aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/gl860/gl860-mi2020.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/gspca/gl860/gl860-mi2020.c')
-rw-r--r--drivers/media/video/gspca/gl860/gl860-mi2020.c69
1 files changed, 34 insertions, 35 deletions
diff --git a/drivers/media/video/gspca/gl860/gl860-mi2020.c b/drivers/media/video/gspca/gl860/gl860-mi2020.c
index ffb09fed3e8c..80cb3f1b36f7 100644
--- a/drivers/media/video/gspca/gl860/gl860-mi2020.c
+++ b/drivers/media/video/gspca/gl860/gl860-mi2020.c
@@ -1,7 +1,6 @@
1/* @file gl860-mi2020.c 1/* Subdriver for the GL860 chip with the MI2020 sensor
2 * @author Olivier LORIN, from Ice/Soro2005's logs(A), Fret_saw/Hulkie's 2 * Author Olivier LORIN, from Ice/Soro2005's logs(A), Fret_saw/Hulkie's
3 * logs(B) and Tricid"s logs(C). With the help of Kytrix/BUGabundo/Blazercist. 3 * logs(B) and Tricid"s logs(C). With the help of Kytrix/BUGabundo/Blazercist.
4 * @date 2009-08-27
5 * 4 *
6 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -41,7 +40,7 @@ static u8 dat_freq1[] = { 0x8c, 0xa4, 0x04 };
41static u8 dat_multi5[] = { 0x8c, 0xa1, 0x03 }; 40static u8 dat_multi5[] = { 0x8c, 0xa1, 0x03 };
42static u8 dat_multi6[] = { 0x90, 0x00, 0x05 }; 41static u8 dat_multi6[] = { 0x90, 0x00, 0x05 };
43 42
44static struct validx tbl_common_a[] = { 43static struct validx tbl_common1[] = {
45 {0x0000, 0x0000}, 44 {0x0000, 0x0000},
46 {1, 0xffff}, /* msleep(35); */ 45 {1, 0xffff}, /* msleep(35); */
47 {0x006a, 0x0007}, {0x0063, 0x0006}, {0x006a, 0x000d}, {0x0000, 0x00c0}, 46 {0x006a, 0x0007}, {0x0063, 0x0006}, {0x006a, 0x000d}, {0x0000, 0x00c0},
@@ -49,7 +48,7 @@ static struct validx tbl_common_a[] = {
49 {0x0000, 0x0058}, {0x0002, 0x0004}, {0x0041, 0x0000}, 48 {0x0000, 0x0058}, {0x0002, 0x0004}, {0x0041, 0x0000},
50}; 49};
51 50
52static struct validx tbl_common_b[] = { 51static struct validx tbl_common2[] = {
53 {0x006a, 0x0007}, 52 {0x006a, 0x0007},
54 {35, 0xffff}, 53 {35, 0xffff},
55 {0x00ef, 0x0006}, 54 {0x00ef, 0x0006},
@@ -60,7 +59,7 @@ static struct validx tbl_common_b[] = {
60 {0x0004, 0x00d8}, {0x0000, 0x0058}, {0x0041, 0x0000}, 59 {0x0004, 0x00d8}, {0x0000, 0x0058}, {0x0041, 0x0000},
61}; 60};
62 61
63static struct idxdata tbl_common_c[] = { 62static struct idxdata tbl_common3[] = {
64 {0x32, "\x02\x00\x08"}, {0x33, "\xf4\x03\x1d"}, 63 {0x32, "\x02\x00\x08"}, {0x33, "\xf4\x03\x1d"},
65 {6, "\xff\xff\xff"}, /* 12 */ 64 {6, "\xff\xff\xff"}, /* 12 */
66 {0x34, "\x1e\x8f\x09"}, {0x34, "\x1c\x01\x28"}, {0x34, "\x1e\x8f\x09"}, 65 {0x34, "\x1e\x8f\x09"}, {0x34, "\x1c\x01\x28"}, {0x34, "\x1e\x8f\x09"},
@@ -109,7 +108,7 @@ static struct idxdata tbl_common_c[] = {
109 {0x33, "\x8c\xa2\x03"}, {0x33, "\x90\x00\xbb"}, 108 {0x33, "\x8c\xa2\x03"}, {0x33, "\x90\x00\xbb"},
110}; 109};
111 110
112static struct idxdata tbl_common_d[] = { 111static struct idxdata tbl_common4[] = {
113 {0x33, "\x8c\x22\x2e"}, {0x33, "\x90\x00\xa0"}, {0x33, "\x8c\xa4\x08"}, 112 {0x33, "\x8c\x22\x2e"}, {0x33, "\x90\x00\xa0"}, {0x33, "\x8c\xa4\x08"},
114 {0x33, "\x90\x00\x1f"}, {0x33, "\x8c\xa4\x09"}, {0x33, "\x90\x00\x21"}, 113 {0x33, "\x90\x00\x1f"}, {0x33, "\x8c\xa4\x09"}, {0x33, "\x90\x00\x21"},
115 {0x33, "\x8c\xa4\x0a"}, {0x33, "\x90\x00\x25"}, {0x33, "\x8c\xa4\x0b"}, 114 {0x33, "\x8c\xa4\x0a"}, {0x33, "\x90\x00\x25"}, {0x33, "\x8c\xa4\x0b"},
@@ -118,7 +117,7 @@ static struct idxdata tbl_common_d[] = {
118 {0x33, "\x90\x00\xa0"}, {0x33, "\x8c\x24\x17"}, {0x33, "\x90\x00\xc0"}, 117 {0x33, "\x90\x00\xa0"}, {0x33, "\x8c\x24\x17"}, {0x33, "\x90\x00\xc0"},
119}; 118};
120 119
121static struct idxdata tbl_common_e[] = { 120static struct idxdata tbl_common5[] = {
122 {0x33, "\x8c\xa4\x04"}, {0x33, "\x90\x00\x80"}, {0x33, "\x8c\xa7\x9d"}, 121 {0x33, "\x8c\xa4\x04"}, {0x33, "\x90\x00\x80"}, {0x33, "\x8c\xa7\x9d"},
123 {0x33, "\x90\x00\x00"}, {0x33, "\x8c\xa7\x9e"}, {0x33, "\x90\x00\x00"}, 122 {0x33, "\x90\x00\x00"}, {0x33, "\x8c\xa7\x9e"}, {0x33, "\x90\x00\x00"},
124 {0x33, "\x8c\xa2\x0c"}, {0x33, "\x90\x00\x17"}, {0x33, "\x8c\xa2\x15"}, 123 {0x33, "\x8c\xa2\x0c"}, {0x33, "\x90\x00\x17"}, {0x33, "\x8c\xa2\x15"},
@@ -180,7 +179,7 @@ static struct validx tbl_init_at_startup[] = {
180 {53, 0xffff}, 179 {53, 0xffff},
181}; 180};
182 181
183static struct idxdata tbl_init_post_alt_low_a[] = { 182static struct idxdata tbl_init_post_alt_low1[] = {
184 {0x33, "\x8c\x27\x15"}, {0x33, "\x90\x00\x25"}, {0x33, "\x8c\x22\x2e"}, 183 {0x33, "\x8c\x27\x15"}, {0x33, "\x90\x00\x25"}, {0x33, "\x8c\x22\x2e"},
185 {0x33, "\x90\x00\x81"}, {0x33, "\x8c\xa4\x08"}, {0x33, "\x90\x00\x17"}, 184 {0x33, "\x90\x00\x81"}, {0x33, "\x8c\xa4\x08"}, {0x33, "\x90\x00\x17"},
186 {0x33, "\x8c\xa4\x09"}, {0x33, "\x90\x00\x1a"}, {0x33, "\x8c\xa4\x0a"}, 185 {0x33, "\x8c\xa4\x09"}, {0x33, "\x90\x00\x1a"}, {0x33, "\x8c\xa4\x0a"},
@@ -189,7 +188,7 @@ static struct idxdata tbl_init_post_alt_low_a[] = {
189 {0x33, "\x90\x00\x9b"}, 188 {0x33, "\x90\x00\x9b"},
190}; 189};
191 190
192static struct idxdata tbl_init_post_alt_low_b[] = { 191static struct idxdata tbl_init_post_alt_low2[] = {
193 {0x33, "\x8c\x27\x03"}, {0x33, "\x90\x03\x24"}, {0x33, "\x8c\x27\x05"}, 192 {0x33, "\x8c\x27\x03"}, {0x33, "\x90\x03\x24"}, {0x33, "\x8c\x27\x05"},
194 {0x33, "\x90\x02\x58"}, {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x05"}, 193 {0x33, "\x90\x02\x58"}, {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x05"},
195 {2, "\xff\xff\xff"}, 194 {2, "\xff\xff\xff"},
@@ -197,7 +196,7 @@ static struct idxdata tbl_init_post_alt_low_b[] = {
197 {2, "\xff\xff\xff"}, 196 {2, "\xff\xff\xff"},
198}; 197};
199 198
200static struct idxdata tbl_init_post_alt_low_c[] = { 199static struct idxdata tbl_init_post_alt_low3[] = {
201 {0x34, "\x1e\x8f\x09"}, {0x34, "\x1c\x01\x28"}, {0x34, "\x1e\x8f\x09"}, 200 {0x34, "\x1e\x8f\x09"}, {0x34, "\x1c\x01\x28"}, {0x34, "\x1e\x8f\x09"},
202 {2, "\xff\xff\xff"}, 201 {2, "\xff\xff\xff"},
203 {0x34, "\x1e\x8f\x09"}, {0x32, "\x14\x06\xe6"}, {0x33, "\x8c\xa1\x20"}, 202 {0x34, "\x1e\x8f\x09"}, {0x32, "\x14\x06\xe6"}, {0x33, "\x8c\xa1\x20"},
@@ -221,7 +220,7 @@ static struct idxdata tbl_init_post_alt_low_c[] = {
221 {1, "\xff\xff\xff"}, 220 {1, "\xff\xff\xff"},
222}; 221};
223 222
224static struct idxdata tbl_init_post_alt_low_d[] = { 223static struct idxdata tbl_init_post_alt_low4[] = {
225 {0x32, "\x10\x01\xf8"}, {0x34, "\xce\x01\xa8"}, {0x34, "\xd0\x66\x33"}, 224 {0x32, "\x10\x01\xf8"}, {0x34, "\xce\x01\xa8"}, {0x34, "\xd0\x66\x33"},
226 {0x34, "\xd2\x31\x9a"}, {0x34, "\xd4\x94\x63"}, {0x34, "\xd6\x4b\x25"}, 225 {0x34, "\xd2\x31\x9a"}, {0x34, "\xd4\x94\x63"}, {0x34, "\xd6\x4b\x25"},
227 {0x34, "\xd8\x26\x70"}, {0x34, "\xda\x72\x4c"}, {0x34, "\xdc\xff\x04"}, 226 {0x34, "\xd8\x26\x70"}, {0x34, "\xda\x72\x4c"}, {0x34, "\xdc\xff\x04"},
@@ -267,7 +266,7 @@ static struct idxdata tbl_init_post_alt_low_d[] = {
267 {0x32, "\x6c\x14\x08"}, 266 {0x32, "\x6c\x14\x08"},
268}; 267};
269 268
270static struct idxdata tbl_init_post_alt_big_a[] = { 269static struct idxdata tbl_init_post_alt_big1[] = {
271 {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x05"}, 270 {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x05"},
272 {2, "\xff\xff\xff"}, 271 {2, "\xff\xff\xff"},
273 {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x06"}, 272 {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x06"},
@@ -288,7 +287,7 @@ static struct idxdata tbl_init_post_alt_big_a[] = {
288 {0x34, "\x04\x00\x2a"}, {0x33, "\x8c\xa7\x02"}, {0x33, "\x90\x00\x01"}, 287 {0x34, "\x04\x00\x2a"}, {0x33, "\x8c\xa7\x02"}, {0x33, "\x90\x00\x01"},
289}; 288};
290 289
291static struct idxdata tbl_init_post_alt_big_b[] = { 290static struct idxdata tbl_init_post_alt_big2[] = {
292 {0x32, "\x10\x01\xf8"}, {0x34, "\xce\x01\xa8"}, {0x34, "\xd0\x66\x33"}, 291 {0x32, "\x10\x01\xf8"}, {0x34, "\xce\x01\xa8"}, {0x34, "\xd0\x66\x33"},
293 {0x34, "\xd2\x31\x9a"}, {0x34, "\xd4\x94\x63"}, {0x34, "\xd6\x4b\x25"}, 292 {0x34, "\xd2\x31\x9a"}, {0x34, "\xd4\x94\x63"}, {0x34, "\xd6\x4b\x25"},
294 {0x34, "\xd8\x26\x70"}, {0x34, "\xda\x72\x4c"}, {0x34, "\xdc\xff\x04"}, 293 {0x34, "\xd8\x26\x70"}, {0x34, "\xda\x72\x4c"}, {0x34, "\xdc\xff\x04"},
@@ -317,7 +316,7 @@ static struct idxdata tbl_init_post_alt_big_b[] = {
317 {0x32, "\x10\x01\xfc"}, {0x33, "\x8c\xa1\x18"}, {0x33, "\x90\x00\x3c"}, 316 {0x32, "\x10\x01\xfc"}, {0x33, "\x8c\xa1\x18"}, {0x33, "\x90\x00\x3c"},
318}; 317};
319 318
320static struct idxdata tbl_init_post_alt_big_c[] = { 319static struct idxdata tbl_init_post_alt_big3[] = {
321 {0x33, "\x8c\xa1\x02"}, 320 {0x33, "\x8c\xa1\x02"},
322 {0x33, "\x90\x00\x1f"}, 321 {0x33, "\x90\x00\x1f"},
323 {0x33, "\x8c\xa1\x02"}, 322 {0x33, "\x8c\xa1\x02"},
@@ -388,14 +387,14 @@ static void common(struct gspca_dev *gspca_dev)
388 s32 reso = gspca_dev->cam.cam_mode[(s32) gspca_dev->curr_mode].priv; 387 s32 reso = gspca_dev->cam.cam_mode[(s32) gspca_dev->curr_mode].priv;
389 388
390 if (_MI2020b_) { 389 if (_MI2020b_) {
391 fetch_validx(gspca_dev, tbl_common_a, ARRAY_SIZE(tbl_common_a)); 390 fetch_validx(gspca_dev, tbl_common1, ARRAY_SIZE(tbl_common1));
392 } else { 391 } else {
393 if (_MI2020_) 392 if (_MI2020_)
394 ctrl_out(gspca_dev, 0x40, 1, 0x0008, 0x0004, 0, NULL); 393 ctrl_out(gspca_dev, 0x40, 1, 0x0008, 0x0004, 0, NULL);
395 else 394 else
396 ctrl_out(gspca_dev, 0x40, 1, 0x0002, 0x0004, 0, NULL); 395 ctrl_out(gspca_dev, 0x40, 1, 0x0002, 0x0004, 0, NULL);
397 msleep(35); 396 msleep(35);
398 fetch_validx(gspca_dev, tbl_common_b, ARRAY_SIZE(tbl_common_b)); 397 fetch_validx(gspca_dev, tbl_common2, ARRAY_SIZE(tbl_common2));
399 } 398 }
400 ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0033, 3, "\x86\x25\x01"); 399 ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0033, 3, "\x86\x25\x01");
401 ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0033, 3, "\x86\x25\x00"); 400 ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0033, 3, "\x86\x25\x00");
@@ -403,13 +402,13 @@ static void common(struct gspca_dev *gspca_dev)
403 ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0030, 3, "\x1a\x0a\xcc"); 402 ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0030, 3, "\x1a\x0a\xcc");
404 if (reso == IMAGE_1600) 403 if (reso == IMAGE_1600)
405 msleep(2); /* 1600 */ 404 msleep(2); /* 1600 */
406 fetch_idxdata(gspca_dev, tbl_common_c, ARRAY_SIZE(tbl_common_c)); 405 fetch_idxdata(gspca_dev, tbl_common3, ARRAY_SIZE(tbl_common3));
407 406
408 if (_MI2020b_ || _MI2020_) 407 if (_MI2020b_ || _MI2020_)
409 fetch_idxdata(gspca_dev, tbl_common_d, 408 fetch_idxdata(gspca_dev, tbl_common4,
410 ARRAY_SIZE(tbl_common_d)); 409 ARRAY_SIZE(tbl_common4));
411 410
412 fetch_idxdata(gspca_dev, tbl_common_e, ARRAY_SIZE(tbl_common_e)); 411 fetch_idxdata(gspca_dev, tbl_common5, ARRAY_SIZE(tbl_common5));
413 if (_MI2020b_ || _MI2020_) { 412 if (_MI2020b_ || _MI2020_) {
414 /* Different from fret */ 413 /* Different from fret */
415 ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x78"); 414 ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x78");
@@ -525,15 +524,15 @@ static int mi2020_init_post_alt(struct gspca_dev *gspca_dev)
525 12, dat_800); 524 12, dat_800);
526 525
527 if (_MI2020c_) 526 if (_MI2020c_)
528 fetch_idxdata(gspca_dev, tbl_init_post_alt_low_a, 527 fetch_idxdata(gspca_dev, tbl_init_post_alt_low1,
529 ARRAY_SIZE(tbl_init_post_alt_low_a)); 528 ARRAY_SIZE(tbl_init_post_alt_low1));
530 529
531 if (reso == IMAGE_800) 530 if (reso == IMAGE_800)
532 fetch_idxdata(gspca_dev, tbl_init_post_alt_low_b, 531 fetch_idxdata(gspca_dev, tbl_init_post_alt_low2,
533 ARRAY_SIZE(tbl_init_post_alt_low_b)); 532 ARRAY_SIZE(tbl_init_post_alt_low2));
534 533
535 fetch_idxdata(gspca_dev, tbl_init_post_alt_low_c, 534 fetch_idxdata(gspca_dev, tbl_init_post_alt_low3,
536 ARRAY_SIZE(tbl_init_post_alt_low_c)); 535 ARRAY_SIZE(tbl_init_post_alt_low3));
537 536
538 if (_MI2020b_) { 537 if (_MI2020b_) {
539 ctrl_out(gspca_dev, 0x40, 1, 0x0001, 0x0010, 0, NULL); 538 ctrl_out(gspca_dev, 0x40, 1, 0x0001, 0x0010, 0, NULL);
@@ -574,8 +573,8 @@ static int mi2020_init_post_alt(struct gspca_dev *gspca_dev)
574 msleep(5);/* " */ 573 msleep(5);/* " */
575 574
576 if (_MI2020c_) { 575 if (_MI2020c_) {
577 fetch_idxdata(gspca_dev, tbl_init_post_alt_low_d, 576 fetch_idxdata(gspca_dev, tbl_init_post_alt_low4,
578 ARRAY_SIZE(tbl_init_post_alt_low_d)); 577 ARRAY_SIZE(tbl_init_post_alt_low4));
579 } else { 578 } else {
580 ctrl_in(gspca_dev, 0xc0, 2, 0x0000, 0x0000, 1, &c); 579 ctrl_in(gspca_dev, 0xc0, 2, 0x0000, 0x0000, 1, &c);
581 msleep(14); /* 0xd8 */ 580 msleep(14); /* 0xd8 */
@@ -644,8 +643,8 @@ static int mi2020_init_post_alt(struct gspca_dev *gspca_dev)
644 3, "\x90\x04\xb0"); 643 3, "\x90\x04\xb0");
645 } 644 }
646 645
647 fetch_idxdata(gspca_dev, tbl_init_post_alt_big_a, 646 fetch_idxdata(gspca_dev, tbl_init_post_alt_big1,
648 ARRAY_SIZE(tbl_init_post_alt_big_a)); 647 ARRAY_SIZE(tbl_init_post_alt_big1));
649 648
650 if (reso == IMAGE_1600) 649 if (reso == IMAGE_1600)
651 msleep(13); /* 1600 */ 650 msleep(13); /* 1600 */
@@ -708,8 +707,8 @@ static int mi2020_init_post_alt(struct gspca_dev *gspca_dev)
708 msleep(14); 707 msleep(14);
709 708
710 if (_MI2020c_) 709 if (_MI2020c_)
711 fetch_idxdata(gspca_dev, tbl_init_post_alt_big_b, 710 fetch_idxdata(gspca_dev, tbl_init_post_alt_big2,
712 ARRAY_SIZE(tbl_init_post_alt_big_b)); 711 ARRAY_SIZE(tbl_init_post_alt_big2));
713 712
714 /* flip/mirror */ 713 /* flip/mirror */
715 ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0033, 3, dat_hvflip1); 714 ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0033, 3, dat_hvflip1);
@@ -738,8 +737,8 @@ static int mi2020_init_post_alt(struct gspca_dev *gspca_dev)
738 sd->nbIm = 0; 737 sd->nbIm = 0;
739 738
740 if (_MI2020c_) 739 if (_MI2020c_)
741 fetch_idxdata(gspca_dev, tbl_init_post_alt_big_c, 740 fetch_idxdata(gspca_dev, tbl_init_post_alt_big3,
742 ARRAY_SIZE(tbl_init_post_alt_big_c)); 741 ARRAY_SIZE(tbl_init_post_alt_big3));
743 } 742 }
744 743
745 sd->vold.mirror = mirror; 744 sd->vold.mirror = mirror;