2 DVB device driver for em28xx
4 (c) 2008-2011 Mauro Carvalho Chehab <mchehab@infradead.org>
6 (c) 2008 Devin Heitmueller <devin.heitmueller@gmail.com>
7 - Fixes for the driver to properly work with HVR-950
8 - Fixes for the driver to properly work with Pinnacle PCTV HD Pro Stick
9 - Fixes for the driver to properly work with AMD ATI TV Wonder HD 600
11 (c) 2008 Aidan Thornton <makosoft@googlemail.com>
13 (c) 2012 Frank Schäfer <fschaefer.oss@googlemail.com>
15 Based on cx88-dvb, saa7134-dvb and videobuf-dvb originally written by:
16 (c) 2004, 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au>
17 (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
19 This program is free software; you can redistribute it and/or modify
20 it under the terms of the GNU General Public License as published by
21 the Free Software Foundation; either version 2 of the License.
24 #include <linux/kernel.h>
25 #include <linux/slab.h>
26 #include <linux/usb.h>
29 #include <media/v4l2-common.h>
30 #include <dvb_demux.h>
33 #include <media/tuner.h>
34 #include "tuner-simple.h"
35 #include <linux/gpio.h>
42 #include "mt352_priv.h" /* FIXME */
48 #include "tda18271c2dd.h"
54 #include "m88ds3103.h"
55 #include "m88ts2022.h"
57 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>");
58 MODULE_LICENSE("GPL");
59 MODULE_DESCRIPTION(DRIVER_DESC " - digital TV interface");
60 MODULE_VERSION(EM28XX_VERSION);
63 static unsigned int debug;
64 module_param(debug, int, 0644);
65 MODULE_PARM_DESC(debug, "enable debug messages [dvb]");
67 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
69 #define dprintk(level, fmt, arg...) do { \
71 printk(KERN_DEBUG "%s/2-dvb: " fmt, dev->name, ## arg); \
75 struct dvb_frontend *fe[2];
77 /* feed count management */
81 /* general boilerplate stuff */
82 struct dvb_adapter adapter;
83 struct dvb_demux demux;
85 struct dmx_frontend fe_hw;
86 struct dmx_frontend fe_mem;
89 /* Due to DRX-K - probably need changes */
90 int (*gate_ctrl)(struct dvb_frontend *, int);
91 struct semaphore pll_mutex;
94 struct i2c_client *i2c_client_tuner;
98 static inline void print_err_status(struct em28xx *dev,
99 int packet, int status)
101 char *errmsg = "Unknown";
105 errmsg = "unlinked synchronuously";
108 errmsg = "unlinked asynchronuously";
111 errmsg = "Buffer error (overrun)";
114 errmsg = "Stalled (device not responding)";
117 errmsg = "Babble (bad cable?)";
120 errmsg = "Bit-stuff error (bad cable?)";
123 errmsg = "CRC/Timeout (could be anything)";
126 errmsg = "Device does not respond";
130 dprintk(1, "URB status %d [%s].\n", status, errmsg);
132 dprintk(1, "URB packet %d, status %d [%s].\n",
133 packet, status, errmsg);
137 static inline int em28xx_dvb_urb_data_copy(struct em28xx *dev, struct urb *urb)
139 int xfer_bulk, num_packets, i;
144 if (dev->disconnected)
148 print_err_status(dev, -1, urb->status);
150 xfer_bulk = usb_pipebulk(urb->pipe);
152 if (xfer_bulk) /* bulk */
155 num_packets = urb->number_of_packets;
157 for (i = 0; i < num_packets; i++) {
159 if (urb->status < 0) {
160 print_err_status(dev, i, urb->status);
161 if (urb->status != -EPROTO)
164 dvb_dmx_swfilter(&dev->dvb->demux, urb->transfer_buffer,
167 if (urb->iso_frame_desc[i].status < 0) {
168 print_err_status(dev, i,
169 urb->iso_frame_desc[i].status);
170 if (urb->iso_frame_desc[i].status != -EPROTO)
173 dvb_dmx_swfilter(&dev->dvb->demux,
174 urb->transfer_buffer +
175 urb->iso_frame_desc[i].offset,
176 urb->iso_frame_desc[i].actual_length);
183 static int em28xx_start_streaming(struct em28xx_dvb *dvb)
186 struct em28xx_i2c_bus *i2c_bus = dvb->adapter.priv;
187 struct em28xx *dev = i2c_bus->dev;
188 int dvb_max_packet_size, packet_multiplier, dvb_alt;
190 if (dev->dvb_xfer_bulk) {
191 if (!dev->dvb_ep_bulk)
193 dvb_max_packet_size = 512; /* USB 2.0 spec */
194 packet_multiplier = EM28XX_DVB_BULK_PACKET_MULTIPLIER;
197 if (!dev->dvb_ep_isoc)
199 dvb_max_packet_size = dev->dvb_max_pkt_size_isoc;
200 if (dvb_max_packet_size < 0)
201 return dvb_max_packet_size;
202 packet_multiplier = EM28XX_DVB_NUM_ISOC_PACKETS;
203 dvb_alt = dev->dvb_alt_isoc;
206 usb_set_interface(dev->udev, 0, dvb_alt);
207 rc = em28xx_set_mode(dev, EM28XX_DIGITAL_MODE);
211 dprintk(1, "Using %d buffers each with %d x %d bytes\n",
214 dvb_max_packet_size);
216 return em28xx_init_usb_xfer(dev, EM28XX_DIGITAL_MODE,
221 em28xx_dvb_urb_data_copy);
224 static int em28xx_stop_streaming(struct em28xx_dvb *dvb)
226 struct em28xx_i2c_bus *i2c_bus = dvb->adapter.priv;
227 struct em28xx *dev = i2c_bus->dev;
229 em28xx_stop_urbs(dev);
234 static int em28xx_start_feed(struct dvb_demux_feed *feed)
236 struct dvb_demux *demux = feed->demux;
237 struct em28xx_dvb *dvb = demux->priv;
240 if (!demux->dmx.frontend)
243 mutex_lock(&dvb->lock);
247 if (dvb->nfeeds == 1) {
248 ret = em28xx_start_streaming(dvb);
253 mutex_unlock(&dvb->lock);
257 static int em28xx_stop_feed(struct dvb_demux_feed *feed)
259 struct dvb_demux *demux = feed->demux;
260 struct em28xx_dvb *dvb = demux->priv;
263 mutex_lock(&dvb->lock);
266 if (0 == dvb->nfeeds)
267 err = em28xx_stop_streaming(dvb);
269 mutex_unlock(&dvb->lock);
275 /* ------------------------------------------------------------------ */
276 static int em28xx_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire)
278 struct em28xx_i2c_bus *i2c_bus = fe->dvb->priv;
279 struct em28xx *dev = i2c_bus->dev;
282 return em28xx_set_mode(dev, EM28XX_DIGITAL_MODE);
284 return em28xx_set_mode(dev, EM28XX_SUSPEND);
287 /* ------------------------------------------------------------------ */
289 static struct lgdt330x_config em2880_lgdt3303_dev = {
290 .demod_address = 0x0e,
291 .demod_chip = LGDT3303,
294 static struct lgdt3305_config em2870_lgdt3304_dev = {
296 .demod_chip = LGDT3304,
297 .spectral_inversion = 1,
299 .mpeg_mode = LGDT3305_MPEG_PARALLEL,
300 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
301 .tpvalid_polarity = LGDT3305_TP_VALID_HIGH,
306 static struct lgdt3305_config em2874_lgdt3305_dev = {
308 .demod_chip = LGDT3305,
309 .spectral_inversion = 1,
311 .mpeg_mode = LGDT3305_MPEG_SERIAL,
312 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
313 .tpvalid_polarity = LGDT3305_TP_VALID_HIGH,
318 static struct s921_config sharp_isdbt = {
319 .demod_address = 0x30 >> 1
322 static struct zl10353_config em28xx_zl10353_with_xc3028 = {
323 .demod_address = (0x1e >> 1),
329 static struct s5h1409_config em28xx_s5h1409_with_xc3028 = {
330 .demod_address = 0x32 >> 1,
331 .output_mode = S5H1409_PARALLEL_OUTPUT,
332 .gpio = S5H1409_GPIO_OFF,
333 .inversion = S5H1409_INVERSION_OFF,
334 .status_mode = S5H1409_DEMODLOCKING,
335 .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK
338 static struct tda18271_std_map kworld_a340_std_map = {
339 .atsc_6 = { .if_freq = 3250, .agc_mode = 3, .std = 0,
340 .if_lvl = 1, .rfagc_top = 0x37, },
341 .qam_6 = { .if_freq = 4000, .agc_mode = 3, .std = 1,
342 .if_lvl = 1, .rfagc_top = 0x37, },
345 static struct tda18271_config kworld_a340_config = {
346 .std_map = &kworld_a340_std_map,
349 static struct tda18271_config kworld_ub435q_v2_config = {
350 .std_map = &kworld_a340_std_map,
351 .gate = TDA18271_GATE_DIGITAL,
354 static struct zl10353_config em28xx_zl10353_xc3028_no_i2c_gate = {
355 .demod_address = (0x1e >> 1),
357 .disable_i2c_gate_ctrl = 1,
362 static struct drxd_config em28xx_drxd = {
363 .demod_address = 0x70,
364 .demod_revision = 0xa2,
365 .pll_type = DRXD_PLL_NONE,
369 .disable_i2c_gate_ctrl = 1,
372 static struct drxk_config terratec_h5_drxk = {
376 .microcode_name = "dvb-usb-terratec-h5-drxk.fw",
377 .qam_demod_parameter_count = 2,
378 .load_firmware_sync = true,
381 static struct drxk_config hauppauge_930c_drxk = {
385 .microcode_name = "dvb-usb-hauppauge-hvr930c-drxk.fw",
387 .qam_demod_parameter_count = 2,
388 .load_firmware_sync = true,
391 static struct drxk_config terratec_htc_stick_drxk = {
395 .microcode_name = "dvb-usb-terratec-htc-stick-drxk.fw",
397 .qam_demod_parameter_count = 2,
398 /* Required for the antenna_gpio to disable LNA. */
399 .antenna_dvbt = true,
400 /* The windows driver uses the same. This will disable LNA. */
402 .load_firmware_sync = true,
405 static struct drxk_config maxmedia_ub425_tc_drxk = {
409 .microcode_name = "dvb-demod-drxk-01.fw",
411 .load_firmware_sync = true,
412 .qam_demod_parameter_count = 2,
415 static struct drxk_config pctv_520e_drxk = {
418 .microcode_name = "dvb-demod-drxk-pctv.fw",
419 .qam_demod_parameter_count = 2,
421 .antenna_dvbt = true, /* disable LNA */
422 .antenna_gpio = (1 << 2), /* disable LNA */
423 .load_firmware_sync = true,
426 static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable)
428 struct em28xx_dvb *dvb = fe->sec_priv;
435 down(&dvb->pll_mutex);
436 status = dvb->gate_ctrl(fe, 1);
438 status = dvb->gate_ctrl(fe, 0);
444 static void hauppauge_hvr930c_init(struct em28xx *dev)
448 struct em28xx_reg_seq hauppauge_hvr930c_init[] = {
449 {EM2874_R80_GPIO_P0_CTRL, 0xff, 0xff, 0x65},
450 {EM2874_R80_GPIO_P0_CTRL, 0xfb, 0xff, 0x32},
451 {EM2874_R80_GPIO_P0_CTRL, 0xff, 0xff, 0xb8},
454 struct em28xx_reg_seq hauppauge_hvr930c_end[] = {
455 {EM2874_R80_GPIO_P0_CTRL, 0xef, 0xff, 0x01},
456 {EM2874_R80_GPIO_P0_CTRL, 0xaf, 0xff, 0x65},
457 {EM2874_R80_GPIO_P0_CTRL, 0xef, 0xff, 0x76},
458 {EM2874_R80_GPIO_P0_CTRL, 0xef, 0xff, 0x01},
459 {EM2874_R80_GPIO_P0_CTRL, 0xcf, 0xff, 0x0b},
460 {EM2874_R80_GPIO_P0_CTRL, 0xef, 0xff, 0x40},
462 {EM2874_R80_GPIO_P0_CTRL, 0xcf, 0xff, 0x65},
463 {EM2874_R80_GPIO_P0_CTRL, 0xef, 0xff, 0x65},
464 {EM2874_R80_GPIO_P0_CTRL, 0xcf, 0xff, 0x0b},
465 {EM2874_R80_GPIO_P0_CTRL, 0xef, 0xff, 0x65},
474 {{ 0x06, 0x02, 0x00, 0x31 }, 4},
476 {{ 0x01, 0x02, 0x00, 0xc6 }, 4},
478 {{ 0x01, 0x00, 0xff, 0xaf }, 4},
479 {{ 0x01, 0x00, 0x03, 0xa0 }, 4},
481 {{ 0x01, 0x00, 0x73, 0xaf }, 4},
484 {{ 0x00, 0x04, 0x00, 0x0a }, 4},
486 {{ 0x04, 0x14, 0x00, 0x00 }, 4},
489 em28xx_gpio_set(dev, hauppauge_hvr930c_init);
490 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
492 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
495 dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1;
497 for (i = 0; i < ARRAY_SIZE(regs); i++)
498 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len);
499 em28xx_gpio_set(dev, hauppauge_hvr930c_end);
503 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
506 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x45);
511 static void terratec_h5_init(struct em28xx *dev)
514 struct em28xx_reg_seq terratec_h5_init[] = {
515 {EM2820_R08_GPIO_CTRL, 0xff, 0xff, 10},
516 {EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 100},
517 {EM2874_R80_GPIO_P0_CTRL, 0xf2, 0xff, 50},
518 {EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 100},
521 struct em28xx_reg_seq terratec_h5_end[] = {
522 {EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 100},
523 {EM2874_R80_GPIO_P0_CTRL, 0xa6, 0xff, 50},
524 {EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 100},
531 {{ 0x06, 0x02, 0x00, 0x31 }, 4},
533 {{ 0x01, 0x02, 0x00, 0xc6 }, 4},
535 {{ 0x01, 0x00, 0xff, 0xaf }, 4},
536 {{ 0x01, 0x00, 0x03, 0xa0 }, 4},
538 {{ 0x01, 0x00, 0x73, 0xaf }, 4},
541 {{ 0x00, 0x04, 0x00, 0x0a }, 4},
543 {{ 0x04, 0x14, 0x00, 0x00 }, 4},
546 em28xx_gpio_set(dev, terratec_h5_init);
547 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
549 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x45);
552 dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1;
554 for (i = 0; i < ARRAY_SIZE(regs); i++)
555 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len);
556 em28xx_gpio_set(dev, terratec_h5_end);
559 static void terratec_htc_stick_init(struct em28xx *dev)
564 * GPIO configuration:
565 * 0xff: unknown (does not affect DVB-T).
566 * 0xf6: DRX-K (demodulator).
567 * 0xe6: unknown (does not affect DVB-T).
568 * 0xb6: unknown (does not affect DVB-T).
570 struct em28xx_reg_seq terratec_htc_stick_init[] = {
571 {EM2820_R08_GPIO_CTRL, 0xff, 0xff, 10},
572 {EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 100},
573 {EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 50},
574 {EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 100},
577 struct em28xx_reg_seq terratec_htc_stick_end[] = {
578 {EM2874_R80_GPIO_P0_CTRL, 0xb6, 0xff, 100},
579 {EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 50},
584 * Init the analog decoder (not yet supported), but
585 * it's probably still a good idea.
591 {{ 0x06, 0x02, 0x00, 0x31 }, 4},
593 {{ 0x01, 0x02, 0x00, 0xc6 }, 4},
595 {{ 0x01, 0x00, 0xff, 0xaf }, 4},
598 em28xx_gpio_set(dev, terratec_htc_stick_init);
600 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
602 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
605 dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1;
607 for (i = 0; i < ARRAY_SIZE(regs); i++)
608 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len);
610 em28xx_gpio_set(dev, terratec_htc_stick_end);
613 static void terratec_htc_usb_xs_init(struct em28xx *dev)
617 struct em28xx_reg_seq terratec_htc_usb_xs_init[] = {
618 {EM2820_R08_GPIO_CTRL, 0xff, 0xff, 10},
619 {EM2874_R80_GPIO_P0_CTRL, 0xb2, 0xff, 100},
620 {EM2874_R80_GPIO_P0_CTRL, 0xb2, 0xff, 50},
621 {EM2874_R80_GPIO_P0_CTRL, 0xb6, 0xff, 100},
624 struct em28xx_reg_seq terratec_htc_usb_xs_end[] = {
625 {EM2874_R80_GPIO_P0_CTRL, 0xa6, 0xff, 100},
626 {EM2874_R80_GPIO_P0_CTRL, 0xa6, 0xff, 50},
627 {EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 100},
632 * Init the analog decoder (not yet supported), but
633 * it's probably still a good idea.
639 {{ 0x06, 0x02, 0x00, 0x31 }, 4},
641 {{ 0x01, 0x02, 0x00, 0xc6 }, 4},
643 {{ 0x01, 0x00, 0xff, 0xaf }, 4},
644 {{ 0x01, 0x00, 0x03, 0xa0 }, 4},
646 {{ 0x01, 0x00, 0x73, 0xaf }, 4},
649 {{ 0x00, 0x04, 0x00, 0x0a }, 4},
651 {{ 0x04, 0x14, 0x00, 0x00 }, 4},
654 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
656 em28xx_gpio_set(dev, terratec_htc_usb_xs_init);
658 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
660 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
663 dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1;
665 for (i = 0; i < ARRAY_SIZE(regs); i++)
666 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len);
668 em28xx_gpio_set(dev, terratec_htc_usb_xs_end);
671 static void pctv_520e_init(struct em28xx *dev)
674 * Init AVF4910B analog decoder. Looks like I2C traffic to
675 * digital demodulator and tuner are routed via AVF4910B.
682 {{ 0x06, 0x02, 0x00, 0x31 }, 4},
684 {{ 0x01, 0x02, 0x00, 0xc6 }, 4},
686 {{ 0x01, 0x00, 0xff, 0xaf }, 4},
687 {{ 0x01, 0x00, 0x03, 0xa0 }, 4},
689 {{ 0x01, 0x00, 0x73, 0xaf }, 4},
692 dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; /* 0x41 */
694 for (i = 0; i < ARRAY_SIZE(regs); i++)
695 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len);
698 static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe)
700 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
701 struct em28xx *dev = fe->dvb->priv;
702 #ifdef CONFIG_GPIOLIB
703 struct em28xx_dvb *dvb = dev->dvb;
708 flags = GPIOF_OUT_INIT_HIGH; /* enable LNA */
710 flags = GPIOF_OUT_INIT_LOW; /* disable LNA */
712 ret = gpio_request_one(dvb->lna_gpio, flags, NULL);
714 em28xx_errdev("gpio request failed %d\n", ret);
716 gpio_free(dvb->lna_gpio);
720 dev_warn(&dev->udev->dev, "%s: LNA control is disabled (lna=%u)\n",
721 KBUILD_MODNAME, c->lna);
726 static int em28xx_mt352_terratec_xs_init(struct dvb_frontend *fe)
728 /* Values extracted from a USB trace of the Terratec Windows driver */
729 static u8 clock_config[] = { CLOCK_CTL, 0x38, 0x2c };
730 static u8 reset[] = { RESET, 0x80 };
731 static u8 adc_ctl_1_cfg[] = { ADC_CTL_1, 0x40 };
732 static u8 agc_cfg[] = { AGC_TARGET, 0x28, 0xa0 };
733 static u8 input_freq_cfg[] = { INPUT_FREQ_1, 0x31, 0xb8 };
734 static u8 rs_err_cfg[] = { RS_ERR_PER_1, 0x00, 0x4d };
735 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
736 static u8 trl_nom_cfg[] = { TRL_NOMINAL_RATE_1, 0x64, 0x00 };
737 static u8 tps_given_cfg[] = { TPS_GIVEN_1, 0x40, 0x80, 0x50 };
738 static u8 tuner_go[] = { TUNER_GO, 0x01};
740 mt352_write(fe, clock_config, sizeof(clock_config));
742 mt352_write(fe, reset, sizeof(reset));
743 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
744 mt352_write(fe, agc_cfg, sizeof(agc_cfg));
745 mt352_write(fe, input_freq_cfg, sizeof(input_freq_cfg));
746 mt352_write(fe, rs_err_cfg, sizeof(rs_err_cfg));
747 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
748 mt352_write(fe, trl_nom_cfg, sizeof(trl_nom_cfg));
749 mt352_write(fe, tps_given_cfg, sizeof(tps_given_cfg));
750 mt352_write(fe, tuner_go, sizeof(tuner_go));
754 static struct mt352_config terratec_xs_mt352_cfg = {
755 .demod_address = (0x1e >> 1),
758 .demod_init = em28xx_mt352_terratec_xs_init,
761 static struct tda10023_config em28xx_tda10023_config = {
762 .demod_address = 0x0c,
766 static struct cxd2820r_config em28xx_cxd2820r_config = {
767 .i2c_address = (0xd8 >> 1),
768 .ts_mode = CXD2820R_TS_SERIAL,
771 static struct tda18271_config em28xx_cxd2820r_tda18271_config = {
772 .output_opt = TDA18271_OUTPUT_LT_OFF,
773 .gate = TDA18271_GATE_DIGITAL,
776 static const struct tda10071_config em28xx_tda10071_config = {
777 .demod_i2c_addr = 0x55, /* (0xaa >> 1) */
778 .tuner_i2c_addr = 0x14,
780 .ts_mode = TDA10071_TS_SERIAL,
782 .xtal = 40444000, /* 40.444 MHz */
783 .pll_multiplier = 20,
786 static const struct a8293_config em28xx_a8293_config = {
787 .i2c_addr = 0x08, /* (0x10 >> 1) */
790 static struct zl10353_config em28xx_zl10353_no_i2c_gate_dev = {
791 .demod_address = (0x1e >> 1),
792 .disable_i2c_gate_ctrl = 1,
796 static struct qt1010_config em28xx_qt1010_config = {
800 static const struct mb86a20s_config c3tech_duo_mb86a20s_config = {
801 .demod_address = 0x10,
805 static struct tda18271_std_map mb86a20s_tda18271_config = {
806 .dvbt_6 = { .if_freq = 4000, .agc_mode = 3, .std = 4,
807 .if_lvl = 1, .rfagc_top = 0x37, },
810 static struct tda18271_config c3tech_duo_tda18271_config = {
811 .std_map = &mb86a20s_tda18271_config,
812 .gate = TDA18271_GATE_DIGITAL,
813 .small_i2c = TDA18271_03_BYTE_CHUNK_INIT,
816 static const struct m88ds3103_config pctv_461e_m88ds3103_config = {
821 .ts_mode = M88DS3103_TS_PARALLEL_16,
825 /* ------------------------------------------------------------------ */
827 static int em28xx_attach_xc3028(u8 addr, struct em28xx *dev)
829 struct dvb_frontend *fe;
830 struct xc2028_config cfg;
831 struct xc2028_ctrl ctl;
833 memset(&cfg, 0, sizeof(cfg));
834 cfg.i2c_adap = &dev->i2c_adap[dev->def_i2c_bus];
837 memset(&ctl, 0, sizeof(ctl));
838 em28xx_setup_xc3028(dev, &ctl);
841 if (!dev->dvb->fe[0]) {
842 em28xx_errdev("/2: dvb frontend not attached. "
843 "Can't attach xc3028\n");
847 fe = dvb_attach(xc2028_attach, dev->dvb->fe[0], &cfg);
849 em28xx_errdev("/2: xc3028 attach failed\n");
850 dvb_frontend_detach(dev->dvb->fe[0]);
851 dev->dvb->fe[0] = NULL;
855 em28xx_info("%s/2: xc3028 attached\n", dev->name);
860 /* ------------------------------------------------------------------ */
862 static int em28xx_register_dvb(struct em28xx_dvb *dvb, struct module *module,
863 struct em28xx *dev, struct device *device)
867 mutex_init(&dvb->lock);
869 /* register adapter */
870 result = dvb_register_adapter(&dvb->adapter, dev->name, module, device,
873 printk(KERN_WARNING "%s: dvb_register_adapter failed (errno = %d)\n",
878 /* Ensure all frontends negotiate bus access */
879 dvb->fe[0]->ops.ts_bus_ctrl = em28xx_dvb_bus_ctrl;
881 dvb->fe[1]->ops.ts_bus_ctrl = em28xx_dvb_bus_ctrl;
883 dvb->adapter.priv = &dev->i2c_bus[dev->def_i2c_bus];
885 /* register frontend */
886 result = dvb_register_frontend(&dvb->adapter, dvb->fe[0]);
888 printk(KERN_WARNING "%s: dvb_register_frontend failed (errno = %d)\n",
893 /* register 2nd frontend */
895 result = dvb_register_frontend(&dvb->adapter, dvb->fe[1]);
897 printk(KERN_WARNING "%s: 2nd dvb_register_frontend failed (errno = %d)\n",
903 /* register demux stuff */
904 dvb->demux.dmx.capabilities =
905 DMX_TS_FILTERING | DMX_SECTION_FILTERING |
906 DMX_MEMORY_BASED_FILTERING;
907 dvb->demux.priv = dvb;
908 dvb->demux.filternum = 256;
909 dvb->demux.feednum = 256;
910 dvb->demux.start_feed = em28xx_start_feed;
911 dvb->demux.stop_feed = em28xx_stop_feed;
913 result = dvb_dmx_init(&dvb->demux);
915 printk(KERN_WARNING "%s: dvb_dmx_init failed (errno = %d)\n",
920 dvb->dmxdev.filternum = 256;
921 dvb->dmxdev.demux = &dvb->demux.dmx;
922 dvb->dmxdev.capabilities = 0;
923 result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter);
925 printk(KERN_WARNING "%s: dvb_dmxdev_init failed (errno = %d)\n",
930 dvb->fe_hw.source = DMX_FRONTEND_0;
931 result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_hw);
933 printk(KERN_WARNING "%s: add_frontend failed (DMX_FRONTEND_0, errno = %d)\n",
938 dvb->fe_mem.source = DMX_MEMORY_FE;
939 result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_mem);
941 printk(KERN_WARNING "%s: add_frontend failed (DMX_MEMORY_FE, errno = %d)\n",
946 result = dvb->demux.dmx.connect_frontend(&dvb->demux.dmx, &dvb->fe_hw);
948 printk(KERN_WARNING "%s: connect_frontend failed (errno = %d)\n",
953 /* register network adapter */
954 dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx);
958 dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem);
960 dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw);
962 dvb_dmxdev_release(&dvb->dmxdev);
964 dvb_dmx_release(&dvb->demux);
967 dvb_unregister_frontend(dvb->fe[1]);
968 dvb_unregister_frontend(dvb->fe[0]);
971 dvb_frontend_detach(dvb->fe[1]);
973 dvb_frontend_detach(dvb->fe[0]);
974 dvb_unregister_adapter(&dvb->adapter);
979 static void em28xx_unregister_dvb(struct em28xx_dvb *dvb)
981 dvb_net_release(&dvb->net);
982 dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem);
983 dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw);
984 dvb_dmxdev_release(&dvb->dmxdev);
985 dvb_dmx_release(&dvb->demux);
987 dvb_unregister_frontend(dvb->fe[1]);
988 dvb_unregister_frontend(dvb->fe[0]);
989 if (dvb->fe[1] && !dvb->dont_attach_fe1)
990 dvb_frontend_detach(dvb->fe[1]);
991 dvb_frontend_detach(dvb->fe[0]);
992 dvb_unregister_adapter(&dvb->adapter);
995 static int em28xx_dvb_init(struct em28xx *dev)
997 int result = 0, mfe_shared = 0;
998 struct em28xx_dvb *dvb;
1000 if (dev->is_audio_only) {
1001 /* Shouldn't initialize IR for this interface */
1005 if (!dev->board.has_dvb) {
1006 /* This device does not support the extension */
1010 em28xx_info("Binding DVB extension\n");
1012 dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL);
1015 em28xx_info("em28xx_dvb: memory allocation failed\n");
1019 dvb->fe[0] = dvb->fe[1] = NULL;
1021 /* pre-allocate DVB usb transfer buffers */
1022 if (dev->dvb_xfer_bulk) {
1023 result = em28xx_alloc_urbs(dev, EM28XX_DIGITAL_MODE,
1025 EM28XX_DVB_NUM_BUFS,
1027 EM28XX_DVB_BULK_PACKET_MULTIPLIER);
1029 result = em28xx_alloc_urbs(dev, EM28XX_DIGITAL_MODE,
1031 EM28XX_DVB_NUM_BUFS,
1032 dev->dvb_max_pkt_size_isoc,
1033 EM28XX_DVB_NUM_ISOC_PACKETS);
1036 em28xx_errdev("em28xx_dvb: failed to pre-allocate USB transfer buffers for DVB.\n");
1042 mutex_lock(&dev->lock);
1043 em28xx_set_mode(dev, EM28XX_DIGITAL_MODE);
1045 switch (dev->model) {
1046 case EM2874_BOARD_LEADERSHIP_ISDBT:
1047 dvb->fe[0] = dvb_attach(s921_attach,
1048 &sharp_isdbt, &dev->i2c_adap[dev->def_i2c_bus]);
1056 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
1057 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
1058 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
1059 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
1060 dvb->fe[0] = dvb_attach(lgdt330x_attach,
1061 &em2880_lgdt3303_dev,
1062 &dev->i2c_adap[dev->def_i2c_bus]);
1063 if (em28xx_attach_xc3028(0x61, dev) < 0) {
1068 case EM2880_BOARD_KWORLD_DVB_310U:
1069 dvb->fe[0] = dvb_attach(zl10353_attach,
1070 &em28xx_zl10353_with_xc3028,
1071 &dev->i2c_adap[dev->def_i2c_bus]);
1072 if (em28xx_attach_xc3028(0x61, dev) < 0) {
1077 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
1078 case EM2882_BOARD_TERRATEC_HYBRID_XS:
1079 case EM2880_BOARD_EMPIRE_DUAL_TV:
1080 dvb->fe[0] = dvb_attach(zl10353_attach,
1081 &em28xx_zl10353_xc3028_no_i2c_gate,
1082 &dev->i2c_adap[dev->def_i2c_bus]);
1083 if (em28xx_attach_xc3028(0x61, dev) < 0) {
1088 case EM2880_BOARD_TERRATEC_HYBRID_XS:
1089 case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
1090 case EM2881_BOARD_PINNACLE_HYBRID_PRO:
1091 case EM2882_BOARD_DIKOM_DK300:
1092 case EM2882_BOARD_KWORLD_VS_DVBT:
1093 dvb->fe[0] = dvb_attach(zl10353_attach,
1094 &em28xx_zl10353_xc3028_no_i2c_gate,
1095 &dev->i2c_adap[dev->def_i2c_bus]);
1096 if (dvb->fe[0] == NULL) {
1097 /* This board could have either a zl10353 or a mt352.
1098 If the chip id isn't for zl10353, try mt352 */
1099 dvb->fe[0] = dvb_attach(mt352_attach,
1100 &terratec_xs_mt352_cfg,
1101 &dev->i2c_adap[dev->def_i2c_bus]);
1104 if (em28xx_attach_xc3028(0x61, dev) < 0) {
1109 case EM2870_BOARD_KWORLD_355U:
1110 dvb->fe[0] = dvb_attach(zl10353_attach,
1111 &em28xx_zl10353_no_i2c_gate_dev,
1112 &dev->i2c_adap[dev->def_i2c_bus]);
1113 if (dvb->fe[0] != NULL)
1114 dvb_attach(qt1010_attach, dvb->fe[0],
1115 &dev->i2c_adap[dev->def_i2c_bus], &em28xx_qt1010_config);
1117 case EM2883_BOARD_KWORLD_HYBRID_330U:
1118 case EM2882_BOARD_EVGA_INDTUBE:
1119 dvb->fe[0] = dvb_attach(s5h1409_attach,
1120 &em28xx_s5h1409_with_xc3028,
1121 &dev->i2c_adap[dev->def_i2c_bus]);
1122 if (em28xx_attach_xc3028(0x61, dev) < 0) {
1127 case EM2882_BOARD_KWORLD_ATSC_315U:
1128 dvb->fe[0] = dvb_attach(lgdt330x_attach,
1129 &em2880_lgdt3303_dev,
1130 &dev->i2c_adap[dev->def_i2c_bus]);
1131 if (dvb->fe[0] != NULL) {
1132 if (!dvb_attach(simple_tuner_attach, dvb->fe[0],
1133 &dev->i2c_adap[dev->def_i2c_bus], 0x61, TUNER_THOMSON_DTT761X)) {
1139 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
1140 case EM2882_BOARD_PINNACLE_HYBRID_PRO_330E:
1141 dvb->fe[0] = dvb_attach(drxd_attach, &em28xx_drxd, NULL,
1142 &dev->i2c_adap[dev->def_i2c_bus], &dev->udev->dev);
1143 if (em28xx_attach_xc3028(0x61, dev) < 0) {
1148 case EM2870_BOARD_REDDO_DVB_C_USB_BOX:
1149 /* Philips CU1216L NIM (Philips TDA10023 + Infineon TUA6034) */
1150 dvb->fe[0] = dvb_attach(tda10023_attach,
1151 &em28xx_tda10023_config,
1152 &dev->i2c_adap[dev->def_i2c_bus], 0x48);
1154 if (!dvb_attach(simple_tuner_attach, dvb->fe[0],
1155 &dev->i2c_adap[dev->def_i2c_bus], 0x60, TUNER_PHILIPS_CU1216L)) {
1161 case EM2870_BOARD_KWORLD_A340:
1162 dvb->fe[0] = dvb_attach(lgdt3305_attach,
1163 &em2870_lgdt3304_dev,
1164 &dev->i2c_adap[dev->def_i2c_bus]);
1165 if (dvb->fe[0] != NULL)
1166 dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1167 &dev->i2c_adap[dev->def_i2c_bus], &kworld_a340_config);
1169 case EM28174_BOARD_PCTV_290E:
1170 /* set default GPIO0 for LNA, used if GPIOLIB is undefined */
1171 dvb->lna_gpio = CXD2820R_GPIO_E | CXD2820R_GPIO_O |
1173 dvb->fe[0] = dvb_attach(cxd2820r_attach,
1174 &em28xx_cxd2820r_config,
1175 &dev->i2c_adap[dev->def_i2c_bus],
1178 /* FE 0 attach tuner */
1179 if (!dvb_attach(tda18271_attach,
1182 &dev->i2c_adap[dev->def_i2c_bus],
1183 &em28xx_cxd2820r_tda18271_config)) {
1185 dvb_frontend_detach(dvb->fe[0]);
1190 #ifdef CONFIG_GPIOLIB
1191 /* enable LNA for DVB-T, DVB-T2 and DVB-C */
1192 result = gpio_request_one(dvb->lna_gpio,
1193 GPIOF_OUT_INIT_LOW, NULL);
1195 em28xx_errdev("gpio request failed %d\n",
1198 gpio_free(dvb->lna_gpio);
1200 result = 0; /* continue even set LNA fails */
1202 dvb->fe[0]->ops.set_lna = em28xx_pctv_290e_set_lna;
1206 case EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C:
1208 struct xc5000_config cfg;
1209 hauppauge_hvr930c_init(dev);
1211 dvb->fe[0] = dvb_attach(drxk_attach,
1212 &hauppauge_930c_drxk, &dev->i2c_adap[dev->def_i2c_bus]);
1217 /* FIXME: do we need a pll semaphore? */
1218 dvb->fe[0]->sec_priv = dvb;
1219 sema_init(&dvb->pll_mutex, 1);
1220 dvb->gate_ctrl = dvb->fe[0]->ops.i2c_gate_ctrl;
1221 dvb->fe[0]->ops.i2c_gate_ctrl = drxk_gate_ctrl;
1224 memset(&cfg, 0, sizeof(cfg));
1225 cfg.i2c_address = 0x61;
1228 if (dvb->fe[0]->ops.i2c_gate_ctrl)
1229 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1);
1230 if (!dvb_attach(xc5000_attach, dvb->fe[0], &dev->i2c_adap[dev->def_i2c_bus],
1235 if (dvb->fe[0]->ops.i2c_gate_ctrl)
1236 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 0);
1240 case EM2884_BOARD_TERRATEC_H5:
1241 terratec_h5_init(dev);
1243 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_h5_drxk, &dev->i2c_adap[dev->def_i2c_bus]);
1248 /* FIXME: do we need a pll semaphore? */
1249 dvb->fe[0]->sec_priv = dvb;
1250 sema_init(&dvb->pll_mutex, 1);
1251 dvb->gate_ctrl = dvb->fe[0]->ops.i2c_gate_ctrl;
1252 dvb->fe[0]->ops.i2c_gate_ctrl = drxk_gate_ctrl;
1254 /* Attach tda18271 to DVB-C frontend */
1255 if (dvb->fe[0]->ops.i2c_gate_ctrl)
1256 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1);
1257 if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0], &dev->i2c_adap[dev->def_i2c_bus], 0x60)) {
1261 if (dvb->fe[0]->ops.i2c_gate_ctrl)
1262 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 0);
1265 case EM2884_BOARD_C3TECH_DIGITAL_DUO:
1266 dvb->fe[0] = dvb_attach(mb86a20s_attach,
1267 &c3tech_duo_mb86a20s_config,
1268 &dev->i2c_adap[dev->def_i2c_bus]);
1269 if (dvb->fe[0] != NULL)
1270 dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1271 &dev->i2c_adap[dev->def_i2c_bus],
1272 &c3tech_duo_tda18271_config);
1274 case EM28174_BOARD_PCTV_460E:
1276 dvb->fe[0] = dvb_attach(tda10071_attach,
1277 &em28xx_tda10071_config, &dev->i2c_adap[dev->def_i2c_bus]);
1281 dvb_attach(a8293_attach, dvb->fe[0], &dev->i2c_adap[dev->def_i2c_bus],
1282 &em28xx_a8293_config);
1284 case EM2874_BOARD_DELOCK_61959:
1285 case EM2874_BOARD_MAXMEDIA_UB425_TC:
1286 /* attach demodulator */
1287 dvb->fe[0] = dvb_attach(drxk_attach, &maxmedia_ub425_tc_drxk,
1288 &dev->i2c_adap[dev->def_i2c_bus]);
1291 /* disable I2C-gate */
1292 dvb->fe[0]->ops.i2c_gate_ctrl = NULL;
1295 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1296 &dev->i2c_adap[dev->def_i2c_bus],
1297 &em28xx_cxd2820r_tda18271_config)) {
1298 dvb_frontend_detach(dvb->fe[0]);
1304 case EM2884_BOARD_PCTV_510E:
1305 case EM2884_BOARD_PCTV_520E:
1306 pctv_520e_init(dev);
1308 /* attach demodulator */
1309 dvb->fe[0] = dvb_attach(drxk_attach, &pctv_520e_drxk,
1310 &dev->i2c_adap[dev->def_i2c_bus]);
1314 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1315 &dev->i2c_adap[dev->def_i2c_bus],
1316 &em28xx_cxd2820r_tda18271_config)) {
1317 dvb_frontend_detach(dvb->fe[0]);
1323 case EM2884_BOARD_CINERGY_HTC_STICK:
1324 terratec_htc_stick_init(dev);
1326 /* attach demodulator */
1327 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk,
1328 &dev->i2c_adap[dev->def_i2c_bus]);
1334 /* Attach the demodulator. */
1335 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1336 &dev->i2c_adap[dev->def_i2c_bus],
1337 &em28xx_cxd2820r_tda18271_config)) {
1342 case EM2884_BOARD_TERRATEC_HTC_USB_XS:
1343 terratec_htc_usb_xs_init(dev);
1345 /* attach demodulator */
1346 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk,
1347 &dev->i2c_adap[dev->def_i2c_bus]);
1353 /* Attach the demodulator. */
1354 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1355 &dev->i2c_adap[dev->def_i2c_bus],
1356 &em28xx_cxd2820r_tda18271_config)) {
1361 case EM2874_BOARD_KWORLD_UB435Q_V2:
1362 dvb->fe[0] = dvb_attach(lgdt3305_attach,
1363 &em2874_lgdt3305_dev,
1364 &dev->i2c_adap[dev->def_i2c_bus]);
1370 /* Attach the demodulator. */
1371 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1372 &dev->i2c_adap[dev->def_i2c_bus],
1373 &kworld_ub435q_v2_config)) {
1378 case EM28178_BOARD_PCTV_461E:
1380 /* demod I2C adapter */
1381 struct i2c_adapter *i2c_adapter;
1382 struct i2c_board_info info;
1383 struct m88ts2022_config m88ts2022_config = {
1386 memset(&info, 0, sizeof(struct i2c_board_info));
1389 dvb->fe[0] = dvb_attach(m88ds3103_attach,
1390 &pctv_461e_m88ds3103_config,
1391 &dev->i2c_adap[dev->def_i2c_bus],
1393 if (dvb->fe[0] == NULL) {
1399 m88ts2022_config.fe = dvb->fe[0];
1400 strlcpy(info.type, "m88ts2022", I2C_NAME_SIZE);
1402 info.platform_data = &m88ts2022_config;
1403 request_module("m88ts2022");
1404 dvb->i2c_client_tuner = i2c_new_device(i2c_adapter, &info);
1406 /* delegate signal strength measurement to tuner */
1407 dvb->fe[0]->ops.read_signal_strength =
1408 dvb->fe[0]->ops.tuner_ops.get_rf_strength;
1411 if (!dvb_attach(a8293_attach, dvb->fe[0],
1412 &dev->i2c_adap[dev->def_i2c_bus],
1413 &em28xx_a8293_config)) {
1414 dvb_frontend_detach(dvb->fe[0]);
1421 em28xx_errdev("/2: The frontend of your DVB/ATSC card"
1422 " isn't supported yet\n");
1425 if (NULL == dvb->fe[0]) {
1426 em28xx_errdev("/2: frontend initialization failed\n");
1430 /* define general-purpose callback pointer */
1431 dvb->fe[0]->callback = em28xx_tuner_callback;
1433 dvb->fe[1]->callback = em28xx_tuner_callback;
1435 /* register everything */
1436 result = em28xx_register_dvb(dvb, THIS_MODULE, dev, &dev->udev->dev);
1442 dvb->adapter.mfe_shared = mfe_shared;
1444 em28xx_info("DVB extension successfully initialized\n");
1446 em28xx_set_mode(dev, EM28XX_SUSPEND);
1447 mutex_unlock(&dev->lock);
1456 static inline void prevent_sleep(struct dvb_frontend_ops *ops)
1458 ops->set_voltage = NULL;
1460 ops->tuner_ops.sleep = NULL;
1463 static int em28xx_dvb_fini(struct em28xx *dev)
1465 if (dev->is_audio_only) {
1466 /* Shouldn't initialize IR for this interface */
1470 if (!dev->board.has_dvb) {
1471 /* This device does not support the extension */
1476 struct em28xx_dvb *dvb = dev->dvb;
1478 em28xx_uninit_usb_xfer(dev, EM28XX_DIGITAL_MODE);
1480 if (dev->disconnected) {
1481 /* We cannot tell the device to sleep
1482 * once it has been unplugged. */
1484 prevent_sleep(&dvb->fe[0]->ops);
1486 prevent_sleep(&dvb->fe[1]->ops);
1489 i2c_release_client(dvb->i2c_client_tuner);
1490 em28xx_unregister_dvb(dvb);
1498 static struct em28xx_ops dvb_ops = {
1500 .name = "Em28xx dvb Extension",
1501 .init = em28xx_dvb_init,
1502 .fini = em28xx_dvb_fini,
1505 static int __init em28xx_dvb_register(void)
1507 return em28xx_register_extension(&dvb_ops);
1510 static void __exit em28xx_dvb_unregister(void)
1512 em28xx_unregister_extension(&dvb_ops);
1515 module_init(em28xx_dvb_register);
1516 module_exit(em28xx_dvb_unregister);