diff options
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-dvb.c')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-dvb.c | 182 |
1 files changed, 180 insertions, 2 deletions
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 9db8e13f21c3..86cfdb8514cb 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "saa7134-reg.h" | 32 | #include "saa7134-reg.h" |
33 | #include "saa7134.h" | 33 | #include "saa7134.h" |
34 | #include <media/v4l2-common.h> | 34 | #include <media/v4l2-common.h> |
35 | #include "dvb-pll.h" | ||
35 | 36 | ||
36 | #ifdef HAVE_MT352 | 37 | #ifdef HAVE_MT352 |
37 | # include "mt352.h" | 38 | # include "mt352.h" |
@@ -42,7 +43,6 @@ | |||
42 | #endif | 43 | #endif |
43 | #ifdef HAVE_NXT200X | 44 | #ifdef HAVE_NXT200X |
44 | # include "nxt200x.h" | 45 | # include "nxt200x.h" |
45 | # include "dvb-pll.h" | ||
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); | 48 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); |
@@ -114,6 +114,24 @@ static int mt352_pinnacle_init(struct dvb_frontend* fe) | |||
114 | return 0; | 114 | return 0; |
115 | } | 115 | } |
116 | 116 | ||
117 | static int mt352_aver777_init(struct dvb_frontend* fe) | ||
118 | { | ||
119 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x2d }; | ||
120 | static u8 reset [] = { RESET, 0x80 }; | ||
121 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; | ||
122 | static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0xa0 }; | ||
123 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x33 }; | ||
124 | |||
125 | mt352_write(fe, clock_config, sizeof(clock_config)); | ||
126 | udelay(200); | ||
127 | mt352_write(fe, reset, sizeof(reset)); | ||
128 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); | ||
129 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); | ||
130 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); | ||
131 | |||
132 | return 0; | ||
133 | } | ||
134 | |||
117 | static int mt352_pinnacle_pll_set(struct dvb_frontend* fe, | 135 | static int mt352_pinnacle_pll_set(struct dvb_frontend* fe, |
118 | struct dvb_frontend_parameters* params, | 136 | struct dvb_frontend_parameters* params, |
119 | u8* pllbuf) | 137 | u8* pllbuf) |
@@ -146,6 +164,15 @@ static int mt352_pinnacle_pll_set(struct dvb_frontend* fe, | |||
146 | return 0; | 164 | return 0; |
147 | } | 165 | } |
148 | 166 | ||
167 | static int mt352_aver777_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, u8* pllbuf) | ||
168 | { | ||
169 | pllbuf[0] = 0xc2; | ||
170 | dvb_pll_configure(&dvb_pll_philips_td1316, pllbuf+1, | ||
171 | params->frequency, | ||
172 | params->u.ofdm.bandwidth); | ||
173 | return 0; | ||
174 | } | ||
175 | |||
149 | static struct mt352_config pinnacle_300i = { | 176 | static struct mt352_config pinnacle_300i = { |
150 | .demod_address = 0x3c >> 1, | 177 | .demod_address = 0x3c >> 1, |
151 | .adc_clock = 20333, | 178 | .adc_clock = 20333, |
@@ -154,6 +181,12 @@ static struct mt352_config pinnacle_300i = { | |||
154 | .demod_init = mt352_pinnacle_init, | 181 | .demod_init = mt352_pinnacle_init, |
155 | .pll_set = mt352_pinnacle_pll_set, | 182 | .pll_set = mt352_pinnacle_pll_set, |
156 | }; | 183 | }; |
184 | |||
185 | static struct mt352_config avermedia_777 = { | ||
186 | .demod_address = 0xf, | ||
187 | .demod_init = mt352_aver777_init, | ||
188 | .pll_set = mt352_aver777_pll_set, | ||
189 | }; | ||
157 | #endif | 190 | #endif |
158 | 191 | ||
159 | /* ------------------------------------------------------------------ */ | 192 | /* ------------------------------------------------------------------ */ |
@@ -781,7 +814,7 @@ static int philips_tiger_pll_set(struct dvb_frontend *fe, struct dvb_frontend_pa | |||
781 | tda8290_msg.buf = tda8290_open; | 814 | tda8290_msg.buf = tda8290_open; |
782 | i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1); | 815 | i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1); |
783 | return ret; | 816 | return ret; |
784 | }; | 817 | } |
785 | 818 | ||
786 | static int philips_tiger_dvb_mode(struct dvb_frontend *fe) | 819 | static int philips_tiger_dvb_mode(struct dvb_frontend *fe) |
787 | { | 820 | { |
@@ -817,6 +850,110 @@ static struct tda1004x_config philips_tiger_config = { | |||
817 | .request_firmware = NULL, | 850 | .request_firmware = NULL, |
818 | }; | 851 | }; |
819 | 852 | ||
853 | /* ------------------------------------------------------------------ */ | ||
854 | |||
855 | static int lifeview_trio_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
856 | { | ||
857 | int ret; | ||
858 | |||
859 | ret = philips_tda827xa_pll_set(0x60, fe, params); | ||
860 | return ret; | ||
861 | } | ||
862 | |||
863 | static int lifeview_trio_dvb_mode(struct dvb_frontend *fe) | ||
864 | { | ||
865 | return 0; | ||
866 | } | ||
867 | |||
868 | static void lifeview_trio_analog_mode(struct dvb_frontend *fe) | ||
869 | { | ||
870 | philips_tda827xa_pll_sleep(0x60, fe); | ||
871 | } | ||
872 | |||
873 | static struct tda1004x_config lifeview_trio_config = { | ||
874 | .demod_address = 0x09, | ||
875 | .invert = 1, | ||
876 | .invert_oclk = 0, | ||
877 | .xtal_freq = TDA10046_XTAL_16M, | ||
878 | .agc_config = TDA10046_AGC_TDA827X_GPL, | ||
879 | .if_freq = TDA10046_FREQ_045, | ||
880 | .pll_init = lifeview_trio_dvb_mode, | ||
881 | .pll_set = lifeview_trio_pll_set, | ||
882 | .pll_sleep = lifeview_trio_analog_mode, | ||
883 | .request_firmware = NULL, | ||
884 | }; | ||
885 | |||
886 | /* ------------------------------------------------------------------ */ | ||
887 | |||
888 | static int ads_duo_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
889 | { | ||
890 | int ret; | ||
891 | |||
892 | ret = philips_tda827xa_pll_set(0x61, fe, params); | ||
893 | return ret; | ||
894 | } | ||
895 | |||
896 | static int ads_duo_dvb_mode(struct dvb_frontend *fe) | ||
897 | { | ||
898 | struct saa7134_dev *dev = fe->dvb->priv; | ||
899 | /* route TDA8275a AGC input to the channel decoder */ | ||
900 | saa_writeb(SAA7134_GPIO_GPSTATUS2, 0x60); | ||
901 | return 0; | ||
902 | } | ||
903 | |||
904 | static void ads_duo_analog_mode(struct dvb_frontend *fe) | ||
905 | { | ||
906 | struct saa7134_dev *dev = fe->dvb->priv; | ||
907 | /* route TDA8275a AGC input to the analog IF chip*/ | ||
908 | saa_writeb(SAA7134_GPIO_GPSTATUS2, 0x20); | ||
909 | philips_tda827xa_pll_sleep( 0x61, fe); | ||
910 | } | ||
911 | |||
912 | static struct tda1004x_config ads_tech_duo_config = { | ||
913 | .demod_address = 0x08, | ||
914 | .invert = 1, | ||
915 | .invert_oclk = 0, | ||
916 | .xtal_freq = TDA10046_XTAL_16M, | ||
917 | .agc_config = TDA10046_AGC_TDA827X_GPL, | ||
918 | .if_freq = TDA10046_FREQ_045, | ||
919 | .pll_init = ads_duo_dvb_mode, | ||
920 | .pll_set = ads_duo_pll_set, | ||
921 | .pll_sleep = ads_duo_analog_mode, | ||
922 | .request_firmware = NULL, | ||
923 | }; | ||
924 | |||
925 | /* ------------------------------------------------------------------ */ | ||
926 | |||
927 | static int tevion_dvb220rf_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
928 | { | ||
929 | int ret; | ||
930 | ret = philips_tda827xa_pll_set(0x60, fe, params); | ||
931 | return ret; | ||
932 | } | ||
933 | |||
934 | static int tevion_dvb220rf_pll_init(struct dvb_frontend *fe) | ||
935 | { | ||
936 | return 0; | ||
937 | } | ||
938 | |||
939 | static void tevion_dvb220rf_pll_sleep(struct dvb_frontend *fe) | ||
940 | { | ||
941 | philips_tda827xa_pll_sleep( 0x61, fe); | ||
942 | } | ||
943 | |||
944 | static struct tda1004x_config tevion_dvbt220rf_config = { | ||
945 | .demod_address = 0x08, | ||
946 | .invert = 1, | ||
947 | .invert_oclk = 0, | ||
948 | .xtal_freq = TDA10046_XTAL_16M, | ||
949 | .agc_config = TDA10046_AGC_TDA827X, | ||
950 | .if_freq = TDA10046_FREQ_045, | ||
951 | .pll_init = tevion_dvb220rf_pll_init, | ||
952 | .pll_set = tevion_dvb220rf_pll_set, | ||
953 | .pll_sleep = tevion_dvb220rf_pll_sleep, | ||
954 | .request_firmware = NULL, | ||
955 | }; | ||
956 | |||
820 | #endif | 957 | #endif |
821 | 958 | ||
822 | /* ------------------------------------------------------------------ */ | 959 | /* ------------------------------------------------------------------ */ |
@@ -827,6 +964,22 @@ static struct nxt200x_config avertvhda180 = { | |||
827 | .pll_address = 0x61, | 964 | .pll_address = 0x61, |
828 | .pll_desc = &dvb_pll_tdhu2, | 965 | .pll_desc = &dvb_pll_tdhu2, |
829 | }; | 966 | }; |
967 | |||
968 | static int nxt200x_set_pll_input(u8 *buf, int input) | ||
969 | { | ||
970 | if (input) | ||
971 | buf[3] |= 0x08; | ||
972 | else | ||
973 | buf[3] &= ~0x08; | ||
974 | return 0; | ||
975 | } | ||
976 | |||
977 | static struct nxt200x_config kworldatsc110 = { | ||
978 | .demod_address = 0x0a, | ||
979 | .pll_address = 0x61, | ||
980 | .pll_desc = &dvb_pll_tuv1236d, | ||
981 | .set_pll_input = nxt200x_set_pll_input, | ||
982 | }; | ||
830 | #endif | 983 | #endif |
831 | 984 | ||
832 | /* ------------------------------------------------------------------ */ | 985 | /* ------------------------------------------------------------------ */ |
@@ -851,6 +1004,12 @@ static int dvb_init(struct saa7134_dev *dev) | |||
851 | dev->dvb.frontend = mt352_attach(&pinnacle_300i, | 1004 | dev->dvb.frontend = mt352_attach(&pinnacle_300i, |
852 | &dev->i2c_adap); | 1005 | &dev->i2c_adap); |
853 | break; | 1006 | break; |
1007 | |||
1008 | case SAA7134_BOARD_AVERMEDIA_777: | ||
1009 | printk("%s: avertv 777 dvb setup\n",dev->name); | ||
1010 | dev->dvb.frontend = mt352_attach(&avermedia_777, | ||
1011 | &dev->i2c_adap); | ||
1012 | break; | ||
854 | #endif | 1013 | #endif |
855 | #ifdef HAVE_TDA1004X | 1014 | #ifdef HAVE_TDA1004X |
856 | case SAA7134_BOARD_MD7134: | 1015 | case SAA7134_BOARD_MD7134: |
@@ -889,11 +1048,30 @@ static int dvb_init(struct saa7134_dev *dev) | |||
889 | dev->dvb.frontend = tda10046_attach(&philips_tiger_config, | 1048 | dev->dvb.frontend = tda10046_attach(&philips_tiger_config, |
890 | &dev->i2c_adap); | 1049 | &dev->i2c_adap); |
891 | break; | 1050 | break; |
1051 | case SAA7134_BOARD_FLYDVBT_LR301: | ||
1052 | dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, | ||
1053 | &dev->i2c_adap); | ||
1054 | break; | ||
1055 | case SAA7134_BOARD_FLYDVB_TRIO: | ||
1056 | dev->dvb.frontend = tda10046_attach(&lifeview_trio_config, | ||
1057 | &dev->i2c_adap); | ||
1058 | break; | ||
1059 | case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: | ||
1060 | dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config, | ||
1061 | &dev->i2c_adap); | ||
1062 | break; | ||
1063 | case SAA7134_BOARD_TEVION_DVBT_220RF: | ||
1064 | dev->dvb.frontend = tda10046_attach(&tevion_dvbt220rf_config, | ||
1065 | &dev->i2c_adap); | ||
1066 | break; | ||
892 | #endif | 1067 | #endif |
893 | #ifdef HAVE_NXT200X | 1068 | #ifdef HAVE_NXT200X |
894 | case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: | 1069 | case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: |
895 | dev->dvb.frontend = nxt200x_attach(&avertvhda180, &dev->i2c_adap); | 1070 | dev->dvb.frontend = nxt200x_attach(&avertvhda180, &dev->i2c_adap); |
896 | break; | 1071 | break; |
1072 | case SAA7134_BOARD_KWORLD_ATSC110: | ||
1073 | dev->dvb.frontend = nxt200x_attach(&kworldatsc110, &dev->i2c_adap); | ||
1074 | break; | ||
897 | #endif | 1075 | #endif |
898 | default: | 1076 | default: |
899 | printk("%s: Huh? unknown DVB card?\n",dev->name); | 1077 | printk("%s: Huh? unknown DVB card?\n",dev->name); |