diff options
author | Jean-François Moine <moinejf@free.fr> | 2010-07-26 06:53:57 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-08-08 22:42:53 -0400 |
commit | 486cb2d5b01e77fb3cd93c4c0810100d59a45c8b (patch) | |
tree | 998f16027fab2dc05f13a78446f742f63113028b /drivers/media | |
parent | 6e80cc51b4419ca0f8162024ee2497d7ec8ba31c (diff) |
V4L/DVB: gspca - vc032x: Add more controls for poxxxx
The added controls are exposure, gain, autogain and backlight compensation.
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/gspca/vc032x.c | 306 |
1 files changed, 272 insertions, 34 deletions
diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c index 031266a4081b..d450a95480bd 100644 --- a/drivers/media/video/gspca/vc032x.c +++ b/drivers/media/video/gspca/vc032x.c | |||
@@ -39,6 +39,10 @@ struct sd { | |||
39 | u8 vflip; | 39 | u8 vflip; |
40 | u8 lightfreq; | 40 | u8 lightfreq; |
41 | s8 sharpness; | 41 | s8 sharpness; |
42 | u16 exposure; | ||
43 | u8 gain; | ||
44 | u8 autogain; | ||
45 | u8 backlight; | ||
42 | 46 | ||
43 | u8 image_offset; | 47 | u8 image_offset; |
44 | 48 | ||
@@ -77,6 +81,14 @@ static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val); | |||
77 | static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); | 81 | static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); |
78 | static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val); | 82 | static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val); |
79 | static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val); | 83 | static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val); |
84 | static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val); | ||
85 | static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val); | ||
86 | static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val); | ||
87 | static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val); | ||
88 | static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); | ||
89 | static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); | ||
90 | static int sd_setbacklight(struct gspca_dev *gspca_dev, __s32 val); | ||
91 | static int sd_getbacklight(struct gspca_dev *gspca_dev, __s32 *val); | ||
80 | 92 | ||
81 | static const struct ctrl sd_ctrls[] = { | 93 | static const struct ctrl sd_ctrls[] = { |
82 | #define BRIGHTNESS_IDX 0 | 94 | #define BRIGHTNESS_IDX 0 |
@@ -185,6 +197,66 @@ static const struct ctrl sd_ctrls[] = { | |||
185 | .set = sd_setsharpness, | 197 | .set = sd_setsharpness, |
186 | .get = sd_getsharpness, | 198 | .get = sd_getsharpness, |
187 | }, | 199 | }, |
200 | #define GAIN_IDX 7 | ||
201 | { | ||
202 | { | ||
203 | .id = V4L2_CID_GAIN, | ||
204 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
205 | .name = "Gain", | ||
206 | .minimum = 0, | ||
207 | .maximum = 78, | ||
208 | .step = 1, | ||
209 | #define GAIN_DEF 0 | ||
210 | .default_value = GAIN_DEF, | ||
211 | }, | ||
212 | .set = sd_setgain, | ||
213 | .get = sd_getgain, | ||
214 | }, | ||
215 | #define EXPOSURE_IDX 8 | ||
216 | { | ||
217 | { | ||
218 | .id = V4L2_CID_EXPOSURE, | ||
219 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
220 | .name = "Exposure", | ||
221 | #define EXPOSURE_DEF 450 | ||
222 | .minimum = 0, | ||
223 | .maximum = 4095, | ||
224 | .step = 1, | ||
225 | .default_value = EXPOSURE_DEF, | ||
226 | }, | ||
227 | .set = sd_setexposure, | ||
228 | .get = sd_getexposure, | ||
229 | }, | ||
230 | #define AUTOGAIN_IDX 9 | ||
231 | { | ||
232 | { | ||
233 | .id = V4L2_CID_AUTOGAIN, | ||
234 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
235 | .name = "Automatic Gain and Exposure", | ||
236 | .minimum = 0, | ||
237 | .maximum = 1, | ||
238 | .step = 1, | ||
239 | #define AUTOGAIN_DEF 1 | ||
240 | .default_value = AUTOGAIN_DEF, | ||
241 | }, | ||
242 | .set = sd_setautogain, | ||
243 | .get = sd_getautogain, | ||
244 | }, | ||
245 | #define BACKLIGHT_IDX 10 | ||
246 | { | ||
247 | { | ||
248 | .id = V4L2_CID_BACKLIGHT_COMPENSATION, | ||
249 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
250 | .name = "Backlight Compensation", | ||
251 | .minimum = 0, | ||
252 | .maximum = 15, | ||
253 | .step = 1, | ||
254 | #define BACKLIGHT_DEF 15 | ||
255 | .default_value = BACKLIGHT_DEF, | ||
256 | }, | ||
257 | .set = sd_setbacklight, | ||
258 | .get = sd_getbacklight, | ||
259 | }, | ||
188 | }; | 260 | }; |
189 | 261 | ||
190 | /* table of the disabled controls */ | 262 | /* table of the disabled controls */ |
@@ -192,33 +264,51 @@ static u32 ctrl_dis[] = { | |||
192 | /* SENSOR_HV7131R 0 */ | 264 | /* SENSOR_HV7131R 0 */ |
193 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) | 265 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) |
194 | | (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX) | 266 | | (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX) |
195 | | (1 << SHARPNESS_IDX), | 267 | | (1 << SHARPNESS_IDX) |
268 | | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) | ||
269 | | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), | ||
196 | /* SENSOR_MI0360 1 */ | 270 | /* SENSOR_MI0360 1 */ |
197 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) | 271 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) |
198 | | (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX) | 272 | | (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX) |
199 | | (1 << SHARPNESS_IDX), | 273 | | (1 << SHARPNESS_IDX) |
274 | | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) | ||
275 | | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), | ||
200 | /* SENSOR_MI1310_SOC 2 */ | 276 | /* SENSOR_MI1310_SOC 2 */ |
201 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) | 277 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) |
202 | | (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX), | 278 | | (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX) |
279 | | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) | ||
280 | | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), | ||
203 | /* SENSOR_MI1320 3 */ | 281 | /* SENSOR_MI1320 3 */ |
204 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) | 282 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) |
205 | | (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX), | 283 | | (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX) |
284 | | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) | ||
285 | | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), | ||
206 | /* SENSOR_MI1320_SOC 4 */ | 286 | /* SENSOR_MI1320_SOC 4 */ |
207 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) | 287 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) |
208 | | (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX), | 288 | | (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX) |
289 | | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) | ||
290 | | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), | ||
209 | /* SENSOR_OV7660 5 */ | 291 | /* SENSOR_OV7660 5 */ |
210 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) | 292 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) |
211 | | (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX), | 293 | | (1 << LIGHTFREQ_IDX) | (1 << SHARPNESS_IDX) |
294 | | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) | ||
295 | | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), | ||
212 | /* SENSOR_OV7670 6 */ | 296 | /* SENSOR_OV7670 6 */ |
213 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) | 297 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) |
214 | | (1 << SHARPNESS_IDX), | 298 | | (1 << SHARPNESS_IDX) |
299 | | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) | ||
300 | | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), | ||
215 | /* SENSOR_PO1200 7 */ | 301 | /* SENSOR_PO1200 7 */ |
216 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) | 302 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) |
217 | | (1 << LIGHTFREQ_IDX), | 303 | | (1 << LIGHTFREQ_IDX) |
304 | | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) | ||
305 | | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), | ||
218 | /* SENSOR_PO3130NC 8 */ | 306 | /* SENSOR_PO3130NC 8 */ |
219 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) | 307 | (1 << BRIGHTNESS_IDX) | (1 << CONTRAST_IDX) | (1 << COLORS_IDX) |
220 | | (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX) | 308 | | (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX) |
221 | | (1 << SHARPNESS_IDX), | 309 | | (1 << SHARPNESS_IDX) |
310 | | (1 << GAIN_IDX) | (1 << EXPOSURE_IDX) | ||
311 | | (1 << AUTOGAIN_IDX) | (1 << BACKLIGHT_IDX), | ||
222 | /* SENSOR_POxxxx 9 */ | 312 | /* SENSOR_POxxxx 9 */ |
223 | (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX), | 313 | (1 << HFLIP_IDX) | (1 << VFLIP_IDX) | (1 << LIGHTFREQ_IDX), |
224 | }; | 314 | }; |
@@ -2825,7 +2915,9 @@ static const u8 poxxxx_init_common[][4] = { | |||
2825 | {0x00, 0x1e, 0xc6, 0xaa}, | 2915 | {0x00, 0x1e, 0xc6, 0xaa}, |
2826 | {0x00, 0x00, 0x40, 0xdd}, | 2916 | {0x00, 0x00, 0x40, 0xdd}, |
2827 | {0x00, 0x1d, 0x05, 0xaa}, | 2917 | {0x00, 0x1d, 0x05, 0xaa}, |
2828 | 2918 | {} | |
2919 | }; | ||
2920 | static const u8 poxxxx_gamma[][4] = { | ||
2829 | {0x00, 0xd6, 0x22, 0xaa}, /* gamma 0 */ | 2921 | {0x00, 0xd6, 0x22, 0xaa}, /* gamma 0 */ |
2830 | {0x00, 0x73, 0x00, 0xaa}, | 2922 | {0x00, 0x73, 0x00, 0xaa}, |
2831 | {0x00, 0x74, 0x0a, 0xaa}, | 2923 | {0x00, 0x74, 0x0a, 0xaa}, |
@@ -2867,19 +2959,9 @@ static const u8 poxxxx_init_common[][4] = { | |||
2867 | {0x00, 0x7c, 0xba, 0xaa}, | 2959 | {0x00, 0x7c, 0xba, 0xaa}, |
2868 | {0x00, 0x7d, 0xd4, 0xaa}, | 2960 | {0x00, 0x7d, 0xd4, 0xaa}, |
2869 | {0x00, 0x7e, 0xea, 0xaa}, | 2961 | {0x00, 0x7e, 0xea, 0xaa}, |
2870 | 2962 | {} | |
2871 | {0x00, 0xaa, 0xff, 0xaa}, /* back light comp */ | 2963 | }; |
2872 | {0x00, 0xc4, 0x03, 0xaa}, | 2964 | static const u8 poxxxx_init_start_3[][4] = { |
2873 | {0x00, 0xc5, 0x19, 0xaa}, | ||
2874 | {0x00, 0xc6, 0x03, 0xaa}, | ||
2875 | {0x00, 0xc7, 0x91, 0xaa}, | ||
2876 | {0x00, 0xc8, 0x01, 0xaa}, | ||
2877 | {0x00, 0xc9, 0xdd, 0xaa}, | ||
2878 | {0x00, 0xca, 0x02, 0xaa}, | ||
2879 | {0x00, 0xcb, 0x37, 0xaa}, | ||
2880 | |||
2881 | /* read d1 */ | ||
2882 | {0x00, 0xd1, 0x3c, 0xaa}, | ||
2883 | {0x00, 0xb8, 0x28, 0xaa}, | 2965 | {0x00, 0xb8, 0x28, 0xaa}, |
2884 | {0x00, 0xb9, 0x1e, 0xaa}, | 2966 | {0x00, 0xb9, 0x1e, 0xaa}, |
2885 | {0x00, 0xb6, 0x14, 0xaa}, | 2967 | {0x00, 0xb6, 0x14, 0xaa}, |
@@ -2959,9 +3041,6 @@ static const u8 poxxxx_init_end_1[][4] = { | |||
2959 | {0x00, 0xb3, 0x08, 0xaa}, | 3041 | {0x00, 0xb3, 0x08, 0xaa}, |
2960 | {0x00, 0xb4, 0x0b, 0xaa}, | 3042 | {0x00, 0xb4, 0x0b, 0xaa}, |
2961 | {0x00, 0xb5, 0x0d, 0xaa}, | 3043 | {0x00, 0xb5, 0x0d, 0xaa}, |
2962 | {0x00, 0x59, 0x7e, 0xaa}, /* sharpness */ | ||
2963 | {0x00, 0x16, 0x00, 0xaa}, /* white balance */ | ||
2964 | {0x00, 0x18, 0x00, 0xaa}, | ||
2965 | {} | 3044 | {} |
2966 | }; | 3045 | }; |
2967 | static const u8 poxxxx_init_end_2[][4] = { | 3046 | static const u8 poxxxx_init_end_2[][4] = { |
@@ -3409,6 +3488,10 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
3409 | sd->vflip = VFLIP_DEF; | 3488 | sd->vflip = VFLIP_DEF; |
3410 | sd->lightfreq = FREQ_DEF; | 3489 | sd->lightfreq = FREQ_DEF; |
3411 | sd->sharpness = SHARPNESS_DEF; | 3490 | sd->sharpness = SHARPNESS_DEF; |
3491 | sd->gain = GAIN_DEF; | ||
3492 | sd->exposure = EXPOSURE_DEF; | ||
3493 | sd->autogain = AUTOGAIN_DEF; | ||
3494 | sd->backlight = BACKLIGHT_DEF; | ||
3412 | 3495 | ||
3413 | gspca_dev->ctrl_dis = ctrl_dis[sd->sensor]; | 3496 | gspca_dev->ctrl_dis = ctrl_dis[sd->sensor]; |
3414 | 3497 | ||
@@ -3551,6 +3634,82 @@ static void setsharpness(struct gspca_dev *gspca_dev) | |||
3551 | break; | 3634 | break; |
3552 | } | 3635 | } |
3553 | } | 3636 | } |
3637 | static void setgain(struct gspca_dev *gspca_dev) | ||
3638 | { | ||
3639 | struct sd *sd = (struct sd *) gspca_dev; | ||
3640 | |||
3641 | if (gspca_dev->ctrl_dis & (1 << GAIN_IDX)) | ||
3642 | return; | ||
3643 | i2c_write(gspca_dev, 0x15, &sd->gain, 1); | ||
3644 | } | ||
3645 | |||
3646 | static void setexposure(struct gspca_dev *gspca_dev) | ||
3647 | { | ||
3648 | struct sd *sd = (struct sd *) gspca_dev; | ||
3649 | u8 data; | ||
3650 | |||
3651 | if (gspca_dev->ctrl_dis & (1 << EXPOSURE_IDX)) | ||
3652 | return; | ||
3653 | data = sd->exposure >> 8; | ||
3654 | i2c_write(gspca_dev, 0x1a, &data, 1); | ||
3655 | data = sd->exposure; | ||
3656 | i2c_write(gspca_dev, 0x1b, &data, 1); | ||
3657 | } | ||
3658 | |||
3659 | static void setautogain(struct gspca_dev *gspca_dev) | ||
3660 | { | ||
3661 | struct sd *sd = (struct sd *) gspca_dev; | ||
3662 | static const u8 data[2] = {0x28, 0x3c}; | ||
3663 | |||
3664 | if (gspca_dev->ctrl_dis & (1 << AUTOGAIN_IDX)) | ||
3665 | return; | ||
3666 | i2c_write(gspca_dev, 0xd1, &data[sd->autogain], 1); | ||
3667 | } | ||
3668 | |||
3669 | static void setgamma(struct gspca_dev *gspca_dev) | ||
3670 | { | ||
3671 | /*fixme:to do */ | ||
3672 | usb_exchange(gspca_dev, poxxxx_gamma); | ||
3673 | } | ||
3674 | |||
3675 | static void setbacklight(struct gspca_dev *gspca_dev) | ||
3676 | { | ||
3677 | struct sd *sd = (struct sd *) gspca_dev; | ||
3678 | u16 v; | ||
3679 | u8 data; | ||
3680 | |||
3681 | data = (sd->backlight << 4) | 0x0f; | ||
3682 | i2c_write(gspca_dev, 0xaa, &data, 1); | ||
3683 | v = 613 + 12 * sd->backlight; | ||
3684 | data = v >> 8; | ||
3685 | i2c_write(gspca_dev, 0xc4, &data, 1); | ||
3686 | data = v; | ||
3687 | i2c_write(gspca_dev, 0xc5, &data, 1); | ||
3688 | v = 1093 - 12 * sd->backlight; | ||
3689 | data = v >> 8; | ||
3690 | i2c_write(gspca_dev, 0xc6, &data, 1); | ||
3691 | data = v; | ||
3692 | i2c_write(gspca_dev, 0xc7, &data, 1); | ||
3693 | v = 342 + 9 * sd->backlight; | ||
3694 | data = v >> 8; | ||
3695 | i2c_write(gspca_dev, 0xc8, &data, 1); | ||
3696 | data = v; | ||
3697 | i2c_write(gspca_dev, 0xc9, &data, 1); | ||
3698 | v = 702 - 9 * sd->backlight; | ||
3699 | data = v >> 8; | ||
3700 | i2c_write(gspca_dev, 0xca, &data, 1); | ||
3701 | data = v; | ||
3702 | i2c_write(gspca_dev, 0xcb, &data, 1); | ||
3703 | } | ||
3704 | |||
3705 | static void setwb(struct gspca_dev *gspca_dev) | ||
3706 | { | ||
3707 | /*fixme:to do - valid when reg d1 = 0x1c - (reg16 + reg15 = 0xa3)*/ | ||
3708 | static const u8 data[2] = {0x00, 0x00}; | ||
3709 | |||
3710 | i2c_write(gspca_dev, 0x16, &data[0], 1); | ||
3711 | i2c_write(gspca_dev, 0x18, &data[1], 1); | ||
3712 | } | ||
3554 | 3713 | ||
3555 | static int sd_start(struct gspca_dev *gspca_dev) | 3714 | static int sd_start(struct gspca_dev *gspca_dev) |
3556 | { | 3715 | { |
@@ -3662,6 +3821,16 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
3662 | default: | 3821 | default: |
3663 | /* case SENSOR_POxxxx: */ | 3822 | /* case SENSOR_POxxxx: */ |
3664 | usb_exchange(gspca_dev, poxxxx_init_common); | 3823 | usb_exchange(gspca_dev, poxxxx_init_common); |
3824 | setgamma(gspca_dev); | ||
3825 | setbacklight(gspca_dev); | ||
3826 | setbrightness(gspca_dev); | ||
3827 | setcontrast(gspca_dev); | ||
3828 | setcolors(gspca_dev); | ||
3829 | setsharpness(gspca_dev); | ||
3830 | setautogain(gspca_dev); | ||
3831 | setexposure(gspca_dev); | ||
3832 | setgain(gspca_dev); | ||
3833 | usb_exchange(gspca_dev, poxxxx_init_start_3); | ||
3665 | if (mode) | 3834 | if (mode) |
3666 | init = poxxxx_initQVGA; | 3835 | init = poxxxx_initQVGA; |
3667 | else | 3836 | else |
@@ -3693,7 +3862,6 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
3693 | break; | 3862 | break; |
3694 | } | 3863 | } |
3695 | msleep(100); | 3864 | msleep(100); |
3696 | setsharpness(gspca_dev); | ||
3697 | sethvflip(gspca_dev); | 3865 | sethvflip(gspca_dev); |
3698 | setlightfreq(gspca_dev); | 3866 | setlightfreq(gspca_dev); |
3699 | } | 3867 | } |
@@ -3704,14 +3872,10 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
3704 | reg_w(gspca_dev, 0xa0, 0x0000, 0xbfff); | 3872 | reg_w(gspca_dev, 0xa0, 0x0000, 0xbfff); |
3705 | break; | 3873 | break; |
3706 | case SENSOR_POxxxx: | 3874 | case SENSOR_POxxxx: |
3707 | setcolors(gspca_dev); | ||
3708 | setbrightness(gspca_dev); | ||
3709 | setcontrast(gspca_dev); | ||
3710 | |||
3711 | /* led on */ | ||
3712 | msleep(80); | ||
3713 | reg_w(gspca_dev, 0x89, 0xffff, 0xfdff); | ||
3714 | usb_exchange(gspca_dev, poxxxx_init_end_2); | 3875 | usb_exchange(gspca_dev, poxxxx_init_end_2); |
3876 | setwb(gspca_dev); | ||
3877 | msleep(80); /* led on */ | ||
3878 | reg_w(gspca_dev, 0x89, 0xffff, 0xfdff); | ||
3715 | break; | 3879 | break; |
3716 | } | 3880 | } |
3717 | return gspca_dev->usb_err; | 3881 | return gspca_dev->usb_err; |
@@ -3911,6 +4075,80 @@ static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val) | |||
3911 | return 0; | 4075 | return 0; |
3912 | } | 4076 | } |
3913 | 4077 | ||
4078 | static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val) | ||
4079 | { | ||
4080 | struct sd *sd = (struct sd *) gspca_dev; | ||
4081 | |||
4082 | sd->gain = val; | ||
4083 | if (gspca_dev->streaming) | ||
4084 | setgain(gspca_dev); | ||
4085 | return gspca_dev->usb_err; | ||
4086 | } | ||
4087 | |||
4088 | static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val) | ||
4089 | { | ||
4090 | struct sd *sd = (struct sd *) gspca_dev; | ||
4091 | |||
4092 | *val = sd->gain; | ||
4093 | return 0; | ||
4094 | } | ||
4095 | |||
4096 | static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val) | ||
4097 | { | ||
4098 | struct sd *sd = (struct sd *) gspca_dev; | ||
4099 | |||
4100 | sd->exposure = val; | ||
4101 | if (gspca_dev->streaming) | ||
4102 | setexposure(gspca_dev); | ||
4103 | return gspca_dev->usb_err; | ||
4104 | } | ||
4105 | |||
4106 | static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val) | ||
4107 | { | ||
4108 | struct sd *sd = (struct sd *) gspca_dev; | ||
4109 | |||
4110 | *val = sd->exposure; | ||
4111 | return 0; | ||
4112 | } | ||
4113 | |||
4114 | static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) | ||
4115 | { | ||
4116 | struct sd *sd = (struct sd *) gspca_dev; | ||
4117 | |||
4118 | sd->autogain = val; | ||
4119 | if (gspca_dev->streaming) | ||
4120 | setautogain(gspca_dev); | ||
4121 | |||
4122 | return gspca_dev->usb_err; | ||
4123 | } | ||
4124 | |||
4125 | static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val) | ||
4126 | { | ||
4127 | struct sd *sd = (struct sd *) gspca_dev; | ||
4128 | |||
4129 | *val = sd->autogain; | ||
4130 | return 0; | ||
4131 | } | ||
4132 | |||
4133 | static int sd_setbacklight(struct gspca_dev *gspca_dev, __s32 val) | ||
4134 | { | ||
4135 | struct sd *sd = (struct sd *) gspca_dev; | ||
4136 | |||
4137 | sd->backlight = val; | ||
4138 | if (gspca_dev->streaming) | ||
4139 | setbacklight(gspca_dev); | ||
4140 | |||
4141 | return gspca_dev->usb_err; | ||
4142 | } | ||
4143 | |||
4144 | static int sd_getbacklight(struct gspca_dev *gspca_dev, __s32 *val) | ||
4145 | { | ||
4146 | struct sd *sd = (struct sd *) gspca_dev; | ||
4147 | |||
4148 | *val = sd->backlight; | ||
4149 | return 0; | ||
4150 | } | ||
4151 | |||
3914 | static int sd_querymenu(struct gspca_dev *gspca_dev, | 4152 | static int sd_querymenu(struct gspca_dev *gspca_dev, |
3915 | struct v4l2_querymenu *menu) | 4153 | struct v4l2_querymenu *menu) |
3916 | { | 4154 | { |