1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
6 * Extended 3 / 2005 by Hartmut Hackmann to support various
7 * cards with the tda10046 DVB-T channel decoder
11 #include "saa7134-reg.h"
13 #include <linux/init.h>
14 #include <linux/list.h>
15 #include <linux/module.h>
16 #include <linux/kernel.h>
17 #include <linux/delay.h>
18 #include <linux/kthread.h>
19 #include <linux/suspend.h>
21 #include <media/v4l2-common.h>
23 #include <media/dvb_frontend.h>
26 #include "mt352_priv.h" /* FIXME */
38 #include "tuner-simple.h"
54 MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
55 MODULE_DESCRIPTION("DVB/ATSC Support for saa7134 based TV cards");
56 MODULE_LICENSE("GPL");
58 static unsigned int antenna_pwr
;
60 module_param(antenna_pwr
, int, 0444);
61 MODULE_PARM_DESC(antenna_pwr
,"enable antenna power (Pinnacle 300i)");
63 static int use_frontend
;
64 module_param(use_frontend
, int, 0644);
65 MODULE_PARM_DESC(use_frontend
,"for cards with multiple frontends (0: terrestrial, 1: satellite)");
67 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr
);
69 /* ------------------------------------------------------------------
70 * mt352 based DVB-T cards
73 static int pinnacle_antenna_pwr(struct saa7134_dev
*dev
, int on
)
78 saa_setl(SAA7134_GPIO_GPMODE0
>> 2, (1 << 26));
79 saa_clearl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 26));
83 saa_setl(SAA7134_GPIO_GPMODE0
>> 2, (1 << 26));
84 saa_setl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 26));
87 saa_setl(SAA7134_GPIO_GPMODE0
>> 2, (1 << 28));
88 saa_clearl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 28));
90 saa_setl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 28));
92 ok
= saa_readl(SAA7134_GPIO_GPSTATUS0
) & (1 << 27);
93 pr_debug("%s %s\n", __func__
, ok
? "on" : "off");
96 saa_clearl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 26));
100 static int mt352_pinnacle_init(struct dvb_frontend
* fe
)
102 static u8 clock_config
[] = { CLOCK_CTL
, 0x3d, 0x28 };
103 static u8 reset
[] = { RESET
, 0x80 };
104 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
105 static u8 agc_cfg
[] = { AGC_TARGET
, 0x28, 0xa0 };
106 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x31 };
107 static u8 fsm_ctl_cfg
[] = { 0x7b, 0x04 };
108 static u8 gpp_ctl_cfg
[] = { GPP_CTL
, 0x0f };
109 static u8 scan_ctl_cfg
[] = { SCAN_CTL
, 0x0d };
110 static u8 irq_cfg
[] = { INTERRUPT_EN_0
, 0x00, 0x00, 0x00, 0x00 };
112 pr_debug("%s called\n", __func__
);
114 mt352_write(fe
, clock_config
, sizeof(clock_config
));
116 mt352_write(fe
, reset
, sizeof(reset
));
117 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
118 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
119 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
120 mt352_write(fe
, gpp_ctl_cfg
, sizeof(gpp_ctl_cfg
));
122 mt352_write(fe
, fsm_ctl_cfg
, sizeof(fsm_ctl_cfg
));
123 mt352_write(fe
, scan_ctl_cfg
, sizeof(scan_ctl_cfg
));
124 mt352_write(fe
, irq_cfg
, sizeof(irq_cfg
));
129 static int mt352_aver777_init(struct dvb_frontend
* fe
)
131 static u8 clock_config
[] = { CLOCK_CTL
, 0x38, 0x2d };
132 static u8 reset
[] = { RESET
, 0x80 };
133 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
134 static u8 agc_cfg
[] = { AGC_TARGET
, 0x28, 0xa0 };
135 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x33 };
137 mt352_write(fe
, clock_config
, sizeof(clock_config
));
139 mt352_write(fe
, reset
, sizeof(reset
));
140 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
141 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
142 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
147 static int mt352_avermedia_xc3028_init(struct dvb_frontend
*fe
)
149 static u8 clock_config
[] = { CLOCK_CTL
, 0x38, 0x2d };
150 static u8 reset
[] = { RESET
, 0x80 };
151 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
152 static u8 agc_cfg
[] = { AGC_TARGET
, 0xe };
153 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x33 };
155 mt352_write(fe
, clock_config
, sizeof(clock_config
));
157 mt352_write(fe
, reset
, sizeof(reset
));
158 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
159 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
160 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
164 static int mt352_pinnacle_tuner_set_params(struct dvb_frontend
*fe
)
166 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
167 u8 off
[] = { 0x00, 0xf1};
168 u8 on
[] = { 0x00, 0x71};
169 struct i2c_msg msg
= {.addr
=0x43, .flags
=0, .buf
=off
, .len
= sizeof(off
)};
171 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
172 struct v4l2_frequency f
;
174 /* set frequency (mt2050) */
176 f
.type
= V4L2_TUNER_DIGITAL_TV
;
177 f
.frequency
= c
->frequency
/ 1000 * 16 / 1000;
178 if (fe
->ops
.i2c_gate_ctrl
)
179 fe
->ops
.i2c_gate_ctrl(fe
, 1);
180 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
181 saa_call_all(dev
, tuner
, s_frequency
, &f
);
183 if (fe
->ops
.i2c_gate_ctrl
)
184 fe
->ops
.i2c_gate_ctrl(fe
, 1);
185 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
187 pinnacle_antenna_pwr(dev
, antenna_pwr
);
190 return mt352_pinnacle_init(fe
);
193 static struct mt352_config pinnacle_300i
= {
194 .demod_address
= 0x3c >> 1,
198 .demod_init
= mt352_pinnacle_init
,
201 static struct mt352_config avermedia_777
= {
202 .demod_address
= 0xf,
203 .demod_init
= mt352_aver777_init
,
206 static struct mt352_config avermedia_xc3028_mt352_dev
= {
207 .demod_address
= (0x1e >> 1),
209 .demod_init
= mt352_avermedia_xc3028_init
,
212 static struct tda18271_std_map mb86a20s_tda18271_std_map
= {
213 .dvbt_6
= { .if_freq
= 3300, .agc_mode
= 3, .std
= 4,
214 .if_lvl
= 7, .rfagc_top
= 0x37, },
217 static struct tda18271_config kworld_tda18271_config
= {
218 .std_map
= &mb86a20s_tda18271_std_map
,
219 .gate
= TDA18271_GATE_DIGITAL
,
220 .config
= 3, /* Use tuner callback for AGC */
224 static const struct mb86a20s_config kworld_mb86a20s_config
= {
225 .demod_address
= 0x10,
228 static int kworld_sbtvd_gate_ctrl(struct dvb_frontend
* fe
, int enable
)
230 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
232 unsigned char initmsg
[] = {0x45, 0x97};
233 unsigned char msg_enable
[] = {0x45, 0xc1};
234 unsigned char msg_disable
[] = {0x45, 0x81};
235 struct i2c_msg msg
= {.addr
= 0x4b, .flags
= 0, .buf
= initmsg
, .len
= 2};
237 if (i2c_transfer(&dev
->i2c_adap
, &msg
, 1) != 1) {
238 pr_warn("could not access the I2C gate\n");
242 msg
.buf
= msg_enable
;
244 msg
.buf
= msg_disable
;
245 if (i2c_transfer(&dev
->i2c_adap
, &msg
, 1) != 1) {
246 pr_warn("could not access the I2C gate\n");
253 /* ==================================================================
254 * tda1004x based DVB-T cards, helper functions
257 static int philips_tda1004x_request_firmware(struct dvb_frontend
*fe
,
258 const struct firmware
**fw
, char *name
)
260 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
261 return request_firmware(fw
, name
, &dev
->pci
->dev
);
264 /* ------------------------------------------------------------------
265 * these tuners are tu1216, td1316(a)
268 static int philips_tda6651_pll_set(struct dvb_frontend
*fe
)
270 struct dtv_frontend_properties
*c
= &fe
->dtv_property_cache
;
271 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
272 struct tda1004x_state
*state
= fe
->demodulator_priv
;
273 u8 addr
= state
->config
->tuner_address
;
275 struct i2c_msg tuner_msg
= {.addr
= addr
,.flags
= 0,.buf
= tuner_buf
,.len
=
277 int tuner_frequency
= 0;
280 /* determine charge pump */
281 tuner_frequency
= c
->frequency
+ 36166000;
282 if (tuner_frequency
< 87000000)
284 else if (tuner_frequency
< 130000000)
286 else if (tuner_frequency
< 160000000)
288 else if (tuner_frequency
< 200000000)
290 else if (tuner_frequency
< 290000000)
292 else if (tuner_frequency
< 420000000)
294 else if (tuner_frequency
< 480000000)
296 else if (tuner_frequency
< 620000000)
298 else if (tuner_frequency
< 830000000)
300 else if (tuner_frequency
< 895000000)
306 if (c
->frequency
< 49000000)
308 else if (c
->frequency
< 161000000)
310 else if (c
->frequency
< 444000000)
312 else if (c
->frequency
< 861000000)
317 /* setup PLL filter */
318 switch (c
->bandwidth_hz
) {
336 * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6)
338 tuner_frequency
= (((c
->frequency
/ 1000) * 6) + 217496) / 1000;
340 /* setup tuner buffer */
341 tuner_buf
[0] = (tuner_frequency
>> 8) & 0x7f;
342 tuner_buf
[1] = tuner_frequency
& 0xff;
344 tuner_buf
[3] = (cp
<< 5) | (filter
<< 3) | band
;
346 if (fe
->ops
.i2c_gate_ctrl
)
347 fe
->ops
.i2c_gate_ctrl(fe
, 1);
348 if (i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1) != 1) {
349 pr_warn("could not write to tuner at addr: 0x%02x\n",
357 static int philips_tu1216_init(struct dvb_frontend
*fe
)
359 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
360 struct tda1004x_state
*state
= fe
->demodulator_priv
;
361 u8 addr
= state
->config
->tuner_address
;
362 static u8 tu1216_init
[] = { 0x0b, 0xf5, 0x85, 0xab };
363 struct i2c_msg tuner_msg
= {.addr
= addr
,.flags
= 0,.buf
= tu1216_init
,.len
= sizeof(tu1216_init
) };
365 /* setup PLL configuration */
366 if (fe
->ops
.i2c_gate_ctrl
)
367 fe
->ops
.i2c_gate_ctrl(fe
, 1);
368 if (i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1) != 1)
375 /* ------------------------------------------------------------------ */
377 static struct tda1004x_config philips_tu1216_60_config
= {
378 .demod_address
= 0x8,
381 .xtal_freq
= TDA10046_XTAL_4M
,
382 .agc_config
= TDA10046_AGC_DEFAULT
,
383 .if_freq
= TDA10046_FREQ_3617
,
384 .tuner_address
= 0x60,
385 .request_firmware
= philips_tda1004x_request_firmware
388 static struct tda1004x_config philips_tu1216_61_config
= {
390 .demod_address
= 0x8,
393 .xtal_freq
= TDA10046_XTAL_4M
,
394 .agc_config
= TDA10046_AGC_DEFAULT
,
395 .if_freq
= TDA10046_FREQ_3617
,
396 .tuner_address
= 0x61,
397 .request_firmware
= philips_tda1004x_request_firmware
400 /* ------------------------------------------------------------------ */
402 static int philips_td1316_tuner_init(struct dvb_frontend
*fe
)
404 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
405 struct tda1004x_state
*state
= fe
->demodulator_priv
;
406 u8 addr
= state
->config
->tuner_address
;
407 static u8 msg
[] = { 0x0b, 0xf5, 0x86, 0xab };
408 struct i2c_msg init_msg
= {.addr
= addr
,.flags
= 0,.buf
= msg
,.len
= sizeof(msg
) };
410 /* setup PLL configuration */
411 if (fe
->ops
.i2c_gate_ctrl
)
412 fe
->ops
.i2c_gate_ctrl(fe
, 1);
413 if (i2c_transfer(&dev
->i2c_adap
, &init_msg
, 1) != 1)
418 static int philips_td1316_tuner_set_params(struct dvb_frontend
*fe
)
420 return philips_tda6651_pll_set(fe
);
423 static int philips_td1316_tuner_sleep(struct dvb_frontend
*fe
)
425 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
426 struct tda1004x_state
*state
= fe
->demodulator_priv
;
427 u8 addr
= state
->config
->tuner_address
;
428 static u8 msg
[] = { 0x0b, 0xdc, 0x86, 0xa4 };
429 struct i2c_msg analog_msg
= {.addr
= addr
,.flags
= 0,.buf
= msg
,.len
= sizeof(msg
) };
431 /* switch the tuner to analog mode */
432 if (fe
->ops
.i2c_gate_ctrl
)
433 fe
->ops
.i2c_gate_ctrl(fe
, 1);
434 if (i2c_transfer(&dev
->i2c_adap
, &analog_msg
, 1) != 1)
439 /* ------------------------------------------------------------------ */
441 static int philips_europa_tuner_init(struct dvb_frontend
*fe
)
443 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
444 static u8 msg
[] = { 0x00, 0x40};
445 struct i2c_msg init_msg
= {.addr
= 0x43,.flags
= 0,.buf
= msg
,.len
= sizeof(msg
) };
448 if (philips_td1316_tuner_init(fe
))
451 if (i2c_transfer(&dev
->i2c_adap
, &init_msg
, 1) != 1)
457 static int philips_europa_tuner_sleep(struct dvb_frontend
*fe
)
459 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
461 static u8 msg
[] = { 0x00, 0x14 };
462 struct i2c_msg analog_msg
= {.addr
= 0x43,.flags
= 0,.buf
= msg
,.len
= sizeof(msg
) };
464 if (philips_td1316_tuner_sleep(fe
))
467 /* switch the board to analog mode */
468 if (fe
->ops
.i2c_gate_ctrl
)
469 fe
->ops
.i2c_gate_ctrl(fe
, 1);
470 if (i2c_transfer(&dev
->i2c_adap
, &analog_msg
, 1) != 1)
476 static int philips_europa_demod_sleep(struct dvb_frontend
*fe
)
478 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
480 if (dev
->original_demod_sleep
)
481 dev
->original_demod_sleep(fe
);
482 fe
->ops
.i2c_gate_ctrl(fe
, 1);
486 static struct tda1004x_config philips_europa_config
= {
488 .demod_address
= 0x8,
491 .xtal_freq
= TDA10046_XTAL_4M
,
492 .agc_config
= TDA10046_AGC_IFO_AUTO_POS
,
493 .if_freq
= TDA10046_FREQ_052
,
494 .tuner_address
= 0x61,
495 .request_firmware
= philips_tda1004x_request_firmware
498 static struct tda1004x_config medion_cardbus
= {
499 .demod_address
= 0x08,
502 .xtal_freq
= TDA10046_XTAL_16M
,
503 .agc_config
= TDA10046_AGC_IFO_AUTO_NEG
,
504 .if_freq
= TDA10046_FREQ_3613
,
505 .tuner_address
= 0x61,
506 .request_firmware
= philips_tda1004x_request_firmware
509 static struct tda1004x_config technotrend_budget_t3000_config
= {
510 .demod_address
= 0x8,
513 .xtal_freq
= TDA10046_XTAL_4M
,
514 .agc_config
= TDA10046_AGC_DEFAULT
,
515 .if_freq
= TDA10046_FREQ_3617
,
516 .tuner_address
= 0x63,
517 .request_firmware
= philips_tda1004x_request_firmware
520 /* ------------------------------------------------------------------
521 * tda 1004x based cards with philips silicon tuner
524 static int tda8290_i2c_gate_ctrl( struct dvb_frontend
* fe
, int enable
)
526 struct tda1004x_state
*state
= fe
->demodulator_priv
;
528 u8 addr
= state
->config
->i2c_gate
;
529 static u8 tda8290_close
[] = { 0x21, 0xc0};
530 static u8 tda8290_open
[] = { 0x21, 0x80};
531 struct i2c_msg tda8290_msg
= {.addr
= addr
,.flags
= 0, .len
= 2};
533 tda8290_msg
.buf
= tda8290_close
;
535 tda8290_msg
.buf
= tda8290_open
;
537 if (i2c_transfer(state
->i2c
, &tda8290_msg
, 1) != 1) {
538 pr_warn("could not access tda8290 I2C gate\n");
545 static int philips_tda827x_tuner_init(struct dvb_frontend
*fe
)
547 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
548 struct tda1004x_state
*state
= fe
->demodulator_priv
;
550 switch (state
->config
->antenna_switch
) {
554 pr_debug("setting GPIO21 to 0 (TV antenna?)\n");
555 saa7134_set_gpio(dev
, 21, 0);
558 pr_debug("setting GPIO21 to 1 (Radio antenna?)\n");
559 saa7134_set_gpio(dev
, 21, 1);
565 static int philips_tda827x_tuner_sleep(struct dvb_frontend
*fe
)
567 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
568 struct tda1004x_state
*state
= fe
->demodulator_priv
;
570 switch (state
->config
->antenna_switch
) {
574 pr_debug("setting GPIO21 to 1 (Radio antenna?)\n");
575 saa7134_set_gpio(dev
, 21, 1);
578 pr_debug("setting GPIO21 to 0 (TV antenna?)\n");
579 saa7134_set_gpio(dev
, 21, 0);
585 static int configure_tda827x_fe(struct saa7134_dev
*dev
,
586 struct tda1004x_config
*cdec_conf
,
587 struct tda827x_config
*tuner_conf
)
589 struct vb2_dvb_frontend
*fe0
;
591 /* Get the first frontend */
592 fe0
= vb2_dvb_get_frontend(&dev
->frontends
, 1);
597 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
, cdec_conf
, &dev
->i2c_adap
);
598 if (fe0
->dvb
.frontend
) {
599 if (cdec_conf
->i2c_gate
)
600 fe0
->dvb
.frontend
->ops
.i2c_gate_ctrl
= tda8290_i2c_gate_ctrl
;
601 if (dvb_attach(tda827x_attach
, fe0
->dvb
.frontend
,
602 cdec_conf
->tuner_address
,
603 &dev
->i2c_adap
, tuner_conf
))
606 pr_warn("no tda827x tuner found at addr: %02x\n",
607 cdec_conf
->tuner_address
);
612 /* ------------------------------------------------------------------ */
614 static struct tda827x_config tda827x_cfg_0
= {
615 .init
= philips_tda827x_tuner_init
,
616 .sleep
= philips_tda827x_tuner_sleep
,
621 static struct tda827x_config tda827x_cfg_1
= {
622 .init
= philips_tda827x_tuner_init
,
623 .sleep
= philips_tda827x_tuner_sleep
,
628 static struct tda827x_config tda827x_cfg_2
= {
629 .init
= philips_tda827x_tuner_init
,
630 .sleep
= philips_tda827x_tuner_sleep
,
635 static struct tda827x_config tda827x_cfg_2_sw42
= {
636 .init
= philips_tda827x_tuner_init
,
637 .sleep
= philips_tda827x_tuner_sleep
,
642 /* ------------------------------------------------------------------ */
644 static struct tda1004x_config tda827x_lifeview_config
= {
645 .demod_address
= 0x08,
648 .xtal_freq
= TDA10046_XTAL_16M
,
649 .agc_config
= TDA10046_AGC_TDA827X
,
650 .gpio_config
= TDA10046_GP11_I
,
651 .if_freq
= TDA10046_FREQ_045
,
652 .tuner_address
= 0x60,
653 .request_firmware
= philips_tda1004x_request_firmware
656 static struct tda1004x_config philips_tiger_config
= {
657 .demod_address
= 0x08,
660 .xtal_freq
= TDA10046_XTAL_16M
,
661 .agc_config
= TDA10046_AGC_TDA827X
,
662 .gpio_config
= TDA10046_GP11_I
,
663 .if_freq
= TDA10046_FREQ_045
,
665 .tuner_address
= 0x61,
667 .request_firmware
= philips_tda1004x_request_firmware
670 static struct tda1004x_config cinergy_ht_config
= {
671 .demod_address
= 0x08,
674 .xtal_freq
= TDA10046_XTAL_16M
,
675 .agc_config
= TDA10046_AGC_TDA827X
,
676 .gpio_config
= TDA10046_GP01_I
,
677 .if_freq
= TDA10046_FREQ_045
,
679 .tuner_address
= 0x61,
680 .request_firmware
= philips_tda1004x_request_firmware
683 static struct tda1004x_config cinergy_ht_pci_config
= {
684 .demod_address
= 0x08,
687 .xtal_freq
= TDA10046_XTAL_16M
,
688 .agc_config
= TDA10046_AGC_TDA827X
,
689 .gpio_config
= TDA10046_GP01_I
,
690 .if_freq
= TDA10046_FREQ_045
,
692 .tuner_address
= 0x60,
693 .request_firmware
= philips_tda1004x_request_firmware
696 static struct tda1004x_config philips_tiger_s_config
= {
697 .demod_address
= 0x08,
700 .xtal_freq
= TDA10046_XTAL_16M
,
701 .agc_config
= TDA10046_AGC_TDA827X
,
702 .gpio_config
= TDA10046_GP01_I
,
703 .if_freq
= TDA10046_FREQ_045
,
705 .tuner_address
= 0x61,
707 .request_firmware
= philips_tda1004x_request_firmware
710 static struct tda1004x_config pinnacle_pctv_310i_config
= {
711 .demod_address
= 0x08,
714 .xtal_freq
= TDA10046_XTAL_16M
,
715 .agc_config
= TDA10046_AGC_TDA827X
,
716 .gpio_config
= TDA10046_GP11_I
,
717 .if_freq
= TDA10046_FREQ_045
,
719 .tuner_address
= 0x61,
720 .request_firmware
= philips_tda1004x_request_firmware
723 static struct tda1004x_config hauppauge_hvr_1110_config
= {
724 .demod_address
= 0x08,
727 .xtal_freq
= TDA10046_XTAL_16M
,
728 .agc_config
= TDA10046_AGC_TDA827X
,
729 .gpio_config
= TDA10046_GP11_I
,
730 .if_freq
= TDA10046_FREQ_045
,
732 .tuner_address
= 0x61,
733 .request_firmware
= philips_tda1004x_request_firmware
736 static struct tda1004x_config asus_p7131_dual_config
= {
737 .demod_address
= 0x08,
740 .xtal_freq
= TDA10046_XTAL_16M
,
741 .agc_config
= TDA10046_AGC_TDA827X
,
742 .gpio_config
= TDA10046_GP11_I
,
743 .if_freq
= TDA10046_FREQ_045
,
745 .tuner_address
= 0x61,
747 .request_firmware
= philips_tda1004x_request_firmware
750 static struct tda1004x_config lifeview_trio_config
= {
751 .demod_address
= 0x09,
754 .xtal_freq
= TDA10046_XTAL_16M
,
755 .agc_config
= TDA10046_AGC_TDA827X
,
756 .gpio_config
= TDA10046_GP00_I
,
757 .if_freq
= TDA10046_FREQ_045
,
758 .tuner_address
= 0x60,
759 .request_firmware
= philips_tda1004x_request_firmware
762 static struct tda1004x_config tevion_dvbt220rf_config
= {
763 .demod_address
= 0x08,
766 .xtal_freq
= TDA10046_XTAL_16M
,
767 .agc_config
= TDA10046_AGC_TDA827X
,
768 .gpio_config
= TDA10046_GP11_I
,
769 .if_freq
= TDA10046_FREQ_045
,
770 .tuner_address
= 0x60,
771 .request_firmware
= philips_tda1004x_request_firmware
774 static struct tda1004x_config md8800_dvbt_config
= {
775 .demod_address
= 0x08,
778 .xtal_freq
= TDA10046_XTAL_16M
,
779 .agc_config
= TDA10046_AGC_TDA827X
,
780 .gpio_config
= TDA10046_GP01_I
,
781 .if_freq
= TDA10046_FREQ_045
,
783 .tuner_address
= 0x60,
784 .request_firmware
= philips_tda1004x_request_firmware
787 static struct tda1004x_config asus_p7131_4871_config
= {
788 .demod_address
= 0x08,
791 .xtal_freq
= TDA10046_XTAL_16M
,
792 .agc_config
= TDA10046_AGC_TDA827X
,
793 .gpio_config
= TDA10046_GP01_I
,
794 .if_freq
= TDA10046_FREQ_045
,
796 .tuner_address
= 0x61,
798 .request_firmware
= philips_tda1004x_request_firmware
801 static struct tda1004x_config asus_p7131_hybrid_lna_config
= {
802 .demod_address
= 0x08,
805 .xtal_freq
= TDA10046_XTAL_16M
,
806 .agc_config
= TDA10046_AGC_TDA827X
,
807 .gpio_config
= TDA10046_GP11_I
,
808 .if_freq
= TDA10046_FREQ_045
,
810 .tuner_address
= 0x61,
812 .request_firmware
= philips_tda1004x_request_firmware
815 static struct tda1004x_config kworld_dvb_t_210_config
= {
816 .demod_address
= 0x08,
819 .xtal_freq
= TDA10046_XTAL_16M
,
820 .agc_config
= TDA10046_AGC_TDA827X
,
821 .gpio_config
= TDA10046_GP11_I
,
822 .if_freq
= TDA10046_FREQ_045
,
824 .tuner_address
= 0x61,
826 .request_firmware
= philips_tda1004x_request_firmware
829 static struct tda1004x_config avermedia_super_007_config
= {
830 .demod_address
= 0x08,
833 .xtal_freq
= TDA10046_XTAL_16M
,
834 .agc_config
= TDA10046_AGC_TDA827X
,
835 .gpio_config
= TDA10046_GP01_I
,
836 .if_freq
= TDA10046_FREQ_045
,
838 .tuner_address
= 0x60,
840 .request_firmware
= philips_tda1004x_request_firmware
843 static struct tda1004x_config twinhan_dtv_dvb_3056_config
= {
844 .demod_address
= 0x08,
847 .xtal_freq
= TDA10046_XTAL_16M
,
848 .agc_config
= TDA10046_AGC_TDA827X
,
849 .gpio_config
= TDA10046_GP01_I
,
850 .if_freq
= TDA10046_FREQ_045
,
852 .tuner_address
= 0x61,
854 .request_firmware
= philips_tda1004x_request_firmware
857 static struct tda1004x_config asus_tiger_3in1_config
= {
858 .demod_address
= 0x0b,
861 .xtal_freq
= TDA10046_XTAL_16M
,
862 .agc_config
= TDA10046_AGC_TDA827X
,
863 .gpio_config
= TDA10046_GP11_I
,
864 .if_freq
= TDA10046_FREQ_045
,
866 .tuner_address
= 0x61,
868 .request_firmware
= philips_tda1004x_request_firmware
871 static struct tda1004x_config asus_ps3_100_config
= {
872 .demod_address
= 0x0b,
875 .xtal_freq
= TDA10046_XTAL_16M
,
876 .agc_config
= TDA10046_AGC_TDA827X
,
877 .gpio_config
= TDA10046_GP11_I
,
878 .if_freq
= TDA10046_FREQ_045
,
880 .tuner_address
= 0x61,
882 .request_firmware
= philips_tda1004x_request_firmware
885 /* ------------------------------------------------------------------
886 * special case: this card uses saa713x GPIO22 for the mode switch
889 static int ads_duo_tuner_init(struct dvb_frontend
*fe
)
891 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
892 philips_tda827x_tuner_init(fe
);
893 /* route TDA8275a AGC input to the channel decoder */
894 saa7134_set_gpio(dev
, 22, 1);
898 static int ads_duo_tuner_sleep(struct dvb_frontend
*fe
)
900 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
901 /* route TDA8275a AGC input to the analog IF chip*/
902 saa7134_set_gpio(dev
, 22, 0);
903 philips_tda827x_tuner_sleep(fe
);
907 static struct tda827x_config ads_duo_cfg
= {
908 .init
= ads_duo_tuner_init
,
909 .sleep
= ads_duo_tuner_sleep
,
913 static struct tda1004x_config ads_tech_duo_config
= {
914 .demod_address
= 0x08,
917 .xtal_freq
= TDA10046_XTAL_16M
,
918 .agc_config
= TDA10046_AGC_TDA827X
,
919 .gpio_config
= TDA10046_GP00_I
,
920 .if_freq
= TDA10046_FREQ_045
,
921 .tuner_address
= 0x61,
922 .request_firmware
= philips_tda1004x_request_firmware
925 static struct zl10353_config behold_h6_config
= {
926 .demod_address
= 0x1e>>1,
929 .disable_i2c_gate_ctrl
= 1,
932 static struct xc5000_config behold_x7_tunerconfig
= {
933 .i2c_address
= 0xc2>>1,
935 .radio_input
= XC5000_RADIO_FM1
,
938 static struct zl10353_config behold_x7_config
= {
939 .demod_address
= 0x1e>>1,
943 .disable_i2c_gate_ctrl
= 1,
946 static struct zl10353_config videomate_t750_zl10353_config
= {
947 .demod_address
= 0x0f,
950 .disable_i2c_gate_ctrl
= 1,
953 static struct qt1010_config videomate_t750_qt1010_config
= {
958 /* ==================================================================
959 * tda10086 based DVB-S cards, helper functions
962 static struct tda10086_config flydvbs
= {
963 .demod_address
= 0x0e,
966 .xtal_freq
= TDA10086_XTAL_16M
,
969 static struct tda10086_config sd1878_4m
= {
970 .demod_address
= 0x0e,
973 .xtal_freq
= TDA10086_XTAL_4M
,
976 /* ------------------------------------------------------------------
977 * special case: lnb supply is connected to the gated i2c
980 static int md8800_set_voltage(struct dvb_frontend
*fe
,
981 enum fe_sec_voltage voltage
)
984 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
985 if (fe
->ops
.i2c_gate_ctrl
) {
986 fe
->ops
.i2c_gate_ctrl(fe
, 1);
987 if (dev
->original_set_voltage
)
988 res
= dev
->original_set_voltage(fe
, voltage
);
989 fe
->ops
.i2c_gate_ctrl(fe
, 0);
994 static int md8800_set_high_voltage(struct dvb_frontend
*fe
, long arg
)
997 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
998 if (fe
->ops
.i2c_gate_ctrl
) {
999 fe
->ops
.i2c_gate_ctrl(fe
, 1);
1000 if (dev
->original_set_high_voltage
)
1001 res
= dev
->original_set_high_voltage(fe
, arg
);
1002 fe
->ops
.i2c_gate_ctrl(fe
, 0);
1007 static int md8800_set_voltage2(struct dvb_frontend
*fe
,
1008 enum fe_sec_voltage voltage
)
1010 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
1011 u8 wbuf
[2] = { 0x1f, 00 };
1013 struct i2c_msg msg
[] = { { .addr
= 0x08, .flags
= 0, .buf
= wbuf
, .len
= 1 },
1014 { .addr
= 0x08, .flags
= I2C_M_RD
, .buf
= &rbuf
, .len
= 1 } };
1016 if (i2c_transfer(&dev
->i2c_adap
, msg
, 2) != 2)
1018 /* NOTE: this assumes that gpo1 is used, it might be bit 5 (gpo2) */
1019 if (voltage
== SEC_VOLTAGE_18
)
1020 wbuf
[1] = rbuf
| 0x10;
1022 wbuf
[1] = rbuf
& 0xef;
1024 if (i2c_transfer(&dev
->i2c_adap
, msg
, 1) != 1)
1030 static int md8800_set_high_voltage2(struct dvb_frontend
*fe
, long arg
)
1032 pr_warn("%s: sorry can't set high LNB supply voltage from here\n",
1037 /* ==================================================================
1038 * nxt200x based ATSC cards, helper functions
1041 static const struct nxt200x_config avertvhda180
= {
1042 .demod_address
= 0x0a,
1045 static const struct nxt200x_config kworldatsc110
= {
1046 .demod_address
= 0x0a,
1049 /* ------------------------------------------------------------------ */
1051 static struct mt312_config avertv_a700_mt312
= {
1052 .demod_address
= 0x0e,
1053 .voltage_inverted
= 1,
1056 static struct zl10036_config avertv_a700_tuner
= {
1057 .tuner_address
= 0x60,
1060 static struct mt312_config zl10313_compro_s350_config
= {
1061 .demod_address
= 0x0e,
1064 static struct mt312_config zl10313_avermedia_a706_config
= {
1065 .demod_address
= 0x0e,
1068 static struct lgdt3305_config hcw_lgdt3305_config
= {
1070 .mpeg_mode
= LGDT3305_MPEG_SERIAL
,
1071 .tpclk_edge
= LGDT3305_TPCLK_RISING_EDGE
,
1072 .tpvalid_polarity
= LGDT3305_TP_VALID_HIGH
,
1074 .spectral_inversion
= 1,
1079 static struct tda10048_config hcw_tda10048_config
= {
1080 .demod_address
= 0x10 >> 1,
1081 .output_mode
= TDA10048_SERIAL_OUTPUT
,
1082 .fwbulkwritelen
= TDA10048_BULKWRITE_200
,
1083 .inversion
= TDA10048_INVERSION_ON
,
1084 .dtv6_if_freq_khz
= TDA10048_IF_3300
,
1085 .dtv7_if_freq_khz
= TDA10048_IF_3500
,
1086 .dtv8_if_freq_khz
= TDA10048_IF_4000
,
1087 .clk_freq_khz
= TDA10048_CLK_16000
,
1088 .disable_gate_access
= 1,
1091 static struct tda18271_std_map hauppauge_tda18271_std_map
= {
1092 .atsc_6
= { .if_freq
= 3250, .agc_mode
= 3, .std
= 4,
1093 .if_lvl
= 1, .rfagc_top
= 0x58, },
1094 .qam_6
= { .if_freq
= 4000, .agc_mode
= 3, .std
= 5,
1095 .if_lvl
= 1, .rfagc_top
= 0x58, },
1098 static struct tda18271_config hcw_tda18271_config
= {
1099 .std_map
= &hauppauge_tda18271_std_map
,
1100 .gate
= TDA18271_GATE_ANALOG
,
1102 .output_opt
= TDA18271_OUTPUT_LT_OFF
,
1105 static struct tda829x_config tda829x_no_probe
= {
1106 .probe_tuner
= TDA829X_DONT_PROBE
,
1109 static struct tda10048_config zolid_tda10048_config
= {
1110 .demod_address
= 0x10 >> 1,
1111 .output_mode
= TDA10048_PARALLEL_OUTPUT
,
1112 .fwbulkwritelen
= TDA10048_BULKWRITE_200
,
1113 .inversion
= TDA10048_INVERSION_ON
,
1114 .dtv6_if_freq_khz
= TDA10048_IF_3300
,
1115 .dtv7_if_freq_khz
= TDA10048_IF_3500
,
1116 .dtv8_if_freq_khz
= TDA10048_IF_4000
,
1117 .clk_freq_khz
= TDA10048_CLK_16000
,
1118 .disable_gate_access
= 1,
1121 static struct tda18271_config zolid_tda18271_config
= {
1122 .gate
= TDA18271_GATE_ANALOG
,
1125 static struct tda10048_config dtv1000s_tda10048_config
= {
1126 .demod_address
= 0x10 >> 1,
1127 .output_mode
= TDA10048_PARALLEL_OUTPUT
,
1128 .fwbulkwritelen
= TDA10048_BULKWRITE_200
,
1129 .inversion
= TDA10048_INVERSION_ON
,
1130 .dtv6_if_freq_khz
= TDA10048_IF_3300
,
1131 .dtv7_if_freq_khz
= TDA10048_IF_3800
,
1132 .dtv8_if_freq_khz
= TDA10048_IF_4300
,
1133 .clk_freq_khz
= TDA10048_CLK_16000
,
1134 .disable_gate_access
= 1,
1137 static struct tda18271_std_map dtv1000s_tda18271_std_map
= {
1138 .dvbt_6
= { .if_freq
= 3300, .agc_mode
= 3, .std
= 4,
1139 .if_lvl
= 1, .rfagc_top
= 0x37, },
1140 .dvbt_7
= { .if_freq
= 3800, .agc_mode
= 3, .std
= 5,
1141 .if_lvl
= 1, .rfagc_top
= 0x37, },
1142 .dvbt_8
= { .if_freq
= 4300, .agc_mode
= 3, .std
= 6,
1143 .if_lvl
= 1, .rfagc_top
= 0x37, },
1146 static struct tda18271_config dtv1000s_tda18271_config
= {
1147 .std_map
= &dtv1000s_tda18271_std_map
,
1148 .gate
= TDA18271_GATE_ANALOG
,
1151 static struct lgs8gxx_config prohdtv_pro2_lgs8g75_config
= {
1152 .prod
= LGS8GXX_PROD_LGS8G75
,
1153 .demod_address
= 0x1d,
1157 .if_clk_freq
= 30400, /* 30.4 MHz */
1158 .if_freq
= 4000, /* 4.00 MHz */
1162 .adc_vpp
= 3, /* 2.0 Vpp */
1166 static struct tda18271_config prohdtv_pro2_tda18271_config
= {
1167 .gate
= TDA18271_GATE_ANALOG
,
1168 .output_opt
= TDA18271_OUTPUT_LT_OFF
,
1171 static struct tda18271_std_map kworld_tda18271_std_map
= {
1172 .atsc_6
= { .if_freq
= 3250, .agc_mode
= 3, .std
= 3,
1173 .if_lvl
= 6, .rfagc_top
= 0x37 },
1174 .qam_6
= { .if_freq
= 4000, .agc_mode
= 3, .std
= 0,
1175 .if_lvl
= 6, .rfagc_top
= 0x37 },
1178 static struct tda18271_config kworld_pc150u_tda18271_config
= {
1179 .std_map
= &kworld_tda18271_std_map
,
1180 .gate
= TDA18271_GATE_ANALOG
,
1181 .output_opt
= TDA18271_OUTPUT_LT_OFF
,
1182 .config
= 3, /* Use tuner callback for AGC */
1183 .rf_cal_on_startup
= 1
1186 static struct s5h1411_config kworld_s5h1411_config
= {
1187 .output_mode
= S5H1411_PARALLEL_OUTPUT
,
1188 .gpio
= S5H1411_GPIO_OFF
,
1189 .qam_if
= S5H1411_IF_4000
,
1190 .vsb_if
= S5H1411_IF_3250
,
1191 .inversion
= S5H1411_INVERSION_ON
,
1192 .status_mode
= S5H1411_DEMODLOCKING
,
1194 S5H1411_MPEGTIMING_CONTINUOUS_NONINVERTING_CLOCK
,
1197 static struct tda18271_config hdtv200h_tda18271_config
= {
1198 .gate
= TDA18271_GATE_ANALOG
,
1199 .config
= 3 /* Use tuner callback for AGC */
1202 static struct s5h1411_config hdtv200h_s5h1411_config
= {
1203 .output_mode
= S5H1411_PARALLEL_OUTPUT
,
1204 .gpio
= S5H1411_GPIO_OFF
,
1205 .qam_if
= S5H1411_IF_4000
,
1206 .vsb_if
= S5H1411_IF_3250
,
1207 .inversion
= S5H1411_INVERSION_ON
,
1208 .status_mode
= S5H1411_DEMODLOCKING
,
1210 S5H1411_MPEGTIMING_CONTINUOUS_NONINVERTING_CLOCK
,
1214 /* ==================================================================
1218 static int dvb_init(struct saa7134_dev
*dev
)
1221 int attach_xc3028
= 0;
1222 struct vb2_dvb_frontend
*fe0
;
1223 struct vb2_queue
*q
;
1225 /* FIXME: add support for multi-frontend */
1226 mutex_init(&dev
->frontends
.lock
);
1227 INIT_LIST_HEAD(&dev
->frontends
.felist
);
1229 pr_info("%s() allocating 1 frontend\n", __func__
);
1230 fe0
= vb2_dvb_alloc_frontend(&dev
->frontends
, 1);
1232 pr_err("%s() failed to alloc\n", __func__
);
1236 /* init struct vb2_dvb */
1237 dev
->ts
.nr_bufs
= 32;
1238 dev
->ts
.nr_packets
= 32*4;
1239 fe0
->dvb
.name
= dev
->name
;
1241 q
->type
= V4L2_BUF_TYPE_VIDEO_CAPTURE
;
1242 q
->io_modes
= VB2_MMAP
| VB2_READ
;
1243 q
->drv_priv
= &dev
->ts_q
;
1244 q
->ops
= &saa7134_ts_qops
;
1245 q
->mem_ops
= &vb2_dma_sg_memops
;
1246 q
->buf_struct_size
= sizeof(struct saa7134_buf
);
1247 q
->timestamp_flags
= V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC
;
1248 q
->lock
= &dev
->lock
;
1249 q
->dev
= &dev
->pci
->dev
;
1250 ret
= vb2_queue_init(q
);
1252 vb2_dvb_dealloc_frontends(&dev
->frontends
);
1256 switch (dev
->board
) {
1257 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL
:
1258 pr_debug("pinnacle 300i dvb setup\n");
1259 fe0
->dvb
.frontend
= dvb_attach(mt352_attach
, &pinnacle_300i
,
1261 if (fe0
->dvb
.frontend
) {
1262 fe0
->dvb
.frontend
->ops
.tuner_ops
.set_params
= mt352_pinnacle_tuner_set_params
;
1265 case SAA7134_BOARD_AVERMEDIA_777
:
1266 case SAA7134_BOARD_AVERMEDIA_A16AR
:
1267 pr_debug("avertv 777 dvb setup\n");
1268 fe0
->dvb
.frontend
= dvb_attach(mt352_attach
, &avermedia_777
,
1270 if (fe0
->dvb
.frontend
) {
1271 dvb_attach(simple_tuner_attach
, fe0
->dvb
.frontend
,
1272 &dev
->i2c_adap
, 0x61,
1273 TUNER_PHILIPS_TD1316
);
1276 case SAA7134_BOARD_AVERMEDIA_A16D
:
1277 pr_debug("AverMedia A16D dvb setup\n");
1278 fe0
->dvb
.frontend
= dvb_attach(mt352_attach
,
1279 &avermedia_xc3028_mt352_dev
,
1283 case SAA7134_BOARD_MD7134
:
1284 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1287 if (fe0
->dvb
.frontend
) {
1289 * The TV tuner on this board is actually NOT
1290 * behind the demod i2c gate.
1291 * However, the demod EEPROM is indeed there and it
1292 * conflicts with the SAA7134 chip config EEPROM
1293 * if the i2c gate is open (since they have same
1294 * bus addresses) resulting in card PCI SVID / SSID
1295 * being garbage after a reboot from time to time.
1297 * Let's just leave the gate permanently closed -
1298 * saa7134_i2c_eeprom_md7134_gate() will close it for
1299 * us at probe time if it was open for some reason.
1301 fe0
->dvb
.frontend
->ops
.i2c_gate_ctrl
= NULL
;
1302 dvb_attach(simple_tuner_attach
, fe0
->dvb
.frontend
,
1303 &dev
->i2c_adap
, medion_cardbus
.tuner_address
,
1304 TUNER_PHILIPS_FMD1216ME_MK3
);
1307 case SAA7134_BOARD_PHILIPS_TOUGH
:
1308 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1309 &philips_tu1216_60_config
,
1311 if (fe0
->dvb
.frontend
) {
1312 fe0
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tu1216_init
;
1313 fe0
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tda6651_pll_set
;
1316 case SAA7134_BOARD_FLYDVBTDUO
:
1317 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS
:
1318 if (configure_tda827x_fe(dev
, &tda827x_lifeview_config
,
1319 &tda827x_cfg_0
) < 0)
1320 goto detach_frontend
;
1322 case SAA7134_BOARD_PHILIPS_EUROPA
:
1323 case SAA7134_BOARD_VIDEOMATE_DVBT_300
:
1324 case SAA7134_BOARD_ASUS_EUROPA_HYBRID
:
1325 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1326 &philips_europa_config
,
1328 if (fe0
->dvb
.frontend
) {
1329 dev
->original_demod_sleep
= fe0
->dvb
.frontend
->ops
.sleep
;
1330 fe0
->dvb
.frontend
->ops
.sleep
= philips_europa_demod_sleep
;
1331 fe0
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_europa_tuner_init
;
1332 fe0
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_europa_tuner_sleep
;
1333 fe0
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_td1316_tuner_set_params
;
1336 case SAA7134_BOARD_TECHNOTREND_BUDGET_T3000
:
1337 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1338 &technotrend_budget_t3000_config
,
1340 if (fe0
->dvb
.frontend
) {
1341 dev
->original_demod_sleep
= fe0
->dvb
.frontend
->ops
.sleep
;
1342 fe0
->dvb
.frontend
->ops
.sleep
= philips_europa_demod_sleep
;
1343 fe0
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_europa_tuner_init
;
1344 fe0
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_europa_tuner_sleep
;
1345 fe0
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_td1316_tuner_set_params
;
1348 case SAA7134_BOARD_VIDEOMATE_DVBT_200
:
1349 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1350 &philips_tu1216_61_config
,
1352 if (fe0
->dvb
.frontend
) {
1353 fe0
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tu1216_init
;
1354 fe0
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tda6651_pll_set
;
1357 case SAA7134_BOARD_KWORLD_DVBT_210
:
1358 if (configure_tda827x_fe(dev
, &kworld_dvb_t_210_config
,
1359 &tda827x_cfg_2
) < 0)
1360 goto detach_frontend
;
1362 case SAA7134_BOARD_HAUPPAUGE_HVR1120
:
1363 fe0
->dvb
.frontend
= dvb_attach(tda10048_attach
,
1364 &hcw_tda10048_config
,
1366 if (fe0
->dvb
.frontend
!= NULL
) {
1367 dvb_attach(tda829x_attach
, fe0
->dvb
.frontend
,
1368 &dev
->i2c_adap
, 0x4b,
1370 dvb_attach(tda18271_attach
, fe0
->dvb
.frontend
,
1371 0x60, &dev
->i2c_adap
,
1372 &hcw_tda18271_config
);
1375 case SAA7134_BOARD_PHILIPS_TIGER
:
1376 if (configure_tda827x_fe(dev
, &philips_tiger_config
,
1377 &tda827x_cfg_0
) < 0)
1378 goto detach_frontend
;
1380 case SAA7134_BOARD_PINNACLE_PCTV_310i
:
1381 if (configure_tda827x_fe(dev
, &pinnacle_pctv_310i_config
,
1382 &tda827x_cfg_1
) < 0)
1383 goto detach_frontend
;
1385 case SAA7134_BOARD_HAUPPAUGE_HVR1110
:
1386 if (configure_tda827x_fe(dev
, &hauppauge_hvr_1110_config
,
1387 &tda827x_cfg_1
) < 0)
1388 goto detach_frontend
;
1390 case SAA7134_BOARD_HAUPPAUGE_HVR1150
:
1391 fe0
->dvb
.frontend
= dvb_attach(lgdt3305_attach
,
1392 &hcw_lgdt3305_config
,
1394 if (fe0
->dvb
.frontend
) {
1395 dvb_attach(tda829x_attach
, fe0
->dvb
.frontend
,
1396 &dev
->i2c_adap
, 0x4b,
1398 dvb_attach(tda18271_attach
, fe0
->dvb
.frontend
,
1399 0x60, &dev
->i2c_adap
,
1400 &hcw_tda18271_config
);
1403 case SAA7134_BOARD_ASUSTeK_P7131_DUAL
:
1404 if (configure_tda827x_fe(dev
, &asus_p7131_dual_config
,
1405 &tda827x_cfg_0
) < 0)
1406 goto detach_frontend
;
1408 case SAA7134_BOARD_FLYDVBT_LR301
:
1409 if (configure_tda827x_fe(dev
, &tda827x_lifeview_config
,
1410 &tda827x_cfg_0
) < 0)
1411 goto detach_frontend
;
1413 case SAA7134_BOARD_FLYDVB_TRIO
:
1414 if (!use_frontend
) { /* terrestrial */
1415 if (configure_tda827x_fe(dev
, &lifeview_trio_config
,
1416 &tda827x_cfg_0
) < 0)
1417 goto detach_frontend
;
1418 } else { /* satellite */
1419 fe0
->dvb
.frontend
= dvb_attach(tda10086_attach
, &flydvbs
, &dev
->i2c_adap
);
1420 if (fe0
->dvb
.frontend
) {
1421 if (dvb_attach(tda826x_attach
, fe0
->dvb
.frontend
, 0x63,
1422 &dev
->i2c_adap
, 0) == NULL
) {
1423 pr_warn("%s: Lifeview Trio, No tda826x found!\n",
1425 goto detach_frontend
;
1427 if (dvb_attach(isl6421_attach
, fe0
->dvb
.frontend
,
1429 0x08, 0, 0, false) == NULL
) {
1430 pr_warn("%s: Lifeview Trio, No ISL6421 found!\n",
1432 goto detach_frontend
;
1437 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331
:
1438 case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS
:
1439 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1440 &ads_tech_duo_config
,
1442 if (fe0
->dvb
.frontend
) {
1443 if (dvb_attach(tda827x_attach
,fe0
->dvb
.frontend
,
1444 ads_tech_duo_config
.tuner_address
, &dev
->i2c_adap
,
1445 &ads_duo_cfg
) == NULL
) {
1446 pr_warn("no tda827x tuner found at addr: %02x\n",
1447 ads_tech_duo_config
.tuner_address
);
1448 goto detach_frontend
;
1451 pr_warn("failed to attach tda10046\n");
1453 case SAA7134_BOARD_TEVION_DVBT_220RF
:
1454 if (configure_tda827x_fe(dev
, &tevion_dvbt220rf_config
,
1455 &tda827x_cfg_0
) < 0)
1456 goto detach_frontend
;
1458 case SAA7134_BOARD_MEDION_MD8800_QUADRO
:
1459 if (!use_frontend
) { /* terrestrial */
1460 if (configure_tda827x_fe(dev
, &md8800_dvbt_config
,
1461 &tda827x_cfg_0
) < 0)
1462 goto detach_frontend
;
1463 } else { /* satellite */
1464 fe0
->dvb
.frontend
= dvb_attach(tda10086_attach
,
1465 &flydvbs
, &dev
->i2c_adap
);
1466 if (fe0
->dvb
.frontend
) {
1467 struct dvb_frontend
*fe
= fe0
->dvb
.frontend
;
1468 u8 dev_id
= dev
->eedata
[2];
1470 struct i2c_msg msg
= {.addr
= 0x08, .flags
= 0, .len
= 1};
1472 if (dvb_attach(tda826x_attach
, fe0
->dvb
.frontend
,
1473 0x60, &dev
->i2c_adap
, 0) == NULL
) {
1474 pr_warn("%s: Medion Quadro, no tda826x found !\n",
1476 goto detach_frontend
;
1478 if (dev_id
!= 0x08) {
1479 /* we need to open the i2c gate (we know it exists) */
1480 fe
->ops
.i2c_gate_ctrl(fe
, 1);
1481 if (dvb_attach(isl6405_attach
, fe
,
1482 &dev
->i2c_adap
, 0x08, 0, 0) == NULL
) {
1483 pr_warn("%s: Medion Quadro, no ISL6405 found !\n",
1485 goto detach_frontend
;
1487 if (dev_id
== 0x07) {
1488 /* fire up the 2nd section of the LNB supply since
1489 we can't do this from the other section */
1491 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
1493 fe
->ops
.i2c_gate_ctrl(fe
, 0);
1494 dev
->original_set_voltage
= fe
->ops
.set_voltage
;
1495 fe
->ops
.set_voltage
= md8800_set_voltage
;
1496 dev
->original_set_high_voltage
= fe
->ops
.enable_high_lnb_voltage
;
1497 fe
->ops
.enable_high_lnb_voltage
= md8800_set_high_voltage
;
1499 fe
->ops
.set_voltage
= md8800_set_voltage2
;
1500 fe
->ops
.enable_high_lnb_voltage
= md8800_set_high_voltage2
;
1505 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180
:
1506 fe0
->dvb
.frontend
= dvb_attach(nxt200x_attach
, &avertvhda180
,
1508 if (fe0
->dvb
.frontend
)
1509 dvb_attach(dvb_pll_attach
, fe0
->dvb
.frontend
, 0x61,
1510 NULL
, DVB_PLL_TDHU2
);
1512 case SAA7134_BOARD_ADS_INSTANT_HDTV_PCI
:
1513 case SAA7134_BOARD_KWORLD_ATSC110
:
1514 fe0
->dvb
.frontend
= dvb_attach(nxt200x_attach
, &kworldatsc110
,
1516 if (fe0
->dvb
.frontend
)
1517 dvb_attach(simple_tuner_attach
, fe0
->dvb
.frontend
,
1518 &dev
->i2c_adap
, 0x61,
1519 TUNER_PHILIPS_TUV1236D
);
1521 case SAA7134_BOARD_KWORLD_PC150U
:
1522 saa7134_set_gpio(dev
, 18, 1); /* Switch to digital mode */
1523 saa7134_tuner_callback(dev
, 0,
1524 TDA18271_CALLBACK_CMD_AGC_ENABLE
, 1);
1525 fe0
->dvb
.frontend
= dvb_attach(s5h1411_attach
,
1526 &kworld_s5h1411_config
,
1528 if (fe0
->dvb
.frontend
!= NULL
) {
1529 dvb_attach(tda829x_attach
, fe0
->dvb
.frontend
,
1530 &dev
->i2c_adap
, 0x4b,
1532 dvb_attach(tda18271_attach
, fe0
->dvb
.frontend
,
1533 0x60, &dev
->i2c_adap
,
1534 &kworld_pc150u_tda18271_config
);
1537 case SAA7134_BOARD_FLYDVBS_LR300
:
1538 fe0
->dvb
.frontend
= dvb_attach(tda10086_attach
, &flydvbs
,
1540 if (fe0
->dvb
.frontend
) {
1541 if (dvb_attach(tda826x_attach
, fe0
->dvb
.frontend
, 0x60,
1542 &dev
->i2c_adap
, 0) == NULL
) {
1543 pr_warn("%s: No tda826x found!\n", __func__
);
1544 goto detach_frontend
;
1546 if (dvb_attach(isl6421_attach
, fe0
->dvb
.frontend
,
1548 0x08, 0, 0, false) == NULL
) {
1549 pr_warn("%s: No ISL6421 found!\n", __func__
);
1550 goto detach_frontend
;
1554 case SAA7134_BOARD_ASUS_EUROPA2_HYBRID
:
1555 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1558 if (fe0
->dvb
.frontend
) {
1559 dev
->original_demod_sleep
= fe0
->dvb
.frontend
->ops
.sleep
;
1560 fe0
->dvb
.frontend
->ops
.sleep
= philips_europa_demod_sleep
;
1562 dvb_attach(simple_tuner_attach
, fe0
->dvb
.frontend
,
1563 &dev
->i2c_adap
, medion_cardbus
.tuner_address
,
1564 TUNER_PHILIPS_FMD1216ME_MK3
);
1567 case SAA7134_BOARD_VIDEOMATE_DVBT_200A
:
1568 fe0
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1569 &philips_europa_config
,
1571 if (fe0
->dvb
.frontend
) {
1572 fe0
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_td1316_tuner_init
;
1573 fe0
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_td1316_tuner_set_params
;
1576 case SAA7134_BOARD_CINERGY_HT_PCMCIA
:
1577 if (configure_tda827x_fe(dev
, &cinergy_ht_config
,
1578 &tda827x_cfg_0
) < 0)
1579 goto detach_frontend
;
1581 case SAA7134_BOARD_CINERGY_HT_PCI
:
1582 if (configure_tda827x_fe(dev
, &cinergy_ht_pci_config
,
1583 &tda827x_cfg_0
) < 0)
1584 goto detach_frontend
;
1586 case SAA7134_BOARD_PHILIPS_TIGER_S
:
1587 if (configure_tda827x_fe(dev
, &philips_tiger_s_config
,
1588 &tda827x_cfg_2
) < 0)
1589 goto detach_frontend
;
1591 case SAA7134_BOARD_ASUS_P7131_4871
:
1592 if (configure_tda827x_fe(dev
, &asus_p7131_4871_config
,
1593 &tda827x_cfg_2
) < 0)
1594 goto detach_frontend
;
1596 case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA
:
1597 if (configure_tda827x_fe(dev
, &asus_p7131_hybrid_lna_config
,
1598 &tda827x_cfg_2
) < 0)
1599 goto detach_frontend
;
1601 case SAA7134_BOARD_AVERMEDIA_SUPER_007
:
1602 if (configure_tda827x_fe(dev
, &avermedia_super_007_config
,
1603 &tda827x_cfg_0
) < 0)
1604 goto detach_frontend
;
1606 case SAA7134_BOARD_TWINHAN_DTV_DVB_3056
:
1607 if (configure_tda827x_fe(dev
, &twinhan_dtv_dvb_3056_config
,
1608 &tda827x_cfg_2_sw42
) < 0)
1609 goto detach_frontend
;
1611 case SAA7134_BOARD_PHILIPS_SNAKE
:
1612 fe0
->dvb
.frontend
= dvb_attach(tda10086_attach
, &flydvbs
,
1614 if (fe0
->dvb
.frontend
) {
1615 if (dvb_attach(tda826x_attach
, fe0
->dvb
.frontend
, 0x60,
1616 &dev
->i2c_adap
, 0) == NULL
) {
1617 pr_warn("%s: No tda826x found!\n", __func__
);
1618 goto detach_frontend
;
1620 if (dvb_attach(lnbp21_attach
, fe0
->dvb
.frontend
,
1621 &dev
->i2c_adap
, 0, 0) == NULL
) {
1622 pr_warn("%s: No lnbp21 found!\n", __func__
);
1623 goto detach_frontend
;
1627 case SAA7134_BOARD_CREATIX_CTX953
:
1628 if (configure_tda827x_fe(dev
, &md8800_dvbt_config
,
1629 &tda827x_cfg_0
) < 0)
1630 goto detach_frontend
;
1632 case SAA7134_BOARD_MSI_TVANYWHERE_AD11
:
1633 if (configure_tda827x_fe(dev
, &philips_tiger_s_config
,
1634 &tda827x_cfg_2
) < 0)
1635 goto detach_frontend
;
1637 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506
:
1638 pr_debug("AverMedia E506R dvb setup\n");
1639 saa7134_set_gpio(dev
, 25, 0);
1641 saa7134_set_gpio(dev
, 25, 1);
1642 fe0
->dvb
.frontend
= dvb_attach(mt352_attach
,
1643 &avermedia_xc3028_mt352_dev
,
1647 case SAA7134_BOARD_MD7134_BRIDGE_2
:
1648 fe0
->dvb
.frontend
= dvb_attach(tda10086_attach
,
1649 &sd1878_4m
, &dev
->i2c_adap
);
1650 if (fe0
->dvb
.frontend
) {
1651 struct dvb_frontend
*fe
;
1652 if (dvb_attach(dvb_pll_attach
, fe0
->dvb
.frontend
, 0x60,
1653 &dev
->i2c_adap
, DVB_PLL_PHILIPS_SD1878_TDA8261
) == NULL
) {
1654 pr_warn("%s: MD7134 DVB-S, no SD1878 found !\n",
1656 goto detach_frontend
;
1658 /* we need to open the i2c gate (we know it exists) */
1659 fe
= fe0
->dvb
.frontend
;
1660 fe
->ops
.i2c_gate_ctrl(fe
, 1);
1661 if (dvb_attach(isl6405_attach
, fe
,
1662 &dev
->i2c_adap
, 0x08, 0, 0) == NULL
) {
1663 pr_warn("%s: MD7134 DVB-S, no ISL6405 found !\n",
1665 goto detach_frontend
;
1667 fe
->ops
.i2c_gate_ctrl(fe
, 0);
1668 dev
->original_set_voltage
= fe
->ops
.set_voltage
;
1669 fe
->ops
.set_voltage
= md8800_set_voltage
;
1670 dev
->original_set_high_voltage
= fe
->ops
.enable_high_lnb_voltage
;
1671 fe
->ops
.enable_high_lnb_voltage
= md8800_set_high_voltage
;
1674 case SAA7134_BOARD_AVERMEDIA_M103
:
1675 saa7134_set_gpio(dev
, 25, 0);
1677 saa7134_set_gpio(dev
, 25, 1);
1678 fe0
->dvb
.frontend
= dvb_attach(mt352_attach
,
1679 &avermedia_xc3028_mt352_dev
,
1683 case SAA7134_BOARD_ASUSTeK_TIGER_3IN1
:
1684 if (!use_frontend
) { /* terrestrial */
1685 if (configure_tda827x_fe(dev
, &asus_tiger_3in1_config
,
1686 &tda827x_cfg_2
) < 0)
1687 goto detach_frontend
;
1688 } else { /* satellite */
1689 fe0
->dvb
.frontend
= dvb_attach(tda10086_attach
,
1690 &flydvbs
, &dev
->i2c_adap
);
1691 if (fe0
->dvb
.frontend
) {
1692 if (dvb_attach(tda826x_attach
,
1693 fe0
->dvb
.frontend
, 0x60,
1694 &dev
->i2c_adap
, 0) == NULL
) {
1695 pr_warn("%s: Asus Tiger 3in1, no tda826x found!\n",
1697 goto detach_frontend
;
1699 if (dvb_attach(lnbp21_attach
, fe0
->dvb
.frontend
,
1700 &dev
->i2c_adap
, 0, 0) == NULL
) {
1701 pr_warn("%s: Asus Tiger 3in1, no lnbp21 found!\n",
1703 goto detach_frontend
;
1708 case SAA7134_BOARD_ASUSTeK_PS3_100
:
1709 if (!use_frontend
) { /* terrestrial */
1710 if (configure_tda827x_fe(dev
, &asus_ps3_100_config
,
1711 &tda827x_cfg_2
) < 0)
1712 goto detach_frontend
;
1713 } else { /* satellite */
1714 fe0
->dvb
.frontend
= dvb_attach(tda10086_attach
,
1715 &flydvbs
, &dev
->i2c_adap
);
1716 if (fe0
->dvb
.frontend
) {
1717 if (dvb_attach(tda826x_attach
,
1718 fe0
->dvb
.frontend
, 0x60,
1719 &dev
->i2c_adap
, 0) == NULL
) {
1720 pr_warn("%s: Asus My Cinema PS3-100, no tda826x found!\n",
1722 goto detach_frontend
;
1724 if (dvb_attach(lnbp21_attach
, fe0
->dvb
.frontend
,
1725 &dev
->i2c_adap
, 0, 0) == NULL
) {
1726 pr_warn("%s: Asus My Cinema PS3-100, no lnbp21 found!\n",
1728 goto detach_frontend
;
1733 case SAA7134_BOARD_ASUSTeK_TIGER
:
1734 if (configure_tda827x_fe(dev
, &philips_tiger_config
,
1735 &tda827x_cfg_0
) < 0)
1736 goto detach_frontend
;
1738 case SAA7134_BOARD_BEHOLD_H6
:
1739 fe0
->dvb
.frontend
= dvb_attach(zl10353_attach
,
1742 if (fe0
->dvb
.frontend
) {
1743 dvb_attach(simple_tuner_attach
, fe0
->dvb
.frontend
,
1744 &dev
->i2c_adap
, 0x61,
1745 TUNER_PHILIPS_FMD1216MEX_MK3
);
1748 case SAA7134_BOARD_BEHOLD_X7
:
1749 fe0
->dvb
.frontend
= dvb_attach(zl10353_attach
,
1752 if (fe0
->dvb
.frontend
) {
1753 dvb_attach(xc5000_attach
, fe0
->dvb
.frontend
,
1754 &dev
->i2c_adap
, &behold_x7_tunerconfig
);
1757 case SAA7134_BOARD_BEHOLD_H7
:
1758 fe0
->dvb
.frontend
= dvb_attach(zl10353_attach
,
1761 if (fe0
->dvb
.frontend
) {
1762 dvb_attach(xc5000_attach
, fe0
->dvb
.frontend
,
1763 &dev
->i2c_adap
, &behold_x7_tunerconfig
);
1766 case SAA7134_BOARD_AVERMEDIA_A700_PRO
:
1767 case SAA7134_BOARD_AVERMEDIA_A700_HYBRID
:
1768 /* Zarlink ZL10313 */
1769 fe0
->dvb
.frontend
= dvb_attach(mt312_attach
,
1770 &avertv_a700_mt312
, &dev
->i2c_adap
);
1771 if (fe0
->dvb
.frontend
) {
1772 if (dvb_attach(zl10036_attach
, fe0
->dvb
.frontend
,
1773 &avertv_a700_tuner
, &dev
->i2c_adap
) == NULL
) {
1774 pr_warn("%s: No zl10036 found!\n",
1779 case SAA7134_BOARD_VIDEOMATE_S350
:
1780 fe0
->dvb
.frontend
= dvb_attach(mt312_attach
,
1781 &zl10313_compro_s350_config
, &dev
->i2c_adap
);
1782 if (fe0
->dvb
.frontend
)
1783 if (dvb_attach(zl10039_attach
, fe0
->dvb
.frontend
,
1784 0x60, &dev
->i2c_adap
) == NULL
)
1785 pr_warn("%s: No zl10039 found!\n",
1789 case SAA7134_BOARD_VIDEOMATE_T750
:
1790 fe0
->dvb
.frontend
= dvb_attach(zl10353_attach
,
1791 &videomate_t750_zl10353_config
,
1793 if (fe0
->dvb
.frontend
!= NULL
) {
1794 if (dvb_attach(qt1010_attach
,
1797 &videomate_t750_qt1010_config
) == NULL
)
1798 pr_warn("error attaching QT1010\n");
1801 case SAA7134_BOARD_ZOLID_HYBRID_PCI
:
1802 fe0
->dvb
.frontend
= dvb_attach(tda10048_attach
,
1803 &zolid_tda10048_config
,
1805 if (fe0
->dvb
.frontend
!= NULL
) {
1806 dvb_attach(tda829x_attach
, fe0
->dvb
.frontend
,
1807 &dev
->i2c_adap
, 0x4b,
1809 dvb_attach(tda18271_attach
, fe0
->dvb
.frontend
,
1810 0x60, &dev
->i2c_adap
,
1811 &zolid_tda18271_config
);
1814 case SAA7134_BOARD_LEADTEK_WINFAST_DTV1000S
:
1815 fe0
->dvb
.frontend
= dvb_attach(tda10048_attach
,
1816 &dtv1000s_tda10048_config
,
1818 if (fe0
->dvb
.frontend
!= NULL
) {
1819 dvb_attach(tda829x_attach
, fe0
->dvb
.frontend
,
1820 &dev
->i2c_adap
, 0x4b,
1822 dvb_attach(tda18271_attach
, fe0
->dvb
.frontend
,
1823 0x60, &dev
->i2c_adap
,
1824 &dtv1000s_tda18271_config
);
1827 case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG
:
1828 /* Switch to digital mode */
1829 saa7134_tuner_callback(dev
, 0,
1830 TDA18271_CALLBACK_CMD_AGC_ENABLE
, 1);
1831 fe0
->dvb
.frontend
= dvb_attach(mb86a20s_attach
,
1832 &kworld_mb86a20s_config
,
1834 if (fe0
->dvb
.frontend
!= NULL
) {
1835 dvb_attach(tda829x_attach
, fe0
->dvb
.frontend
,
1836 &dev
->i2c_adap
, 0x4b,
1838 fe0
->dvb
.frontend
->ops
.i2c_gate_ctrl
= kworld_sbtvd_gate_ctrl
;
1839 dvb_attach(tda18271_attach
, fe0
->dvb
.frontend
,
1840 0x60, &dev
->i2c_adap
,
1841 &kworld_tda18271_config
);
1844 /* mb86a20s need to use the I2C gateway */
1846 case SAA7134_BOARD_MAGICPRO_PROHDTV_PRO2
:
1847 fe0
->dvb
.frontend
= dvb_attach(lgs8gxx_attach
,
1848 &prohdtv_pro2_lgs8g75_config
,
1850 if (fe0
->dvb
.frontend
!= NULL
) {
1851 dvb_attach(tda829x_attach
, fe0
->dvb
.frontend
,
1852 &dev
->i2c_adap
, 0x4b,
1854 dvb_attach(tda18271_attach
, fe0
->dvb
.frontend
,
1855 0x60, &dev
->i2c_adap
,
1856 &prohdtv_pro2_tda18271_config
);
1859 case SAA7134_BOARD_AVERMEDIA_A706
:
1860 /* Enable all DVB-S devices now */
1861 /* CE5039 DVB-S tuner SLEEP pin low */
1862 saa7134_set_gpio(dev
, 23, 0);
1863 /* CE6313 DVB-S demod SLEEP pin low */
1864 saa7134_set_gpio(dev
, 9, 0);
1865 /* CE6313 DVB-S demod RESET# pin high */
1866 saa7134_set_gpio(dev
, 25, 1);
1868 fe0
->dvb
.frontend
= dvb_attach(mt312_attach
,
1869 &zl10313_avermedia_a706_config
, &dev
->i2c_adap
);
1870 if (fe0
->dvb
.frontend
) {
1871 fe0
->dvb
.frontend
->ops
.i2c_gate_ctrl
= NULL
;
1872 if (dvb_attach(zl10039_attach
, fe0
->dvb
.frontend
,
1873 0x60, &dev
->i2c_adap
) == NULL
)
1874 pr_warn("%s: No zl10039 found!\n",
1878 case SAA7134_BOARD_LEADTEK_WINFAST_HDTV200_H
:
1879 fe0
->dvb
.frontend
= dvb_attach(s5h1411_attach
,
1880 &hdtv200h_s5h1411_config
,
1882 if (fe0
->dvb
.frontend
) {
1883 dvb_attach(tda829x_attach
, fe0
->dvb
.frontend
,
1884 &dev
->i2c_adap
, 0x4b,
1886 dvb_attach(tda18271_attach
, fe0
->dvb
.frontend
,
1887 0x60, &dev
->i2c_adap
,
1888 &hdtv200h_tda18271_config
);
1892 pr_warn("Huh? unknown DVB card?\n");
1896 if (attach_xc3028
) {
1897 struct dvb_frontend
*fe
;
1898 struct xc2028_config cfg
= {
1899 .i2c_adap
= &dev
->i2c_adap
,
1903 if (!fe0
->dvb
.frontend
)
1904 goto detach_frontend
;
1906 fe
= dvb_attach(xc2028_attach
, fe0
->dvb
.frontend
, &cfg
);
1908 pr_err("%s/2: xc3028 attach failed\n",
1910 goto detach_frontend
;
1914 if (NULL
== fe0
->dvb
.frontend
) {
1915 pr_err("%s/dvb: frontend initialization failed\n", dev
->name
);
1916 goto detach_frontend
;
1918 /* define general-purpose callback pointer */
1919 fe0
->dvb
.frontend
->callback
= saa7134_tuner_callback
;
1921 /* register everything else */
1922 #ifndef CONFIG_MEDIA_CONTROLLER_DVB
1923 ret
= vb2_dvb_register_bus(&dev
->frontends
, THIS_MODULE
, dev
,
1924 &dev
->pci
->dev
, NULL
,
1927 ret
= vb2_dvb_register_bus(&dev
->frontends
, THIS_MODULE
, dev
,
1928 &dev
->pci
->dev
, dev
->media_dev
,
1932 /* this sequence is necessary to make the tda1004x load its firmware
1933 * and to enter analog mode of hybrid boards
1936 if (fe0
->dvb
.frontend
->ops
.init
)
1937 fe0
->dvb
.frontend
->ops
.init(fe0
->dvb
.frontend
);
1938 if (fe0
->dvb
.frontend
->ops
.sleep
)
1939 fe0
->dvb
.frontend
->ops
.sleep(fe0
->dvb
.frontend
);
1940 if (fe0
->dvb
.frontend
->ops
.tuner_ops
.sleep
)
1941 fe0
->dvb
.frontend
->ops
.tuner_ops
.sleep(fe0
->dvb
.frontend
);
1946 vb2_dvb_dealloc_frontends(&dev
->frontends
);
1947 vb2_queue_release(&fe0
->dvb
.dvbq
);
1951 static int dvb_fini(struct saa7134_dev
*dev
)
1953 struct vb2_dvb_frontend
*fe0
;
1955 /* Get the first frontend */
1956 fe0
= vb2_dvb_get_frontend(&dev
->frontends
, 1);
1960 /* FIXME: I suspect that this code is bogus, since the entry for
1961 Pinnacle 300I DVB-T PAL already defines the proper init to allow
1962 the detection of mt2032 (TDA9887_PORT2_INACTIVE)
1964 if (dev
->board
== SAA7134_BOARD_PINNACLE_300I_DVBT_PAL
) {
1965 struct v4l2_priv_tun_config tda9887_cfg
;
1966 static int on
= TDA9887_PRESENT
| TDA9887_PORT2_INACTIVE
;
1968 tda9887_cfg
.tuner
= TUNER_TDA9887
;
1969 tda9887_cfg
.priv
= &on
;
1971 /* otherwise we don't detect the tuner on next insmod */
1972 saa_call_all(dev
, tuner
, s_config
, &tda9887_cfg
);
1973 } else if (dev
->board
== SAA7134_BOARD_MEDION_MD8800_QUADRO
) {
1974 if ((dev
->eedata
[2] == 0x07) && use_frontend
) {
1975 /* turn off the 2nd lnb supply */
1977 struct i2c_msg msg
= {.addr
= 0x08, .buf
= &data
, .flags
= 0, .len
= 1};
1978 struct dvb_frontend
*fe
;
1979 fe
= fe0
->dvb
.frontend
;
1980 if (fe
->ops
.i2c_gate_ctrl
) {
1981 fe
->ops
.i2c_gate_ctrl(fe
, 1);
1982 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
1983 fe
->ops
.i2c_gate_ctrl(fe
, 0);
1987 vb2_dvb_unregister_bus(&dev
->frontends
);
1988 vb2_queue_release(&fe0
->dvb
.dvbq
);
1992 static struct saa7134_mpeg_ops dvb_ops
= {
1993 .type
= SAA7134_MPEG_DVB
,
1998 static int __init
dvb_register(void)
2000 return saa7134_ts_register(&dvb_ops
);
2003 static void __exit
dvb_unregister(void)
2005 saa7134_ts_unregister(&dvb_ops
);
2008 module_init(dvb_register
);
2009 module_exit(dvb_unregister
);