aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJean-François Moine <moinejf@free.fr>2010-03-18 04:15:30 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-17 23:47:23 -0400
commitad98c0f674796848c6fd8fe614ef83ef971ebfcf (patch)
treee81ee7708222d9a2f6a51c450a9d3f28a1fb964a /drivers
parent9c33afc6102517764fb5d308dcf49bf42893da2c (diff)
V4L/DVB: gspca - sonixj: Add webcam 0c45:6142 with sensors gc0307 and po2030n
Signed-off-by: Jean-François Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/gspca/sonixj.c297
1 files changed, 289 insertions, 8 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index 20ca161bc3d0..aaa68ddb1fb4 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -69,6 +69,7 @@ struct sd {
69 u8 sensor; /* Type of image sensor chip */ 69 u8 sensor; /* Type of image sensor chip */
70enum { 70enum {
71 SENSOR_ADCM1700, 71 SENSOR_ADCM1700,
72 SENSOR_GC0307,
72 SENSOR_HV7131R, 73 SENSOR_HV7131R,
73 SENSOR_MI0360, 74 SENSOR_MI0360,
74 SENSOR_MO4000, 75 SENSOR_MO4000,
@@ -78,6 +79,7 @@ enum {
78 SENSOR_OV7648, 79 SENSOR_OV7648,
79 SENSOR_OV7660, 80 SENSOR_OV7660,
80 SENSOR_PO1030, 81 SENSOR_PO1030,
82 SENSOR_PO2030N,
81 SENSOR_SP80708, 83 SENSOR_SP80708,
82} sensors; 84} sensors;
83 u8 i2c_addr; 85 u8 i2c_addr;
@@ -289,6 +291,11 @@ static const __u32 ctrl_dis[] = {
289 (1 << VFLIP_IDX) | 291 (1 << VFLIP_IDX) |
290 (1 << FREQ_IDX), 292 (1 << FREQ_IDX),
291 293
294[SENSOR_GC0307] = (1 << AUTOGAIN_IDX) |
295 (1 << INFRARED_IDX) |
296 (1 << VFLIP_IDX) |
297 (1 << FREQ_IDX),
298
292[SENSOR_HV7131R] = (1 << INFRARED_IDX) | 299[SENSOR_HV7131R] = (1 << INFRARED_IDX) |
293 (1 << FREQ_IDX), 300 (1 << FREQ_IDX),
294 301
@@ -320,6 +327,11 @@ static const __u32 ctrl_dis[] = {
320 (1 << VFLIP_IDX) | 327 (1 << VFLIP_IDX) |
321 (1 << FREQ_IDX), 328 (1 << FREQ_IDX),
322 329
330[SENSOR_PO2030N] = (1 << AUTOGAIN_IDX) |
331 (1 << INFRARED_IDX) |
332 (1 << VFLIP_IDX) |
333 (1 << FREQ_IDX),
334
323[SENSOR_SP80708] = (1 << AUTOGAIN_IDX) | 335[SENSOR_SP80708] = (1 << AUTOGAIN_IDX) |
324 (1 << INFRARED_IDX) | 336 (1 << INFRARED_IDX) |
325 (1 << VFLIP_IDX) | 337 (1 << VFLIP_IDX) |
@@ -363,7 +375,17 @@ static const u8 sn_adcm1700[0x1c] = {
363 0x06, 0x00, 0x00, 0x00 375 0x06, 0x00, 0x00, 0x00
364}; 376};
365 377
366/*Data from sn9c102p+hv7131r */ 378static const u8 sn_gc0307[0x1c] = {
379/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */
380 0x00, 0x61, 0x62, 0x00, 0x1a, 0x00, 0x00, 0x00,
381/* reg8 reg9 rega regb regc regd rege regf */
382 0x80, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
383/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */
384 0x03, 0x00, 0x03, 0x01, 0x08, 0x28, 0x1e, 0x02,
385/* reg18 reg19 reg1a reg1b */
386 0x06, 0x00, 0x00, 0x00
387};
388
367static const u8 sn_hv7131[0x1c] = { 389static const u8 sn_hv7131[0x1c] = {
368/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ 390/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */
369 0x00, 0x03, 0x64, 0x00, 0x1a, 0x20, 0x20, 0x20, 391 0x00, 0x03, 0x64, 0x00, 0x1a, 0x20, 0x20, 0x20,
@@ -463,6 +485,17 @@ static const u8 sn_po1030[0x1c] = {
463 0x07, 0x00, 0x00, 0x00 485 0x07, 0x00, 0x00, 0x00
464}; 486};
465 487
488static const u8 sn_po2030n[0x1c] = {
489/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */
490 0x00, 0x63, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00,
491/* reg8 reg9 rega regb regc regd rege regf */
492 0x81, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
493/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */
494 0x03, 0x00, 0x00, 0x01, 0x14, 0x28, 0x1e, 0x00,
495/* reg18 reg19 reg1a reg1b */
496 0x07, 0x00, 0x00, 0x00
497};
498
466static const u8 sn_sp80708[0x1c] = { 499static const u8 sn_sp80708[0x1c] = {
467/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ 500/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */
468 0x00, 0x63, 0x60, 0x00, 0x1a, 0x20, 0x20, 0x20, 501 0x00, 0x63, 0x60, 0x00, 0x1a, 0x20, 0x20, 0x20,
@@ -477,6 +510,7 @@ static const u8 sn_sp80708[0x1c] = {
477/* sequence specific to the sensors - !! index = SENSOR_xxx */ 510/* sequence specific to the sensors - !! index = SENSOR_xxx */
478static const u8 *sn_tb[] = { 511static const u8 *sn_tb[] = {
479[SENSOR_ADCM1700] = sn_adcm1700, 512[SENSOR_ADCM1700] = sn_adcm1700,
513[SENSOR_GC0307] = sn_gc0307,
480[SENSOR_HV7131R] = sn_hv7131, 514[SENSOR_HV7131R] = sn_hv7131,
481[SENSOR_MI0360] = sn_mi0360, 515[SENSOR_MI0360] = sn_mi0360,
482[SENSOR_MO4000] = sn_mo4000, 516[SENSOR_MO4000] = sn_mo4000,
@@ -486,6 +520,7 @@ static const u8 *sn_tb[] = {
486[SENSOR_OV7648] = sn_ov7648, 520[SENSOR_OV7648] = sn_ov7648,
487[SENSOR_OV7660] = sn_ov7660, 521[SENSOR_OV7660] = sn_ov7660,
488[SENSOR_PO1030] = sn_po1030, 522[SENSOR_PO1030] = sn_po1030,
523[SENSOR_PO2030N] = sn_po2030n,
489[SENSOR_SP80708] = sn_sp80708 524[SENSOR_SP80708] = sn_sp80708
490}; 525};
491 526
@@ -504,8 +539,13 @@ static const u8 gamma_spec_1[17] = {
504 0x08, 0x3a, 0x52, 0x65, 0x75, 0x83, 0x91, 0x9d, 539 0x08, 0x3a, 0x52, 0x65, 0x75, 0x83, 0x91, 0x9d,
505 0xa9, 0xb4, 0xbe, 0xc8, 0xd2, 0xdb, 0xe4, 0xed, 0xf5 540 0xa9, 0xb4, 0xbe, 0xc8, 0xd2, 0xdb, 0xe4, 0xed, 0xf5
506}; 541};
507/* gamma for sensor SP80708 */ 542/* gamma for sensor GC0307 */
508static const u8 gamma_spec_2[17] = { 543static const u8 gamma_spec_2[17] = {
544 0x14, 0x37, 0x50, 0x6a, 0x7c, 0x8d, 0x9d, 0xab,
545 0xb5, 0xbf, 0xc2, 0xcb, 0xd1, 0xd6, 0xdb, 0xe1, 0xeb
546};
547/* gamma for sensor SP80708 */
548static const u8 gamma_spec_3[17] = {
509 0x0a, 0x2d, 0x4e, 0x68, 0x7d, 0x8f, 0x9f, 0xab, 549 0x0a, 0x2d, 0x4e, 0x68, 0x7d, 0x8f, 0x9f, 0xab,
510 0xb7, 0xc2, 0xcc, 0xd3, 0xd8, 0xde, 0xe2, 0xe5, 0xe6 550 0xb7, 0xc2, 0xcc, 0xd3, 0xd8, 0xde, 0xe2, 0xe5, 0xe6
511}; 551};
@@ -553,6 +593,64 @@ static const u8 adcm1700_sensor_param1[][8] = {
553 {0xb0, 0x51, 0x32, 0x00, 0xa2, 0x00, 0x00, 0x10}, 593 {0xb0, 0x51, 0x32, 0x00, 0xa2, 0x00, 0x00, 0x10},
554 {} 594 {}
555}; 595};
596static const u8 gc0307_sensor_init[][8] = {
597 {0xa0, 0x21, 0x43, 0x00, 0x00, 0x00, 0x00, 0x10},
598 {0xa0, 0x21, 0x44, 0xa2, 0x00, 0x00, 0x00, 0x10},
599 {0xa0, 0x21, 0x01, 0x6a, 0x00, 0x00, 0x00, 0x10},
600 {0xa0, 0x21, 0x02, 0x70, 0x00, 0x00, 0x00, 0x10},
601 {0xa0, 0x21, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10},
602 {0xa0, 0x21, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x10},
603 {0xa0, 0x21, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x10},
604 {0xa0, 0x21, 0x11, 0x05, 0x00, 0x00, 0x00, 0x10},
605 {0xa0, 0x21, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10},
606 {0xa0, 0x21, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10},
607 {0xa0, 0x21, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10},
608 {0xa0, 0x21, 0x08, 0x02, 0x00, 0x00, 0x00, 0x10},
609 {0xa0, 0x21, 0x09, 0x01, 0x00, 0x00, 0x00, 0x10},
610 {0xa0, 0x21, 0x0a, 0xe8, 0x00, 0x00, 0x00, 0x10},
611 {0xa0, 0x21, 0x0b, 0x02, 0x00, 0x00, 0x00, 0x10},
612 {0xa0, 0x21, 0x0c, 0x80, 0x00, 0x00, 0x00, 0x10},
613 {0xa0, 0x21, 0x0d, 0x22, 0x00, 0x00, 0x00, 0x10},
614 {0xa0, 0x21, 0x0e, 0x02, 0x00, 0x00, 0x00, 0x10},
615 {0xa0, 0x21, 0x0f, 0xb2, 0x00, 0x00, 0x00, 0x10},
616 {0xa0, 0x21, 0x12, 0x70, 0x00, 0x00, 0x00, 0x10},
617 {0xdd, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 10ms*/
618 {0xa0, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00, 0x10},
619 {0xa0, 0x21, 0x15, 0xb8, 0x00, 0x00, 0x00, 0x10},
620 {0xa0, 0x21, 0x16, 0x13, 0x00, 0x00, 0x00, 0x10},
621 {0xa0, 0x21, 0x17, 0x52, 0x00, 0x00, 0x00, 0x10},
622 {0xa0, 0x21, 0x18, 0x50, 0x00, 0x00, 0x00, 0x10},
623 {0xa0, 0x21, 0x1e, 0x0d, 0x00, 0x00, 0x00, 0x10},
624 {0xa0, 0x21, 0x1f, 0x32, 0x00, 0x00, 0x00, 0x10},
625 {0xa0, 0x21, 0x61, 0x90, 0x00, 0x00, 0x00, 0x10},
626 {0xa0, 0x21, 0x63, 0x70, 0x00, 0x00, 0x00, 0x10},
627 {0xa0, 0x21, 0x65, 0x98, 0x00, 0x00, 0x00, 0x10},
628 {0xa0, 0x21, 0x67, 0x90, 0x00, 0x00, 0x00, 0x10},
629 {0xa0, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10},
630 {0xa0, 0x21, 0x04, 0x96, 0x00, 0x00, 0x00, 0x10},
631 {0xa0, 0x21, 0x45, 0x27, 0x00, 0x00, 0x00, 0x10},
632 {0xa0, 0x21, 0x47, 0x2c, 0x00, 0x00, 0x00, 0x10},
633 {0xa0, 0x21, 0x43, 0x47, 0x00, 0x00, 0x00, 0x10},
634 {0xa0, 0x21, 0x44, 0xd8, 0x00, 0x00, 0x00, 0x10},
635 {}
636};
637static const u8 gc0307_sensor_param1[][8] = {
638 {0xa0, 0x21, 0x68, 0x13, 0x00, 0x00, 0x00, 0x10},
639 {0xd0, 0x21, 0x61, 0x80, 0x00, 0x80, 0x00, 0x10},
640 {0xc0, 0x21, 0x65, 0x80, 0x00, 0x80, 0x00, 0x10},
641 {0xc0, 0x21, 0x63, 0xa0, 0x00, 0xa6, 0x00, 0x10},
642/*param3*/
643 {0xa0, 0x21, 0x01, 0x6e, 0x00, 0x00, 0x00, 0x10},
644 {0xa0, 0x21, 0x02, 0x88, 0x00, 0x00, 0x00, 0x10},
645
646 {0xa0, 0x21, 0x68, 0x22, 0x00, 0x00, 0x00, 0x10},
647 {0xdd, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
648 {0xa0, 0x21, 0x03, 0x07, 0x00, 0x00, 0x00, 0x10},
649 {0xdd, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
650 {0xa0, 0x21, 0x04, 0x91, 0x00, 0x00, 0x00, 0x10},
651 {}
652};
653
556static const u8 hv7131r_sensor_init[][8] = { 654static const u8 hv7131r_sensor_init[][8] = {
557 {0xc1, 0x11, 0x01, 0x08, 0x01, 0x00, 0x00, 0x10}, 655 {0xc1, 0x11, 0x01, 0x08, 0x01, 0x00, 0x00, 0x10},
558 {0xb1, 0x11, 0x34, 0x17, 0x7f, 0x00, 0x00, 0x10}, 656 {0xb1, 0x11, 0x34, 0x17, 0x7f, 0x00, 0x00, 0x10},
@@ -1004,6 +1102,82 @@ static const u8 po1030_sensor_param1[][8] = {
1004 {} 1102 {}
1005}; 1103};
1006 1104
1105static const u8 po2030n_sensor_init[][8] = {
1106 {0xa1, 0x6e, 0x1e, 0x1a, 0x00, 0x00, 0x00, 0x10},
1107 {0xa1, 0x6e, 0x1f, 0x99, 0x00, 0x00, 0x00, 0x10},
1108 {0xdd, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 10ms */
1109 {0xa1, 0x6e, 0x1e, 0x0a, 0x00, 0x00, 0x00, 0x10},
1110 {0xa1, 0x6e, 0x1f, 0x19, 0x00, 0x00, 0x00, 0x10},
1111 {0xdd, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 10ms */
1112 {0xa1, 0x6e, 0x20, 0x44, 0x00, 0x00, 0x00, 0x10},
1113 {0xa1, 0x6e, 0x04, 0x03, 0x00, 0x00, 0x00, 0x10},
1114 {0xa1, 0x6e, 0x05, 0x70, 0x00, 0x00, 0x00, 0x10},
1115 {0xa1, 0x6e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x10},
1116 {0xa1, 0x6e, 0x07, 0x25, 0x00, 0x00, 0x00, 0x10},
1117 {0xd1, 0x6e, 0x08, 0x00, 0xd0, 0x00, 0x08, 0x10},
1118 {0xd1, 0x6e, 0x0c, 0x03, 0x50, 0x01, 0xe8, 0x10},
1119 {0xd1, 0x6e, 0x1d, 0x20, 0x0a, 0x19, 0x44, 0x10},
1120 {0xd1, 0x6e, 0x21, 0x00, 0x00, 0x00, 0x00, 0x10},
1121 {0xd1, 0x6e, 0x25, 0x00, 0x00, 0x00, 0x00, 0x10},
1122 {0xd1, 0x6e, 0x29, 0x00, 0x00, 0x00, 0x00, 0x10},
1123 {0xd1, 0x6e, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10},
1124 {0xd1, 0x6e, 0x31, 0x00, 0x00, 0x00, 0x00, 0x10},
1125 {0xd1, 0x6e, 0x35, 0x00, 0x00, 0x00, 0x00, 0x10},
1126 {0xd1, 0x6e, 0x39, 0x00, 0x00, 0x00, 0x00, 0x10},
1127 {0xd1, 0x6e, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x10},
1128 {0xd1, 0x6e, 0x41, 0x00, 0x00, 0x00, 0x00, 0x10},
1129 {0xd1, 0x6e, 0x45, 0x00, 0x00, 0x00, 0x00, 0x10},
1130 {0xd1, 0x6e, 0x49, 0x00, 0x00, 0x00, 0x00, 0x10},
1131 {0xd1, 0x6e, 0x4d, 0x00, 0x00, 0x00, 0xed, 0x10},
1132 {0xd1, 0x6e, 0x51, 0x17, 0x4a, 0x2f, 0xc0, 0x10},
1133 {0xd1, 0x6e, 0x55, 0x00, 0x00, 0x00, 0x00, 0x10},
1134 {0xd1, 0x6e, 0x59, 0x00, 0x00, 0x00, 0x00, 0x10},
1135 {0xd1, 0x6e, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x10},
1136 {0xd1, 0x6e, 0x61, 0x00, 0x00, 0x00, 0x00, 0x10},
1137 {0xd1, 0x6e, 0x65, 0x00, 0x00, 0x00, 0x00, 0x10},
1138 {0xd1, 0x6e, 0x69, 0x00, 0x00, 0x00, 0x00, 0x10},
1139 {0xd1, 0x6e, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x10},
1140 {0xd1, 0x6e, 0x71, 0x00, 0x00, 0x00, 0x00, 0x10},
1141 {0xd1, 0x6e, 0x75, 0x00, 0x00, 0x00, 0x00, 0x10},
1142 {0xd1, 0x6e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x10},
1143 {0xd1, 0x6e, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x10},
1144 {0xd1, 0x6e, 0x81, 0x00, 0x00, 0x00, 0x00, 0x10},
1145 {0xd1, 0x6e, 0x85, 0x00, 0x00, 0x00, 0x08, 0x10},
1146 {0xd1, 0x6e, 0x89, 0x01, 0xe8, 0x00, 0x01, 0x10},
1147 {0xa1, 0x6e, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x10},
1148 {0xd1, 0x6e, 0x21, 0x00, 0x00, 0x00, 0x00, 0x10},
1149 {0xd1, 0x6e, 0x25, 0x00, 0x00, 0x00, 0x01, 0x10},
1150 {0xd1, 0x6e, 0x29, 0xe6, 0x00, 0xbd, 0x03, 0x10},
1151 {0xd1, 0x6e, 0x2d, 0x41, 0x38, 0x68, 0x40, 0x10},
1152 {0xd1, 0x6e, 0x31, 0x2b, 0x00, 0x36, 0x00, 0x10},
1153 {0xd1, 0x6e, 0x35, 0x30, 0x30, 0x08, 0x00, 0x10},
1154 {0xd1, 0x6e, 0x39, 0x00, 0x00, 0x33, 0x06, 0x10},
1155 {0xb1, 0x6e, 0x3d, 0x06, 0x02, 0x00, 0x00, 0x10},
1156 {}
1157};
1158static const u8 po2030n_sensor_param1[][8] = {
1159 {0xa1, 0x6e, 0x1a, 0x01, 0x00, 0x00, 0x00, 0x10},
1160 {0xdd, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 8ms */
1161 {0xa1, 0x6e, 0x1b, 0xf4, 0x00, 0x00, 0x00, 0x10},
1162 {0xa1, 0x6e, 0x15, 0x04, 0x00, 0x00, 0x00, 0x10},
1163 {0xd1, 0x6e, 0x16, 0x50, 0x40, 0x49, 0x40, 0x10},
1164/*param2*/
1165 {0xa1, 0x6e, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x10},
1166 {0xa1, 0x6e, 0x04, 0x03, 0x00, 0x00, 0x00, 0x10},
1167 {0xa1, 0x6e, 0x05, 0x6f, 0x00, 0x00, 0x00, 0x10},
1168 {0xa1, 0x6e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x10},
1169 {0xa1, 0x6e, 0x07, 0x25, 0x00, 0x00, 0x00, 0x10},
1170 {0xa1, 0x6e, 0x15, 0x04, 0x00, 0x00, 0x00, 0x10},
1171 {0xc1, 0x6e, 0x16, 0x52, 0x40, 0x48, 0x00, 0x10},
1172/*after start*/
1173 {0xa1, 0x6e, 0x15, 0x0f, 0x00, 0x00, 0x00, 0x10},
1174 {0xdd, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 5ms */
1175 {0xa1, 0x6e, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x10},
1176 {0xdd, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 5ms */
1177 {0xa1, 0x6e, 0x1b, 0x53, 0x00, 0x00, 0x00, 0x10},
1178 {}
1179};
1180
1007static const u8 sp80708_sensor_init[][8] = { 1181static const u8 sp80708_sensor_init[][8] = {
1008 {0xa1, 0x18, 0x06, 0xf9, 0x00, 0x00, 0x00, 0x10}, 1182 {0xa1, 0x18, 0x06, 0xf9, 0x00, 0x00, 0x00, 0x10},
1009 {0xa1, 0x18, 0x09, 0x1f, 0x00, 0x00, 0x00, 0x10}, 1183 {0xa1, 0x18, 0x09, 0x1f, 0x00, 0x00, 0x00, 0x10},
@@ -1091,6 +1265,7 @@ static const u8 sp80708_sensor_param1[][8] = {
1091 1265
1092static const u8 (*sensor_init[])[8] = { 1266static const u8 (*sensor_init[])[8] = {
1093[SENSOR_ADCM1700] = adcm1700_sensor_init, 1267[SENSOR_ADCM1700] = adcm1700_sensor_init,
1268[SENSOR_GC0307] = gc0307_sensor_init,
1094[SENSOR_HV7131R] = hv7131r_sensor_init, 1269[SENSOR_HV7131R] = hv7131r_sensor_init,
1095[SENSOR_MI0360] = mi0360_sensor_init, 1270[SENSOR_MI0360] = mi0360_sensor_init,
1096[SENSOR_MO4000] = mo4000_sensor_init, 1271[SENSOR_MO4000] = mo4000_sensor_init,
@@ -1100,6 +1275,7 @@ static const u8 (*sensor_init[])[8] = {
1100[SENSOR_OV7648] = ov7648_sensor_init, 1275[SENSOR_OV7648] = ov7648_sensor_init,
1101[SENSOR_OV7660] = ov7660_sensor_init, 1276[SENSOR_OV7660] = ov7660_sensor_init,
1102[SENSOR_PO1030] = po1030_sensor_init, 1277[SENSOR_PO1030] = po1030_sensor_init,
1278[SENSOR_PO2030N] = po2030n_sensor_init,
1103[SENSOR_SP80708] = sp80708_sensor_init, 1279[SENSOR_SP80708] = sp80708_sensor_init,
1104}; 1280};
1105 1281
@@ -1169,7 +1345,8 @@ static void i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val)
1169 PDEBUG(D_USBO, "i2c_w2 [%02x] = %02x", reg, val); 1345 PDEBUG(D_USBO, "i2c_w2 [%02x] = %02x", reg, val);
1170 switch (sd->sensor) { 1346 switch (sd->sensor) {
1171 case SENSOR_ADCM1700: 1347 case SENSOR_ADCM1700:
1172 case SENSOR_OM6802: /* i2c command = a0 (100 kHz) */ 1348 case SENSOR_OM6802:
1349 case SENSOR_GC0307: /* i2c command = a0 (100 kHz) */
1173 gspca_dev->usb_buf[0] = 0x80 | (2 << 4); 1350 gspca_dev->usb_buf[0] = 0x80 | (2 << 4);
1174 break; 1351 break;
1175 default: /* i2c command = a1 (400 kHz) */ 1352 default: /* i2c command = a1 (400 kHz) */
@@ -1216,7 +1393,8 @@ static void i2c_r(struct gspca_dev *gspca_dev, u8 reg, int len)
1216 1393
1217 switch (sd->sensor) { 1394 switch (sd->sensor) {
1218 case SENSOR_ADCM1700: 1395 case SENSOR_ADCM1700:
1219 case SENSOR_OM6802: /* i2c command = 90 (100 kHz) */ 1396 case SENSOR_OM6802:
1397 case SENSOR_GC0307: /* i2c command = a0 (100 kHz) */
1220 mode[0] = 0x80 | 0x10; 1398 mode[0] = 0x80 | 0x10;
1221 break; 1399 break;
1222 default: /* i2c command = 91 (400 kHz) */ 1400 default: /* i2c command = 91 (400 kHz) */
@@ -1355,6 +1533,46 @@ static void ov7648_probe(struct gspca_dev *gspca_dev)
1355 gspca_dev->usb_buf[3], gspca_dev->usb_buf[4]); 1533 gspca_dev->usb_buf[3], gspca_dev->usb_buf[4]);
1356} 1534}
1357 1535
1536/* 0c45:6142 sensor may be po2030n, gc0305 or gc0307 */
1537static void po2030n_probe(struct gspca_dev *gspca_dev)
1538{
1539 struct sd *sd = (struct sd *) gspca_dev;
1540
1541 /* check gc0307 */
1542 reg_w1(gspca_dev, 0x17, 0x62);
1543 reg_w1(gspca_dev, 0x01, 0x08);
1544 reg_w1(gspca_dev, 0x02, 0x22);
1545 sd->i2c_addr = 0x21;
1546 i2c_r(gspca_dev, 0x00, 1);
1547
1548 reg_w1(gspca_dev, 0x01, 0x29); /* reset */
1549 reg_w1(gspca_dev, 0x17, 0x42);
1550
1551 if (gspca_dev->usb_buf[4] == 0x99) { /* gc0307 (?) */
1552 PDEBUG(D_PROBE, "Sensor gc0307");
1553 sd->sensor = SENSOR_GC0307;
1554 return;
1555 }
1556
1557 /* check po2030n */
1558 reg_w1(gspca_dev, 0x17, 0x62);
1559 reg_w1(gspca_dev, 0x01, 0x0a);
1560 sd->i2c_addr = 0x6e;
1561 i2c_r(gspca_dev, 0x00, 2);
1562
1563 reg_w1(gspca_dev, 0x01, 0x29);
1564 reg_w1(gspca_dev, 0x17, 0x42);
1565
1566 if (gspca_dev->usb_buf[3] == 0x20
1567 && gspca_dev->usb_buf[4] == 0x30)
1568 PDEBUG(D_PROBE, "Sensor po2030n");
1569/* sd->sensor = SENSOR_PO2030N; */
1570 else
1571 PDEBUG(D_PROBE, "Unknown sensor ID %02x%02x",
1572 gspca_dev->usb_buf[3],
1573 gspca_dev->usb_buf[4]);
1574}
1575
1358static void bridge_init(struct gspca_dev *gspca_dev, 1576static void bridge_init(struct gspca_dev *gspca_dev,
1359 const u8 *sn9c1xx) 1577 const u8 *sn9c1xx)
1360{ 1578{
@@ -1375,8 +1593,10 @@ static void bridge_init(struct gspca_dev *gspca_dev,
1375 reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2); 1593 reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2);
1376 reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); 1594 reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5);
1377 switch (sd->sensor) { 1595 switch (sd->sensor) {
1596 case SENSOR_GC0307:
1378 case SENSOR_OV7660: 1597 case SENSOR_OV7660:
1379 case SENSOR_PO1030: 1598 case SENSOR_PO1030:
1599 case SENSOR_PO2030N:
1380 case SENSOR_SP80708: 1600 case SENSOR_SP80708:
1381 reg9a = reg9a_spec; 1601 reg9a = reg9a_spec;
1382 break; 1602 break;
@@ -1397,6 +1617,14 @@ static void bridge_init(struct gspca_dev *gspca_dev,
1397 reg_w1(gspca_dev, 0x01, 0x42); 1617 reg_w1(gspca_dev, 0x01, 0x42);
1398 reg_w1(gspca_dev, 0x01, 0x42); 1618 reg_w1(gspca_dev, 0x01, 0x42);
1399 break; 1619 break;
1620 case SENSOR_GC0307:
1621 msleep(50);
1622 reg_w1(gspca_dev, 0x01, 0x61);
1623 reg_w1(gspca_dev, 0x17, 0x22);
1624 reg_w1(gspca_dev, 0x01, 0x60);
1625 reg_w1(gspca_dev, 0x01, 0x40);
1626 msleep(50);
1627 break;
1400 case SENSOR_MT9V111: 1628 case SENSOR_MT9V111:
1401 reg_w1(gspca_dev, 0x01, 0x61); 1629 reg_w1(gspca_dev, 0x01, 0x61);
1402 reg_w1(gspca_dev, 0x17, 0x61); 1630 reg_w1(gspca_dev, 0x17, 0x61);
@@ -1439,6 +1667,12 @@ static void bridge_init(struct gspca_dev *gspca_dev,
1439 reg_w1(gspca_dev, 0x01, 0x60); 1667 reg_w1(gspca_dev, 0x01, 0x60);
1440 reg_w1(gspca_dev, 0x01, 0x40); 1668 reg_w1(gspca_dev, 0x01, 0x40);
1441 break; 1669 break;
1670 case SENSOR_PO2030N:
1671 reg_w1(gspca_dev, 0x01, 0x63);
1672 reg_w1(gspca_dev, 0x17, 0x20);
1673 reg_w1(gspca_dev, 0x01, 0x62);
1674 reg_w1(gspca_dev, 0x01, 0x42);
1675 break;
1442 case SENSOR_OV7660: 1676 case SENSOR_OV7660:
1443 /* fall thru */ 1677 /* fall thru */
1444 case SENSOR_SP80708: 1678 case SENSOR_SP80708:
@@ -1546,6 +1780,9 @@ static int sd_init(struct gspca_dev *gspca_dev)
1546 case SENSOR_OV7648: 1780 case SENSOR_OV7648:
1547 ov7648_probe(gspca_dev); 1781 ov7648_probe(gspca_dev);
1548 break; 1782 break;
1783 case SENSOR_PO2030N:
1784 po2030n_probe(gspca_dev);
1785 break;
1549 } 1786 }
1550 regGpio[1] = 0x70; 1787 regGpio[1] = 0x70;
1551 reg_w(gspca_dev, 0x01, regGpio, 2); 1788 reg_w(gspca_dev, 0x01, regGpio, 2);
@@ -1764,9 +2001,12 @@ static void setgamma(struct gspca_dev *gspca_dev)
1764 case SENSOR_MT9V111: 2001 case SENSOR_MT9V111:
1765 gamma_base = gamma_spec_1; 2002 gamma_base = gamma_spec_1;
1766 break; 2003 break;
1767 case SENSOR_SP80708: 2004 case SENSOR_GC0307:
1768 gamma_base = gamma_spec_2; 2005 gamma_base = gamma_spec_2;
1769 break; 2006 break;
2007 case SENSOR_SP80708:
2008 gamma_base = gamma_spec_3;
2009 break;
1770 default: 2010 default:
1771 gamma_base = gamma_def; 2011 gamma_base = gamma_def;
1772 break; 2012 break;
@@ -1957,9 +2197,15 @@ static int sd_start(struct gspca_dev *gspca_dev)
1957 static const u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; 2197 static const u8 CA[] = { 0x28, 0xd8, 0x14, 0xec };
1958 static const u8 CA_adcm1700[] = 2198 static const u8 CA_adcm1700[] =
1959 { 0x14, 0xec, 0x0a, 0xf6 }; 2199 { 0x14, 0xec, 0x0a, 0xf6 };
2200 static const u8 CA_po2030n[] =
2201 { 0x1e, 0xe2, 0x14, 0xec };
1960 static const u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */ 2202 static const u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */
2203 static const u8 CE_gc0307[] =
2204 { 0x32, 0xce, 0x2d, 0xd3 };
1961 static const u8 CE_ov76xx[] = 2205 static const u8 CE_ov76xx[] =
1962 { 0x32, 0xdd, 0x32, 0xdd }; 2206 { 0x32, 0xdd, 0x32, 0xdd };
2207 static const u8 CE_po2030n[] =
2208 { 0x14, 0xe7, 0x1e, 0xdd };
1963 2209
1964 /* create the JPEG header */ 2210 /* create the JPEG header */
1965 sd->jpeg_hdr = kmalloc(JPEG_HDR_SZ, GFP_KERNEL); 2211 sd->jpeg_hdr = kmalloc(JPEG_HDR_SZ, GFP_KERNEL);
@@ -2016,6 +2262,9 @@ static int sd_start(struct gspca_dev *gspca_dev)
2016 } 2262 }
2017 reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); 2263 reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]);
2018 switch (sd->sensor) { 2264 switch (sd->sensor) {
2265 case SENSOR_GC0307:
2266 reg17 = 0xa2;
2267 break;
2019 case SENSOR_MT9V111: 2268 case SENSOR_MT9V111:
2020 reg17 = 0xe0; 2269 reg17 = 0xe0;
2021 break; 2270 break;
@@ -2030,6 +2279,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
2030 reg17 = 0xa0; 2279 reg17 = 0xa0;
2031 break; 2280 break;
2032 case SENSOR_PO1030: 2281 case SENSOR_PO1030:
2282 case SENSOR_PO2030N:
2033 reg17 = 0xa0; 2283 reg17 = 0xa0;
2034 break; 2284 break;
2035 default: 2285 default:
@@ -2054,12 +2304,16 @@ static int sd_start(struct gspca_dev *gspca_dev)
2054 case SENSOR_SP80708: 2304 case SENSOR_SP80708:
2055 reg_w1(gspca_dev, 0x9a, 0x05); 2305 reg_w1(gspca_dev, 0x9a, 0x05);
2056 break; 2306 break;
2307 case SENSOR_GC0307:
2057 case SENSOR_MT9V111: 2308 case SENSOR_MT9V111:
2058 reg_w1(gspca_dev, 0x9a, 0x07); 2309 reg_w1(gspca_dev, 0x9a, 0x07);
2059 break; 2310 break;
2060 case SENSOR_OV7648: 2311 case SENSOR_OV7648:
2061 reg_w1(gspca_dev, 0x9a, 0x0a); 2312 reg_w1(gspca_dev, 0x9a, 0x0a);
2062 break; 2313 break;
2314 case SENSOR_PO2030N:
2315 reg_w1(gspca_dev, 0x9a, 0x06);
2316 break;
2063 default: 2317 default:
2064 reg_w1(gspca_dev, 0x9a, 0x08); 2318 reg_w1(gspca_dev, 0x9a, 0x08);
2065 break; 2319 break;
@@ -2084,6 +2338,11 @@ static int sd_start(struct gspca_dev *gspca_dev)
2084 reg1 = 0x46; 2338 reg1 = 0x46;
2085 reg17 = 0xe2; 2339 reg17 = 0xe2;
2086 break; 2340 break;
2341 case SENSOR_GC0307:
2342 init = gc0307_sensor_param1;
2343 reg17 = 0xa2;
2344 reg1 = 0x44;
2345 break;
2087 case SENSOR_MO4000: 2346 case SENSOR_MO4000:
2088 if (mode) { 2347 if (mode) {
2089/* reg1 = 0x46; * 320 clk 48Mhz 60fp/s */ 2348/* reg1 = 0x46; * 320 clk 48Mhz 60fp/s */
@@ -2133,6 +2392,11 @@ static int sd_start(struct gspca_dev *gspca_dev)
2133 reg17 = 0xa2; 2392 reg17 = 0xa2;
2134 reg1 = 0x44; 2393 reg1 = 0x44;
2135 break; 2394 break;
2395 case SENSOR_PO2030N:
2396 init = po2030n_sensor_param1;
2397 reg1 = 0x46;
2398 reg17 = 0xa2;
2399 break;
2136 default: 2400 default:
2137/* case SENSOR_SP80708: */ 2401/* case SENSOR_SP80708: */
2138 init = sp80708_sensor_param1; 2402 init = sp80708_sensor_param1;
@@ -2152,10 +2416,18 @@ static int sd_start(struct gspca_dev *gspca_dev)
2152 } 2416 }
2153 2417
2154 reg_w(gspca_dev, 0xc0, C0, 6); 2418 reg_w(gspca_dev, 0xc0, C0, 6);
2155 if (sd->sensor == SENSOR_ADCM1700) 2419 switch (sd->sensor) {
2420 case SENSOR_ADCM1700:
2421 case SENSOR_GC0307:
2156 reg_w(gspca_dev, 0xca, CA_adcm1700, 4); 2422 reg_w(gspca_dev, 0xca, CA_adcm1700, 4);
2157 else 2423 break;
2424 case SENSOR_PO2030N:
2425 reg_w(gspca_dev, 0xca, CA_po2030n, 4);
2426 break;
2427 default:
2158 reg_w(gspca_dev, 0xca, CA, 4); 2428 reg_w(gspca_dev, 0xca, CA, 4);
2429 break;
2430 }
2159 switch (sd->sensor) { 2431 switch (sd->sensor) {
2160 case SENSOR_ADCM1700: 2432 case SENSOR_ADCM1700:
2161 case SENSOR_OV7630: 2433 case SENSOR_OV7630:
@@ -2163,6 +2435,12 @@ static int sd_start(struct gspca_dev *gspca_dev)
2163 case SENSOR_OV7660: 2435 case SENSOR_OV7660:
2164 reg_w(gspca_dev, 0xce, CE_ov76xx, 4); 2436 reg_w(gspca_dev, 0xce, CE_ov76xx, 4);
2165 break; 2437 break;
2438 case SENSOR_GC0307:
2439 reg_w(gspca_dev, 0xce, CE_gc0307, 4);
2440 break;
2441 case SENSOR_PO2030N:
2442 reg_w(gspca_dev, 0xce, CE_po2030n, 4);
2443 break;
2166 default: 2444 default:
2167 reg_w(gspca_dev, 0xce, CE, 4); 2445 reg_w(gspca_dev, 0xce, CE, 4);
2168 /* ?? {0x1e, 0xdd, 0x2d, 0xe7} */ 2446 /* ?? {0x1e, 0xdd, 0x2d, 0xe7} */
@@ -2200,6 +2478,9 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
2200 2478
2201 data = 0x0b; 2479 data = 0x0b;
2202 switch (sd->sensor) { 2480 switch (sd->sensor) {
2481 case SENSOR_GC0307:
2482 data = 0x29;
2483 break;
2203 case SENSOR_HV7131R: 2484 case SENSOR_HV7131R:
2204 i2c_w8(gspca_dev, stophv7131); 2485 i2c_w8(gspca_dev, stophv7131);
2205 data = 0x2b; 2486 data = 0x2b;
@@ -2676,7 +2957,7 @@ static const __devinitdata struct usb_device_id device_table[] = {
2676#endif 2957#endif
2677 {USB_DEVICE(0x0c45, 0x613c), BS(SN9C120, HV7131R)}, 2958 {USB_DEVICE(0x0c45, 0x613c), BS(SN9C120, HV7131R)},
2678 {USB_DEVICE(0x0c45, 0x613e), BS(SN9C120, OV7630)}, 2959 {USB_DEVICE(0x0c45, 0x613e), BS(SN9C120, OV7630)},
2679/* {USB_DEVICE(0x0c45, 0x6142), BS(SN9C120, PO2030N)}, *sn9c120b*/ 2960 {USB_DEVICE(0x0c45, 0x6142), BS(SN9C120, PO2030N)}, /*sn9c120b*/
2680 {USB_DEVICE(0x0c45, 0x6143), BS(SN9C120, SP80708)}, /*sn9c120b*/ 2961 {USB_DEVICE(0x0c45, 0x6143), BS(SN9C120, SP80708)}, /*sn9c120b*/
2681 {USB_DEVICE(0x0c45, 0x6148), BS(SN9C120, OM6802)}, /*sn9c120b*/ 2962 {USB_DEVICE(0x0c45, 0x6148), BS(SN9C120, OM6802)}, /*sn9c120b*/
2682 {USB_DEVICE(0x0c45, 0x614a), BS(SN9C120, ADCM1700)}, /*sn9c120b*/ 2963 {USB_DEVICE(0x0c45, 0x614a), BS(SN9C120, ADCM1700)}, /*sn9c120b*/