diff options
author | Erik Andrén <erik.andren@gmail.com> | 2009-04-27 14:38:05 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-16 17:20:46 -0400 |
commit | 57851d0cd0b4b9058a10ca81efc4cb6cbc9323e7 (patch) | |
tree | 2e62239d65b56ec501908e5eca9d0f7d0557223a /drivers/media | |
parent | 4c3414eeb3a275a017399ea162615292b00d087f (diff) |
V4L/DVB (11632): gspca - m5602-s5k83a: Reset the v4l2 ctrl cache upon sensor init
Signed-off-by: Erik Andrén <erik.andren@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/gspca/m5602/m5602_s5k83a.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k83a.c b/drivers/media/video/gspca/m5602/m5602_s5k83a.c index e1529afd4940..646796d21c5b 100644 --- a/drivers/media/video/gspca/m5602/m5602_s5k83a.c +++ b/drivers/media/video/gspca/m5602/m5602_s5k83a.c | |||
@@ -124,7 +124,8 @@ const static struct ctrl s5k83a_ctrls[] = { | |||
124 | static void s5k83a_dump_registers(struct sd *sd); | 124 | static void s5k83a_dump_registers(struct sd *sd); |
125 | static int s5k83a_get_rotation(struct sd *sd, u8 *reg_data); | 125 | static int s5k83a_get_rotation(struct sd *sd, u8 *reg_data); |
126 | static int s5k83a_set_led_indication(struct sd *sd, u8 val); | 126 | static int s5k83a_set_led_indication(struct sd *sd, u8 val); |
127 | int s5k83a_set_flip_real(struct gspca_dev *gspca_dev, __s32 vflip, __s32 hflip); | 127 | static int s5k83a_set_flip_real(struct gspca_dev *gspca_dev, |
128 | __s32 vflip, __s32 hflip); | ||
128 | 129 | ||
129 | int s5k83a_probe(struct sd *sd) | 130 | int s5k83a_probe(struct sd *sd) |
130 | { | 131 | { |
@@ -198,6 +199,7 @@ sensor_found: | |||
198 | int s5k83a_init(struct sd *sd) | 199 | int s5k83a_init(struct sd *sd) |
199 | { | 200 | { |
200 | int i, err = 0; | 201 | int i, err = 0; |
202 | s32 *sensor_settings = sd->sensor_priv; | ||
201 | 203 | ||
202 | for (i = 0; i < ARRAY_SIZE(init_s5k83a) && !err; i++) { | 204 | for (i = 0; i < ARRAY_SIZE(init_s5k83a) && !err; i++) { |
203 | u8 data[2] = {0x00, 0x00}; | 205 | u8 data[2] = {0x00, 0x00}; |
@@ -230,7 +232,27 @@ int s5k83a_init(struct sd *sd) | |||
230 | if (dump_sensor) | 232 | if (dump_sensor) |
231 | s5k83a_dump_registers(sd); | 233 | s5k83a_dump_registers(sd); |
232 | 234 | ||
233 | return (err < 0) ? err : 0; | 235 | err = s5k83a_set_gain(&sd->gspca_dev, sensor_settings[GAIN_IDX]); |
236 | if (err < 0) | ||
237 | return err; | ||
238 | |||
239 | err = s5k83a_set_brightness(&sd->gspca_dev, | ||
240 | sensor_settings[BRIGHTNESS_IDX]); | ||
241 | if (err < 0) | ||
242 | return err; | ||
243 | |||
244 | err = s5k83a_set_exposure(&sd->gspca_dev, | ||
245 | sensor_settings[EXPOSURE_IDX]); | ||
246 | if (err < 0) | ||
247 | return err; | ||
248 | |||
249 | err = s5k83a_set_hflip(&sd->gspca_dev, sensor_settings[HFLIP_IDX]); | ||
250 | if (err < 0) | ||
251 | return err; | ||
252 | |||
253 | err = s5k83a_set_vflip(&sd->gspca_dev, sensor_settings[VFLIP_IDX]); | ||
254 | |||
255 | return err; | ||
234 | } | 256 | } |
235 | 257 | ||
236 | static int rotation_thread_function(void *data) | 258 | static int rotation_thread_function(void *data) |
@@ -282,7 +304,8 @@ int s5k83a_start(struct sd *sd) | |||
282 | /* Create another thread, polling the GPIO ports of the camera to check | 304 | /* Create another thread, polling the GPIO ports of the camera to check |
283 | if it got rotated. This is how the windows driver does it so we have | 305 | if it got rotated. This is how the windows driver does it so we have |
284 | to assume that there is no better way of accomplishing this */ | 306 | to assume that there is no better way of accomplishing this */ |
285 | sens_priv->rotation_thread = kthread_create(rotation_thread_function, sd, "rotation thread"); | 307 | sens_priv->rotation_thread = kthread_create(rotation_thread_function, |
308 | sd, "rotation thread"); | ||
286 | wake_up_process(sens_priv->rotation_thread); | 309 | wake_up_process(sens_priv->rotation_thread); |
287 | 310 | ||
288 | return s5k83a_set_led_indication(sd, 1); | 311 | return s5k83a_set_led_indication(sd, 1); |
@@ -402,7 +425,8 @@ static int s5k83a_get_vflip(struct gspca_dev *gspca_dev, __s32 *val) | |||
402 | return 0; | 425 | return 0; |
403 | } | 426 | } |
404 | 427 | ||
405 | int s5k83a_set_flip_real(struct gspca_dev *gspca_dev, __s32 vflip, __s32 hflip) | 428 | static int s5k83a_set_flip_real(struct gspca_dev *gspca_dev, |
429 | __s32 vflip, __s32 hflip) | ||
406 | { | 430 | { |
407 | int err; | 431 | int err; |
408 | u8 data[1]; | 432 | u8 data[1]; |
@@ -505,7 +529,7 @@ static int s5k83a_set_led_indication(struct sd *sd, u8 val) | |||
505 | 529 | ||
506 | err = m5602_write_bridge(sd, M5602_XB_GPIO_DAT, data[0]); | 530 | err = m5602_write_bridge(sd, M5602_XB_GPIO_DAT, data[0]); |
507 | 531 | ||
508 | return (err < 0) ? err : 0; | 532 | return err; |
509 | } | 533 | } |
510 | 534 | ||
511 | /* Get camera rotation on Acer notebooks */ | 535 | /* Get camera rotation on Acer notebooks */ |