aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/sonixj.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/gspca/sonixj.c')
-rw-r--r--drivers/media/video/gspca/sonixj.c145
1 files changed, 140 insertions, 5 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index e4454b573598..d9a7d1157f92 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -66,6 +66,7 @@ struct sd {
66#define SENSOR_OV7630 5 66#define SENSOR_OV7630 5
67#define SENSOR_OV7648 6 67#define SENSOR_OV7648 6
68#define SENSOR_OV7660 7 68#define SENSOR_OV7660 7
69#define SENSOR_SP80708 8
69 u8 i2c_base; 70 u8 i2c_base;
70}; 71};
71 72
@@ -243,6 +244,8 @@ static __u32 ctrl_dis[] = {
243 /* SENSOR_OV7648 6 */ 244 /* SENSOR_OV7648 6 */
244 (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX), 245 (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX),
245 /* SENSOR_OV7660 7 */ 246 /* SENSOR_OV7660 7 */
247 (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX),
248 /* SENSOR_SP80708 8 */
246}; 249};
247 250
248static const struct v4l2_pix_format vga_mode[] = { 251static const struct v4l2_pix_format vga_mode[] = {
@@ -352,6 +355,17 @@ static const u8 sn_ov7660[0x1c] = {
352 0x07, 0x00, 0x00, 0x00 355 0x07, 0x00, 0x00, 0x00
353}; 356};
354 357
358static const u8 sn_sp80708[0x1c] = {
359/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */
360 0x00, 0x63, 0x60, 0x00, 0x1a, 0x20, 0x20, 0x20,
361/* reg8 reg9 rega regb regc regd rege regf */
362 0x81, 0x18, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
363/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */
364 0x03, 0x00, 0x00, 0x03, 0x04, 0x28, 0x1e, 0x00,
365/* reg18 reg19 reg1a reg1b */
366 0x07, 0x00, 0x00, 0x00
367};
368
355/* sequence specific to the sensors - !! index = SENSOR_xxx */ 369/* sequence specific to the sensors - !! index = SENSOR_xxx */
356static const u8 *sn_tb[] = { 370static const u8 *sn_tb[] = {
357 sn_hv7131, 371 sn_hv7131,
@@ -361,7 +375,8 @@ static const u8 *sn_tb[] = {
361 sn_om6802, 375 sn_om6802,
362 sn_ov7630, 376 sn_ov7630,
363 sn_ov7648, 377 sn_ov7648,
364 sn_ov7660 378 sn_ov7660,
379 sn_sp80708
365}; 380};
366 381
367static const u8 gamma_def[17] = { 382static const u8 gamma_def[17] = {
@@ -740,6 +755,89 @@ static const u8 ov7660_sensor_init[][8] = {
740 {} 755 {}
741}; 756};
742 757
758static const u8 sp80708_sensor_init[][8] = {
759 {0xa1, 0x18, 0x06, 0xf9, 0x00, 0x00, 0x00, 0x10},
760 {0xa1, 0x18, 0x09, 0x1f, 0x00, 0x00, 0x00, 0x10},
761 {0xa1, 0x18, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x10},
762 {0xa1, 0x18, 0x0d, 0xc0, 0x00, 0x00, 0x00, 0x10},
763 {0xa1, 0x18, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x10},
764 {0xa1, 0x18, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x10},
765 {0xa1, 0x18, 0x10, 0x40, 0x00, 0x00, 0x00, 0x10},
766 {0xa1, 0x18, 0x11, 0x4e, 0x00, 0x00, 0x00, 0x10},
767 {0xa1, 0x18, 0x12, 0x53, 0x00, 0x00, 0x00, 0x10},
768 {0xa1, 0x18, 0x15, 0x80, 0x00, 0x00, 0x00, 0x10},
769 {0xa1, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x10},
770 {0xa1, 0x18, 0x19, 0x18, 0x00, 0x00, 0x00, 0x10},
771 {0xa1, 0x18, 0x1a, 0x10, 0x00, 0x00, 0x00, 0x10},
772 {0xa1, 0x18, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x10},
773 {0xa1, 0x18, 0x1c, 0x28, 0x00, 0x00, 0x00, 0x10},
774 {0xa1, 0x18, 0x1d, 0x02, 0x00, 0x00, 0x00, 0x10},
775 {0xa1, 0x18, 0x1e, 0x10, 0x00, 0x00, 0x00, 0x10},
776 {0xa1, 0x18, 0x26, 0x04, 0x00, 0x00, 0x00, 0x10},
777 {0xa1, 0x18, 0x27, 0x1e, 0x00, 0x00, 0x00, 0x10},
778 {0xa1, 0x18, 0x28, 0x5a, 0x00, 0x00, 0x00, 0x10},
779 {0xa1, 0x18, 0x29, 0x28, 0x00, 0x00, 0x00, 0x10},
780 {0xa1, 0x18, 0x2a, 0x78, 0x00, 0x00, 0x00, 0x10},
781 {0xa1, 0x18, 0x2b, 0x01, 0x00, 0x00, 0x00, 0x10},
782 {0xa1, 0x18, 0x2c, 0xf7, 0x00, 0x00, 0x00, 0x10},
783 {0xa1, 0x18, 0x2d, 0x2d, 0x00, 0x00, 0x00, 0x10},
784 {0xa1, 0x18, 0x2e, 0xd5, 0x00, 0x00, 0x00, 0x10},
785 {0xa1, 0x18, 0x39, 0x42, 0x00, 0x00, 0x00, 0x10},
786 {0xa1, 0x18, 0x3a, 0x67, 0x00, 0x00, 0x00, 0x10},
787 {0xa1, 0x18, 0x3b, 0x87, 0x00, 0x00, 0x00, 0x10},
788 {0xa1, 0x18, 0x3c, 0xa3, 0x00, 0x00, 0x00, 0x10},
789 {0xa1, 0x18, 0x3d, 0xb0, 0x00, 0x00, 0x00, 0x10},
790 {0xa1, 0x18, 0x3e, 0xbc, 0x00, 0x00, 0x00, 0x10},
791 {0xa1, 0x18, 0x3f, 0xc8, 0x00, 0x00, 0x00, 0x10},
792 {0xa1, 0x18, 0x40, 0xd4, 0x00, 0x00, 0x00, 0x10},
793 {0xa1, 0x18, 0x41, 0xdf, 0x00, 0x00, 0x00, 0x10},
794 {0xa1, 0x18, 0x42, 0xea, 0x00, 0x00, 0x00, 0x10},
795 {0xa1, 0x18, 0x43, 0xf5, 0x00, 0x00, 0x00, 0x10},
796 {0xa1, 0x18, 0x45, 0x80, 0x00, 0x00, 0x00, 0x10},
797 {0xa1, 0x18, 0x46, 0x60, 0x00, 0x00, 0x00, 0x10},
798 {0xa1, 0x18, 0x47, 0x50, 0x00, 0x00, 0x00, 0x10},
799 {0xa1, 0x18, 0x48, 0x30, 0x00, 0x00, 0x00, 0x10},
800 {0xa1, 0x18, 0x49, 0x01, 0x00, 0x00, 0x00, 0x10},
801 {0xa1, 0x18, 0x4d, 0xae, 0x00, 0x00, 0x00, 0x10},
802 {0xa1, 0x18, 0x4e, 0x03, 0x00, 0x00, 0x00, 0x10},
803 {0xa1, 0x18, 0x4f, 0x66, 0x00, 0x00, 0x00, 0x10},
804 {0xa1, 0x18, 0x50, 0x1c, 0x00, 0x00, 0x00, 0x10},
805 {0xa1, 0x18, 0x44, 0x10, 0x00, 0x00, 0x00, 0x10},
806 {0xa1, 0x18, 0x4a, 0x30, 0x00, 0x00, 0x00, 0x10},
807 {0xa1, 0x18, 0x51, 0x80, 0x00, 0x00, 0x00, 0x10},
808 {0xa1, 0x18, 0x52, 0x80, 0x00, 0x00, 0x00, 0x10},
809 {0xa1, 0x18, 0x53, 0x80, 0x00, 0x00, 0x00, 0x10},
810 {0xa1, 0x18, 0x54, 0x80, 0x00, 0x00, 0x00, 0x10},
811 {0xa1, 0x18, 0x55, 0x80, 0x00, 0x00, 0x00, 0x10},
812 {0xa1, 0x18, 0x56, 0x80, 0x00, 0x00, 0x00, 0x10},
813 {0xa1, 0x18, 0x57, 0xe0, 0x00, 0x00, 0x00, 0x10},
814 {0xa1, 0x18, 0x58, 0xc0, 0x00, 0x00, 0x00, 0x10},
815 {0xa1, 0x18, 0x59, 0xab, 0x00, 0x00, 0x00, 0x10},
816 {0xa1, 0x18, 0x5a, 0xa0, 0x00, 0x00, 0x00, 0x10},
817 {0xa1, 0x18, 0x5b, 0x99, 0x00, 0x00, 0x00, 0x10},
818 {0xa1, 0x18, 0x5c, 0x90, 0x00, 0x00, 0x00, 0x10},
819 {0xa1, 0x18, 0x5e, 0x24, 0x00, 0x00, 0x00, 0x10},
820 {0xa1, 0x18, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x10},
821 {0xa1, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x10},
822 {0xa1, 0x18, 0x61, 0x73, 0x00, 0x00, 0x00, 0x10},
823 {0xa1, 0x18, 0x63, 0x42, 0x00, 0x00, 0x00, 0x10},
824 {0xa1, 0x18, 0x64, 0x42, 0x00, 0x00, 0x00, 0x10},
825 {0xa1, 0x18, 0x65, 0x42, 0x00, 0x00, 0x00, 0x10},
826 {0xa1, 0x18, 0x66, 0x24, 0x00, 0x00, 0x00, 0x10},
827 {0xa1, 0x18, 0x67, 0x24, 0x00, 0x00, 0x00, 0x10},
828 {0xa1, 0x18, 0x68, 0x08, 0x00, 0x00, 0x00, 0x10},
829 {0xa1, 0x18, 0x2f, 0xc9, 0x00, 0x00, 0x00, 0x10},
830 /********/
831 {0xa1, 0x18, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x10},
832 {0xa1, 0x18, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x10},
833 {0xa1, 0x18, 0x03, 0x01, 0x00, 0x00, 0x00, 0x10},
834 {0xa1, 0x18, 0x04, 0xa4, 0x00, 0x00, 0x00, 0x10},
835 {0xa1, 0x18, 0x14, 0x3f, 0x00, 0x00, 0x00, 0x10},
836 {0xa1, 0x18, 0x5d, 0x80, 0x00, 0x00, 0x00, 0x10},
837 {0xb1, 0x18, 0x11, 0x40, 0x40, 0x00, 0x00, 0x10},
838 {}
839};
840
743static const u8 qtable4[] = { 841static const u8 qtable4[] = {
744 0x06, 0x04, 0x04, 0x06, 0x04, 0x04, 0x06, 0x06, 842 0x06, 0x04, 0x04, 0x06, 0x04, 0x04, 0x06, 0x06,
745 0x06, 0x06, 0x08, 0x06, 0x06, 0x08, 0x0a, 0x11, 843 0x06, 0x06, 0x08, 0x06, 0x06, 0x08, 0x0a, 0x11,
@@ -1014,6 +1112,14 @@ static int configure_gpio(struct gspca_dev *gspca_dev,
1014 break; 1112 break;
1015 } 1113 }
1016 /* fall thru */ 1114 /* fall thru */
1115 case SENSOR_SP80708:
1116 reg_w1(gspca_dev, 0x01, 0x63);
1117 reg_w1(gspca_dev, 0x17, 0x20);
1118 reg_w1(gspca_dev, 0x01, 0x62);
1119 reg_w1(gspca_dev, 0x01, 0x42);
1120 mdelay(100);
1121 reg_w1(gspca_dev, 0x02, 0x62);
1122 break;
1017 default: 1123 default:
1018 reg_w1(gspca_dev, 0x01, 0x43); 1124 reg_w1(gspca_dev, 0x01, 0x43);
1019 reg_w1(gspca_dev, 0x17, 0x61); 1125 reg_w1(gspca_dev, 0x17, 0x61);
@@ -1137,6 +1243,19 @@ static void ov7660_InitSensor(struct gspca_dev *gspca_dev)
1137 } 1243 }
1138} 1244}
1139 1245
1246static void sp80708_InitSensor(struct gspca_dev *gspca_dev)
1247{
1248 int i = 0;
1249
1250 i2c_w8(gspca_dev, sp80708_sensor_init[i]); /* reset SCCB */
1251 i++;
1252 msleep(20);
1253 while (sp80708_sensor_init[i][0]) {
1254 i2c_w8(gspca_dev, sp80708_sensor_init[i]);
1255 i++;
1256 }
1257}
1258
1140/* this function is called at probe time */ 1259/* this function is called at probe time */
1141static int sd_config(struct gspca_dev *gspca_dev, 1260static int sd_config(struct gspca_dev *gspca_dev,
1142 const struct usb_device_id *id) 1261 const struct usb_device_id *id)
@@ -1400,6 +1519,7 @@ static void setgamma(struct gspca_dev *gspca_dev)
1400 0x18, 0x13, 0x10, 0x0e, 0x08, 0x07, 0x04, 0x02, 0x00 1519 0x18, 0x13, 0x10, 0x0e, 0x08, 0x07, 0x04, 0x02, 0x00
1401 }; 1520 };
1402 1521
1522
1403 for (i = 0; i < sizeof gamma; i++) 1523 for (i = 0; i < sizeof gamma; i++)
1404 gamma[i] = gamma_def[i] 1524 gamma[i] = gamma_def[i]
1405 + delta[i] * (sd->gamma - GAMMA_DEF) / 32; 1525 + delta[i] * (sd->gamma - GAMMA_DEF) / 32;
@@ -1488,7 +1608,8 @@ static int sd_start(struct gspca_dev *gspca_dev)
1488 reg_w1(gspca_dev, 0x07, sn9c1xx[7]); /* green */ 1608 reg_w1(gspca_dev, 0x07, sn9c1xx[7]); /* green */
1489 reg_w1(gspca_dev, 0x06, sn9c1xx[6]); /* blue */ 1609 reg_w1(gspca_dev, 0x06, sn9c1xx[6]); /* blue */
1490 reg_w1(gspca_dev, 0x14, sn9c1xx[0x14]); 1610 reg_w1(gspca_dev, 0x14, sn9c1xx[0x14]);
1491 setgamma(gspca_dev); 1611 setgamma(gspca_dev);
1612
1492 for (i = 0; i < 8; i++) 1613 for (i = 0; i < 8; i++)
1493 reg_w(gspca_dev, 0x84, reg84, sizeof reg84); 1614 reg_w(gspca_dev, 0x84, reg84, sizeof reg84);
1494 switch (sd->sensor) { 1615 switch (sd->sensor) {
@@ -1500,6 +1621,10 @@ static int sd_start(struct gspca_dev *gspca_dev)
1500 reg_w1(gspca_dev, 0x9a, 0x0a); 1621 reg_w1(gspca_dev, 0x9a, 0x0a);
1501 reg_w1(gspca_dev, 0x99, 0x60); 1622 reg_w1(gspca_dev, 0x99, 0x60);
1502 break; 1623 break;
1624 case SENSOR_SP80708:
1625 reg_w1(gspca_dev, 0x9a, 0x05);
1626 reg_w1(gspca_dev, 0x99, 0x59);
1627 break;
1503 case SENSOR_OV7660: 1628 case SENSOR_OV7660:
1504 if (sd->bridge == BRIDGE_SN9C120) { 1629 if (sd->bridge == BRIDGE_SN9C120) {
1505 reg_w1(gspca_dev, 0x9a, 0x05); 1630 reg_w1(gspca_dev, 0x9a, 0x05);
@@ -1559,8 +1684,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
1559 reg17 = 0x21; 1684 reg17 = 0x21;
1560/* reg1 = 0x42; * 42 - 46? */ 1685/* reg1 = 0x42; * 42 - 46? */
1561 break; 1686 break;
1562 default: 1687 case SENSOR_OV7660:
1563/* case SENSOR_OV7660: */
1564 ov7660_InitSensor(gspca_dev); 1688 ov7660_InitSensor(gspca_dev);
1565 if (sd->bridge == BRIDGE_SN9C120) { 1689 if (sd->bridge == BRIDGE_SN9C120) {
1566 if (mode) { /* 320x240 - 160x120 */ 1690 if (mode) { /* 320x240 - 160x120 */
@@ -1573,6 +1697,17 @@ static int sd_start(struct gspca_dev *gspca_dev)
1573 * inverse power down */ 1697 * inverse power down */
1574 } 1698 }
1575 break; 1699 break;
1700 default:
1701/* case SENSOR_SP80708: */
1702 sp80708_InitSensor(gspca_dev);
1703 if (mode) {
1704/*?? reg1 = 0x04; * 320 clk 48Mhz */
1705 ;
1706 } else {
1707 reg1 = 0x46; /* 640 clk 48Mz */
1708 reg17 = 0xa2;
1709 }
1710 break;
1576 } 1711 }
1577 reg_w(gspca_dev, 0xc0, C0, 6); 1712 reg_w(gspca_dev, 0xc0, C0, 6);
1578 reg_w(gspca_dev, 0xca, CA, 4); 1713 reg_w(gspca_dev, 0xca, CA, 4);
@@ -1970,7 +2105,7 @@ static const __devinitdata struct usb_device_id device_table[] = {
1970 {USB_DEVICE(0x0c45, 0x613c), BSI(SN9C120, HV7131R, 0x11)}, 2105 {USB_DEVICE(0x0c45, 0x613c), BSI(SN9C120, HV7131R, 0x11)},
1971/* {USB_DEVICE(0x0c45, 0x613e), BSI(SN9C120, OV7630, 0x??)}, */ 2106/* {USB_DEVICE(0x0c45, 0x613e), BSI(SN9C120, OV7630, 0x??)}, */
1972#endif 2107#endif
1973 {USB_DEVICE(0x0c45, 0x6143), BSI(SN9C120, MI0360, 0x5d)}, 2108 {USB_DEVICE(0x0c45, 0x6143), BSI(SN9C120, SP80708, 0x18)},
1974 {} 2109 {}
1975}; 2110};
1976MODULE_DEVICE_TABLE(usb, device_table); 2111MODULE_DEVICE_TABLE(usb, device_table);