1 From cbfd21871e5882f8ffa73a7b5c96018409b683ea Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Fri, 28 Sep 2018 10:17:11 +0100
4 Subject: [PATCH 264/703] staging: bcm2835-camera: Use enums for max value in
7 Controls of type MMAL_CONTROL_TYPE_STD_MENU call v4l2_ctrl_new_std_menu
8 with a max value and a mask. The max value is one of the defined
9 values for the control, however in the config array there are several
10 entries where raw numbers have been used instead. Replace these
11 with the appropriate enum.
13 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
15 .../vc04_services/bcm2835-camera/controls.c | 37 +++++++------------
16 1 file changed, 13 insertions(+), 24 deletions(-)
18 --- a/drivers/staging/vc04_services/bcm2835-camera/controls.c
19 +++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c
20 @@ -58,19 +58,6 @@ static const uint32_t iso_values[] = {
21 0, 100, 200, 400, 800,
24 -static const s64 mains_freq_qmenu[] = {
25 - V4L2_CID_POWER_LINE_FREQUENCY_DISABLED,
26 - V4L2_CID_POWER_LINE_FREQUENCY_50HZ,
27 - V4L2_CID_POWER_LINE_FREQUENCY_60HZ,
28 - V4L2_CID_POWER_LINE_FREQUENCY_AUTO
31 -/* Supported video encode modes */
32 -static const s64 bitrate_mode_qmenu[] = {
33 - (s64)V4L2_MPEG_VIDEO_BITRATE_MODE_VBR,
34 - (s64)V4L2_MPEG_VIDEO_BITRATE_MODE_CBR,
37 enum bm2835_mmal_ctrl_type {
38 MMAL_CONTROL_TYPE_STD,
39 MMAL_CONTROL_TYPE_STD_MENU,
40 @@ -966,8 +953,8 @@ static const struct bm2835_mmal_v4l2_ctr
43 V4L2_CID_ISO_SENSITIVITY_AUTO, MMAL_CONTROL_TYPE_STD_MENU,
44 - 0, 1, V4L2_ISO_SENSITIVITY_AUTO, 1, NULL,
46 + 0, V4L2_ISO_SENSITIVITY_AUTO, V4L2_ISO_SENSITIVITY_AUTO, 1,
47 + NULL, MMAL_PARAMETER_ISO,
51 @@ -984,8 +971,8 @@ static const struct bm2835_mmal_v4l2_ctr
54 V4L2_CID_EXPOSURE_AUTO, MMAL_CONTROL_TYPE_STD_MENU,
55 - ~0x03, 3, V4L2_EXPOSURE_AUTO, 0, NULL,
56 - MMAL_PARAMETER_EXPOSURE_MODE,
57 + ~0x03, V4L2_EXPOSURE_APERTURE_PRIORITY, V4L2_EXPOSURE_AUTO, 0,
58 + NULL, MMAL_PARAMETER_EXPOSURE_MODE,
62 @@ -1021,7 +1008,8 @@ static const struct bm2835_mmal_v4l2_ctr
64 V4L2_CID_EXPOSURE_METERING,
65 MMAL_CONTROL_TYPE_STD_MENU,
66 - ~0x7, 2, V4L2_EXPOSURE_METERING_AVERAGE, 0, NULL,
67 + ~0x7, V4L2_EXPOSURE_METERING_SPOT,
68 + V4L2_EXPOSURE_METERING_AVERAGE, 0, NULL,
69 MMAL_PARAMETER_EXP_METERING_MODE,
70 &ctrl_set_metering_mode,
72 @@ -1029,7 +1017,8 @@ static const struct bm2835_mmal_v4l2_ctr
74 V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE,
75 MMAL_CONTROL_TYPE_STD_MENU,
76 - ~0x3ff, 9, V4L2_WHITE_BALANCE_AUTO, 0, NULL,
77 + ~0x3ff, V4L2_WHITE_BALANCE_SHADE, V4L2_WHITE_BALANCE_AUTO, 0,
79 MMAL_PARAMETER_AWB_MODE,
82 @@ -1050,7 +1039,7 @@ static const struct bm2835_mmal_v4l2_ctr
85 V4L2_CID_COLORFX, MMAL_CONTROL_TYPE_STD_MENU,
86 - 0, 15, V4L2_COLORFX_NONE, 0, NULL,
87 + 0, V4L2_COLORFX_SET_CBCR, V4L2_COLORFX_NONE, 0, NULL,
88 MMAL_PARAMETER_IMAGE_EFFECT,
89 &ctrl_set_image_effect,
91 @@ -1085,8 +1074,8 @@ static const struct bm2835_mmal_v4l2_ctr
94 V4L2_CID_MPEG_VIDEO_BITRATE_MODE, MMAL_CONTROL_TYPE_STD_MENU,
95 - 0, ARRAY_SIZE(bitrate_mode_qmenu) - 1,
96 - 0, 0, bitrate_mode_qmenu,
97 + 0, V4L2_MPEG_VIDEO_BITRATE_MODE_CBR,
99 MMAL_PARAMETER_RATECONTROL,
100 &ctrl_set_bitrate_mode,
102 @@ -1108,8 +1097,8 @@ static const struct bm2835_mmal_v4l2_ctr
105 V4L2_CID_POWER_LINE_FREQUENCY, MMAL_CONTROL_TYPE_STD_MENU,
106 - 0, ARRAY_SIZE(mains_freq_qmenu) - 1,
107 - 1, 1, mains_freq_qmenu,
108 + 0, V4L2_CID_POWER_LINE_FREQUENCY_AUTO,
110 MMAL_PARAMETER_FLICKER_AVOID,
111 &ctrl_set_flicker_avoidance,