blob: 01b4e0aac0491fc0620414f84f1207263d9a0f1e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Bt8xx based DVB adapter driver
3 *
4 * Copyright (C) 2002,2003 Florian Schirmer <jolt@tuxbox.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 */
21
22#include <linux/bitops.h>
23#include <linux/module.h>
24#include <linux/moduleparam.h>
25#include <linux/init.h>
26#include <linux/device.h>
27#include <linux/delay.h>
28#include <linux/slab.h>
29#include <linux/i2c.h>
30
31#include "dmxdev.h"
32#include "dvbdev.h"
33#include "dvb_demux.h"
34#include "dvb_frontend.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070035#include "dvb-bt8xx.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070036#include "bt878.h"
Michael Krufky3cff00d2005-11-08 21:35:12 -080037#include "dvb-pll.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
39static int debug;
40
41module_param(debug, int, 0644);
42MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
43
44#define dprintk( args... ) \
David Johnson1f15ddd2005-09-09 13:02:54 -070045 do \
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 if (debug) printk(KERN_DEBUG args); \
David Johnson1f15ddd2005-09-09 13:02:54 -070047 while (0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070048
David Johnson05ade5a2005-09-09 13:02:55 -070049#define IF_FREQUENCYx6 217 /* 6 * 36.16666666667MHz */
50
Linus Torvalds1da177e2005-04-16 15:20:36 -070051static void dvb_bt8xx_task(unsigned long data)
52{
53 struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *)data;
54
55 //printk("%d ", card->bt->finished_block);
56
57 while (card->bt->last_block != card->bt->finished_block) {
58 (card->bt->TS_Size ? dvb_dmx_swfilter_204 : dvb_dmx_swfilter)
59 (&card->demux,
60 &card->bt->buf_cpu[card->bt->last_block *
61 card->bt->block_bytes],
62 card->bt->block_bytes);
63 card->bt->last_block = (card->bt->last_block + 1) %
64 card->bt->block_count;
65 }
66}
67
68static int dvb_bt8xx_start_feed(struct dvb_demux_feed *dvbdmxfeed)
69{
70 struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
71 struct dvb_bt8xx_card *card = dvbdmx->priv;
72 int rc;
73
74 dprintk("dvb_bt8xx: start_feed\n");
75
76 if (!dvbdmx->dmx.frontend)
77 return -EINVAL;
78
79 down(&card->lock);
80 card->nfeeds++;
81 rc = card->nfeeds;
82 if (card->nfeeds == 1)
83 bt878_start(card->bt, card->gpio_mode,
84 card->op_sync_orin, card->irq_err_ignore);
85 up(&card->lock);
86 return rc;
87}
88
89static int dvb_bt8xx_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
90{
91 struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
92 struct dvb_bt8xx_card *card = dvbdmx->priv;
93
94 dprintk("dvb_bt8xx: stop_feed\n");
95
96 if (!dvbdmx->dmx.frontend)
97 return -EINVAL;
98
99 down(&card->lock);
100 card->nfeeds--;
101 if (card->nfeeds == 0)
102 bt878_stop(card->bt);
103 up(&card->lock);
104
105 return 0;
106}
107
108static int is_pci_slot_eq(struct pci_dev* adev, struct pci_dev* bdev)
109{
110 if ((adev->subsystem_vendor == bdev->subsystem_vendor) &&
111 (adev->subsystem_device == bdev->subsystem_device) &&
112 (adev->bus->number == bdev->bus->number) &&
113 (PCI_SLOT(adev->devfn) == PCI_SLOT(bdev->devfn)))
114 return 1;
115 return 0;
116}
117
118static struct bt878 __init *dvb_bt8xx_878_match(unsigned int bttv_nr, struct pci_dev* bttv_pci_dev)
119{
120 unsigned int card_nr;
121
122 /* Hmm, n squared. Hope n is small */
David Johnson1f15ddd2005-09-09 13:02:54 -0700123 for (card_nr = 0; card_nr < bt878_num; card_nr++)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124 if (is_pci_slot_eq(bt878[card_nr].dev, bttv_pci_dev))
125 return &bt878[card_nr];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126 return NULL;
127}
128
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129static int thomson_dtt7579_demod_init(struct dvb_frontend* fe)
130{
131 static u8 mt352_clock_config [] = { 0x89, 0x38, 0x38 };
132 static u8 mt352_reset [] = { 0x50, 0x80 };
133 static u8 mt352_adc_ctl_1_cfg [] = { 0x8E, 0x40 };
134 static u8 mt352_agc_cfg [] = { 0x67, 0x28, 0x20 };
135 static u8 mt352_gpp_ctl_cfg [] = { 0x8C, 0x33 };
136 static u8 mt352_capt_range_cfg[] = { 0x75, 0x32 };
137
138 mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config));
139 udelay(2000);
140 mt352_write(fe, mt352_reset, sizeof(mt352_reset));
141 mt352_write(fe, mt352_adc_ctl_1_cfg, sizeof(mt352_adc_ctl_1_cfg));
142
143 mt352_write(fe, mt352_agc_cfg, sizeof(mt352_agc_cfg));
Johannes Stezenbach50b215a2005-05-16 21:54:41 -0700144 mt352_write(fe, mt352_gpp_ctl_cfg, sizeof(mt352_gpp_ctl_cfg));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 mt352_write(fe, mt352_capt_range_cfg, sizeof(mt352_capt_range_cfg));
146
147 return 0;
148}
149
150static int thomson_dtt7579_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf)
151{
152 u32 div;
153 unsigned char bs = 0;
154 unsigned char cp = 0;
155
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156 div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6;
157
David Johnson1f15ddd2005-09-09 13:02:54 -0700158 if (params->frequency < 542000000)
159 cp = 0xb4;
160 else if (params->frequency < 771000000)
161 cp = 0xbc;
162 else
163 cp = 0xf4;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164
David Johnson1f15ddd2005-09-09 13:02:54 -0700165 if (params->frequency == 0)
166 bs = 0x03;
167 else if (params->frequency < 443250000)
168 bs = 0x02;
169 else
170 bs = 0x08;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171
172 pllbuf[0] = 0xc0; // Note: non-linux standard PLL i2c address
173 pllbuf[1] = div >> 8;
174 pllbuf[2] = div & 0xff;
175 pllbuf[3] = cp;
176 pllbuf[4] = bs;
177
178 return 0;
179}
180
181static struct mt352_config thomson_dtt7579_config = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182 .demod_address = 0x0f,
183 .demod_init = thomson_dtt7579_demod_init,
184 .pll_set = thomson_dtt7579_pll_set,
185};
186
187static int cx24108_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
188{
David Johnson1f15ddd2005-09-09 13:02:54 -0700189 u32 freq = params->frequency;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190
David Johnson1f15ddd2005-09-09 13:02:54 -0700191 int i, a, n, pump;
192 u32 band, pll;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193
David Johnson1f15ddd2005-09-09 13:02:54 -0700194 u32 osci[]={950000,1019000,1075000,1178000,1296000,1432000,
195 1576000,1718000,1856000,2036000,2150000};
196 u32 bandsel[]={0,0x00020000,0x00040000,0x00100800,0x00101000,
197 0x00102000,0x00104000,0x00108000,0x00110000,
198 0x00120000,0x00140000};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199
David Johnson1f15ddd2005-09-09 13:02:54 -0700200 #define XTAL 1011100 /* Hz, really 1.0111 MHz and a /10 prescaler */
Johannes Stezenbach50b215a2005-05-16 21:54:41 -0700201 printk("cx24108 debug: entering SetTunerFreq, freq=%d\n",freq);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700202
Johannes Stezenbach50b215a2005-05-16 21:54:41 -0700203 /* This is really the bit driving the tuner chip cx24108 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204
David Johnson1f15ddd2005-09-09 13:02:54 -0700205 if (freq<950000)
206 freq = 950000; /* kHz */
207 else if (freq>2150000)
208 freq = 2150000; /* satellite IF is 950..2150MHz */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209
Johannes Stezenbach50b215a2005-05-16 21:54:41 -0700210 /* decide which VCO to use for the input frequency */
211 for(i=1;(i<sizeof(osci)/sizeof(osci[0]))&&(osci[i]<freq);i++);
212 printk("cx24108 debug: select vco #%d (f=%d)\n",i,freq);
213 band=bandsel[i];
214 /* the gain values must be set by SetSymbolrate */
215 /* compute the pll divider needed, from Conexant data sheet,
216 resolved for (n*32+a), remember f(vco) is f(receive) *2 or *4,
217 depending on the divider bit. It is set to /4 on the 2 lowest
218 bands */
219 n=((i<=2?2:1)*freq*10L)/(XTAL/100);
220 a=n%32; n/=32; if(a==0) n--;
221 pump=(freq<(osci[i-1]+osci[i])/2);
222 pll=0xf8000000|
223 ((pump?1:2)<<(14+11))|
224 ((n&0x1ff)<<(5+11))|
225 ((a&0x1f)<<11);
226 /* everything is shifted left 11 bits to left-align the bits in the
227 32bit word. Output to the tuner goes MSB-aligned, after all */
228 printk("cx24108 debug: pump=%d, n=%d, a=%d\n",pump,n,a);
229 cx24110_pll_write(fe,band);
230 /* set vga and vca to their widest-band settings, as a precaution.
231 SetSymbolrate might not be called to set this up */
232 cx24110_pll_write(fe,0x500c0000);
233 cx24110_pll_write(fe,0x83f1f800);
234 cx24110_pll_write(fe,pll);
David Johnson1f15ddd2005-09-09 13:02:54 -0700235 //writereg(client,0x56,0x7f);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236
237 return 0;
238}
239
240static int pinnsat_pll_init(struct dvb_frontend* fe)
241{
David Johnson1f15ddd2005-09-09 13:02:54 -0700242 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243}
244
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245static struct cx24110_config pctvsat_config = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246 .demod_address = 0x55,
247 .pll_init = pinnsat_pll_init,
248 .pll_set = cx24108_pll_set,
249};
250
Linus Torvalds1da177e2005-04-16 15:20:36 -0700251static int microtune_mt7202dtf_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
252{
253 struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv;
254 u8 cfg, cpump, band_select;
255 u8 data[4];
256 u32 div;
257 struct i2c_msg msg = { .addr = 0x60, .flags = 0, .buf = data, .len = sizeof(data) };
258
259 div = (36000000 + params->frequency + 83333) / 166666;
260 cfg = 0x88;
261
David Johnson1f15ddd2005-09-09 13:02:54 -0700262 if (params->frequency < 175000000)
263 cpump = 2;
264 else if (params->frequency < 390000000)
265 cpump = 1;
266 else if (params->frequency < 470000000)
267 cpump = 2;
268 else if (params->frequency < 750000000)
269 cpump = 2;
270 else
271 cpump = 3;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272
David Johnson1f15ddd2005-09-09 13:02:54 -0700273 if (params->frequency < 175000000)
274 band_select = 0x0e;
275 else if (params->frequency < 470000000)
276 band_select = 0x05;
277 else
278 band_select = 0x03;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279
280 data[0] = (div >> 8) & 0x7f;
281 data[1] = div & 0xff;
282 data[2] = ((div >> 10) & 0x60) | cfg;
Michael Krufky2b70a2f2005-11-08 21:35:16 -0800283 data[3] = (cpump << 6) | band_select;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700284
285 i2c_transfer(card->i2c_adapter, &msg, 1);
286 return (div * 166666 - 36000000);
287}
288
289static int microtune_mt7202dtf_request_firmware(struct dvb_frontend* fe, const struct firmware **fw, char* name)
290{
291 struct dvb_bt8xx_card* bt = (struct dvb_bt8xx_card*) fe->dvb->priv;
292
293 return request_firmware(fw, name, &bt->bt->dev->dev);
294}
295
296static struct sp887x_config microtune_mt7202dtf_config = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700297 .demod_address = 0x70,
298 .pll_set = microtune_mt7202dtf_pll_set,
299 .request_firmware = microtune_mt7202dtf_request_firmware,
300};
301
Linus Torvalds1da177e2005-04-16 15:20:36 -0700302static int advbt771_samsung_tdtc9251dh0_demod_init(struct dvb_frontend* fe)
303{
304 static u8 mt352_clock_config [] = { 0x89, 0x38, 0x2d };
305 static u8 mt352_reset [] = { 0x50, 0x80 };
306 static u8 mt352_adc_ctl_1_cfg [] = { 0x8E, 0x40 };
307 static u8 mt352_agc_cfg [] = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF,
Johannes Stezenbach50b215a2005-05-16 21:54:41 -0700308 0x00, 0xFF, 0x00, 0x40, 0x40 };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309 static u8 mt352_av771_extra[] = { 0xB5, 0x7A };
310 static u8 mt352_capt_range_cfg[] = { 0x75, 0x32 };
311
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312 mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config));
313 udelay(2000);
314 mt352_write(fe, mt352_reset, sizeof(mt352_reset));
315 mt352_write(fe, mt352_adc_ctl_1_cfg, sizeof(mt352_adc_ctl_1_cfg));
316
317 mt352_write(fe, mt352_agc_cfg,sizeof(mt352_agc_cfg));
318 udelay(2000);
319 mt352_write(fe, mt352_av771_extra,sizeof(mt352_av771_extra));
320 mt352_write(fe, mt352_capt_range_cfg, sizeof(mt352_capt_range_cfg));
321
322 return 0;
323}
324
325static int advbt771_samsung_tdtc9251dh0_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf)
326{
327 u32 div;
328 unsigned char bs = 0;
329 unsigned char cp = 0;
330
Linus Torvalds1da177e2005-04-16 15:20:36 -0700331 div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6;
332
David Johnson1f15ddd2005-09-09 13:02:54 -0700333 if (params->frequency < 150000000)
334 cp = 0xB4;
335 else if (params->frequency < 173000000)
336 cp = 0xBC;
337 else if (params->frequency < 250000000)
338 cp = 0xB4;
339 else if (params->frequency < 400000000)
340 cp = 0xBC;
341 else if (params->frequency < 420000000)
342 cp = 0xF4;
343 else if (params->frequency < 470000000)
344 cp = 0xFC;
345 else if (params->frequency < 600000000)
346 cp = 0xBC;
347 else if (params->frequency < 730000000)
348 cp = 0xF4;
349 else
350 cp = 0xFC;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351
David Johnson1f15ddd2005-09-09 13:02:54 -0700352 if (params->frequency < 150000000)
353 bs = 0x01;
354 else if (params->frequency < 173000000)
355 bs = 0x01;
356 else if (params->frequency < 250000000)
357 bs = 0x02;
358 else if (params->frequency < 400000000)
359 bs = 0x02;
360 else if (params->frequency < 420000000)
361 bs = 0x02;
362 else if (params->frequency < 470000000)
363 bs = 0x02;
364 else if (params->frequency < 600000000)
365 bs = 0x08;
366 else if (params->frequency < 730000000)
367 bs = 0x08;
368 else
369 bs = 0x08;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370
371 pllbuf[0] = 0xc2; // Note: non-linux standard PLL i2c address
372 pllbuf[1] = div >> 8;
373 pllbuf[2] = div & 0xff;
374 pllbuf[3] = cp;
375 pllbuf[4] = bs;
376
377 return 0;
378}
379
380static struct mt352_config advbt771_samsung_tdtc9251dh0_config = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700381 .demod_address = 0x0f,
382 .demod_init = advbt771_samsung_tdtc9251dh0_demod_init,
383 .pll_set = advbt771_samsung_tdtc9251dh0_pll_set,
384};
385
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386static struct dst_config dst_config = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387 .demod_address = 0x55,
388};
389
Linus Torvalds1da177e2005-04-16 15:20:36 -0700390static int or51211_request_firmware(struct dvb_frontend* fe, const struct firmware **fw, char* name)
391{
392 struct dvb_bt8xx_card* bt = (struct dvb_bt8xx_card*) fe->dvb->priv;
393
394 return request_firmware(fw, name, &bt->bt->dev->dev);
395}
396
397static void or51211_setmode(struct dvb_frontend * fe, int mode)
398{
399 struct dvb_bt8xx_card *bt = fe->dvb->priv;
400 bttv_write_gpio(bt->bttv_nr, 0x0002, mode); /* Reset */
401 msleep(20);
402}
403
404static void or51211_reset(struct dvb_frontend * fe)
405{
406 struct dvb_bt8xx_card *bt = fe->dvb->priv;
407
408 /* RESET DEVICE
409 * reset is controled by GPIO-0
410 * when set to 0 causes reset and when to 1 for normal op
411 * must remain reset for 128 clock cycles on a 50Mhz clock
412 * also PRM1 PRM2 & PRM4 are controled by GPIO-1,GPIO-2 & GPIO-4
413 * We assume that the reset has be held low long enough or we
414 * have been reset by a power on. When the driver is unloaded
415 * reset set to 0 so if reloaded we have been reset.
416 */
417 /* reset & PRM1,2&4 are outputs */
418 int ret = bttv_gpio_enable(bt->bttv_nr, 0x001F, 0x001F);
David Johnson1f15ddd2005-09-09 13:02:54 -0700419 if (ret != 0)
David Johnson05ade5a2005-09-09 13:02:55 -0700420 printk(KERN_WARNING "or51211: Init Error - Can't Reset DVR (%i)\n", ret);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421 bttv_write_gpio(bt->bttv_nr, 0x001F, 0x0000); /* Reset */
422 msleep(20);
423 /* Now set for normal operation */
424 bttv_write_gpio(bt->bttv_nr, 0x0001F, 0x0001);
425 /* wait for operation to begin */
426 msleep(500);
427}
428
429static void or51211_sleep(struct dvb_frontend * fe)
430{
431 struct dvb_bt8xx_card *bt = fe->dvb->priv;
432 bttv_write_gpio(bt->bttv_nr, 0x0001, 0x0000);
433}
434
435static struct or51211_config or51211_config = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700436 .demod_address = 0x15,
437 .request_firmware = or51211_request_firmware,
438 .setmode = or51211_setmode,
439 .reset = or51211_reset,
440 .sleep = or51211_sleep,
441};
442
Linus Torvalds1da177e2005-04-16 15:20:36 -0700443static int vp3021_alps_tded4_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
444{
445 struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv;
446 u8 buf[4];
447 u32 div;
448 struct i2c_msg msg = { .addr = 0x60, .flags = 0, .buf = buf, .len = sizeof(buf) };
449
450 div = (params->frequency + 36166667) / 166667;
451
452 buf[0] = (div >> 8) & 0x7F;
453 buf[1] = div & 0xFF;
454 buf[2] = 0x85;
455 if ((params->frequency >= 47000000) && (params->frequency < 153000000))
456 buf[3] = 0x01;
457 else if ((params->frequency >= 153000000) && (params->frequency < 430000000))
458 buf[3] = 0x02;
459 else if ((params->frequency >= 430000000) && (params->frequency < 824000000))
460 buf[3] = 0x0C;
461 else if ((params->frequency >= 824000000) && (params->frequency < 863000000))
462 buf[3] = 0x8C;
463 else
464 return -EINVAL;
465
466 i2c_transfer(card->i2c_adapter, &msg, 1);
467 return 0;
468}
469
470static struct nxt6000_config vp3021_alps_tded4_config = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471 .demod_address = 0x0a,
472 .clock_inversion = 1,
473 .pll_set = vp3021_alps_tded4_pll_set,
474};
475
David Johnson05ade5a2005-09-09 13:02:55 -0700476static int digitv_alps_tded4_demod_init(struct dvb_frontend* fe)
477{
478 static u8 mt352_clock_config [] = { 0x89, 0x38, 0x2d };
479 static u8 mt352_reset [] = { 0x50, 0x80 };
480 static u8 mt352_adc_ctl_1_cfg [] = { 0x8E, 0x40 };
481 static u8 mt352_agc_cfg [] = { 0x67, 0x20, 0xa0 };
482 static u8 mt352_capt_range_cfg[] = { 0x75, 0x32 };
483
484 mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config));
485 udelay(2000);
486 mt352_write(fe, mt352_reset, sizeof(mt352_reset));
487 mt352_write(fe, mt352_adc_ctl_1_cfg, sizeof(mt352_adc_ctl_1_cfg));
488 mt352_write(fe, mt352_agc_cfg,sizeof(mt352_agc_cfg));
489 mt352_write(fe, mt352_capt_range_cfg, sizeof(mt352_capt_range_cfg));
490
491 return 0;
492}
493
494static int digitv_alps_tded4_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf)
495{
496 u32 div;
497 struct dvb_ofdm_parameters *op = &params->u.ofdm;
498
499 div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6;
500
501 pllbuf[0] = 0xc2;
502 pllbuf[1] = (div >> 8) & 0x7F;
503 pllbuf[2] = div & 0xFF;
504 pllbuf[3] = 0x85;
505
506 dprintk("frequency %u, div %u\n", params->frequency, div);
507
508 if (params->frequency < 470000000)
509 pllbuf[4] = 0x02;
510 else if (params->frequency > 823000000)
511 pllbuf[4] = 0x88;
512 else
513 pllbuf[4] = 0x08;
514
515 if (op->bandwidth == 8)
516 pllbuf[4] |= 0x04;
517
518 return 0;
519}
520
521static void digitv_alps_tded4_reset(struct dvb_bt8xx_card *bt)
522{
523 /*
524 * Reset the frontend, must be called before trying
525 * to initialise the MT352 or mt352_attach
Stuart Auchterlonie163d8fe2005-11-08 21:35:40 -0800526 * will fail. Same goes for the nxt6000 frontend.
David Johnson05ade5a2005-09-09 13:02:55 -0700527 *
528 */
529
530 int ret = bttv_gpio_enable(bt->bttv_nr, 0x08, 0x08);
531 if (ret != 0)
532 printk(KERN_WARNING "digitv_alps_tded4: Init Error - Can't Reset DVR (%i)\n", ret);
533
534 /* Pulse the reset line */
535 bttv_write_gpio(bt->bttv_nr, 0x08, 0x08); /* High */
536 bttv_write_gpio(bt->bttv_nr, 0x08, 0x00); /* Low */
537 msleep(100);
538
539 bttv_write_gpio(bt->bttv_nr, 0x08, 0x08); /* High */
540}
541
542static struct mt352_config digitv_alps_tded4_config = {
543 .demod_address = 0x0a,
544 .demod_init = digitv_alps_tded4_demod_init,
545 .pll_set = digitv_alps_tded4_pll_set,
546};
547
Michael Krufky3cff00d2005-11-08 21:35:12 -0800548static int tdvs_tua6034_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
549{
550 struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv;
551 u8 buf[4];
552 struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) };
553 int err;
554
555 dvb_pll_configure(&dvb_pll_tdvs_tua6034, buf, params->frequency, 0);
556 dprintk("%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n",
557 __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]);
558 if ((err = i2c_transfer(card->i2c_adapter, &msg, 1)) != 1) {
Mauro Carvalho Chehab9101e622005-12-12 00:37:24 -0800559 printk(KERN_WARNING "dvb-bt8xx: %s error "
560 "(addr %02x <- %02x, err = %i)\n",
561 __FUNCTION__, buf[0], buf[1], err);
Michael Krufky3cff00d2005-11-08 21:35:12 -0800562 if (err < 0)
563 return err;
564 else
565 return -EREMOTEIO;
566 }
567
568 /* Set the Auxiliary Byte. */
569 buf[2] &= ~0x20;
570 buf[2] |= 0x18;
571 buf[3] = 0x50;
572 i2c_transfer(card->i2c_adapter, &msg, 1);
573
574 return 0;
575}
576
577static struct lgdt330x_config tdvs_tua6034_config = {
578 .demod_address = 0x0e,
579 .demod_chip = LGDT3303,
580 .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */
581 .pll_set = tdvs_tua6034_pll_set,
582};
583
584static void lgdt330x_reset(struct dvb_bt8xx_card *bt)
585{
586 /* Set pin 27 of the lgdt3303 chip high to reset the frontend */
587
588 /* Pulse the reset line */
589 bttv_write_gpio(bt->bttv_nr, 0x00e00007, 0x00000001); /* High */
590 bttv_write_gpio(bt->bttv_nr, 0x00e00007, 0x00000000); /* Low */
591 msleep(100);
592
593 bttv_write_gpio(bt->bttv_nr, 0x00e00007, 0x00000001); /* High */
594 msleep(100);
595}
596
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
598{
Johannes Stezenbach50b215a2005-05-16 21:54:41 -0700599 int ret;
600 struct dst_state* state = NULL;
601
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 switch(type) {
Michael Krufky6cffcc22005-11-08 21:38:36 -0800603 case BTTV_BOARD_DVICO_DVBT_LITE:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700604 card->fe = mt352_attach(&thomson_dtt7579_config, card->i2c_adapter);
605 if (card->fe != NULL) {
606 card->fe->ops->info.frequency_min = 174000000;
607 card->fe->ops->info.frequency_max = 862000000;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700608 }
609 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610
Michael Krufky6cffcc22005-11-08 21:38:36 -0800611 case BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE:
Michael Krufky3cff00d2005-11-08 21:35:12 -0800612 lgdt330x_reset(card);
613 card->fe = lgdt330x_attach(&tdvs_tua6034_config, card->i2c_adapter);
614 if (card->fe != NULL)
615 dprintk ("dvb_bt8xx: lgdt330x detected\n");
616 break;
Michael Krufky3cff00d2005-11-08 21:35:12 -0800617
Michael Krufky6cffcc22005-11-08 21:38:36 -0800618 case BTTV_BOARD_NEBULA_DIGITV:
David Johnson05ade5a2005-09-09 13:02:55 -0700619 /*
620 * It is possible to determine the correct frontend using the I2C bus (see the Nebula SDK);
621 * this would be a cleaner solution than trying each frontend in turn.
622 */
623
624 /* Old Nebula (marked (c)2003 on high profile pci card) has nxt6000 demod */
Stuart Auchterlonie163d8fe2005-11-08 21:35:40 -0800625 digitv_alps_tded4_reset(card);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700626 card->fe = nxt6000_attach(&vp3021_alps_tded4_config, card->i2c_adapter);
Stuart Auchterlonief30db062005-09-09 13:02:56 -0700627 if (card->fe != NULL) {
David Johnson05ade5a2005-09-09 13:02:55 -0700628 dprintk ("dvb_bt8xx: an nxt6000 was detected on your digitv card\n");
Stuart Auchterlonief30db062005-09-09 13:02:56 -0700629 break;
630 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700631
David Johnson05ade5a2005-09-09 13:02:55 -0700632 /* New Nebula (marked (c)2005 on low profile pci card) has mt352 demod */
633 digitv_alps_tded4_reset(card);
634 card->fe = mt352_attach(&digitv_alps_tded4_config, card->i2c_adapter);
635
David Johnson1f15ddd2005-09-09 13:02:54 -0700636 if (card->fe != NULL)
David Johnson05ade5a2005-09-09 13:02:55 -0700637 dprintk ("dvb_bt8xx: an mt352 was detected on your digitv card\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700638 break;
639
Michael Krufky6cffcc22005-11-08 21:38:36 -0800640 case BTTV_BOARD_AVDVBT_761:
David Johnson05ade5a2005-09-09 13:02:55 -0700641 card->fe = sp887x_attach(&microtune_mt7202dtf_config, card->i2c_adapter);
642 break;
643
Michael Krufky6cffcc22005-11-08 21:38:36 -0800644 case BTTV_BOARD_AVDVBT_771:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700645 card->fe = mt352_attach(&advbt771_samsung_tdtc9251dh0_config, card->i2c_adapter);
646 if (card->fe != NULL) {
647 card->fe->ops->info.frequency_min = 174000000;
648 card->fe->ops->info.frequency_max = 862000000;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700649 }
650 break;
651
Michael Krufky6cffcc22005-11-08 21:38:36 -0800652 case BTTV_BOARD_TWINHAN_DST:
Johannes Stezenbach50b215a2005-05-16 21:54:41 -0700653 /* DST is not a frontend driver !!! */
654 state = (struct dst_state *) kmalloc(sizeof (struct dst_state), GFP_KERNEL);
655 /* Setup the Card */
656 state->config = &dst_config;
657 state->i2c = card->i2c_adapter;
658 state->bt = card->bt;
659
660 /* DST is not a frontend, attaching the ASIC */
661 if ((dst_attach(state, &card->dvb_adapter)) == NULL) {
662 printk("%s: Could not find a Twinhan DST.\n", __FUNCTION__);
663 break;
664 }
665 card->fe = &state->frontend;
666
667 /* Attach other DST peripherals if any */
668 /* Conditional Access device */
David Johnson1f15ddd2005-09-09 13:02:54 -0700669 if (state->dst_hw_cap & DST_TYPE_HAS_CA)
Johannes Stezenbach50b215a2005-05-16 21:54:41 -0700670 ret = dst_ca_attach(state, &card->dvb_adapter);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700671 break;
672
Michael Krufky6cffcc22005-11-08 21:38:36 -0800673 case BTTV_BOARD_PINNACLESAT:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700674 card->fe = cx24110_attach(&pctvsat_config, card->i2c_adapter);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675 break;
676
Michael Krufky6cffcc22005-11-08 21:38:36 -0800677 case BTTV_BOARD_PC_HDTV:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700678 card->fe = or51211_attach(&or51211_config, card->i2c_adapter);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700679 break;
680 }
681
David Johnson1f15ddd2005-09-09 13:02:54 -0700682 if (card->fe == NULL)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683 printk("dvb-bt8xx: A frontend driver was not found for device %04x/%04x subsystem %04x/%04x\n",
684 card->bt->dev->vendor,
685 card->bt->dev->device,
686 card->bt->dev->subsystem_vendor,
687 card->bt->dev->subsystem_device);
David Johnson1f15ddd2005-09-09 13:02:54 -0700688 else
Johannes Stezenbachfdc53a62005-05-16 21:54:39 -0700689 if (dvb_register_frontend(&card->dvb_adapter, card->fe)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700690 printk("dvb-bt8xx: Frontend registration failed!\n");
691 if (card->fe->ops->release)
692 card->fe->ops->release(card->fe);
693 card->fe = NULL;
694 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700695}
696
697static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)
698{
699 int result;
700
David Johnson1f15ddd2005-09-09 13:02:54 -0700701 if ((result = dvb_register_adapter(&card->dvb_adapter, card->card_name, THIS_MODULE)) < 0) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702 printk("dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result);
703 return result;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700704 }
Johannes Stezenbachfdc53a62005-05-16 21:54:39 -0700705 card->dvb_adapter.priv = card;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700706
707 card->bt->adapter = card->i2c_adapter;
708
709 memset(&card->demux, 0, sizeof(struct dvb_demux));
710
711 card->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING;
712
713 card->demux.priv = card;
714 card->demux.filternum = 256;
715 card->demux.feednum = 256;
716 card->demux.start_feed = dvb_bt8xx_start_feed;
717 card->demux.stop_feed = dvb_bt8xx_stop_feed;
718 card->demux.write_to_decoder = NULL;
719
720 if ((result = dvb_dmx_init(&card->demux)) < 0) {
721 printk("dvb_bt8xx: dvb_dmx_init failed (errno = %d)\n", result);
722
Johannes Stezenbachfdc53a62005-05-16 21:54:39 -0700723 dvb_unregister_adapter(&card->dvb_adapter);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700724 return result;
725 }
726
727 card->dmxdev.filternum = 256;
728 card->dmxdev.demux = &card->demux.dmx;
729 card->dmxdev.capabilities = 0;
730
Johannes Stezenbachfdc53a62005-05-16 21:54:39 -0700731 if ((result = dvb_dmxdev_init(&card->dmxdev, &card->dvb_adapter)) < 0) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700732 printk("dvb_bt8xx: dvb_dmxdev_init failed (errno = %d)\n", result);
733
734 dvb_dmx_release(&card->demux);
Johannes Stezenbachfdc53a62005-05-16 21:54:39 -0700735 dvb_unregister_adapter(&card->dvb_adapter);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700736 return result;
737 }
738
739 card->fe_hw.source = DMX_FRONTEND_0;
740
741 if ((result = card->demux.dmx.add_frontend(&card->demux.dmx, &card->fe_hw)) < 0) {
742 printk("dvb_bt8xx: dvb_dmx_init failed (errno = %d)\n", result);
743
744 dvb_dmxdev_release(&card->dmxdev);
745 dvb_dmx_release(&card->demux);
Johannes Stezenbachfdc53a62005-05-16 21:54:39 -0700746 dvb_unregister_adapter(&card->dvb_adapter);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700747 return result;
748 }
749
750 card->fe_mem.source = DMX_MEMORY_FE;
751
752 if ((result = card->demux.dmx.add_frontend(&card->demux.dmx, &card->fe_mem)) < 0) {
753 printk("dvb_bt8xx: dvb_dmx_init failed (errno = %d)\n", result);
754
755 card->demux.dmx.remove_frontend(&card->demux.dmx, &card->fe_hw);
756 dvb_dmxdev_release(&card->dmxdev);
757 dvb_dmx_release(&card->demux);
Johannes Stezenbachfdc53a62005-05-16 21:54:39 -0700758 dvb_unregister_adapter(&card->dvb_adapter);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700759 return result;
760 }
761
762 if ((result = card->demux.dmx.connect_frontend(&card->demux.dmx, &card->fe_hw)) < 0) {
763 printk("dvb_bt8xx: dvb_dmx_init failed (errno = %d)\n", result);
764
765 card->demux.dmx.remove_frontend(&card->demux.dmx, &card->fe_mem);
766 card->demux.dmx.remove_frontend(&card->demux.dmx, &card->fe_hw);
767 dvb_dmxdev_release(&card->dmxdev);
768 dvb_dmx_release(&card->demux);
Johannes Stezenbachfdc53a62005-05-16 21:54:39 -0700769 dvb_unregister_adapter(&card->dvb_adapter);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700770 return result;
771 }
772
Johannes Stezenbachfdc53a62005-05-16 21:54:39 -0700773 dvb_net_init(&card->dvb_adapter, &card->dvbnet, &card->demux.dmx);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700774
775 tasklet_init(&card->bt->tasklet, dvb_bt8xx_task, (unsigned long) card);
776
777 frontend_init(card, type);
778
779 return 0;
780}
781
782static int dvb_bt8xx_probe(struct device *dev)
783{
784 struct bttv_sub_device *sub = to_bttv_sub_dev(dev);
785 struct dvb_bt8xx_card *card;
786 struct pci_dev* bttv_pci_dev;
787 int ret;
788
789 if (!(card = kmalloc(sizeof(struct dvb_bt8xx_card), GFP_KERNEL)))
790 return -ENOMEM;
791
792 memset(card, 0, sizeof(*card));
793 init_MUTEX(&card->lock);
794 card->bttv_nr = sub->core->nr;
795 strncpy(card->card_name, sub->core->name, sizeof(sub->core->name));
796 card->i2c_adapter = &sub->core->i2c_adap;
797
David Johnson1f15ddd2005-09-09 13:02:54 -0700798 switch(sub->core->type) {
Michael Krufky6cffcc22005-11-08 21:38:36 -0800799 case BTTV_BOARD_PINNACLESAT:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700800 card->gpio_mode = 0x0400c060;
801 /* should be: BT878_A_GAIN=0,BT878_A_PWRDN,BT878_DA_DPM,BT878_DA_SBR,
Johannes Stezenbach50b215a2005-05-16 21:54:41 -0700802 BT878_DA_IOM=1,BT878_DA_APP to enable serial highspeed mode. */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700803 card->op_sync_orin = 0;
804 card->irq_err_ignore = 0;
805 break;
806
Michael Krufky6cffcc22005-11-08 21:38:36 -0800807 case BTTV_BOARD_DVICO_DVBT_LITE:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700808 card->gpio_mode = 0x0400C060;
809 card->op_sync_orin = 0;
810 card->irq_err_ignore = 0;
811 /* 26, 15, 14, 6, 5
812 * A_PWRDN DA_DPM DA_SBR DA_IOM_DA
813 * DA_APP(parallel) */
814 break;
815
Michael Krufky6cffcc22005-11-08 21:38:36 -0800816 case BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE:
Michael Krufky3cff00d2005-11-08 21:35:12 -0800817 card->gpio_mode = 0x0400c060;
818 card->op_sync_orin = BT878_RISC_SYNC_MASK;
819 card->irq_err_ignore = BT878_AFBUS | BT878_AFDSR;
820 break;
821
Michael Krufky6cffcc22005-11-08 21:38:36 -0800822 case BTTV_BOARD_NEBULA_DIGITV:
Michael Krufky6cffcc22005-11-08 21:38:36 -0800823 case BTTV_BOARD_AVDVBT_761:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700824 card->gpio_mode = (1 << 26) | (1 << 14) | (1 << 5);
825 card->op_sync_orin = 0;
826 card->irq_err_ignore = 0;
827 /* A_PWRDN DA_SBR DA_APP (high speed serial) */
828 break;
829
Michael Krufky6cffcc22005-11-08 21:38:36 -0800830 case BTTV_BOARD_AVDVBT_771: //case 0x07711461:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700831 card->gpio_mode = 0x0400402B;
832 card->op_sync_orin = BT878_RISC_SYNC_MASK;
833 card->irq_err_ignore = 0;
834 /* A_PWRDN DA_SBR DA_APP[0] PKTP=10 RISC_ENABLE FIFO_ENABLE*/
835 break;
836
Michael Krufky6cffcc22005-11-08 21:38:36 -0800837 case BTTV_BOARD_TWINHAN_DST:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700838 card->gpio_mode = 0x2204f2c;
839 card->op_sync_orin = BT878_RISC_SYNC_MASK;
840 card->irq_err_ignore = BT878_APABORT | BT878_ARIPERR |
841 BT878_APPERR | BT878_AFBUS;
842 /* 25,21,14,11,10,9,8,3,2 then
843 * 0x33 = 5,4,1,0
844 * A_SEL=SML, DA_MLB, DA_SBR,
845 * DA_SDR=f, fifo trigger = 32 DWORDS
846 * IOM = 0 == audio A/D
847 * DPM = 0 == digital audio mode
848 * == async data parallel port
849 * then 0x33 (13 is set by start_capture)
850 * DA_APP = async data parallel port,
851 * ACAP_EN = 1,
852 * RISC+FIFO ENABLE */
853 break;
854
Michael Krufky6cffcc22005-11-08 21:38:36 -0800855 case BTTV_BOARD_PC_HDTV:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700856 card->gpio_mode = 0x0100EC7B;
857 card->op_sync_orin = 0;
858 card->irq_err_ignore = 0;
859 break;
860
David Johnson05ade5a2005-09-09 13:02:55 -0700861 default:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700862 printk(KERN_WARNING "dvb_bt8xx: Unknown bttv card type: %d.\n",
863 sub->core->type);
864 kfree(card);
865 return -ENODEV;
866 }
867
868 dprintk("dvb_bt8xx: identified card%d as %s\n", card->bttv_nr, card->card_name);
869
870 if (!(bttv_pci_dev = bttv_get_pcidev(card->bttv_nr))) {
871 printk("dvb_bt8xx: no pci device for card %d\n", card->bttv_nr);
872 kfree(card);
873 return -EFAULT;
874 }
875
876 if (!(card->bt = dvb_bt8xx_878_match(card->bttv_nr, bttv_pci_dev))) {
877 printk("dvb_bt8xx: unable to determine DMA core of card %d,\n",
878 card->bttv_nr);
879 printk("dvb_bt8xx: if you have the ALSA bt87x audio driver "
880 "installed, try removing it.\n");
881
882 kfree(card);
883 return -EFAULT;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700884 }
885
886 init_MUTEX(&card->bt->gpio_lock);
887 card->bt->bttv_nr = sub->core->nr;
888
889 if ( (ret = dvb_bt8xx_load_card(card, sub->core->type)) ) {
890 kfree(card);
891 return ret;
892 }
893
894 dev_set_drvdata(dev, card);
895 return 0;
896}
897
898static int dvb_bt8xx_remove(struct device *dev)
899{
900 struct dvb_bt8xx_card *card = dev_get_drvdata(dev);
901
902 dprintk("dvb_bt8xx: unloading card%d\n", card->bttv_nr);
903
904 bt878_stop(card->bt);
905 tasklet_kill(&card->bt->tasklet);
906 dvb_net_release(&card->dvbnet);
907 card->demux.dmx.remove_frontend(&card->demux.dmx, &card->fe_mem);
908 card->demux.dmx.remove_frontend(&card->demux.dmx, &card->fe_hw);
909 dvb_dmxdev_release(&card->dmxdev);
910 dvb_dmx_release(&card->demux);
David Johnson1f15ddd2005-09-09 13:02:54 -0700911 if (card->fe)
912 dvb_unregister_frontend(card->fe);
Johannes Stezenbachfdc53a62005-05-16 21:54:39 -0700913 dvb_unregister_adapter(&card->dvb_adapter);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700914
915 kfree(card);
916
917 return 0;
918}
919
920static struct bttv_sub_driver driver = {
921 .drv = {
922 .name = "dvb-bt8xx",
923 .probe = dvb_bt8xx_probe,
924 .remove = dvb_bt8xx_remove,
925 /* FIXME:
926 * .shutdown = dvb_bt8xx_shutdown,
927 * .suspend = dvb_bt8xx_suspend,
928 * .resume = dvb_bt8xx_resume,
929 */
930 },
931};
932
933static int __init dvb_bt8xx_init(void)
934{
935 return bttv_sub_register(&driver, "dvb");
936}
937
938static void __exit dvb_bt8xx_exit(void)
939{
940 bttv_sub_unregister(&driver);
941}
942
943module_init(dvb_bt8xx_init);
944module_exit(dvb_bt8xx_exit);
945
946MODULE_DESCRIPTION("Bt8xx based DVB adapter driver");
947MODULE_AUTHOR("Florian Schirmer <jolt@tuxbox.org>");
948MODULE_LICENSE("GPL");