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: Erik Andr?n <erik.andren@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Erik Andr?n 2009-01-08 18:11:05 -03:00 committed by Mauro Carvalho Chehab
parent 6e5ccf83ef
commit dd3ec39871
2 changed files with 14 additions and 9 deletions

View File

@ -136,12 +136,16 @@ sensor_found:
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;
return (err < 0) ? err : 0;
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;
}
void mt9m111_disconnect(struct sd *sd)

View File

@ -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