Web lists-archives.com

[Spca50x-devs] PATCH: gspca-mercurial OV7630 light frequency filter




Hi!

This patch adds the light frequency filter to the OV7630 sensor in my Webcam.

Also this patch adjust the exposure setting in the sensor, reading the datasheet, this sensor has the 2 LSB of the Automatic Exposure Control in the register 76.

Regards,

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 20:42:17 2008 -0300
@@ -719,6 +719,14 @@
 		i2c[1] = sd->sensor_addr;
 		i2c[3] = reg10;
 		i2c[4] |= reg11 - 1;
+		if (sd->sensor == SENSOR_OV7630_3) {
+			__u8 reg76 = reg10 & 0x03;
+			reg10 >>= 2;
+			__u8 i2c_reg76[] = {0xa0, 0x21, 0x76, 0x00, 
+					    0x00, 0x00, 0x00, 0x10};
+			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 +739,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 +753,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 +840,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;
-------------------------------------------------------------------------
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