aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorHartmut Hackmann <hartmut.hackmann@t.online.de>2005-11-09 00:38:42 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 10:56:30 -0500
commit90e9df7f186876584b938e01fcf7f40a50c950b9 (patch)
tree630e9515da682fc1a29006ec89a9f008f1c4ae02 /drivers/media/video
parent12b0e1df5c10a094a4475439a484307478c4c607 (diff)
[PATCH] V4L: 904: added dvb support for tda8275a philips tiger reference design
Added dvb support for tda8275a (Philips Tiger reference design) Signed-off-by: Hartmut Hackmann <hartmut.hackmann@t.online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c37
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c192
-rw-r--r--drivers/media/video/saa7134/saa7134.h1
3 files changed, 230 insertions, 0 deletions
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 9e1c51c08f21..d9b3fb0f3eff 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -2490,6 +2490,29 @@ struct saa7134_board saa7134_boards[] = {
2490 .amux = LINE1, 2490 .amux = LINE1,
2491 }}, 2491 }},
2492 }, 2492 },
2493 [SAA7134_BOARD_PHILIPS_TIGER] = {
2494 .name = "Philips Tiger reference design",
2495 .audio_clock = 0x00187de7,
2496 .tuner_type = TUNER_PHILIPS_TDA8290,
2497 .radio_type = UNSET,
2498 .tuner_addr = ADDR_UNSET,
2499 .radio_addr = ADDR_UNSET,
2500 .mpeg = SAA7134_MPEG_DVB,
2501 .inputs = {{
2502 .name = name_tv,
2503 .vmux = 1,
2504 .amux = TV,
2505 .tv = 1,
2506 },{
2507 .name = name_comp1,
2508 .vmux = 3,
2509 .amux = LINE1,
2510 },{
2511 .name = name_svideo,
2512 .vmux = 8,
2513 .amux = LINE1,
2514 }},
2515 },
2493}; 2516};
2494 2517
2495const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); 2518const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
@@ -2919,6 +2942,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
2919 .subvendor = 0x1043, 2942 .subvendor = 0x1043,
2920 .subdevice = 0x4862, 2943 .subdevice = 0x4862,
2921 .driver_data = SAA7134_BOARD_ASUSTeK_P7131_DUAL, 2944 .driver_data = SAA7134_BOARD_ASUSTeK_P7131_DUAL,
2945 },{
2946 .vendor = PCI_VENDOR_ID_PHILIPS,
2947 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
2948 .subvendor = PCI_VENDOR_ID_PHILIPS,
2949 .subdevice = 0x2018,
2950 .driver_data = SAA7134_BOARD_PHILIPS_TIGER,
2922 },{ 2951 },{
2923 /* --- boards without eeprom + subsystem ID --- */ 2952 /* --- boards without eeprom + subsystem ID --- */
2924 .vendor = PCI_VENDOR_ID_PHILIPS, 2953 .vendor = PCI_VENDOR_ID_PHILIPS,
@@ -3177,6 +3206,14 @@ int saa7134_board_init2(struct saa7134_dev *dev)
3177 saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR,&tun_setup); 3206 saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR,&tun_setup);
3178 } 3207 }
3179 break; 3208 break;
3209 case SAA7134_BOARD_PHILIPS_TIGER:
3210 /* this is a hybrid board, initialize to analog mode */
3211 {
3212 u8 data[] = { 0x3c, 0x33, 0x68};
3213 struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)};
3214 i2c_transfer(&dev->i2c_adap, &msg, 1);
3215 }
3216 break;
3180 } 3217 }
3181 return 0; 3218 return 0;
3182} 3219}
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index aaac12e8adbf..d1d1abc55718 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -626,8 +626,196 @@ static struct tda1004x_config tda827x_lifeview_config = {
626 .pll_sleep = philips_tda827x_pll_sleep, 626 .pll_sleep = philips_tda827x_pll_sleep,
627 .request_firmware = NULL, 627 .request_firmware = NULL,
628}; 628};
629
630/* ------------------------------------------------------------------ */
631
632struct tda827xa_data {
633 u32 lomax;
634 u8 svco;
635 u8 spd;
636 u8 scr;
637 u8 sbs;
638 u8 gc3;
639};
640
641static struct tda827xa_data tda827xa_dvbt[] = {
642 { .lomax = 56875000, .svco = 3, .spd = 4, .scr = 0, .sbs = 0, .gc3 = 1},
643 { .lomax = 67250000, .svco = 0, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 1},
644 { .lomax = 81250000, .svco = 1, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 1},
645 { .lomax = 97500000, .svco = 2, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 1},
646 { .lomax = 113750000, .svco = 3, .spd = 3, .scr = 0, .sbs = 1, .gc3 = 1},
647 { .lomax = 134500000, .svco = 0, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},
648 { .lomax = 154000000, .svco = 1, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},
649 { .lomax = 162500000, .svco = 1, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},
650 { .lomax = 183000000, .svco = 2, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},
651 { .lomax = 195000000, .svco = 2, .spd = 2, .scr = 0, .sbs = 2, .gc3 = 1},
652 { .lomax = 227500000, .svco = 3, .spd = 2, .scr = 0, .sbs = 2, .gc3 = 1},
653 { .lomax = 269000000, .svco = 0, .spd = 1, .scr = 0, .sbs = 2, .gc3 = 1},
654 { .lomax = 290000000, .svco = 1, .spd = 1, .scr = 0, .sbs = 2, .gc3 = 1},
655 { .lomax = 325000000, .svco = 1, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 1},
656 { .lomax = 390000000, .svco = 2, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 1},
657 { .lomax = 455000000, .svco = 3, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 1},
658 { .lomax = 520000000, .svco = 0, .spd = 0, .scr = 0, .sbs = 3, .gc3 = 1},
659 { .lomax = 538000000, .svco = 0, .spd = 0, .scr = 1, .sbs = 3, .gc3 = 1},
660 { .lomax = 550000000, .svco = 1, .spd = 0, .scr = 0, .sbs = 3, .gc3 = 1},
661 { .lomax = 620000000, .svco = 1, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0},
662 { .lomax = 650000000, .svco = 1, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0},
663 { .lomax = 700000000, .svco = 2, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0},
664 { .lomax = 780000000, .svco = 2, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0},
665 { .lomax = 820000000, .svco = 3, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0},
666 { .lomax = 870000000, .svco = 3, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0},
667 { .lomax = 911000000, .svco = 3, .spd = 0, .scr = 2, .sbs = 4, .gc3 = 0},
668 { .lomax = 0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0}};
669
670
671static int philips_tda827xa_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
672{
673 struct saa7134_dev *dev = fe->dvb->priv;
674 u8 tuner_buf[14];
675 unsigned char reg2[2];
676
677 struct i2c_msg msg = {.addr = addr,.flags = 0,.buf = tuner_buf};
678 int i, tuner_freq, if_freq;
679 u32 N;
680
681 switch (params->u.ofdm.bandwidth) {
682 case BANDWIDTH_6_MHZ:
683 if_freq = 4000000;
684 break;
685 case BANDWIDTH_7_MHZ:
686 if_freq = 4500000;
687 break;
688 default: /* 8 MHz or Auto */
689 if_freq = 5000000;
690 break;
691 }
692 tuner_freq = params->frequency + if_freq;
693
694 i = 0;
695 while (tda827xa_dvbt[i].lomax < tuner_freq) {
696 if(tda827xa_dvbt[i + 1].lomax == 0)
697 break;
698 i++;
699 }
700
701 N = ((tuner_freq + 31250) / 62500) << tda827xa_dvbt[i].spd;
702 tuner_buf[0] = 0; // subaddress
703 tuner_buf[1] = N >> 8;
704 tuner_buf[2] = N & 0xff;
705 tuner_buf[3] = 0;
706 tuner_buf[4] = 0x16;
707 tuner_buf[5] = (tda827xa_dvbt[i].spd << 5) + (tda827xa_dvbt[i].svco << 3) +
708 tda827xa_dvbt[i].sbs;
709 tuner_buf[6] = 0x4b + (tda827xa_dvbt[i].gc3 << 4);
710 tuner_buf[7] = 0x0c;
711 tuner_buf[8] = 0x06;
712 tuner_buf[9] = 0x24;
713 tuner_buf[10] = 0xff;
714 tuner_buf[11] = 0x60;
715 tuner_buf[12] = 0x00;
716 tuner_buf[13] = 0x39; // lpsel
717 msg.len = 14;
718 if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1)
719 return -EIO;
720
721 msg.buf= reg2;
722 msg.len = 2;
723 reg2[0] = 0x60;
724 reg2[1] = 0x3c;
725 i2c_transfer(&dev->i2c_adap, &msg, 1);
726
727 reg2[0] = 0xa0;
728 reg2[1] = 0x40;
729 i2c_transfer(&dev->i2c_adap, &msg, 1);
730
731 msleep(2);
732 /* correct CP value */
733 reg2[0] = 0x30;
734 reg2[1] = 0x10 + tda827xa_dvbt[i].scr;
735 msg.len = 2;
736 i2c_transfer(&dev->i2c_adap, &msg, 1);
737
738 msleep(550);
739 reg2[0] = 0x50;
740 reg2[1] = 0x4f + (tda827xa_dvbt[i].gc3 << 4);
741 i2c_transfer(&dev->i2c_adap, &msg, 1);
742
743 return 0;
744
745}
746
747static void philips_tda827xa_pll_sleep(u8 addr, struct dvb_frontend *fe)
748{
749 struct saa7134_dev *dev = fe->dvb->priv;
750 static u8 tda827xa_sleep[] = { 0x30, 0x90};
751 struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tda827xa_sleep,
752 .len = sizeof(tda827xa_sleep) };
753 i2c_transfer(&dev->i2c_adap, &tuner_msg, 1);
754
755}
756
757/* ------------------------------------------------------------------ */
758
759static int philips_tiger_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
760{
761 int ret;
762 struct saa7134_dev *dev = fe->dvb->priv;
763 static u8 tda8290_close[] = { 0x21, 0xc0};
764 static u8 tda8290_open[] = { 0x21, 0x80};
765 struct i2c_msg tda8290_msg = {.addr = 0x4b,.flags = 0, .len = 2};
766 /* close tda8290 i2c bridge */
767 tda8290_msg.buf = tda8290_close;
768 ret = i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1);
769 if (ret != 1)
770 return -EIO;
771 msleep(20);
772 ret = philips_tda827xa_pll_set(0x61, fe, params);
773 if (ret != 0)
774 return ret;
775 /* open tda8290 i2c bridge */
776 tda8290_msg.buf = tda8290_open;
777 i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1);
778 return ret;
779};
780
781static int philips_tiger_dvb_mode(struct dvb_frontend *fe)
782{
783 struct saa7134_dev *dev = fe->dvb->priv;
784 static u8 data[] = { 0x3c, 0x33, 0x6a};
785 struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)};
786
787 if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1)
788 return -EIO;
789 return 0;
790}
791
792static void philips_tiger_analog_mode(struct dvb_frontend *fe)
793{
794 struct saa7134_dev *dev = fe->dvb->priv;
795 static u8 data[] = { 0x3c, 0x33, 0x68};
796 struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)};
797
798 i2c_transfer(&dev->i2c_adap, &msg, 1);
799 philips_tda827xa_pll_sleep( 0x61, fe);
800}
801
802static struct tda1004x_config philips_tiger_config = {
803 .demod_address = 0x08,
804 .invert = 1,
805 .invert_oclk = 0,
806 .xtal_freq = TDA10046_XTAL_16M,
807 .agc_config = TDA10046_AGC_TDA827X,
808 .if_freq = TDA10046_FREQ_045,
809 .pll_init = philips_tiger_dvb_mode,
810 .pll_set = philips_tiger_pll_set,
811 .pll_sleep = philips_tiger_analog_mode,
812 .request_firmware = NULL,
813};
814
629#endif 815#endif
630 816
817/* ------------------------------------------------------------------ */
818
631#ifdef HAVE_NXT200X 819#ifdef HAVE_NXT200X
632static struct nxt200x_config avertvhda180 = { 820static struct nxt200x_config avertvhda180 = {
633 .demod_address = 0x0a, 821 .demod_address = 0x0a,
@@ -688,6 +876,10 @@ static int dvb_init(struct saa7134_dev *dev)
688 dev->dvb.frontend = tda10046_attach(&philips_tu1216_61_config, 876 dev->dvb.frontend = tda10046_attach(&philips_tu1216_61_config,
689 &dev->i2c_adap); 877 &dev->i2c_adap);
690 break; 878 break;
879 case SAA7134_BOARD_PHILIPS_TIGER:
880 dev->dvb.frontend = tda10046_attach(&philips_tiger_config,
881 &dev->i2c_adap);
882 break;
691#endif 883#endif
692#ifdef HAVE_NXT200X 884#ifdef HAVE_NXT200X
693 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: 885 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180:
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index 4273ded9d174..a82468a07676 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -207,6 +207,7 @@ struct saa7134_format {
207#define SAA7134_BOARD_ASUSTeK_P7131_DUAL 78 207#define SAA7134_BOARD_ASUSTeK_P7131_DUAL 78
208#define SAA7134_BOARD_PCTV_CARDBUS 79 208#define SAA7134_BOARD_PCTV_CARDBUS 79
209#define SAA7134_BOARD_ASUSTEK_DIGIMATRIX_TV 80 209#define SAA7134_BOARD_ASUSTEK_DIGIMATRIX_TV 80
210#define SAA7134_BOARD_PHILIPS_TIGER 81
210 211
211#define SAA7134_MAXBOARDS 8 212#define SAA7134_MAXBOARDS 8
212#define SAA7134_INPUT_MAX 8 213#define SAA7134_INPUT_MAX 8