f6fa4ae3d6cf4b8440a0a71ed277c3abb5c3e8d9
[openwrt/staging/blogic.git] /
1 From 75aca02c1449e3a97ec32de9974ad410f5d34463 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 246/806] 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 | 165 +++++++++---------
14 .../bcm2835-camera/bcm2835-camera.h | 20 +--
15 .../vc04_services/bcm2835-camera/controls.c | 47 +++--
16 3 files changed, 114 insertions(+), 118 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 @@ -80,7 +80,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 @@ -89,7 +89,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 @@ -98,7 +98,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 @@ -107,7 +107,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 @@ -116,7 +116,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 @@ -125,7 +125,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 @@ -134,7 +134,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 @@ -143,7 +143,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 @@ -152,7 +152,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 @@ -161,7 +161,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 @@ -170,7 +170,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 @@ -179,7 +179,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 @@ -188,7 +188,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 @@ -197,7 +197,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 @@ -314,7 +314,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 @@ -439,7 +439,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 @@ -450,7 +450,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 @@ -482,7 +482,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 @@ -490,7 +490,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 @@ -542,7 +542,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 @@ -775,9 +775,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 @@ -790,13 +790,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 @@ -808,14 +808,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 @@ -832,7 +832,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 @@ -853,8 +853,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 @@ -1057,31 +1057,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 @@ -1123,13 +1123,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 @@ -1160,7 +1159,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 @@ -1214,11 +1213,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 @@ -1593,14 +1592,14 @@ static int mmal_init(struct bm2835_mmal_
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 v4l2_err(&dev->v4l2_dev, "%s: too few camera outputs %d needed %d\n",
369 - __func__, camera->outputs, MMAL_CAMERA_PORT_COUNT);
370 + __func__, camera->outputs, CAM_PORT_COUNT);
371 ret = -EINVAL;
372 goto unreg_camera;
373 }
374 @@ -1622,7 +1621,7 @@ static int mmal_init(struct bm2835_mmal_
375 dev->rgb_bgr_swapped = true;
376 param_size = sizeof(supported_encodings);
377 ret = vchiq_mmal_port_parameter_get(dev->instance,
378 - &camera->output[MMAL_CAMERA_PORT_CAPTURE],
379 + &camera->output[CAM_PORT_CAPTURE],
380 MMAL_PARAMETER_SUPPORTED_ENCODINGS,
381 &supported_encodings,
382 &param_size);
383 @@ -1643,7 +1642,7 @@ static int mmal_init(struct bm2835_mmal_
384 }
385 }
386 }
387 - format = &camera->output[MMAL_CAMERA_PORT_PREVIEW].format;
388 + format = &camera->output[CAM_PORT_PREVIEW].format;
389
390 format->encoding = MMAL_ENCODING_OPAQUE;
391 format->encoding_variant = MMAL_ENCODING_I420;
392 @@ -1657,7 +1656,7 @@ static int mmal_init(struct bm2835_mmal_
393 format->es->video.frame_rate.num = 0; /* Rely on fps_range */
394 format->es->video.frame_rate.den = 1;
395
396 - format = &camera->output[MMAL_CAMERA_PORT_VIDEO].format;
397 + format = &camera->output[CAM_PORT_VIDEO].format;
398
399 format->encoding = MMAL_ENCODING_OPAQUE;
400 format->encoding_variant = MMAL_ENCODING_I420;
401 @@ -1671,7 +1670,7 @@ static int mmal_init(struct bm2835_mmal_
402 format->es->video.frame_rate.num = 0; /* Rely on fps_range */
403 format->es->video.frame_rate.den = 1;
404
405 - format = &camera->output[MMAL_CAMERA_PORT_CAPTURE].format;
406 + format = &camera->output[CAM_PORT_CAPTURE].format;
407
408 format->encoding = MMAL_ENCODING_OPAQUE;
409
410 @@ -1695,28 +1694,28 @@ static int mmal_init(struct bm2835_mmal_
411 /* get the preview component ready */
412 ret = vchiq_mmal_component_init(
413 dev->instance, "ril.video_render",
414 - &dev->component[MMAL_COMPONENT_PREVIEW]);
415 + &dev->component[COMP_PREVIEW]);
416 if (ret < 0)
417 goto unreg_camera;
418
419 - if (dev->component[MMAL_COMPONENT_PREVIEW]->inputs < 1) {
420 + if (dev->component[COMP_PREVIEW]->inputs < 1) {
421 ret = -EINVAL;
422 v4l2_err(&dev->v4l2_dev, "%s: too few input ports %d needed %d\n",
423 - __func__, dev->component[MMAL_COMPONENT_PREVIEW]->inputs, 1);
424 + __func__, dev->component[COMP_PREVIEW]->inputs, 1);
425 goto unreg_preview;
426 }
427
428 /* get the image encoder component ready */
429 ret = vchiq_mmal_component_init(
430 dev->instance, "ril.image_encode",
431 - &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]);
432 + &dev->component[COMP_IMAGE_ENCODE]);
433 if (ret < 0)
434 goto unreg_preview;
435
436 - if (dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs < 1) {
437 + if (dev->component[COMP_IMAGE_ENCODE]->inputs < 1) {
438 ret = -EINVAL;
439 v4l2_err(&dev->v4l2_dev, "%s: too few input ports %d needed %d\n",
440 - __func__, dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs,
441 + __func__, dev->component[COMP_IMAGE_ENCODE]->inputs,
442 1);
443 goto unreg_image_encoder;
444 }
445 @@ -1724,21 +1723,21 @@ static int mmal_init(struct bm2835_mmal_
446 /* get the video encoder component ready */
447 ret = vchiq_mmal_component_init(dev->instance, "ril.video_encode",
448 &dev->
449 - component[MMAL_COMPONENT_VIDEO_ENCODE]);
450 + component[COMP_VIDEO_ENCODE]);
451 if (ret < 0)
452 goto unreg_image_encoder;
453
454 - if (dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs < 1) {
455 + if (dev->component[COMP_VIDEO_ENCODE]->inputs < 1) {
456 ret = -EINVAL;
457 v4l2_err(&dev->v4l2_dev, "%s: too few input ports %d needed %d\n",
458 - __func__, dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs,
459 + __func__, dev->component[COMP_VIDEO_ENCODE]->inputs,
460 1);
461 goto unreg_vid_encoder;
462 }
463
464 {
465 struct vchiq_mmal_port *encoder_port =
466 - &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0];
467 + &dev->component[COMP_VIDEO_ENCODE]->output[0];
468 encoder_port->format.encoding = MMAL_ENCODING_H264;
469 ret = vchiq_mmal_port_set_format(dev->instance,
470 encoder_port);
471 @@ -1749,12 +1748,12 @@ static int mmal_init(struct bm2835_mmal_
472
473 vchiq_mmal_port_parameter_set(
474 dev->instance,
475 - &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->control,
476 + &dev->component[COMP_VIDEO_ENCODE]->control,
477 MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT,
478 &enable, sizeof(enable));
479
480 vchiq_mmal_port_parameter_set(dev->instance,
481 - &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->control,
482 + &dev->component[COMP_VIDEO_ENCODE]->control,
483 MMAL_PARAMETER_MINIMISE_FRAGMENTATION,
484 &enable,
485 sizeof(enable));
486 @@ -1772,23 +1771,23 @@ unreg_vid_encoder:
487 pr_err("Cleanup: Destroy video encoder\n");
488 vchiq_mmal_component_finalise(
489 dev->instance,
490 - dev->component[MMAL_COMPONENT_VIDEO_ENCODE]);
491 + dev->component[COMP_VIDEO_ENCODE]);
492
493 unreg_image_encoder:
494 pr_err("Cleanup: Destroy image encoder\n");
495 vchiq_mmal_component_finalise(
496 dev->instance,
497 - dev->component[MMAL_COMPONENT_IMAGE_ENCODE]);
498 + dev->component[COMP_IMAGE_ENCODE]);
499
500 unreg_preview:
501 pr_err("Cleanup: Destroy video render\n");
502 vchiq_mmal_component_finalise(dev->instance,
503 - dev->component[MMAL_COMPONENT_PREVIEW]);
504 + dev->component[COMP_PREVIEW]);
505
506 unreg_camera:
507 pr_err("Cleanup: Destroy camera\n");
508 vchiq_mmal_component_finalise(dev->instance,
509 - dev->component[MMAL_COMPONENT_CAMERA]);
510 + dev->component[COMP_CAMERA]);
511
512 unreg_mmal:
513 vchiq_mmal_finalise(dev->instance);
514 @@ -1844,21 +1843,21 @@ static void bcm2835_cleanup_instance(str
515 dev->capture.encode_component);
516 }
517 vchiq_mmal_component_disable(dev->instance,
518 - dev->component[MMAL_COMPONENT_CAMERA]);
519 + dev->component[COMP_CAMERA]);
520
521 vchiq_mmal_component_finalise(dev->instance,
522 dev->
523 - component[MMAL_COMPONENT_VIDEO_ENCODE]);
524 + component[COMP_VIDEO_ENCODE]);
525
526 vchiq_mmal_component_finalise(dev->instance,
527 dev->
528 - component[MMAL_COMPONENT_IMAGE_ENCODE]);
529 + component[COMP_IMAGE_ENCODE]);
530
531 vchiq_mmal_component_finalise(dev->instance,
532 - dev->component[MMAL_COMPONENT_PREVIEW]);
533 + dev->component[COMP_PREVIEW]);
534
535 vchiq_mmal_component_finalise(dev->instance,
536 - dev->component[MMAL_COMPONENT_CAMERA]);
537 + dev->component[COMP_CAMERA]);
538
539 v4l2_ctrl_handler_free(&dev->ctrl_handler);
540
541 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.h
542 +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.h
543 @@ -16,18 +16,18 @@
544 #define V4L2_CTRL_COUNT 29 /* number of v4l controls */
545
546 enum {
547 - MMAL_COMPONENT_CAMERA = 0,
548 - MMAL_COMPONENT_PREVIEW,
549 - MMAL_COMPONENT_IMAGE_ENCODE,
550 - MMAL_COMPONENT_VIDEO_ENCODE,
551 - MMAL_COMPONENT_COUNT
552 + COMP_CAMERA = 0,
553 + COMP_PREVIEW,
554 + COMP_IMAGE_ENCODE,
555 + COMP_VIDEO_ENCODE,
556 + COMP_COUNT
557 };
558
559 enum {
560 - MMAL_CAMERA_PORT_PREVIEW = 0,
561 - MMAL_CAMERA_PORT_VIDEO,
562 - MMAL_CAMERA_PORT_CAPTURE,
563 - MMAL_CAMERA_PORT_COUNT
564 + CAM_PORT_PREVIEW = 0,
565 + CAM_PORT_VIDEO,
566 + CAM_PORT_CAPTURE,
567 + CAM_PORT_COUNT
568 };
569
570 #define PREVIEW_LAYER 2
571 @@ -61,7 +61,7 @@ struct bm2835_mmal_dev {
572
573 /* allocated mmal instance and components */
574 struct vchiq_mmal_instance *instance;
575 - struct vchiq_mmal_component *component[MMAL_COMPONENT_COUNT];
576 + struct vchiq_mmal_component *component[COMP_COUNT];
577 int camera_use_count;
578
579 struct v4l2_window overlay;
580 --- a/drivers/staging/vc04_services/bcm2835-camera/controls.c
581 +++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c
582 @@ -176,7 +176,7 @@ static int ctrl_set_rational(struct bm28
583 struct mmal_parameter_rational rational_value;
584 struct vchiq_mmal_port *control;
585
586 - control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
587 + control = &dev->component[COMP_CAMERA]->control;
588
589 rational_value.num = ctrl->val;
590 rational_value.den = 100;
591 @@ -194,7 +194,7 @@ static int ctrl_set_value(struct bm2835_
592 u32 u32_value;
593 struct vchiq_mmal_port *control;
594
595 - control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
596 + control = &dev->component[COMP_CAMERA]->control;
597
598 u32_value = ctrl->val;
599
600 @@ -219,7 +219,7 @@ static int ctrl_set_iso(struct bm2835_mm
601 dev->manual_iso_enabled =
602 (ctrl->val == V4L2_ISO_SENSITIVITY_MANUAL);
603
604 - control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
605 + control = &dev->component[COMP_CAMERA]->control;
606
607 if (dev->manual_iso_enabled)
608 u32_value = dev->iso;
609 @@ -238,7 +238,7 @@ static int ctrl_set_value_ev(struct bm28
610 s32 s32_value;
611 struct vchiq_mmal_port *control;
612
613 - control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
614 + control = &dev->component[COMP_CAMERA]->control;
615
616 s32_value = (ctrl->val - 12) * 2; /* Convert from index to 1/6ths */
617
618 @@ -255,7 +255,7 @@ static int ctrl_set_rotate(struct bm2835
619 u32 u32_value;
620 struct vchiq_mmal_component *camera;
621
622 - camera = dev->component[MMAL_COMPONENT_CAMERA];
623 + camera = dev->component[COMP_CAMERA];
624
625 u32_value = ((ctrl->val % 360) / 90) * 90;
626
627 @@ -291,7 +291,7 @@ static int ctrl_set_flip(struct bm2835_m
628 else
629 dev->vflip = ctrl->val;
630
631 - camera = dev->component[MMAL_COMPONENT_CAMERA];
632 + camera = dev->component[COMP_CAMERA];
633
634 if (dev->hflip && dev->vflip)
635 u32_value = MMAL_PARAM_MIRROR_BOTH;
636 @@ -330,7 +330,7 @@ static int ctrl_set_exposure(struct bm28
637 struct vchiq_mmal_port *control;
638 int ret = 0;
639
640 - control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
641 + control = &dev->component[COMP_CAMERA]->control;
642
643 if (mmal_ctrl->mmal_id == MMAL_PARAMETER_SHUTTER_SPEED) {
644 /* V4L2 is in 100usec increments.
645 @@ -405,7 +405,7 @@ static int ctrl_set_metering_mode(struct
646 struct vchiq_mmal_port *control;
647 u32 u32_value = dev->metering_mode;
648
649 - control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
650 + control = &dev->component[COMP_CAMERA]->control;
651
652 return vchiq_mmal_port_parameter_set(dev->instance, control,
653 mmal_ctrl->mmal_id,
654 @@ -421,7 +421,7 @@ static int ctrl_set_flicker_avoidance(st
655 u32 u32_value;
656 struct vchiq_mmal_port *control;
657
658 - control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
659 + control = &dev->component[COMP_CAMERA]->control;
660
661 switch (ctrl->val) {
662 case V4L2_CID_POWER_LINE_FREQUENCY_DISABLED:
663 @@ -450,7 +450,7 @@ static int ctrl_set_awb_mode(struct bm28
664 u32 u32_value;
665 struct vchiq_mmal_port *control;
666
667 - control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
668 + control = &dev->component[COMP_CAMERA]->control;
669
670 switch (ctrl->val) {
671 case V4L2_WHITE_BALANCE_MANUAL:
672 @@ -506,7 +506,7 @@ static int ctrl_set_awb_gains(struct bm2
673 struct vchiq_mmal_port *control;
674 struct mmal_parameter_awbgains gains;
675
676 - control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
677 + control = &dev->component[COMP_CAMERA]->control;
678
679 if (ctrl->id == V4L2_CID_RED_BALANCE)
680 dev->red_gain = ctrl->val;
681 @@ -554,7 +554,7 @@ static int ctrl_set_image_effect(struct
682 v4l2_to_mmal_effects_values[i].v;
683 }
684
685 - control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
686 + control = &dev->component[COMP_CAMERA]->control;
687
688 ret = vchiq_mmal_port_parameter_set(
689 dev->instance, control,
690 @@ -587,7 +587,7 @@ static int ctrl_set_colfx(struct bm2835_
691 int ret = -EINVAL;
692 struct vchiq_mmal_port *control;
693
694 - control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
695 + control = &dev->component[COMP_CAMERA]->control;
696
697 dev->colourfx.enable = (ctrl->val & 0xff00) >> 8;
698 dev->colourfx.enable = ctrl->val & 0xff;
699 @@ -613,7 +613,7 @@ static int ctrl_set_bitrate(struct bm283
700
701 dev->capture.encode_bitrate = ctrl->val;
702
703 - encoder_out = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0];
704 + encoder_out = &dev->component[COMP_VIDEO_ENCODE]->output[0];
705
706 ret = vchiq_mmal_port_parameter_set(dev->instance, encoder_out,
707 mmal_ctrl->mmal_id,
708 @@ -629,7 +629,7 @@ static int ctrl_set_bitrate_mode(struct
709 u32 bitrate_mode;
710 struct vchiq_mmal_port *encoder_out;
711
712 - encoder_out = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0];
713 + encoder_out = &dev->component[COMP_VIDEO_ENCODE]->output[0];
714
715 dev->capture.encode_bitrate_mode = ctrl->val;
716 switch (ctrl->val) {
717 @@ -656,7 +656,7 @@ static int ctrl_set_image_encode_output(
718 u32 u32_value;
719 struct vchiq_mmal_port *jpeg_out;
720
721 - jpeg_out = &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->output[0];
722 + jpeg_out = &dev->component[COMP_IMAGE_ENCODE]->output[0];
723
724 u32_value = ctrl->val;
725
726 @@ -672,7 +672,7 @@ static int ctrl_set_video_encode_param_o
727 u32 u32_value;
728 struct vchiq_mmal_port *vid_enc_ctl;
729
730 - vid_enc_ctl = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0];
731 + vid_enc_ctl = &dev->component[COMP_VIDEO_ENCODE]->output[0];
732
733 u32_value = ctrl->val;
734
735 @@ -785,7 +785,7 @@ static int ctrl_set_video_encode_profile
736 }
737
738 ret = vchiq_mmal_port_parameter_set(dev->instance,
739 - &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0],
740 + &dev->component[COMP_VIDEO_ENCODE]->output[0],
741 mmal_ctrl->mmal_id,
742 &param, sizeof(param));
743 }
744 @@ -803,7 +803,7 @@ static int ctrl_set_scene_mode(struct bm
745 v4l2_dbg(0, bcm2835_v4l2_debug, &dev->v4l2_dev,
746 "scene mode selected %d, was %d\n", ctrl->val,
747 dev->scene_mode);
748 - control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
749 + control = &dev->component[COMP_CAMERA]->control;
750
751 if (ctrl->val == dev->scene_mode)
752 return 0;
753 @@ -1221,18 +1221,15 @@ int set_framerate_params(struct bm2835_m
754 fps_range.fps_high.den);
755
756 ret = vchiq_mmal_port_parameter_set(dev->instance,
757 - &dev->component[MMAL_COMPONENT_CAMERA]->
758 - output[MMAL_CAMERA_PORT_PREVIEW],
759 + &dev->component[COMP_CAMERA]->output[CAM_PORT_PREVIEW],
760 MMAL_PARAMETER_FPS_RANGE,
761 &fps_range, sizeof(fps_range));
762 ret += vchiq_mmal_port_parameter_set(dev->instance,
763 - &dev->component[MMAL_COMPONENT_CAMERA]->
764 - output[MMAL_CAMERA_PORT_VIDEO],
765 + &dev->component[COMP_CAMERA]->output[CAM_PORT_VIDEO],
766 MMAL_PARAMETER_FPS_RANGE,
767 &fps_range, sizeof(fps_range));
768 ret += vchiq_mmal_port_parameter_set(dev->instance,
769 - &dev->component[MMAL_COMPONENT_CAMERA]->
770 - output[MMAL_CAMERA_PORT_CAPTURE],
771 + &dev->component[COMP_CAMERA]->output[CAM_PORT_CAPTURE],
772 MMAL_PARAMETER_FPS_RANGE,
773 &fps_range, sizeof(fps_range));
774 if (ret)