bb57d135eaff91c08ff35c142d00cd619e0ed658
[oweals/openwrt.git] /
1 From 2a5b35b90041f190656984ee9299e0edf8e272e2 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Wed, 21 Feb 2018 15:23:35 +0000
4 Subject: [PATCH 397/454] staging: bcm2835-camera: Reduce length of enum names
5
6 We have numerous lines over 80 chars, or oddly split. Many
7 of these are due to using long enum names such as
8 MMAL_COMPONENT_CAMERA.
9 Reduce the length of these enum names.
10
11 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
12 ---
13  .../bcm2835-camera/bcm2835-camera.c           | 163 +++++++++---------
14  .../bcm2835-camera/bcm2835-camera.h           |  20 +--
15  .../vc04_services/bcm2835-camera/controls.c   |  47 +++--
16  3 files changed, 113 insertions(+), 117 deletions(-)
17
18 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
19 +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
20 @@ -87,7 +87,7 @@ static struct mmal_fmt formats[] = {
21                 .flags = 0,
22                 .mmal = MMAL_ENCODING_I420,
23                 .depth = 12,
24 -               .mmal_component = MMAL_COMPONENT_CAMERA,
25 +               .mmal_component = COMP_CAMERA,
26                 .ybbp = 1,
27                 .remove_padding = 1,
28         }, {
29 @@ -96,7 +96,7 @@ static struct mmal_fmt formats[] = {
30                 .flags = 0,
31                 .mmal = MMAL_ENCODING_YUYV,
32                 .depth = 16,
33 -               .mmal_component = MMAL_COMPONENT_CAMERA,
34 +               .mmal_component = COMP_CAMERA,
35                 .ybbp = 2,
36                 .remove_padding = 0,
37         }, {
38 @@ -105,7 +105,7 @@ static struct mmal_fmt formats[] = {
39                 .flags = 0,
40                 .mmal = MMAL_ENCODING_RGB24,
41                 .depth = 24,
42 -               .mmal_component = MMAL_COMPONENT_CAMERA,
43 +               .mmal_component = COMP_CAMERA,
44                 .ybbp = 3,
45                 .remove_padding = 0,
46         }, {
47 @@ -114,7 +114,7 @@ static struct mmal_fmt formats[] = {
48                 .flags = V4L2_FMT_FLAG_COMPRESSED,
49                 .mmal = MMAL_ENCODING_JPEG,
50                 .depth = 8,
51 -               .mmal_component = MMAL_COMPONENT_IMAGE_ENCODE,
52 +               .mmal_component = COMP_IMAGE_ENCODE,
53                 .ybbp = 0,
54                 .remove_padding = 0,
55         }, {
56 @@ -123,7 +123,7 @@ static struct mmal_fmt formats[] = {
57                 .flags = V4L2_FMT_FLAG_COMPRESSED,
58                 .mmal = MMAL_ENCODING_H264,
59                 .depth = 8,
60 -               .mmal_component = MMAL_COMPONENT_VIDEO_ENCODE,
61 +               .mmal_component = COMP_VIDEO_ENCODE,
62                 .ybbp = 0,
63                 .remove_padding = 0,
64         }, {
65 @@ -132,7 +132,7 @@ static struct mmal_fmt formats[] = {
66                 .flags = V4L2_FMT_FLAG_COMPRESSED,
67                 .mmal = MMAL_ENCODING_MJPEG,
68                 .depth = 8,
69 -               .mmal_component = MMAL_COMPONENT_VIDEO_ENCODE,
70 +               .mmal_component = COMP_VIDEO_ENCODE,
71                 .ybbp = 0,
72                 .remove_padding = 0,
73         }, {
74 @@ -141,7 +141,7 @@ static struct mmal_fmt formats[] = {
75                 .flags = 0,
76                 .mmal = MMAL_ENCODING_YVYU,
77                 .depth = 16,
78 -               .mmal_component = MMAL_COMPONENT_CAMERA,
79 +               .mmal_component = COMP_CAMERA,
80                 .ybbp = 2,
81                 .remove_padding = 0,
82         }, {
83 @@ -150,7 +150,7 @@ static struct mmal_fmt formats[] = {
84                 .flags = 0,
85                 .mmal = MMAL_ENCODING_VYUY,
86                 .depth = 16,
87 -               .mmal_component = MMAL_COMPONENT_CAMERA,
88 +               .mmal_component = COMP_CAMERA,
89                 .ybbp = 2,
90                 .remove_padding = 0,
91         }, {
92 @@ -159,7 +159,7 @@ static struct mmal_fmt formats[] = {
93                 .flags = 0,
94                 .mmal = MMAL_ENCODING_UYVY,
95                 .depth = 16,
96 -               .mmal_component = MMAL_COMPONENT_CAMERA,
97 +               .mmal_component = COMP_CAMERA,
98                 .ybbp = 2,
99                 .remove_padding = 0,
100         }, {
101 @@ -168,7 +168,7 @@ static struct mmal_fmt formats[] = {
102                 .flags = 0,
103                 .mmal = MMAL_ENCODING_NV12,
104                 .depth = 12,
105 -               .mmal_component = MMAL_COMPONENT_CAMERA,
106 +               .mmal_component = COMP_CAMERA,
107                 .ybbp = 1,
108                 .remove_padding = 1,
109         }, {
110 @@ -177,7 +177,7 @@ static struct mmal_fmt formats[] = {
111                 .flags = 0,
112                 .mmal = MMAL_ENCODING_BGR24,
113                 .depth = 24,
114 -               .mmal_component = MMAL_COMPONENT_CAMERA,
115 +               .mmal_component = COMP_CAMERA,
116                 .ybbp = 3,
117                 .remove_padding = 0,
118         }, {
119 @@ -186,7 +186,7 @@ static struct mmal_fmt formats[] = {
120                 .flags = 0,
121                 .mmal = MMAL_ENCODING_YV12,
122                 .depth = 12,
123 -               .mmal_component = MMAL_COMPONENT_CAMERA,
124 +               .mmal_component = COMP_CAMERA,
125                 .ybbp = 1,
126                 .remove_padding = 1,
127         }, {
128 @@ -195,7 +195,7 @@ static struct mmal_fmt formats[] = {
129                 .flags = 0,
130                 .mmal = MMAL_ENCODING_NV21,
131                 .depth = 12,
132 -               .mmal_component = MMAL_COMPONENT_CAMERA,
133 +               .mmal_component = COMP_CAMERA,
134                 .ybbp = 1,
135                 .remove_padding = 1,
136         }, {
137 @@ -204,7 +204,7 @@ static struct mmal_fmt formats[] = {
138                 .flags = 0,
139                 .mmal = MMAL_ENCODING_BGRA,
140                 .depth = 32,
141 -               .mmal_component = MMAL_COMPONENT_CAMERA,
142 +               .mmal_component = COMP_CAMERA,
143                 .ybbp = 4,
144                 .remove_padding = 0,
145         },
146 @@ -321,7 +321,7 @@ static inline bool is_capturing(struct b
147  {
148         return dev->capture.camera_port ==
149             &dev->
150 -           component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_CAPTURE];
151 +           component[COMP_CAMERA]->output[CAM_PORT_CAPTURE];
152  }
153  
154  static void buffer_cb(struct vchiq_mmal_instance *instance,
155 @@ -443,7 +443,7 @@ static int enable_camera(struct bm2835_m
156         if (!dev->camera_use_count) {
157                 ret = vchiq_mmal_port_parameter_set(
158                         dev->instance,
159 -                       &dev->component[MMAL_COMPONENT_CAMERA]->control,
160 +                       &dev->component[COMP_CAMERA]->control,
161                         MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num,
162                         sizeof(dev->camera_num));
163                 if (ret < 0) {
164 @@ -454,7 +454,7 @@ static int enable_camera(struct bm2835_m
165  
166                 ret = vchiq_mmal_component_enable(
167                                 dev->instance,
168 -                               dev->component[MMAL_COMPONENT_CAMERA]);
169 +                               dev->component[COMP_CAMERA]);
170                 if (ret < 0) {
171                         v4l2_err(&dev->v4l2_dev,
172                                  "Failed enabling camera, ret %d\n", ret);
173 @@ -486,7 +486,7 @@ static int disable_camera(struct bm2835_
174                 ret =
175                     vchiq_mmal_component_disable(
176                                 dev->instance,
177 -                               dev->component[MMAL_COMPONENT_CAMERA]);
178 +                               dev->component[COMP_CAMERA]);
179                 if (ret < 0) {
180                         v4l2_err(&dev->v4l2_dev,
181                                  "Failed disabling camera, ret %d\n", ret);
182 @@ -494,7 +494,7 @@ static int disable_camera(struct bm2835_
183                 }
184                 vchiq_mmal_port_parameter_set(
185                         dev->instance,
186 -                       &dev->component[MMAL_COMPONENT_CAMERA]->control,
187 +                       &dev->component[COMP_CAMERA]->control,
188                         MMAL_PARAMETER_CAMERA_NUM, &i,
189                         sizeof(i));
190         }
191 @@ -546,7 +546,7 @@ static int start_streaming(struct vb2_qu
192         /* if the preview is not already running, wait for a few frames for AGC
193          * to settle down.
194          */
195 -       if (!dev->component[MMAL_COMPONENT_PREVIEW]->enabled)
196 +       if (!dev->component[COMP_PREVIEW]->enabled)
197                 msleep(300);
198  
199         /* enable the connection from camera to encoder (if applicable) */
200 @@ -784,9 +784,9 @@ static int vidioc_s_fmt_vid_overlay(stru
201         vidioc_try_fmt_vid_overlay(file, priv, f);
202  
203         dev->overlay = f->fmt.win;
204 -       if (dev->component[MMAL_COMPONENT_PREVIEW]->enabled) {
205 +       if (dev->component[COMP_PREVIEW]->enabled) {
206                 set_overlay_params(dev,
207 -                                  &dev->component[MMAL_COMPONENT_PREVIEW]->input[0]);
208 +                                  &dev->component[COMP_PREVIEW]->input[0]);
209         }
210  
211         return 0;
212 @@ -799,13 +799,13 @@ static int vidioc_overlay(struct file *f
213         struct vchiq_mmal_port *src;
214         struct vchiq_mmal_port *dst;
215  
216 -       if ((on && dev->component[MMAL_COMPONENT_PREVIEW]->enabled) ||
217 -           (!on && !dev->component[MMAL_COMPONENT_PREVIEW]->enabled))
218 +       if ((on && dev->component[COMP_PREVIEW]->enabled) ||
219 +           (!on && !dev->component[COMP_PREVIEW]->enabled))
220                 return 0;       /* already in requested state */
221  
222         src =
223 -           &dev->component[MMAL_COMPONENT_CAMERA]->
224 -           output[MMAL_CAMERA_PORT_PREVIEW];
225 +           &dev->component[COMP_CAMERA]->
226 +           output[CAM_PORT_PREVIEW];
227  
228         if (!on) {
229                 /* disconnect preview ports and disable component */
230 @@ -817,14 +817,14 @@ static int vidioc_overlay(struct file *f
231                 if (ret >= 0)
232                         ret = vchiq_mmal_component_disable(
233                                         dev->instance,
234 -                                       dev->component[MMAL_COMPONENT_PREVIEW]);
235 +                                       dev->component[COMP_PREVIEW]);
236  
237                 disable_camera(dev);
238                 return ret;
239         }
240  
241         /* set preview port format and connect it to output */
242 -       dst = &dev->component[MMAL_COMPONENT_PREVIEW]->input[0];
243 +       dst = &dev->component[COMP_PREVIEW]->input[0];
244  
245         ret = vchiq_mmal_port_set_format(dev->instance, src);
246         if (ret < 0)
247 @@ -839,7 +839,7 @@ static int vidioc_overlay(struct file *f
248  
249         ret = vchiq_mmal_component_enable(
250                         dev->instance,
251 -                       dev->component[MMAL_COMPONENT_PREVIEW]);
252 +                       dev->component[COMP_PREVIEW]);
253         if (ret < 0)
254                 return ret;
255  
256 @@ -860,8 +860,8 @@ static int vidioc_g_fbuf(struct file *fi
257          */
258         struct bm2835_mmal_dev *dev = video_drvdata(file);
259         struct vchiq_mmal_port *preview_port =
260 -                   &dev->component[MMAL_COMPONENT_CAMERA]->
261 -                   output[MMAL_CAMERA_PORT_PREVIEW];
262 +               &dev->component[COMP_CAMERA]->
263 +               output[CAM_PORT_PREVIEW];
264  
265         a->capability = V4L2_FBUF_CAP_EXTERNOVERLAY |
266                         V4L2_FBUF_CAP_GLOBAL_ALPHA;
267 @@ -1064,31 +1064,31 @@ static int mmal_setup_components(struct
268         }
269         /* format dependent port setup */
270         switch (mfmt->mmal_component) {
271 -       case MMAL_COMPONENT_CAMERA:
272 +       case COMP_CAMERA:
273                 /* Make a further decision on port based on resolution */
274                 if (f->fmt.pix.width <= max_video_width
275                     && f->fmt.pix.height <= max_video_height)
276                         camera_port = port =
277 -                           &dev->component[MMAL_COMPONENT_CAMERA]->
278 -                           output[MMAL_CAMERA_PORT_VIDEO];
279 +                           &dev->component[COMP_CAMERA]->
280 +                           output[CAM_PORT_VIDEO];
281                 else
282                         camera_port = port =
283 -                           &dev->component[MMAL_COMPONENT_CAMERA]->
284 -                           output[MMAL_CAMERA_PORT_CAPTURE];
285 +                           &dev->component[COMP_CAMERA]->
286 +                           output[CAM_PORT_CAPTURE];
287                 break;
288 -       case MMAL_COMPONENT_IMAGE_ENCODE:
289 -               encode_component = dev->component[MMAL_COMPONENT_IMAGE_ENCODE];
290 -               port = &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->output[0];
291 +       case COMP_IMAGE_ENCODE:
292 +               encode_component = dev->component[COMP_IMAGE_ENCODE];
293 +               port = &dev->component[COMP_IMAGE_ENCODE]->output[0];
294                 camera_port =
295 -                   &dev->component[MMAL_COMPONENT_CAMERA]->
296 -                   output[MMAL_CAMERA_PORT_CAPTURE];
297 +                   &dev->component[COMP_CAMERA]->
298 +                   output[CAM_PORT_CAPTURE];
299                 break;
300 -       case MMAL_COMPONENT_VIDEO_ENCODE:
301 -               encode_component = dev->component[MMAL_COMPONENT_VIDEO_ENCODE];
302 -               port = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0];
303 +       case COMP_VIDEO_ENCODE:
304 +               encode_component = dev->component[COMP_VIDEO_ENCODE];
305 +               port = &dev->component[COMP_VIDEO_ENCODE]->output[0];
306                 camera_port =
307 -                   &dev->component[MMAL_COMPONENT_CAMERA]->
308 -                   output[MMAL_CAMERA_PORT_VIDEO];
309 +                   &dev->component[COMP_CAMERA]->
310 +                   output[CAM_PORT_VIDEO];
311                 break;
312         default:
313                 break;
314 @@ -1130,13 +1130,12 @@ static int mmal_setup_components(struct
315  
316         if (!ret
317             && camera_port ==
318 -           &dev->component[MMAL_COMPONENT_CAMERA]->
319 -           output[MMAL_CAMERA_PORT_VIDEO]) {
320 +           &dev->component[COMP_CAMERA]->
321 +           output[CAM_PORT_VIDEO]) {
322                 bool overlay_enabled =
323 -                   !!dev->component[MMAL_COMPONENT_PREVIEW]->enabled;
324 +                   !!dev->component[COMP_PREVIEW]->enabled;
325                 struct vchiq_mmal_port *preview_port =
326 -                   &dev->component[MMAL_COMPONENT_CAMERA]->
327 -                   output[MMAL_CAMERA_PORT_PREVIEW];
328 +                   &dev->component[COMP_CAMERA]->output[CAM_PORT_PREVIEW];
329                 /* Preview and encode ports need to match on resolution */
330                 if (overlay_enabled) {
331                         /* Need to disable the overlay before we can update
332 @@ -1167,7 +1166,7 @@ static int mmal_setup_components(struct
333                         ret = vchiq_mmal_port_connect_tunnel(
334                                 dev->instance,
335                                 preview_port,
336 -                               &dev->component[MMAL_COMPONENT_PREVIEW]->input[0]);
337 +                               &dev->component[COMP_PREVIEW]->input[0]);
338                         if (!ret)
339                                 ret = vchiq_mmal_port_enable(dev->instance,
340                                                              preview_port,
341 @@ -1221,11 +1220,11 @@ static int mmal_setup_components(struct
342                                 port->format.encoding_variant = 0;
343                                 /* Set any encoding specific parameters */
344                                 switch (mfmt->mmal_component) {
345 -                               case MMAL_COMPONENT_VIDEO_ENCODE:
346 +                               case COMP_VIDEO_ENCODE:
347                                         port->format.bitrate =
348                                             dev->capture.encode_bitrate;
349                                         break;
350 -                               case MMAL_COMPONENT_IMAGE_ENCODE:
351 +                               case COMP_IMAGE_ENCODE:
352                                         /* Could set EXIF parameters here */
353                                         break;
354                                 default:
355 @@ -1597,12 +1596,12 @@ static int __init mmal_init(struct bm283
356  
357         /* get the camera component ready */
358         ret = vchiq_mmal_component_init(dev->instance, "ril.camera",
359 -                                       &dev->component[MMAL_COMPONENT_CAMERA]);
360 +                                       &dev->component[COMP_CAMERA]);
361         if (ret < 0)
362                 goto unreg_mmal;
363  
364 -       camera = dev->component[MMAL_COMPONENT_CAMERA];
365 -       if (camera->outputs <  MMAL_CAMERA_PORT_COUNT) {
366 +       camera = dev->component[COMP_CAMERA];
367 +       if (camera->outputs <  CAM_PORT_COUNT) {
368                 ret = -EINVAL;
369                 goto unreg_camera;
370         }
371 @@ -1621,7 +1620,7 @@ static int __init mmal_init(struct bm283
372         dev->rgb_bgr_swapped = true;
373         param_size = sizeof(supported_encodings);
374         ret = vchiq_mmal_port_parameter_get(dev->instance,
375 -                                           &camera->output[MMAL_CAMERA_PORT_CAPTURE],
376 +                                           &camera->output[CAM_PORT_CAPTURE],
377                                             MMAL_PARAMETER_SUPPORTED_ENCODINGS,
378                                             &supported_encodings,
379                                             &param_size);
380 @@ -1642,7 +1641,7 @@ static int __init mmal_init(struct bm283
381                         }
382                 }
383         }
384 -       format = &camera->output[MMAL_CAMERA_PORT_PREVIEW].format;
385 +       format = &camera->output[CAM_PORT_PREVIEW].format;
386  
387         format->encoding = MMAL_ENCODING_OPAQUE;
388         format->encoding_variant = MMAL_ENCODING_I420;
389 @@ -1656,7 +1655,7 @@ static int __init mmal_init(struct bm283
390         format->es->video.frame_rate.num = 0; /* Rely on fps_range */
391         format->es->video.frame_rate.den = 1;
392  
393 -       format = &camera->output[MMAL_CAMERA_PORT_VIDEO].format;
394 +       format = &camera->output[CAM_PORT_VIDEO].format;
395  
396         format->encoding = MMAL_ENCODING_OPAQUE;
397         format->encoding_variant = MMAL_ENCODING_I420;
398 @@ -1670,7 +1669,7 @@ static int __init mmal_init(struct bm283
399         format->es->video.frame_rate.num = 0; /* Rely on fps_range */
400         format->es->video.frame_rate.den = 1;
401  
402 -       format = &camera->output[MMAL_CAMERA_PORT_CAPTURE].format;
403 +       format = &camera->output[CAM_PORT_CAPTURE].format;
404  
405         format->encoding = MMAL_ENCODING_OPAQUE;
406  
407 @@ -1694,28 +1693,28 @@ static int __init mmal_init(struct bm283
408         /* get the preview component ready */
409         ret = vchiq_mmal_component_init(
410                         dev->instance, "ril.video_render",
411 -                       &dev->component[MMAL_COMPONENT_PREVIEW]);
412 +                       &dev->component[COMP_PREVIEW]);
413         if (ret < 0)
414                 goto unreg_camera;
415  
416 -       if (dev->component[MMAL_COMPONENT_PREVIEW]->inputs < 1) {
417 +       if (dev->component[COMP_PREVIEW]->inputs < 1) {
418                 ret = -EINVAL;
419                 pr_debug("too few input ports %d needed %d\n",
420 -                        dev->component[MMAL_COMPONENT_PREVIEW]->inputs, 1);
421 +                        dev->component[COMP_PREVIEW]->inputs, 1);
422                 goto unreg_preview;
423         }
424  
425         /* get the image encoder component ready */
426         ret = vchiq_mmal_component_init(
427                 dev->instance, "ril.image_encode",
428 -               &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]);
429 +               &dev->component[COMP_IMAGE_ENCODE]);
430         if (ret < 0)
431                 goto unreg_preview;
432  
433 -       if (dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs < 1) {
434 +       if (dev->component[COMP_IMAGE_ENCODE]->inputs < 1) {
435                 ret = -EINVAL;
436                 v4l2_err(&dev->v4l2_dev, "too few input ports %d needed %d\n",
437 -                        dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs,
438 +                        dev->component[COMP_IMAGE_ENCODE]->inputs,
439                          1);
440                 goto unreg_image_encoder;
441         }
442 @@ -1723,21 +1722,21 @@ static int __init mmal_init(struct bm283
443         /* get the video encoder component ready */
444         ret = vchiq_mmal_component_init(dev->instance, "ril.video_encode",
445                                         &dev->
446 -                                       component[MMAL_COMPONENT_VIDEO_ENCODE]);
447 +                                       component[COMP_VIDEO_ENCODE]);
448         if (ret < 0)
449                 goto unreg_image_encoder;
450  
451 -       if (dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs < 1) {
452 +       if (dev->component[COMP_VIDEO_ENCODE]->inputs < 1) {
453                 ret = -EINVAL;
454                 v4l2_err(&dev->v4l2_dev, "too few input ports %d needed %d\n",
455 -                        dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs,
456 +                        dev->component[COMP_VIDEO_ENCODE]->inputs,
457                          1);
458                 goto unreg_vid_encoder;
459         }
460  
461         {
462                 struct vchiq_mmal_port *encoder_port =
463 -                       &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0];
464 +                       &dev->component[COMP_VIDEO_ENCODE]->output[0];
465                 encoder_port->format.encoding = MMAL_ENCODING_H264;
466                 ret = vchiq_mmal_port_set_format(dev->instance,
467                                                  encoder_port);
468 @@ -1748,12 +1747,12 @@ static int __init mmal_init(struct bm283
469  
470                 vchiq_mmal_port_parameter_set(
471                         dev->instance,
472 -                       &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->control,
473 +                       &dev->component[COMP_VIDEO_ENCODE]->control,
474                         MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT,
475                         &enable, sizeof(enable));
476  
477                 vchiq_mmal_port_parameter_set(dev->instance,
478 -                                             &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->control,
479 +                                             &dev->component[COMP_VIDEO_ENCODE]->control,
480                                               MMAL_PARAMETER_MINIMISE_FRAGMENTATION,
481                                               &enable,
482                                               sizeof(enable));
483 @@ -1768,23 +1767,23 @@ unreg_vid_encoder:
484         pr_err("Cleanup: Destroy video encoder\n");
485         vchiq_mmal_component_finalise(
486                 dev->instance,
487 -               dev->component[MMAL_COMPONENT_VIDEO_ENCODE]);
488 +               dev->component[COMP_VIDEO_ENCODE]);
489  
490  unreg_image_encoder:
491         pr_err("Cleanup: Destroy image encoder\n");
492         vchiq_mmal_component_finalise(
493                 dev->instance,
494 -               dev->component[MMAL_COMPONENT_IMAGE_ENCODE]);
495 +               dev->component[COMP_IMAGE_ENCODE]);
496  
497  unreg_preview:
498         pr_err("Cleanup: Destroy video render\n");
499         vchiq_mmal_component_finalise(dev->instance,
500 -                                     dev->component[MMAL_COMPONENT_PREVIEW]);
501 +                                     dev->component[COMP_PREVIEW]);
502  
503  unreg_camera:
504         pr_err("Cleanup: Destroy camera\n");
505         vchiq_mmal_component_finalise(dev->instance,
506 -                                     dev->component[MMAL_COMPONENT_CAMERA]);
507 +                                     dev->component[COMP_CAMERA]);
508  
509  unreg_mmal:
510         vchiq_mmal_finalise(dev->instance);
511 @@ -1840,21 +1839,21 @@ static void bcm2835_cleanup_instance(str
512                                              dev->capture.encode_component);
513         }
514         vchiq_mmal_component_disable(dev->instance,
515 -                                    dev->component[MMAL_COMPONENT_CAMERA]);
516 +                                    dev->component[COMP_CAMERA]);
517  
518         vchiq_mmal_component_finalise(dev->instance,
519                                       dev->
520 -                                     component[MMAL_COMPONENT_VIDEO_ENCODE]);
521 +                                     component[COMP_VIDEO_ENCODE]);
522  
523         vchiq_mmal_component_finalise(dev->instance,
524                                       dev->
525 -                                     component[MMAL_COMPONENT_IMAGE_ENCODE]);
526 +                                     component[COMP_IMAGE_ENCODE]);
527  
528         vchiq_mmal_component_finalise(dev->instance,
529 -                                     dev->component[MMAL_COMPONENT_PREVIEW]);
530 +                                     dev->component[COMP_PREVIEW]);
531  
532         vchiq_mmal_component_finalise(dev->instance,
533 -                                     dev->component[MMAL_COMPONENT_CAMERA]);
534 +                                     dev->component[COMP_CAMERA]);
535  
536         v4l2_ctrl_handler_free(&dev->ctrl_handler);
537  
538 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.h
539 +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.h
540 @@ -19,18 +19,18 @@
541  #define V4L2_CTRL_COUNT 29 /* number of v4l controls */
542  
543  enum {
544 -       MMAL_COMPONENT_CAMERA = 0,
545 -       MMAL_COMPONENT_PREVIEW,
546 -       MMAL_COMPONENT_IMAGE_ENCODE,
547 -       MMAL_COMPONENT_VIDEO_ENCODE,
548 -       MMAL_COMPONENT_COUNT
549 +       COMP_CAMERA = 0,
550 +       COMP_PREVIEW,
551 +       COMP_IMAGE_ENCODE,
552 +       COMP_VIDEO_ENCODE,
553 +       COMP_COUNT
554  };
555  
556  enum {
557 -       MMAL_CAMERA_PORT_PREVIEW = 0,
558 -       MMAL_CAMERA_PORT_VIDEO,
559 -       MMAL_CAMERA_PORT_CAPTURE,
560 -       MMAL_CAMERA_PORT_COUNT
561 +       CAM_PORT_PREVIEW = 0,
562 +       CAM_PORT_VIDEO,
563 +       CAM_PORT_CAPTURE,
564 +       CAM_PORT_COUNT
565  };
566  
567  #define PREVIEW_LAYER      2
568 @@ -64,7 +64,7 @@ struct bm2835_mmal_dev {
569  
570         /* allocated mmal instance and components */
571         struct vchiq_mmal_instance   *instance;
572 -       struct vchiq_mmal_component  *component[MMAL_COMPONENT_COUNT];
573 +       struct vchiq_mmal_component  *component[COMP_COUNT];
574         int camera_use_count;
575  
576         struct v4l2_window overlay;
577 --- a/drivers/staging/vc04_services/bcm2835-camera/controls.c
578 +++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c
579 @@ -179,7 +179,7 @@ static int ctrl_set_rational(struct bm28
580         struct mmal_parameter_rational rational_value;
581         struct vchiq_mmal_port *control;
582  
583 -       control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
584 +       control = &dev->component[COMP_CAMERA]->control;
585  
586         rational_value.num = ctrl->val;
587         rational_value.den = 100;
588 @@ -197,7 +197,7 @@ static int ctrl_set_value(struct bm2835_
589         u32 u32_value;
590         struct vchiq_mmal_port *control;
591  
592 -       control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
593 +       control = &dev->component[COMP_CAMERA]->control;
594  
595         u32_value = ctrl->val;
596  
597 @@ -222,7 +222,7 @@ static int ctrl_set_iso(struct bm2835_mm
598                 dev->manual_iso_enabled =
599                                 (ctrl->val == V4L2_ISO_SENSITIVITY_MANUAL);
600  
601 -       control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
602 +       control = &dev->component[COMP_CAMERA]->control;
603  
604         if (dev->manual_iso_enabled)
605                 u32_value = dev->iso;
606 @@ -241,7 +241,7 @@ static int ctrl_set_value_ev(struct bm28
607         s32 s32_value;
608         struct vchiq_mmal_port *control;
609  
610 -       control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
611 +       control = &dev->component[COMP_CAMERA]->control;
612  
613         s32_value = (ctrl->val - 12) * 2;       /* Convert from index to 1/6ths */
614  
615 @@ -258,7 +258,7 @@ static int ctrl_set_rotate(struct bm2835
616         u32 u32_value;
617         struct vchiq_mmal_component *camera;
618  
619 -       camera = dev->component[MMAL_COMPONENT_CAMERA];
620 +       camera = dev->component[COMP_CAMERA];
621  
622         u32_value = ((ctrl->val % 360) / 90) * 90;
623  
624 @@ -294,7 +294,7 @@ static int ctrl_set_flip(struct bm2835_m
625         else
626                 dev->vflip = ctrl->val;
627  
628 -       camera = dev->component[MMAL_COMPONENT_CAMERA];
629 +       camera = dev->component[COMP_CAMERA];
630  
631         if (dev->hflip && dev->vflip)
632                 u32_value = MMAL_PARAM_MIRROR_BOTH;
633 @@ -333,7 +333,7 @@ static int ctrl_set_exposure(struct bm28
634         struct vchiq_mmal_port *control;
635         int ret = 0;
636  
637 -       control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
638 +       control = &dev->component[COMP_CAMERA]->control;
639  
640         if (mmal_ctrl->mmal_id == MMAL_PARAMETER_SHUTTER_SPEED) {
641                 /* V4L2 is in 100usec increments.
642 @@ -408,7 +408,7 @@ static int ctrl_set_metering_mode(struct
643                 struct vchiq_mmal_port *control;
644                 u32 u32_value = dev->metering_mode;
645  
646 -               control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
647 +               control = &dev->component[COMP_CAMERA]->control;
648  
649                 return vchiq_mmal_port_parameter_set(dev->instance, control,
650                                              mmal_ctrl->mmal_id,
651 @@ -424,7 +424,7 @@ static int ctrl_set_flicker_avoidance(st
652         u32 u32_value;
653         struct vchiq_mmal_port *control;
654  
655 -       control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
656 +       control = &dev->component[COMP_CAMERA]->control;
657  
658         switch (ctrl->val) {
659         case V4L2_CID_POWER_LINE_FREQUENCY_DISABLED:
660 @@ -453,7 +453,7 @@ static int ctrl_set_awb_mode(struct bm28
661         u32 u32_value;
662         struct vchiq_mmal_port *control;
663  
664 -       control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
665 +       control = &dev->component[COMP_CAMERA]->control;
666  
667         switch (ctrl->val) {
668         case V4L2_WHITE_BALANCE_MANUAL:
669 @@ -509,7 +509,7 @@ static int ctrl_set_awb_gains(struct bm2
670         struct vchiq_mmal_port *control;
671         struct mmal_parameter_awbgains gains;
672  
673 -       control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
674 +       control = &dev->component[COMP_CAMERA]->control;
675  
676         if (ctrl->id == V4L2_CID_RED_BALANCE)
677                 dev->red_gain = ctrl->val;
678 @@ -557,7 +557,7 @@ static int ctrl_set_image_effect(struct
679                                         v4l2_to_mmal_effects_values[i].v;
680                         }
681  
682 -                       control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
683 +                       control = &dev->component[COMP_CAMERA]->control;
684  
685                         ret = vchiq_mmal_port_parameter_set(
686                                         dev->instance, control,
687 @@ -590,7 +590,7 @@ static int ctrl_set_colfx(struct bm2835_
688         int ret = -EINVAL;
689         struct vchiq_mmal_port *control;
690  
691 -       control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
692 +       control = &dev->component[COMP_CAMERA]->control;
693  
694         dev->colourfx.enable = (ctrl->val & 0xff00) >> 8;
695         dev->colourfx.enable = ctrl->val & 0xff;
696 @@ -616,7 +616,7 @@ static int ctrl_set_bitrate(struct bm283
697  
698         dev->capture.encode_bitrate = ctrl->val;
699  
700 -       encoder_out = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0];
701 +       encoder_out = &dev->component[COMP_VIDEO_ENCODE]->output[0];
702  
703         ret = vchiq_mmal_port_parameter_set(dev->instance, encoder_out,
704                                             mmal_ctrl->mmal_id,
705 @@ -632,7 +632,7 @@ static int ctrl_set_bitrate_mode(struct
706         u32 bitrate_mode;
707         struct vchiq_mmal_port *encoder_out;
708  
709 -       encoder_out = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0];
710 +       encoder_out = &dev->component[COMP_VIDEO_ENCODE]->output[0];
711  
712         dev->capture.encode_bitrate_mode = ctrl->val;
713         switch (ctrl->val) {
714 @@ -659,7 +659,7 @@ static int ctrl_set_image_encode_output(
715         u32 u32_value;
716         struct vchiq_mmal_port *jpeg_out;
717  
718 -       jpeg_out = &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->output[0];
719 +       jpeg_out = &dev->component[COMP_IMAGE_ENCODE]->output[0];
720  
721         u32_value = ctrl->val;
722  
723 @@ -675,7 +675,7 @@ static int ctrl_set_video_encode_param_o
724         u32 u32_value;
725         struct vchiq_mmal_port *vid_enc_ctl;
726  
727 -       vid_enc_ctl = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0];
728 +       vid_enc_ctl = &dev->component[COMP_VIDEO_ENCODE]->output[0];
729  
730         u32_value = ctrl->val;
731  
732 @@ -788,7 +788,7 @@ static int ctrl_set_video_encode_profile
733                 }
734  
735                 ret = vchiq_mmal_port_parameter_set(dev->instance,
736 -                                                   &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0],
737 +                                                   &dev->component[COMP_VIDEO_ENCODE]->output[0],
738                         mmal_ctrl->mmal_id,
739                         &param, sizeof(param));
740         }
741 @@ -806,7 +806,7 @@ static int ctrl_set_scene_mode(struct bm
742         v4l2_dbg(0, bcm2835_v4l2_debug, &dev->v4l2_dev,
743                  "scene mode selected %d, was %d\n", ctrl->val,
744                  dev->scene_mode);
745 -       control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
746 +       control = &dev->component[COMP_CAMERA]->control;
747  
748         if (ctrl->val == dev->scene_mode)
749                 return 0;
750 @@ -1224,18 +1224,15 @@ int set_framerate_params(struct bm2835_m
751                  fps_range.fps_high.den);
752  
753         ret = vchiq_mmal_port_parameter_set(dev->instance,
754 -                                           &dev->component[MMAL_COMPONENT_CAMERA]->
755 -                                           output[MMAL_CAMERA_PORT_PREVIEW],
756 +                                           &dev->component[COMP_CAMERA]->output[CAM_PORT_PREVIEW],
757                                             MMAL_PARAMETER_FPS_RANGE,
758                                             &fps_range, sizeof(fps_range));
759         ret += vchiq_mmal_port_parameter_set(dev->instance,
760 -                                            &dev->component[MMAL_COMPONENT_CAMERA]->
761 -                                            output[MMAL_CAMERA_PORT_VIDEO],
762 +                                            &dev->component[COMP_CAMERA]->output[CAM_PORT_VIDEO],
763                                              MMAL_PARAMETER_FPS_RANGE,
764                                              &fps_range, sizeof(fps_range));
765         ret += vchiq_mmal_port_parameter_set(dev->instance,
766 -                                            &dev->component[MMAL_COMPONENT_CAMERA]->
767 -                                            output[MMAL_CAMERA_PORT_CAPTURE],
768 +                                            &dev->component[COMP_CAMERA]->output[CAM_PORT_CAPTURE],
769                                              MMAL_PARAMETER_FPS_RANGE,
770                                              &fps_range, sizeof(fps_range));
771         if (ret)