lists.zerezo.com
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Spca50x-devs] PATCH: gspca-mercurial OV7630 light frequency filter
- Date: Wed, 16 Jul 2008 21:07:40 -0300
- From: "Andoni Zubimendi" <andoni.zubimendi@xxxxxxxxx>
- Subject: Re: [Spca50x-devs] PATCH: gspca-mercurial OV7630 light frequency filter
I'm sorry, but the previous patch had an error an didn't set the LSB bits of AEC.
Here's a new patch. Additionaly, I've cleanup the initialization code of the OV7630 sensor.
Regards, and forgive me for the previous patch.
Andoni
diff -r 52caa9704f42 linux/drivers/media/video/gspca/sonixb.c
--- a/linux/drivers/media/video/gspca/sonixb.c Wed Jul 16 17:29:11 2008 +0200
+++ b/linux/drivers/media/video/gspca/sonixb.c Wed Jul 16 21:03:58 2008 -0300
@@ -317,22 +317,9 @@
{0xa0, 0x21, 0x76, 0x02, 0xbd, 0x06, 0xf6, 0x16},
{0xa0, 0x21, 0x00, 0x10, 0xbd, 0x06, 0xf6, 0x15}, /* gain */
};
-static const __u8 ov7630_sensor_init_3[][5][8] = {
- { {0xa0, 0x21, 0x10, 0x36, 0xbd, 0x06, 0xf6, 0x16}, /* exposure */
- {0xa0, 0x21, 0x76, 0x03, 0xbd, 0x06, 0xf6, 0x16},
- {0xa0, 0x21, 0x11, 0x01, 0xbd, 0x06, 0xf6, 0x16},
- {0xa0, 0x21, 0x00, 0x10, 0xbd, 0x06, 0xf6, 0x15}, /* gain */
- {0xb0, 0x21, 0x2a, 0xa0, 0x1c, 0x06, 0xf6, 0x1d},
- },
- { {0xa0, 0x21, 0x10, 0x83, 0xbd, 0x06, 0xf6, 0x16}, /* exposure */
- {0xa0, 0x21, 0x76, 0x00, 0xbd, 0x06, 0xf6, 0x16},
- {0xa0, 0x21, 0x11, 0x00, 0xbd, 0x06, 0xf6, 0x16},
- {0xa0, 0x21, 0x00, 0x10, 0xbd, 0x06, 0xf6, 0x15}, /* gain */
-/* {0xb0, 0x21, 0x2a, 0xc0, 0x3c, 0x06, 0xf6, 0x1d},
- * a0 1c,a0 1f,c0 3c frame rate ?line interval from ov6630 */
-/* {0xb0, 0x21, 0x2a, 0xa0, 0x1f, 0x06, 0xf6, 0x1d}, * from win */
- {0xb0, 0x21, 0x2a, 0x80, 0x60, 0x06, 0xf6, 0x1d},
- }
+static const __u8 ov7630_sensor_init_3[][8] = {
+ {0xa0, 0x21, 0x2a, 0xa0, 0x00, 0x00, 0x00, 0x10},
+ {0xa0, 0x21, 0x2a, 0x80, 0x00, 0x00, 0x00, 0x10},
};
static const __u8 initPas106[] = {
@@ -719,6 +706,15 @@
i2c[1] = sd->sensor_addr;
i2c[3] = reg10;
i2c[4] |= reg11 - 1;
+ if (sd->sensor == SENSOR_OV7630_3) {
+ __u8 reg76 = reg10 & 0x03;
+ __u8 i2c_reg76[] = {0xa0, 0x21, 0x76, 0x00,
+ 0x00, 0x00, 0x00, 0x10};
+ reg10 >>= 2;
+ i2c_reg76[3] = reg76;
+ if (i2c_w(gspca_dev, i2c_reg76) < 0)
+ PDEBUG(D_ERR, "i2c error exposure");
+ }
if (i2c_w(gspca_dev, i2c) < 0)
PDEBUG(D_ERR, "i2c error exposure");
break;
@@ -731,12 +727,13 @@
struct sd *sd = (struct sd *) gspca_dev;
switch (sd->sensor) {
- case SENSOR_OV6650: {
+ case SENSOR_OV6650:
+ case SENSOR_OV7630_3: {
/* Framerate adjust register for artificial light 50 hz flicker
compensation, identical to ov6630 0x2b register, see ov6630
datasheet.
0x4f -> (30 fps -> 25 fps), 0x00 -> no adjustment */
- __u8 i2c[] = {0xa0, 0x60, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10};
+ __u8 i2c[] = {0xa0, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10};
switch (sd->freq) {
default:
/* case 0: * no filter*/
@@ -744,9 +741,10 @@
i2c[3] = 0;
break;
case 1: /* 50 hz */
- i2c[3] = 0x4f;
+ i2c[3] = (sd->sensor == SENSOR_OV6650)? 0x4f:0x8a;
break;
}
+ i2c[1] = sd->sensor_addr;
if (i2c_w(gspca_dev, i2c) < 0)
PDEBUG(D_ERR, "i2c error setfreq");
break;
@@ -830,7 +828,7 @@
sd->sensor_addr = 0x21;
sd->fr_h_sz = 18; /* size of frame header */
sd->sensor_has_gain = 1;
- sd->sd_desc.nctrls = 4;
+ sd->sd_desc.nctrls = 5;
sd->sd_desc.dq_callback = do_autogain;
sd->autogain = 0;
break;
@@ -1008,8 +1006,7 @@
i2c_w_vector(gspca_dev, ov7630_sensor_init_com,
sizeof ov7630_sensor_init_com);
msleep(200);
- i2c_w_vector(gspca_dev, ov7630_sensor_init_3[mode],
- sizeof ov7630_sensor_init_3[mode]);
+ i2c_w(gspca_dev, ov7630_sensor_init_3[mode]);
break;
case SENSOR_PAS106:
pas106_i2cinit(gspca_dev);
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Spca50x-devs mailing list
Spca50x-devs@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/spca50x-devs