aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorErik Andr?n <erik.andren@gmail.com>2009-01-09 01:30:54 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 17:20:27 -0400
commitd4a389a39bb9586219641144ab0c79706bbc8bcc (patch)
treea6fae7180b3526b1a4fb97f9c27924db552a0164 /drivers/media/video
parentdd3ec39871ba83fb47364a26b1caaac4494deb7b (diff)
V4L/DVB (11465): gspca - m5602-s5k4aa: Set all v4l2 ctrls on sensor init.
Reset all v4l2 ctrls on the s5k4aa init. The prevents all ctrls to be reset during resume from ram. Signed-off-by: Erik Andr?n <erik.andren@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/gspca/m5602/m5602_s5k4aa.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
index e8fbeac626cd..fe574ef24c94 100644
--- a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
+++ b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
@@ -204,6 +204,10 @@ sensor_found:
204 for (i = 0; i < ARRAY_SIZE(s5k4aa_ctrls); i++) 204 for (i = 0; i < ARRAY_SIZE(s5k4aa_ctrls); i++)
205 sensor_settings[i] = s5k4aa_ctrls[i].qctrl.default_value; 205 sensor_settings[i] = s5k4aa_ctrls[i].qctrl.default_value;
206 sd->sensor_priv = sensor_settings; 206 sd->sensor_priv = sensor_settings;
207
208 if (dump_sensor)
209 s5k4aa_dump_registers(sd);
210
207 return 0; 211 return 0;
208} 212}
209 213
@@ -213,8 +217,7 @@ int s5k4aa_start(struct sd *sd)
213 u8 data[2]; 217 u8 data[2];
214 struct cam *cam = &sd->gspca_dev.cam; 218 struct cam *cam = &sd->gspca_dev.cam;
215 219
216 switch (cam->cam_mode[sd->gspca_dev.curr_mode].width) 220 switch (cam->cam_mode[sd->gspca_dev.curr_mode].width) {
217 {
218 case 640: 221 case 640:
219 PDEBUG(D_V4L2, "Configuring camera for VGA mode"); 222 PDEBUG(D_V4L2, "Configuring camera for VGA mode");
220 223
@@ -253,6 +256,7 @@ int s5k4aa_start(struct sd *sd)
253int s5k4aa_init(struct sd *sd) 256int s5k4aa_init(struct sd *sd)
254{ 257{
255 int i, err = 0; 258 int i, err = 0;
259 s32 *sensor_settings = sd->sensor_priv;
256 260
257 for (i = 0; i < ARRAY_SIZE(init_s5k4aa) && !err; i++) { 261 for (i = 0; i < ARRAY_SIZE(init_s5k4aa) && !err; i++) {
258 u8 data[2] = {0x00, 0x00}; 262 u8 data[2] = {0x00, 0x00};
@@ -282,30 +286,22 @@ int s5k4aa_init(struct sd *sd)
282 } 286 }
283 } 287 }
284 288
285 if (dump_sensor) 289 err = s5k4aa_set_exposure(&sd->gspca_dev,
286 s5k4aa_dump_registers(sd); 290 sensor_settings[EXPOSURE_IDX]);
291 if (err < 0)
292 return err;
287 293
288 if (!err && dmi_check_system(s5k4aa_vflip_dmi_table)) { 294 err = s5k4aa_set_gain(&sd->gspca_dev, sensor_settings[GAIN_IDX]);
289 u8 data = 0x02; 295 if (err < 0)
290 info("vertical flip quirk active"); 296 return err;
291 m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
292 m5602_read_sensor(sd, S5K4AA_READ_MODE, &data, 1);
293 data |= S5K4AA_RM_V_FLIP;
294 data &= ~S5K4AA_RM_H_FLIP;
295 m5602_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
296
297 /* Decrement COLSTART to preserve color order (BGGR) */
298 m5602_read_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
299 data--;
300 m5602_write_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
301 297
302 /* Increment ROWSTART to preserve color order (BGGR) */ 298 err = s5k4aa_set_vflip(&sd->gspca_dev, sensor_settings[VFLIP_IDX]);
303 m5602_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1); 299 if (err < 0)
304 data++; 300 return err;
305 m5602_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
306 }
307 301
308 return (err < 0) ? err : 0; 302 err = s5k4aa_set_hflip(&sd->gspca_dev, sensor_settings[HFLIP_IDX]);
303
304 return err;
309} 305}
310 306
311int s5k4aa_get_exposure(struct gspca_dev *gspca_dev, __s32 *val) 307int s5k4aa_get_exposure(struct gspca_dev *gspca_dev, __s32 *val)
@@ -378,6 +374,9 @@ int s5k4aa_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
378 if (err < 0) 374 if (err < 0)
379 return err; 375 return err;
380 376
377 if (dmi_check_system(s5k4aa_vflip_dmi_table))
378 val = !val;
379
381 if (val) { 380 if (val) {
382 err = m5602_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1); 381 err = m5602_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
383 if (err < 0) 382 if (err < 0)