Web lists-archives.com

Re: [Spca50x-devs] [gspcav1-20071224] Patch for 0c45:6011 Microdia




I attach a newer version of the patch.
Should correct color initialization on the "sweex foldable webcam" and still
working ok with the original camera i made the patch for.
Also, i increased the fps from 2-3 to 10. Thats the max i could get.
Sensor now is initialized as SIF , so, 640x480 won appear anymore.

best regards

Costantino Leandro
Pixart SRL
diff -Nru gspcav1-20071224/Sonix/sonix.h gspcav1-20071224-ov6650/Sonix/sonix.h
--- gspcav1-20071224/Sonix/sonix.h	2007-11-22 11:52:16.000000000 -0300
+++ gspcav1-20071224-ov6650/Sonix/sonix.h	2008-03-03 22:41:48.000000000 -0300
@@ -243,6 +243,13 @@
 	0x00, 0x00, 0x02, 0x03, 0x0F, 0x0C
 };
 
+static __u8 initOv6650[] =
+{
+     0x44, 0x44 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x60 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,
+     0x00 ,0x02 ,0x01 ,0x0a ,0x16 ,0x12 ,0x68 ,0x0b ,0x10 ,0x1d ,0x10 ,0x00 ,0x06 ,0x1f ,0x00
+
+};
+
 //compression 0x86 mckinit1 0x2b
 static __u8 pas106_data[][2] = {
 	{0x02, 0x04},		/* Pixel Clock Divider 6 */
@@ -337,6 +344,42 @@
 	{0, 0, 0, 0, 0, 0, 0, 0}
 };
 
+static __u8 ov6650_sensor_init[][8] =
+{
+         
+        {0xA0,0x60,0x12,0x80,0x00,0x00,0x00,0x10},
+	{0xD0,0x60,0x11,0xC0,0x1B,0x18,0xC1,0x10},
+	{0xB0,0x60,0x15,0x00,0x02,0x18,0xC1,0x10},
+      //{0xA0,0x60,0x1B,0x01,0x02,0x18,0xC1,0x10}, //THIS SET GREEN SCREEN ( pixels could be innverted indecode kind of "brg", but blue wont be there. Avoid this data ...
+        {0xD0,0x60,0x26,0x01,0x14,0xD8,0xA4,0x10}, //format out?
+        {0xD0,0x60,0x26,0x01,0x14,0xD8,0xA4,0x10},
+        {0xA0,0x60,0x30,0x3D,0x0A,0xD8,0xA4,0x10},
+     	{0xB0,0x60,0x60,0x66,0x68,0xD8,0xA4,0x10},
+     	{0xA0,0x60,0x68,0x04,0x68,0xD8,0xA4,0x10},
+     	{0xD0,0x60,0x17,0x24,0xD6,0x04,0x94,0x10}, //Clipreg
+     	{0xA0,0x60,0x10,0x5D,0x99,0x04,0x94,0x16},
+     	{0xA0,0x60,0x2D,0x0A,0x99,0x04,0x94,0x16},
+     	{0xA0,0x60,0x32,0x00,0x99,0x04,0x94,0x16},
+     	{0xA0,0x60,0x33,0x40,0x99,0x04,0x94,0x16},
+     	{0xA0,0x60,0x11,0xC0,0x99,0x04,0x94,0x16},
+     	{0xA0,0x60,0x00,0x16,0x99,0x04,0x94,0x15},   //bright / Lumino
+     	{0xA0,0x60,0x2B,0xAB,0x99,0x04,0x94,0x15}, //?flicker o brillo
+     	{0xA0,0x60,0x2D,0x2A,0x99,0x04,0x94,0x15},
+     	{0xA0,0x60,0x2D,0x2B,0x99,0x04,0x94,0x16},
+     	{0xA0,0x60,0x32,0x00,0x99,0x04,0x94,0x16},
+     	{0xA0,0x60,0x33,0x00,0x99,0x04,0x94,0x16},
+     	{0xA0,0x60,0x10,0x57,0x99,0x04,0x94,0x16},
+//   	{0xA0,0x60,0x33,0x9D,0x99,0x04,0x94,0x16}, 
+        {0xA0,0x60,0x2D,0x2B,0x99,0x04,0x94,0x16},
+     	{0xA0,0x60,0x32,0x00,0x99,0x04,0x94,0x16}, // Low Light ( Enabled: 0x32 0x1 | Disabled: 0x32 0x00 )
+	{0xA0,0x60,0x33,0x29,0x99,0x04,0x94,0x16}, // Low Ligth ( Enabled: 0x33 0x13 | Disabled: 0x33 0x29 )
+//    	{0xA0,0x60,0x11,0xC1,0x99,0x04,0x94,0x16},
+//      {0xA0,0x60,0x00,0x16,0x99,0x04,0x94,0x15},
+     	{0xA0,0x60,0x00,0x17,0x99,0x04,0x94,0x15},
+     	{0xA0,0x60,0x00,0x18,0x99,0x04,0x94,0x15},
+     {0 , 0, 0, 0, 0, 0, 0, 0},
+}
+;
 static int
 sonix_i2cwrite(struct usb_device *dev, __u8 * buffer, __u16 length)
 {
@@ -380,6 +423,7 @@
 	__u8 i2cpdoit[] = { 0xA0, 0x40, 0x11, 0x01, 0x31, 0x00, 0x63, 0x16 };
 	//__u8 i2cpexpo1[] = { 0xB0,0x40,0x04,0x07,0x2A,0x00,0x63,0x16 };
 	__u8 i2cpexpo[] = { 0xB0, 0x40, 0x0e, 0x01, 0xab, 0x00, 0x63, 0x16 };
+	__u8 i2cOV6650[] = { 0xa0, 0x60, 0x06,0x11, 0x99, 0x04, 0x94, 0x15 }; 
 	if (spca50x->sensor == SENSOR_TAS5130CXX ||
 	    spca50x->sensor == SENSOR_TAS5110) {
 		value = (0xFF - (spca50x->brightness >> 8));
@@ -416,6 +460,12 @@
 		if (sonix_i2cwrite(spca50x->dev, i2cpdoit, 8) < 0)
 			PDEBUG(0, "i2c error brightness");
 	}
+	else if( spca50x->sensor == SENSOR_OV6650 )
+     	{
+		i2cOV6650[3] =spca50x->brightness>> 8;
+		if (sonix_i2cwrite(spca50x->dev, i2cOV6650, 8) < 0)
+			 PDEBUG(0, "i2c error brightness");
+     	}
 }
 static void
 sonix_setcontrast(struct usb_spca50x *spca50x)
