From: Erik Andr?n Date: Thu, 8 Jan 2009 21:11:05 +0000 (-0300) Subject: V4L/DVB (11464): gspca - m5602-mt9m111: Set the cached v4l2 ctrl values X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=dd3ec39871ba83fb47364a26b1caaac4494deb7b;p=mv-sheeva.git 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 Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/gspca/m5602/m5602_mt9m111.c b/drivers/media/video/gspca/m5602/m5602_mt9m111.c index 519548d07af..8700f37deca 100644 --- a/drivers/media/video/gspca/m5602/m5602_mt9m111.c +++ b/drivers/media/video/gspca/m5602/m5602_mt9m111.c @@ -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; + + 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) diff --git a/drivers/media/video/gspca/m5602/m5602_mt9m111.h b/drivers/media/video/gspca/m5602/m5602_mt9m111.h index 91386324757..c198734c807 100644 --- a/drivers/media/video/gspca/m5602/m5602_mt9m111.h +++ b/drivers/media/video/gspca/m5602/m5602_mt9m111.h @@ -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