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>
39 # include "mt352_priv.h" /* FIXME */
42 # include "tda1004x.h"
48 MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
49 MODULE_LICENSE("GPL");
51 static unsigned int antenna_pwr
= 0;
53 module_param(antenna_pwr
, int, 0444);
54 MODULE_PARM_DESC(antenna_pwr
,"enable antenna power (Pinnacle 300i)");
56 /* ------------------------------------------------------------------ */
59 static int pinnacle_antenna_pwr(struct saa7134_dev
*dev
, int on
)
64 saa_setl(SAA7134_GPIO_GPMODE0
>> 2, (1 << 26));
65 saa_clearl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 26));
69 saa_setl(SAA7134_GPIO_GPMODE0
>> 2, (1 << 26));
70 saa_setl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 26));
73 saa_setl(SAA7134_GPIO_GPMODE0
>> 2, (1 << 28));
74 saa_clearl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 28));
76 saa_setl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 28));
78 ok
= saa_readl(SAA7134_GPIO_GPSTATUS0
) & (1 << 27);
79 printk("%s: %s %s\n", dev
->name
, __FUNCTION__
,
83 saa_clearl(SAA7134_GPIO_GPSTATUS0
>> 2, (1 << 26));
87 static int mt352_pinnacle_init(struct dvb_frontend
* fe
)
89 static u8 clock_config
[] = { CLOCK_CTL
, 0x3d, 0x28 };
90 static u8 reset
[] = { RESET
, 0x80 };
91 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
92 static u8 agc_cfg
[] = { AGC_TARGET
, 0x28, 0xa0 };
93 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x31 };
94 static u8 fsm_ctl_cfg
[] = { 0x7b, 0x04 };
95 static u8 gpp_ctl_cfg
[] = { GPP_CTL
, 0x0f };
96 static u8 scan_ctl_cfg
[] = { SCAN_CTL
, 0x0d };
97 static u8 irq_cfg
[] = { INTERRUPT_EN_0
, 0x00, 0x00, 0x00, 0x00 };
98 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
100 printk("%s: %s called\n",dev
->name
,__FUNCTION__
);
102 mt352_write(fe
, clock_config
, sizeof(clock_config
));
104 mt352_write(fe
, reset
, sizeof(reset
));
105 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
106 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
107 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
108 mt352_write(fe
, gpp_ctl_cfg
, sizeof(gpp_ctl_cfg
));
110 mt352_write(fe
, fsm_ctl_cfg
, sizeof(fsm_ctl_cfg
));
111 mt352_write(fe
, scan_ctl_cfg
, sizeof(scan_ctl_cfg
));
112 mt352_write(fe
, irq_cfg
, sizeof(irq_cfg
));
117 static int mt352_aver777_init(struct dvb_frontend
* fe
)
119 static u8 clock_config
[] = { CLOCK_CTL
, 0x38, 0x2d };
120 static u8 reset
[] = { RESET
, 0x80 };
121 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
122 static u8 agc_cfg
[] = { AGC_TARGET
, 0x28, 0xa0 };
123 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x33 };
125 mt352_write(fe
, clock_config
, sizeof(clock_config
));
127 mt352_write(fe
, reset
, sizeof(reset
));
128 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
129 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
130 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
135 static int mt352_pinnacle_tuner_set_params(struct dvb_frontend
* fe
,
136 struct dvb_frontend_parameters
* params
)
138 u8 off
[] = { 0x00, 0xf1};
139 u8 on
[] = { 0x00, 0x71};
140 struct i2c_msg msg
= {.addr
=0x43, .flags
=0, .buf
=off
, .len
= sizeof(off
)};
142 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
143 struct v4l2_frequency f
;
145 /* set frequency (mt2050) */
147 f
.type
= V4L2_TUNER_DIGITAL_TV
;
148 f
.frequency
= params
->frequency
/ 1000 * 16 / 1000;
149 if (fe
->ops
.i2c_gate_ctrl
)
150 fe
->ops
.i2c_gate_ctrl(fe
, 1);
151 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
152 saa7134_i2c_call_clients(dev
,VIDIOC_S_FREQUENCY
,&f
);
154 if (fe
->ops
.i2c_gate_ctrl
)
155 fe
->ops
.i2c_gate_ctrl(fe
, 1);
156 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
158 pinnacle_antenna_pwr(dev
, antenna_pwr
);
161 return mt352_pinnacle_init(fe
);
164 static int mt352_aver777_tuner_calc_regs(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
, u8
* pllbuf
, int buf_len
)
170 dvb_pll_configure(&dvb_pll_philips_td1316
, pllbuf
+1,
172 params
->u
.ofdm
.bandwidth
);
176 static struct mt352_config pinnacle_300i
= {
177 .demod_address
= 0x3c >> 1,
181 .demod_init
= mt352_pinnacle_init
,
184 static struct mt352_config avermedia_777
= {
185 .demod_address
= 0xf,
186 .demod_init
= mt352_aver777_init
,
190 /* ------------------------------------------------------------------ */
194 static int philips_tda6651_pll_set(u8 addr
, struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
196 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
198 struct i2c_msg tuner_msg
= {.addr
= addr
,.flags
= 0,.buf
= tuner_buf
,.len
=
200 int tuner_frequency
= 0;
203 /* determine charge pump */
204 tuner_frequency
= params
->frequency
+ 36166000;
205 if (tuner_frequency
< 87000000)
207 else if (tuner_frequency
< 130000000)
209 else if (tuner_frequency
< 160000000)
211 else if (tuner_frequency
< 200000000)
213 else if (tuner_frequency
< 290000000)
215 else if (tuner_frequency
< 420000000)
217 else if (tuner_frequency
< 480000000)
219 else if (tuner_frequency
< 620000000)
221 else if (tuner_frequency
< 830000000)
223 else if (tuner_frequency
< 895000000)
229 if (params
->frequency
< 49000000)
231 else if (params
->frequency
< 161000000)
233 else if (params
->frequency
< 444000000)
235 else if (params
->frequency
< 861000000)
240 /* setup PLL filter */
241 switch (params
->u
.ofdm
.bandwidth
) {
242 case BANDWIDTH_6_MHZ
:
246 case BANDWIDTH_7_MHZ
:
250 case BANDWIDTH_8_MHZ
:
259 * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6)
261 tuner_frequency
= (((params
->frequency
/ 1000) * 6) + 217496) / 1000;
263 /* setup tuner buffer */
264 tuner_buf
[0] = (tuner_frequency
>> 8) & 0x7f;
265 tuner_buf
[1] = tuner_frequency
& 0xff;
267 tuner_buf
[3] = (cp
<< 5) | (filter
<< 3) | band
;
269 if (fe
->ops
.i2c_gate_ctrl
)
270 fe
->ops
.i2c_gate_ctrl(fe
, 1);
271 if (i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1) != 1)
277 static int philips_tda6651_pll_init(u8 addr
, struct dvb_frontend
*fe
)
279 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
280 static u8 tu1216_init
[] = { 0x0b, 0xf5, 0x85, 0xab };
281 struct i2c_msg tuner_msg
= {.addr
= addr
,.flags
= 0,.buf
= tu1216_init
,.len
= sizeof(tu1216_init
) };
283 /* setup PLL configuration */
284 if (fe
->ops
.i2c_gate_ctrl
)
285 fe
->ops
.i2c_gate_ctrl(fe
, 1);
286 if (i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1) != 1)
293 /* ------------------------------------------------------------------ */
295 static int philips_tu1216_tuner_60_init(struct dvb_frontend
*fe
)
297 return philips_tda6651_pll_init(0x60, fe
);
300 static int philips_tu1216_tuner_60_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
302 return philips_tda6651_pll_set(0x60, fe
, params
);
305 static int philips_tu1216_request_firmware(struct dvb_frontend
*fe
,
306 const struct firmware
**fw
, char *name
)
308 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
309 return request_firmware(fw
, name
, &dev
->pci
->dev
);
312 static struct tda1004x_config philips_tu1216_60_config
= {
314 .demod_address
= 0x8,
317 .xtal_freq
= TDA10046_XTAL_4M
,
318 .agc_config
= TDA10046_AGC_DEFAULT
,
319 .if_freq
= TDA10046_FREQ_3617
,
320 .request_firmware
= philips_tu1216_request_firmware
,
323 /* ------------------------------------------------------------------ */
325 static int philips_tu1216_tuner_61_init(struct dvb_frontend
*fe
)
327 return philips_tda6651_pll_init(0x61, fe
);
330 static int philips_tu1216_tuner_61_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
332 return philips_tda6651_pll_set(0x61, fe
, params
);
335 static struct tda1004x_config philips_tu1216_61_config
= {
337 .demod_address
= 0x8,
340 .xtal_freq
= TDA10046_XTAL_4M
,
341 .agc_config
= TDA10046_AGC_DEFAULT
,
342 .if_freq
= TDA10046_FREQ_3617
,
343 .request_firmware
= philips_tu1216_request_firmware
,
346 /* ------------------------------------------------------------------ */
348 static int philips_europa_tuner_init(struct dvb_frontend
*fe
)
350 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
351 static u8 msg
[] = { 0x0b, 0xf5, 0x86, 0xab };
352 struct i2c_msg init_msg
= {.addr
= 0x61,.flags
= 0,.buf
= msg
,.len
= sizeof(msg
) };
354 /* setup PLL configuration */
355 if (fe
->ops
.i2c_gate_ctrl
)
356 fe
->ops
.i2c_gate_ctrl(fe
, 1);
357 if (i2c_transfer(&dev
->i2c_adap
, &init_msg
, 1) != 1)
361 /* switch the board to dvb mode */
362 init_msg
.addr
= 0x43;
366 if (fe
->ops
.i2c_gate_ctrl
)
367 fe
->ops
.i2c_gate_ctrl(fe
, 1);
368 if (i2c_transfer(&dev
->i2c_adap
, &init_msg
, 1) != 1)
374 static int philips_td1316_tuner_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
376 return philips_tda6651_pll_set(0x61, fe
, params
);
379 static int philips_europa_tuner_sleep(struct dvb_frontend
*fe
)
381 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
382 /* this message actually turns the tuner back to analog mode */
383 static u8 msg
[] = { 0x0b, 0xdc, 0x86, 0xa4 };
384 struct i2c_msg analog_msg
= {.addr
= 0x61,.flags
= 0,.buf
= msg
,.len
= sizeof(msg
) };
386 i2c_transfer(&dev
->i2c_adap
, &analog_msg
, 1);
389 /* switch the board to analog mode */
390 analog_msg
.addr
= 0x43;
391 analog_msg
.len
= 0x02;
394 if (fe
->ops
.i2c_gate_ctrl
)
395 fe
->ops
.i2c_gate_ctrl(fe
, 1);
396 i2c_transfer(&dev
->i2c_adap
, &analog_msg
, 1);
400 static int philips_europa_demod_sleep(struct dvb_frontend
*fe
)
402 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
404 if (dev
->original_demod_sleep
)
405 dev
->original_demod_sleep(fe
);
406 fe
->ops
.i2c_gate_ctrl(fe
, 1);
410 static struct tda1004x_config philips_europa_config
= {
412 .demod_address
= 0x8,
415 .xtal_freq
= TDA10046_XTAL_4M
,
416 .agc_config
= TDA10046_AGC_IFO_AUTO_POS
,
417 .if_freq
= TDA10046_FREQ_052
,
418 .request_firmware
= NULL
,
421 /* ------------------------------------------------------------------ */
423 static int philips_fmd1216_tuner_init(struct dvb_frontend
*fe
)
425 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
426 /* this message is to set up ATC and ALC */
427 static u8 fmd1216_init
[] = { 0x0b, 0xdc, 0x9c, 0xa0 };
428 struct i2c_msg tuner_msg
= {.addr
= 0x61,.flags
= 0,.buf
= fmd1216_init
,.len
= sizeof(fmd1216_init
) };
430 if (fe
->ops
.i2c_gate_ctrl
)
431 fe
->ops
.i2c_gate_ctrl(fe
, 1);
432 if (i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1) != 1)
439 static int philips_fmd1216_tuner_sleep(struct dvb_frontend
*fe
)
441 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
442 /* this message actually turns the tuner back to analog mode */
443 static u8 fmd1216_init
[] = { 0x0b, 0xdc, 0x9c, 0x60 };
444 struct i2c_msg tuner_msg
= {.addr
= 0x61,.flags
= 0,.buf
= fmd1216_init
,.len
= sizeof(fmd1216_init
) };
446 if (fe
->ops
.i2c_gate_ctrl
)
447 fe
->ops
.i2c_gate_ctrl(fe
, 1);
448 i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1);
450 fmd1216_init
[2] = 0x86;
451 fmd1216_init
[3] = 0x54;
452 if (fe
->ops
.i2c_gate_ctrl
)
453 fe
->ops
.i2c_gate_ctrl(fe
, 1);
454 i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1);
459 static int philips_fmd1216_tuner_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
461 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
463 struct i2c_msg tuner_msg
= {.addr
= 0x61,.flags
= 0,.buf
= tuner_buf
,.len
=
465 int tuner_frequency
= 0;
469 /* determine charge pump */
470 tuner_frequency
= params
->frequency
+ 36130000;
471 if (tuner_frequency
< 87000000)
474 else if (tuner_frequency
< 180000000) {
478 } else if (tuner_frequency
< 195000000) {
483 } else if (tuner_frequency
< 366000000) {
484 if (params
->u
.ofdm
.bandwidth
== BANDWIDTH_8_MHZ
) {
491 } else if (tuner_frequency
< 478000000) {
492 if (params
->u
.ofdm
.bandwidth
== BANDWIDTH_8_MHZ
) {
500 } else if (tuner_frequency
< 662000000) {
501 if (params
->u
.ofdm
.bandwidth
== BANDWIDTH_8_MHZ
) {
508 } else if (tuner_frequency
< 840000000) {
509 if (params
->u
.ofdm
.bandwidth
== BANDWIDTH_8_MHZ
) {
517 if (params
->u
.ofdm
.bandwidth
== BANDWIDTH_8_MHZ
) {
526 /* calculate divisor */
527 /* ((36166000 + Finput) / 166666) rounded! */
528 divider
= (tuner_frequency
+ 83333) / 166667;
530 /* setup tuner buffer */
531 tuner_buf
[0] = (divider
>> 8) & 0x7f;
532 tuner_buf
[1] = divider
& 0xff;
533 tuner_buf
[2] = 0x80 | (cp
<< 6) | (mode
<< 3) | 4;
534 tuner_buf
[3] = 0x40 | band
;
536 if (fe
->ops
.i2c_gate_ctrl
)
537 fe
->ops
.i2c_gate_ctrl(fe
, 1);
538 if (i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1) != 1)
543 static struct tda1004x_config medion_cardbus
= {
544 .demod_address
= 0x08,
547 .xtal_freq
= TDA10046_XTAL_16M
,
548 .agc_config
= TDA10046_AGC_IFO_AUTO_NEG
,
549 .if_freq
= TDA10046_FREQ_3613
,
550 .request_firmware
= NULL
,
553 /* ------------------------------------------------------------------ */
555 struct tda827x_data
{
565 static struct tda827x_data tda827x_dvbt
[] = {
566 { .lomax
= 62000000, .spd
= 3, .bs
= 2, .bp
= 0, .cp
= 0, .gc3
= 3, .div1p5
= 1},
567 { .lomax
= 66000000, .spd
= 3, .bs
= 3, .bp
= 0, .cp
= 0, .gc3
= 3, .div1p5
= 1},
568 { .lomax
= 76000000, .spd
= 3, .bs
= 1, .bp
= 0, .cp
= 0, .gc3
= 3, .div1p5
= 0},
569 { .lomax
= 84000000, .spd
= 3, .bs
= 2, .bp
= 0, .cp
= 0, .gc3
= 3, .div1p5
= 0},
570 { .lomax
= 93000000, .spd
= 3, .bs
= 2, .bp
= 0, .cp
= 0, .gc3
= 1, .div1p5
= 0},
571 { .lomax
= 98000000, .spd
= 3, .bs
= 3, .bp
= 0, .cp
= 0, .gc3
= 1, .div1p5
= 0},
572 { .lomax
= 109000000, .spd
= 3, .bs
= 3, .bp
= 1, .cp
= 0, .gc3
= 1, .div1p5
= 0},
573 { .lomax
= 123000000, .spd
= 2, .bs
= 2, .bp
= 1, .cp
= 0, .gc3
= 1, .div1p5
= 1},
574 { .lomax
= 133000000, .spd
= 2, .bs
= 3, .bp
= 1, .cp
= 0, .gc3
= 1, .div1p5
= 1},
575 { .lomax
= 151000000, .spd
= 2, .bs
= 1, .bp
= 1, .cp
= 0, .gc3
= 1, .div1p5
= 0},
576 { .lomax
= 154000000, .spd
= 2, .bs
= 2, .bp
= 1, .cp
= 0, .gc3
= 1, .div1p5
= 0},
577 { .lomax
= 181000000, .spd
= 2, .bs
= 2, .bp
= 1, .cp
= 0, .gc3
= 0, .div1p5
= 0},
578 { .lomax
= 185000000, .spd
= 2, .bs
= 2, .bp
= 2, .cp
= 0, .gc3
= 1, .div1p5
= 0},
579 { .lomax
= 217000000, .spd
= 2, .bs
= 3, .bp
= 2, .cp
= 0, .gc3
= 1, .div1p5
= 0},
580 { .lomax
= 244000000, .spd
= 1, .bs
= 2, .bp
= 2, .cp
= 0, .gc3
= 1, .div1p5
= 1},
581 { .lomax
= 265000000, .spd
= 1, .bs
= 3, .bp
= 2, .cp
= 0, .gc3
= 1, .div1p5
= 1},
582 { .lomax
= 302000000, .spd
= 1, .bs
= 1, .bp
= 2, .cp
= 0, .gc3
= 1, .div1p5
= 0},
583 { .lomax
= 324000000, .spd
= 1, .bs
= 2, .bp
= 2, .cp
= 0, .gc3
= 1, .div1p5
= 0},
584 { .lomax
= 370000000, .spd
= 1, .bs
= 2, .bp
= 3, .cp
= 0, .gc3
= 1, .div1p5
= 0},
585 { .lomax
= 454000000, .spd
= 1, .bs
= 3, .bp
= 3, .cp
= 0, .gc3
= 1, .div1p5
= 0},
586 { .lomax
= 493000000, .spd
= 0, .bs
= 2, .bp
= 3, .cp
= 0, .gc3
= 1, .div1p5
= 1},
587 { .lomax
= 530000000, .spd
= 0, .bs
= 3, .bp
= 3, .cp
= 0, .gc3
= 1, .div1p5
= 1},
588 { .lomax
= 554000000, .spd
= 0, .bs
= 1, .bp
= 3, .cp
= 0, .gc3
= 1, .div1p5
= 0},
589 { .lomax
= 604000000, .spd
= 0, .bs
= 1, .bp
= 4, .cp
= 0, .gc3
= 0, .div1p5
= 0},
590 { .lomax
= 696000000, .spd
= 0, .bs
= 2, .bp
= 4, .cp
= 0, .gc3
= 0, .div1p5
= 0},
591 { .lomax
= 740000000, .spd
= 0, .bs
= 2, .bp
= 4, .cp
= 1, .gc3
= 0, .div1p5
= 0},
592 { .lomax
= 820000000, .spd
= 0, .bs
= 3, .bp
= 4, .cp
= 0, .gc3
= 0, .div1p5
= 0},
593 { .lomax
= 865000000, .spd
= 0, .bs
= 3, .bp
= 4, .cp
= 1, .gc3
= 0, .div1p5
= 0},
594 { .lomax
= 0, .spd
= 0, .bs
= 0, .bp
= 0, .cp
= 0, .gc3
= 0, .div1p5
= 0}
597 static int philips_tda827x_tuner_init(struct dvb_frontend
*fe
)
602 static int philips_tda827x_tuner_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
604 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
607 struct i2c_msg tuner_msg
= {.addr
= 0x60,.flags
= 0,.buf
= tuner_buf
,
608 .len
= sizeof(tuner_buf
) };
609 int i
, tuner_freq
, if_freq
;
611 switch (params
->u
.ofdm
.bandwidth
) {
612 case BANDWIDTH_6_MHZ
:
615 case BANDWIDTH_7_MHZ
:
618 default: /* 8 MHz or Auto */
622 tuner_freq
= params
->frequency
+ if_freq
;
625 while (tda827x_dvbt
[i
].lomax
< tuner_freq
) {
626 if(tda827x_dvbt
[i
+ 1].lomax
== 0)
631 N
= ((tuner_freq
+ 125000) / 250000) << (tda827x_dvbt
[i
].spd
+ 2);
633 tuner_buf
[1] = (N
>>8) | 0x40;
634 tuner_buf
[2] = N
& 0xff;
637 tuner_buf
[5] = (tda827x_dvbt
[i
].spd
<< 6) + (tda827x_dvbt
[i
].div1p5
<< 5) +
638 (tda827x_dvbt
[i
].bs
<< 3) + tda827x_dvbt
[i
].bp
;
639 tuner_buf
[6] = (tda827x_dvbt
[i
].gc3
<< 4) + 0x8f;
643 tuner_buf
[10] = 0xff;
644 tuner_buf
[11] = 0x00;
645 tuner_buf
[12] = 0x00;
646 tuner_buf
[13] = 0x40;
649 if (fe
->ops
.i2c_gate_ctrl
)
650 fe
->ops
.i2c_gate_ctrl(fe
, 1);
651 if (i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1) != 1)
655 /* correct CP value */
657 tuner_buf
[1] = 0x50 + tda827x_dvbt
[i
].cp
;
659 if (fe
->ops
.i2c_gate_ctrl
)
660 fe
->ops
.i2c_gate_ctrl(fe
, 1);
661 i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1);
666 static int philips_tda827x_tuner_sleep(struct dvb_frontend
*fe
)
668 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
669 static u8 tda827x_sleep
[] = { 0x30, 0xd0};
670 struct i2c_msg tuner_msg
= {.addr
= 0x60,.flags
= 0,.buf
= tda827x_sleep
,
671 .len
= sizeof(tda827x_sleep
) };
672 if (fe
->ops
.i2c_gate_ctrl
)
673 fe
->ops
.i2c_gate_ctrl(fe
, 1);
674 i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1);
678 static struct tda1004x_config tda827x_lifeview_config
= {
679 .demod_address
= 0x08,
682 .xtal_freq
= TDA10046_XTAL_16M
,
683 .agc_config
= TDA10046_AGC_TDA827X
,
684 .if_freq
= TDA10046_FREQ_045
,
685 .request_firmware
= NULL
,
688 /* ------------------------------------------------------------------ */
690 struct tda827xa_data
{
699 static struct tda827xa_data tda827xa_dvbt
[] = {
700 { .lomax
= 56875000, .svco
= 3, .spd
= 4, .scr
= 0, .sbs
= 0, .gc3
= 1},
701 { .lomax
= 67250000, .svco
= 0, .spd
= 3, .scr
= 0, .sbs
= 0, .gc3
= 1},
702 { .lomax
= 81250000, .svco
= 1, .spd
= 3, .scr
= 0, .sbs
= 0, .gc3
= 1},
703 { .lomax
= 97500000, .svco
= 2, .spd
= 3, .scr
= 0, .sbs
= 0, .gc3
= 1},
704 { .lomax
= 113750000, .svco
= 3, .spd
= 3, .scr
= 0, .sbs
= 1, .gc3
= 1},
705 { .lomax
= 134500000, .svco
= 0, .spd
= 2, .scr
= 0, .sbs
= 1, .gc3
= 1},
706 { .lomax
= 154000000, .svco
= 1, .spd
= 2, .scr
= 0, .sbs
= 1, .gc3
= 1},
707 { .lomax
= 162500000, .svco
= 1, .spd
= 2, .scr
= 0, .sbs
= 1, .gc3
= 1},
708 { .lomax
= 183000000, .svco
= 2, .spd
= 2, .scr
= 0, .sbs
= 1, .gc3
= 1},
709 { .lomax
= 195000000, .svco
= 2, .spd
= 2, .scr
= 0, .sbs
= 2, .gc3
= 1},
710 { .lomax
= 227500000, .svco
= 3, .spd
= 2, .scr
= 0, .sbs
= 2, .gc3
= 1},
711 { .lomax
= 269000000, .svco
= 0, .spd
= 1, .scr
= 0, .sbs
= 2, .gc3
= 1},
712 { .lomax
= 290000000, .svco
= 1, .spd
= 1, .scr
= 0, .sbs
= 2, .gc3
= 1},
713 { .lomax
= 325000000, .svco
= 1, .spd
= 1, .scr
= 0, .sbs
= 3, .gc3
= 1},
714 { .lomax
= 390000000, .svco
= 2, .spd
= 1, .scr
= 0, .sbs
= 3, .gc3
= 1},
715 { .lomax
= 455000000, .svco
= 3, .spd
= 1, .scr
= 0, .sbs
= 3, .gc3
= 1},
716 { .lomax
= 520000000, .svco
= 0, .spd
= 0, .scr
= 0, .sbs
= 3, .gc3
= 1},
717 { .lomax
= 538000000, .svco
= 0, .spd
= 0, .scr
= 1, .sbs
= 3, .gc3
= 1},
718 { .lomax
= 550000000, .svco
= 1, .spd
= 0, .scr
= 0, .sbs
= 3, .gc3
= 1},
719 { .lomax
= 620000000, .svco
= 1, .spd
= 0, .scr
= 0, .sbs
= 4, .gc3
= 0},
720 { .lomax
= 650000000, .svco
= 1, .spd
= 0, .scr
= 1, .sbs
= 4, .gc3
= 0},
721 { .lomax
= 700000000, .svco
= 2, .spd
= 0, .scr
= 0, .sbs
= 4, .gc3
= 0},
722 { .lomax
= 780000000, .svco
= 2, .spd
= 0, .scr
= 1, .sbs
= 4, .gc3
= 0},
723 { .lomax
= 820000000, .svco
= 3, .spd
= 0, .scr
= 0, .sbs
= 4, .gc3
= 0},
724 { .lomax
= 870000000, .svco
= 3, .spd
= 0, .scr
= 1, .sbs
= 4, .gc3
= 0},
725 { .lomax
= 911000000, .svco
= 3, .spd
= 0, .scr
= 2, .sbs
= 4, .gc3
= 0},
726 { .lomax
= 0, .svco
= 0, .spd
= 0, .scr
= 0, .sbs
= 0, .gc3
= 0}};
729 static int philips_tda827xa_pll_set(u8 addr
, struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
731 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
733 unsigned char reg2
[2];
735 struct i2c_msg msg
= {.addr
= addr
,.flags
= 0,.buf
= tuner_buf
};
736 int i
, tuner_freq
, if_freq
;
739 switch (params
->u
.ofdm
.bandwidth
) {
740 case BANDWIDTH_6_MHZ
:
743 case BANDWIDTH_7_MHZ
:
746 default: /* 8 MHz or Auto */
750 tuner_freq
= params
->frequency
+ if_freq
;
753 while (tda827xa_dvbt
[i
].lomax
< tuner_freq
) {
754 if(tda827xa_dvbt
[i
+ 1].lomax
== 0)
759 N
= ((tuner_freq
+ 31250) / 62500) << tda827xa_dvbt
[i
].spd
;
760 tuner_buf
[0] = 0; // subaddress
761 tuner_buf
[1] = N
>> 8;
762 tuner_buf
[2] = N
& 0xff;
765 tuner_buf
[5] = (tda827xa_dvbt
[i
].spd
<< 5) + (tda827xa_dvbt
[i
].svco
<< 3) +
766 tda827xa_dvbt
[i
].sbs
;
767 tuner_buf
[6] = 0x4b + (tda827xa_dvbt
[i
].gc3
<< 4);
771 tuner_buf
[10] = 0xff;
772 tuner_buf
[11] = 0x60;
773 tuner_buf
[12] = 0x00;
774 tuner_buf
[13] = 0x39; // lpsel
776 if (fe
->ops
.i2c_gate_ctrl
)
777 fe
->ops
.i2c_gate_ctrl(fe
, 1);
778 if (i2c_transfer(&dev
->i2c_adap
, &msg
, 1) != 1)
785 if (fe
->ops
.i2c_gate_ctrl
)
786 fe
->ops
.i2c_gate_ctrl(fe
, 1);
787 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
791 if (fe
->ops
.i2c_gate_ctrl
)
792 fe
->ops
.i2c_gate_ctrl(fe
, 1);
793 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
796 /* correct CP value */
798 reg2
[1] = 0x10 + tda827xa_dvbt
[i
].scr
;
800 if (fe
->ops
.i2c_gate_ctrl
)
801 fe
->ops
.i2c_gate_ctrl(fe
, 1);
802 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
806 reg2
[1] = 0x4f + (tda827xa_dvbt
[i
].gc3
<< 4);
807 if (fe
->ops
.i2c_gate_ctrl
)
808 fe
->ops
.i2c_gate_ctrl(fe
, 1);
809 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
815 static int philips_tda827xa_tuner_sleep(u8 addr
, struct dvb_frontend
*fe
)
817 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
818 static u8 tda827xa_sleep
[] = { 0x30, 0x90};
819 struct i2c_msg tuner_msg
= {.addr
= addr
,.flags
= 0,.buf
= tda827xa_sleep
,
820 .len
= sizeof(tda827xa_sleep
) };
821 if (fe
->ops
.i2c_gate_ctrl
)
822 fe
->ops
.i2c_gate_ctrl(fe
, 1);
823 i2c_transfer(&dev
->i2c_adap
, &tuner_msg
, 1);
827 /* ------------------------------------------------------------------ */
829 static int philips_tiger_tuner_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
832 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
833 static u8 tda8290_close
[] = { 0x21, 0xc0};
834 static u8 tda8290_open
[] = { 0x21, 0x80};
835 struct i2c_msg tda8290_msg
= {.addr
= 0x4b,.flags
= 0, .len
= 2};
837 /* close tda8290 i2c bridge */
838 tda8290_msg
.buf
= tda8290_close
;
839 ret
= i2c_transfer(&dev
->i2c_adap
, &tda8290_msg
, 1);
843 ret
= philips_tda827xa_pll_set(0x61, fe
, params
);
846 /* open tda8290 i2c bridge */
847 tda8290_msg
.buf
= tda8290_open
;
848 i2c_transfer(&dev
->i2c_adap
, &tda8290_msg
, 1);
852 static int philips_tiger_tuner_init(struct dvb_frontend
*fe
)
854 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
855 static u8 data
[] = { 0x3c, 0x33, 0x6a};
856 struct i2c_msg msg
= {.addr
=0x08, .flags
=0, .buf
=data
, .len
= sizeof(data
)};
858 if (i2c_transfer(&dev
->i2c_adap
, &msg
, 1) != 1)
863 static int philips_tiger_tuner_sleep(struct dvb_frontend
*fe
)
865 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
866 static u8 data
[] = { 0x3c, 0x33, 0x68};
867 struct i2c_msg msg
= {.addr
=0x08, .flags
=0, .buf
=data
, .len
= sizeof(data
)};
869 i2c_transfer(&dev
->i2c_adap
, &msg
, 1);
870 philips_tda827xa_tuner_sleep( 0x61, fe
);
874 static struct tda1004x_config philips_tiger_config
= {
875 .demod_address
= 0x08,
878 .xtal_freq
= TDA10046_XTAL_16M
,
879 .agc_config
= TDA10046_AGC_TDA827X
,
880 .if_freq
= TDA10046_FREQ_045
,
881 .request_firmware
= NULL
,
884 /* ------------------------------------------------------------------ */
886 static int lifeview_trio_tuner_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
890 ret
= philips_tda827xa_pll_set(0x60, fe
, params
);
894 static int lifeview_trio_tuner_sleep(struct dvb_frontend
*fe
)
896 philips_tda827xa_tuner_sleep(0x60, fe
);
900 static struct tda1004x_config lifeview_trio_config
= {
901 .demod_address
= 0x09,
904 .xtal_freq
= TDA10046_XTAL_16M
,
905 .agc_config
= TDA10046_AGC_TDA827X_GPL
,
906 .if_freq
= TDA10046_FREQ_045
,
907 .request_firmware
= NULL
,
910 /* ------------------------------------------------------------------ */
912 static int ads_duo_tuner_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
916 ret
= philips_tda827xa_pll_set(0x61, fe
, params
);
920 static int ads_duo_tuner_init(struct dvb_frontend
*fe
)
922 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
923 /* route TDA8275a AGC input to the channel decoder */
924 saa_writeb(SAA7134_GPIO_GPSTATUS2
, 0x60);
928 static int ads_duo_tuner_sleep(struct dvb_frontend
*fe
)
930 struct saa7134_dev
*dev
= fe
->dvb
->priv
;
931 /* route TDA8275a AGC input to the analog IF chip*/
932 saa_writeb(SAA7134_GPIO_GPSTATUS2
, 0x20);
933 philips_tda827xa_tuner_sleep( 0x61, fe
);
937 static struct tda1004x_config ads_tech_duo_config
= {
938 .demod_address
= 0x08,
941 .xtal_freq
= TDA10046_XTAL_16M
,
942 .agc_config
= TDA10046_AGC_TDA827X_GPL
,
943 .if_freq
= TDA10046_FREQ_045
,
944 .request_firmware
= NULL
,
947 /* ------------------------------------------------------------------ */
949 static int tevion_dvb220rf_tuner_set_params(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*params
)
952 ret
= philips_tda827xa_pll_set(0x60, fe
, params
);
956 static int tevion_dvb220rf_tuner_sleep(struct dvb_frontend
*fe
)
958 philips_tda827xa_tuner_sleep( 0x61, fe
);
962 static struct tda1004x_config tevion_dvbt220rf_config
= {
963 .demod_address
= 0x08,
966 .xtal_freq
= TDA10046_XTAL_16M
,
967 .agc_config
= TDA10046_AGC_TDA827X
,
968 .if_freq
= TDA10046_FREQ_045
,
969 .request_firmware
= NULL
,
974 /* ------------------------------------------------------------------ */
977 static struct nxt200x_config avertvhda180
= {
978 .demod_address
= 0x0a,
981 static int nxt200x_set_pll_input(u8
*buf
, int input
)
990 static struct nxt200x_config kworldatsc110
= {
991 .demod_address
= 0x0a,
992 .set_pll_input
= nxt200x_set_pll_input
,
996 /* ------------------------------------------------------------------ */
998 static int dvb_init(struct saa7134_dev
*dev
)
1000 /* init struct videobuf_dvb */
1001 dev
->ts
.nr_bufs
= 32;
1002 dev
->ts
.nr_packets
= 32*4;
1003 dev
->dvb
.name
= dev
->name
;
1004 videobuf_queue_init(&dev
->dvb
.dvbq
, &saa7134_ts_qops
,
1005 dev
->pci
, &dev
->slock
,
1006 V4L2_BUF_TYPE_VIDEO_CAPTURE
,
1007 V4L2_FIELD_ALTERNATE
,
1008 sizeof(struct saa7134_buf
),
1011 switch (dev
->board
) {
1013 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL
:
1014 printk("%s: pinnacle 300i dvb setup\n",dev
->name
);
1015 dev
->dvb
.frontend
= mt352_attach(&pinnacle_300i
,
1017 if (dev
->dvb
.frontend
) {
1018 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= mt352_pinnacle_tuner_set_params
;
1022 case SAA7134_BOARD_AVERMEDIA_777
:
1023 printk("%s: avertv 777 dvb setup\n",dev
->name
);
1024 dev
->dvb
.frontend
= mt352_attach(&avermedia_777
,
1026 if (dev
->dvb
.frontend
) {
1027 dev
->dvb
.frontend
->ops
.tuner_ops
.calc_regs
= mt352_aver777_tuner_calc_regs
;
1031 #ifdef HAVE_TDA1004X
1032 case SAA7134_BOARD_MD7134
:
1033 dev
->dvb
.frontend
= tda10046_attach(&medion_cardbus
,
1035 if (dev
->dvb
.frontend
) {
1036 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_fmd1216_tuner_init
;
1037 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_fmd1216_tuner_sleep
;
1038 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_fmd1216_tuner_set_params
;
1041 case SAA7134_BOARD_PHILIPS_TOUGH
:
1042 dev
->dvb
.frontend
= tda10046_attach(&philips_tu1216_60_config
,
1044 if (dev
->dvb
.frontend
) {
1045 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tu1216_tuner_60_init
;
1046 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tu1216_tuner_60_set_params
;
1049 case SAA7134_BOARD_FLYDVBTDUO
:
1050 dev
->dvb
.frontend
= tda10046_attach(&tda827x_lifeview_config
,
1052 if (dev
->dvb
.frontend
) {
1053 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tda827x_tuner_init
;
1054 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_tda827x_tuner_sleep
;
1055 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tda827x_tuner_set_params
;
1058 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS
:
1059 dev
->dvb
.frontend
= tda10046_attach(&tda827x_lifeview_config
,
1061 if (dev
->dvb
.frontend
) {
1062 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tda827x_tuner_init
;
1063 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_tda827x_tuner_sleep
;
1064 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tda827x_tuner_set_params
;
1067 case SAA7134_BOARD_PHILIPS_EUROPA
:
1068 dev
->dvb
.frontend
= tda10046_attach(&philips_europa_config
,
1070 if (dev
->dvb
.frontend
) {
1071 dev
->original_demod_sleep
= dev
->dvb
.frontend
->ops
.sleep
;
1072 dev
->dvb
.frontend
->ops
.sleep
= philips_europa_demod_sleep
;
1073 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_europa_tuner_init
;
1074 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_europa_tuner_sleep
;
1075 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_td1316_tuner_set_params
;
1078 case SAA7134_BOARD_VIDEOMATE_DVBT_300
:
1079 dev
->dvb
.frontend
= tda10046_attach(&philips_europa_config
,
1081 if (dev
->dvb
.frontend
) {
1082 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_europa_tuner_init
;
1083 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_europa_tuner_sleep
;
1084 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_td1316_tuner_set_params
;
1087 case SAA7134_BOARD_VIDEOMATE_DVBT_200
:
1088 dev
->dvb
.frontend
= tda10046_attach(&philips_tu1216_61_config
,
1090 if (dev
->dvb
.frontend
) {
1091 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tu1216_tuner_61_init
;
1092 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tu1216_tuner_61_set_params
;
1095 case SAA7134_BOARD_PHILIPS_TIGER
:
1096 dev
->dvb
.frontend
= tda10046_attach(&philips_tiger_config
,
1098 if (dev
->dvb
.frontend
) {
1099 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tiger_tuner_init
;
1100 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_tiger_tuner_sleep
;
1101 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tiger_tuner_set_params
;
1104 case SAA7134_BOARD_ASUSTeK_P7131_DUAL
:
1105 dev
->dvb
.frontend
= tda10046_attach(&philips_tiger_config
,
1107 if (dev
->dvb
.frontend
) {
1108 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tiger_tuner_init
;
1109 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_tiger_tuner_sleep
;
1110 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tiger_tuner_set_params
;
1113 case SAA7134_BOARD_FLYDVBT_LR301
:
1114 dev
->dvb
.frontend
= tda10046_attach(&tda827x_lifeview_config
,
1116 if (dev
->dvb
.frontend
) {
1117 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= philips_tda827x_tuner_init
;
1118 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= philips_tda827x_tuner_sleep
;
1119 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= philips_tda827x_tuner_set_params
;
1122 case SAA7134_BOARD_FLYDVB_TRIO
:
1123 dev
->dvb
.frontend
= tda10046_attach(&lifeview_trio_config
,
1125 if (dev
->dvb
.frontend
) {
1126 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= lifeview_trio_tuner_sleep
;
1127 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= lifeview_trio_tuner_set_params
;
1130 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331
:
1131 dev
->dvb
.frontend
= tda10046_attach(&ads_tech_duo_config
,
1133 if (dev
->dvb
.frontend
) {
1134 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= ads_duo_tuner_init
;
1135 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= ads_duo_tuner_sleep
;
1136 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= ads_duo_tuner_set_params
;
1139 case SAA7134_BOARD_TEVION_DVBT_220RF
:
1140 dev
->dvb
.frontend
= tda10046_attach(&tevion_dvbt220rf_config
,
1142 if (dev
->dvb
.frontend
) {
1143 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= tevion_dvb220rf_tuner_sleep
;
1144 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= tevion_dvb220rf_tuner_set_params
;
1147 case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS
:
1148 dev
->dvb
.frontend
= tda10046_attach(&ads_tech_duo_config
,
1150 if (dev
->dvb
.frontend
) {
1151 dev
->dvb
.frontend
->ops
.tuner_ops
.init
= ads_duo_tuner_init
;
1152 dev
->dvb
.frontend
->ops
.tuner_ops
.sleep
= ads_duo_tuner_sleep
;
1153 dev
->dvb
.frontend
->ops
.tuner_ops
.set_params
= ads_duo_tuner_set_params
;
1158 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180
:
1159 dev
->dvb
.frontend
= nxt200x_attach(&avertvhda180
, &dev
->i2c_adap
);
1160 if (dev
->dvb
.frontend
) {
1161 dvb_pll_attach(dev
->dvb
.frontend
, 0x61, &dev
->i2c_adap
, &dvb_pll_tdhu2
);
1164 case SAA7134_BOARD_KWORLD_ATSC110
:
1165 dev
->dvb
.frontend
= nxt200x_attach(&kworldatsc110
, &dev
->i2c_adap
);
1166 if (dev
->dvb
.frontend
) {
1167 dvb_pll_attach(dev
->dvb
.frontend
, 0x61, &dev
->i2c_adap
, &dvb_pll_tuv1236d
);
1172 printk("%s: Huh? unknown DVB card?\n",dev
->name
);
1176 if (NULL
== dev
->dvb
.frontend
) {
1177 printk("%s: frontend initialization failed\n",dev
->name
);
1181 /* register everything else */
1182 return videobuf_dvb_register(&dev
->dvb
, THIS_MODULE
, dev
, &dev
->pci
->dev
);
1185 static int dvb_fini(struct saa7134_dev
*dev
)
1187 static int on
= TDA9887_PRESENT
| TDA9887_PORT2_INACTIVE
;
1189 switch (dev
->board
) {
1190 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL
:
1191 /* otherwise we don't detect the tuner on next insmod */
1192 saa7134_i2c_call_clients(dev
,TDA9887_SET_CONFIG
,&on
);
1195 videobuf_dvb_unregister(&dev
->dvb
);
1199 static struct saa7134_mpeg_ops dvb_ops
= {
1200 .type
= SAA7134_MPEG_DVB
,
1205 static int __init
dvb_register(void)
1207 return saa7134_ts_register(&dvb_ops
);
1210 static void __exit
dvb_unregister(void)
1212 saa7134_ts_unregister(&dvb_ops
);
1215 module_init(dvb_register
);
1216 module_exit(dvb_unregister
);
1218 /* ------------------------------------------------------------------ */