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

Costantino Leandro <[email protected]>
Newsgroups gmane.linux.drivers.spca50x.devel
Message-ID <[email protected]>
Hi, i am attaching a "patch" for  webcam  0c45:0611  , reported as
"Microdia "
This camera have  chip SN9C101G and sensor OV6650 ( QCIF/CIF ), and
works under bridge SONIX.
Thx to Matias Mousseaud from Hong Kong CF for sending a webcam to the
office.

Patch was tested on Rxart Desktop 3.2 , kernel 2.6.22.2-pixart-panda.
Driver SN9C102 will take care of this webcam at first ( but dont support
this sensor ), so if you have it on your system, unload it or put it on
blacklist.

I also attach a screenshot.

Ty in advance,
Costantino Leandro
Pixart SRL

PD: Any problem no doubt in get in contact, maybe some sensor init regs
may need a tweak.

-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/spca50x-devs
gspcav-20071224-sn9c102g-ov6650-rxart.patch (text/x-patch, 6.5 KB)
diff -Nru gspcav1-20071224/gspca_core.c gspcav1-2007224-rxart-ov6650/gspca_core.c
--- gspcav1-20071224/gspca_core.c	2007-12-24 13:56:47.000000000 -0300
+++ gspcav1-2007224-rxart-ov6650/gspca_core.c	2008-02-18 07:10:12.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;
diff -Nru gspcav1-20071224/gspca.h gspcav1-2007224-rxart-ov6650/gspca.h
--- gspcav1-20071224/gspca.h	2007-12-24 13:56:47.000000000 -0300
+++ gspcav1-2007224-rxart-ov6650/gspca.h	2008-02-18 00:00:00.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/Sonix/sonix.h gspcav1-2007224-rxart-ov6650/Sonix/sonix.h
--- gspcav1-20071224/Sonix/sonix.h	2007-11-22 11:52:16.000000000 -0300
+++ gspcav1-2007224-rxart-ov6650/Sonix/sonix.h	2008-02-18 06:56:39.000000000 -0300
@@ -243,6 +243,12 @@
 	0x00, 0x00, 0x02, 0x03, 0x0F, 0x0C
 };
 
+static __u8 initOv6650[] =
+{
+   	0x64,0x44,0x28,0x00,0x00,0x00,0x00,0x10,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+        0x00,0x02,0x01,0x0A,0x14,0x0f,0x68,0x8B,0x10,0x1D,0x10,0x01,0x01,0x07,0x06       
+};
+
 //compression 0x86 mckinit1 0x2b
 static __u8 pas106_data[][2] = {
 	{0x02, 0x04},		/* Pixel Clock Divider 6 */
@@ -337,6 +343,43 @@
 	{0, 0, 0, 0, 0, 0, 0, 0}
 };
 
+static __u8 ov6650_sensor_init[][8] =
+{
+   //Bright, contrast, etc are set througth SCBB interface. AVCAP on win2 do not send any data on this 	controls.
+   //Anyway, some registers appears to alter bright and constrat
+
+     	{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 in decode 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,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,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,0x17,0x99,0x04,0x94,0x15}, //clip? r
+     	{0xA0,0x60,0x00,0x18,0x99,0x04,0x94,0x15}, //clip? r
+     	{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,14 @@
 		CompressCtrl[1] = 0x20;	//reg19 30
 		MCK_SIZE = 0x20;
 		break;
+	case SENSOR_OV6650:
+		sn9c10x = initOv6650;
+		compress = 0x8b;//spca50x->mode << 4 | 0x8b;
+		CompressCtrl[0] = compress;
+		frmult = 0x68;
+		CompressCtrl[1] = 0x20;
+		MCK_SIZE = 0x20;
+		break;
 	}
 	/* reg 0x01 bit 2 video transfert on */
 
@@ -615,6 +684,9 @@
 	case SENSOR_PAS202:
 		err = pas202_I2cinit(spca50x);
 		break;
+	case SENSOR_OV6650:
+		err = ov6650_I2cinit(spca50x);
+		break;
 	default:
 		err = -EINVAL;
 		break;
@@ -654,6 +726,7 @@
 	case SENSOR_HV7131R:
 	case SENSOR_MI0360:
 	case SENSOR_PAS202:
+	case SENSOR_OV6650:
 		set_sonixVGA(spca50x);
 		break;
 	case SENSOR_PAS106:
webcam-capture.jpeg (image/jpeg, 10.8 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.