diff mbox

[5/6,media] gspca/sonixj: Fix support for sn9c105+0v7660

Message ID 20101209184238.78a2c2fd@pedra (mailing list archive)
State RFC
Headers show

Commit Message

Mauro Carvalho Chehab Dec. 9, 2010, 8:42 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index 2229847..681f64b 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -1766,6 +1766,7 @@  static void bridge_init(struct gspca_dev *gspca_dev,
 	static const u8 reg9a_spec[] =
 		{0x00, 0x40, 0x38, 0x30, 0x00, 0x20};
 	static const u8 regd4[] = {0x60, 0x00, 0x00};
+	u8 reg1_inv_powerdown = 0x02;
 
 	/* sensor clock already enabled in sd_init */
 	/* reg_w1(gspca_dev, 0xf1, 0x00); */
@@ -1779,6 +1780,14 @@  static void bridge_init(struct gspca_dev *gspca_dev,
 	reg_w(gspca_dev, 0x01, reg0102, 2);
 	reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2);
 	reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5);
+
+	/*
+	 * This combination doesn't use an inverted powerdown
+	 * Tested with USB ID = 0c45:60fb
+	 */
+	if (sd->sensor == SENSOR_OV7660 && sd->bridge == BRIDGE_SN9C105)
+		reg1_inv_powerdown = 0;
+
 	switch (sd->sensor) {
 	case SENSOR_GC0307:
 	case SENSOR_OV7660:
@@ -1798,6 +1807,11 @@  static void bridge_init(struct gspca_dev *gspca_dev,
 
 	reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f);
 
+	/*
+	 * FIXME: most of the info on this table is due to inverse
+	 * powerdown. The better is to add this information on a per-type
+	 * config, and remove this ugly hack
+	 */
 	switch (sd->sensor) {
 	case SENSOR_ADCM1700:
 		reg_w1(gspca_dev, 0x01, 0x43);
@@ -1864,10 +1878,10 @@  static void bridge_init(struct gspca_dev *gspca_dev,
 		break;
 	case SENSOR_PO2030N:
 	case SENSOR_OV7660:
-		reg_w1(gspca_dev, 0x01, 0x63);
+		reg_w1(gspca_dev, 0x01, 0x61 | reg1_inv_powerdown);
 		reg_w1(gspca_dev, 0x17, 0x20);
-		reg_w1(gspca_dev, 0x01, 0x62);
-		reg_w1(gspca_dev, 0x01, 0x42);
+		reg_w1(gspca_dev, 0x01, 0x60 | reg1_inv_powerdown);
+		reg_w1(gspca_dev, 0x01, 0x40 | reg1_inv_powerdown);
 		break;
 	case SENSOR_SP80708:
 		reg_w1(gspca_dev, 0x01, 0x63);
@@ -2606,6 +2620,9 @@  static int sd_start(struct gspca_dev *gspca_dev)
 				reg17 = 0xa2;
 				reg1 = 0x44;	/* 48 Mhz, video trf eneble */
 			}
+		} else if (sd->bridge == BRIDGE_SN9C105) {
+			reg17 = 0xa2;
+			reg1 = 0x44;	/* 48 Mhz, video trf eneble */
 		} else {
 			reg17 = 0x22;
 			reg1 = 0x06;	/* 24 Mhz, video trf eneble