blob: d62e9a4f2a1c3db36df07de569877eeea26e98ff [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 *
3 * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
4 *
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07005 * Extended 3 / 2005 by Hartmut Hackmann to support various
6 * cards with the tda10046 DVB-T channel decoder
7 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 * 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.
12 *
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.
17 *
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.
21 */
22
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>
31
32#include "saa7134-reg.h"
33#include "saa7134.h"
Michael Krufky5e453dc2006-01-09 15:32:31 -020034#include <media/v4l2-common.h>
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -020035#include "dvb-pll.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
Michael Krufky29780bb2005-07-27 11:45:59 -070037#ifdef HAVE_MT352
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -070038# include "mt352.h"
39# include "mt352_priv.h" /* FIXME */
40#endif
Michael Krufky29780bb2005-07-27 11:45:59 -070041#ifdef HAVE_TDA1004X
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -070042# include "tda1004x.h"
43#endif
Michael Krufky3b64e8e2005-11-08 21:38:20 -080044#ifdef HAVE_NXT200X
45# include "nxt200x.h"
Michael Krufky3b64e8e2005-11-08 21:38:20 -080046#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
48MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
49MODULE_LICENSE("GPL");
50
51static unsigned int antenna_pwr = 0;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -070052
Linus Torvalds1da177e2005-04-16 15:20:36 -070053module_param(antenna_pwr, int, 0444);
54MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)");
55
56/* ------------------------------------------------------------------ */
57
Michael Krufky29780bb2005-07-27 11:45:59 -070058#ifdef HAVE_MT352
Linus Torvalds1da177e2005-04-16 15:20:36 -070059static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on)
60{
61 u32 ok;
62
63 if (!on) {
64 saa_setl(SAA7134_GPIO_GPMODE0 >> 2, (1 << 26));
65 saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26));
66 return 0;
67 }
68
69 saa_setl(SAA7134_GPIO_GPMODE0 >> 2, (1 << 26));
70 saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26));
71 udelay(10);
72
73 saa_setl(SAA7134_GPIO_GPMODE0 >> 2, (1 << 28));
74 saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 28));
75 udelay(10);
76 saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 28));
77 udelay(10);
78 ok = saa_readl(SAA7134_GPIO_GPSTATUS0) & (1 << 27);
79 printk("%s: %s %s\n", dev->name, __FUNCTION__,
80 ok ? "on" : "off");
81
82 if (!ok)
83 saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26));
84 return ok;
85}
86
87static int mt352_pinnacle_init(struct dvb_frontend* fe)
88{
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;
99
100 printk("%s: %s called\n",dev->name,__FUNCTION__);
101
102 mt352_write(fe, clock_config, sizeof(clock_config));
103 udelay(200);
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));
109
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));
Hartmut Hackmanndf8cf702006-03-03 12:09:26 -0300113
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 return 0;
115}
116
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -0200117static int mt352_aver777_init(struct dvb_frontend* fe)
118{
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 };
124
125 mt352_write(fe, clock_config, sizeof(clock_config));
126 udelay(200);
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));
131
132 return 0;
133}
134
Andrew de Quinceybd4956b2006-04-18 21:38:49 -0300135static int mt352_pinnacle_tuner_calc_regs(struct dvb_frontend* fe,
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300136 struct dvb_frontend_parameters* params,
137 u8* pllbuf, int buf_len)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138{
Hartmut Hackmanndf8cf702006-03-03 12:09:26 -0300139 u8 off[] = { 0x00, 0xf1};
140 u8 on[] = { 0x00, 0x71};
141 struct i2c_msg msg = {.addr=0x43, .flags=0, .buf=off, .len = sizeof(off)};
142
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 struct saa7134_dev *dev = fe->dvb->priv;
144 struct v4l2_frequency f;
145
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300146 if (buf_len < 5)
147 return -EINVAL;
148
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149 /* set frequency (mt2050) */
150 f.tuner = 0;
151 f.type = V4L2_TUNER_DIGITAL_TV;
152 f.frequency = params->frequency / 1000 * 16 / 1000;
Hartmut Hackmanndf8cf702006-03-03 12:09:26 -0300153 i2c_transfer(&dev->i2c_adap, &msg, 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f);
Hartmut Hackmanndf8cf702006-03-03 12:09:26 -0300155 msg.buf = on;
156 i2c_transfer(&dev->i2c_adap, &msg, 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157
158 pinnacle_antenna_pwr(dev, antenna_pwr);
159
160 /* mt352 setup */
161 mt352_pinnacle_init(fe);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300162 pllbuf[0] = 0x61;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163 pllbuf[1] = 0x00;
164 pllbuf[2] = 0x00;
165 pllbuf[3] = 0x80;
166 pllbuf[4] = 0x00;
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300167 return 5;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168}
169
Andrew de Quinceybd4956b2006-04-18 21:38:49 -0300170static int mt352_aver777_tuner_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, u8* pllbuf, int buf_len)
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -0200171{
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300172 if (buf_len < 5)
173 return -EINVAL;
174
175 pllbuf[0] = 0x61;
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -0200176 dvb_pll_configure(&dvb_pll_philips_td1316, pllbuf+1,
177 params->frequency,
178 params->u.ofdm.bandwidth);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300179 return 5;
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -0200180}
181
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182static struct mt352_config pinnacle_300i = {
183 .demod_address = 0x3c >> 1,
184 .adc_clock = 20333,
185 .if2 = 36150,
186 .no_tuner = 1,
187 .demod_init = mt352_pinnacle_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188};
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -0200189
190static struct mt352_config avermedia_777 = {
191 .demod_address = 0xf,
192 .demod_init = mt352_aver777_init,
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -0200193};
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700194#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195
196/* ------------------------------------------------------------------ */
197
Michael Krufky29780bb2005-07-27 11:45:59 -0700198#ifdef HAVE_TDA1004X
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800200static int philips_tda6651_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700201{
202 struct saa7134_dev *dev = fe->dvb->priv;
203 u8 tuner_buf[4];
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800204 struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tuner_buf,.len =
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700205 sizeof(tuner_buf) };
206 int tuner_frequency = 0;
207 u8 band, cp, filter;
208
209 /* determine charge pump */
210 tuner_frequency = params->frequency + 36166000;
211 if (tuner_frequency < 87000000)
212 return -EINVAL;
213 else if (tuner_frequency < 130000000)
214 cp = 3;
215 else if (tuner_frequency < 160000000)
216 cp = 5;
217 else if (tuner_frequency < 200000000)
218 cp = 6;
219 else if (tuner_frequency < 290000000)
220 cp = 3;
221 else if (tuner_frequency < 420000000)
222 cp = 5;
223 else if (tuner_frequency < 480000000)
224 cp = 6;
225 else if (tuner_frequency < 620000000)
226 cp = 3;
227 else if (tuner_frequency < 830000000)
228 cp = 5;
229 else if (tuner_frequency < 895000000)
230 cp = 7;
231 else
232 return -EINVAL;
233
234 /* determine band */
235 if (params->frequency < 49000000)
236 return -EINVAL;
237 else if (params->frequency < 161000000)
238 band = 1;
239 else if (params->frequency < 444000000)
240 band = 2;
241 else if (params->frequency < 861000000)
242 band = 4;
243 else
244 return -EINVAL;
245
246 /* setup PLL filter */
247 switch (params->u.ofdm.bandwidth) {
248 case BANDWIDTH_6_MHZ:
249 filter = 0;
250 break;
251
252 case BANDWIDTH_7_MHZ:
253 filter = 0;
254 break;
255
256 case BANDWIDTH_8_MHZ:
257 filter = 1;
258 break;
259
260 default:
261 return -EINVAL;
262 }
263
264 /* calculate divisor
265 * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6)
266 */
267 tuner_frequency = (((params->frequency / 1000) * 6) + 217496) / 1000;
268
269 /* setup tuner buffer */
270 tuner_buf[0] = (tuner_frequency >> 8) & 0x7f;
271 tuner_buf[1] = tuner_frequency & 0xff;
272 tuner_buf[2] = 0xca;
273 tuner_buf[3] = (cp << 5) | (filter << 3) | band;
274
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300275 if (fe->ops->i2c_gate_ctrl)
276 fe->ops->i2c_gate_ctrl(fe, 1);
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700277 if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1)
278 return -EIO;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700279 msleep(1);
280 return 0;
281}
282
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800283static int philips_tda6651_pll_init(u8 addr, struct dvb_frontend *fe)
284{
285 struct saa7134_dev *dev = fe->dvb->priv;
286 static u8 tu1216_init[] = { 0x0b, 0xf5, 0x85, 0xab };
287 struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) };
288
289 /* setup PLL configuration */
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300290 if (fe->ops->i2c_gate_ctrl)
291 fe->ops->i2c_gate_ctrl(fe, 1);
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800292 if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1)
293 return -EIO;
294 msleep(1);
295
296 return 0;
297}
298
299/* ------------------------------------------------------------------ */
300
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300301static int philips_tu1216_tuner_60_init(struct dvb_frontend *fe)
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800302{
303 return philips_tda6651_pll_init(0x60, fe);
304}
305
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300306static int philips_tu1216_tuner_60_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800307{
308 return philips_tda6651_pll_set(0x60, fe, params);
309}
310
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700311static int philips_tu1216_request_firmware(struct dvb_frontend *fe,
312 const struct firmware **fw, char *name)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313{
314 struct saa7134_dev *dev = fe->dvb->priv;
315 return request_firmware(fw, name, &dev->pci->dev);
316}
317
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800318static struct tda1004x_config philips_tu1216_60_config = {
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700319
320 .demod_address = 0x8,
321 .invert = 1,
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800322 .invert_oclk = 0,
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700323 .xtal_freq = TDA10046_XTAL_4M,
324 .agc_config = TDA10046_AGC_DEFAULT,
325 .if_freq = TDA10046_FREQ_3617,
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700326 .request_firmware = philips_tu1216_request_firmware,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327};
328
329/* ------------------------------------------------------------------ */
330
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300331static int philips_tu1216_tuner_61_init(struct dvb_frontend *fe)
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800332{
333 return philips_tda6651_pll_init(0x61, fe);
334}
335
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300336static int philips_tu1216_tuner_61_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800337{
338 return philips_tda6651_pll_set(0x61, fe, params);
339}
340
341static struct tda1004x_config philips_tu1216_61_config = {
342
343 .demod_address = 0x8,
344 .invert = 1,
345 .invert_oclk = 0,
346 .xtal_freq = TDA10046_XTAL_4M,
347 .agc_config = TDA10046_AGC_DEFAULT,
348 .if_freq = TDA10046_FREQ_3617,
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800349 .request_firmware = philips_tu1216_request_firmware,
350};
351
352/* ------------------------------------------------------------------ */
353
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300354static int philips_europa_tuner_init(struct dvb_frontend *fe)
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800355{
356 struct saa7134_dev *dev = fe->dvb->priv;
357 static u8 msg[] = { 0x0b, 0xf5, 0x86, 0xab };
358 struct i2c_msg init_msg = {.addr = 0x61,.flags = 0,.buf = msg,.len = sizeof(msg) };
359
360 /* setup PLL configuration */
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300361 if (fe->ops->i2c_gate_ctrl)
362 fe->ops->i2c_gate_ctrl(fe, 1);
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800363 if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1)
364 return -EIO;
365 msleep(1);
366
367 /* switch the board to dvb mode */
368 init_msg.addr = 0x43;
369 init_msg.len = 0x02;
370 msg[0] = 0x00;
371 msg[1] = 0x40;
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300372 if (fe->ops->i2c_gate_ctrl)
373 fe->ops->i2c_gate_ctrl(fe, 1);
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800374 if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1)
375 return -EIO;
376
377 return 0;
378}
379
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300380static int philips_td1316_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800381{
382 return philips_tda6651_pll_set(0x61, fe, params);
383}
384
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300385static int philips_europa_tuner_sleep(struct dvb_frontend *fe)
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800386{
387 struct saa7134_dev *dev = fe->dvb->priv;
388 /* this message actually turns the tuner back to analog mode */
389 static u8 msg[] = { 0x0b, 0xdc, 0x86, 0xa4 };
390 struct i2c_msg analog_msg = {.addr = 0x61,.flags = 0,.buf = msg,.len = sizeof(msg) };
391
392 i2c_transfer(&dev->i2c_adap, &analog_msg, 1);
393 msleep(1);
394
395 /* switch the board to analog mode */
396 analog_msg.addr = 0x43;
397 analog_msg.len = 0x02;
398 msg[0] = 0x00;
399 msg[1] = 0x14;
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300400 if (fe->ops->i2c_gate_ctrl)
401 fe->ops->i2c_gate_ctrl(fe, 1);
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800402 i2c_transfer(&dev->i2c_adap, &analog_msg, 1);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300403 return 0;
404}
405
406static int philips_europa_demod_sleep(struct dvb_frontend *fe)
407{
408 struct saa7134_dev *dev = fe->dvb->priv;
409
410 if (dev->original_demod_sleep)
411 dev->original_demod_sleep(fe);
412 fe->ops->i2c_gate_ctrl(fe, 1);
413 return 0;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800414}
415
416static struct tda1004x_config philips_europa_config = {
417
418 .demod_address = 0x8,
419 .invert = 0,
420 .invert_oclk = 0,
421 .xtal_freq = TDA10046_XTAL_4M,
422 .agc_config = TDA10046_AGC_IFO_AUTO_POS,
423 .if_freq = TDA10046_FREQ_052,
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800424 .request_firmware = NULL,
425};
426
427/* ------------------------------------------------------------------ */
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700428
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300429static int philips_fmd1216_tuner_init(struct dvb_frontend *fe)
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700430{
431 struct saa7134_dev *dev = fe->dvb->priv;
432 /* this message is to set up ATC and ALC */
433 static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0xa0 };
434 struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) };
435
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300436 if (fe->ops->i2c_gate_ctrl)
437 fe->ops->i2c_gate_ctrl(fe, 1);
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700438 if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1)
439 return -EIO;
440 msleep(1);
441
442 return 0;
443}
444
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300445static int philips_fmd1216_tuner_sleep(struct dvb_frontend *fe)
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700446{
447 struct saa7134_dev *dev = fe->dvb->priv;
448 /* this message actually turns the tuner back to analog mode */
449 static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0x60 };
450 struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) };
451
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300452 if (fe->ops->i2c_gate_ctrl)
453 fe->ops->i2c_gate_ctrl(fe, 1);
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700454 i2c_transfer(&dev->i2c_adap, &tuner_msg, 1);
455 msleep(1);
456 fmd1216_init[2] = 0x86;
457 fmd1216_init[3] = 0x54;
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300458 if (fe->ops->i2c_gate_ctrl)
459 fe->ops->i2c_gate_ctrl(fe, 1);
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700460 i2c_transfer(&dev->i2c_adap, &tuner_msg, 1);
461 msleep(1);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300462 return 0;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700463}
464
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300465static int philips_fmd1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700466{
467 struct saa7134_dev *dev = fe->dvb->priv;
468 u8 tuner_buf[4];
469 struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = tuner_buf,.len =
470 sizeof(tuner_buf) };
471 int tuner_frequency = 0;
472 int divider = 0;
473 u8 band, mode, cp;
474
475 /* determine charge pump */
476 tuner_frequency = params->frequency + 36130000;
477 if (tuner_frequency < 87000000)
478 return -EINVAL;
479 /* low band */
480 else if (tuner_frequency < 180000000) {
481 band = 1;
482 mode = 7;
483 cp = 0;
484 } else if (tuner_frequency < 195000000) {
485 band = 1;
486 mode = 6;
487 cp = 1;
488 /* mid band */
489 } else if (tuner_frequency < 366000000) {
490 if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) {
491 band = 10;
492 } else {
493 band = 2;
494 }
495 mode = 7;
496 cp = 0;
497 } else if (tuner_frequency < 478000000) {
498 if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) {
499 band = 10;
500 } else {
501 band = 2;
502 }
503 mode = 6;
504 cp = 1;
505 /* high band */
506 } else if (tuner_frequency < 662000000) {
507 if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) {
508 band = 12;
509 } else {
510 band = 4;
511 }
512 mode = 7;
513 cp = 0;
514 } else if (tuner_frequency < 840000000) {
515 if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) {
516 band = 12;
517 } else {
518 band = 4;
519 }
520 mode = 6;
521 cp = 1;
522 } else {
523 if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) {
524 band = 12;
525 } else {
526 band = 4;
527 }
528 mode = 7;
529 cp = 1;
530
531 }
532 /* calculate divisor */
533 /* ((36166000 + Finput) / 166666) rounded! */
534 divider = (tuner_frequency + 83333) / 166667;
535
536 /* setup tuner buffer */
537 tuner_buf[0] = (divider >> 8) & 0x7f;
538 tuner_buf[1] = divider & 0xff;
539 tuner_buf[2] = 0x80 | (cp << 6) | (mode << 3) | 4;
540 tuner_buf[3] = 0x40 | band;
541
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300542 if (fe->ops->i2c_gate_ctrl)
543 fe->ops->i2c_gate_ctrl(fe, 1);
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700544 if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1)
545 return -EIO;
546 return 0;
547}
548
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700549static struct tda1004x_config medion_cardbus = {
550 .demod_address = 0x08,
551 .invert = 1,
552 .invert_oclk = 0,
553 .xtal_freq = TDA10046_XTAL_16M,
554 .agc_config = TDA10046_AGC_IFO_AUTO_NEG,
555 .if_freq = TDA10046_FREQ_3613,
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700556 .request_firmware = NULL,
557};
558
559/* ------------------------------------------------------------------ */
560
561struct tda827x_data {
562 u32 lomax;
563 u8 spd;
564 u8 bs;
565 u8 bp;
566 u8 cp;
567 u8 gc3;
568 u8 div1p5;
569};
570
571static struct tda827x_data tda827x_dvbt[] = {
572 { .lomax = 62000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1},
573 { .lomax = 66000000, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1},
574 { .lomax = 76000000, .spd = 3, .bs = 1, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0},
575 { .lomax = 84000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0},
576 { .lomax = 93000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0},
577 { .lomax = 98000000, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0},
578 { .lomax = 109000000, .spd = 3, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0},
579 { .lomax = 123000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1},
580 { .lomax = 133000000, .spd = 2, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1},
581 { .lomax = 151000000, .spd = 2, .bs = 1, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0},
582 { .lomax = 154000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0},
583 { .lomax = 181000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 0, .div1p5 = 0},
584 { .lomax = 185000000, .spd = 2, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0},
585 { .lomax = 217000000, .spd = 2, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0},
586 { .lomax = 244000000, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1},
587 { .lomax = 265000000, .spd = 1, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1},
588 { .lomax = 302000000, .spd = 1, .bs = 1, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0},
589 { .lomax = 324000000, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0},
590 { .lomax = 370000000, .spd = 1, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0},
591 { .lomax = 454000000, .spd = 1, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0},
592 { .lomax = 493000000, .spd = 0, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1},
593 { .lomax = 530000000, .spd = 0, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1},
594 { .lomax = 554000000, .spd = 0, .bs = 1, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0},
595 { .lomax = 604000000, .spd = 0, .bs = 1, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0},
596 { .lomax = 696000000, .spd = 0, .bs = 2, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0},
597 { .lomax = 740000000, .spd = 0, .bs = 2, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0},
598 { .lomax = 820000000, .spd = 0, .bs = 3, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0},
599 { .lomax = 865000000, .spd = 0, .bs = 3, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0},
600 { .lomax = 0, .spd = 0, .bs = 0, .bp = 0, .cp = 0, .gc3 = 0, .div1p5 = 0}
601};
602
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300603static int philips_tda827x_tuner_init(struct dvb_frontend *fe)
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700604{
605 return 0;
606}
607
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300608static int philips_tda827x_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700609{
610 struct saa7134_dev *dev = fe->dvb->priv;
611 u8 tuner_buf[14];
612
613 struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf,
Mauro Carvalho Chehabf2421ca2005-11-08 21:37:45 -0800614 .len = sizeof(tuner_buf) };
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700615 int i, tuner_freq, if_freq;
616 u32 N;
617 switch (params->u.ofdm.bandwidth) {
618 case BANDWIDTH_6_MHZ:
619 if_freq = 4000000;
620 break;
621 case BANDWIDTH_7_MHZ:
622 if_freq = 4500000;
623 break;
624 default: /* 8 MHz or Auto */
625 if_freq = 5000000;
626 break;
627 }
628 tuner_freq = params->frequency + if_freq;
629
630 i = 0;
631 while (tda827x_dvbt[i].lomax < tuner_freq) {
632 if(tda827x_dvbt[i + 1].lomax == 0)
633 break;
634 i++;
635 }
636
637 N = ((tuner_freq + 125000) / 250000) << (tda827x_dvbt[i].spd + 2);
638 tuner_buf[0] = 0;
639 tuner_buf[1] = (N>>8) | 0x40;
640 tuner_buf[2] = N & 0xff;
641 tuner_buf[3] = 0;
642 tuner_buf[4] = 0x52;
643 tuner_buf[5] = (tda827x_dvbt[i].spd << 6) + (tda827x_dvbt[i].div1p5 << 5) +
644 (tda827x_dvbt[i].bs << 3) + tda827x_dvbt[i].bp;
645 tuner_buf[6] = (tda827x_dvbt[i].gc3 << 4) + 0x8f;
646 tuner_buf[7] = 0xbf;
647 tuner_buf[8] = 0x2a;
648 tuner_buf[9] = 0x05;
649 tuner_buf[10] = 0xff;
650 tuner_buf[11] = 0x00;
651 tuner_buf[12] = 0x00;
652 tuner_buf[13] = 0x40;
653
654 tuner_msg.len = 14;
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300655 if (fe->ops->i2c_gate_ctrl)
656 fe->ops->i2c_gate_ctrl(fe, 1);
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700657 if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1)
658 return -EIO;
659
660 msleep(500);
661 /* correct CP value */
662 tuner_buf[0] = 0x30;
663 tuner_buf[1] = 0x50 + tda827x_dvbt[i].cp;
664 tuner_msg.len = 2;
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300665 if (fe->ops->i2c_gate_ctrl)
666 fe->ops->i2c_gate_ctrl(fe, 1);
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700667 i2c_transfer(&dev->i2c_adap, &tuner_msg, 1);
668
669 return 0;
670}
671
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300672static int philips_tda827x_tuner_sleep(struct dvb_frontend *fe)
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700673{
674 struct saa7134_dev *dev = fe->dvb->priv;
675 static u8 tda827x_sleep[] = { 0x30, 0xd0};
676 struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tda827x_sleep,
Mauro Carvalho Chehabf2421ca2005-11-08 21:37:45 -0800677 .len = sizeof(tda827x_sleep) };
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300678 if (fe->ops->i2c_gate_ctrl)
679 fe->ops->i2c_gate_ctrl(fe, 1);
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700680 i2c_transfer(&dev->i2c_adap, &tuner_msg, 1);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300681 return 0;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700682}
683
684static struct tda1004x_config tda827x_lifeview_config = {
685 .demod_address = 0x08,
686 .invert = 1,
687 .invert_oclk = 0,
688 .xtal_freq = TDA10046_XTAL_16M,
689 .agc_config = TDA10046_AGC_TDA827X,
690 .if_freq = TDA10046_FREQ_045,
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700691 .request_firmware = NULL,
692};
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800693
694/* ------------------------------------------------------------------ */
695
696struct tda827xa_data {
697 u32 lomax;
698 u8 svco;
699 u8 spd;
700 u8 scr;
701 u8 sbs;
702 u8 gc3;
703};
704
705static struct tda827xa_data tda827xa_dvbt[] = {
706 { .lomax = 56875000, .svco = 3, .spd = 4, .scr = 0, .sbs = 0, .gc3 = 1},
707 { .lomax = 67250000, .svco = 0, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 1},
708 { .lomax = 81250000, .svco = 1, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 1},
709 { .lomax = 97500000, .svco = 2, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 1},
710 { .lomax = 113750000, .svco = 3, .spd = 3, .scr = 0, .sbs = 1, .gc3 = 1},
711 { .lomax = 134500000, .svco = 0, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},
712 { .lomax = 154000000, .svco = 1, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},
713 { .lomax = 162500000, .svco = 1, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},
714 { .lomax = 183000000, .svco = 2, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},
715 { .lomax = 195000000, .svco = 2, .spd = 2, .scr = 0, .sbs = 2, .gc3 = 1},
716 { .lomax = 227500000, .svco = 3, .spd = 2, .scr = 0, .sbs = 2, .gc3 = 1},
717 { .lomax = 269000000, .svco = 0, .spd = 1, .scr = 0, .sbs = 2, .gc3 = 1},
718 { .lomax = 290000000, .svco = 1, .spd = 1, .scr = 0, .sbs = 2, .gc3 = 1},
719 { .lomax = 325000000, .svco = 1, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 1},
720 { .lomax = 390000000, .svco = 2, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 1},
721 { .lomax = 455000000, .svco = 3, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 1},
722 { .lomax = 520000000, .svco = 0, .spd = 0, .scr = 0, .sbs = 3, .gc3 = 1},
723 { .lomax = 538000000, .svco = 0, .spd = 0, .scr = 1, .sbs = 3, .gc3 = 1},
724 { .lomax = 550000000, .svco = 1, .spd = 0, .scr = 0, .sbs = 3, .gc3 = 1},
725 { .lomax = 620000000, .svco = 1, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0},
726 { .lomax = 650000000, .svco = 1, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0},
727 { .lomax = 700000000, .svco = 2, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0},
728 { .lomax = 780000000, .svco = 2, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0},
729 { .lomax = 820000000, .svco = 3, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0},
730 { .lomax = 870000000, .svco = 3, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0},
731 { .lomax = 911000000, .svco = 3, .spd = 0, .scr = 2, .sbs = 4, .gc3 = 0},
732 { .lomax = 0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0}};
733
734
735static int philips_tda827xa_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
736{
737 struct saa7134_dev *dev = fe->dvb->priv;
738 u8 tuner_buf[14];
739 unsigned char reg2[2];
740
741 struct i2c_msg msg = {.addr = addr,.flags = 0,.buf = tuner_buf};
742 int i, tuner_freq, if_freq;
743 u32 N;
744
745 switch (params->u.ofdm.bandwidth) {
746 case BANDWIDTH_6_MHZ:
747 if_freq = 4000000;
748 break;
749 case BANDWIDTH_7_MHZ:
750 if_freq = 4500000;
751 break;
752 default: /* 8 MHz or Auto */
753 if_freq = 5000000;
754 break;
755 }
756 tuner_freq = params->frequency + if_freq;
757
758 i = 0;
759 while (tda827xa_dvbt[i].lomax < tuner_freq) {
760 if(tda827xa_dvbt[i + 1].lomax == 0)
761 break;
762 i++;
763 }
764
765 N = ((tuner_freq + 31250) / 62500) << tda827xa_dvbt[i].spd;
766 tuner_buf[0] = 0; // subaddress
767 tuner_buf[1] = N >> 8;
768 tuner_buf[2] = N & 0xff;
769 tuner_buf[3] = 0;
770 tuner_buf[4] = 0x16;
771 tuner_buf[5] = (tda827xa_dvbt[i].spd << 5) + (tda827xa_dvbt[i].svco << 3) +
772 tda827xa_dvbt[i].sbs;
773 tuner_buf[6] = 0x4b + (tda827xa_dvbt[i].gc3 << 4);
774 tuner_buf[7] = 0x0c;
775 tuner_buf[8] = 0x06;
776 tuner_buf[9] = 0x24;
777 tuner_buf[10] = 0xff;
778 tuner_buf[11] = 0x60;
779 tuner_buf[12] = 0x00;
780 tuner_buf[13] = 0x39; // lpsel
781 msg.len = 14;
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300782 if (fe->ops->i2c_gate_ctrl)
783 fe->ops->i2c_gate_ctrl(fe, 1);
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800784 if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1)
785 return -EIO;
786
787 msg.buf= reg2;
788 msg.len = 2;
789 reg2[0] = 0x60;
790 reg2[1] = 0x3c;
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300791 if (fe->ops->i2c_gate_ctrl)
792 fe->ops->i2c_gate_ctrl(fe, 1);
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800793 i2c_transfer(&dev->i2c_adap, &msg, 1);
794
795 reg2[0] = 0xa0;
796 reg2[1] = 0x40;
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300797 if (fe->ops->i2c_gate_ctrl)
798 fe->ops->i2c_gate_ctrl(fe, 1);
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800799 i2c_transfer(&dev->i2c_adap, &msg, 1);
800
801 msleep(2);
802 /* correct CP value */
803 reg2[0] = 0x30;
804 reg2[1] = 0x10 + tda827xa_dvbt[i].scr;
805 msg.len = 2;
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300806 if (fe->ops->i2c_gate_ctrl)
807 fe->ops->i2c_gate_ctrl(fe, 1);
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800808 i2c_transfer(&dev->i2c_adap, &msg, 1);
809
810 msleep(550);
811 reg2[0] = 0x50;
812 reg2[1] = 0x4f + (tda827xa_dvbt[i].gc3 << 4);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300813 if (fe->ops->i2c_gate_ctrl)
814 fe->ops->i2c_gate_ctrl(fe, 1);
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800815 i2c_transfer(&dev->i2c_adap, &msg, 1);
816
817 return 0;
818
819}
820
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300821static int philips_tda827xa_tuner_sleep(u8 addr, struct dvb_frontend *fe)
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800822{
823 struct saa7134_dev *dev = fe->dvb->priv;
824 static u8 tda827xa_sleep[] = { 0x30, 0x90};
825 struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tda827xa_sleep,
Tyler Traffordf1bcef82005-11-08 21:38:46 -0800826 .len = sizeof(tda827xa_sleep) };
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300827 if (fe->ops->i2c_gate_ctrl)
828 fe->ops->i2c_gate_ctrl(fe, 1);
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800829 i2c_transfer(&dev->i2c_adap, &tuner_msg, 1);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300830 return 0;
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800831}
832
833/* ------------------------------------------------------------------ */
834
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300835static int philips_tiger_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800836{
837 int ret;
838 struct saa7134_dev *dev = fe->dvb->priv;
839 static u8 tda8290_close[] = { 0x21, 0xc0};
840 static u8 tda8290_open[] = { 0x21, 0x80};
841 struct i2c_msg tda8290_msg = {.addr = 0x4b,.flags = 0, .len = 2};
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300842
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800843 /* close tda8290 i2c bridge */
844 tda8290_msg.buf = tda8290_close;
845 ret = i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1);
846 if (ret != 1)
847 return -EIO;
848 msleep(20);
849 ret = philips_tda827xa_pll_set(0x61, fe, params);
850 if (ret != 0)
851 return ret;
852 /* open tda8290 i2c bridge */
853 tda8290_msg.buf = tda8290_open;
854 i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1);
855 return ret;
Hartmut Hackmann2d6b5f62006-02-27 21:14:36 -0300856}
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800857
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300858static int philips_tiger_tuner_init(struct dvb_frontend *fe)
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800859{
860 struct saa7134_dev *dev = fe->dvb->priv;
861 static u8 data[] = { 0x3c, 0x33, 0x6a};
862 struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)};
863
864 if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1)
865 return -EIO;
866 return 0;
867}
868
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300869static int philips_tiger_tuner_sleep(struct dvb_frontend *fe)
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800870{
871 struct saa7134_dev *dev = fe->dvb->priv;
872 static u8 data[] = { 0x3c, 0x33, 0x68};
873 struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)};
874
875 i2c_transfer(&dev->i2c_adap, &msg, 1);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300876 philips_tda827xa_tuner_sleep( 0x61, fe);
877 return 0;
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800878}
879
880static struct tda1004x_config philips_tiger_config = {
881 .demod_address = 0x08,
882 .invert = 1,
883 .invert_oclk = 0,
884 .xtal_freq = TDA10046_XTAL_16M,
885 .agc_config = TDA10046_AGC_TDA827X,
886 .if_freq = TDA10046_FREQ_045,
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800887 .request_firmware = NULL,
888};
889
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200890/* ------------------------------------------------------------------ */
891
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300892static int lifeview_trio_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
Nico Sabbi420f32f2006-03-03 12:11:28 -0300893{
894 int ret;
895
896 ret = philips_tda827xa_pll_set(0x60, fe, params);
897 return ret;
898}
899
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300900static int lifeview_trio_tuner_sleep(struct dvb_frontend *fe)
Nico Sabbi420f32f2006-03-03 12:11:28 -0300901{
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300902 philips_tda827xa_tuner_sleep(0x60, fe);
Nico Sabbi420f32f2006-03-03 12:11:28 -0300903 return 0;
904}
905
Nico Sabbi420f32f2006-03-03 12:11:28 -0300906static struct tda1004x_config lifeview_trio_config = {
907 .demod_address = 0x09,
908 .invert = 1,
909 .invert_oclk = 0,
910 .xtal_freq = TDA10046_XTAL_16M,
911 .agc_config = TDA10046_AGC_TDA827X_GPL,
912 .if_freq = TDA10046_FREQ_045,
Nico Sabbi420f32f2006-03-03 12:11:28 -0300913 .request_firmware = NULL,
914};
915
916/* ------------------------------------------------------------------ */
917
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300918static int ads_duo_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200919{
920 int ret;
921
922 ret = philips_tda827xa_pll_set(0x61, fe, params);
923 return ret;
Hartmut Hackmann2d6b5f62006-02-27 21:14:36 -0300924}
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200925
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300926static int ads_duo_tuner_init(struct dvb_frontend *fe)
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200927{
928 struct saa7134_dev *dev = fe->dvb->priv;
929 /* route TDA8275a AGC input to the channel decoder */
930 saa_writeb(SAA7134_GPIO_GPSTATUS2, 0x60);
931 return 0;
932}
933
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300934static int ads_duo_tuner_sleep(struct dvb_frontend *fe)
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200935{
936 struct saa7134_dev *dev = fe->dvb->priv;
937 /* route TDA8275a AGC input to the analog IF chip*/
938 saa_writeb(SAA7134_GPIO_GPSTATUS2, 0x20);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300939 philips_tda827xa_tuner_sleep( 0x61, fe);
940 return 0;
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200941}
942
943static struct tda1004x_config ads_tech_duo_config = {
944 .demod_address = 0x08,
945 .invert = 1,
946 .invert_oclk = 0,
947 .xtal_freq = TDA10046_XTAL_16M,
948 .agc_config = TDA10046_AGC_TDA827X_GPL,
949 .if_freq = TDA10046_FREQ_045,
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200950 .request_firmware = NULL,
951};
952
Peter Hartshorn3dfb7292006-02-07 06:49:13 -0200953/* ------------------------------------------------------------------ */
954
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300955static int tevion_dvb220rf_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
Peter Hartshorn3dfb7292006-02-07 06:49:13 -0200956{
957 int ret;
958 ret = philips_tda827xa_pll_set(0x60, fe, params);
959 return ret;
960}
961
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300962static int tevion_dvb220rf_tuner_sleep(struct dvb_frontend *fe)
Peter Hartshorn3dfb7292006-02-07 06:49:13 -0200963{
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300964 philips_tda827xa_tuner_sleep( 0x61, fe);
Peter Hartshorn3dfb7292006-02-07 06:49:13 -0200965 return 0;
966}
967
Peter Hartshorn3dfb7292006-02-07 06:49:13 -0200968static struct tda1004x_config tevion_dvbt220rf_config = {
969 .demod_address = 0x08,
970 .invert = 1,
971 .invert_oclk = 0,
972 .xtal_freq = TDA10046_XTAL_16M,
973 .agc_config = TDA10046_AGC_TDA827X,
974 .if_freq = TDA10046_FREQ_045,
Peter Hartshorn3dfb7292006-02-07 06:49:13 -0200975 .request_firmware = NULL,
976};
977
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700978#endif
979
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800980/* ------------------------------------------------------------------ */
981
Michael Krufky3b64e8e2005-11-08 21:38:20 -0800982#ifdef HAVE_NXT200X
983static struct nxt200x_config avertvhda180 = {
984 .demod_address = 0x0a,
Michael Krufky3b64e8e2005-11-08 21:38:20 -0800985};
Andrew Burri3e1410a2006-02-27 00:08:23 -0300986
Curt Meyersfbc81c02006-02-27 00:08:27 -0300987static int nxt200x_set_pll_input(u8 *buf, int input)
988{
989 if (input)
990 buf[3] |= 0x08;
991 else
992 buf[3] &= ~0x08;
993 return 0;
994}
995
Andrew Burri3e1410a2006-02-27 00:08:23 -0300996static struct nxt200x_config kworldatsc110 = {
997 .demod_address = 0x0a,
Curt Meyersfbc81c02006-02-27 00:08:27 -0300998 .set_pll_input = nxt200x_set_pll_input,
Andrew Burri3e1410a2006-02-27 00:08:23 -0300999};
Michael Krufky3b64e8e2005-11-08 21:38:20 -08001000#endif
1001
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07001002/* ------------------------------------------------------------------ */
1003
Linus Torvalds1da177e2005-04-16 15:20:36 -07001004static int dvb_init(struct saa7134_dev *dev)
1005{
1006 /* init struct videobuf_dvb */
1007 dev->ts.nr_bufs = 32;
1008 dev->ts.nr_packets = 32*4;
1009 dev->dvb.name = dev->name;
1010 videobuf_queue_init(&dev->dvb.dvbq, &saa7134_ts_qops,
1011 dev->pci, &dev->slock,
1012 V4L2_BUF_TYPE_VIDEO_CAPTURE,
1013 V4L2_FIELD_ALTERNATE,
1014 sizeof(struct saa7134_buf),
1015 dev);
1016
1017 switch (dev->board) {
Michael Krufky29780bb2005-07-27 11:45:59 -07001018#ifdef HAVE_MT352
Linus Torvalds1da177e2005-04-16 15:20:36 -07001019 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
1020 printk("%s: pinnacle 300i dvb setup\n",dev->name);
1021 dev->dvb.frontend = mt352_attach(&pinnacle_300i,
1022 &dev->i2c_adap);
Andrew de Quinceybd4956b2006-04-18 21:38:49 -03001023 dev->dvb.frontend->ops->tuner_ops.calc_regs = mt352_pinnacle_tuner_calc_regs;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001024 break;
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -02001025
1026 case SAA7134_BOARD_AVERMEDIA_777:
1027 printk("%s: avertv 777 dvb setup\n",dev->name);
1028 dev->dvb.frontend = mt352_attach(&avermedia_777,
1029 &dev->i2c_adap);
Andrew de Quinceybd4956b2006-04-18 21:38:49 -03001030 dev->dvb.frontend->ops->tuner_ops.calc_regs = mt352_aver777_tuner_calc_regs;
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -02001031 break;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07001032#endif
Michael Krufky29780bb2005-07-27 11:45:59 -07001033#ifdef HAVE_TDA1004X
Linus Torvalds1da177e2005-04-16 15:20:36 -07001034 case SAA7134_BOARD_MD7134:
1035 dev->dvb.frontend = tda10046_attach(&medion_cardbus,
1036 &dev->i2c_adap);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -03001037 dev->dvb.frontend->ops->tuner_ops.init = philips_fmd1216_tuner_init;
1038 dev->dvb.frontend->ops->tuner_ops.sleep = philips_fmd1216_tuner_sleep;
1039 dev->dvb.frontend->ops->tuner_ops.set_params = philips_fmd1216_tuner_set_params;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001040 break;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07001041 case SAA7134_BOARD_PHILIPS_TOUGH:
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -08001042 dev->dvb.frontend = tda10046_attach(&philips_tu1216_60_config,
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07001043 &dev->i2c_adap);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -03001044 dev->dvb.frontend->ops->tuner_ops.init = philips_tu1216_tuner_60_init;
1045 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tu1216_tuner_60_set_params;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07001046 break;
1047 case SAA7134_BOARD_FLYDVBTDUO:
1048 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,
1049 &dev->i2c_adap);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -03001050 dev->dvb.frontend->ops->tuner_ops.init = philips_tda827x_tuner_init;
1051 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tda827x_tuner_sleep;
1052 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tda827x_tuner_set_params;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07001053 break;
Peter Missel10b7a902006-01-23 17:11:06 -02001054 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS:
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07001055 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,
1056 &dev->i2c_adap);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -03001057 dev->dvb.frontend->ops->tuner_ops.init = philips_tda827x_tuner_init;
1058 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tda827x_tuner_sleep;
1059 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tda827x_tuner_set_params;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07001060 break;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -08001061 case SAA7134_BOARD_PHILIPS_EUROPA:
1062 dev->dvb.frontend = tda10046_attach(&philips_europa_config,
1063 &dev->i2c_adap);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -03001064 dev->original_demod_sleep = dev->dvb.frontend->ops->sleep;
1065 dev->dvb.frontend->ops->sleep = philips_europa_demod_sleep;
1066 dev->dvb.frontend->ops->tuner_ops.init = philips_europa_tuner_init;
1067 dev->dvb.frontend->ops->tuner_ops.sleep = philips_europa_tuner_sleep;
1068 dev->dvb.frontend->ops->tuner_ops.set_params = philips_td1316_tuner_set_params;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -08001069 break;
1070 case SAA7134_BOARD_VIDEOMATE_DVBT_300:
1071 dev->dvb.frontend = tda10046_attach(&philips_europa_config,
1072 &dev->i2c_adap);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -03001073 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;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -08001076 break;
1077 case SAA7134_BOARD_VIDEOMATE_DVBT_200:
1078 dev->dvb.frontend = tda10046_attach(&philips_tu1216_61_config,
1079 &dev->i2c_adap);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -03001080 dev->dvb.frontend->ops->tuner_ops.init = philips_tu1216_tuner_61_init;
1081 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tu1216_tuner_61_set_params;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -08001082 break;
Hartmut Hackmann90e9df72005-11-08 21:38:42 -08001083 case SAA7134_BOARD_PHILIPS_TIGER:
1084 dev->dvb.frontend = tda10046_attach(&philips_tiger_config,
1085 &dev->i2c_adap);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -03001086 dev->dvb.frontend->ops->tuner_ops.init = philips_tiger_tuner_init;
1087 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tiger_tuner_sleep;
1088 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tiger_tuner_set_params;
Hartmut Hackmann90e9df72005-11-08 21:38:42 -08001089 break;
Hartmut Hackmannd4b0aba2005-11-08 21:38:44 -08001090 case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
1091 dev->dvb.frontend = tda10046_attach(&philips_tiger_config,
1092 &dev->i2c_adap);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -03001093 dev->dvb.frontend->ops->tuner_ops.init = philips_tiger_tuner_init;
1094 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tiger_tuner_sleep;
1095 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tiger_tuner_set_params;
Hartmut Hackmannd4b0aba2005-11-08 21:38:44 -08001096 break;
Giampiero Giancipoli3d8466e2006-02-07 06:49:09 -02001097 case SAA7134_BOARD_FLYDVBT_LR301:
1098 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,
1099 &dev->i2c_adap);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -03001100 dev->dvb.frontend->ops->tuner_ops.init = philips_tda827x_tuner_init;
1101 dev->dvb.frontend->ops->tuner_ops.sleep = philips_tda827x_tuner_sleep;
1102 dev->dvb.frontend->ops->tuner_ops.set_params = philips_tda827x_tuner_set_params;
Giampiero Giancipoli3d8466e2006-02-07 06:49:09 -02001103 break;
Nico Sabbi420f32f2006-03-03 12:11:28 -03001104 case SAA7134_BOARD_FLYDVB_TRIO:
1105 dev->dvb.frontend = tda10046_attach(&lifeview_trio_config,
1106 &dev->i2c_adap);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -03001107 dev->dvb.frontend->ops->tuner_ops.sleep = lifeview_trio_tuner_sleep;
1108 dev->dvb.frontend->ops->tuner_ops.set_params = lifeview_trio_tuner_set_params;
Nico Sabbi420f32f2006-03-03 12:11:28 -03001109 break;
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -02001110 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331:
1111 dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config,
1112 &dev->i2c_adap);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -03001113 dev->dvb.frontend->ops->tuner_ops.init = ads_duo_tuner_init;
1114 dev->dvb.frontend->ops->tuner_ops.sleep = ads_duo_tuner_sleep;
1115 dev->dvb.frontend->ops->tuner_ops.set_params = ads_duo_tuner_set_params;
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -02001116 break;
Peter Hartshorn3dfb7292006-02-07 06:49:13 -02001117 case SAA7134_BOARD_TEVION_DVBT_220RF:
1118 dev->dvb.frontend = tda10046_attach(&tevion_dvbt220rf_config,
1119 &dev->i2c_adap);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -03001120 dev->dvb.frontend->ops->tuner_ops.sleep = tevion_dvb220rf_tuner_sleep;
1121 dev->dvb.frontend->ops->tuner_ops.set_params = tevion_dvb220rf_tuner_set_params;
Peter Hartshorn3dfb7292006-02-07 06:49:13 -02001122 break;
Hartmut Hackmannd95b8942006-03-27 19:39:30 -03001123 case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS:
1124 dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config,
1125 &dev->i2c_adap);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -03001126 dev->dvb.frontend->ops->tuner_ops.init = ads_duo_tuner_init;
1127 dev->dvb.frontend->ops->tuner_ops.sleep = ads_duo_tuner_sleep;
1128 dev->dvb.frontend->ops->tuner_ops.set_params = ads_duo_tuner_set_params;
Hartmut Hackmannd95b8942006-03-27 19:39:30 -03001129 break;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07001130#endif
Michael Krufky3b64e8e2005-11-08 21:38:20 -08001131#ifdef HAVE_NXT200X
1132 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180:
1133 dev->dvb.frontend = nxt200x_attach(&avertvhda180, &dev->i2c_adap);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -03001134 if (dev->dvb.frontend) {
1135 dvb_pll_attach(dev->dvb.frontend, 0x61, &dev->i2c_adap, &dvb_pll_tdhu2);
1136 }
Michael Krufky3b64e8e2005-11-08 21:38:20 -08001137 break;
Andrew Burri3e1410a2006-02-27 00:08:23 -03001138 case SAA7134_BOARD_KWORLD_ATSC110:
1139 dev->dvb.frontend = nxt200x_attach(&kworldatsc110, &dev->i2c_adap);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -03001140 if (dev->dvb.frontend) {
1141 dvb_pll_attach(dev->dvb.frontend, 0x61, &dev->i2c_adap, &dvb_pll_tuv1236d);
1142 }
Andrew Burri3e1410a2006-02-27 00:08:23 -03001143 break;
Michael Krufky3b64e8e2005-11-08 21:38:20 -08001144#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001145 default:
1146 printk("%s: Huh? unknown DVB card?\n",dev->name);
1147 break;
1148 }
1149
1150 if (NULL == dev->dvb.frontend) {
1151 printk("%s: frontend initialization failed\n",dev->name);
1152 return -1;
1153 }
1154
1155 /* register everything else */
Andrew de Quinceyd09dbf92006-04-10 09:27:37 -03001156 return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, &dev->pci->dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001157}
1158
1159static int dvb_fini(struct saa7134_dev *dev)
1160{
1161 static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE;
1162
Linus Torvalds1da177e2005-04-16 15:20:36 -07001163 switch (dev->board) {
1164 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
1165 /* otherwise we don't detect the tuner on next insmod */
1166 saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&on);
1167 break;
1168 };
1169 videobuf_dvb_unregister(&dev->dvb);
1170 return 0;
1171}
1172
1173static struct saa7134_mpeg_ops dvb_ops = {
1174 .type = SAA7134_MPEG_DVB,
1175 .init = dvb_init,
1176 .fini = dvb_fini,
1177};
1178
1179static int __init dvb_register(void)
1180{
1181 return saa7134_ts_register(&dvb_ops);
1182}
1183
1184static void __exit dvb_unregister(void)
1185{
1186 saa7134_ts_unregister(&dvb_ops);
1187}
1188
1189module_init(dvb_register);
1190module_exit(dvb_unregister);
1191
1192/* ------------------------------------------------------------------ */
1193/*
1194 * Local variables:
1195 * c-basic-offset: 8
1196 * End:
1197 */