aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/t613.c
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2009-07-07 03:03:24 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-12 11:17:37 -0400
commit78a6d74e8101c5bdb7439a46689e9c81f784f570 (patch)
tree69962e21eda10026d6202473e85676f699407cdf /drivers/media/video/gspca/t613.c
parent1f53b0b0107e3d4b5a4382eaed6a8b4fc146b50c (diff)
V4L/DVB (12230): gspca - t613: Change tas5130a init sequences.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/t613.c')
-rw-r--r--drivers/media/video/gspca/t613.c210
1 files changed, 106 insertions, 104 deletions
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c
index 404214b8cd2b..1d321c30d22f 100644
--- a/drivers/media/video/gspca/t613.c
+++ b/drivers/media/video/gspca/t613.c
@@ -264,6 +264,10 @@ static const struct v4l2_pix_format vga_mode_t16[] = {
264 264
265/* sensor specific data */ 265/* sensor specific data */
266struct additional_sensor_data { 266struct additional_sensor_data {
267 const u8 n3[6];
268 const u8 *n4, n4sz;
269 const u8 reg80, reg8e;
270 const u8 nset8[6];
267 const u8 data1[10]; 271 const u8 data1[10];
268 const u8 data2[9]; 272 const u8 data2[9];
269 const u8 data3[9]; 273 const u8 data3[9];
@@ -272,14 +276,55 @@ struct additional_sensor_data {
272 const u8 stream[4]; 276 const u8 stream[4];
273}; 277};
274 278
279static const u8 n4_om6802[] = {
280 0x09, 0x01, 0x12, 0x04, 0x66, 0x8a, 0x80, 0x3c,
281 0x81, 0x22, 0x84, 0x50, 0x8a, 0x78, 0x8b, 0x68,
282 0x8c, 0x88, 0x8e, 0x33, 0x8f, 0x24, 0xaa, 0xb1,
283 0xa2, 0x60, 0xa5, 0x30, 0xa6, 0x3a, 0xa8, 0xe8,
284 0xae, 0x05, 0xb1, 0x00, 0xbb, 0x04, 0xbc, 0x48,
285 0xbe, 0x36, 0xc6, 0x88, 0xe9, 0x00, 0xc5, 0xc0,
286 0x65, 0x0a, 0xbb, 0x86, 0xaf, 0x58, 0xb0, 0x68,
287 0x87, 0x40, 0x89, 0x2b, 0x8d, 0xff, 0x83, 0x40,
288 0xac, 0x84, 0xad, 0x86, 0xaf, 0x46
289};
290static const u8 n4_other[] = {
291 0x66, 0x00, 0x7f, 0x00, 0x80, 0xac, 0x81, 0x69,
292 0x84, 0x40, 0x85, 0x70, 0x86, 0x20, 0x8a, 0x68,
293 0x8b, 0x58, 0x8c, 0x88, 0x8d, 0xff, 0x8e, 0xb8,
294 0x8f, 0x28, 0xa2, 0x60, 0xa5, 0x40, 0xa8, 0xa8,
295 0xac, 0x84, 0xad, 0x84, 0xae, 0x24, 0xaf, 0x56,
296 0xb0, 0x68, 0xb1, 0x00, 0xb2, 0x88, 0xbb, 0xc5,
297 0xbc, 0x4a, 0xbe, 0x36, 0xc2, 0x88, 0xc5, 0xc0,
298 0xc6, 0xda, 0xe9, 0x26, 0xeb, 0x00
299};
300static const u8 n4_tas5130a[] = {
301 0x80, 0x3c, 0x81, 0x68, 0x83, 0xa0, 0x84, 0x20,
302 0x8a, 0x68, 0x8b, 0x58, 0x8c, 0x88, 0x8e, 0xb4,
303 0x8f, 0x24, 0xa1, 0xb1, 0xa2, 0x30, 0xa5, 0x10,
304 0xa6, 0x4a, 0xae, 0x03, 0xb1, 0x44, 0xb2, 0x08,
305 0xb7, 0x06, 0xb9, 0xe7, 0xbb, 0xc4, 0xbc, 0x4a,
306 0xbe, 0x36, 0xbf, 0xff, 0xc2, 0x88, 0xc5, 0xc8,
307 0xc6, 0xda
308};
309
275static const struct additional_sensor_data sensor_data[] = { 310static const struct additional_sensor_data sensor_data[] = {
276 { /* OM6802 */ 311 { /* 0: OM6802 */
312 .n3 =
313 {0x61, 0x68, 0x65, 0x0a, 0x60, 0x04},
314 .n4 = n4_om6802,
315 .n4sz = sizeof n4_om6802,
316 .reg80 = 0x3c,
317 .reg8e = 0x33,
318 .nset8 = {0xa8, 0xf0, 0xc6, 0x88, 0xc0, 0x00},
277 .data1 = 319 .data1 =
278 {0xc2, 0x28, 0x0f, 0x22, 0xcd, 0x27, 0x2c, 0x06, 320 {0xc2, 0x28, 0x0f, 0x22, 0xcd, 0x27, 0x2c, 0x06,
279 0xb3, 0xfc}, 321 0xb3, 0xfc},
280 .data2 = 322 .data2 =
281 {0x80, 0xff, 0xff, 0x80, 0xff, 0xff, 0x80, 0xff, 323 {0x80, 0xff, 0xff, 0x80, 0xff, 0xff, 0x80, 0xff,
282 0xff}, 324 0xff},
325 .data3 =
326 {0x80, 0xff, 0xff, 0x80, 0xff, 0xff, 0x80, 0xff,
327 0xff},
283 .data4 = /*Freq (50/60Hz). Splitted for test purpose */ 328 .data4 = /*Freq (50/60Hz). Splitted for test purpose */
284 {0x66, 0xca, 0xa8, 0xf0}, 329 {0x66, 0xca, 0xa8, 0xf0},
285 .data5 = /* this could be removed later */ 330 .data5 = /* this could be removed later */
@@ -287,13 +332,23 @@ static const struct additional_sensor_data sensor_data[] = {
287 .stream = 332 .stream =
288 {0x0b, 0x04, 0x0a, 0x78}, 333 {0x0b, 0x04, 0x0a, 0x78},
289 }, 334 },
290 { /* OTHER */ 335 { /* 1: OTHER */
336 .n3 =
337 {0x61, 0xc2, 0x65, 0x88, 0x60, 0x00},
338 .n4 = n4_other,
339 .n4sz = sizeof n4_other,
340 .reg80 = 0xac,
341 .reg8e = 0xb8,
342 .nset8 = {0xa8, 0xa8, 0xc6, 0xda, 0xc0, 0x00},
291 .data1 = 343 .data1 =
292 {0xc1, 0x48, 0x04, 0x1b, 0xca, 0x2e, 0x33, 0x3a, 344 {0xc1, 0x48, 0x04, 0x1b, 0xca, 0x2e, 0x33, 0x3a,
293 0xe8, 0xfc}, 345 0xe8, 0xfc},
294 .data2 = 346 .data2 =
295 {0x4e, 0x9c, 0xec, 0x40, 0x80, 0xc0, 0x48, 0x96, 347 {0x4e, 0x9c, 0xec, 0x40, 0x80, 0xc0, 0x48, 0x96,
296 0xd9}, 348 0xd9},
349 .data3 =
350 {0x4e, 0x9c, 0xec, 0x40, 0x80, 0xc0, 0x48, 0x96,
351 0xd9},
297 .data4 = 352 .data4 =
298 {0x66, 0x00, 0xa8, 0xa8}, 353 {0x66, 0x00, 0xa8, 0xa8},
299 .data5 = 354 .data5 =
@@ -301,13 +356,23 @@ static const struct additional_sensor_data sensor_data[] = {
301 .stream = 356 .stream =
302 {0x0b, 0x04, 0x0a, 0x00}, 357 {0x0b, 0x04, 0x0a, 0x00},
303 }, 358 },
304 { /* TAS5130A */ 359 { /* 2: TAS5130A */
360 .n3 =
361 {0x61, 0xc2, 0x65, 0x0d, 0x60, 0x08},
362 .n4 = n4_tas5130a,
363 .n4sz = sizeof n4_tas5130a,
364 .reg80 = 0x3c,
365 .reg8e = 0xb4,
366 .nset8 = {0xa8, 0xf0, 0xc6, 0xda, 0xc0, 0x00},
305 .data1 = 367 .data1 =
306 {0xbb, 0x28, 0x10, 0x10, 0xbb, 0x28, 0x1e, 0x27, 368 {0xbb, 0x28, 0x10, 0x10, 0xbb, 0x28, 0x1e, 0x27,
307 0xc8, 0xfc}, 369 0xc8, 0xfc},
308 .data2 = 370 .data2 =
309 {0x60, 0xa8, 0xe0, 0x60, 0xa8, 0xe0, 0x60, 0xa8, 371 {0x60, 0xa8, 0xe0, 0x60, 0xa8, 0xe0, 0x60, 0xa8,
310 0xe0}, 372 0xe0},
373 .data3 =
374 {0x60, 0xa8, 0xe0, 0x60, 0xa8, 0xe0, 0x60, 0xa8,
375 0xe0},
311 .data4 = /* Freq (50/60Hz). Splitted for test purpose */ 376 .data4 = /* Freq (50/60Hz). Splitted for test purpose */
312 {0x66, 0x00, 0xa8, 0xe8}, 377 {0x66, 0x00, 0xa8, 0xe8},
313 .data5 = 378 .data5 =
@@ -364,7 +429,7 @@ static const u8 gamma_table[GAMMA_MAX][17] = {
364 {0x00, 0x18, 0x2b, 0x44, 0x60, 0x70, 0x80, 0x8e, /* 10 */ 429 {0x00, 0x18, 0x2b, 0x44, 0x60, 0x70, 0x80, 0x8e, /* 10 */
365 0x9c, 0xaa, 0xb7, 0xc4, 0xd0, 0xd8, 0xe2, 0xf0, 430 0x9c, 0xaa, 0xb7, 0xc4, 0xd0, 0xd8, 0xe2, 0xf0,
366 0xff}, 431 0xff},
367 {0x00, 0x1a, 0x34, 0x52, 0x66, 0x7e, 0x8D, 0x9B, /* 11 */ 432 {0x00, 0x1a, 0x34, 0x52, 0x66, 0x7e, 0x8d, 0x9b, /* 11 */
368 0xa8, 0xb4, 0xc0, 0xcb, 0xd6, 0xe1, 0xeb, 0xf5, 433 0xa8, 0xb4, 0xc0, 0xcb, 0xd6, 0xe1, 0xeb, 0xf5,
369 0xff}, 434 0xff},
370 {0x00, 0x3f, 0x5a, 0x6e, 0x7f, 0x8e, 0x9c, 0xa8, /* 12 */ 435 {0x00, 0x3f, 0x5a, 0x6e, 0x7f, 0x8e, 0x9c, 0xa8, /* 12 */
@@ -385,8 +450,6 @@ static const u8 tas5130a_sensor_init[][8] = {
385 {0x62, 0x08, 0x63, 0x70, 0x64, 0x1d, 0x60, 0x09}, 450 {0x62, 0x08, 0x63, 0x70, 0x64, 0x1d, 0x60, 0x09},
386 {0x62, 0x20, 0x63, 0x01, 0x64, 0x02, 0x60, 0x09}, 451 {0x62, 0x20, 0x63, 0x01, 0x64, 0x02, 0x60, 0x09},
387 {0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09}, 452 {0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09},
388 {0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09},
389 {},
390}; 453};
391 454
392static u8 sensor_reset[] = {0x61, 0x68, 0x62, 0xff, 0x60, 0x07}; 455static u8 sensor_reset[] = {0x61, 0x68, 0x62, 0xff, 0x60, 0x07};
@@ -633,10 +696,10 @@ static int sd_init(struct gspca_dev *gspca_dev)
633 * but wont hurt anyway, and can help someone with similar webcam 696 * but wont hurt anyway, and can help someone with similar webcam
634 * to see the initial parameters.*/ 697 * to see the initial parameters.*/
635 struct sd *sd = (struct sd *) gspca_dev; 698 struct sd *sd = (struct sd *) gspca_dev;
699 const struct additional_sensor_data *sensor;
636 int i; 700 int i;
637 u16 sensor_id; 701 u16 sensor_id;
638 u8 test_byte = 0; 702 u8 test_byte = 0;
639 u16 reg80, reg8e;
640 703
641 static const u8 read_indexs[] = 704 static const u8 read_indexs[] =
642 { 0x0a, 0x0b, 0x66, 0x80, 0x81, 0x8e, 0x8f, 0xa5, 705 { 0x0a, 0x0b, 0x66, 0x80, 0x81, 0x8e, 0x8f, 0xa5,
@@ -645,37 +708,6 @@ static int sd_init(struct gspca_dev *gspca_dev)
645 {0x08, 0x03, 0x09, 0x03, 0x12, 0x04}; 708 {0x08, 0x03, 0x09, 0x03, 0x12, 0x04};
646 static const u8 n2[] = 709 static const u8 n2[] =
647 {0x08, 0x00}; 710 {0x08, 0x00};
648 static const u8 n3[6] =
649 {0x61, 0x68, 0x65, 0x0a, 0x60, 0x04};
650 static const u8 n3_other[6] =
651 {0x61, 0xc2, 0x65, 0x88, 0x60, 0x00};
652 static const u8 n4[] =
653 {0x09, 0x01, 0x12, 0x04, 0x66, 0x8a, 0x80, 0x3c,
654 0x81, 0x22, 0x84, 0x50, 0x8a, 0x78, 0x8b, 0x68,
655 0x8c, 0x88, 0x8e, 0x33, 0x8f, 0x24, 0xaa, 0xb1,
656 0xa2, 0x60, 0xa5, 0x30, 0xa6, 0x3a, 0xa8, 0xe8,
657 0xae, 0x05, 0xb1, 0x00, 0xbb, 0x04, 0xbc, 0x48,
658 0xbe, 0x36, 0xc6, 0x88, 0xe9, 0x00, 0xc5, 0xc0,
659 0x65, 0x0a, 0xbb, 0x86, 0xaf, 0x58, 0xb0, 0x68,
660 0x87, 0x40, 0x89, 0x2b, 0x8d, 0xff, 0x83, 0x40,
661 0xac, 0x84, 0xad, 0x86, 0xaf, 0x46};
662 static const u8 n4_other[] =
663 {0x66, 0x00, 0x7f, 0x00, 0x80, 0xac, 0x81, 0x69,
664 0x84, 0x40, 0x85, 0x70, 0x86, 0x20, 0x8a, 0x68,
665 0x8b, 0x58, 0x8c, 0x88, 0x8d, 0xff, 0x8e, 0xb8,
666 0x8f, 0x28, 0xa2, 0x60, 0xa5, 0x40, 0xa8, 0xa8,
667 0xac, 0x84, 0xad, 0x84, 0xae, 0x24, 0xaf, 0x56,
668 0xb0, 0x68, 0xb1, 0x00, 0xb2, 0x88, 0xbb, 0xc5,
669 0xbc, 0x4a, 0xbe, 0x36, 0xc2, 0x88, 0xc5, 0xc0,
670 0xc6, 0xda, 0xe9, 0x26, 0xeb, 0x00};
671 static const u8 nset8[6] =
672 { 0xa8, 0xf0, 0xc6, 0x88, 0xc0, 0x00 };
673 static const u8 nset8_other[6] =
674 { 0xa8, 0xa8, 0xc6, 0xda, 0xc0, 0x00 };
675 static const u8 nset9[4] =
676 { 0x0b, 0x04, 0x0a, 0x78 };
677 static const u8 nset9_other[4] =
678 { 0x0b, 0x04, 0x0a, 0x00 };
679 711
680 sensor_id = (reg_r(gspca_dev, 0x06) << 8) 712 sensor_id = (reg_r(gspca_dev, 0x06) << 8)
681 | reg_r(gspca_dev, 0x07); 713 | reg_r(gspca_dev, 0x07);
@@ -709,8 +741,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
709 } 741 }
710 if (i < 0) { 742 if (i < 0) {
711 err("Bad sensor reset %02x", test_byte); 743 err("Bad sensor reset %02x", test_byte);
712/* return -EIO; */ 744 return -EIO;
713/*fixme: test - continue */
714 } 745 }
715 reg_w_buf(gspca_dev, n2, sizeof n2); 746 reg_w_buf(gspca_dev, n2, sizeof n2);
716 } 747 }
@@ -723,31 +754,17 @@ static int sd_init(struct gspca_dev *gspca_dev)
723 i++; 754 i++;
724 } 755 }
725 756
726 if (sd->sensor != SENSOR_OTHER) { 757 sensor = &sensor_data[sd->sensor];
727 reg_w_buf(gspca_dev, n3, sizeof n3); 758 reg_w_buf(gspca_dev, sensor->n3, sizeof sensor->n3);
728 reg_w_buf(gspca_dev, n4, sizeof n4); 759 reg_w_buf(gspca_dev, sensor->n4, sensor->n4sz);
729 reg_r(gspca_dev, 0x0080);
730 reg_w(gspca_dev, 0x2c80);
731 reg80 = 0x3880;
732 reg8e = 0x338e;
733 } else {
734 reg_w_buf(gspca_dev, n3_other, sizeof n3_other);
735 reg_w_buf(gspca_dev, n4_other, sizeof n4_other);
736 sd->gamma = 5;
737 reg80 = 0xac80;
738 reg8e = 0xb88e;
739 }
740 760
741 reg_w_ixbuf(gspca_dev, 0xd0, sensor_data[sd->sensor].data1, 761 reg_w_ixbuf(gspca_dev, 0xd0, sensor->data1, sizeof sensor->data1);
742 sizeof sensor_data[sd->sensor].data1); 762 reg_w_ixbuf(gspca_dev, 0xc7, sensor->data2, sizeof sensor->data2);
743 reg_w_ixbuf(gspca_dev, 0xc7, sensor_data[sd->sensor].data2, 763 reg_w_ixbuf(gspca_dev, 0xe0, sensor->data3, sizeof sensor->data3);
744 sizeof sensor_data[sd->sensor].data2);
745 reg_w_ixbuf(gspca_dev, 0xe0, sensor_data[sd->sensor].data2,
746 sizeof sensor_data[sd->sensor].data2);
747 764
748 reg_w(gspca_dev, reg80); 765 reg_w(gspca_dev, (sensor->reg80 << 8) + 0x80);
749 reg_w(gspca_dev, reg80); 766 reg_w(gspca_dev, (sensor->reg80 << 8) + 0x80);
750 reg_w(gspca_dev, reg8e); 767 reg_w(gspca_dev, (sensor->reg8e << 8) + 0x8e);
751 768
752 setbrightness(gspca_dev); 769 setbrightness(gspca_dev);
753 setcontrast(gspca_dev); 770 setcontrast(gspca_dev);
@@ -760,25 +777,14 @@ static int sd_init(struct gspca_dev *gspca_dev)
760 reg_w(gspca_dev, 0x2088); 777 reg_w(gspca_dev, 0x2088);
761 reg_w(gspca_dev, 0x2089); 778 reg_w(gspca_dev, 0x2089);
762 779
763 reg_w_buf(gspca_dev, sensor_data[sd->sensor].data4, 780 reg_w_buf(gspca_dev, sensor->data4, sizeof sensor->data4);
764 sizeof sensor_data[sd->sensor].data4); 781 reg_w_buf(gspca_dev, sensor->data5, sizeof sensor->data5);
765 reg_w_buf(gspca_dev, sensor_data[sd->sensor].data5, 782 reg_w_buf(gspca_dev, sensor->nset8, sizeof sensor->nset8);
766 sizeof sensor_data[sd->sensor].data5); 783 reg_w_buf(gspca_dev, sensor->stream, sizeof sensor->stream);
767 if (sd->sensor != SENSOR_OTHER) {
768 reg_w_buf(gspca_dev, nset8, sizeof nset8);
769 reg_w_buf(gspca_dev, nset9, sizeof nset9);
770 reg_w(gspca_dev, 0x2880);
771 } else {
772 reg_w_buf(gspca_dev, nset8_other, sizeof nset8_other);
773 reg_w_buf(gspca_dev, nset9_other, sizeof nset9_other);
774 }
775 784
776 reg_w_ixbuf(gspca_dev, 0xd0, sensor_data[sd->sensor].data1, 785 reg_w_ixbuf(gspca_dev, 0xd0, sensor->data1, sizeof sensor->data1);
777 sizeof sensor_data[sd->sensor].data1); 786 reg_w_ixbuf(gspca_dev, 0xc7, sensor->data2, sizeof sensor->data2);
778 reg_w_ixbuf(gspca_dev, 0xc7, sensor_data[sd->sensor].data2, 787 reg_w_ixbuf(gspca_dev, 0xe0, sensor->data3, sizeof sensor->data3);
779 sizeof sensor_data[sd->sensor].data2);
780 reg_w_ixbuf(gspca_dev, 0xe0, sensor_data[sd->sensor].data2,
781 sizeof sensor_data[sd->sensor].data2);
782 788
783 return 0; 789 return 0;
784} 790}
@@ -828,7 +834,6 @@ static void setlightfreq(struct gspca_dev *gspca_dev)
828 * i added some module parameters for test with some users */ 834 * i added some module parameters for test with some users */
829static void poll_sensor(struct gspca_dev *gspca_dev) 835static void poll_sensor(struct gspca_dev *gspca_dev)
830{ 836{
831 struct sd *sd = (struct sd *) gspca_dev;
832 static const u8 poll1[] = 837 static const u8 poll1[] =
833 {0x67, 0x05, 0x68, 0x81, 0x69, 0x80, 0x6a, 0x82, 838 {0x67, 0x05, 0x68, 0x81, 0x69, 0x80, 0x6a, 0x82,
834 0x6b, 0x68, 0x6c, 0x69, 0x72, 0xd9, 0x73, 0x34, 839 0x6b, 0x68, 0x6c, 0x69, 0x72, 0xd9, 0x73, 0x34,
@@ -844,24 +849,23 @@ static void poll_sensor(struct gspca_dev *gspca_dev)
844 0xa1, 0xb1, 0xda, 0x6b, 0xdb, 0x98, 0xdf, 0x0c, 849 0xa1, 0xb1, 0xda, 0x6b, 0xdb, 0x98, 0xdf, 0x0c,
845 0xc2, 0x80, 0xc3, 0x10}; 850 0xc2, 0x80, 0xc3, 0x10};
846 851
847 if (sd->sensor == SENSOR_OM6802) { 852 PDEBUG(D_STREAM, "[Sensor requires polling]");
848 PDEBUG(D_STREAM, "[Sensor requires polling]"); 853 reg_w_buf(gspca_dev, poll1, sizeof poll1);
849 reg_w_buf(gspca_dev, poll1, sizeof poll1); 854 reg_w_buf(gspca_dev, poll2, sizeof poll2);
850 reg_w_buf(gspca_dev, poll2, sizeof poll2); 855 reg_w_buf(gspca_dev, poll3, sizeof poll3);
851 reg_w_buf(gspca_dev, poll3, sizeof poll3); 856 reg_w_buf(gspca_dev, poll4, sizeof poll4);
852 reg_w_buf(gspca_dev, poll4, sizeof poll4);
853 }
854} 857}
855 858
856static int sd_start(struct gspca_dev *gspca_dev) 859static int sd_start(struct gspca_dev *gspca_dev)
857{ 860{
858 struct sd *sd = (struct sd *) gspca_dev; 861 struct sd *sd = (struct sd *) gspca_dev;
862 const struct additional_sensor_data *sensor;
859 int i, mode; 863 int i, mode;
860 u8 t2[] = { 0x07, 0x00, 0x0d, 0x60, 0x0e, 0x80 }; 864 u8 t2[] = { 0x07, 0x00, 0x0d, 0x60, 0x0e, 0x80 };
861 static const u8 t3[] = 865 static const u8 t3[] =
862 { 0x07, 0x00, 0x88, 0x02, 0x06, 0x00, 0xe7, 0x01 }; 866 { 0x07, 0x00, 0x88, 0x02, 0x06, 0x00, 0xe7, 0x01 };
863 867
864 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode]. priv; 868 mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
865 switch (mode) { 869 switch (mode) {
866 case 0: /* 640x480 (0x00) */ 870 case 0: /* 640x480 (0x00) */
867 break; 871 break;
@@ -889,34 +893,33 @@ static int sd_start(struct gspca_dev *gspca_dev)
889 default: 893 default:
890/* case SENSOR_TAS5130A: */ 894/* case SENSOR_TAS5130A: */
891 i = 0; 895 i = 0;
892 while (tas5130a_sensor_init[i][0] != 0) { 896 for (;;) {
893 reg_w_buf(gspca_dev, tas5130a_sensor_init[i], 897 reg_w_buf(gspca_dev, tas5130a_sensor_init[i],
894 sizeof tas5130a_sensor_init[0]); 898 sizeof tas5130a_sensor_init[0]);
899 if (i >= ARRAY_SIZE(tas5130a_sensor_init) - 1)
900 break;
895 i++; 901 i++;
896 } 902 }
897 reg_w(gspca_dev, 0x3c80); 903 reg_w(gspca_dev, 0x3c80);
898 /* just in case and to keep sync with logs (for mine) */ 904 /* just in case and to keep sync with logs (for mine) */
899 reg_w_buf(gspca_dev, tas5130a_sensor_init[3], 905 reg_w_buf(gspca_dev, tas5130a_sensor_init[i],
900 sizeof tas5130a_sensor_init[0]); 906 sizeof tas5130a_sensor_init[0]);
901 reg_w(gspca_dev, 0x3c80); 907 reg_w(gspca_dev, 0x3c80);
902 break; 908 break;
903 } 909 }
904 reg_w_buf(gspca_dev, sensor_data[sd->sensor].data4, 910 sensor = &sensor_data[sd->sensor];
905 sizeof sensor_data[sd->sensor].data4); 911 reg_w_buf(gspca_dev, sensor->data4, sizeof sensor->data4);
906 reg_r(gspca_dev, 0x0012); 912 reg_r(gspca_dev, 0x0012);
907 reg_w_buf(gspca_dev, t2, sizeof t2); 913 reg_w_buf(gspca_dev, t2, sizeof t2);
908 reg_w_ixbuf(gspca_dev, 0xb3, t3, sizeof t3); 914 reg_w_ixbuf(gspca_dev, 0xb3, t3, sizeof t3);
909 reg_w(gspca_dev, 0x0013); 915 reg_w(gspca_dev, 0x0013);
910 msleep(15); 916 msleep(15);
911 reg_w_buf(gspca_dev, sensor_data[sd->sensor].stream, 917 reg_w_buf(gspca_dev, sensor->stream, sizeof sensor->stream);
912 sizeof sensor_data[sd->sensor].stream); 918 reg_w_buf(gspca_dev, sensor->stream, sizeof sensor->stream);
913 poll_sensor(gspca_dev); 919
920 if (sd->sensor == SENSOR_OM6802)
921 poll_sensor(gspca_dev);
914 922
915 /* restart on each start, just in case, sometimes regs goes wrong
916 * when using controls from app */
917 setbrightness(gspca_dev);
918 setcontrast(gspca_dev);
919 setcolors(gspca_dev);
920 return 0; 923 return 0;
921} 924}
922 925
@@ -926,10 +929,9 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
926 929
927 reg_w_buf(gspca_dev, sensor_data[sd->sensor].stream, 930 reg_w_buf(gspca_dev, sensor_data[sd->sensor].stream,
928 sizeof sensor_data[sd->sensor].stream); 931 sizeof sensor_data[sd->sensor].stream);
929 msleep(20);
930 reg_w_buf(gspca_dev, sensor_data[sd->sensor].stream, 932 reg_w_buf(gspca_dev, sensor_data[sd->sensor].stream,
931 sizeof sensor_data[sd->sensor].stream); 933 sizeof sensor_data[sd->sensor].stream);
932 if (sd->sensor != SENSOR_OTHER) { 934 if (sd->sensor == SENSOR_OM6802) {
933 msleep(20); 935 msleep(20);
934 reg_w(gspca_dev, 0x0309); 936 reg_w(gspca_dev, 0x0309);
935 } 937 }