diff options
author | Hans de Goede <hdegoede@redhat.com> | 2011-10-09 14:56:23 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-01-06 13:42:44 +0100 |
commit | f4af65958a6ea987ff61504ad9f053f8ba8da674 (patch) | |
tree | e69fc8938aaa68f430d3d52c4f3f72921d455559 /drivers/media/video/pwc/pwc-ctrl.c | |
parent | [media] pwc: Properly mark device_hint as unused in all probe error paths (diff) | |
download | linux-f4af65958a6ea987ff61504ad9f053f8ba8da674.tar.xz linux-f4af65958a6ea987ff61504ad9f053f8ba8da674.zip |
[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-ctrl.c')
-rw-r--r-- | drivers/media/video/pwc/pwc-ctrl.c | 64 |
1 files changed, 7 insertions, 57 deletions
diff --git a/drivers/media/video/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c index b42c239de9cf..def9120b607d 100644 --- a/drivers/media/video/pwc/pwc-ctrl.c +++ b/drivers/media/video/pwc/pwc-ctrl.c @@ -597,54 +597,6 @@ void pwc_camera_power(struct pwc_device *pdev, int power) power ? "on" : "off", r); } -static int pwc_set_wb_speed(struct pwc_device *pdev, int speed) -{ - unsigned char buf; - - /* useful range is 0x01..0x20 */ - buf = speed / 0x7f0; - return send_control_msg(pdev, - SET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, &buf, sizeof(buf)); -} - -static int pwc_get_wb_speed(struct pwc_device *pdev, int *value) -{ - unsigned char buf; - int ret; - - ret = recv_control_msg(pdev, - GET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, &buf, sizeof(buf)); - if (ret < 0) - return ret; - *value = buf * 0x7f0; - return 0; -} - - -static int pwc_set_wb_delay(struct pwc_device *pdev, int delay) -{ - unsigned char buf; - - /* useful range is 0x01..0x3F */ - buf = (delay >> 10); - return send_control_msg(pdev, - SET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, &buf, sizeof(buf)); -} - -static int pwc_get_wb_delay(struct pwc_device *pdev, int *value) -{ - unsigned char buf; - int ret; - - ret = recv_control_msg(pdev, - GET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, &buf, sizeof(buf)); - if (ret < 0) - return ret; - *value = buf << 10; - return 0; -} - - int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value) { unsigned char buf[2]; @@ -963,10 +915,12 @@ long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) ARG_DEF(struct pwc_wb_speed, wbs) if (ARGR(wbs).control_speed > 0) { - ret = pwc_set_wb_speed(pdev, ARGR(wbs).control_speed); + ret = pwc_ioctl_s_ctrl(pdev->awb_speed, + ARGR(wbs).control_speed); } - if (ARGR(wbs).control_delay > 0) { - ret = pwc_set_wb_delay(pdev, ARGR(wbs).control_delay); + if (ret == 0 && ARGR(wbs).control_delay > 0) { + ret = pwc_ioctl_s_ctrl(pdev->awb_delay, + ARGR(wbs).control_delay); } break; } @@ -975,12 +929,8 @@ long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) { ARG_DEF(struct pwc_wb_speed, wbs) - ret = pwc_get_wb_speed(pdev, &ARGR(wbs).control_speed); - if (ret < 0) - break; - ret = pwc_get_wb_delay(pdev, &ARGR(wbs).control_delay); - if (ret < 0) - break; + ARGR(wbs).control_speed = v4l2_ctrl_g_ctrl(pdev->awb_speed); + ARGR(wbs).control_delay = v4l2_ctrl_g_ctrl(pdev->awb_delay); ARG_OUT(wbs) break; } |