3 * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
5 * Extended 3 / 2005 by Hartmut Hackmann to support various
6 * cards with the tda10046 DVB-T channel decoder
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
20 #include "saa7134-reg.h"
22 #include <linux/init.h>
23 #include <linux/list.h>
24 #include <linux/module.h>
25 #include <linux/kernel.h>
26 #include <linux/delay.h>
27 #include <linux/kthread.h>
28 #include <linux/suspend.h>
30 #include <media/v4l2-common.h>
32 #include <media/dvb_frontend.h>
35 #include "mt352_priv.h" /* FIXME */
38 #include "tuner-xc2028.h"
47 #include "tuner-simple.h"
63 MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
64 MODULE_LICENSE("GPL");
66 static unsigned int antenna_pwr
;
68 module_param(antenna_pwr
, int, 0444);
69 MODULE_PARM_DESC(antenna_pwr
,"enable antenna power (Pinnacle 300i)");
71 static int use_frontend
;
72 module_param(use_frontend
, int, 0644);
73 MODULE_PARM_DESC(use_frontend
,"for cards with multiple frontends (0: terrestrial, 1: satellite)");
75 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr
);
77 /* ------------------------------------------------------------------
78 * mt352 based DVB-T cards
81 static int pinnacle_antenna_pwr(struct saa7134_dev
*dev
, int on
)
86 saa_setl(SAA7134_GPIO_GPMODE0
>> 2, (1 << 26));
87 saa_clearl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 26));
91 saa_setl(SAA7134_GPIO_GPMODE0
>> 2, (1 << 26));
92 saa_setl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 26));
95 saa_setl(SAA7134_GPIO_GPMODE0
>> 2, (1 << 28));
96 saa_clearl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 28));
98 saa_setl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 28));
100 ok
= saa_readl(SAA7134_GPIO_GPSTATUS0
) & (1 << 27);
101 pr_debug("%s %s\n", __func__
, ok
? "on" : "off");
104 saa_clearl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 26));
108 static int mt352_pinnacle_init(struct dvb_frontend
* fe
)
110 static u8 clock_config
[] = { CLOCK_CTL
, 0x3d, 0x28 };
111 static u8 reset
[] = { RESET
, 0x80 };
112 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
113 static u8 agc_cfg
[] = { AGC_TARGET
, 0x28, 0xa0 };
114 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x31 };
115 static u8 fsm_ctl_cfg
[] = { 0x7b, 0x04 };
116 static u8 gpp_ctl_cfg
[] = { GPP_CTL
, 0x0f };
117 static u8 scan_ctl_cfg
[] = { SCAN_CTL
, 0x0d };
118 static u8 irq_cfg
[] = { INTERRUPT_EN_0
, 0x00, 0x00, 0x00, 0x00 };
120 pr_debug("%s called\n", __func__
);
122 mt352_write(fe
, clock_config
, sizeof(clock_config
));
124 mt352_write(fe
, reset
, sizeof(reset
));
125 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
126 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
127 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
128 mt352_write(fe
, gpp_ctl_cfg
, sizeof(gpp_ctl_cfg
));
130 mt352_write(fe
, fsm_ctl_cfg
, sizeof(fsm_ctl_cfg
));
131 mt352_write(fe
, scan_ctl_cfg
, sizeof(scan_ctl_cfg
));
132 mt352_write(fe
, irq_cfg
, sizeof(irq_cfg
));
137 static int mt352_aver777_init(struct dvb_frontend
* fe
)
139 static u8 clock_config
[] = { CLOCK_CTL
, 0x38, 0x2d };
140 static u8 reset
[] = { RESET
, 0x80 };
141 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
142 static u8 agc_cfg
[] = { AGC_TARGET
, 0x28, 0xa0 };
143 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x33 };
145 mt352_write(fe
, clock_config
, sizeof(clock_config
));
147 mt352_write(fe
, reset
, sizeof(reset
));
148 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
149 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
150 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
155 static int mt352_avermedia_xc3028_init(struct dvb_frontend
*fe
)
157 static u8 clock_config
[] = { CLOCK_CTL
, 0x38, 0x2d };
158 static u8 reset
[] = { RESET
, 0x80 };
159 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
160 static u8 agc_cfg
[] = { AGC_TARGET
, 0xe };
161 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x33 };
163 mt352_write(fe
, clock_config
, sizeof(clock_config
));
165 mt352_write(fe
, reset
, sizeof(reset
));
166 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
167 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
168 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
172 static int mt352_pinnacle_tuner_set_params(struct dvb_frontend
*fe
)
174 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
175 u8 off
[] = { 0x00, 0xf1};
176 u8 on
[] = { 0x00, 0x71};
177 struct i2c_msg msg
= {.addr
=0x43, .flags
=0, .buf
=off
, .len
= sizeof(off
)};
179 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
180 struct v4l2_frequency f
;
182 /* set frequency (mt2050) */
184 f
.type
= V4L2_TUNER_DIGITAL_TV
;
185 f
.frequency
= c
->frequency
/ 1000 * 16 / 1000;
186 if (fe
->ops
.i2c_gate_ctrl
)
187 fe
->ops
.i2c_gate_ctrl(fe
, 1);
188 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
189 saa_call_all(dev
, tuner
, s_frequency
, &f
);
191 if (fe
->ops
.i2c_gate_ctrl
)
192 fe
->ops
.i2c_gate_ctrl(fe
, 1);
193 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
195 pinnacle_antenna_pwr(dev
, antenna_pwr
);
198 return mt352_pinnacle_init(fe
);
201 static struct mt352_config pinnacle_300i
= {
202 .demod_address
= 0x3c >> 1,
206 .demod_init
= mt352_pinnacle_init
,
209 static struct mt352_config avermedia_777
= {
210 .demod_address
= 0xf,
211 .demod_init
= mt352_aver777_init
,
214 static struct mt352_config avermedia_xc3028_mt352_dev
= {
215 .demod_address
= (0x1e >> 1),
217 .demod_init
= mt352_avermedia_xc3028_init
,
220 static struct tda18271_std_map mb86a20s_tda18271_std_map
= {
221 .dvbt_6
= { .if_freq
= 3300, .agc_mode
= 3, .std
= 4,
222 .if_lvl
= 7, .rfagc_top
= 0x37, },
225 static struct tda18271_config kworld_tda18271_config
= {
226 .std_map
= &mb86a20s_tda18271_std_map
,
227 .gate
= TDA18271_GATE_DIGITAL
,
228 .config
= 3, /* Use tuner callback for AGC */
232 static const struct mb86a20s_config kworld_mb86a20s_config
= {
233 .demod_address
= 0x10,
236 static int kworld_sbtvd_gate_ctrl(struct dvb_frontend
* fe
, int enable
)
238 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
240 unsigned char initmsg
[] = {0x45, 0x97};
241 unsigned char msg_enable
[] = {0x45, 0xc1};
242 unsigned char msg_disable
[] = {0x45, 0x81};
243 struct i2c_msg msg
= {.addr
= 0x4b, .flags
= 0, .buf
= initmsg
, .len
= 2};
245 if (i2c_transfer(&dev
->i2c_adap
, &msg
, 1) != 1) {
246 pr_warn("could not access the I2C gate\n");
250 msg
.buf
= msg_enable
;
252 msg
.buf
= msg_disable
;
253 if (i2c_transfer(&dev
->i2c_adap
, &msg
, 1) != 1) {
254 pr_warn("could not access the I2C gate\n");
261 /* ==================================================================
262 * tda1004x based DVB-T cards, helper functions
265 static int philips_tda1004x_request_firmware(struct dvb_frontend
*fe
,
266 const struct firmware
**fw
, char *name
)
268 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
269 return request_firmware(fw
, name
, &dev
->pci
->dev
);
272 /* ------------------------------------------------------------------
273 * these tuners are tu1216, td1316(a)
276 static int philips_tda6651_pll_set(struct dvb_frontend
*fe
)
278 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
279 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
280 struct tda1004x_state
*state
= fe
->demodulator_priv
;
281 u8 addr
= state
->config
->tuner_address
;
283 struct i2c_msg tuner_msg
= {.addr
= addr
,.flags
= 0,.buf
= tuner_buf
,.len
=
285 int tuner_frequency
= 0;
288 /* determine charge pump */
289 tuner_frequency
= c
->frequency
+ 36166000;
290 if (tuner_frequency
< 87000000)
292 else if (tuner_frequency
< 130000000)
294 else if (tuner_frequency
< 160000000)
296 else if (tuner_frequency
< 200000000)
298 else if (tuner_frequency
< 290000000)
300 else if (tuner_frequency
< 420000000)
302 else if (tuner_frequency
< 480000000)
304 else if (tuner_frequency
< 620000000)
306 else if (tuner_frequency
< 830000000)
308 else if (tuner_frequency
< 895000000)
314 if (c
->frequency
< 49000000)
316 else if (c
->frequency
< 161000000)
318 else if (c
->frequency
< 444000000)
320 else if (c
->frequency
< 861000000)
325 /* setup PLL filter */
326 switch (c
->bandwidth_hz
) {
344 * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6)
346 tuner_frequency
= (((c
->frequency
/ 1000) * 6) + 217496) / 1000;
348 /* setup tuner buffer */
349 tuner_buf
[0] = (tuner_frequency
>> 8) & 0x7f;
350 tuner_buf
[1] = tuner_frequency
& 0xff;
352 tuner_buf
[3] = (cp
<< 5) | (filter
<< 3) | band
;
354 if (fe
->ops
.i2c_gate_ctrl
)
355 fe
->ops
.i2c_gate_ctrl(fe
, 1);
356 if (i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1) != 1) {
357 pr_warn("could not write to tuner at addr: 0x%02x\n",
365 static int philips_tu1216_init(struct dvb_frontend
*fe
)
367 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
368 struct tda1004x_state
*state
= fe
->demodulator_priv
;
369 u8 addr
= state
->config
->tuner_address
;
370 static u8 tu1216_init
[] = { 0x0b, 0xf5, 0x85, 0xab };
371 struct i2c_msg tuner_msg
= {.addr
= addr
,.flags
= 0,.buf
= tu1216_init
,.len
= sizeof(tu1216_init
) };
373 /* setup PLL configuration */
374 if (fe
->ops
.i2c_gate_ctrl
)
375 fe
->ops
.i2c_gate_ctrl(fe
, 1);
376 if (i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1) != 1)
383 /* ------------------------------------------------------------------ */
385 static struct tda1004x_config philips_tu1216_60_config
= {
386 .demod_address
= 0x8,
389 .xtal_freq
= TDA10046_XTAL_4M
,
390 .agc_config
= TDA10046_AGC_DEFAULT
,
391 .if_freq
= TDA10046_FREQ_3617
,
392 .tuner_address
= 0x60,
393 .request_firmware
= philips_tda1004x_request_firmware
396 static struct tda1004x_config philips_tu1216_61_config
= {
398 .demod_address
= 0x8,
401 .xtal_freq
= TDA10046_XTAL_4M
,
402 .agc_config
= TDA10046_AGC_DEFAULT
,
403 .if_freq
= TDA10046_FREQ_3617
,
404 .tuner_address
= 0x61,
405 .request_firmware
= philips_tda1004x_request_firmware
408 /* ------------------------------------------------------------------ */
410 static int philips_td1316_tuner_init(struct dvb_frontend
*fe
)
412 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
413 struct tda1004x_state
*state
= fe
->demodulator_priv
;
414 u8 addr
= state
->config
->tuner_address
;
415 static u8 msg
[] = { 0x0b, 0xf5, 0x86, 0xab };
416 struct i2c_msg init_msg
= {.addr
= addr
,.flags
= 0,.buf
= msg
,.len
= sizeof(msg
) };
418 /* setup PLL configuration */
419 if (fe
->ops
.i2c_gate_ctrl
)
420 fe
->ops
.i2c_gate_ctrl(fe
, 1);
421 if (i2c_transfer(&dev
->i2c_adap
, &init_msg
, 1) != 1)
426 static int philips_td1316_tuner_set_params(struct dvb_frontend
*fe
)
428 return philips_tda6651_pll_set(fe
);
431 static int philips_td1316_tuner_sleep(struct dvb_frontend
*fe
)
433 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
434 struct tda1004x_state
*state
= fe
->demodulator_priv
;
435 u8 addr
= state
->config
->tuner_address
;
436 static u8 msg
[] = { 0x0b, 0xdc, 0x86, 0xa4 };
437 struct i2c_msg analog_msg
= {.addr
= addr
,.flags
= 0,.buf
= msg
,.len
= sizeof(msg
) };
439 /* switch the tuner to analog mode */
440 if (fe
->ops
.i2c_gate_ctrl
)
441 fe
->ops
.i2c_gate_ctrl(fe
, 1);
442 if (i2c_transfer(&dev
->i2c_adap
, &analog_msg
, 1) != 1)
447 /* ------------------------------------------------------------------ */
449 static int philips_europa_tuner_init(struct dvb_frontend
*fe
)
451 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
452 static u8 msg
[] = { 0x00, 0x40};
453 struct i2c_msg init_msg
= {.addr
= 0x43,.flags
= 0,.buf
= msg
,.len
= sizeof(msg
) };
456 if (philips_td1316_tuner_init(fe
))
459 if (i2c_transfer(&dev
->i2c_adap
, &init_msg
, 1) != 1)
465 static int philips_europa_tuner_sleep(struct dvb_frontend
*fe
)
467 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
469 static u8 msg
[] = { 0x00, 0x14 };
470 struct i2c_msg analog_msg
= {.addr
= 0x43,.flags
= 0,.buf
= msg
,.len
= sizeof(msg
) };
472 if (philips_td1316_tuner_sleep(fe
))
475 /* switch the board to analog mode */
476 if (fe
->ops
.i2c_gate_ctrl
)
477 fe
->ops
.i2c_gate_ctrl(fe
, 1);
478 i2c_transfer(&dev
->i2c_adap
, &analog_msg
, 1);
482 static int philips_europa_demod_sleep(struct dvb_frontend
*fe
)
484 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
486 if (dev
->original_demod_sleep
)
487 dev
->original_demod_sleep(fe
);
488 fe
->ops
.i2c_gate_ctrl(fe
, 1);
492 static struct tda1004x_config philips_europa_config
= {
494 .demod_address
= 0x8,
497 .xtal_freq
= TDA10046_XTAL_4M
,
498 .agc_config
= TDA10046_AGC_IFO_AUTO_POS
,
499 .if_freq
= TDA10046_FREQ_052
,
500 .tuner_address
= 0x61,
501 .request_firmware
= philips_tda1004x_request_firmware
504 static struct tda1004x_config medion_cardbus
= {
505 .demod_address
= 0x08,
508 .xtal_freq
= TDA10046_XTAL_16M
,
509 .agc_config
= TDA10046_AGC_IFO_AUTO_NEG
,
510 .if_freq
= TDA10046_FREQ_3613
,
511 .tuner_address
= 0x61,
512 .request_firmware
= philips_tda1004x_request_firmware
515 static struct tda1004x_config technotrend_budget_t3000_config
= {
516 .demod_address
= 0x8,
519 .xtal_freq
= TDA10046_XTAL_4M
,
520 .agc_config
= TDA10046_AGC_DEFAULT
,
521 .if_freq
= TDA10046_FREQ_3617
,
522 .tuner_address
= 0x63,
523 .request_firmware
= philips_tda1004x_request_firmware
526 /* ------------------------------------------------------------------
527 * tda 1004x based cards with philips silicon tuner
530 static int tda8290_i2c_gate_ctrl( struct dvb_frontend
* fe
, int enable
)
532 struct tda1004x_state
*state
= fe
->demodulator_priv
;
534 u8 addr
= state
->config
->i2c_gate
;
535 static u8 tda8290_close
[] = { 0x21, 0xc0};
536 static u8 tda8290_open
[] = { 0x21, 0x80};
537 struct i2c_msg tda8290_msg
= {.addr
= addr
,.flags
= 0, .len
= 2};
539 tda8290_msg
.buf
= tda8290_close
;
541 tda8290_msg
.buf
= tda8290_open
;
543 if (i2c_transfer(state
->i2c
, &tda8290_msg
, 1) != 1) {
544 pr_warn("could not access tda8290 I2C gate\n");
551 static int philips_tda827x_tuner_init(struct dvb_frontend
*fe
)
553 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
554 struct tda1004x_state
*state
= fe
->demodulator_priv
;
556 switch (state
->config
->antenna_switch
) {
560 pr_debug("setting GPIO21 to 0 (TV antenna?)\n");
561 saa7134_set_gpio(dev
, 21, 0);
564 pr_debug("setting GPIO21 to 1 (Radio antenna?)\n");
565 saa7134_set_gpio(dev
, 21, 1);
571 static int philips_tda827x_tuner_sleep(struct dvb_frontend
*fe
)
573 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
574 struct tda1004x_state
*state
= fe
->demodulator_priv
;
576 switch (state
->config
->antenna_switch
) {
580 pr_debug("setting GPIO21 to 1 (Radio antenna?)\n");
581 saa7134_set_gpio(dev
, 21, 1);
584 pr_debug("setting GPIO21 to 0 (TV antenna?)\n");
585 saa7134_set_gpio(dev
, 21, 0);
591 static int configure_tda827x_fe(struct saa7134_dev
*dev
,
592 struct tda1004x_config
*cdec_conf
,
593 struct tda827x_config
*tuner_conf
)
595 struct vb2_dvb_frontend
*fe0
;
597 /* Get the first frontend */
598 fe0
= vb2_dvb_get_frontend(&dev
->frontends
, 1);
603 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
, cdec_conf
, &dev
->i2c_adap
);
604 if (fe0
->dvb
.frontend
) {
605 if (cdec_conf
->i2c_gate
)
606 fe0
->dvb
.frontend
->ops
.i2c_gate_ctrl
= tda8290_i2c_gate_ctrl
;
607 if (dvb_attach(tda827x_attach
, fe0
->dvb
.frontend
,
608 cdec_conf
->tuner_address
,
609 &dev
->i2c_adap
, tuner_conf
))
612 pr_warn("no tda827x tuner found at addr: %02x\n",
613 cdec_conf
->tuner_address
);
618 /* ------------------------------------------------------------------ */
620 static struct tda827x_config tda827x_cfg_0
= {
621 .init
= philips_tda827x_tuner_init
,
622 .sleep
= philips_tda827x_tuner_sleep
,
627 static struct tda827x_config tda827x_cfg_1
= {
628 .init
= philips_tda827x_tuner_init
,
629 .sleep
= philips_tda827x_tuner_sleep
,
634 static struct tda827x_config tda827x_cfg_2
= {
635 .init
= philips_tda827x_tuner_init
,
636 .sleep
= philips_tda827x_tuner_sleep
,
641 static struct tda827x_config tda827x_cfg_2_sw42
= {
642 .init
= philips_tda827x_tuner_init
,
643 .sleep
= philips_tda827x_tuner_sleep
,
648 /* ------------------------------------------------------------------ */
650 static struct tda1004x_config tda827x_lifeview_config
= {
651 .demod_address
= 0x08,
654 .xtal_freq
= TDA10046_XTAL_16M
,
655 .agc_config
= TDA10046_AGC_TDA827X
,
656 .gpio_config
= TDA10046_GP11_I
,
657 .if_freq
= TDA10046_FREQ_045
,
658 .tuner_address
= 0x60,
659 .request_firmware
= philips_tda1004x_request_firmware
662 static struct tda1004x_config philips_tiger_config
= {
663 .demod_address
= 0x08,
666 .xtal_freq
= TDA10046_XTAL_16M
,
667 .agc_config
= TDA10046_AGC_TDA827X
,
668 .gpio_config
= TDA10046_GP11_I
,
669 .if_freq
= TDA10046_FREQ_045
,
671 .tuner_address
= 0x61,
673 .request_firmware
= philips_tda1004x_request_firmware
676 static struct tda1004x_config cinergy_ht_config
= {
677 .demod_address
= 0x08,
680 .xtal_freq
= TDA10046_XTAL_16M
,
681 .agc_config
= TDA10046_AGC_TDA827X
,
682 .gpio_config
= TDA10046_GP01_I
,
683 .if_freq
= TDA10046_FREQ_045
,
685 .tuner_address
= 0x61,
686 .request_firmware
= philips_tda1004x_request_firmware
689 static struct tda1004x_config cinergy_ht_pci_config
= {
690 .demod_address
= 0x08,
693 .xtal_freq
= TDA10046_XTAL_16M
,
694 .agc_config
= TDA10046_AGC_TDA827X
,
695 .gpio_config
= TDA10046_GP01_I
,
696 .if_freq
= TDA10046_FREQ_045
,
698 .tuner_address
= 0x60,
699 .request_firmware
= philips_tda1004x_request_firmware
702 static struct tda1004x_config philips_tiger_s_config
= {
703 .demod_address
= 0x08,
706 .xtal_freq
= TDA10046_XTAL_16M
,
707 .agc_config
= TDA10046_AGC_TDA827X
,
708 .gpio_config
= TDA10046_GP01_I
,
709 .if_freq
= TDA10046_FREQ_045
,
711 .tuner_address
= 0x61,
713 .request_firmware
= philips_tda1004x_request_firmware
716 static struct tda1004x_config pinnacle_pctv_310i_config
= {
717 .demod_address
= 0x08,
720 .xtal_freq
= TDA10046_XTAL_16M
,
721 .agc_config
= TDA10046_AGC_TDA827X
,
722 .gpio_config
= TDA10046_GP11_I
,
723 .if_freq
= TDA10046_FREQ_045
,
725 .tuner_address
= 0x61,
726 .request_firmware
= philips_tda1004x_request_firmware
729 static struct tda1004x_config hauppauge_hvr_1110_config
= {
730 .demod_address
= 0x08,
733 .xtal_freq
= TDA10046_XTAL_16M
,
734 .agc_config
= TDA10046_AGC_TDA827X
,
735 .gpio_config
= TDA10046_GP11_I
,
736 .if_freq
= TDA10046_FREQ_045
,
738 .tuner_address
= 0x61,
739 .request_firmware
= philips_tda1004x_request_firmware
742 static struct tda1004x_config asus_p7131_dual_config
= {
743 .demod_address
= 0x08,
746 .xtal_freq
= TDA10046_XTAL_16M
,
747 .agc_config
= TDA10046_AGC_TDA827X
,
748 .gpio_config
= TDA10046_GP11_I
,
749 .if_freq
= TDA10046_FREQ_045
,
751 .tuner_address
= 0x61,
753 .request_firmware
= philips_tda1004x_request_firmware
756 static struct tda1004x_config lifeview_trio_config
= {
757 .demod_address
= 0x09,
760 .xtal_freq
= TDA10046_XTAL_16M
,
761 .agc_config
= TDA10046_AGC_TDA827X
,
762 .gpio_config
= TDA10046_GP00_I
,
763 .if_freq
= TDA10046_FREQ_045
,
764 .tuner_address
= 0x60,
765 .request_firmware
= philips_tda1004x_request_firmware
768 static struct tda1004x_config tevion_dvbt220rf_config
= {
769 .demod_address
= 0x08,
772 .xtal_freq
= TDA10046_XTAL_16M
,
773 .agc_config
= TDA10046_AGC_TDA827X
,
774 .gpio_config
= TDA10046_GP11_I
,
775 .if_freq
= TDA10046_FREQ_045
,
776 .tuner_address
= 0x60,
777 .request_firmware
= philips_tda1004x_request_firmware
780 static struct tda1004x_config md8800_dvbt_config
= {
781 .demod_address
= 0x08,
784 .xtal_freq
= TDA10046_XTAL_16M
,
785 .agc_config
= TDA10046_AGC_TDA827X
,
786 .gpio_config
= TDA10046_GP01_I
,
787 .if_freq
= TDA10046_FREQ_045
,
789 .tuner_address
= 0x60,
790 .request_firmware
= philips_tda1004x_request_firmware
793 static struct tda1004x_config asus_p7131_4871_config
= {
794 .demod_address
= 0x08,
797 .xtal_freq
= TDA10046_XTAL_16M
,
798 .agc_config
= TDA10046_AGC_TDA827X
,
799 .gpio_config
= TDA10046_GP01_I
,
800 .if_freq
= TDA10046_FREQ_045
,
802 .tuner_address
= 0x61,
804 .request_firmware
= philips_tda1004x_request_firmware
807 static struct tda1004x_config asus_p7131_hybrid_lna_config
= {
808 .demod_address
= 0x08,
811 .xtal_freq
= TDA10046_XTAL_16M
,
812 .agc_config
= TDA10046_AGC_TDA827X
,
813 .gpio_config
= TDA10046_GP11_I
,
814 .if_freq
= TDA10046_FREQ_045
,
816 .tuner_address
= 0x61,
818 .request_firmware
= philips_tda1004x_request_firmware
821 static struct tda1004x_config kworld_dvb_t_210_config
= {
822 .demod_address
= 0x08,
825 .xtal_freq
= TDA10046_XTAL_16M
,
826 .agc_config
= TDA10046_AGC_TDA827X
,
827 .gpio_config
= TDA10046_GP11_I
,
828 .if_freq
= TDA10046_FREQ_045
,
830 .tuner_address
= 0x61,
832 .request_firmware
= philips_tda1004x_request_firmware
835 static struct tda1004x_config avermedia_super_007_config
= {
836 .demod_address
= 0x08,
839 .xtal_freq
= TDA10046_XTAL_16M
,
840 .agc_config
= TDA10046_AGC_TDA827X
,
841 .gpio_config
= TDA10046_GP01_I
,
842 .if_freq
= TDA10046_FREQ_045
,
844 .tuner_address
= 0x60,
846 .request_firmware
= philips_tda1004x_request_firmware
849 static struct tda1004x_config twinhan_dtv_dvb_3056_config
= {
850 .demod_address
= 0x08,
853 .xtal_freq
= TDA10046_XTAL_16M
,
854 .agc_config
= TDA10046_AGC_TDA827X
,
855 .gpio_config
= TDA10046_GP01_I
,
856 .if_freq
= TDA10046_FREQ_045
,
858 .tuner_address
= 0x61,
860 .request_firmware
= philips_tda1004x_request_firmware
863 static struct tda1004x_config asus_tiger_3in1_config
= {
864 .demod_address
= 0x0b,
867 .xtal_freq
= TDA10046_XTAL_16M
,
868 .agc_config
= TDA10046_AGC_TDA827X
,
869 .gpio_config
= TDA10046_GP11_I
,
870 .if_freq
= TDA10046_FREQ_045
,
872 .tuner_address
= 0x61,
874 .request_firmware
= philips_tda1004x_request_firmware
877 static struct tda1004x_config asus_ps3_100_config
= {
878 .demod_address
= 0x0b,
881 .xtal_freq
= TDA10046_XTAL_16M
,
882 .agc_config
= TDA10046_AGC_TDA827X
,
883 .gpio_config
= TDA10046_GP11_I
,
884 .if_freq
= TDA10046_FREQ_045
,
886 .tuner_address
= 0x61,
888 .request_firmware
= philips_tda1004x_request_firmware
891 /* ------------------------------------------------------------------
892 * special case: this card uses saa713x GPIO22 for the mode switch
895 static int ads_duo_tuner_init(struct dvb_frontend
*fe
)
897 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
898 philips_tda827x_tuner_init(fe
);
899 /* route TDA8275a AGC input to the channel decoder */
900 saa7134_set_gpio(dev
, 22, 1);
904 static int ads_duo_tuner_sleep(struct dvb_frontend
*fe
)
906 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
907 /* route TDA8275a AGC input to the analog IF chip*/
908 saa7134_set_gpio(dev
, 22, 0);
909 philips_tda827x_tuner_sleep(fe
);
913 static struct tda827x_config ads_duo_cfg
= {
914 .init
= ads_duo_tuner_init
,
915 .sleep
= ads_duo_tuner_sleep
,
919 static struct tda1004x_config ads_tech_duo_config
= {
920 .demod_address
= 0x08,
923 .xtal_freq
= TDA10046_XTAL_16M
,
924 .agc_config
= TDA10046_AGC_TDA827X
,
925 .gpio_config
= TDA10046_GP00_I
,
926 .if_freq
= TDA10046_FREQ_045
,
927 .tuner_address
= 0x61,
928 .request_firmware
= philips_tda1004x_request_firmware
931 static struct zl10353_config behold_h6_config
= {
932 .demod_address
= 0x1e>>1,
935 .disable_i2c_gate_ctrl
= 1,
938 static struct xc5000_config behold_x7_tunerconfig
= {
939 .i2c_address
= 0xc2>>1,
941 .radio_input
= XC5000_RADIO_FM1
,
944 static struct zl10353_config behold_x7_config
= {
945 .demod_address
= 0x1e>>1,
949 .disable_i2c_gate_ctrl
= 1,
952 static struct zl10353_config videomate_t750_zl10353_config
= {
953 .demod_address
= 0x0f,
956 .disable_i2c_gate_ctrl
= 1,
959 static struct qt1010_config videomate_t750_qt1010_config
= {
964 /* ==================================================================
965 * tda10086 based DVB-S cards, helper functions
968 static struct tda10086_config flydvbs
= {
969 .demod_address
= 0x0e,
972 .xtal_freq
= TDA10086_XTAL_16M
,
975 static struct tda10086_config sd1878_4m
= {
976 .demod_address
= 0x0e,
979 .xtal_freq
= TDA10086_XTAL_4M
,
982 /* ------------------------------------------------------------------
983 * special case: lnb supply is connected to the gated i2c
986 static int md8800_set_voltage(struct dvb_frontend
*fe
,
987 enum fe_sec_voltage voltage
)
990 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
991 if (fe
->ops
.i2c_gate_ctrl
) {
992 fe
->ops
.i2c_gate_ctrl(fe
, 1);
993 if (dev
->original_set_voltage
)
994 res
= dev
->original_set_voltage(fe
, voltage
);
995 fe
->ops
.i2c_gate_ctrl(fe
, 0);
1000 static int md8800_set_high_voltage(struct dvb_frontend
*fe
, long arg
)
1003 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
1004 if (fe
->ops
.i2c_gate_ctrl
) {
1005 fe
->ops
.i2c_gate_ctrl(fe
, 1);
1006 if (dev
->original_set_high_voltage
)
1007 res
= dev
->original_set_high_voltage(fe
, arg
);
1008 fe
->ops
.i2c_gate_ctrl(fe
, 0);
1013 static int md8800_set_voltage2(struct dvb_frontend
*fe
,
1014 enum fe_sec_voltage voltage
)
1016 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
1017 u8 wbuf
[2] = { 0x1f, 00 };
1019 struct i2c_msg msg
[] = { { .addr
= 0x08, .flags
= 0, .buf
= wbuf
, .len
= 1 },
1020 { .addr
= 0x08, .flags
= I2C_M_RD
, .buf
= &rbuf
, .len
= 1 } };
1022 if (i2c_transfer(&dev
->i2c_adap
, msg
, 2) != 2)
1024 /* NOTE: this assumes that gpo1 is used, it might be bit 5 (gpo2) */
1025 if (voltage
== SEC_VOLTAGE_18
)
1026 wbuf
[1] = rbuf
| 0x10;
1028 wbuf
[1] = rbuf
& 0xef;
1030 i2c_transfer(&dev
->i2c_adap
, msg
, 1);
1034 static int md8800_set_high_voltage2(struct dvb_frontend
*fe
, long arg
)
1036 pr_warn("%s: sorry can't set high LNB supply voltage from here\n",
1041 /* ==================================================================
1042 * nxt200x based ATSC cards, helper functions
1045 static const struct nxt200x_config avertvhda180
= {
1046 .demod_address
= 0x0a,
1049 static const struct nxt200x_config kworldatsc110
= {
1050 .demod_address
= 0x0a,
1053 /* ------------------------------------------------------------------ */
1055 static struct mt312_config avertv_a700_mt312
= {
1056 .demod_address
= 0x0e,
1057 .voltage_inverted
= 1,
1060 static struct zl10036_config avertv_a700_tuner
= {
1061 .tuner_address
= 0x60,
1064 static struct mt312_config zl10313_compro_s350_config
= {
1065 .demod_address
= 0x0e,
1068 static struct mt312_config zl10313_avermedia_a706_config
= {
1069 .demod_address
= 0x0e,
1072 static struct lgdt3305_config hcw_lgdt3305_config
= {
1074 .mpeg_mode
= LGDT3305_MPEG_SERIAL
,
1075 .tpclk_edge
= LGDT3305_TPCLK_RISING_EDGE
,
1076 .tpvalid_polarity
= LGDT3305_TP_VALID_HIGH
,
1078 .spectral_inversion
= 1,
1083 static struct tda10048_config hcw_tda10048_config
= {
1084 .demod_address
= 0x10 >> 1,
1085 .output_mode
= TDA10048_SERIAL_OUTPUT
,
1086 .fwbulkwritelen
= TDA10048_BULKWRITE_200
,
1087 .inversion
= TDA10048_INVERSION_ON
,
1088 .dtv6_if_freq_khz
= TDA10048_IF_3300
,
1089 .dtv7_if_freq_khz
= TDA10048_IF_3500
,
1090 .dtv8_if_freq_khz
= TDA10048_IF_4000
,
1091 .clk_freq_khz
= TDA10048_CLK_16000
,
1092 .disable_gate_access
= 1,
1095 static struct tda18271_std_map hauppauge_tda18271_std_map
= {
1096 .atsc_6
= { .if_freq
= 3250, .agc_mode
= 3, .std
= 4,
1097 .if_lvl
= 1, .rfagc_top
= 0x58, },
1098 .qam_6
= { .if_freq
= 4000, .agc_mode
= 3, .std
= 5,
1099 .if_lvl
= 1, .rfagc_top
= 0x58, },
1102 static struct tda18271_config hcw_tda18271_config
= {
1103 .std_map
= &hauppauge_tda18271_std_map
,
1104 .gate
= TDA18271_GATE_ANALOG
,
1106 .output_opt
= TDA18271_OUTPUT_LT_OFF
,
1109 static struct tda829x_config tda829x_no_probe
= {
1110 .probe_tuner
= TDA829X_DONT_PROBE
,
1113 static struct tda10048_config zolid_tda10048_config
= {
1114 .demod_address
= 0x10 >> 1,
1115 .output_mode
= TDA10048_PARALLEL_OUTPUT
,
1116 .fwbulkwritelen
= TDA10048_BULKWRITE_200
,
1117 .inversion
= TDA10048_INVERSION_ON
,
1118 .dtv6_if_freq_khz
= TDA10048_IF_3300
,
1119 .dtv7_if_freq_khz
= TDA10048_IF_3500
,
1120 .dtv8_if_freq_khz
= TDA10048_IF_4000
,
1121 .clk_freq_khz
= TDA10048_CLK_16000
,
1122 .disable_gate_access
= 1,
1125 static struct tda18271_config zolid_tda18271_config
= {
1126 .gate
= TDA18271_GATE_ANALOG
,
1129 static struct tda10048_config dtv1000s_tda10048_config
= {
1130 .demod_address
= 0x10 >> 1,
1131 .output_mode
= TDA10048_PARALLEL_OUTPUT
,
1132 .fwbulkwritelen
= TDA10048_BULKWRITE_200
,
1133 .inversion
= TDA10048_INVERSION_ON
,
1134 .dtv6_if_freq_khz
= TDA10048_IF_3300
,
1135 .dtv7_if_freq_khz
= TDA10048_IF_3800
,
1136 .dtv8_if_freq_khz
= TDA10048_IF_4300
,
1137 .clk_freq_khz
= TDA10048_CLK_16000
,
1138 .disable_gate_access
= 1,
1141 static struct tda18271_std_map dtv1000s_tda18271_std_map
= {
1142 .dvbt_6
= { .if_freq
= 3300, .agc_mode
= 3, .std
= 4,
1143 .if_lvl
= 1, .rfagc_top
= 0x37, },
1144 .dvbt_7
= { .if_freq
= 3800, .agc_mode
= 3, .std
= 5,
1145 .if_lvl
= 1, .rfagc_top
= 0x37, },
1146 .dvbt_8
= { .if_freq
= 4300, .agc_mode
= 3, .std
= 6,
1147 .if_lvl
= 1, .rfagc_top
= 0x37, },
1150 static struct tda18271_config dtv1000s_tda18271_config
= {
1151 .std_map
= &dtv1000s_tda18271_std_map
,
1152 .gate
= TDA18271_GATE_ANALOG
,
1155 static struct lgs8gxx_config prohdtv_pro2_lgs8g75_config
= {
1156 .prod
= LGS8GXX_PROD_LGS8G75
,
1157 .demod_address
= 0x1d,
1161 .if_clk_freq
= 30400, /* 30.4 MHz */
1162 .if_freq
= 4000, /* 4.00 MHz */
1166 .adc_vpp
= 3, /* 2.0 Vpp */
1170 static struct tda18271_config prohdtv_pro2_tda18271_config
= {
1171 .gate
= TDA18271_GATE_ANALOG
,
1172 .output_opt
= TDA18271_OUTPUT_LT_OFF
,
1175 static struct tda18271_std_map kworld_tda18271_std_map
= {
1176 .atsc_6
= { .if_freq
= 3250, .agc_mode
= 3, .std
= 3,
1177 .if_lvl
= 6, .rfagc_top
= 0x37 },
1178 .qam_6
= { .if_freq
= 4000, .agc_mode
= 3, .std
= 0,
1179 .if_lvl
= 6, .rfagc_top
= 0x37 },
1182 static struct tda18271_config kworld_pc150u_tda18271_config
= {
1183 .std_map
= &kworld_tda18271_std_map
,
1184 .gate
= TDA18271_GATE_ANALOG
,
1185 .output_opt
= TDA18271_OUTPUT_LT_OFF
,
1186 .config
= 3, /* Use tuner callback for AGC */
1187 .rf_cal_on_startup
= 1
1190 static struct s5h1411_config kworld_s5h1411_config
= {
1191 .output_mode
= S5H1411_PARALLEL_OUTPUT
,
1192 .gpio
= S5H1411_GPIO_OFF
,
1193 .qam_if
= S5H1411_IF_4000
,
1194 .vsb_if
= S5H1411_IF_3250
,
1195 .inversion
= S5H1411_INVERSION_ON
,
1196 .status_mode
= S5H1411_DEMODLOCKING
,
1198 S5H1411_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK
,
1202 /* ==================================================================
1206 static int dvb_init(struct saa7134_dev
*dev
)
1209 int attach_xc3028
= 0;
1210 struct vb2_dvb_frontend
*fe0
;
1211 struct vb2_queue
*q
;
1213 /* FIXME: add support for multi-frontend */
1214 mutex_init(&dev
->frontends
.lock
);
1215 INIT_LIST_HEAD(&dev
->frontends
.felist
);
1217 pr_info("%s() allocating 1 frontend\n", __func__
);
1218 fe0
= vb2_dvb_alloc_frontend(&dev
->frontends
, 1);
1220 pr_err("%s() failed to alloc\n", __func__
);
1224 /* init struct vb2_dvb */
1225 dev
->ts
.nr_bufs
= 32;
1226 dev
->ts
.nr_packets
= 32*4;
1227 fe0
->dvb
.name
= dev
->name
;
1229 q
->type
= V4L2_BUF_TYPE_VIDEO_CAPTURE
;
1230 q
->io_modes
= VB2_MMAP
| VB2_READ
;
1231 q
->drv_priv
= &dev
->ts_q
;
1232 q
->ops
= &saa7134_ts_qops
;
1233 q
->mem_ops
= &vb2_dma_sg_memops
;
1234 q
->buf_struct_size
= sizeof(struct saa7134_buf
);
1235 q
->timestamp_flags
= V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC
;
1236 q
->lock
= &dev
->lock
;
1237 q
->dev
= &dev
->pci
->dev
;
1238 ret
= vb2_queue_init(q
);
1240 vb2_dvb_dealloc_frontends(&dev
->frontends
);
1244 switch (dev
->board
) {
1245 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL
:
1246 pr_debug("pinnacle 300i dvb setup\n");
1247 fe0
->dvb
.frontend
= dvb_attach(mt352_attach
, &pinnacle_300i
,
1249 if (fe0
->dvb
.frontend
) {
1250 fe0
->dvb
.frontend
->ops
.tuner_ops
.set_params
= mt352_pinnacle_tuner_set_params
;
1253 case SAA7134_BOARD_AVERMEDIA_777
:
1254 case SAA7134_BOARD_AVERMEDIA_A16AR
:
1255 pr_debug("avertv 777 dvb setup\n");
1256 fe0
->dvb
.frontend
= dvb_attach(mt352_attach
, &avermedia_777
,
1258 if (fe0
->dvb
.frontend
) {
1259 dvb_attach(simple_tuner_attach
, fe0
->dvb
.frontend
,
1260 &dev
->i2c_adap
, 0x61,
1261 TUNER_PHILIPS_TD1316
);
1264 case SAA7134_BOARD_AVERMEDIA_A16D
:
1265 pr_debug("AverMedia A16D dvb setup\n");
1266 fe0
->dvb
.frontend
= dvb_attach(mt352_attach
,
1267 &avermedia_xc3028_mt352_dev
,
1271 case SAA7134_BOARD_MD7134
:
1272 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1275 if (fe0
->dvb
.frontend
) {
1276 dvb_attach(simple_tuner_attach
, fe0
->dvb
.frontend
,
1277 &dev
->i2c_adap
, medion_cardbus
.tuner_address
,
1278 TUNER_PHILIPS_FMD1216ME_MK3
);
1281 case SAA7134_BOARD_PHILIPS_TOUGH
:
1282 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1283 &philips_tu1216_60_config
,
1285 if (fe0
->dvb
.frontend
) {
1286 fe0
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tu1216_init
;
1287 fe0
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tda6651_pll_set
;
1290 case SAA7134_BOARD_FLYDVBTDUO
:
1291 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS
:
1292 if (configure_tda827x_fe(dev
, &tda827x_lifeview_config
,
1293 &tda827x_cfg_0
) < 0)
1294 goto detach_frontend
;
1296 case SAA7134_BOARD_PHILIPS_EUROPA
:
1297 case SAA7134_BOARD_VIDEOMATE_DVBT_300
:
1298 case SAA7134_BOARD_ASUS_EUROPA_HYBRID
:
1299 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1300 &philips_europa_config
,
1302 if (fe0
->dvb
.frontend
) {
1303 dev
->original_demod_sleep
= fe0
->dvb
.frontend
->ops
.sleep
;
1304 fe0
->dvb
.frontend
->ops
.sleep
= philips_europa_demod_sleep
;
1305 fe0
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_europa_tuner_init
;
1306 fe0
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_europa_tuner_sleep
;
1307 fe0
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_td1316_tuner_set_params
;
1310 case SAA7134_BOARD_TECHNOTREND_BUDGET_T3000
:
1311 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1312 &technotrend_budget_t3000_config
,
1314 if (fe0
->dvb
.frontend
) {
1315 dev
->original_demod_sleep
= fe0
->dvb
.frontend
->ops
.sleep
;
1316 fe0
->dvb
.frontend
->ops
.sleep
= philips_europa_demod_sleep
;
1317 fe0
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_europa_tuner_init
;
1318 fe0
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_europa_tuner_sleep
;
1319 fe0
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_td1316_tuner_set_params
;
1322 case SAA7134_BOARD_VIDEOMATE_DVBT_200
:
1323 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1324 &philips_tu1216_61_config
,
1326 if (fe0
->dvb
.frontend
) {
1327 fe0
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tu1216_init
;
1328 fe0
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tda6651_pll_set
;
1331 case SAA7134_BOARD_KWORLD_DVBT_210
:
1332 if (configure_tda827x_fe(dev
, &kworld_dvb_t_210_config
,
1333 &tda827x_cfg_2
) < 0)
1334 goto detach_frontend
;
1336 case SAA7134_BOARD_HAUPPAUGE_HVR1120
:
1337 fe0
->dvb
.frontend
= dvb_attach(tda10048_attach
,
1338 &hcw_tda10048_config
,
1340 if (fe0
->dvb
.frontend
!= NULL
) {
1341 dvb_attach(tda829x_attach
, fe0
->dvb
.frontend
,
1342 &dev
->i2c_adap
, 0x4b,
1344 dvb_attach(tda18271_attach
, fe0
->dvb
.frontend
,
1345 0x60, &dev
->i2c_adap
,
1346 &hcw_tda18271_config
);
1349 case SAA7134_BOARD_PHILIPS_TIGER
:
1350 if (configure_tda827x_fe(dev
, &philips_tiger_config
,
1351 &tda827x_cfg_0
) < 0)
1352 goto detach_frontend
;
1354 case SAA7134_BOARD_PINNACLE_PCTV_310i
:
1355 if (configure_tda827x_fe(dev
, &pinnacle_pctv_310i_config
,
1356 &tda827x_cfg_1
) < 0)
1357 goto detach_frontend
;
1359 case SAA7134_BOARD_HAUPPAUGE_HVR1110
:
1360 if (configure_tda827x_fe(dev
, &hauppauge_hvr_1110_config
,
1361 &tda827x_cfg_1
) < 0)
1362 goto detach_frontend
;
1364 case SAA7134_BOARD_HAUPPAUGE_HVR1150
:
1365 fe0
->dvb
.frontend
= dvb_attach(lgdt3305_attach
,
1366 &hcw_lgdt3305_config
,
1368 if (fe0
->dvb
.frontend
) {
1369 dvb_attach(tda829x_attach
, fe0
->dvb
.frontend
,
1370 &dev
->i2c_adap
, 0x4b,
1372 dvb_attach(tda18271_attach
, fe0
->dvb
.frontend
,
1373 0x60, &dev
->i2c_adap
,
1374 &hcw_tda18271_config
);
1377 case SAA7134_BOARD_ASUSTeK_P7131_DUAL
:
1378 if (configure_tda827x_fe(dev
, &asus_p7131_dual_config
,
1379 &tda827x_cfg_0
) < 0)
1380 goto detach_frontend
;
1382 case SAA7134_BOARD_FLYDVBT_LR301
:
1383 if (configure_tda827x_fe(dev
, &tda827x_lifeview_config
,
1384 &tda827x_cfg_0
) < 0)
1385 goto detach_frontend
;
1387 case SAA7134_BOARD_FLYDVB_TRIO
:
1388 if (!use_frontend
) { /* terrestrial */
1389 if (configure_tda827x_fe(dev
, &lifeview_trio_config
,
1390 &tda827x_cfg_0
) < 0)
1391 goto detach_frontend
;
1392 } else { /* satellite */
1393 fe0
->dvb
.frontend
= dvb_attach(tda10086_attach
, &flydvbs
, &dev
->i2c_adap
);
1394 if (fe0
->dvb
.frontend
) {
1395 if (dvb_attach(tda826x_attach
, fe0
->dvb
.frontend
, 0x63,
1396 &dev
->i2c_adap
, 0) == NULL
) {
1397 pr_warn("%s: Lifeview Trio, No tda826x found!\n",
1399 goto detach_frontend
;
1401 if (dvb_attach(isl6421_attach
, fe0
->dvb
.frontend
,
1403 0x08, 0, 0, false) == NULL
) {
1404 pr_warn("%s: Lifeview Trio, No ISL6421 found!\n",
1406 goto detach_frontend
;
1411 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331
:
1412 case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS
:
1413 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1414 &ads_tech_duo_config
,
1416 if (fe0
->dvb
.frontend
) {
1417 if (dvb_attach(tda827x_attach
,fe0
->dvb
.frontend
,
1418 ads_tech_duo_config
.tuner_address
, &dev
->i2c_adap
,
1419 &ads_duo_cfg
) == NULL
) {
1420 pr_warn("no tda827x tuner found at addr: %02x\n",
1421 ads_tech_duo_config
.tuner_address
);
1422 goto detach_frontend
;
1425 pr_warn("failed to attach tda10046\n");
1427 case SAA7134_BOARD_TEVION_DVBT_220RF
:
1428 if (configure_tda827x_fe(dev
, &tevion_dvbt220rf_config
,
1429 &tda827x_cfg_0
) < 0)
1430 goto detach_frontend
;
1432 case SAA7134_BOARD_MEDION_MD8800_QUADRO
:
1433 if (!use_frontend
) { /* terrestrial */
1434 if (configure_tda827x_fe(dev
, &md8800_dvbt_config
,
1435 &tda827x_cfg_0
) < 0)
1436 goto detach_frontend
;
1437 } else { /* satellite */
1438 fe0
->dvb
.frontend
= dvb_attach(tda10086_attach
,
1439 &flydvbs
, &dev
->i2c_adap
);
1440 if (fe0
->dvb
.frontend
) {
1441 struct dvb_frontend
*fe
= fe0
->dvb
.frontend
;
1442 u8 dev_id
= dev
->eedata
[2];
1444 struct i2c_msg msg
= {.addr
= 0x08, .flags
= 0, .len
= 1};
1446 if (dvb_attach(tda826x_attach
, fe0
->dvb
.frontend
,
1447 0x60, &dev
->i2c_adap
, 0) == NULL
) {
1448 pr_warn("%s: Medion Quadro, no tda826x found !\n",
1450 goto detach_frontend
;
1452 if (dev_id
!= 0x08) {
1453 /* we need to open the i2c gate (we know it exists) */
1454 fe
->ops
.i2c_gate_ctrl(fe
, 1);
1455 if (dvb_attach(isl6405_attach
, fe
,
1456 &dev
->i2c_adap
, 0x08, 0, 0) == NULL
) {
1457 pr_warn("%s: Medion Quadro, no ISL6405 found !\n",
1459 goto detach_frontend
;
1461 if (dev_id
== 0x07) {
1462 /* fire up the 2nd section of the LNB supply since
1463 we can't do this from the other section */
1465 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
1467 fe
->ops
.i2c_gate_ctrl(fe
, 0);
1468 dev
->original_set_voltage
= fe
->ops
.set_voltage
;
1469 fe
->ops
.set_voltage
= md8800_set_voltage
;
1470 dev
->original_set_high_voltage
= fe
->ops
.enable_high_lnb_voltage
;
1471 fe
->ops
.enable_high_lnb_voltage
= md8800_set_high_voltage
;
1473 fe
->ops
.set_voltage
= md8800_set_voltage2
;
1474 fe
->ops
.enable_high_lnb_voltage
= md8800_set_high_voltage2
;
1479 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180
:
1480 fe0
->dvb
.frontend
= dvb_attach(nxt200x_attach
, &avertvhda180
,
1482 if (fe0
->dvb
.frontend
)
1483 dvb_attach(dvb_pll_attach
, fe0
->dvb
.frontend
, 0x61,
1484 NULL
, DVB_PLL_TDHU2
);
1486 case SAA7134_BOARD_ADS_INSTANT_HDTV_PCI
:
1487 case SAA7134_BOARD_KWORLD_ATSC110
:
1488 fe0
->dvb
.frontend
= dvb_attach(nxt200x_attach
, &kworldatsc110
,
1490 if (fe0
->dvb
.frontend
)
1491 dvb_attach(simple_tuner_attach
, fe0
->dvb
.frontend
,
1492 &dev
->i2c_adap
, 0x61,
1493 TUNER_PHILIPS_TUV1236D
);
1495 case SAA7134_BOARD_KWORLD_PC150U
:
1496 saa7134_set_gpio(dev
, 18, 1); /* Switch to digital mode */
1497 saa7134_tuner_callback(dev
, 0,
1498 TDA18271_CALLBACK_CMD_AGC_ENABLE
, 1);
1499 fe0
->dvb
.frontend
= dvb_attach(s5h1411_attach
,
1500 &kworld_s5h1411_config
,
1502 if (fe0
->dvb
.frontend
!= NULL
) {
1503 dvb_attach(tda829x_attach
, fe0
->dvb
.frontend
,
1504 &dev
->i2c_adap
, 0x4b,
1506 dvb_attach(tda18271_attach
, fe0
->dvb
.frontend
,
1507 0x60, &dev
->i2c_adap
,
1508 &kworld_pc150u_tda18271_config
);
1511 case SAA7134_BOARD_FLYDVBS_LR300
:
1512 fe0
->dvb
.frontend
= dvb_attach(tda10086_attach
, &flydvbs
,
1514 if (fe0
->dvb
.frontend
) {
1515 if (dvb_attach(tda826x_attach
, fe0
->dvb
.frontend
, 0x60,
1516 &dev
->i2c_adap
, 0) == NULL
) {
1517 pr_warn("%s: No tda826x found!\n", __func__
);
1518 goto detach_frontend
;
1520 if (dvb_attach(isl6421_attach
, fe0
->dvb
.frontend
,
1522 0x08, 0, 0, false) == NULL
) {
1523 pr_warn("%s: No ISL6421 found!\n", __func__
);
1524 goto detach_frontend
;
1528 case SAA7134_BOARD_ASUS_EUROPA2_HYBRID
:
1529 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1532 if (fe0
->dvb
.frontend
) {
1533 dev
->original_demod_sleep
= fe0
->dvb
.frontend
->ops
.sleep
;
1534 fe0
->dvb
.frontend
->ops
.sleep
= philips_europa_demod_sleep
;
1536 dvb_attach(simple_tuner_attach
, fe0
->dvb
.frontend
,
1537 &dev
->i2c_adap
, medion_cardbus
.tuner_address
,
1538 TUNER_PHILIPS_FMD1216ME_MK3
);
1541 case SAA7134_BOARD_VIDEOMATE_DVBT_200A
:
1542 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1543 &philips_europa_config
,
1545 if (fe0
->dvb
.frontend
) {
1546 fe0
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_td1316_tuner_init
;
1547 fe0
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_td1316_tuner_set_params
;
1550 case SAA7134_BOARD_CINERGY_HT_PCMCIA
:
1551 if (configure_tda827x_fe(dev
, &cinergy_ht_config
,
1552 &tda827x_cfg_0
) < 0)
1553 goto detach_frontend
;
1555 case SAA7134_BOARD_CINERGY_HT_PCI
:
1556 if (configure_tda827x_fe(dev
, &cinergy_ht_pci_config
,
1557 &tda827x_cfg_0
) < 0)
1558 goto detach_frontend
;
1560 case SAA7134_BOARD_PHILIPS_TIGER_S
:
1561 if (configure_tda827x_fe(dev
, &philips_tiger_s_config
,
1562 &tda827x_cfg_2
) < 0)
1563 goto detach_frontend
;
1565 case SAA7134_BOARD_ASUS_P7131_4871
:
1566 if (configure_tda827x_fe(dev
, &asus_p7131_4871_config
,
1567 &tda827x_cfg_2
) < 0)
1568 goto detach_frontend
;
1570 case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA
:
1571 if (configure_tda827x_fe(dev
, &asus_p7131_hybrid_lna_config
,
1572 &tda827x_cfg_2
) < 0)
1573 goto detach_frontend
;
1575 case SAA7134_BOARD_AVERMEDIA_SUPER_007
:
1576 if (configure_tda827x_fe(dev
, &avermedia_super_007_config
,
1577 &tda827x_cfg_0
) < 0)
1578 goto detach_frontend
;
1580 case SAA7134_BOARD_TWINHAN_DTV_DVB_3056
:
1581 if (configure_tda827x_fe(dev
, &twinhan_dtv_dvb_3056_config
,
1582 &tda827x_cfg_2_sw42
) < 0)
1583 goto detach_frontend
;
1585 case SAA7134_BOARD_PHILIPS_SNAKE
:
1586 fe0
->dvb
.frontend
= dvb_attach(tda10086_attach
, &flydvbs
,
1588 if (fe0
->dvb
.frontend
) {
1589 if (dvb_attach(tda826x_attach
, fe0
->dvb
.frontend
, 0x60,
1590 &dev
->i2c_adap
, 0) == NULL
) {
1591 pr_warn("%s: No tda826x found!\n", __func__
);
1592 goto detach_frontend
;
1594 if (dvb_attach(lnbp21_attach
, fe0
->dvb
.frontend
,
1595 &dev
->i2c_adap
, 0, 0) == NULL
) {
1596 pr_warn("%s: No lnbp21 found!\n", __func__
);
1597 goto detach_frontend
;
1601 case SAA7134_BOARD_CREATIX_CTX953
:
1602 if (configure_tda827x_fe(dev
, &md8800_dvbt_config
,
1603 &tda827x_cfg_0
) < 0)
1604 goto detach_frontend
;
1606 case SAA7134_BOARD_MSI_TVANYWHERE_AD11
:
1607 if (configure_tda827x_fe(dev
, &philips_tiger_s_config
,
1608 &tda827x_cfg_2
) < 0)
1609 goto detach_frontend
;
1611 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506
:
1612 pr_debug("AverMedia E506R dvb setup\n");
1613 saa7134_set_gpio(dev
, 25, 0);
1615 saa7134_set_gpio(dev
, 25, 1);
1616 fe0
->dvb
.frontend
= dvb_attach(mt352_attach
,
1617 &avermedia_xc3028_mt352_dev
,
1621 case SAA7134_BOARD_MD7134_BRIDGE_2
:
1622 fe0
->dvb
.frontend
= dvb_attach(tda10086_attach
,
1623 &sd1878_4m
, &dev
->i2c_adap
);
1624 if (fe0
->dvb
.frontend
) {
1625 struct dvb_frontend
*fe
;
1626 if (dvb_attach(dvb_pll_attach
, fe0
->dvb
.frontend
, 0x60,
1627 &dev
->i2c_adap
, DVB_PLL_PHILIPS_SD1878_TDA8261
) == NULL
) {
1628 pr_warn("%s: MD7134 DVB-S, no SD1878 found !\n",
1630 goto detach_frontend
;
1632 /* we need to open the i2c gate (we know it exists) */
1633 fe
= fe0
->dvb
.frontend
;
1634 fe
->ops
.i2c_gate_ctrl(fe
, 1);
1635 if (dvb_attach(isl6405_attach
, fe
,
1636 &dev
->i2c_adap
, 0x08, 0, 0) == NULL
) {
1637 pr_warn("%s: MD7134 DVB-S, no ISL6405 found !\n",
1639 goto detach_frontend
;
1641 fe
->ops
.i2c_gate_ctrl(fe
, 0);
1642 dev
->original_set_voltage
= fe
->ops
.set_voltage
;
1643 fe
->ops
.set_voltage
= md8800_set_voltage
;
1644 dev
->original_set_high_voltage
= fe
->ops
.enable_high_lnb_voltage
;
1645 fe
->ops
.enable_high_lnb_voltage
= md8800_set_high_voltage
;
1648 case SAA7134_BOARD_AVERMEDIA_M103
:
1649 saa7134_set_gpio(dev
, 25, 0);
1651 saa7134_set_gpio(dev
, 25, 1);
1652 fe0
->dvb
.frontend
= dvb_attach(mt352_attach
,
1653 &avermedia_xc3028_mt352_dev
,
1657 case SAA7134_BOARD_ASUSTeK_TIGER_3IN1
:
1658 if (!use_frontend
) { /* terrestrial */
1659 if (configure_tda827x_fe(dev
, &asus_tiger_3in1_config
,
1660 &tda827x_cfg_2
) < 0)
1661 goto detach_frontend
;
1662 } else { /* satellite */
1663 fe0
->dvb
.frontend
= dvb_attach(tda10086_attach
,
1664 &flydvbs
, &dev
->i2c_adap
);
1665 if (fe0
->dvb
.frontend
) {
1666 if (dvb_attach(tda826x_attach
,
1667 fe0
->dvb
.frontend
, 0x60,
1668 &dev
->i2c_adap
, 0) == NULL
) {
1669 pr_warn("%s: Asus Tiger 3in1, no tda826x found!\n",
1671 goto detach_frontend
;
1673 if (dvb_attach(lnbp21_attach
, fe0
->dvb
.frontend
,
1674 &dev
->i2c_adap
, 0, 0) == NULL
) {
1675 pr_warn("%s: Asus Tiger 3in1, no lnbp21 found!\n",
1677 goto detach_frontend
;
1682 case SAA7134_BOARD_ASUSTeK_PS3_100
:
1683 if (!use_frontend
) { /* terrestrial */
1684 if (configure_tda827x_fe(dev
, &asus_ps3_100_config
,
1685 &tda827x_cfg_2
) < 0)
1686 goto detach_frontend
;
1687 } else { /* satellite */
1688 fe0
->dvb
.frontend
= dvb_attach(tda10086_attach
,
1689 &flydvbs
, &dev
->i2c_adap
);
1690 if (fe0
->dvb
.frontend
) {
1691 if (dvb_attach(tda826x_attach
,
1692 fe0
->dvb
.frontend
, 0x60,
1693 &dev
->i2c_adap
, 0) == NULL
) {
1694 pr_warn("%s: Asus My Cinema PS3-100, no tda826x found!\n",
1696 goto detach_frontend
;
1698 if (dvb_attach(lnbp21_attach
, fe0
->dvb
.frontend
,
1699 &dev
->i2c_adap
, 0, 0) == NULL
) {
1700 pr_warn("%s: Asus My Cinema PS3-100, no lnbp21 found!\n",
1702 goto detach_frontend
;
1707 case SAA7134_BOARD_ASUSTeK_TIGER
:
1708 if (configure_tda827x_fe(dev
, &philips_tiger_config
,
1709 &tda827x_cfg_0
) < 0)
1710 goto detach_frontend
;
1712 case SAA7134_BOARD_BEHOLD_H6
:
1713 fe0
->dvb
.frontend
= dvb_attach(zl10353_attach
,
1716 if (fe0
->dvb
.frontend
) {
1717 dvb_attach(simple_tuner_attach
, fe0
->dvb
.frontend
,
1718 &dev
->i2c_adap
, 0x61,
1719 TUNER_PHILIPS_FMD1216MEX_MK3
);
1722 case SAA7134_BOARD_BEHOLD_X7
:
1723 fe0
->dvb
.frontend
= dvb_attach(zl10353_attach
,
1726 if (fe0
->dvb
.frontend
) {
1727 dvb_attach(xc5000_attach
, fe0
->dvb
.frontend
,
1728 &dev
->i2c_adap
, &behold_x7_tunerconfig
);
1731 case SAA7134_BOARD_BEHOLD_H7
:
1732 fe0
->dvb
.frontend
= dvb_attach(zl10353_attach
,
1735 if (fe0
->dvb
.frontend
) {
1736 dvb_attach(xc5000_attach
, fe0
->dvb
.frontend
,
1737 &dev
->i2c_adap
, &behold_x7_tunerconfig
);
1740 case SAA7134_BOARD_AVERMEDIA_A700_PRO
:
1741 case SAA7134_BOARD_AVERMEDIA_A700_HYBRID
:
1742 /* Zarlink ZL10313 */
1743 fe0
->dvb
.frontend
= dvb_attach(mt312_attach
,
1744 &avertv_a700_mt312
, &dev
->i2c_adap
);
1745 if (fe0
->dvb
.frontend
) {
1746 if (dvb_attach(zl10036_attach
, fe0
->dvb
.frontend
,
1747 &avertv_a700_tuner
, &dev
->i2c_adap
) == NULL
) {
1748 pr_warn("%s: No zl10036 found!\n",
1753 case SAA7134_BOARD_VIDEOMATE_S350
:
1754 fe0
->dvb
.frontend
= dvb_attach(mt312_attach
,
1755 &zl10313_compro_s350_config
, &dev
->i2c_adap
);
1756 if (fe0
->dvb
.frontend
)
1757 if (dvb_attach(zl10039_attach
, fe0
->dvb
.frontend
,
1758 0x60, &dev
->i2c_adap
) == NULL
)
1759 pr_warn("%s: No zl10039 found!\n",
1763 case SAA7134_BOARD_VIDEOMATE_T750
:
1764 fe0
->dvb
.frontend
= dvb_attach(zl10353_attach
,
1765 &videomate_t750_zl10353_config
,
1767 if (fe0
->dvb
.frontend
!= NULL
) {
1768 if (dvb_attach(qt1010_attach
,
1771 &videomate_t750_qt1010_config
) == NULL
)
1772 pr_warn("error attaching QT1010\n");
1775 case SAA7134_BOARD_ZOLID_HYBRID_PCI
:
1776 fe0
->dvb
.frontend
= dvb_attach(tda10048_attach
,
1777 &zolid_tda10048_config
,
1779 if (fe0
->dvb
.frontend
!= NULL
) {
1780 dvb_attach(tda829x_attach
, fe0
->dvb
.frontend
,
1781 &dev
->i2c_adap
, 0x4b,
1783 dvb_attach(tda18271_attach
, fe0
->dvb
.frontend
,
1784 0x60, &dev
->i2c_adap
,
1785 &zolid_tda18271_config
);
1788 case SAA7134_BOARD_LEADTEK_WINFAST_DTV1000S
:
1789 fe0
->dvb
.frontend
= dvb_attach(tda10048_attach
,
1790 &dtv1000s_tda10048_config
,
1792 if (fe0
->dvb
.frontend
!= NULL
) {
1793 dvb_attach(tda829x_attach
, fe0
->dvb
.frontend
,
1794 &dev
->i2c_adap
, 0x4b,
1796 dvb_attach(tda18271_attach
, fe0
->dvb
.frontend
,
1797 0x60, &dev
->i2c_adap
,
1798 &dtv1000s_tda18271_config
);
1801 case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG
:
1802 /* Switch to digital mode */
1803 saa7134_tuner_callback(dev
, 0,
1804 TDA18271_CALLBACK_CMD_AGC_ENABLE
, 1);
1805 fe0
->dvb
.frontend
= dvb_attach(mb86a20s_attach
,
1806 &kworld_mb86a20s_config
,
1808 if (fe0
->dvb
.frontend
!= NULL
) {
1809 dvb_attach(tda829x_attach
, fe0
->dvb
.frontend
,
1810 &dev
->i2c_adap
, 0x4b,
1812 fe0
->dvb
.frontend
->ops
.i2c_gate_ctrl
= kworld_sbtvd_gate_ctrl
;
1813 dvb_attach(tda18271_attach
, fe0
->dvb
.frontend
,
1814 0x60, &dev
->i2c_adap
,
1815 &kworld_tda18271_config
);
1818 /* mb86a20s need to use the I2C gateway */
1820 case SAA7134_BOARD_MAGICPRO_PROHDTV_PRO2
:
1821 fe0
->dvb
.frontend
= dvb_attach(lgs8gxx_attach
,
1822 &prohdtv_pro2_lgs8g75_config
,
1824 if (fe0
->dvb
.frontend
!= NULL
) {
1825 dvb_attach(tda829x_attach
, fe0
->dvb
.frontend
,
1826 &dev
->i2c_adap
, 0x4b,
1828 dvb_attach(tda18271_attach
, fe0
->dvb
.frontend
,
1829 0x60, &dev
->i2c_adap
,
1830 &prohdtv_pro2_tda18271_config
);
1833 case SAA7134_BOARD_AVERMEDIA_A706
:
1834 /* Enable all DVB-S devices now */
1835 /* CE5039 DVB-S tuner SLEEP pin low */
1836 saa7134_set_gpio(dev
, 23, 0);
1837 /* CE6313 DVB-S demod SLEEP pin low */
1838 saa7134_set_gpio(dev
, 9, 0);
1839 /* CE6313 DVB-S demod RESET# pin high */
1840 saa7134_set_gpio(dev
, 25, 1);
1842 fe0
->dvb
.frontend
= dvb_attach(mt312_attach
,
1843 &zl10313_avermedia_a706_config
, &dev
->i2c_adap
);
1844 if (fe0
->dvb
.frontend
) {
1845 fe0
->dvb
.frontend
->ops
.i2c_gate_ctrl
= NULL
;
1846 if (dvb_attach(zl10039_attach
, fe0
->dvb
.frontend
,
1847 0x60, &dev
->i2c_adap
) == NULL
)
1848 pr_warn("%s: No zl10039 found!\n",
1853 pr_warn("Huh? unknown DVB card?\n");
1857 if (attach_xc3028
) {
1858 struct dvb_frontend
*fe
;
1859 struct xc2028_config cfg
= {
1860 .i2c_adap
= &dev
->i2c_adap
,
1864 if (!fe0
->dvb
.frontend
)
1865 goto detach_frontend
;
1867 fe
= dvb_attach(xc2028_attach
, fe0
->dvb
.frontend
, &cfg
);
1869 pr_err("%s/2: xc3028 attach failed\n",
1871 goto detach_frontend
;
1875 if (NULL
== fe0
->dvb
.frontend
) {
1876 pr_err("%s/dvb: frontend initialization failed\n", dev
->name
);
1877 goto detach_frontend
;
1879 /* define general-purpose callback pointer */
1880 fe0
->dvb
.frontend
->callback
= saa7134_tuner_callback
;
1882 /* register everything else */
1883 #ifndef CONFIG_MEDIA_CONTROLLER_DVB
1884 ret
= vb2_dvb_register_bus(&dev
->frontends
, THIS_MODULE
, dev
,
1885 &dev
->pci
->dev
, NULL
,
1888 ret
= vb2_dvb_register_bus(&dev
->frontends
, THIS_MODULE
, dev
,
1889 &dev
->pci
->dev
, dev
->media_dev
,
1893 /* this sequence is necessary to make the tda1004x load its firmware
1894 * and to enter analog mode of hybrid boards
1897 if (fe0
->dvb
.frontend
->ops
.init
)
1898 fe0
->dvb
.frontend
->ops
.init(fe0
->dvb
.frontend
);
1899 if (fe0
->dvb
.frontend
->ops
.sleep
)
1900 fe0
->dvb
.frontend
->ops
.sleep(fe0
->dvb
.frontend
);
1901 if (fe0
->dvb
.frontend
->ops
.tuner_ops
.sleep
)
1902 fe0
->dvb
.frontend
->ops
.tuner_ops
.sleep(fe0
->dvb
.frontend
);
1907 vb2_dvb_dealloc_frontends(&dev
->frontends
);
1908 vb2_queue_release(&fe0
->dvb
.dvbq
);
1912 static int dvb_fini(struct saa7134_dev
*dev
)
1914 struct vb2_dvb_frontend
*fe0
;
1916 /* Get the first frontend */
1917 fe0
= vb2_dvb_get_frontend(&dev
->frontends
, 1);
1921 /* FIXME: I suspect that this code is bogus, since the entry for
1922 Pinnacle 300I DVB-T PAL already defines the proper init to allow
1923 the detection of mt2032 (TDA9887_PORT2_INACTIVE)
1925 if (dev
->board
== SAA7134_BOARD_PINNACLE_300I_DVBT_PAL
) {
1926 struct v4l2_priv_tun_config tda9887_cfg
;
1927 static int on
= TDA9887_PRESENT
| TDA9887_PORT2_INACTIVE
;
1929 tda9887_cfg
.tuner
= TUNER_TDA9887
;
1930 tda9887_cfg
.priv
= &on
;
1932 /* otherwise we don't detect the tuner on next insmod */
1933 saa_call_all(dev
, tuner
, s_config
, &tda9887_cfg
);
1934 } else if (dev
->board
== SAA7134_BOARD_MEDION_MD8800_QUADRO
) {
1935 if ((dev
->eedata
[2] == 0x07) && use_frontend
) {
1936 /* turn off the 2nd lnb supply */
1938 struct i2c_msg msg
= {.addr
= 0x08, .buf
= &data
, .flags
= 0, .len
= 1};
1939 struct dvb_frontend
*fe
;
1940 fe
= fe0
->dvb
.frontend
;
1941 if (fe
->ops
.i2c_gate_ctrl
) {
1942 fe
->ops
.i2c_gate_ctrl(fe
, 1);
1943 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
1944 fe
->ops
.i2c_gate_ctrl(fe
, 0);
1948 vb2_dvb_unregister_bus(&dev
->frontends
);
1949 vb2_queue_release(&fe0
->dvb
.dvbq
);
1953 static struct saa7134_mpeg_ops dvb_ops
= {
1954 .type
= SAA7134_MPEG_DVB
,
1959 static int __init
dvb_register(void)
1961 return saa7134_ts_register(&dvb_ops
);
1964 static void __exit
dvb_unregister(void)
1966 saa7134_ts_unregister(&dvb_ops
);
1969 module_init(dvb_register
);
1970 module_exit(dvb_unregister
);