diff options
author | James Blanford <jhblanford@gmail.com> | 2009-09-18 13:53:09 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-18 23:52:43 -0400 |
commit | 4711ca823bed12be879f22a930aa9deded9736df (patch) | |
tree | b7c465774372d38384d1e2ccfbae3bda06d1f184 /drivers/media/video/gspca | |
parent | 4fac17b4e73715aefe48f4ada7d4930cd4df6c31 (diff) |
V4L/DVB (13008): gspca - stv06xx-hdcs: Fixup exposure
Initialize image size before it's used to initialize exposure.
Work around lack of exposure set hardware latch with a sequence of
register writes in a single I2C command packet.
Signed-off-by: James Blanford <jhblanford@gmail.com>
Signed-off-by: Erik Andrén <erik.andren@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca')
-rw-r--r-- | drivers/media/video/gspca/stv06xx/stv06xx_hdcs.c | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx_hdcs.c b/drivers/media/video/gspca/stv06xx/stv06xx_hdcs.c index e180ce611583..1655dcd1a5dc 100644 --- a/drivers/media/video/gspca/stv06xx/stv06xx_hdcs.c +++ b/drivers/media/video/gspca/stv06xx/stv06xx_hdcs.c | |||
@@ -280,7 +280,7 @@ static int hdcs_set_exposure(struct gspca_dev *gspca_dev, __s32 val) | |||
280 | within the column processing period */ | 280 | within the column processing period */ |
281 | int mnct; | 281 | int mnct; |
282 | int cycles, err; | 282 | int cycles, err; |
283 | u8 exp[4]; | 283 | u8 exp[14]; |
284 | 284 | ||
285 | cycles = val * HDCS_CLK_FREQ_MHZ; | 285 | cycles = val * HDCS_CLK_FREQ_MHZ; |
286 | 286 | ||
@@ -316,24 +316,37 @@ static int hdcs_set_exposure(struct gspca_dev *gspca_dev, __s32 val) | |||
316 | srowexp = max_srowexp; | 316 | srowexp = max_srowexp; |
317 | 317 | ||
318 | if (IS_1020(sd)) { | 318 | if (IS_1020(sd)) { |
319 | exp[0] = rowexp & 0xff; | 319 | exp[0] = HDCS20_CONTROL; |
320 | exp[1] = rowexp >> 8; | 320 | exp[1] = 0x00; /* Stop streaming */ |
321 | exp[2] = (srowexp >> 2) & 0xff; | 321 | exp[2] = HDCS_ROWEXPL; |
322 | /* this clears exposure error flag */ | 322 | exp[3] = rowexp & 0xff; |
323 | exp[3] = 0x1; | 323 | exp[4] = HDCS_ROWEXPH; |
324 | err = hdcs_reg_write_seq(sd, HDCS_ROWEXPL, exp, 4); | 324 | exp[5] = rowexp >> 8; |
325 | exp[6] = HDCS20_SROWEXP; | ||
326 | exp[7] = (srowexp >> 2) & 0xff; | ||
327 | exp[8] = HDCS20_ERROR; | ||
328 | exp[9] = 0x10; /* Clear exposure error flag*/ | ||
329 | exp[10] = HDCS20_CONTROL; | ||
330 | exp[11] = 0x04; /* Restart streaming */ | ||
331 | err = stv06xx_write_sensor_bytes(sd, exp, 6); | ||
325 | } else { | 332 | } else { |
326 | exp[0] = rowexp & 0xff; | 333 | exp[0] = HDCS00_CONTROL; |
327 | exp[1] = rowexp >> 8; | 334 | exp[1] = 0x00; /* Stop streaming */ |
328 | exp[2] = srowexp & 0xff; | 335 | exp[2] = HDCS_ROWEXPL; |
329 | exp[3] = srowexp >> 8; | 336 | exp[3] = rowexp & 0xff; |
330 | err = hdcs_reg_write_seq(sd, HDCS_ROWEXPL, exp, 4); | 337 | exp[4] = HDCS_ROWEXPH; |
338 | exp[5] = rowexp >> 8; | ||
339 | exp[6] = HDCS00_SROWEXPL; | ||
340 | exp[7] = srowexp & 0xff; | ||
341 | exp[8] = HDCS00_SROWEXPH; | ||
342 | exp[9] = srowexp >> 8; | ||
343 | exp[10] = HDCS_STATUS; | ||
344 | exp[11] = 0x10; /* Clear exposure error flag*/ | ||
345 | exp[12] = HDCS00_CONTROL; | ||
346 | exp[13] = 0x04; /* Restart streaming */ | ||
347 | err = stv06xx_write_sensor_bytes(sd, exp, 7); | ||
331 | if (err < 0) | 348 | if (err < 0) |
332 | return err; | 349 | return err; |
333 | |||
334 | /* clear exposure error flag */ | ||
335 | err = stv06xx_write_sensor(sd, | ||
336 | HDCS_STATUS, BIT(4)); | ||
337 | } | 350 | } |
338 | PDEBUG(D_V4L2, "Writing exposure %d, rowexp %d, srowexp %d", | 351 | PDEBUG(D_V4L2, "Writing exposure %d, rowexp %d, srowexp %d", |
339 | val, rowexp, srowexp); | 352 | val, rowexp, srowexp); |
@@ -605,11 +618,11 @@ static int hdcs_init(struct sd *sd) | |||
605 | if (err < 0) | 618 | if (err < 0) |
606 | return err; | 619 | return err; |
607 | 620 | ||
608 | err = hdcs_set_exposure(&sd->gspca_dev, HDCS_DEFAULT_EXPOSURE); | 621 | err = hdcs_set_size(sd, hdcs->array.width, hdcs->array.height); |
609 | if (err < 0) | 622 | if (err < 0) |
610 | return err; | 623 | return err; |
611 | 624 | ||
612 | err = hdcs_set_size(sd, hdcs->array.width, hdcs->array.height); | 625 | err = hdcs_set_exposure(&sd->gspca_dev, HDCS_DEFAULT_EXPOSURE); |
613 | return err; | 626 | return err; |
614 | } | 627 | } |
615 | 628 | ||