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.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <linux/init.h>
24 #include <linux/list.h>
25 #include <linux/module.h>
26 #include <linux/kernel.h>
27 #include <linux/slab.h>
28 #include <linux/delay.h>
29 #include <linux/kthread.h>
30 #include <linux/suspend.h>
32 #include "saa7134-reg.h"
34 #include <media/v4l2-common.h>
38 #include "mt352_priv.h" /* FIXME */
45 MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
46 MODULE_LICENSE("GPL");
48 static unsigned int antenna_pwr
= 0;
50 module_param(antenna_pwr
, int, 0444);
51 MODULE_PARM_DESC(antenna_pwr
,"enable antenna power (Pinnacle 300i)");
53 /* ------------------------------------------------------------------ */
54 static int pinnacle_antenna_pwr(struct saa7134_dev
*dev
, int on
)
59 saa_setl(SAA7134_GPIO_GPMODE0
>> 2, (1 << 26));
60 saa_clearl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 26));
64 saa_setl(SAA7134_GPIO_GPMODE0
>> 2, (1 << 26));
65 saa_setl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 26));
68 saa_setl(SAA7134_GPIO_GPMODE0
>> 2, (1 << 28));
69 saa_clearl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 28));
71 saa_setl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 28));
73 ok
= saa_readl(SAA7134_GPIO_GPSTATUS0
) & (1 << 27);
74 printk("%s: %s %s\n", dev
->name
, __FUNCTION__
,
78 saa_clearl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 26));
82 static int mt352_pinnacle_init(struct dvb_frontend
* fe
)
84 static u8 clock_config
[] = { CLOCK_CTL
, 0x3d, 0x28 };
85 static u8 reset
[] = { RESET
, 0x80 };
86 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
87 static u8 agc_cfg
[] = { AGC_TARGET
, 0x28, 0xa0 };
88 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x31 };
89 static u8 fsm_ctl_cfg
[] = { 0x7b, 0x04 };
90 static u8 gpp_ctl_cfg
[] = { GPP_CTL
, 0x0f };
91 static u8 scan_ctl_cfg
[] = { SCAN_CTL
, 0x0d };
92 static u8 irq_cfg
[] = { INTERRUPT_EN_0
, 0x00, 0x00, 0x00, 0x00 };
93 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
95 printk("%s: %s called\n",dev
->name
,__FUNCTION__
);
97 mt352_write(fe
, clock_config
, sizeof(clock_config
));
99 mt352_write(fe
, reset
, sizeof(reset
));
100 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
101 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
102 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
103 mt352_write(fe
, gpp_ctl_cfg
, sizeof(gpp_ctl_cfg
));
105 mt352_write(fe
, fsm_ctl_cfg
, sizeof(fsm_ctl_cfg
));
106 mt352_write(fe
, scan_ctl_cfg
, sizeof(scan_ctl_cfg
));
107 mt352_write(fe
, irq_cfg
, sizeof(irq_cfg
));
112 static int mt352_aver777_init(struct dvb_frontend
* fe
)
114 static u8 clock_config
[] = { CLOCK_CTL
, 0x38, 0x2d };
115 static u8 reset
[] = { RESET
, 0x80 };
116 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
117 static u8 agc_cfg
[] = { AGC_TARGET
, 0x28, 0xa0 };
118 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x33 };
120 mt352_write(fe
, clock_config
, sizeof(clock_config
));
122 mt352_write(fe
, reset
, sizeof(reset
));
123 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
124 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
125 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
130 static int mt352_pinnacle_tuner_set_params(struct dvb_frontend
* fe
,
131 struct dvb_frontend_parameters
* params
)
133 u8 off
[] = { 0x00, 0xf1};
134 u8 on
[] = { 0x00, 0x71};
135 struct i2c_msg msg
= {.addr
=0x43, .flags
=0, .buf
=off
, .len
= sizeof(off
)};
137 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
138 struct v4l2_frequency f
;
140 /* set frequency (mt2050) */
142 f
.type
= V4L2_TUNER_DIGITAL_TV
;
143 f
.frequency
= params
->frequency
/ 1000 * 16 / 1000;
144 if (fe
->ops
.i2c_gate_ctrl
)
145 fe
->ops
.i2c_gate_ctrl(fe
, 1);
146 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
147 saa7134_i2c_call_clients(dev
,VIDIOC_S_FREQUENCY
,&f
);
149 if (fe
->ops
.i2c_gate_ctrl
)
150 fe
->ops
.i2c_gate_ctrl(fe
, 1);
151 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
153 pinnacle_antenna_pwr(dev
, antenna_pwr
);
156 return mt352_pinnacle_init(fe
);
159 static int mt352_aver777_tuner_calc_regs(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
, u8
* pllbuf
, int buf_len
)
165 dvb_pll_configure(&dvb_pll_philips_td1316
, pllbuf
+1,
167 params
->u
.ofdm
.bandwidth
);
171 static struct mt352_config pinnacle_300i
= {
172 .demod_address
= 0x3c >> 1,
176 .demod_init
= mt352_pinnacle_init
,
179 static struct mt352_config avermedia_777
= {
180 .demod_address
= 0xf,
181 .demod_init
= mt352_aver777_init
,
184 /* ------------------------------------------------------------------ */
185 static int philips_tda6651_pll_set(u8 addr
, struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
187 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
189 struct i2c_msg tuner_msg
= {.addr
= addr
,.flags
= 0,.buf
= tuner_buf
,.len
=
191 int tuner_frequency
= 0;
194 /* determine charge pump */
195 tuner_frequency
= params
->frequency
+ 36166000;
196 if (tuner_frequency
< 87000000)
198 else if (tuner_frequency
< 130000000)
200 else if (tuner_frequency
< 160000000)
202 else if (tuner_frequency
< 200000000)
204 else if (tuner_frequency
< 290000000)
206 else if (tuner_frequency
< 420000000)
208 else if (tuner_frequency
< 480000000)
210 else if (tuner_frequency
< 620000000)
212 else if (tuner_frequency
< 830000000)
214 else if (tuner_frequency
< 895000000)
220 if (params
->frequency
< 49000000)
222 else if (params
->frequency
< 161000000)
224 else if (params
->frequency
< 444000000)
226 else if (params
->frequency
< 861000000)
231 /* setup PLL filter */
232 switch (params
->u
.ofdm
.bandwidth
) {
233 case BANDWIDTH_6_MHZ
:
237 case BANDWIDTH_7_MHZ
:
241 case BANDWIDTH_8_MHZ
:
250 * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6)
252 tuner_frequency
= (((params
->frequency
/ 1000) * 6) + 217496) / 1000;
254 /* setup tuner buffer */
255 tuner_buf
[0] = (tuner_frequency
>> 8) & 0x7f;
256 tuner_buf
[1] = tuner_frequency
& 0xff;
258 tuner_buf
[3] = (cp
<< 5) | (filter
<< 3) | band
;
260 if (fe
->ops
.i2c_gate_ctrl
)
261 fe
->ops
.i2c_gate_ctrl(fe
, 1);
262 if (i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1) != 1)
268 static int philips_tda6651_pll_init(u8 addr
, struct dvb_frontend
*fe
)
270 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
271 static u8 tu1216_init
[] = { 0x0b, 0xf5, 0x85, 0xab };
272 struct i2c_msg tuner_msg
= {.addr
= addr
,.flags
= 0,.buf
= tu1216_init
,.len
= sizeof(tu1216_init
) };
274 /* setup PLL configuration */
275 if (fe
->ops
.i2c_gate_ctrl
)
276 fe
->ops
.i2c_gate_ctrl(fe
, 1);
277 if (i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1) != 1)
284 /* ------------------------------------------------------------------ */
286 static int philips_tu1216_tuner_60_init(struct dvb_frontend
*fe
)
288 return philips_tda6651_pll_init(0x60, fe
);
291 static int philips_tu1216_tuner_60_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
293 return philips_tda6651_pll_set(0x60, fe
, params
);
296 static int philips_tu1216_request_firmware(struct dvb_frontend
*fe
,
297 const struct firmware
**fw
, char *name
)
299 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
300 return request_firmware(fw
, name
, &dev
->pci
->dev
);
303 static struct tda1004x_config philips_tu1216_60_config
= {
305 .demod_address
= 0x8,
308 .xtal_freq
= TDA10046_XTAL_4M
,
309 .agc_config
= TDA10046_AGC_DEFAULT
,
310 .if_freq
= TDA10046_FREQ_3617
,
311 .request_firmware
= philips_tu1216_request_firmware
,
314 /* ------------------------------------------------------------------ */
316 static int philips_tu1216_tuner_61_init(struct dvb_frontend
*fe
)
318 return philips_tda6651_pll_init(0x61, fe
);
321 static int philips_tu1216_tuner_61_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
323 return philips_tda6651_pll_set(0x61, fe
, params
);
326 static struct tda1004x_config philips_tu1216_61_config
= {
328 .demod_address
= 0x8,
331 .xtal_freq
= TDA10046_XTAL_4M
,
332 .agc_config
= TDA10046_AGC_DEFAULT
,
333 .if_freq
= TDA10046_FREQ_3617
,
334 .request_firmware
= philips_tu1216_request_firmware
,
337 /* ------------------------------------------------------------------ */
339 static int philips_europa_tuner_init(struct dvb_frontend
*fe
)
341 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
342 static u8 msg
[] = { 0x0b, 0xf5, 0x86, 0xab };
343 struct i2c_msg init_msg
= {.addr
= 0x61,.flags
= 0,.buf
= msg
,.len
= sizeof(msg
) };
345 /* setup PLL configuration */
346 if (fe
->ops
.i2c_gate_ctrl
)
347 fe
->ops
.i2c_gate_ctrl(fe
, 1);
348 if (i2c_transfer(&dev
->i2c_adap
, &init_msg
, 1) != 1)
352 /* switch the board to dvb mode */
353 init_msg
.addr
= 0x43;
357 if (fe
->ops
.i2c_gate_ctrl
)
358 fe
->ops
.i2c_gate_ctrl(fe
, 1);
359 if (i2c_transfer(&dev
->i2c_adap
, &init_msg
, 1) != 1)
365 static int philips_td1316_tuner_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
367 return philips_tda6651_pll_set(0x61, fe
, params
);
370 static int philips_europa_tuner_sleep(struct dvb_frontend
*fe
)
372 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
373 /* this message actually turns the tuner back to analog mode */
374 static u8 msg
[] = { 0x0b, 0xdc, 0x86, 0xa4 };
375 struct i2c_msg analog_msg
= {.addr
= 0x61,.flags
= 0,.buf
= msg
,.len
= sizeof(msg
) };
377 i2c_transfer(&dev
->i2c_adap
, &analog_msg
, 1);
380 /* switch the board to analog mode */
381 analog_msg
.addr
= 0x43;
382 analog_msg
.len
= 0x02;
385 if (fe
->ops
.i2c_gate_ctrl
)
386 fe
->ops
.i2c_gate_ctrl(fe
, 1);
387 i2c_transfer(&dev
->i2c_adap
, &analog_msg
, 1);
391 static int philips_europa_demod_sleep(struct dvb_frontend
*fe
)
393 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
395 if (dev
->original_demod_sleep
)
396 dev
->original_demod_sleep(fe
);
397 fe
->ops
.i2c_gate_ctrl(fe
, 1);
401 static struct tda1004x_config philips_europa_config
= {
403 .demod_address
= 0x8,
406 .xtal_freq
= TDA10046_XTAL_4M
,
407 .agc_config
= TDA10046_AGC_IFO_AUTO_POS
,
408 .if_freq
= TDA10046_FREQ_052
,
409 .request_firmware
= NULL
,
412 /* ------------------------------------------------------------------ */
414 static int philips_fmd1216_tuner_init(struct dvb_frontend
*fe
)
416 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
417 /* this message is to set up ATC and ALC */
418 static u8 fmd1216_init
[] = { 0x0b, 0xdc, 0x9c, 0xa0 };
419 struct i2c_msg tuner_msg
= {.addr
= 0x61,.flags
= 0,.buf
= fmd1216_init
,.len
= sizeof(fmd1216_init
) };
421 if (fe
->ops
.i2c_gate_ctrl
)
422 fe
->ops
.i2c_gate_ctrl(fe
, 1);
423 if (i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1) != 1)
430 static int philips_fmd1216_tuner_sleep(struct dvb_frontend
*fe
)
432 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
433 /* this message actually turns the tuner back to analog mode */
434 static u8 fmd1216_init
[] = { 0x0b, 0xdc, 0x9c, 0x60 };
435 struct i2c_msg tuner_msg
= {.addr
= 0x61,.flags
= 0,.buf
= fmd1216_init
,.len
= sizeof(fmd1216_init
) };
437 if (fe
->ops
.i2c_gate_ctrl
)
438 fe
->ops
.i2c_gate_ctrl(fe
, 1);
439 i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1);
441 fmd1216_init
[2] = 0x86;
442 fmd1216_init
[3] = 0x54;
443 if (fe
->ops
.i2c_gate_ctrl
)
444 fe
->ops
.i2c_gate_ctrl(fe
, 1);
445 i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1);
450 static int philips_fmd1216_tuner_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
452 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
454 struct i2c_msg tuner_msg
= {.addr
= 0x61,.flags
= 0,.buf
= tuner_buf
,.len
=
456 int tuner_frequency
= 0;
460 /* determine charge pump */
461 tuner_frequency
= params
->frequency
+ 36130000;
462 if (tuner_frequency
< 87000000)
465 else if (tuner_frequency
< 180000000) {
469 } else if (tuner_frequency
< 195000000) {
474 } else if (tuner_frequency
< 366000000) {
475 if (params
->u
.ofdm
.bandwidth
== BANDWIDTH_8_MHZ
) {
482 } else if (tuner_frequency
< 478000000) {
483 if (params
->u
.ofdm
.bandwidth
== BANDWIDTH_8_MHZ
) {
491 } else if (tuner_frequency
< 662000000) {
492 if (params
->u
.ofdm
.bandwidth
== BANDWIDTH_8_MHZ
) {
499 } else if (tuner_frequency
< 840000000) {
500 if (params
->u
.ofdm
.bandwidth
== BANDWIDTH_8_MHZ
) {
508 if (params
->u
.ofdm
.bandwidth
== BANDWIDTH_8_MHZ
) {
517 /* calculate divisor */
518 /* ((36166000 + Finput) / 166666) rounded! */
519 divider
= (tuner_frequency
+ 83333) / 166667;
521 /* setup tuner buffer */
522 tuner_buf
[0] = (divider
>> 8) & 0x7f;
523 tuner_buf
[1] = divider
& 0xff;
524 tuner_buf
[2] = 0x80 | (cp
<< 6) | (mode
<< 3) | 4;
525 tuner_buf
[3] = 0x40 | band
;
527 if (fe
->ops
.i2c_gate_ctrl
)
528 fe
->ops
.i2c_gate_ctrl(fe
, 1);
529 if (i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1) != 1)
534 static struct tda1004x_config medion_cardbus
= {
535 .demod_address
= 0x08,
538 .xtal_freq
= TDA10046_XTAL_16M
,
539 .agc_config
= TDA10046_AGC_IFO_AUTO_NEG
,
540 .if_freq
= TDA10046_FREQ_3613
,
541 .request_firmware
= NULL
,
544 /* ------------------------------------------------------------------ */
546 struct tda827x_data
{
556 static struct tda827x_data tda827x_dvbt
[] = {
557 { .lomax
= 62000000, .spd
= 3, .bs
= 2, .bp
= 0, .cp
= 0, .gc3
= 3, .div1p5
= 1},
558 { .lomax
= 66000000, .spd
= 3, .bs
= 3, .bp
= 0, .cp
= 0, .gc3
= 3, .div1p5
= 1},
559 { .lomax
= 76000000, .spd
= 3, .bs
= 1, .bp
= 0, .cp
= 0, .gc3
= 3, .div1p5
= 0},
560 { .lomax
= 84000000, .spd
= 3, .bs
= 2, .bp
= 0, .cp
= 0, .gc3
= 3, .div1p5
= 0},
561 { .lomax
= 93000000, .spd
= 3, .bs
= 2, .bp
= 0, .cp
= 0, .gc3
= 1, .div1p5
= 0},
562 { .lomax
= 98000000, .spd
= 3, .bs
= 3, .bp
= 0, .cp
= 0, .gc3
= 1, .div1p5
= 0},
563 { .lomax
= 109000000, .spd
= 3, .bs
= 3, .bp
= 1, .cp
= 0, .gc3
= 1, .div1p5
= 0},
564 { .lomax
= 123000000, .spd
= 2, .bs
= 2, .bp
= 1, .cp
= 0, .gc3
= 1, .div1p5
= 1},
565 { .lomax
= 133000000, .spd
= 2, .bs
= 3, .bp
= 1, .cp
= 0, .gc3
= 1, .div1p5
= 1},
566 { .lomax
= 151000000, .spd
= 2, .bs
= 1, .bp
= 1, .cp
= 0, .gc3
= 1, .div1p5
= 0},
567 { .lomax
= 154000000, .spd
= 2, .bs
= 2, .bp
= 1, .cp
= 0, .gc3
= 1, .div1p5
= 0},
568 { .lomax
= 181000000, .spd
= 2, .bs
= 2, .bp
= 1, .cp
= 0, .gc3
= 0, .div1p5
= 0},
569 { .lomax
= 185000000, .spd
= 2, .bs
= 2, .bp
= 2, .cp
= 0, .gc3
= 1, .div1p5
= 0},
570 { .lomax
= 217000000, .spd
= 2, .bs
= 3, .bp
= 2, .cp
= 0, .gc3
= 1, .div1p5
= 0},
571 { .lomax
= 244000000, .spd
= 1, .bs
= 2, .bp
= 2, .cp
= 0, .gc3
= 1, .div1p5
= 1},
572 { .lomax
= 265000000, .spd
= 1, .bs
= 3, .bp
= 2, .cp
= 0, .gc3
= 1, .div1p5
= 1},
573 { .lomax
= 302000000, .spd
= 1, .bs
= 1, .bp
= 2, .cp
= 0, .gc3
= 1, .div1p5
= 0},
574 { .lomax
= 324000000, .spd
= 1, .bs
= 2, .bp
= 2, .cp
= 0, .gc3
= 1, .div1p5
= 0},
575 { .lomax
= 370000000, .spd
= 1, .bs
= 2, .bp
= 3, .cp
= 0, .gc3
= 1, .div1p5
= 0},
576 { .lomax
= 454000000, .spd
= 1, .bs
= 3, .bp
= 3, .cp
= 0, .gc3
= 1, .div1p5
= 0},
577 { .lomax
= 493000000, .spd
= 0, .bs
= 2, .bp
= 3, .cp
= 0, .gc3
= 1, .div1p5
= 1},
578 { .lomax
= 530000000, .spd
= 0, .bs
= 3, .bp
= 3, .cp
= 0, .gc3
= 1, .div1p5
= 1},
579 { .lomax
= 554000000, .spd
= 0, .bs
= 1, .bp
= 3, .cp
= 0, .gc3
= 1, .div1p5
= 0},
580 { .lomax
= 604000000, .spd
= 0, .bs
= 1, .bp
= 4, .cp
= 0, .gc3
= 0, .div1p5
= 0},
581 { .lomax
= 696000000, .spd
= 0, .bs
= 2, .bp
= 4, .cp
= 0, .gc3
= 0, .div1p5
= 0},
582 { .lomax
= 740000000, .spd
= 0, .bs
= 2, .bp
= 4, .cp
= 1, .gc3
= 0, .div1p5
= 0},
583 { .lomax
= 820000000, .spd
= 0, .bs
= 3, .bp
= 4, .cp
= 0, .gc3
= 0, .div1p5
= 0},
584 { .lomax
= 865000000, .spd
= 0, .bs
= 3, .bp
= 4, .cp
= 1, .gc3
= 0, .div1p5
= 0},
585 { .lomax
= 0, .spd
= 0, .bs
= 0, .bp
= 0, .cp
= 0, .gc3
= 0, .div1p5
= 0}
588 static int philips_tda827x_tuner_init(struct dvb_frontend
*fe
)
593 static int philips_tda827x_tuner_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
595 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
598 struct i2c_msg tuner_msg
= {.addr
= 0x60,.flags
= 0,.buf
= tuner_buf
,
599 .len
= sizeof(tuner_buf
) };
600 int i
, tuner_freq
, if_freq
;
602 switch (params
->u
.ofdm
.bandwidth
) {
603 case BANDWIDTH_6_MHZ
:
606 case BANDWIDTH_7_MHZ
:
609 default: /* 8 MHz or Auto */
613 tuner_freq
= params
->frequency
+ if_freq
;
616 while (tda827x_dvbt
[i
].lomax
< tuner_freq
) {
617 if(tda827x_dvbt
[i
+ 1].lomax
== 0)
622 N
= ((tuner_freq
+ 125000) / 250000) << (tda827x_dvbt
[i
].spd
+ 2);
624 tuner_buf
[1] = (N
>>8) | 0x40;
625 tuner_buf
[2] = N
& 0xff;
628 tuner_buf
[5] = (tda827x_dvbt
[i
].spd
<< 6) + (tda827x_dvbt
[i
].div1p5
<< 5) +
629 (tda827x_dvbt
[i
].bs
<< 3) + tda827x_dvbt
[i
].bp
;
630 tuner_buf
[6] = (tda827x_dvbt
[i
].gc3
<< 4) + 0x8f;
634 tuner_buf
[10] = 0xff;
635 tuner_buf
[11] = 0x00;
636 tuner_buf
[12] = 0x00;
637 tuner_buf
[13] = 0x40;
640 if (fe
->ops
.i2c_gate_ctrl
)
641 fe
->ops
.i2c_gate_ctrl(fe
, 1);
642 if (i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1) != 1)
646 /* correct CP value */
648 tuner_buf
[1] = 0x50 + tda827x_dvbt
[i
].cp
;
650 if (fe
->ops
.i2c_gate_ctrl
)
651 fe
->ops
.i2c_gate_ctrl(fe
, 1);
652 i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1);
657 static int philips_tda827x_tuner_sleep(struct dvb_frontend
*fe
)
659 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
660 static u8 tda827x_sleep
[] = { 0x30, 0xd0};
661 struct i2c_msg tuner_msg
= {.addr
= 0x60,.flags
= 0,.buf
= tda827x_sleep
,
662 .len
= sizeof(tda827x_sleep
) };
663 if (fe
->ops
.i2c_gate_ctrl
)
664 fe
->ops
.i2c_gate_ctrl(fe
, 1);
665 i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1);
669 static struct tda1004x_config tda827x_lifeview_config
= {
670 .demod_address
= 0x08,
673 .xtal_freq
= TDA10046_XTAL_16M
,
674 .agc_config
= TDA10046_AGC_TDA827X
,
675 .if_freq
= TDA10046_FREQ_045
,
676 .request_firmware
= NULL
,
679 /* ------------------------------------------------------------------ */
681 struct tda827xa_data
{
690 static struct tda827xa_data tda827xa_dvbt
[] = {
691 { .lomax
= 56875000, .svco
= 3, .spd
= 4, .scr
= 0, .sbs
= 0, .gc3
= 1},
692 { .lomax
= 67250000, .svco
= 0, .spd
= 3, .scr
= 0, .sbs
= 0, .gc3
= 1},
693 { .lomax
= 81250000, .svco
= 1, .spd
= 3, .scr
= 0, .sbs
= 0, .gc3
= 1},
694 { .lomax
= 97500000, .svco
= 2, .spd
= 3, .scr
= 0, .sbs
= 0, .gc3
= 1},
695 { .lomax
= 113750000, .svco
= 3, .spd
= 3, .scr
= 0, .sbs
= 1, .gc3
= 1},
696 { .lomax
= 134500000, .svco
= 0, .spd
= 2, .scr
= 0, .sbs
= 1, .gc3
= 1},
697 { .lomax
= 154000000, .svco
= 1, .spd
= 2, .scr
= 0, .sbs
= 1, .gc3
= 1},
698 { .lomax
= 162500000, .svco
= 1, .spd
= 2, .scr
= 0, .sbs
= 1, .gc3
= 1},
699 { .lomax
= 183000000, .svco
= 2, .spd
= 2, .scr
= 0, .sbs
= 1, .gc3
= 1},
700 { .lomax
= 195000000, .svco
= 2, .spd
= 2, .scr
= 0, .sbs
= 2, .gc3
= 1},
701 { .lomax
= 227500000, .svco
= 3, .spd
= 2, .scr
= 0, .sbs
= 2, .gc3
= 1},
702 { .lomax
= 269000000, .svco
= 0, .spd
= 1, .scr
= 0, .sbs
= 2, .gc3
= 1},
703 { .lomax
= 290000000, .svco
= 1, .spd
= 1, .scr
= 0, .sbs
= 2, .gc3
= 1},
704 { .lomax
= 325000000, .svco
= 1, .spd
= 1, .scr
= 0, .sbs
= 3, .gc3
= 1},
705 { .lomax
= 390000000, .svco
= 2, .spd
= 1, .scr
= 0, .sbs
= 3, .gc3
= 1},
706 { .lomax
= 455000000, .svco
= 3, .spd
= 1, .scr
= 0, .sbs
= 3, .gc3
= 1},
707 { .lomax
= 520000000, .svco
= 0, .spd
= 0, .scr
= 0, .sbs
= 3, .gc3
= 1},
708 { .lomax
= 538000000, .svco
= 0, .spd
= 0, .scr
= 1, .sbs
= 3, .gc3
= 1},
709 { .lomax
= 550000000, .svco
= 1, .spd
= 0, .scr
= 0, .sbs
= 3, .gc3
= 1},
710 { .lomax
= 620000000, .svco
= 1, .spd
= 0, .scr
= 0, .sbs
= 4, .gc3
= 0},
711 { .lomax
= 650000000, .svco
= 1, .spd
= 0, .scr
= 1, .sbs
= 4, .gc3
= 0},
712 { .lomax
= 700000000, .svco
= 2, .spd
= 0, .scr
= 0, .sbs
= 4, .gc3
= 0},
713 { .lomax
= 780000000, .svco
= 2, .spd
= 0, .scr
= 1, .sbs
= 4, .gc3
= 0},
714 { .lomax
= 820000000, .svco
= 3, .spd
= 0, .scr
= 0, .sbs
= 4, .gc3
= 0},
715 { .lomax
= 870000000, .svco
= 3, .spd
= 0, .scr
= 1, .sbs
= 4, .gc3
= 0},
716 { .lomax
= 911000000, .svco
= 3, .spd
= 0, .scr
= 2, .sbs
= 4, .gc3
= 0},
717 { .lomax
= 0, .svco
= 0, .spd
= 0, .scr
= 0, .sbs
= 0, .gc3
= 0}};
720 static int philips_tda827xa_pll_set(u8 addr
, struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
722 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
724 unsigned char reg2
[2];
726 struct i2c_msg msg
= {.addr
= addr
,.flags
= 0,.buf
= tuner_buf
};
727 int i
, tuner_freq
, if_freq
;
730 switch (params
->u
.ofdm
.bandwidth
) {
731 case BANDWIDTH_6_MHZ
:
734 case BANDWIDTH_7_MHZ
:
737 default: /* 8 MHz or Auto */
741 tuner_freq
= params
->frequency
+ if_freq
;
744 while (tda827xa_dvbt
[i
].lomax
< tuner_freq
) {
745 if(tda827xa_dvbt
[i
+ 1].lomax
== 0)
750 N
= ((tuner_freq
+ 31250) / 62500) << tda827xa_dvbt
[i
].spd
;
751 tuner_buf
[0] = 0; // subaddress
752 tuner_buf
[1] = N
>> 8;
753 tuner_buf
[2] = N
& 0xff;
756 tuner_buf
[5] = (tda827xa_dvbt
[i
].spd
<< 5) + (tda827xa_dvbt
[i
].svco
<< 3) +
757 tda827xa_dvbt
[i
].sbs
;
758 tuner_buf
[6] = 0x4b + (tda827xa_dvbt
[i
].gc3
<< 4);
762 tuner_buf
[10] = 0xff;
763 tuner_buf
[11] = 0x60;
764 tuner_buf
[12] = 0x00;
765 tuner_buf
[13] = 0x39; // lpsel
767 if (fe
->ops
.i2c_gate_ctrl
)
768 fe
->ops
.i2c_gate_ctrl(fe
, 1);
769 if (i2c_transfer(&dev
->i2c_adap
, &msg
, 1) != 1)
776 if (fe
->ops
.i2c_gate_ctrl
)
777 fe
->ops
.i2c_gate_ctrl(fe
, 1);
778 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
782 if (fe
->ops
.i2c_gate_ctrl
)
783 fe
->ops
.i2c_gate_ctrl(fe
, 1);
784 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
787 /* correct CP value */
789 reg2
[1] = 0x10 + tda827xa_dvbt
[i
].scr
;
791 if (fe
->ops
.i2c_gate_ctrl
)
792 fe
->ops
.i2c_gate_ctrl(fe
, 1);
793 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
797 reg2
[1] = 0x4f + (tda827xa_dvbt
[i
].gc3
<< 4);
798 if (fe
->ops
.i2c_gate_ctrl
)
799 fe
->ops
.i2c_gate_ctrl(fe
, 1);
800 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
806 static int philips_tda827xa_tuner_sleep(u8 addr
, struct dvb_frontend
*fe
)
808 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
809 static u8 tda827xa_sleep
[] = { 0x30, 0x90};
810 struct i2c_msg tuner_msg
= {.addr
= addr
,.flags
= 0,.buf
= tda827xa_sleep
,
811 .len
= sizeof(tda827xa_sleep
) };
812 if (fe
->ops
.i2c_gate_ctrl
)
813 fe
->ops
.i2c_gate_ctrl(fe
, 1);
814 i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1);
818 /* ------------------------------------------------------------------ */
820 static int philips_tiger_tuner_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
823 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
824 static u8 tda8290_close
[] = { 0x21, 0xc0};
825 static u8 tda8290_open
[] = { 0x21, 0x80};
826 struct i2c_msg tda8290_msg
= {.addr
= 0x4b,.flags
= 0, .len
= 2};
828 /* close tda8290 i2c bridge */
829 tda8290_msg
.buf
= tda8290_close
;
830 ret
= i2c_transfer(&dev
->i2c_adap
, &tda8290_msg
, 1);
834 ret
= philips_tda827xa_pll_set(0x61, fe
, params
);
837 /* open tda8290 i2c bridge */
838 tda8290_msg
.buf
= tda8290_open
;
839 i2c_transfer(&dev
->i2c_adap
, &tda8290_msg
, 1);
843 static int philips_tiger_tuner_init(struct dvb_frontend
*fe
)
845 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
846 static u8 data
[] = { 0x3c, 0x33, 0x6a};
847 struct i2c_msg msg
= {.addr
=0x08, .flags
=0, .buf
=data
, .len
= sizeof(data
)};
849 if (i2c_transfer(&dev
->i2c_adap
, &msg
, 1) != 1)
854 static int philips_tiger_tuner_sleep(struct dvb_frontend
*fe
)
856 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
857 static u8 data
[] = { 0x3c, 0x33, 0x68};
858 struct i2c_msg msg
= {.addr
=0x08, .flags
=0, .buf
=data
, .len
= sizeof(data
)};
860 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
861 philips_tda827xa_tuner_sleep( 0x61, fe
);
865 static struct tda1004x_config philips_tiger_config
= {
866 .demod_address
= 0x08,
869 .xtal_freq
= TDA10046_XTAL_16M
,
870 .agc_config
= TDA10046_AGC_TDA827X
,
871 .if_freq
= TDA10046_FREQ_045
,
872 .request_firmware
= NULL
,
875 /* ------------------------------------------------------------------ */
877 static int lifeview_trio_tuner_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
881 ret
= philips_tda827xa_pll_set(0x60, fe
, params
);
885 static int lifeview_trio_tuner_sleep(struct dvb_frontend
*fe
)
887 philips_tda827xa_tuner_sleep(0x60, fe
);
891 static struct tda1004x_config lifeview_trio_config
= {
892 .demod_address
= 0x09,
895 .xtal_freq
= TDA10046_XTAL_16M
,
896 .agc_config
= TDA10046_AGC_TDA827X_GPL
,
897 .if_freq
= TDA10046_FREQ_045
,
898 .request_firmware
= NULL
,
901 /* ------------------------------------------------------------------ */
903 static int ads_duo_tuner_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
907 ret
= philips_tda827xa_pll_set(0x61, fe
, params
);
911 static int ads_duo_tuner_init(struct dvb_frontend
*fe
)
913 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
914 /* route TDA8275a AGC input to the channel decoder */
915 saa_writeb(SAA7134_GPIO_GPSTATUS2
, 0x60);
919 static int ads_duo_tuner_sleep(struct dvb_frontend
*fe
)
921 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
922 /* route TDA8275a AGC input to the analog IF chip*/
923 saa_writeb(SAA7134_GPIO_GPSTATUS2
, 0x20);
924 philips_tda827xa_tuner_sleep( 0x61, fe
);
928 static struct tda1004x_config ads_tech_duo_config
= {
929 .demod_address
= 0x08,
932 .xtal_freq
= TDA10046_XTAL_16M
,
933 .agc_config
= TDA10046_AGC_TDA827X_GPL
,
934 .if_freq
= TDA10046_FREQ_045
,
935 .request_firmware
= NULL
,
938 /* ------------------------------------------------------------------ */
940 static int tevion_dvb220rf_tuner_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
943 ret
= philips_tda827xa_pll_set(0x60, fe
, params
);
947 static int tevion_dvb220rf_tuner_sleep(struct dvb_frontend
*fe
)
949 philips_tda827xa_tuner_sleep( 0x61, fe
);
953 static struct tda1004x_config tevion_dvbt220rf_config
= {
954 .demod_address
= 0x08,
957 .xtal_freq
= TDA10046_XTAL_16M
,
958 .agc_config
= TDA10046_AGC_TDA827X
,
959 .if_freq
= TDA10046_FREQ_045
,
960 .request_firmware
= NULL
,
963 /* ------------------------------------------------------------------ */
965 static int md8800_dvbt_analog_mode(struct dvb_frontend
*fe
)
967 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
968 static u8 data
[] = { 0x3c, 0x33, 0x68};
969 struct i2c_msg msg
= {.addr
=0x08, .flags
=0, .buf
=data
, .len
= sizeof(data
)};
971 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
972 philips_tda827xa_tuner_sleep( 0x61, fe
);
976 static int md8800_dvbt_pll_set(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
979 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
980 static u8 tda8290_close
[] = { 0x21, 0xc0};
981 static u8 tda8290_open
[] = { 0x21, 0x80};
982 struct i2c_msg tda8290_msg
= {.addr
= 0x4b,.flags
= 0, .len
= 2};
983 /* close tda8290 i2c bridge */
984 tda8290_msg
.buf
= tda8290_close
;
985 ret
= i2c_transfer(&dev
->i2c_adap
, &tda8290_msg
, 1);
989 ret
= philips_tda827xa_pll_set(0x60, fe
, params
);
992 /* open tda8290 i2c bridge */
993 tda8290_msg
.buf
= tda8290_open
;
994 i2c_transfer(&dev
->i2c_adap
, &tda8290_msg
, 1);
998 static struct tda1004x_config md8800_dvbt_config
= {
999 .demod_address
= 0x08,
1002 .xtal_freq
= TDA10046_XTAL_16M
,
1003 .agc_config
= TDA10046_AGC_TDA827X
,
1004 .if_freq
= TDA10046_FREQ_045
,
1005 .request_firmware
= NULL
,
1008 static struct tda10086_config flydvbs
= {
1009 .demod_address
= 0x0e,
1013 /* ------------------------------------------------------------------ */
1015 static struct nxt200x_config avertvhda180
= {
1016 .demod_address
= 0x0a,
1019 static int nxt200x_set_pll_input(u8
*buf
, int input
)
1028 static struct nxt200x_config kworldatsc110
= {
1029 .demod_address
= 0x0a,
1030 .set_pll_input
= nxt200x_set_pll_input
,
1033 /* ------------------------------------------------------------------ */
1035 static int dvb_init(struct saa7134_dev
*dev
)
1037 /* init struct videobuf_dvb */
1038 dev
->ts
.nr_bufs
= 32;
1039 dev
->ts
.nr_packets
= 32*4;
1040 dev
->dvb
.name
= dev
->name
;
1041 videobuf_queue_init(&dev
->dvb
.dvbq
, &saa7134_ts_qops
,
1042 dev
->pci
, &dev
->slock
,
1043 V4L2_BUF_TYPE_VIDEO_CAPTURE
,
1044 V4L2_FIELD_ALTERNATE
,
1045 sizeof(struct saa7134_buf
),
1048 switch (dev
->board
) {
1049 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL
:
1050 printk("%s: pinnacle 300i dvb setup\n",dev
->name
);
1051 dev
->dvb
.frontend
= dvb_attach(mt352_attach
, &pinnacle_300i
,
1053 if (dev
->dvb
.frontend
) {
1054 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= mt352_pinnacle_tuner_set_params
;
1057 case SAA7134_BOARD_AVERMEDIA_777
:
1058 printk("%s: avertv 777 dvb setup\n",dev
->name
);
1059 dev
->dvb
.frontend
= dvb_attach(mt352_attach
, &avermedia_777
,
1061 if (dev
->dvb
.frontend
) {
1062 dev
->dvb
.frontend
->ops
.tuner_ops
.calc_regs
= mt352_aver777_tuner_calc_regs
;
1065 case SAA7134_BOARD_MD7134
:
1066 dev
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1069 if (dev
->dvb
.frontend
) {
1070 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_fmd1216_tuner_init
;
1071 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_fmd1216_tuner_sleep
;
1072 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_fmd1216_tuner_set_params
;
1075 case SAA7134_BOARD_PHILIPS_TOUGH
:
1076 dev
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1077 &philips_tu1216_60_config
,
1079 if (dev
->dvb
.frontend
) {
1080 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tu1216_tuner_60_init
;
1081 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tu1216_tuner_60_set_params
;
1084 case SAA7134_BOARD_FLYDVBTDUO
:
1085 dev
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1086 &tda827x_lifeview_config
,
1088 if (dev
->dvb
.frontend
) {
1089 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tda827x_tuner_init
;
1090 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_tda827x_tuner_sleep
;
1091 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tda827x_tuner_set_params
;
1094 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS
:
1095 dev
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1096 &tda827x_lifeview_config
,
1098 if (dev
->dvb
.frontend
) {
1099 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tda827x_tuner_init
;
1100 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_tda827x_tuner_sleep
;
1101 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tda827x_tuner_set_params
;
1104 case SAA7134_BOARD_PHILIPS_EUROPA
:
1105 dev
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1106 &philips_europa_config
,
1108 if (dev
->dvb
.frontend
) {
1109 dev
->original_demod_sleep
= dev
->dvb
.frontend
->ops
.sleep
;
1110 dev
->dvb
.frontend
->ops
.sleep
= philips_europa_demod_sleep
;
1111 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_europa_tuner_init
;
1112 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_europa_tuner_sleep
;
1113 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_td1316_tuner_set_params
;
1116 case SAA7134_BOARD_VIDEOMATE_DVBT_300
:
1117 dev
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1118 &philips_europa_config
,
1120 if (dev
->dvb
.frontend
) {
1121 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_europa_tuner_init
;
1122 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_europa_tuner_sleep
;
1123 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_td1316_tuner_set_params
;
1126 case SAA7134_BOARD_VIDEOMATE_DVBT_200
:
1127 dev
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1128 &philips_tu1216_61_config
,
1130 if (dev
->dvb
.frontend
) {
1131 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tu1216_tuner_61_init
;
1132 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tu1216_tuner_61_set_params
;
1135 case SAA7134_BOARD_PHILIPS_TIGER
:
1136 dev
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1137 &philips_tiger_config
,
1139 if (dev
->dvb
.frontend
) {
1140 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tiger_tuner_init
;
1141 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_tiger_tuner_sleep
;
1142 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tiger_tuner_set_params
;
1145 case SAA7134_BOARD_ASUSTeK_P7131_DUAL
:
1146 dev
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1147 &philips_tiger_config
,
1149 if (dev
->dvb
.frontend
) {
1150 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tiger_tuner_init
;
1151 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_tiger_tuner_sleep
;
1152 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tiger_tuner_set_params
;
1155 case SAA7134_BOARD_FLYDVBT_LR301
:
1156 dev
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1157 &tda827x_lifeview_config
,
1159 if (dev
->dvb
.frontend
) {
1160 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tda827x_tuner_init
;
1161 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_tda827x_tuner_sleep
;
1162 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tda827x_tuner_set_params
;
1165 case SAA7134_BOARD_FLYDVB_TRIO
:
1166 dev
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1167 &lifeview_trio_config
,
1169 if (dev
->dvb
.frontend
) {
1170 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= lifeview_trio_tuner_sleep
;
1171 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= lifeview_trio_tuner_set_params
;
1174 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331
:
1175 dev
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1176 &ads_tech_duo_config
,
1178 if (dev
->dvb
.frontend
) {
1179 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= ads_duo_tuner_init
;
1180 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= ads_duo_tuner_sleep
;
1181 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= ads_duo_tuner_set_params
;
1184 case SAA7134_BOARD_TEVION_DVBT_220RF
:
1185 dev
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1186 &tevion_dvbt220rf_config
,
1188 if (dev
->dvb
.frontend
) {
1189 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= tevion_dvb220rf_tuner_sleep
;
1190 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= tevion_dvb220rf_tuner_set_params
;
1193 case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS
:
1194 dev
->dvb
.frontend
= dvb_attach(tda10046_attach
,
1195 &ads_tech_duo_config
,
1197 if (dev
->dvb
.frontend
) {
1198 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= ads_duo_tuner_init
;
1199 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= ads_duo_tuner_sleep
;
1200 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= ads_duo_tuner_set_params
;
1203 case SAA7134_BOARD_MEDION_MD8800_QUADRO
:
1204 dev
->dvb
.frontend
= tda10046_attach(&md8800_dvbt_config
,
1206 if (dev
->dvb
.frontend
) {
1207 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tiger_tuner_init
;
1208 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= md8800_dvbt_analog_mode
;
1209 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= md8800_dvbt_pll_set
;
1212 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180
:
1213 dev
->dvb
.frontend
= dvb_attach(nxt200x_attach
, &avertvhda180
,
1215 if (dev
->dvb
.frontend
) {
1216 dvb_attach(dvb_pll_attach
, dev
->dvb
.frontend
, 0x61,
1217 NULL
, &dvb_pll_tdhu2
);
1220 case SAA7134_BOARD_KWORLD_ATSC110
:
1221 dev
->dvb
.frontend
= dvb_attach(nxt200x_attach
, &kworldatsc110
,
1223 if (dev
->dvb
.frontend
) {
1224 dvb_attach(dvb_pll_attach
, dev
->dvb
.frontend
, 0x61,
1225 NULL
, &dvb_pll_tuv1236d
);
1228 case SAA7134_BOARD_FLYDVBS_LR300
:
1229 dev
->dvb
.frontend
= dvb_attach(tda10086_attach
, &flydvbs
,
1231 if (dev
->dvb
.frontend
) {
1232 if (dvb_attach(tda826x_attach
, dev
->dvb
.frontend
, 0x60,
1233 &dev
->i2c_adap
, 0) == NULL
) {
1234 printk("%s: No tda826x found!\n", __FUNCTION__
);
1236 if (dvb_attach(isl6421_attach
, dev
->dvb
.frontend
,
1237 &dev
->i2c_adap
, 0x08, 0, 0) == NULL
) {
1238 printk("%s: No ISL6421 found!\n", __FUNCTION__
);
1243 printk("%s: Huh? unknown DVB card?\n",dev
->name
);
1247 if (NULL
== dev
->dvb
.frontend
) {
1248 printk("%s: frontend initialization failed\n",dev
->name
);
1252 /* register everything else */
1253 return videobuf_dvb_register(&dev
->dvb
, THIS_MODULE
, dev
, &dev
->pci
->dev
);
1256 static int dvb_fini(struct saa7134_dev
*dev
)
1258 static int on
= TDA9887_PRESENT
| TDA9887_PORT2_INACTIVE
;
1260 switch (dev
->board
) {
1261 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL
:
1262 /* otherwise we don't detect the tuner on next insmod */
1263 saa7134_i2c_call_clients(dev
,TDA9887_SET_CONFIG
,&on
);
1266 videobuf_dvb_unregister(&dev
->dvb
);
1270 static struct saa7134_mpeg_ops dvb_ops
= {
1271 .type
= SAA7134_MPEG_DVB
,
1276 static int __init
dvb_register(void)
1278 return saa7134_ts_register(&dvb_ops
);
1281 static void __exit
dvb_unregister(void)
1283 saa7134_ts_unregister(&dvb_ops
);
1286 module_init(dvb_register
);
1287 module_exit(dvb_unregister
);
1289 /* ------------------------------------------------------------------ */