aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-09-03 15:48:02 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-09-03 17:36:50 -0400
commit4a18625e88efef2b5a21695edcb2b21d98fdf71b (patch)
tree1088ca3a26c755c5be70b4db3e8d52ec39d7d9bf /drivers/media/video/gspca
parentd55b83d3c4558d0d118bf20ef3f1fa65b1c75c3d (diff)
V4L/DVB (8711): gspca: Bad controls and quantization table of pac7311.
Patch adapted from a gspca v1 patch by Thomas Kaiser. 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')
-rw-r--r--drivers/media/video/gspca/pac7311.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c
index a89cc9fd1531..e4f56e0d3ff3 100644
--- a/drivers/media/video/gspca/pac7311.c
+++ b/drivers/media/video/gspca/pac7311.c
@@ -42,6 +42,7 @@ struct sd {
42 unsigned char autogain; 42 unsigned char autogain;
43 __u8 hflip; 43 __u8 hflip;
44 __u8 vflip; 44 __u8 vflip;
45 __u8 qindex;
45 46
46 char tosof; /* number of bytes before next start of frame */ 47 char tosof; /* number of bytes before next start of frame */
47 signed char ag_cnt; 48 signed char ag_cnt;
@@ -462,6 +463,9 @@ static int sd_config(struct gspca_dev *gspca_dev,
462 sd->contrast = CONTRAST_DEF; 463 sd->contrast = CONTRAST_DEF;
463 sd->colors = COLOR_DEF; 464 sd->colors = COLOR_DEF;
464 sd->autogain = AUTOGAIN_DEF; 465 sd->autogain = AUTOGAIN_DEF;
466 sd->hflip = HFLIP_DEF;
467 sd->vflip = VFLIP_DEF;
468 sd->qindex = 3;
465 sd->ag_cnt = -1; 469 sd->ag_cnt = -1;
466 return 0; 470 return 0;
467} 471}
@@ -505,6 +509,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
505/*jfm: inverted?*/ 509/*jfm: inverted?*/
506 brightness = BRIGHTNESS_MAX - sd->brightness; 510 brightness = BRIGHTNESS_MAX - sd->brightness;
507 reg_w(gspca_dev, 0xff, 0x04); 511 reg_w(gspca_dev, 0xff, 0x04);
512 reg_w(gspca_dev, 0x0e, 0x00);
508 reg_w(gspca_dev, 0x0f, brightness); 513 reg_w(gspca_dev, 0x0f, brightness);
509 /* load registers to sensor (Bit 0, auto clear) */ 514 /* load registers to sensor (Bit 0, auto clear) */
510 reg_w(gspca_dev, 0x11, 0x01); 515 reg_w(gspca_dev, 0x11, 0x01);
@@ -520,7 +525,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
520 return; 525 return;
521 } 526 }
522 reg_w(gspca_dev, 0xff, 0x01); 527 reg_w(gspca_dev, 0xff, 0x01);
523 reg_w(gspca_dev, 0x80, sd->contrast); 528 reg_w(gspca_dev, 0x10, sd->contrast);
524 /* load registers to sensor (Bit 0, auto clear) */ 529 /* load registers to sensor (Bit 0, auto clear) */
525 reg_w(gspca_dev, 0x11, 0x01); 530 reg_w(gspca_dev, 0x11, 0x01);
526} 531}
@@ -549,7 +554,7 @@ static void setcolors(struct gspca_dev *gspca_dev)
549 return; 554 return;
550 } 555 }
551 reg_w(gspca_dev, 0xff, 0x01); 556 reg_w(gspca_dev, 0xff, 0x01);
552 reg_w(gspca_dev, 0x10, sd->colors); 557 reg_w(gspca_dev, 0x80, sd->colors);
553 /* load registers to sensor (Bit 0, auto clear) */ 558 /* load registers to sensor (Bit 0, auto clear) */
554 reg_w(gspca_dev, 0x11, 0x01); 559 reg_w(gspca_dev, 0x11, 0x01);
555 PDEBUG(D_CONF|D_STREAM, "color: %i", sd->colors); 560 PDEBUG(D_CONF|D_STREAM, "color: %i", sd->colors);
@@ -583,7 +588,7 @@ static void sethvflip(struct gspca_dev *gspca_dev)
583/* this function is called at open time */ 588/* this function is called at open time */
584static int sd_open(struct gspca_dev *gspca_dev) 589static int sd_open(struct gspca_dev *gspca_dev)
585{ 590{
586 reg_w(gspca_dev, 0x78, 0x00); /* Turn on LED */ 591 reg_w(gspca_dev, 0x78, 0x44); /* Turn on LED */
587 return 0; 592 return 0;
588} 593}
589 594
@@ -612,27 +617,24 @@ static void sd_start(struct gspca_dev *gspca_dev)
612 reg_w(gspca_dev, 0x08, 0x09); 617 reg_w(gspca_dev, 0x08, 0x09);
613 reg_w(gspca_dev, 0x17, 0x20); 618 reg_w(gspca_dev, 0x17, 0x20);
614 reg_w(gspca_dev, 0x1b, 0x00); 619 reg_w(gspca_dev, 0x1b, 0x00);
615/* reg_w(gspca_dev, 0x80, 0x69); */
616 reg_w(gspca_dev, 0x87, 0x10); 620 reg_w(gspca_dev, 0x87, 0x10);
617 break; 621 break;
618 case 1: /* 320x240 pac7311 */ 622 case 1: /* 320x240 pac7311 */
619 reg_w(gspca_dev, 0xff, 0x04); 623 reg_w(gspca_dev, 0xff, 0x04);
620 reg_w(gspca_dev, 0x02, 0x03); 624 reg_w(gspca_dev, 0x02, 0x07);
621 reg_w(gspca_dev, 0xff, 0x01); 625 reg_w(gspca_dev, 0xff, 0x01);
622 reg_w(gspca_dev, 0x08, 0x09); 626 reg_w(gspca_dev, 0x08, 0x09);
623 reg_w(gspca_dev, 0x17, 0x30); 627 reg_w(gspca_dev, 0x17, 0x30);
624/* reg_w(gspca_dev, 0x80, 0x3f); */
625 reg_w(gspca_dev, 0x87, 0x11); 628 reg_w(gspca_dev, 0x87, 0x11);
626 break; 629 break;
627 case 0: /* 640x480 */ 630 case 0: /* 640x480 */
628 if (sd->sensor == SENSOR_PAC7302) 631 if (sd->sensor == SENSOR_PAC7302)
629 break; 632 break;
630 reg_w(gspca_dev, 0xff, 0x04); 633 reg_w(gspca_dev, 0xff, 0x04);
631 reg_w(gspca_dev, 0x02, 0x03); 634 reg_w(gspca_dev, 0x02, 0x07);
632 reg_w(gspca_dev, 0xff, 0x01); 635 reg_w(gspca_dev, 0xff, 0x01);
633 reg_w(gspca_dev, 0x08, 0x08); 636 reg_w(gspca_dev, 0x08, 0x08);
634 reg_w(gspca_dev, 0x17, 0x00); 637 reg_w(gspca_dev, 0x17, 0x00);
635/* reg_w(gspca_dev, 0x80, 0x1c); */
636 reg_w(gspca_dev, 0x87, 0x12); 638 reg_w(gspca_dev, 0x87, 0x12);
637 break; 639 break;
638 } 640 }
@@ -645,8 +647,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
645 reg_w(gspca_dev, 0xff, 0x01); 647 reg_w(gspca_dev, 0xff, 0x01);
646 reg_w(gspca_dev, 0x78, 0x01); 648 reg_w(gspca_dev, 0x78, 0x01);
647 } else { 649 } else {
648 reg_w(gspca_dev, 0x78, 0x04); 650 reg_w(gspca_dev, 0x78, 0x44);
649 reg_w(gspca_dev, 0x78, 0x05); 651 reg_w(gspca_dev, 0x78, 0x45);
650 } 652 }
651} 653}
652 654
@@ -666,7 +668,7 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
666 reg_w(gspca_dev, 0x2a, 0x0e); 668 reg_w(gspca_dev, 0x2a, 0x0e);
667 reg_w(gspca_dev, 0xff, 0x01); 669 reg_w(gspca_dev, 0xff, 0x01);
668 reg_w(gspca_dev, 0x3e, 0x20); 670 reg_w(gspca_dev, 0x3e, 0x20);
669 reg_w(gspca_dev, 0x78, 0x04); /* Bit_0=start stream, Bit_7=LED */ 671 reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */
670 reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ 672 reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */
671 reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ 673 reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */
672} 674}
@@ -757,7 +759,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
757 if (sd->tosof > LUM_OFFSET) 759 if (sd->tosof > LUM_OFFSET)
758 sd->lum_sum += data[-LUM_OFFSET]; 760 sd->lum_sum += data[-LUM_OFFSET];
759 sd->tosof = 0; 761 sd->tosof = 0;
760 jpeg_put_header(gspca_dev, frame, 1, 0x21); 762 jpeg_put_header(gspca_dev, frame, sd->qindex, 0x21);
761 } 763 }
762 764
763 for (i = 0; i < len; i++) { 765 for (i = 0; i < len; i++) {
@@ -777,7 +779,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
777 sd->tosof = -len; 779 sd->tosof = -len;
778 break; 780 break;
779 } 781 }
780 jpeg_put_header(gspca_dev, frame, 1, 0x21); 782 jpeg_put_header(gspca_dev, frame, sd->qindex, 0x21);
781 break; 783 break;
782 } 784 }
783 } 785 }