Web lists-archives.com

[Spca50x-devs] PATCH: gspca-mercurial SN9C103 fixes




Hi!

With this patch my webcam works better. It works fine in 320x240.The brightness and contrast can't be adjusted yet.

I've been working to make it work in 640x480, but I don't have a working patch yet. To make it work in different resolutions I need to change some bytes in ov7630_sensor_init_3, should I make an array for every resolution ?  Or put in the initialization values in a local variable in sd_start?

Regards,

Andoni
diff -r 9ff62c80bf4c linux/drivers/media/video/gspca/sonixb.c
--- a/linux/drivers/media/video/gspca/sonixb.c	Mon Jul 07 23:41:40 2008 +0000
+++ b/linux/drivers/media/video/gspca/sonixb.c	Wed Jul 09 15:33:27 2008 -0300
@@ -207,10 +207,12 @@
 static const __u8 initOv7630_3[] = {
 	0x44, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 0x80,	/* r01 .. r08 */
 	0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,	/* r09 .. r10 */
-	0x00, 0x02, 0x01, 0x0a,				/* r11 .. r14 */
-	0x28, 0x1e,			/* H & V sizes     r15 .. r16 */
-	0x68, COMP1, MCK_INIT1,				/* r17 .. r19 */
-	0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c		/* r1a .. r1f */
+	0x00, 0x01, 0x01, 0x0a,				/* r11 .. r14 */
+	0x16, 0x12,			/* H & V sizes     r15 .. r16 */
+	0x68, 0x8f, MCK_INIT1,				/* r17 .. r19 */
+	0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c, 0x00,	/* r1a .. r20 */
+	0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, /* r21 .. r28 */
+	0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0xff  /* r29 .. r30 */
 };
 static const __u8 ov7630_sensor_init_com[][8] = {
 	{0xa0, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10},
@@ -241,14 +243,14 @@
 	{0xa0, 0x21, 0x00, 0x10, 0xbd, 0x06, 0xf6, 0x15},	/* gain */
 };
 static const __u8 ov7630_sensor_init_3[][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, 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, 0xa0, 0x1c, 0x06, 0xf6, 0x1d},
+	{0xb0, 0x21, 0x2a, 0x80, 0x60, 0x06, 0xf6, 0x1d}, 
 };
 
 static const __u8 initPas106[] = {
@@ -364,7 +366,7 @@
 			  const __u8 *buffer,
 			  int len)
 {
-	__u8 tmpbuf[32];
+	__u8 tmpbuf[48];
 
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 	if (len > sizeof tmpbuf) {
@@ -622,6 +624,7 @@
 	const __u8 *sn9c10x;
 	__u8 reg01, reg17;
 	__u8 reg17_19[3];
+	__u8 reg15[2] = { 0x28, 0x1e };
 
 	mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
 	switch (sd->sensor) {
@@ -684,7 +687,7 @@
 	case SENSOR_OV7630_3:
 		reg01 = 0x44;
 		reg17 = 0x68;
-		l = 0x10;
+		l = sizeof initOv7630_3;
 		break;
 	default:
 		reg01 = sn9c10x[0];
@@ -742,18 +745,21 @@
 		break;
 	}
 	/* H_size V_size  0x28, 0x1e maybe 640x480 */
-	reg_w(dev, 0x15, &sn9c10x[0x15 - 1], 2);
+	reg_w(dev, 0x15, reg15, 2);
 	/* compression register */
 	reg_w(dev, 0x18, &reg17_19[1], 1);
 	/* H_start */		/*fixme: not ov7630*/
-	reg_w(dev, 0x12, &sn9c10x[0x12 - 1], 1);
+	if (sd->sensor != SENSOR_OV7630_3)
+	        reg_w(dev, 0x12, &sn9c10x[0x12 - 1], 1);
 	/* V_START */		/*fixme: not ov7630*/
-	reg_w(dev, 0x13, &sn9c10x[0x13 - 1], 1);
+	if (sd->sensor != SENSOR_OV7630_3)
+	        reg_w(dev, 0x13, &sn9c10x[0x13 - 1], 1);
 	/* reset 0x17 SensorClk enable inv Clk 0x60 */
 				/*fixme: ov7630 [17]=68 8f (+20 if 102)*/
 	reg_w(dev, 0x17, &reg17_19[0], 1);
 	/*MCKSIZE ->3 */	/*fixme: not ov7630*/
-	reg_w(dev, 0x19, &reg17_19[2], 1);
+	if (sd->sensor != SENSOR_OV7630_3)
+	        reg_w(dev, 0x19, &reg17_19[2], 1);
 	/* AE_STRX AE_STRY AE_ENDX AE_ENDY */
 	reg_w(dev, 0x1c, &sn9c10x[0x1c - 1], 4);
 	/* Enable video transfert */

Attachment: shot0001.png
Description: PNG image

-------------------------------------------------------------------------
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