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) ...@@ -204,6 +204,10 @@ int s5k4aa_probe(struct sd *sd)
for (i = 0; i < ARRAY_SIZE(s5k4aa_ctrls); i++) for (i = 0; i < ARRAY_SIZE(s5k4aa_ctrls); i++)
sensor_settings[i] = s5k4aa_ctrls[i].qctrl.default_value; sensor_settings[i] = s5k4aa_ctrls[i].qctrl.default_value;
sd->sensor_priv = sensor_settings; sd->sensor_priv = sensor_settings;
if (dump_sensor)
s5k4aa_dump_registers(sd);
return 0; return 0;
} }
...@@ -213,8 +217,7 @@ int s5k4aa_start(struct sd *sd) ...@@ -213,8 +217,7 @@ int s5k4aa_start(struct sd *sd)
u8 data[2]; u8 data[2];
struct cam *cam = &sd->gspca_dev.cam; 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: case 640:
PDEBUG(D_V4L2, "Configuring camera for VGA mode"); PDEBUG(D_V4L2, "Configuring camera for VGA mode");
...@@ -253,6 +256,7 @@ int s5k4aa_start(struct sd *sd) ...@@ -253,6 +256,7 @@ int s5k4aa_start(struct sd *sd)
int s5k4aa_init(struct sd *sd) int s5k4aa_init(struct sd *sd)
{ {
int i, err = 0; int i, err = 0;
s32 *sensor_settings = sd->sensor_priv;
for (i = 0; i < ARRAY_SIZE(init_s5k4aa) && !err; i++) { for (i = 0; i < ARRAY_SIZE(init_s5k4aa) && !err; i++) {
u8 data[2] = {0x00, 0x00}; u8 data[2] = {0x00, 0x00};
...@@ -282,30 +286,22 @@ int s5k4aa_init(struct sd *sd) ...@@ -282,30 +286,22 @@ int s5k4aa_init(struct sd *sd)
} }
} }
if (dump_sensor) err = s5k4aa_set_exposure(&sd->gspca_dev,
s5k4aa_dump_registers(sd); sensor_settings[EXPOSURE_IDX]);
if (err < 0)
return err;
if (!err && dmi_check_system(s5k4aa_vflip_dmi_table)) { err = s5k4aa_set_gain(&sd->gspca_dev, sensor_settings[GAIN_IDX]);
u8 data = 0x02; if (err < 0)
info("vertical flip quirk active"); return err;
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);
/* Increment ROWSTART to preserve color order (BGGR) */ err = s5k4aa_set_vflip(&sd->gspca_dev, sensor_settings[VFLIP_IDX]);
m5602_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1); if (err < 0)
data++; return err;
m5602_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
}
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) 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) ...@@ -378,6 +374,9 @@ int s5k4aa_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
if (err < 0) if (err < 0)
return err; return err;
if (dmi_check_system(s5k4aa_vflip_dmi_table))
val = !val;
if (val) { if (val) {
err = m5602_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1); err = m5602_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
if (err < 0) 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