aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Andr?n <erik.andren@gmail.com>2009-01-07 16:05:08 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 17:20:25 -0400
commitcb29e691977ac7677ca62c13cc9aa1eab2463075 (patch)
tree24b8d41ea8a43426ac8f55d0db79e91586fef8ba
parent274290822e22bf4d5394ce029c867a4051342d38 (diff)
V4L/DVB (11458): gspca - m5602-po1030: Set all v4l2 controls at sensor init
Previously many of the v4l2 ctrls were set to their initial values at resume from ram/disk. This patch enforces the values stored in the ctrl cache. Signed-off-by: Erik Andr?n <erik.andren@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/gspca/m5602/m5602_po1030.c34
-rw-r--r--drivers/media/video/gspca/m5602/m5602_po1030.h20
2 files changed, 32 insertions, 22 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.c b/drivers/media/video/gspca/m5602/m5602_po1030.c
index 800b5f4cb0e4..7ec3fbffc4be 100644
--- a/drivers/media/video/gspca/m5602/m5602_po1030.c
+++ b/drivers/media/video/gspca/m5602/m5602_po1030.c
@@ -127,7 +127,7 @@ static void po1030_dump_registers(struct sd *sd);
127int po1030_probe(struct sd *sd) 127int po1030_probe(struct sd *sd)
128{ 128{
129 u8 prod_id = 0, ver_id = 0, i; 129 u8 prod_id = 0, ver_id = 0, i;
130 s32 *sensor_settings = sd->sensor_priv; 130 s32 *sensor_settings;
131 131
132 if (force_sensor) { 132 if (force_sensor) {
133 if (force_sensor == PO1030_SENSOR) { 133 if (force_sensor == PO1030_SENSOR) {
@@ -177,11 +177,16 @@ sensor_found:
177 for (i = 0; i < ARRAY_SIZE(po1030_ctrls); i++) 177 for (i = 0; i < ARRAY_SIZE(po1030_ctrls); i++)
178 sensor_settings[i] = po1030_ctrls[i].qctrl.default_value; 178 sensor_settings[i] = po1030_ctrls[i].qctrl.default_value;
179 sd->sensor_priv = sensor_settings; 179 sd->sensor_priv = sensor_settings;
180
181 if (dump_sensor)
182 po1030_dump_registers(sd);
183
180 return 0; 184 return 0;
181} 185}
182 186
183int po1030_init(struct sd *sd) 187int po1030_init(struct sd *sd)
184{ 188{
189 s32 *sensor_settings = sd->sensor_priv;
185 int i, err = 0; 190 int i, err = 0;
186 191
187 /* Init the sensor */ 192 /* Init the sensor */
@@ -206,10 +211,33 @@ int po1030_init(struct sd *sd)
206 return -EINVAL; 211 return -EINVAL;
207 } 212 }
208 } 213 }
214 if (err < 0)
215 return err;
209 216
210 if (dump_sensor) 217 err = po1030_set_exposure(&sd->gspca_dev,
211 po1030_dump_registers(sd); 218 sensor_settings[EXPOSURE_IDX]);
219 if (err < 0)
220 return err;
221
222 err = po1030_set_gain(&sd->gspca_dev, sensor_settings[GAIN_IDX]);
223 if (err < 0)
224 return err;
225
226 err = po1030_set_hflip(&sd->gspca_dev, sensor_settings[HFLIP_IDX]);
227 if (err < 0)
228 return err;
229
230 err = po1030_set_vflip(&sd->gspca_dev, sensor_settings[VFLIP_IDX]);
231 if (err < 0)
232 return err;
233
234 err = po1030_set_red_balance(&sd->gspca_dev,
235 sensor_settings[RED_BALANCE_IDX]);
236 if (err < 0)
237 return err;
212 238
239 err = po1030_set_red_balance(&sd->gspca_dev,
240 sensor_settings[BLUE_BALANCE_IDX]);
213 return err; 241 return err;
214} 242}
215 243
diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.h b/drivers/media/video/gspca/m5602/m5602_po1030.h
index 3e9648794df2..013be33d1b20 100644
--- a/drivers/media/video/gspca/m5602/m5602_po1030.h
+++ b/drivers/media/video/gspca/m5602/m5602_po1030.h
@@ -371,6 +371,7 @@ static const unsigned char init_po1030[][4] =
371 {SENSOR, PO1030_GC6, 0xc0}, 371 {SENSOR, PO1030_GC6, 0xc0},
372 {SENSOR, PO1030_GC7, 0xff}, 372 {SENSOR, PO1030_GC7, 0xff},
373 /*end of sequence 4*/ 373 /*end of sequence 4*/
374
374 /*sequence 5*/ 375 /*sequence 5*/
375 {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06}, 376 {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06},
376 {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, 377 {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
@@ -396,31 +397,12 @@ static const unsigned char init_po1030[][4] =
396 {BRIDGE, M5602_XB_SIG_INI, 0x00}, 397 {BRIDGE, M5602_XB_SIG_INI, 0x00},
397 /*end of sequence 5*/ 398 /*end of sequence 5*/
398 /*sequence 6*/ 399 /*sequence 6*/
399 /* Changing 40 in f0 the image becomes green in bayer mode and red in
400 * rgb mode */
401 {SENSOR, PO1030_RED_GAIN, PO1030_RED_GAIN_DEFAULT},
402 /* in changing 40 in f0 the image becomes green in bayer mode and red in
403 * rgb mode */
404 {SENSOR, PO1030_BLUE_GAIN, PO1030_BLUE_GAIN_DEFAULT},
405 400
406 /* with a very low lighted environment increase the exposure but 401 /* with a very low lighted environment increase the exposure but
407 * decrease the FPS (Frame Per Second) */ 402 * decrease the FPS (Frame Per Second) */
408 {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00}, 403 {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00},
409 {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, 404 {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
410 405
411 /* Controls high exposure more than SENSOR_LOW_EXPOSURE, use only in
412 * low lighted environment (f0 is more than ff ?)*/
413 {SENSOR, PO1030_INTEGLINES_H, ((PO1030_EXPOSURE_DEFAULT >> 2)
414 & 0xff)},
415
416 /* Controls middle exposure, use only in high lighted environment */
417 {SENSOR, PO1030_INTEGLINES_M, PO1030_EXPOSURE_DEFAULT & 0xff},
418
419 /* Controls clarity (not sure) */
420 {SENSOR, PO1030_INTEGLINES_L, 0x00},
421 /* Controls gain (the image is more lighted) */
422 {SENSOR, PO1030_GLOBALGAIN, PO1030_GLOBAL_GAIN_DEFAULT},
423
424 /* Sets the width */ 406 /* Sets the width */
425 {SENSOR, PO1030_FRAMEWIDTH_H, 0x02}, 407 {SENSOR, PO1030_FRAMEWIDTH_H, 0x02},
426 {SENSOR, PO1030_FRAMEWIDTH_L, 0xef} 408 {SENSOR, PO1030_FRAMEWIDTH_L, 0xef}