Commit 965e799e authored by Stefan Wahren's avatar Stefan Wahren Committed by Greg Kroah-Hartman

staging: bcm2835-camera: Use designators to init V4L2 controls

The initializer lists for the V4L2 controls are hard to read.
So improve this by using designators.
Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/1584049059-6772-3-git-send-email-stefan.wahren@i2se.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ef3580d7
...@@ -920,210 +920,340 @@ static const struct v4l2_ctrl_ops bm2835_mmal_ctrl_ops = { ...@@ -920,210 +920,340 @@ static const struct v4l2_ctrl_ops bm2835_mmal_ctrl_ops = {
static const struct bm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = { static const struct bm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = {
{ {
V4L2_CID_SATURATION, MMAL_CONTROL_TYPE_STD, .id = V4L2_CID_SATURATION,
-100, 100, 0, 1, NULL, .type = MMAL_CONTROL_TYPE_STD,
MMAL_PARAMETER_SATURATION, .min = -100,
ctrl_set_rational, .max = 100,
.def = 0,
.step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_SATURATION,
.setter = ctrl_set_rational,
}, },
{ {
V4L2_CID_SHARPNESS, MMAL_CONTROL_TYPE_STD, .id = V4L2_CID_SHARPNESS,
-100, 100, 0, 1, NULL, .type = MMAL_CONTROL_TYPE_STD,
MMAL_PARAMETER_SHARPNESS, .min = -100,
ctrl_set_rational, .max = 100,
.def = 0,
.step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_SHARPNESS,
.setter = ctrl_set_rational,
}, },
{ {
V4L2_CID_CONTRAST, MMAL_CONTROL_TYPE_STD, .id = V4L2_CID_CONTRAST,
-100, 100, 0, 1, NULL, .type = MMAL_CONTROL_TYPE_STD,
MMAL_PARAMETER_CONTRAST, .min = -100,
ctrl_set_rational, .max = 100,
.def = 0,
.step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_CONTRAST,
.setter = ctrl_set_rational,
}, },
{ {
V4L2_CID_BRIGHTNESS, MMAL_CONTROL_TYPE_STD, .id = V4L2_CID_BRIGHTNESS,
0, 100, 50, 1, NULL, .type = MMAL_CONTROL_TYPE_STD,
MMAL_PARAMETER_BRIGHTNESS, .min = 0,
ctrl_set_rational, .max = 100,
.def = 50,
.step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_BRIGHTNESS,
.setter = ctrl_set_rational,
}, },
{ {
V4L2_CID_ISO_SENSITIVITY, MMAL_CONTROL_TYPE_INT_MENU, .id = V4L2_CID_ISO_SENSITIVITY,
0, ARRAY_SIZE(iso_qmenu) - 1, 0, 1, iso_qmenu, .type = MMAL_CONTROL_TYPE_INT_MENU,
MMAL_PARAMETER_ISO, .min = 0,
ctrl_set_iso, .max = ARRAY_SIZE(iso_qmenu) - 1,
.def = 0,
.step = 1,
.imenu = iso_qmenu,
.mmal_id = MMAL_PARAMETER_ISO,
.setter = ctrl_set_iso,
}, },
{ {
V4L2_CID_ISO_SENSITIVITY_AUTO, MMAL_CONTROL_TYPE_STD_MENU, .id = V4L2_CID_ISO_SENSITIVITY_AUTO,
0, V4L2_ISO_SENSITIVITY_AUTO, V4L2_ISO_SENSITIVITY_AUTO, 1, .type = MMAL_CONTROL_TYPE_STD_MENU,
NULL, MMAL_PARAMETER_ISO, .min = 0,
ctrl_set_iso, .max = V4L2_ISO_SENSITIVITY_AUTO,
.def = V4L2_ISO_SENSITIVITY_AUTO,
.step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_ISO,
.setter = ctrl_set_iso,
}, },
{ {
V4L2_CID_IMAGE_STABILIZATION, MMAL_CONTROL_TYPE_STD, .id = V4L2_CID_IMAGE_STABILIZATION,
0, 1, 0, 1, NULL, .type = MMAL_CONTROL_TYPE_STD,
MMAL_PARAMETER_VIDEO_STABILISATION, .min = 0,
ctrl_set_value, .max = 1,
.def = 0,
.step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_VIDEO_STABILISATION,
.setter = ctrl_set_value,
}, },
{ {
V4L2_CID_EXPOSURE_AUTO, MMAL_CONTROL_TYPE_STD_MENU, .id = V4L2_CID_EXPOSURE_AUTO,
~0x03, V4L2_EXPOSURE_APERTURE_PRIORITY, V4L2_EXPOSURE_AUTO, 0, .type = MMAL_CONTROL_TYPE_STD_MENU,
NULL, MMAL_PARAMETER_EXPOSURE_MODE, .min = ~0x03,
ctrl_set_exposure, .max = V4L2_EXPOSURE_APERTURE_PRIORITY,
.def = V4L2_EXPOSURE_AUTO,
.step = 0,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_EXPOSURE_MODE,
.setter = ctrl_set_exposure,
}, },
{ {
V4L2_CID_EXPOSURE_ABSOLUTE, MMAL_CONTROL_TYPE_STD, .id = V4L2_CID_EXPOSURE_ABSOLUTE,
.type = MMAL_CONTROL_TYPE_STD,
/* Units of 100usecs */ /* Units of 100usecs */
1, 1 * 1000 * 10, 100 * 10, 1, NULL, .min = 1,
MMAL_PARAMETER_SHUTTER_SPEED, .max = 1 * 1000 * 10,
ctrl_set_exposure, .def = 100 * 10,
.step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_SHUTTER_SPEED,
.setter = ctrl_set_exposure,
}, },
{ {
V4L2_CID_AUTO_EXPOSURE_BIAS, MMAL_CONTROL_TYPE_INT_MENU, .id = V4L2_CID_AUTO_EXPOSURE_BIAS,
0, ARRAY_SIZE(ev_bias_qmenu) - 1, .type = MMAL_CONTROL_TYPE_INT_MENU,
(ARRAY_SIZE(ev_bias_qmenu) + 1) / 2 - 1, 0, ev_bias_qmenu, .min = 0,
MMAL_PARAMETER_EXPOSURE_COMP, .max = ARRAY_SIZE(ev_bias_qmenu) - 1,
ctrl_set_value_ev, .def = (ARRAY_SIZE(ev_bias_qmenu) + 1) / 2 - 1,
.step = 0,
.imenu = ev_bias_qmenu,
.mmal_id = MMAL_PARAMETER_EXPOSURE_COMP,
.setter = ctrl_set_value_ev,
}, },
{ {
V4L2_CID_EXPOSURE_AUTO_PRIORITY, MMAL_CONTROL_TYPE_STD, .id = V4L2_CID_EXPOSURE_AUTO_PRIORITY,
0, 1, .type = MMAL_CONTROL_TYPE_STD,
0, 1, NULL, .min = 0,
0, /* Dummy MMAL ID as it gets mapped into FPS range*/ .max = 1,
ctrl_set_exposure, .def = 0,
.step = 1,
.imenu = NULL,
/* Dummy MMAL ID as it gets mapped into FPS range */
.mmal_id = 0,
.setter = ctrl_set_exposure,
}, },
{ {
V4L2_CID_EXPOSURE_METERING, .id = V4L2_CID_EXPOSURE_METERING,
MMAL_CONTROL_TYPE_STD_MENU, .type = MMAL_CONTROL_TYPE_STD_MENU,
~0x7, V4L2_EXPOSURE_METERING_SPOT, .min = ~0x7,
V4L2_EXPOSURE_METERING_AVERAGE, 0, NULL, .max = V4L2_EXPOSURE_METERING_SPOT,
MMAL_PARAMETER_EXP_METERING_MODE, .def = V4L2_EXPOSURE_METERING_AVERAGE,
ctrl_set_metering_mode, .step = 0,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_EXP_METERING_MODE,
.setter = ctrl_set_metering_mode,
}, },
{ {
V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE, .id = V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE,
MMAL_CONTROL_TYPE_STD_MENU, .type = MMAL_CONTROL_TYPE_STD_MENU,
~0x3ff, V4L2_WHITE_BALANCE_SHADE, V4L2_WHITE_BALANCE_AUTO, 0, .min = ~0x3ff,
NULL, .max = V4L2_WHITE_BALANCE_SHADE,
MMAL_PARAMETER_AWB_MODE, .def = V4L2_WHITE_BALANCE_AUTO,
ctrl_set_awb_mode, .step = 0,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_AWB_MODE,
.setter = ctrl_set_awb_mode,
}, },
{ {
V4L2_CID_RED_BALANCE, MMAL_CONTROL_TYPE_STD, .id = V4L2_CID_RED_BALANCE,
1, 7999, 1000, 1, NULL, .type = MMAL_CONTROL_TYPE_STD,
MMAL_PARAMETER_CUSTOM_AWB_GAINS, .min = 1,
ctrl_set_awb_gains, .max = 7999,
.def = 1000,
.step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_CUSTOM_AWB_GAINS,
.setter = ctrl_set_awb_gains,
}, },
{ {
V4L2_CID_BLUE_BALANCE, MMAL_CONTROL_TYPE_STD, .id = V4L2_CID_BLUE_BALANCE,
1, 7999, 1000, 1, NULL, .type = MMAL_CONTROL_TYPE_STD,
MMAL_PARAMETER_CUSTOM_AWB_GAINS, .min = 1,
ctrl_set_awb_gains, .max = 7999,
.def = 1000,
.step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_CUSTOM_AWB_GAINS,
.setter = ctrl_set_awb_gains,
}, },
{ {
V4L2_CID_COLORFX, MMAL_CONTROL_TYPE_STD_MENU, .id = V4L2_CID_COLORFX,
0, V4L2_COLORFX_SET_CBCR, V4L2_COLORFX_NONE, 0, NULL, .type = MMAL_CONTROL_TYPE_STD_MENU,
MMAL_PARAMETER_IMAGE_EFFECT, .min = 0,
ctrl_set_image_effect, .max = V4L2_COLORFX_SET_CBCR,
.def = V4L2_COLORFX_NONE,
.step = 0,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_IMAGE_EFFECT,
.setter = ctrl_set_image_effect,
}, },
{ {
V4L2_CID_COLORFX_CBCR, MMAL_CONTROL_TYPE_STD, .id = V4L2_CID_COLORFX_CBCR,
0, 0xffff, 0x8080, 1, NULL, .type = MMAL_CONTROL_TYPE_STD,
MMAL_PARAMETER_COLOUR_EFFECT, .min = 0,
ctrl_set_colfx, .max = 0xffff,
.def = 0x8080,
.step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_COLOUR_EFFECT,
.setter = ctrl_set_colfx,
}, },
{ {
V4L2_CID_ROTATE, MMAL_CONTROL_TYPE_STD, .id = V4L2_CID_ROTATE,
0, 360, 0, 90, NULL, .type = MMAL_CONTROL_TYPE_STD,
MMAL_PARAMETER_ROTATION, .min = 0,
ctrl_set_rotate, .max = 360,
.def = 0,
.step = 90,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_ROTATION,
.setter = ctrl_set_rotate,
}, },
{ {
V4L2_CID_HFLIP, MMAL_CONTROL_TYPE_STD, .id = V4L2_CID_HFLIP,
0, 1, 0, 1, NULL, .type = MMAL_CONTROL_TYPE_STD,
MMAL_PARAMETER_MIRROR, .min = 0,
ctrl_set_flip, .max = 1,
.def = 0,
.step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_MIRROR,
.setter = ctrl_set_flip,
}, },
{ {
V4L2_CID_VFLIP, MMAL_CONTROL_TYPE_STD, .id = V4L2_CID_VFLIP,
0, 1, 0, 1, NULL, .type = MMAL_CONTROL_TYPE_STD,
MMAL_PARAMETER_MIRROR, .min = 0,
ctrl_set_flip, .max = 1,
.def = 0,
.step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_MIRROR,
.setter = ctrl_set_flip,
}, },
{ {
V4L2_CID_MPEG_VIDEO_BITRATE_MODE, MMAL_CONTROL_TYPE_STD_MENU, .id = V4L2_CID_MPEG_VIDEO_BITRATE_MODE,
0, V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, .type = MMAL_CONTROL_TYPE_STD_MENU,
0, 0, NULL, .min = 0,
MMAL_PARAMETER_RATECONTROL, .max = V4L2_MPEG_VIDEO_BITRATE_MODE_CBR,
ctrl_set_bitrate_mode, .def = 0,
.step = 0,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_RATECONTROL,
.setter = ctrl_set_bitrate_mode,
}, },
{ {
V4L2_CID_MPEG_VIDEO_BITRATE, MMAL_CONTROL_TYPE_STD, .id = V4L2_CID_MPEG_VIDEO_BITRATE,
25 * 1000, 25 * 1000 * 1000, 10 * 1000 * 1000, 25 * 1000, NULL, .type = MMAL_CONTROL_TYPE_STD,
MMAL_PARAMETER_VIDEO_BIT_RATE, .min = 25 * 1000,
ctrl_set_bitrate, .max = 25 * 1000 * 1000,
.def = 10 * 1000 * 1000,
.step = 25 * 1000,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_VIDEO_BIT_RATE,
.setter = ctrl_set_bitrate,
}, },
{ {
V4L2_CID_JPEG_COMPRESSION_QUALITY, MMAL_CONTROL_TYPE_STD, .id = V4L2_CID_JPEG_COMPRESSION_QUALITY,
1, 100, .type = MMAL_CONTROL_TYPE_STD,
30, 1, NULL, .min = 1,
MMAL_PARAMETER_JPEG_Q_FACTOR, .max = 100,
ctrl_set_image_encode_output, .def = 30,
.step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_JPEG_Q_FACTOR,
.setter = ctrl_set_image_encode_output,
}, },
{ {
V4L2_CID_POWER_LINE_FREQUENCY, MMAL_CONTROL_TYPE_STD_MENU, .id = V4L2_CID_POWER_LINE_FREQUENCY,
0, V4L2_CID_POWER_LINE_FREQUENCY_AUTO, .type = MMAL_CONTROL_TYPE_STD_MENU,
1, 1, NULL, .min = 0,
MMAL_PARAMETER_FLICKER_AVOID, .max = V4L2_CID_POWER_LINE_FREQUENCY_AUTO,
ctrl_set_flicker_avoidance, .def = 1,
.step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_FLICKER_AVOID,
.setter = ctrl_set_flicker_avoidance,
}, },
{ {
V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER, MMAL_CONTROL_TYPE_STD, .id = V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER,
0, 1, .type = MMAL_CONTROL_TYPE_STD,
0, 1, NULL, .min = 0,
MMAL_PARAMETER_VIDEO_ENCODE_INLINE_HEADER, .max = 1,
ctrl_set_video_encode_param_output, .def = 0,
.step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_VIDEO_ENCODE_INLINE_HEADER,
.setter = ctrl_set_video_encode_param_output,
}, },
{ {
V4L2_CID_MPEG_VIDEO_H264_PROFILE, .id = V4L2_CID_MPEG_VIDEO_H264_PROFILE,
MMAL_CONTROL_TYPE_STD_MENU, .type = MMAL_CONTROL_TYPE_STD_MENU,
~(BIT(V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE) | .min = ~(BIT(V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE) |
BIT(V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE) | BIT(V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE) |
BIT(V4L2_MPEG_VIDEO_H264_PROFILE_MAIN) | BIT(V4L2_MPEG_VIDEO_H264_PROFILE_MAIN) |
BIT(V4L2_MPEG_VIDEO_H264_PROFILE_HIGH)), BIT(V4L2_MPEG_VIDEO_H264_PROFILE_HIGH)),
V4L2_MPEG_VIDEO_H264_PROFILE_HIGH, .max = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
V4L2_MPEG_VIDEO_H264_PROFILE_HIGH, 1, NULL, .def = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
MMAL_PARAMETER_PROFILE, .step = 1,
ctrl_set_video_encode_profile_level, .imenu = NULL,
.mmal_id = MMAL_PARAMETER_PROFILE,
.setter = ctrl_set_video_encode_profile_level,
}, },
{ {
V4L2_CID_MPEG_VIDEO_H264_LEVEL, MMAL_CONTROL_TYPE_STD_MENU, .id = V4L2_CID_MPEG_VIDEO_H264_LEVEL,
~(BIT(V4L2_MPEG_VIDEO_H264_LEVEL_1_0) | .type = MMAL_CONTROL_TYPE_STD_MENU,
BIT(V4L2_MPEG_VIDEO_H264_LEVEL_1B) | .min = ~(BIT(V4L2_MPEG_VIDEO_H264_LEVEL_1_0) |
BIT(V4L2_MPEG_VIDEO_H264_LEVEL_1_1) | BIT(V4L2_MPEG_VIDEO_H264_LEVEL_1B) |
BIT(V4L2_MPEG_VIDEO_H264_LEVEL_1_2) | BIT(V4L2_MPEG_VIDEO_H264_LEVEL_1_1) |
BIT(V4L2_MPEG_VIDEO_H264_LEVEL_1_3) | BIT(V4L2_MPEG_VIDEO_H264_LEVEL_1_2) |
BIT(V4L2_MPEG_VIDEO_H264_LEVEL_2_0) | BIT(V4L2_MPEG_VIDEO_H264_LEVEL_1_3) |
BIT(V4L2_MPEG_VIDEO_H264_LEVEL_2_1) | BIT(V4L2_MPEG_VIDEO_H264_LEVEL_2_0) |
BIT(V4L2_MPEG_VIDEO_H264_LEVEL_2_2) | BIT(V4L2_MPEG_VIDEO_H264_LEVEL_2_1) |
BIT(V4L2_MPEG_VIDEO_H264_LEVEL_3_0) | BIT(V4L2_MPEG_VIDEO_H264_LEVEL_2_2) |
BIT(V4L2_MPEG_VIDEO_H264_LEVEL_3_1) | BIT(V4L2_MPEG_VIDEO_H264_LEVEL_3_0) |
BIT(V4L2_MPEG_VIDEO_H264_LEVEL_3_2) | BIT(V4L2_MPEG_VIDEO_H264_LEVEL_3_1) |
BIT(V4L2_MPEG_VIDEO_H264_LEVEL_4_0)), BIT(V4L2_MPEG_VIDEO_H264_LEVEL_3_2) |
V4L2_MPEG_VIDEO_H264_LEVEL_4_0, BIT(V4L2_MPEG_VIDEO_H264_LEVEL_4_0)),
V4L2_MPEG_VIDEO_H264_LEVEL_4_0, 1, NULL, .max = V4L2_MPEG_VIDEO_H264_LEVEL_4_0,
MMAL_PARAMETER_PROFILE, .def = V4L2_MPEG_VIDEO_H264_LEVEL_4_0,
ctrl_set_video_encode_profile_level, .step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_PROFILE,
.setter = ctrl_set_video_encode_profile_level,
}, },
{ {
V4L2_CID_SCENE_MODE, MMAL_CONTROL_TYPE_STD_MENU, .id = V4L2_CID_SCENE_MODE,
-1, /* Min (mask) is computed at runtime */ .type = MMAL_CONTROL_TYPE_STD_MENU,
V4L2_SCENE_MODE_TEXT, /* mask is computed at runtime */
V4L2_SCENE_MODE_NONE, 1, NULL, .min = -1,
MMAL_PARAMETER_PROFILE, .max = V4L2_SCENE_MODE_TEXT,
ctrl_set_scene_mode, .def = V4L2_SCENE_MODE_NONE,
.step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_PROFILE,
.setter = ctrl_set_scene_mode,
}, },
{ {
V4L2_CID_MPEG_VIDEO_H264_I_PERIOD, MMAL_CONTROL_TYPE_STD, .id = V4L2_CID_MPEG_VIDEO_H264_I_PERIOD,
0, 0x7FFFFFFF, 60, 1, NULL, .type = MMAL_CONTROL_TYPE_STD,
MMAL_PARAMETER_INTRAPERIOD, .min = 0,
ctrl_set_video_encode_param_output, .max = 0x7FFFFFFF,
.def = 60,
.step = 1,
.imenu = NULL,
.mmal_id = MMAL_PARAMETER_INTRAPERIOD,
.setter = ctrl_set_video_encode_param_output,
}, },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment