Web lists-archives.com

[Spca50x-devs] PATCH: sn9c103 - OV7630 initialization modes




This patch allow my webcam to work in 640x480 and 320x240 modes correctly.
From what I can read from the datasheet and from my windows's logs these are the unique resolutions the OV7630 sensor supports.

In windows, when the webcam is put on 160x120, 172x144, 320x240, 352x288, the initialization is always the same, the one used for 320x240. That's why I disable the 160x120 mode when my webcam is detected, but I can be mistaken.

Regards,

Andoni
changeset:   8246:2d54b726ce04
tag:         tip
user:        andoni@xxxxxxxxxxxxxxxx
date:        Thu Jul 10 19:32:43 2008 -0300
summary:     Now works fine in 640x480 and 320x240

diff -r 045bc5e26f6b -r 2d54b726ce04 linux/drivers/media/video/gspca/sonixb.c
--- a/linux/drivers/media/video/gspca/sonixb.c	Thu Jul 10 13:12:24 2008 +0200
+++ b/linux/drivers/media/video/gspca/sonixb.c	Thu Jul 10 19:32:43 2008 -0300
@@ -304,8 +304,14 @@
 	{0xa0, 0x21, 0x76, 0x02, 0xbd, 0x06, 0xf6, 0x16},
 	{0xa0, 0x21, 0x00, 0x10, 0xbd, 0x06, 0xf6, 0x15},	/* gain */
 };
-static const __u8 ov7630_sensor_init_3[][8] = {
-	{0xa0, 0x21, 0x10, 0x83, 0xbd, 0x06, 0xf6, 0x16},      /* exposure */
+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 */
@@ -313,7 +319,7 @@
 		* 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 initPas106[] = {
 	0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x00, 0x00,
@@ -738,6 +744,11 @@
 	if (!sif) {
 		cam->cam_mode = vga_mode;
 		cam->nmodes = ARRAY_SIZE(vga_mode);
+		if (sd->sensor == SENSOR_OV7630_3) {
+			// We only have 320x240 & 640x480
+			cam->cam_mode++;
+			cam->nmodes--;
+		}
 	} else {
 		cam->cam_mode = sif_mode;
 		cam->nmodes = ARRAY_SIZE(sif_mode);
@@ -888,8 +899,8 @@
 		i2c_w_vector(dev, ov7630_sensor_init_com,
 				sizeof ov7630_sensor_init_com);
 		msleep(200);
-		i2c_w_vector(dev, ov7630_sensor_init_3,
-				sizeof ov7630_sensor_init_3);
+		i2c_w_vector(dev, ov7630_sensor_init_3[mode],
+			        sizeof ov7630_sensor_init_3[mode]);
 		break;
 	case SENSOR_PAS106:
 		pas106_i2cinit(dev);

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Spca50x-devs mailing list
Spca50x-devs@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/spca50x-devs