]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
V4L/DVB (11464): gspca - m5602-mt9m111: Set the cached v4l2 ctrl values
authorErik Andr?n <erik.andren@gmail.com>
Thu, 8 Jan 2009 21:11:05 +0000 (18:11 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 16 Jun 2009 21:20:26 +0000 (18:20 -0300)
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>
drivers/media/video/gspca/m5602/m5602_mt9m111.c
drivers/media/video/gspca/m5602/m5602_mt9m111.h

index 519548d07af6bffeb58f99cdbc4a7377d93110c8..8700f37deca9cc039a0ecc9384424b209e995bfa 100644 (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;
+
+       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)
index 91386324757e201f52f2082a9dfdbf60198ede49..c198734c807d3d1074e732dce19c8696ac26036e 100644 (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