diff options
author | Andoni Zubimendi <andoni.zubimendi@gmail.com> | 2008-07-17 04:35:52 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:27:24 -0400 |
commit | d87616f5a5af028d399f2c3e14c3115c67e415cf (patch) | |
tree | bd4a209bf61ecc33103ee64af00a7803822e1bdb /drivers/media/video/gspca/sonixb.c | |
parent | a975a5279e39b5bc104cc8329d25a36a25136ad9 (diff) |
V4L/DVB (8367): gspca: Light frequency filter / exposure / clean-up for sn9c103 ov7630.
Signed-off-by: Andoni Zubimendi <andoni.zubimendi@gmail.com>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/gspca/sonixb.c')
-rw-r--r-- | drivers/media/video/gspca/sonixb.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c index 4625a464a547..045ed6b7d053 100644 --- a/drivers/media/video/gspca/sonixb.c +++ b/drivers/media/video/gspca/sonixb.c | |||
@@ -291,22 +291,9 @@ static const __u8 ov7630_sensor_init[][8] = { | |||
291 | {0xa0, 0x21, 0x76, 0x02, 0xbd, 0x06, 0xf6, 0x16}, | 291 | {0xa0, 0x21, 0x76, 0x02, 0xbd, 0x06, 0xf6, 0x16}, |
292 | {0xa0, 0x21, 0x00, 0x10, 0xbd, 0x06, 0xf6, 0x15}, /* gain */ | 292 | {0xa0, 0x21, 0x00, 0x10, 0xbd, 0x06, 0xf6, 0x15}, /* gain */ |
293 | }; | 293 | }; |
294 | static const __u8 ov7630_sensor_init_3[][5][8] = { | 294 | static const __u8 ov7630_sensor_init_3[][8] = { |
295 | { {0xa0, 0x21, 0x10, 0x36, 0xbd, 0x06, 0xf6, 0x16}, /* exposure */ | 295 | {0xa0, 0x21, 0x2a, 0xa0, 0x00, 0x00, 0x00, 0x10}, |
296 | {0xa0, 0x21, 0x76, 0x03, 0xbd, 0x06, 0xf6, 0x16}, | 296 | {0xa0, 0x21, 0x2a, 0x80, 0x00, 0x00, 0x00, 0x10}, |
297 | {0xa0, 0x21, 0x11, 0x01, 0xbd, 0x06, 0xf6, 0x16}, | ||
298 | {0xa0, 0x21, 0x00, 0x10, 0xbd, 0x06, 0xf6, 0x15}, /* gain */ | ||
299 | {0xb0, 0x21, 0x2a, 0xa0, 0x1c, 0x06, 0xf6, 0x1d}, | ||
300 | }, | ||
301 | { {0xa0, 0x21, 0x10, 0x83, 0xbd, 0x06, 0xf6, 0x16}, /* exposure */ | ||
302 | {0xa0, 0x21, 0x76, 0x00, 0xbd, 0x06, 0xf6, 0x16}, | ||
303 | {0xa0, 0x21, 0x11, 0x00, 0xbd, 0x06, 0xf6, 0x16}, | ||
304 | {0xa0, 0x21, 0x00, 0x10, 0xbd, 0x06, 0xf6, 0x15}, /* gain */ | ||
305 | /* {0xb0, 0x21, 0x2a, 0xc0, 0x3c, 0x06, 0xf6, 0x1d}, | ||
306 | * a0 1c,a0 1f,c0 3c frame rate ?line interval from ov6630 */ | ||
307 | /* {0xb0, 0x21, 0x2a, 0xa0, 0x1f, 0x06, 0xf6, 0x1d}, * from win */ | ||
308 | {0xb0, 0x21, 0x2a, 0x80, 0x60, 0x06, 0xf6, 0x1d}, | ||
309 | } | ||
310 | }; | 297 | }; |
311 | 298 | ||
312 | static const __u8 initPas106[] = { | 299 | static const __u8 initPas106[] = { |
@@ -693,6 +680,15 @@ static void setexposure(struct gspca_dev *gspca_dev) | |||
693 | i2c[1] = sd->sensor_addr; | 680 | i2c[1] = sd->sensor_addr; |
694 | i2c[3] = reg10; | 681 | i2c[3] = reg10; |
695 | i2c[4] |= reg11 - 1; | 682 | i2c[4] |= reg11 - 1; |
683 | if (sd->sensor == SENSOR_OV7630_3) { | ||
684 | __u8 reg76 = reg10 & 0x03; | ||
685 | __u8 i2c_reg76[] = {0xa0, 0x21, 0x76, 0x00, | ||
686 | 0x00, 0x00, 0x00, 0x10}; | ||
687 | reg10 >>= 2; | ||
688 | i2c_reg76[3] = reg76; | ||
689 | if (i2c_w(gspca_dev, i2c_reg76) < 0) | ||
690 | PDEBUG(D_ERR, "i2c error exposure"); | ||
691 | } | ||
696 | if (i2c_w(gspca_dev, i2c) < 0) | 692 | if (i2c_w(gspca_dev, i2c) < 0) |
697 | PDEBUG(D_ERR, "i2c error exposure"); | 693 | PDEBUG(D_ERR, "i2c error exposure"); |
698 | break; | 694 | break; |
@@ -705,12 +701,13 @@ static void setfreq(struct gspca_dev *gspca_dev) | |||
705 | struct sd *sd = (struct sd *) gspca_dev; | 701 | struct sd *sd = (struct sd *) gspca_dev; |
706 | 702 | ||
707 | switch (sd->sensor) { | 703 | switch (sd->sensor) { |
708 | case SENSOR_OV6650: { | 704 | case SENSOR_OV6650: |
705 | case SENSOR_OV7630_3: { | ||
709 | /* Framerate adjust register for artificial light 50 hz flicker | 706 | /* Framerate adjust register for artificial light 50 hz flicker |
710 | compensation, identical to ov6630 0x2b register, see ov6630 | 707 | compensation, identical to ov6630 0x2b register, see ov6630 |
711 | datasheet. | 708 | datasheet. |
712 | 0x4f -> (30 fps -> 25 fps), 0x00 -> no adjustment */ | 709 | 0x4f -> (30 fps -> 25 fps), 0x00 -> no adjustment */ |
713 | __u8 i2c[] = {0xa0, 0x60, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10}; | 710 | __u8 i2c[] = {0xa0, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10}; |
714 | switch (sd->freq) { | 711 | switch (sd->freq) { |
715 | default: | 712 | default: |
716 | /* case 0: * no filter*/ | 713 | /* case 0: * no filter*/ |
@@ -718,9 +715,10 @@ static void setfreq(struct gspca_dev *gspca_dev) | |||
718 | i2c[3] = 0; | 715 | i2c[3] = 0; |
719 | break; | 716 | break; |
720 | case 1: /* 50 hz */ | 717 | case 1: /* 50 hz */ |
721 | i2c[3] = 0x4f; | 718 | i2c[3] = (sd->sensor == SENSOR_OV6650)? 0x4f:0x8a; |
722 | break; | 719 | break; |
723 | } | 720 | } |
721 | i2c[1] = sd->sensor_addr; | ||
724 | if (i2c_w(gspca_dev, i2c) < 0) | 722 | if (i2c_w(gspca_dev, i2c) < 0) |
725 | PDEBUG(D_ERR, "i2c error setfreq"); | 723 | PDEBUG(D_ERR, "i2c error setfreq"); |
726 | break; | 724 | break; |
@@ -804,7 +802,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
804 | sd->sensor_addr = 0x21; | 802 | sd->sensor_addr = 0x21; |
805 | sd->fr_h_sz = 18; /* size of frame header */ | 803 | sd->fr_h_sz = 18; /* size of frame header */ |
806 | sd->sensor_has_gain = 1; | 804 | sd->sensor_has_gain = 1; |
807 | sd->sd_desc.nctrls = 4; | 805 | sd->sd_desc.nctrls = 5; |
808 | sd->sd_desc.dq_callback = do_autogain; | 806 | sd->sd_desc.dq_callback = do_autogain; |
809 | sd->autogain = 0; | 807 | sd->autogain = 0; |
810 | break; | 808 | break; |
@@ -982,8 +980,7 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
982 | i2c_w_vector(gspca_dev, ov7630_sensor_init_com, | 980 | i2c_w_vector(gspca_dev, ov7630_sensor_init_com, |
983 | sizeof ov7630_sensor_init_com); | 981 | sizeof ov7630_sensor_init_com); |
984 | msleep(200); | 982 | msleep(200); |
985 | i2c_w_vector(gspca_dev, ov7630_sensor_init_3[mode], | 983 | i2c_w(gspca_dev, ov7630_sensor_init_3[mode]); |
986 | sizeof ov7630_sensor_init_3[mode]); | ||
987 | break; | 984 | break; |
988 | case SENSOR_PAS106: | 985 | case SENSOR_PAS106: |
989 | pas106_i2cinit(gspca_dev); | 986 | pas106_i2cinit(gspca_dev); |