diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2008-09-03 15:47:34 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-09-03 17:36:38 -0400 |
commit | 6ab0b174d22b448d66058c9de0114fdfac5b7ccf (patch) | |
tree | 3d6d0fb45a5cb1ac7df5fed46f429c5d8fd7db31 /drivers | |
parent | 285a4f6c8e518f03758c7b085bda13bb3795df0a (diff) |
V4L/DVB (8674): gspca: Webcam 0c45:612e added in sonixj.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/gspca/sonixj.c | 110 |
1 files changed, 100 insertions, 10 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 0a20db87a472..47737bf04c6a 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
@@ -55,8 +55,9 @@ struct sd { | |||
55 | #define SENSOR_MI0360 1 | 55 | #define SENSOR_MI0360 1 |
56 | #define SENSOR_MO4000 2 | 56 | #define SENSOR_MO4000 2 |
57 | #define SENSOR_OM6802 3 | 57 | #define SENSOR_OM6802 3 |
58 | #define SENSOR_OV7648 4 | 58 | #define SENSOR_OV7630 4 |
59 | #define SENSOR_OV7660 5 | 59 | #define SENSOR_OV7648 5 |
60 | #define SENSOR_OV7660 6 | ||
60 | unsigned char i2c_base; | 61 | unsigned char i2c_base; |
61 | }; | 62 | }; |
62 | 63 | ||
@@ -195,6 +196,17 @@ static const __u8 sn_om6802[] = { | |||
195 | 0xf7 | 196 | 0xf7 |
196 | }; | 197 | }; |
197 | 198 | ||
199 | static const __u8 sn_ov7630[] = { | ||
200 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ | ||
201 | 0x00, 0x21, 0x40, 0x00, 0x1a, 0x20, 0x1f, 0x20, | ||
202 | /* reg8 reg9 rega regb regc regd rege regf */ | ||
203 | 0xa1, 0x21, 0x76, 0x21, 0x00, 0x00, 0x00, 0x10, | ||
204 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ | ||
205 | 0x03, 0x00, 0x04, 0x01, 0x0a, 0x28, 0x1e, 0xc2, | ||
206 | /* reg18 reg19 reg1a reg1b reg1c reg1d reg1e reg1f */ | ||
207 | 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
208 | }; | ||
209 | |||
198 | static const __u8 sn_ov7648[] = { | 210 | static const __u8 sn_ov7648[] = { |
199 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ | 211 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
200 | 0x00, 0x21, 0x62, 0x00, 0x1a, 0x20, 0x20, 0x20, | 212 | 0x00, 0x21, 0x62, 0x00, 0x1a, 0x20, 0x20, 0x20, |
@@ -223,6 +235,7 @@ static const __u8 *sn_tb[] = { | |||
223 | sn_mi0360, | 235 | sn_mi0360, |
224 | sn_mo4000, | 236 | sn_mo4000, |
225 | sn_om6802, | 237 | sn_om6802, |
238 | sn_ov7630, | ||
226 | sn_ov7648, | 239 | sn_ov7648, |
227 | sn_ov7660 | 240 | sn_ov7660 |
228 | }; | 241 | }; |
@@ -390,6 +403,56 @@ static __u8 om6802_sensor_init[][8] = { | |||
390 | /* {0xa0, 0x34, 0x69, 0x01, 0x00, 0x00, 0x00, 0x10}, */ | 403 | /* {0xa0, 0x34, 0x69, 0x01, 0x00, 0x00, 0x00, 0x10}, */ |
391 | {} | 404 | {} |
392 | }; | 405 | }; |
406 | static const __u8 ov7630_sensor_init[][8] = { | ||
407 | {0xa1, 0x21, 0x76, 0x01, 0x00, 0x00, 0x00, 0x10}, | ||
408 | {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10}, | ||
409 | /* win: delay 20ms */ | ||
410 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, | ||
411 | {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10}, | ||
412 | /* win: delay 20ms */ | ||
413 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, | ||
414 | /* win: loop on 2 wwrite, 1 read */ | ||
415 | {0xd1, 0x21, 0x03, 0x80, 0x10, 0x20, 0x80, 0x10}, | ||
416 | {0xb1, 0x21, 0x0c, 0x20, 0x20, 0x00, 0x00, 0x10}, | ||
417 | {0xd1, 0x21, 0x11, 0x00, 0x48, 0xc0, 0x00, 0x10}, | ||
418 | {0xb1, 0x21, 0x15, 0x80, 0x03, 0x00, 0x00, 0x10}, | ||
419 | {0xd1, 0x21, 0x17, 0x1b, 0xbd, 0x05, 0xf6, 0x10}, | ||
420 | {0xa1, 0x21, 0x1b, 0x04, 0x00, 0x00, 0x00, 0x10}, | ||
421 | {0xd1, 0x21, 0x1f, 0x00, 0x80, 0x80, 0x80, 0x10}, | ||
422 | {0xd1, 0x21, 0x23, 0xde, 0x10, 0x8a, 0xa0, 0x10}, | ||
423 | {0xc1, 0x21, 0x27, 0xca, 0xa2, 0x74, 0x00, 0x10}, | ||
424 | {0xd1, 0x21, 0x2a, 0x88, 0x00, 0x88, 0x01, 0x10}, | ||
425 | {0xc1, 0x21, 0x2e, 0x80, 0x00, 0x18, 0x00, 0x10}, | ||
426 | {0xa1, 0x21, 0x21, 0x08, 0x00, 0x00, 0x00, 0x10}, | ||
427 | {0xa1, 0x21, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10}, | ||
428 | {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10}, | ||
429 | {0xb1, 0x21, 0x32, 0xc2, 0x08, 0x00, 0x00, 0x10}, | ||
430 | {0xb1, 0x21, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x10}, | ||
431 | {0xd1, 0x21, 0x60, 0x05, 0x40, 0x12, 0x57, 0x10}, | ||
432 | {0xa1, 0x21, 0x64, 0x73, 0x00, 0x00, 0x00, 0x10}, | ||
433 | {0xd1, 0x21, 0x65, 0x00, 0x55, 0x01, 0xac, 0x10}, | ||
434 | {0xa1, 0x21, 0x69, 0x38, 0x00, 0x00, 0x00, 0x10}, | ||
435 | {0xd1, 0x21, 0x6f, 0x1f, 0x01, 0x00, 0x10, 0x10}, | ||
436 | {0xd1, 0x21, 0x73, 0x50, 0x20, 0x02, 0x01, 0x10}, | ||
437 | {0xd1, 0x21, 0x77, 0xf3, 0x90, 0x98, 0x98, 0x10}, | ||
438 | {0xc1, 0x21, 0x7b, 0x00, 0x4c, 0xf7, 0x00, 0x10}, | ||
439 | {0xd1, 0x21, 0x17, 0x1b, 0xbd, 0x05, 0xf6, 0x10}, | ||
440 | {0xa1, 0x21, 0x1b, 0x04, 0x00, 0x00, 0x00, 0x10}, | ||
441 | /* */ | ||
442 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, | ||
443 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, | ||
444 | /*fixme: + 0x12, 0x04*/ | ||
445 | {0xa1, 0x21, 0x75, 0x82, 0x00, 0x00, 0x00, 0x10}, | ||
446 | {0xa1, 0x21, 0x10, 0x32, 0x00, 0x00, 0x00, 0x10}, | ||
447 | {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, | ||
448 | {0xb1, 0x21, 0x01, 0x80, 0x80, 0x00, 0x00, 0x10}, | ||
449 | {0xa1, 0x21, 0x11, 0x00, 0x00, 0x00, 0x00, 0x10}, | ||
450 | {0xa1, 0x21, 0x2a, 0x88, 0x00, 0x00, 0x00, 0x10}, | ||
451 | {0xa1, 0x21, 0x2b, 0x34, 0x00, 0x00, 0x00, 0x10}, | ||
452 | {0xa1, 0x21, 0x10, 0x83, 0x00, 0x00, 0x00, 0x10}, | ||
453 | {0xb1, 0x21, 0x01, 0x88, 0x70, 0x00, 0x00, 0x10}, | ||
454 | {} | ||
455 | }; | ||
393 | static const __u8 ov7660_sensor_init[][8] = { | 456 | static const __u8 ov7660_sensor_init[][8] = { |
394 | {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */ | 457 | {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */ |
395 | /* (delay 20ms) */ | 458 | /* (delay 20ms) */ |
@@ -803,6 +866,19 @@ static void om6802_InitSensor(struct gspca_dev *gspca_dev) | |||
803 | } | 866 | } |
804 | } | 867 | } |
805 | 868 | ||
869 | static void ov7630_InitSensor(struct gspca_dev *gspca_dev) | ||
870 | { | ||
871 | int i = 0; | ||
872 | |||
873 | i2c_w8(gspca_dev, ov7630_sensor_init[i]); | ||
874 | i++; | ||
875 | msleep(20); | ||
876 | while (ov7630_sensor_init[i][0]) { | ||
877 | i2c_w8(gspca_dev, ov7630_sensor_init[i]); | ||
878 | i++; | ||
879 | } | ||
880 | } | ||
881 | |||
806 | static void ov7648_InitSensor(struct gspca_dev *gspca_dev) | 882 | static void ov7648_InitSensor(struct gspca_dev *gspca_dev) |
807 | { | 883 | { |
808 | int i = 0; | 884 | int i = 0; |
@@ -1060,8 +1136,8 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
1060 | static const __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; | 1136 | static const __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; |
1061 | static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; | 1137 | static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; |
1062 | static const __u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */ | 1138 | static const __u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */ |
1063 | static const __u8 CE_sn9c325[] = | 1139 | static const __u8 CE_ov76xx[] = |
1064 | { 0x32, 0xdd, 0x32, 0xdd }; /* OV7648 - SN9C325 */ | 1140 | { 0x32, 0xdd, 0x32, 0xdd }; /* OV7630/48 */ |
1065 | 1141 | ||
1066 | sn9c1xx = sn_tb[(int) sd->sensor]; | 1142 | sn9c1xx = sn_tb[(int) sd->sensor]; |
1067 | configure_gpio(gspca_dev, sn9c1xx); | 1143 | configure_gpio(gspca_dev, sn9c1xx); |
@@ -1079,10 +1155,17 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
1079 | reg_w1(gspca_dev, 0xc8, 0x50); | 1155 | reg_w1(gspca_dev, 0xc8, 0x50); |
1080 | reg_w1(gspca_dev, 0xc9, 0x3c); | 1156 | reg_w1(gspca_dev, 0xc9, 0x3c); |
1081 | reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); | 1157 | reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); |
1082 | switch (sd->bridge) { | 1158 | switch (sd->sensor) { |
1083 | case BRIDGE_SN9C325: | 1159 | case SENSOR_OV7630: |
1160 | reg17 = 0xe2; | ||
1161 | break; | ||
1162 | case SENSOR_OV7648: | ||
1084 | reg17 = 0xae; | 1163 | reg17 = 0xae; |
1085 | break; | 1164 | break; |
1165 | /*jfm: from win trace */ | ||
1166 | case SENSOR_OV7660: | ||
1167 | reg17 = 0xa0; | ||
1168 | break; | ||
1086 | default: | 1169 | default: |
1087 | reg17 = 0x60; | 1170 | reg17 = 0x60; |
1088 | break; | 1171 | break; |
@@ -1138,6 +1221,11 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
1138 | om6802_InitSensor(gspca_dev); | 1221 | om6802_InitSensor(gspca_dev); |
1139 | reg17 = 0x64; /* 640 MCKSIZE */ | 1222 | reg17 = 0x64; /* 640 MCKSIZE */ |
1140 | break; | 1223 | break; |
1224 | case SENSOR_OV7630: | ||
1225 | ov7630_InitSensor(gspca_dev); | ||
1226 | reg17 = 0xe2; | ||
1227 | reg1 = 0x40; | ||
1228 | break; | ||
1141 | case SENSOR_OV7648: | 1229 | case SENSOR_OV7648: |
1142 | ov7648_InitSensor(gspca_dev); | 1230 | ov7648_InitSensor(gspca_dev); |
1143 | reg17 = 0xa2; | 1231 | reg17 = 0xa2; |
@@ -1162,9 +1250,10 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
1162 | } | 1250 | } |
1163 | reg_w(gspca_dev, 0xc0, C0, 6); | 1251 | reg_w(gspca_dev, 0xc0, C0, 6); |
1164 | reg_w(gspca_dev, 0xca, CA, 4); | 1252 | reg_w(gspca_dev, 0xca, CA, 4); |
1165 | switch (sd->bridge) { | 1253 | switch (sd->sensor) { |
1166 | case BRIDGE_SN9C325: | 1254 | case SENSOR_OV7630: |
1167 | reg_w(gspca_dev, 0xce, CE_sn9c325, 4); | 1255 | case SENSOR_OV7648: |
1256 | reg_w(gspca_dev, 0xce, CE_ov76xx, 4); | ||
1168 | break; | 1257 | break; |
1169 | default: | 1258 | default: |
1170 | reg_w(gspca_dev, 0xce, CE, 4); | 1259 | reg_w(gspca_dev, 0xce, CE, 4); |
@@ -1208,6 +1297,7 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
1208 | i2c_w8(gspca_dev, stopmi0360); | 1297 | i2c_w8(gspca_dev, stopmi0360); |
1209 | data = 0x29; | 1298 | data = 0x29; |
1210 | break; | 1299 | break; |
1300 | case SENSOR_OV7630: | ||
1211 | case SENSOR_OV7648: | 1301 | case SENSOR_OV7648: |
1212 | data = 0x29; | 1302 | data = 0x29; |
1213 | break; | 1303 | break; |
@@ -1503,7 +1593,7 @@ static const __devinitdata struct usb_device_id device_table[] = { | |||
1503 | /*bw600.inf:*/ | 1593 | /*bw600.inf:*/ |
1504 | {USB_DEVICE(0x0c45, 0x612a), BSI(SN9C110, OV7648, 0x21)}, /*sn9c325?*/ | 1594 | {USB_DEVICE(0x0c45, 0x612a), BSI(SN9C110, OV7648, 0x21)}, /*sn9c325?*/ |
1505 | {USB_DEVICE(0x0c45, 0x612c), BSI(SN9C110, MO4000, 0x21)}, | 1595 | {USB_DEVICE(0x0c45, 0x612c), BSI(SN9C110, MO4000, 0x21)}, |
1506 | /* {USB_DEVICE(0x0c45, 0x612e), BSI(SN9C110, OV7630, 0x??)}, */ | 1596 | {USB_DEVICE(0x0c45, 0x612e), BSI(SN9C110, OV7630, 0x21)}, |
1507 | /* {USB_DEVICE(0x0c45, 0x612f), BSI(SN9C110, ICM105C, 0x??)}, */ | 1597 | /* {USB_DEVICE(0x0c45, 0x612f), BSI(SN9C110, ICM105C, 0x??)}, */ |
1508 | #ifndef CONFIG_USB_SN9C102 | 1598 | #ifndef CONFIG_USB_SN9C102 |
1509 | {USB_DEVICE(0x0c45, 0x6130), BSI(SN9C120, MI0360, 0x5d)}, | 1599 | {USB_DEVICE(0x0c45, 0x6130), BSI(SN9C120, MI0360, 0x5d)}, |