Commit d4a389a3 authored by Erik Andr?n's avatar Erik Andr?n Committed by Mauro Carvalho Chehab

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: default avatarErik Andr?n <erik.andren@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent dd3ec398
......@@ -204,6 +204,10 @@ int s5k4aa_probe(struct sd *sd)
for (i = 0; i < ARRAY_SIZE(s5k4aa_ctrls); i++)
sensor_settings[i] = s5k4aa_ctrls[i].qctrl.default_value;
sd->sensor_priv = sensor_settings;
if (dump_sensor)
s5k4aa_dump_registers(sd);
return 0;
}
......@@ -213,8 +217,7 @@ int s5k4aa_start(struct sd *sd)
u8 data[2];
struct cam *cam = &sd->gspca_dev.cam;
switch (cam->cam_mode[sd->gspca_dev.curr_mode].width)
{
switch (cam->cam_mode[sd->gspca_dev.curr_mode].width) {
case 640:
PDEBUG(D_V4L2, "Configuring camera for VGA mode");
......@@ -253,6 +256,7 @@ int s5k4aa_start(struct sd *sd)
int s5k4aa_init(struct sd *sd)
{
int i, err = 0;
s32 *sensor_settings = sd->sensor_priv;
for (i = 0; i < ARRAY_SIZE(init_s5k4aa) && !err; i++) {
u8 data[2] = {0x00, 0x00};
......@@ -282,30 +286,22 @@ int s5k4aa_init(struct sd *sd)
}
}
if (dump_sensor)
s5k4aa_dump_registers(sd);
err = s5k4aa_set_exposure(&sd->gspca_dev,
sensor_settings[EXPOSURE_IDX]);
if (err < 0)
return err;
if (!err && dmi_check_system(s5k4aa_vflip_dmi_table)) {
u8 data = 0x02;
info("vertical flip quirk active");
m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
m5602_read_sensor(sd, S5K4AA_READ_MODE, &data, 1);
data |= S5K4AA_RM_V_FLIP;
data &= ~S5K4AA_RM_H_FLIP;
m5602_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
/* Decrement COLSTART to preserve color order (BGGR) */
m5602_read_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
data--;
m5602_write_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
err = s5k4aa_set_gain(&sd->gspca_dev, sensor_settings[GAIN_IDX]);
if (err < 0)
return err;
/* Increment ROWSTART to preserve color order (BGGR) */
m5602_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
data++;
m5602_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
}
err = s5k4aa_set_vflip(&sd->gspca_dev, sensor_settings[VFLIP_IDX]);
if (err < 0)
return err;
return (err < 0) ? err : 0;
err = s5k4aa_set_hflip(&sd->gspca_dev, sensor_settings[HFLIP_IDX]);
return err;
}
int 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)
if (err < 0)
return err;
if (dmi_check_system(s5k4aa_vflip_dmi_table))
val = !val;
if (val) {
err = m5602_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
if (err < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment