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

V4L/DVB (11464): gspca - m5602-mt9m111: Set the cached v4l2 ctrl values

When we resume the machine we want the previously set values, not the default
values. Fix this for the mt9m111 sensor
Signed-off-by: default avatarErik Andr?n <erik.andren@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 6e5ccf83
......@@ -136,12 +136,16 @@ int mt9m111_probe(struct sd *sd)
sensor_settings[i] = mt9m111_ctrls[i].qctrl.default_value;
sd->sensor_priv = sensor_settings;
if (dump_sensor)
mt9m111_dump_registers(sd);
return 0;
}
int mt9m111_init(struct sd *sd)
{
int i, err = 0;
s32 *sensor_settings = sd->sensor_priv;
/* Init the sensor */
for (i = 0; i < ARRAY_SIZE(init_mt9m111) && !err; i++) {
......@@ -159,10 +163,17 @@ int mt9m111_init(struct sd *sd)
}
}
if (dump_sensor)
mt9m111_dump_registers(sd);
err = mt9m111_set_vflip(&sd->gspca_dev, sensor_settings[VFLIP_IDX]);
if (err < 0)
return err;
err = mt9m111_set_hflip(&sd->gspca_dev, sensor_settings[HFLIP_IDX]);
if (err < 0)
return err;
err = mt9m111_set_gain(&sd->gspca_dev, sensor_settings[GAIN_IDX]);
return (err < 0) ? err : 0;
return err;
}
void mt9m111_disconnect(struct sd *sd)
......
......@@ -290,7 +290,6 @@ static const unsigned char init_mt9m111[][4] =
{BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xa0, 0x00},
{SENSOR, MT9M111_PAGE_MAP, 0x00, 0x00},
{SENSOR, MT9M111_SC_SHUTTER_WIDTH, 0x01, 0xf4},
{SENSOR, MT9M111_SC_GLOBAL_GAIN, 0x00, 0xea},
{BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06, 0x00},
{BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
......@@ -452,7 +451,6 @@ static const unsigned char init_mt9m111[][4] =
{BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xa0, 0x00},
{SENSOR, MT9M111_PAGE_MAP, 0x00, 0x00},
{SENSOR, MT9M111_SC_SHUTTER_WIDTH, 0x01, 0xf4},
{SENSOR, MT9M111_SC_GLOBAL_GAIN, 0x00, 0xea},
{BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00},
{BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
......@@ -590,7 +588,6 @@ static const unsigned char init_mt9m111[][4] =
{BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xa0, 0x00},
{SENSOR, MT9M111_PAGE_MAP, 0x00, 0x00},
{SENSOR, MT9M111_SC_SHUTTER_WIDTH, 0x01, 0xf4},
{SENSOR, MT9M111_SC_GLOBAL_GAIN, 0x00, 0xea},
{BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00},
{BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
{SENSOR, MT9M111_PAGE_MAP, 0x00, 0x00},
......@@ -766,7 +763,6 @@ static const unsigned char init_mt9m111[][4] =
{SENSOR, MT9M111_PAGE_MAP, 0x00, 0x00},
{SENSOR, MT9M111_SC_SHUTTER_WIDTH, 0x01, 0x90},
{SENSOR, MT9M111_SC_GLOBAL_GAIN, 0x00, 0xe6},
{BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00},
{BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
{SENSOR, MT9M111_PAGE_MAP, 0x00, 0x00},
......@@ -945,8 +941,6 @@ static const unsigned char init_mt9m111[][4] =
{SENSOR, MT9M111_PAGE_MAP, 0x00, 0x00},
/* Set number of blank rows chosen to 400 */
{SENSOR, MT9M111_SC_SHUTTER_WIDTH, 0x01, 0x90},
/* Set the global gain to 283 (of 512) */
{SENSOR, MT9M111_SC_GLOBAL_GAIN, 0x03, 0x63}
};
#endif
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