aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pwc/pwc-v4l.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-10-09 08:56:23 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-06 07:42:44 -0500
commitf4af65958a6ea987ff61504ad9f053f8ba8da674 (patch)
treee69fc8938aaa68f430d3d52c4f3f72921d455559 /drivers/media/video/pwc/pwc-v4l.c
parent32c67ecc4a690220cbd9fda442c70bc4ba9b2dac (diff)
[media] pwc: Make auto white balance speed and delay available as v4l2 controls
Currently auto white balance speed and delay are only available through custom ioctls, which are deprecated and will be going away in 3.3 . Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/pwc/pwc-v4l.c')
-rw-r--r--drivers/media/video/pwc/pwc-v4l.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c
index a10ff6b64acf..1303641c70c1 100644
--- a/drivers/media/video/pwc/pwc-v4l.c
+++ b/drivers/media/video/pwc/pwc-v4l.c
@@ -49,6 +49,7 @@ static const struct v4l2_ctrl_ops pwc_ctrl_ops = {
49 49
50enum { awb_indoor, awb_outdoor, awb_fl, awb_manual, awb_auto }; 50enum { awb_indoor, awb_outdoor, awb_fl, awb_manual, awb_auto };
51enum { custom_autocontour, custom_contour, custom_noise_reduction, 51enum { custom_autocontour, custom_contour, custom_noise_reduction,
52 custom_awb_speed, custom_awb_delay,
52 custom_save_user, custom_restore_user, custom_restore_factory }; 53 custom_save_user, custom_restore_user, custom_restore_factory };
53 54
54const char * const pwc_auto_whitebal_qmenu[] = { 55const char * const pwc_auto_whitebal_qmenu[] = {
@@ -138,6 +139,26 @@ static const struct v4l2_ctrl_config pwc_restore_factory_cfg = {
138 .name = "Restore Factory Settings", 139 .name = "Restore Factory Settings",
139}; 140};
140 141
142static const struct v4l2_ctrl_config pwc_awb_speed_cfg = {
143 .ops = &pwc_ctrl_ops,
144 .id = PWC_CID_CUSTOM(awb_speed),
145 .type = V4L2_CTRL_TYPE_INTEGER,
146 .name = "Auto White Balance Speed",
147 .min = 1,
148 .max = 32,
149 .step = 1,
150};
151
152static const struct v4l2_ctrl_config pwc_awb_delay_cfg = {
153 .ops = &pwc_ctrl_ops,
154 .id = PWC_CID_CUSTOM(awb_delay),
155 .type = V4L2_CTRL_TYPE_INTEGER,
156 .name = "Auto White Balance Delay",
157 .min = 0,
158 .max = 63,
159 .step = 1,
160};
161
141int pwc_init_controls(struct pwc_device *pdev) 162int pwc_init_controls(struct pwc_device *pdev)
142{ 163{
143 struct v4l2_ctrl_handler *hdl; 164 struct v4l2_ctrl_handler *hdl;
@@ -338,6 +359,23 @@ int pwc_init_controls(struct pwc_device *pdev)
338 if (pdev->restore_factory) 359 if (pdev->restore_factory)
339 pdev->restore_factory->flags |= V4L2_CTRL_FLAG_UPDATE; 360 pdev->restore_factory->flags |= V4L2_CTRL_FLAG_UPDATE;
340 361
362 /* Auto White Balance speed & delay */
363 r = pwc_get_u8_ctrl(pdev, GET_CHROM_CTL,
364 AWB_CONTROL_SPEED_FORMATTER, &def);
365 if (r || def < 1 || def > 32)
366 def = 1;
367 cfg = pwc_awb_speed_cfg;
368 cfg.def = def;
369 pdev->awb_speed = v4l2_ctrl_new_custom(hdl, &cfg, NULL);
370
371 r = pwc_get_u8_ctrl(pdev, GET_CHROM_CTL,
372 AWB_CONTROL_DELAY_FORMATTER, &def);
373 if (r || def > 63)
374 def = 0;
375 cfg = pwc_awb_delay_cfg;
376 cfg.def = def;
377 pdev->awb_delay = v4l2_ctrl_new_custom(hdl, &cfg, NULL);
378
341 if (!(pdev->features & FEATURE_MOTOR_PANTILT)) 379 if (!(pdev->features & FEATURE_MOTOR_PANTILT))
342 return hdl->error; 380 return hdl->error;
343 381
@@ -891,6 +929,16 @@ static int pwc_s_ctrl(struct v4l2_ctrl *ctrl)
891 ret = pwc_button_ctrl(pdev, 929 ret = pwc_button_ctrl(pdev,
892 RESTORE_FACTORY_DEFAULTS_FORMATTER); 930 RESTORE_FACTORY_DEFAULTS_FORMATTER);
893 break; 931 break;
932 case PWC_CID_CUSTOM(awb_speed):
933 ret = pwc_set_u8_ctrl(pdev, SET_CHROM_CTL,
934 AWB_CONTROL_SPEED_FORMATTER,
935 ctrl->val);
936 break;
937 case PWC_CID_CUSTOM(awb_delay):
938 ret = pwc_set_u8_ctrl(pdev, SET_CHROM_CTL,
939 AWB_CONTROL_DELAY_FORMATTER,
940 ctrl->val);
941 break;
894 case V4L2_CID_PAN_RELATIVE: 942 case V4L2_CID_PAN_RELATIVE:
895 ret = pwc_set_motor(pdev); 943 ret = pwc_set_motor(pdev);
896 break; 944 break;