aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-10-17 04:19:46 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-17 16:41:09 -0400
commit35480b6bc3884a1c2f9928c45c67dbfe85e1de75 (patch)
tree667457229109ebcd4198df2818fab9fc5cce918d /drivers/media
parentcbc51c6d6e553f799a100eb58d4fbd7617d5becd (diff)
V4L/DVB (9292): gspca: Call the control setting functions at init time in t613.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/gspca/t613.c142
1 files changed, 70 insertions, 72 deletions
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c
index 6c7eedc481a9..3ffbf37e946d 100644
--- a/drivers/media/video/gspca/t613.c
+++ b/drivers/media/video/gspca/t613.c
@@ -502,6 +502,46 @@ static int sd_config(struct gspca_dev *gspca_dev,
502 return 0; 502 return 0;
503} 503}
504 504
505static void setbrightness(struct gspca_dev *gspca_dev)
506{
507 struct sd *sd = (struct sd *) gspca_dev;
508 unsigned int brightness;
509 __u8 set6[4] = { 0x8f, 0x24, 0xc3, 0x00 };
510
511 brightness = sd->brightness;
512 if (brightness < 7) {
513 set6[1] = 0x26;
514 set6[3] = 0x70 - brightness * 0x10;
515 } else {
516 set6[3] = 0x00 + ((brightness - 7) * 0x10);
517 }
518
519 reg_w_buf(gspca_dev, set6, sizeof set6);
520}
521
522static void setcontrast(struct gspca_dev *gspca_dev)
523{
524 struct sd *sd = (struct sd *) gspca_dev;
525 unsigned int contrast = sd->contrast;
526 __u16 reg_to_write;
527
528 if (contrast < 7)
529 reg_to_write = 0x8ea9 - contrast * 0x200;
530 else
531 reg_to_write = 0x00a9 + (contrast - 7) * 0x200;
532
533 reg_w(gspca_dev, reg_to_write);
534}
535
536static void setcolors(struct gspca_dev *gspca_dev)
537{
538 struct sd *sd = (struct sd *) gspca_dev;
539 __u16 reg_to_write;
540
541 reg_to_write = 0x80bb + sd->colors * 0x100; /* was 0xc0 */
542 reg_w(gspca_dev, reg_to_write);
543}
544
505static void setgamma(struct gspca_dev *gspca_dev) 545static void setgamma(struct gspca_dev *gspca_dev)
506{ 546{
507 struct sd *sd = (struct sd *) gspca_dev; 547 struct sd *sd = (struct sd *) gspca_dev;
@@ -510,6 +550,29 @@ static void setgamma(struct gspca_dev *gspca_dev)
510 reg_w_buf(gspca_dev, gamma_table[sd->gamma], sizeof gamma_table[0]); 550 reg_w_buf(gspca_dev, gamma_table[sd->gamma], sizeof gamma_table[0]);
511} 551}
512 552
553static void setwhitebalance(struct gspca_dev *gspca_dev)
554{
555 struct sd *sd = (struct sd *) gspca_dev;
556
557 __u8 white_balance[8] =
558 {0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38};
559
560 if (sd->whitebalance)
561 white_balance[7] = 0x3c;
562
563 reg_w_buf(gspca_dev, white_balance, sizeof white_balance);
564}
565
566static void setsharpness(struct gspca_dev *gspca_dev)
567{
568 struct sd *sd = (struct sd *) gspca_dev;
569 __u16 reg_to_write;
570
571 reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness;
572
573 reg_w(gspca_dev, reg_to_write);
574}
575
513/* this function is called at probe and resume time */ 576/* this function is called at probe and resume time */
514static int sd_init(struct gspca_dev *gspca_dev) 577static int sd_init(struct gspca_dev *gspca_dev)
515{ 578{
@@ -551,8 +614,6 @@ static int sd_init(struct gspca_dev *gspca_dev)
551 0xd5, 0x28, 0xd6, 0x1e, 0xd7, 0x27, 614 0xd5, 0x28, 0xd6, 0x1e, 0xd7, 0x27,
552 0xd8, 0xc8, 0xd9, 0xfc 615 0xd8, 0xc8, 0xd9, 0xfc
553 }; 616 };
554 static const __u8 missing[] =
555 { 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 };
556 static const __u8 nset3[] = { 617 static const __u8 nset3[] = {
557 0xc7, 0x60, 0xc8, 0xa8, 0xc9, 0xe0, 0xca, 0x60, 0xcb, 0xa8, 618 0xc7, 0x60, 0xc8, 0xa8, 0xc9, 0xe0, 0xca, 0x60, 0xcb, 0xa8,
558 0xcc, 0xe0, 0xcd, 0x60, 0xce, 0xa8, 619 0xcc, 0xe0, 0xcd, 0x60, 0xce, 0xa8,
@@ -617,15 +678,15 @@ static int sd_init(struct gspca_dev *gspca_dev)
617 reg_w(gspca_dev, 0x3880); 678 reg_w(gspca_dev, 0x3880);
618 reg_w(gspca_dev, 0x3880); 679 reg_w(gspca_dev, 0x3880);
619 reg_w(gspca_dev, 0x338e); 680 reg_w(gspca_dev, 0x338e);
620 reg_w_buf(gspca_dev, nset5, sizeof nset5); 681nset5 - missing
621 reg_w(gspca_dev, 0x00a9); 682 setbrightness(gspca_dev);
683 setcontrast(gspca_dev);
622 setgamma(gspca_dev); 684 setgamma(gspca_dev);
623 reg_w(gspca_dev, 0x86bb); 685 setcolors(gspca_dev);
624 reg_w(gspca_dev, 0x4aa6); 686 setsharpness(gspca_dev);
625 687 setwhitebalance(gspca_dev);
626 reg_w_buf(gspca_dev, missing, sizeof missing);
627 688
628 reg_w(gspca_dev, 0x2087); 689 reg_w(gspca_dev, 0x2087); /* tied to white balance? */
629 reg_w(gspca_dev, 0x2088); 690 reg_w(gspca_dev, 0x2088);
630 reg_w(gspca_dev, 0x2089); 691 reg_w(gspca_dev, 0x2089);
631 692
@@ -642,23 +703,6 @@ static int sd_init(struct gspca_dev *gspca_dev)
642 return 0; 703 return 0;
643} 704}
644 705
645static void setbrightness(struct gspca_dev *gspca_dev)
646{
647 struct sd *sd = (struct sd *) gspca_dev;
648 unsigned int brightness;
649 __u8 set6[4] = { 0x8f, 0x26, 0xc3, 0x00 };
650
651 brightness = sd->brightness;
652 if (brightness < 7) {
653 set6[3] = 0x70 - brightness * 0x10;
654 } else {
655 set6[1] = 0x24;
656 set6[3] = 0x00 + ((brightness - 7) * 0x10);
657 }
658
659 reg_w_buf(gspca_dev, set6, sizeof set6);
660}
661
662static void setflip(struct gspca_dev *gspca_dev) 706static void setflip(struct gspca_dev *gspca_dev)
663{ 707{
664 struct sd *sd = (struct sd *) gspca_dev; 708 struct sd *sd = (struct sd *) gspca_dev;
@@ -689,19 +733,6 @@ static void seteffect(struct gspca_dev *gspca_dev)
689 reg_w(gspca_dev, 0xfaa6); 733 reg_w(gspca_dev, 0xfaa6);
690} 734}
691 735
692static void setwhitebalance(struct gspca_dev *gspca_dev)
693{
694 struct sd *sd = (struct sd *) gspca_dev;
695
696 __u8 white_balance[8] =
697 { 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 };
698
699 if (sd->whitebalance == 1)
700 white_balance[7] = 0x3c;
701
702 reg_w_buf(gspca_dev, white_balance, sizeof white_balance);
703}
704
705static void setlightfreq(struct gspca_dev *gspca_dev) 736static void setlightfreq(struct gspca_dev *gspca_dev)
706{ 737{
707 struct sd *sd = (struct sd *) gspca_dev; 738 struct sd *sd = (struct sd *) gspca_dev;
@@ -713,39 +744,6 @@ static void setlightfreq(struct gspca_dev *gspca_dev)
713 reg_w_buf(gspca_dev, freq, sizeof freq); 744 reg_w_buf(gspca_dev, freq, sizeof freq);
714} 745}
715 746
716static void setcontrast(struct gspca_dev *gspca_dev)
717{
718 struct sd *sd = (struct sd *) gspca_dev;
719 unsigned int contrast = sd->contrast;
720 __u16 reg_to_write;
721
722 if (contrast < 7)
723 reg_to_write = 0x8ea9 - (0x200 * contrast);
724 else
725 reg_to_write = (0x00a9 + ((contrast - 7) * 0x200));
726
727 reg_w(gspca_dev, reg_to_write);
728}
729
730static void setcolors(struct gspca_dev *gspca_dev)
731{
732 struct sd *sd = (struct sd *) gspca_dev;
733 __u16 reg_to_write;
734
735 reg_to_write = 0xc0bb + sd->colors * 0x100;
736 reg_w(gspca_dev, reg_to_write);
737}
738
739static void setsharpness(struct gspca_dev *gspca_dev)
740{
741 struct sd *sd = (struct sd *) gspca_dev;
742 __u16 reg_to_write;
743
744 reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness;
745
746 reg_w(gspca_dev, reg_to_write);
747}
748
749static int sd_start(struct gspca_dev *gspca_dev) 747static int sd_start(struct gspca_dev *gspca_dev)
750{ 748{
751 struct sd *sd = (struct sd *) gspca_dev; 749 struct sd *sd = (struct sd *) gspca_dev;