@@ -513,6 +563,17 @@
 	}
 	return 0;
 }
+static int
+ov6650_I2cinit(struct usb_spca50x *spca50x)
+{
+	int i = 0;
+	while (ov6650_sensor_init[i][0]) {
+		if (sonix_i2cwrite(spca50x->dev, ov6650_sensor_init[i], 8) < 0)
+	  		PDEBUG(0, "i2c error ov665-");
+		i++;
+     	}
+   	return 0;
+}
 static void
 sonix_start(struct usb_spca50x *spca50x)
 {
@@ -588,6 +649,17 @@
 		CompressCtrl[1] = 0x20;	//reg19 30
 		MCK_SIZE = 0x20;
 		break;
+	case SENSOR_OV6650:
+		sn9c10x = initOv6650;
+	        if( spca50x->mode  )
+	     	compress = 0x9b; 
+	        else
+		compress = 0x8b;
+		CompressCtrl[0] = compress;
+		frmult = 0x68;
+		CompressCtrl[1] = 0x20;
+		MCK_SIZE = 0x20;
+	   	break;
 	}
 	/* reg 0x01 bit 2 video transfert on */
 
@@ -615,6 +687,9 @@
 	case SENSOR_PAS202:
 		err = pas202_I2cinit(spca50x);
 		break;
+	case SENSOR_OV6650:
+		err = ov6650_I2cinit(spca50x);
+		break;
 	default:
 		err = -EINVAL;
 		break;
@@ -658,7 +733,8 @@
 		break;
 	case SENSOR_PAS106:
 	case SENSOR_TAS5110:
-		set_sonixSIF(spca50x);
+	case SENSOR_OV6650:
+	   set_sonixSIF(spca50x);
 		break;
 	default:
 		return -EINVAL;
diff -Nru gspcav1-20071224/gspca.h gspcav1-20071224-ov6650/gspca.h
--- gspcav1-20071224/gspca.h	2007-12-24 13:56:47.000000000 -0300
+++ gspcav1-20071224-ov6650/gspca.h	2008-03-03 22:41:48.000000000 -0300
@@ -129,6 +129,7 @@
 #define SENSOR_OV7670 29
 #define SENSOR_MI1310_SOC 30
 #define SENSOR_MC501CB 31
+#define SENSOR_OV6650 32
 
 /* Alternate interface transfer sizes */
 #define SPCA50X_ALT_SIZE_0       0
diff -Nru gspcav1-20071224/gspca_core.c gspcav1-20071224-ov6650/gspca_core.c
--- gspcav1-20071224/gspca_core.c	2007-12-24 13:56:47.000000000 -0300
+++ gspcav1-20071224-ov6650/gspca_core.c	2008-03-03 22:41:48.000000000 -0300
@@ -422,6 +422,7 @@
 	Lenovo,
 	LogitechQC4Notebooks,
 	PhilipsSPC220NC,
+	MaxSonixCamera,
 	LastCamera
 };
 static struct cam_list clist[] = {
@@ -620,6 +621,7 @@
 	{Lenovo,"lenovo MI1310_SOC"},
 	{LogitechQC4Notebooks,"Logitech QuickCam for Notebooks"},
 	{PhilipsSPC220NC,"Philips SPC220NC PAC207"},
+	{MaxSonixCamera,"Max Webcam (SN9C101G-OV6650-352x288)"},
 	{-1, NULL}
 };
 static __devinitdata struct usb_device_id device_table[] = {
@@ -834,6 +836,7 @@
 	{USB_DEVICE(0x046d, 0x08af)},	/* Logitech QuickCam Cool */
 	{USB_DEVICE(0x093a, 0x2472)},	/* PAC207 Genius VideoCam ge110 */
 	{USB_DEVICE(0x093a, 0x2463)},	/* Philips spc200nc pac207 */
+	{USB_DEVICE(0x0c45, 0x6011)},	/* MAX Webcam ( OV 6650 - SN9C101G ( works only with 	SONIX BRIDGE ) */
 	{USB_DEVICE(0x0000, 0x0000)},	/* MystFromOri Unknow Camera */
 	{}			/* Terminating entry */
 };
@@ -3889,6 +3892,14 @@
 			spca50x->i2c_ctrl_reg = 0x20;
 			spca50x->i2c_base = 0x11;
 			break;
+		case 0x6011:
+		       	spca50x->desc = MaxSonixCamera;
+		       	spca50x->bridge = BRIDGE_SONIX;
+		       	spca50x->sensor = SENSOR_OV6650;
+		       	spca50x->customid = SN9C101; //SN9C101G 
+		       	spca50x->i2c_ctrl_reg = 0x81;
+		       	spca50x->i2c_base = 0x21;
+		       	break;
 		case 0x6024:
 		case 0x6025:
 			spca50x->desc = Sonix6025;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Spca50x-devs mailing list
Spca50x-devs@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/spca50x-devs