diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-03-28 16:52:44 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:07:56 -0400 |
commit | 95a2fdb6f78c020026b4fa82be506ef92961a9f6 (patch) | |
tree | 3f928a676f8a9da13e2f08bac2aafd1e6199a574 /drivers/media | |
parent | cf8267ff100dd8466fe631f7172969945b654e3f (diff) |
V4L/DVB (7458): saa7134: Adds analog support for Avermedia A16D
Thanks to timf <timf@iinet.net.au>, "Richard (MQ)" <osl2008@googlemail.com> and
gian luca rasponi <lucarasp@inwind.it> for their tests.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-cards.c | 25 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-dvb.c | 35 |
2 files changed, 56 insertions, 4 deletions
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index c323ca005f72..cfa13c2fb14f 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -5217,6 +5217,13 @@ static int saa7134_xc2028_callback(struct saa7134_dev *dev, | |||
5217 | case XC2028_TUNER_RESET: | 5217 | case XC2028_TUNER_RESET: |
5218 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x06e20000, 0x06e20000); | 5218 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x06e20000, 0x06e20000); |
5219 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x06a20000, 0x06a20000); | 5219 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x06a20000, 0x06a20000); |
5220 | mdelay(250); | ||
5221 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x06e20000, 0); | ||
5222 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x06a20000, 0); | ||
5223 | mdelay(250); | ||
5224 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x06e20000, 0x06e20000); | ||
5225 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x06a20000, 0x06a20000); | ||
5226 | mdelay(250); | ||
5220 | saa_andorl(SAA7133_ANALOG_IO_SELECT >> 2, 0x02, 0x02); | 5227 | saa_andorl(SAA7133_ANALOG_IO_SELECT >> 2, 0x02, 0x02); |
5221 | saa_andorl(SAA7134_ANALOG_IN_CTRL1 >> 2, 0x81, 0x81); | 5228 | saa_andorl(SAA7134_ANALOG_IN_CTRL1 >> 2, 0x81, 0x81); |
5222 | saa_andorl(SAA7134_AUDIO_CLOCK0 >> 2, 0x03187de7, 0x03187de7); | 5229 | saa_andorl(SAA7134_AUDIO_CLOCK0 >> 2, 0x03187de7, 0x03187de7); |
@@ -5413,10 +5420,15 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
5413 | case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: | 5420 | case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: |
5414 | case SAA7134_BOARD_AVERMEDIA_M115: | 5421 | case SAA7134_BOARD_AVERMEDIA_M115: |
5415 | case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM: | 5422 | case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM: |
5423 | case SAA7134_BOARD_AVERMEDIA_A16D: | ||
5424 | /* power-down tuner chip */ | ||
5425 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0); | ||
5426 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0); | ||
5427 | msleep(10); | ||
5416 | /* power-up tuner chip */ | 5428 | /* power-up tuner chip */ |
5417 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0xffffffff); | 5429 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0xffffffff); |
5418 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0xffffffff); | 5430 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0xffffffff); |
5419 | msleep(1); | 5431 | msleep(10); |
5420 | break; | 5432 | break; |
5421 | case SAA7134_BOARD_RTD_VFG7350: | 5433 | case SAA7134_BOARD_RTD_VFG7350: |
5422 | 5434 | ||
@@ -5709,9 +5721,14 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
5709 | ctl.fname = XC2028_DEFAULT_FIRMWARE; | 5721 | ctl.fname = XC2028_DEFAULT_FIRMWARE; |
5710 | ctl.max_len = 64; | 5722 | ctl.max_len = 64; |
5711 | 5723 | ||
5712 | /* FIXME: This should be device-dependent */ | 5724 | switch (dev->board) { |
5713 | ctl.demod = XC3028_FE_OREN538; | 5725 | case SAA7134_BOARD_AVERMEDIA_A16D: |
5714 | ctl.mts = 1; | 5726 | ctl.demod = XC3028_FE_ZARLINK456; |
5727 | break; | ||
5728 | default: | ||
5729 | ctl.demod = XC3028_FE_OREN538; | ||
5730 | ctl.mts = 1; | ||
5731 | } | ||
5715 | 5732 | ||
5716 | xc2028_cfg.tuner = TUNER_XC2028; | 5733 | xc2028_cfg.tuner = TUNER_XC2028; |
5717 | xc2028_cfg.priv = &ctl; | 5734 | xc2028_cfg.priv = &ctl; |
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 9f8730bc6e5f..5c84f45ecbe2 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -151,6 +151,26 @@ static int mt352_aver777_init(struct dvb_frontend* fe) | |||
151 | return 0; | 151 | return 0; |
152 | } | 152 | } |
153 | 153 | ||
154 | static int mt352_aver_a16d_init(struct dvb_frontend *fe) | ||
155 | { | ||
156 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x2d }; | ||
157 | static u8 reset [] = { RESET, 0x80 }; | ||
158 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; | ||
159 | static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0xa0 }; | ||
160 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x33 }; | ||
161 | |||
162 | mt352_write(fe, clock_config, sizeof(clock_config)); | ||
163 | udelay(200); | ||
164 | mt352_write(fe, reset, sizeof(reset)); | ||
165 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); | ||
166 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); | ||
167 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); | ||
168 | |||
169 | return 0; | ||
170 | } | ||
171 | |||
172 | |||
173 | |||
154 | static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe, | 174 | static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe, |
155 | struct dvb_frontend_parameters* params) | 175 | struct dvb_frontend_parameters* params) |
156 | { | 176 | { |
@@ -193,6 +213,11 @@ static struct mt352_config avermedia_777 = { | |||
193 | .demod_init = mt352_aver777_init, | 213 | .demod_init = mt352_aver777_init, |
194 | }; | 214 | }; |
195 | 215 | ||
216 | static struct mt352_config avermedia_16d = { | ||
217 | .demod_address = 0xf, | ||
218 | .demod_init = mt352_aver_a16d_init, | ||
219 | }; | ||
220 | |||
196 | static struct mt352_config avermedia_e506r_mt352_dev = { | 221 | static struct mt352_config avermedia_e506r_mt352_dev = { |
197 | .demod_address = (0x1e >> 1), | 222 | .demod_address = (0x1e >> 1), |
198 | .no_tuner = 1, | 223 | .no_tuner = 1, |
@@ -935,6 +960,12 @@ static int dvb_init(struct saa7134_dev *dev) | |||
935 | TUNER_PHILIPS_TD1316); | 960 | TUNER_PHILIPS_TD1316); |
936 | } | 961 | } |
937 | break; | 962 | break; |
963 | case SAA7134_BOARD_AVERMEDIA_A16D: | ||
964 | dprintk("avertv A16D dvb setup\n"); | ||
965 | dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_16d, | ||
966 | &dev->i2c_adap); | ||
967 | attach_xc3028 = 1; | ||
968 | break; | ||
938 | case SAA7134_BOARD_MD7134: | 969 | case SAA7134_BOARD_MD7134: |
939 | dev->dvb.frontend = dvb_attach(tda10046_attach, | 970 | dev->dvb.frontend = dvb_attach(tda10046_attach, |
940 | &medion_cardbus, | 971 | &medion_cardbus, |
@@ -1205,6 +1236,10 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1205 | .i2c_adap = &dev->i2c_adap, | 1236 | .i2c_adap = &dev->i2c_adap, |
1206 | .i2c_addr = 0x61, | 1237 | .i2c_addr = 0x61, |
1207 | }; | 1238 | }; |
1239 | |||
1240 | if (!dev->dvb.frontend) | ||
1241 | return -1; | ||
1242 | |||
1208 | fe = dvb_attach(xc2028_attach, dev->dvb.frontend, &cfg); | 1243 | fe = dvb_attach(xc2028_attach, dev->dvb.frontend, &cfg); |
1209 | if (!fe) { | 1244 | if (!fe) { |
1210 | printk(KERN_ERR "%s/2: xc3028 attach failed\n", | 1245 | printk(KERN_ERR "%s/2: xc3028 attach failed\n", |