1 /* Linux driver for devices based on the DiBcom DiB0700 USB bridge
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the Free
5 * Software Foundation, version 2.
7 * Copyright (C) 2005-9 DiBcom, SA et al
11 #include "dib3000mc.h"
18 #include "tuner-xc2028.h"
27 static int force_lna_activation;
28 module_param(force_lna_activation, int, 0644);
29 MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), "
30 "if applicable for the device (default: 0=automatic/off).");
32 struct dib0700_adapter_state {
33 int (*set_param_save) (struct dvb_frontend *, struct dvb_frontend_parameters *);
34 const struct firmware *frontend_firmware;
37 /* Hauppauge Nova-T 500 (aka Bristol)
38 * has a LNA on GPIO0 which is enabled by setting 1 */
39 static struct mt2060_config bristol_mt2060_config[2] = {
49 static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
50 .band_caps = BAND_VHF | BAND_UHF,
51 .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
71 static struct dib3000mc_config bristol_dib3000mc_config[2] = {
72 { .agc = &bristol_dib3000p_mt2060_agc_config,
74 .ln_adc_level = 0x1cc7,
75 .output_mpeg2_in_188_bytes = 1,
77 { .agc = &bristol_dib3000p_mt2060_agc_config,
79 .ln_adc_level = 0x1cc7,
80 .output_mpeg2_in_188_bytes = 1,
84 static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
86 struct dib0700_state *st = adap->dev->priv;
88 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
89 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
90 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
91 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
93 if (force_lna_activation)
94 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
96 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
98 if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {
99 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
103 st->mt2060_if1[adap->id] = 1220;
104 return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
105 (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
108 static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval)
110 struct i2c_msg msg[2] = {
111 { .addr = 0x50, .flags = 0, .buf = &adrs, .len = 1 },
112 { .addr = 0x50, .flags = I2C_M_RD, .buf = pval, .len = 1 },
114 if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO;
118 static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
120 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
121 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
124 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
125 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) {
126 if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;
128 return dvb_attach(mt2060_attach,adap->fe, tun_i2c,&bristol_mt2060_config[adap->id],
129 if1) == NULL ? -ENODEV : 0;
132 /* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
135 static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = {
139 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=1, P_agc_inv_pwm2=1,
140 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
141 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
142 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
177 BAND_VHF | BAND_LBAND,
179 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=1, P_agc_inv_pwm2=1,
180 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
181 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
182 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
219 static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = {
223 (3 << 14) | (1 << 12) | (524 << 0),
228 static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {
229 { .output_mpeg2_in_188_bytes = 1,
230 .hostbus_diversity = 1,
231 .tuner_is_baseband = 1,
233 .agc_config_count = 2,
234 .agc = stk7700d_7000p_mt2266_agc_config,
235 .bw = &stk7700d_mt2266_pll_config,
237 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
238 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
239 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
241 { .output_mpeg2_in_188_bytes = 1,
242 .hostbus_diversity = 1,
243 .tuner_is_baseband = 1,
245 .agc_config_count = 2,
246 .agc = stk7700d_7000p_mt2266_agc_config,
247 .bw = &stk7700d_mt2266_pll_config,
249 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
250 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
251 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
255 static struct mt2266_config stk7700d_mt2266_config[2] = {
256 { .i2c_address = 0x60
258 { .i2c_address = 0x60
262 static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap)
265 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
267 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
268 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
269 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
270 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
272 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
274 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
275 stk7700d_dib7000p_mt2266_config)
277 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
282 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
283 &stk7700d_dib7000p_mt2266_config[adap->id]);
285 return adap->fe == NULL ? -ENODEV : 0;
288 static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap)
291 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
293 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
294 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
295 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
296 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
298 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
300 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
301 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
302 stk7700d_dib7000p_mt2266_config)
304 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
309 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
310 &stk7700d_dib7000p_mt2266_config[adap->id]);
312 return adap->fe == NULL ? -ENODEV : 0;
315 static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap)
317 struct i2c_adapter *tun_i2c;
318 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
319 return dvb_attach(mt2266_attach, adap->fe, tun_i2c,
320 &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;
323 /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
324 static struct dibx000_agc_config xc3028_agc_config = {
325 BAND_VHF | BAND_UHF, /* band_caps */
327 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
328 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
329 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
330 (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
331 (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */
334 21, /* time_stabiliz */
346 39718, /* agc2_max */
355 29, /* agc2_slope1 */
356 29, /* agc2_slope2 */
363 1, /* perform_agc_softsplit */
366 /* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
367 static struct dibx000_bandwidth_config xc3028_bw_config = {
368 60000, 30000, /* internal, sampling */
369 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
370 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc,
372 (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
373 (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
375 30000000, /* xtal_hz */
378 static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
379 .output_mpeg2_in_188_bytes = 1,
380 .tuner_is_baseband = 1,
382 .agc_config_count = 1,
383 .agc = &xc3028_agc_config,
384 .bw = &xc3028_bw_config,
386 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
387 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
388 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
391 static int stk7700ph_xc3028_callback(void *ptr, int component,
392 int command, int arg)
394 struct dvb_usb_adapter *adap = ptr;
397 case XC2028_TUNER_RESET:
398 /* Send the tuner in then out of reset */
399 dib7000p_set_gpio(adap->fe, 8, 0, 0); msleep(10);
400 dib7000p_set_gpio(adap->fe, 8, 0, 1);
402 case XC2028_RESET_CLK:
405 err("%s: unknown command %d, arg %d\n", __func__,
412 static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
413 .fname = XC2028_DEFAULT_FIRMWARE,
415 .demod = XC3028_FE_DIBCOM52,
418 static struct xc2028_config stk7700ph_xc3028_config = {
420 .ctrl = &stk7700ph_xc3028_ctrl,
423 static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
425 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;
427 if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
428 desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))
429 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
431 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
433 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
434 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
435 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
436 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
438 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
440 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
443 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
444 &stk7700ph_dib7700_xc3028_config) != 0) {
445 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
450 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
451 &stk7700ph_dib7700_xc3028_config);
453 return adap->fe == NULL ? -ENODEV : 0;
456 static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
458 struct i2c_adapter *tun_i2c;
460 tun_i2c = dib7000p_get_i2c_master(adap->fe,
461 DIBX000_I2C_INTERFACE_TUNER, 1);
463 stk7700ph_xc3028_config.i2c_adap = tun_i2c;
465 /* FIXME: generalize & move to common area */
466 adap->fe->callback = stk7700ph_xc3028_callback;
468 return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config)
469 == NULL ? -ENODEV : 0;
472 #define DEFAULT_RC_INTERVAL 50
474 static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
476 /* Number of keypresses to ignore before start repeating */
477 #define RC_REPEAT_DELAY 6
480 * This function is used only when firmware is < 1.20 version. Newer
481 * firmwares use bulk mode, with functions implemented at dib0700_core,
482 * at dib0700_rc_urb_completion()
484 static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d)
490 struct dib0700_state *st = d->priv;
492 if (st->fw_version >= 0x10200) {
493 /* For 1.20 firmware , We need to keep the RC polling
494 callback so we can reuse the input device setup in
495 dvb-usb-remote.c. However, the actual work is being done
496 in the bulk URB completion handler. */
500 i = dib0700_ctrl_rd(d, rc_request, 2, key, 4);
502 err("RC Query Failed");
506 /* losing half of KEY_0 events from Philipps rc5 remotes.. */
507 if (key[0] == 0 && key[1] == 0 && key[2] == 0 && key[3] == 0)
510 /* info("%d: %2X %2X %2X %2X",dvb_usb_dib0700_ir_proto,(int)key[3-2],(int)key[3-3],(int)key[3-1],(int)key[3]); */
512 dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */
515 switch (d->props.rc.core.protocol) {
517 /* NEC protocol sends repeat code as 0 0 0 FF */
518 if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&
520 keycode = d->last_event;
522 keycode = key[3-2] << 8 | key[3-3];
523 d->last_event = keycode;
526 rc_keydown(d->rc_dev, keycode, 0);
529 /* RC-5 protocol changes toggle bit on new keypress */
530 keycode = key[3-2] << 8 | key[3-3];
532 rc_keydown(d->rc_dev, keycode, toggle);
539 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
540 static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
543 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
544 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
545 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
546 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
586 static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
589 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
590 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
591 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
592 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
632 static struct dibx000_bandwidth_config stk7700p_pll_config = {
636 (3 << 14) | (1 << 12) | (524 << 0),
642 static struct dib7000m_config stk7700p_dib7000m_config = {
644 .output_mpeg2_in_188_bytes = 1,
647 .agc_config_count = 1,
648 .agc = &stk7700p_7000m_mt2060_agc_config,
649 .bw = &stk7700p_pll_config,
651 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
652 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
653 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
656 static struct dib7000p_config stk7700p_dib7000p_config = {
657 .output_mpeg2_in_188_bytes = 1,
659 .agc_config_count = 1,
660 .agc = &stk7700p_7000p_mt2060_agc_config,
661 .bw = &stk7700p_pll_config,
663 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
664 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
665 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
668 static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
670 struct dib0700_state *st = adap->dev->priv;
671 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
673 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
674 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
676 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
677 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
679 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
680 dib0700_ctrl_clock(adap->dev, 72, 1);
681 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
683 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
685 st->mt2060_if1[0] = 1220;
687 if (dib7000pc_detection(&adap->dev->i2c_adap)) {
688 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
689 st->is_dib7000pc = 1;
691 adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
693 return adap->fe == NULL ? -ENODEV : 0;
696 static struct mt2060_config stk7700p_mt2060_config = {
700 static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
702 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
703 struct dib0700_state *st = adap->dev->priv;
704 struct i2c_adapter *tun_i2c;
707 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
708 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
709 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
711 if (st->is_dib7000pc)
712 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
714 tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
716 return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config,
717 if1) == NULL ? -ENODEV : 0;
720 /* DIB7070 generic */
721 static struct dibx000_agc_config dib7070_agc_config = {
722 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
723 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
724 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
725 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
726 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
763 static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
765 deb_info("reset: %d", onoff);
766 return dib7000p_set_gpio(fe, 8, 0, !onoff);
769 static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
771 deb_info("sleep: %d", onoff);
772 return dib7000p_set_gpio(fe, 9, 0, onoff);
775 static struct dib0070_config dib7070p_dib0070_config[2] = {
777 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
778 .reset = dib7070_tuner_reset,
779 .sleep = dib7070_tuner_sleep,
781 .clock_pad_drive = 4,
784 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
785 .reset = dib7070_tuner_reset,
786 .sleep = dib7070_tuner_sleep,
792 static struct dib0070_config dib7770p_dib0070_config = {
793 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
794 .reset = dib7070_tuner_reset,
795 .sleep = dib7070_tuner_sleep,
797 .clock_pad_drive = 0,
802 static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
804 struct dvb_usb_adapter *adap = fe->dvb->priv;
805 struct dib0700_adapter_state *state = adap->priv;
808 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
810 case BAND_VHF: offset = 950; break;
812 default: offset = 550; break;
814 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
815 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
816 return state->set_param_save(fe, fep);
819 static int dib7770_set_param_override(struct dvb_frontend *fe,
820 struct dvb_frontend_parameters *fep)
822 struct dvb_usb_adapter *adap = fe->dvb->priv;
823 struct dib0700_adapter_state *state = adap->priv;
826 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
829 dib7000p_set_gpio(fe, 0, 0, 1);
834 dib7000p_set_gpio(fe, 0, 0, 0);
838 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
839 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
840 return state->set_param_save(fe, fep);
843 static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
845 struct dib0700_adapter_state *st = adap->priv;
846 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe,
847 DIBX000_I2C_INTERFACE_TUNER, 1);
849 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
850 &dib7770p_dib0070_config) == NULL)
853 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
854 adap->fe->ops.tuner_ops.set_params = dib7770_set_param_override;
858 static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
860 struct dib0700_adapter_state *st = adap->priv;
861 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
864 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
867 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
871 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
872 adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override;
876 static int stk7700p_pid_filter(struct dvb_usb_adapter *adapter, int index,
879 struct dib0700_state *st = adapter->dev->priv;
880 if (st->is_dib7000pc)
881 return dib7000p_pid_filter(adapter->fe, index, pid, onoff);
882 return dib7000m_pid_filter(adapter->fe, index, pid, onoff);
885 static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
887 struct dib0700_state *st = adapter->dev->priv;
888 if (st->is_dib7000pc)
889 return dib7000p_pid_filter_ctrl(adapter->fe, onoff);
890 return dib7000m_pid_filter_ctrl(adapter->fe, onoff);
893 static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
895 return dib7000p_pid_filter(adapter->fe, index, pid, onoff);
898 static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
900 return dib7000p_pid_filter_ctrl(adapter->fe, onoff);
903 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
907 (3 << 14) | (1 << 12) | (524 << 0),
913 static struct dib7000p_config dib7070p_dib7000p_config = {
914 .output_mpeg2_in_188_bytes = 1,
916 .agc_config_count = 1,
917 .agc = &dib7070_agc_config,
918 .bw = &dib7070_bw_config_12_mhz,
919 .tuner_is_baseband = 1,
922 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
923 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
924 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
926 .hostbus_diversity = 1,
930 static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
932 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
933 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
934 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
935 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
937 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
939 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
940 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
941 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
942 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
944 dib0700_ctrl_clock(adap->dev, 72, 1);
947 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
949 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
951 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
952 &dib7070p_dib7000p_config) != 0) {
953 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
958 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
959 &dib7070p_dib7000p_config);
960 return adap->fe == NULL ? -ENODEV : 0;
964 static struct dib7000p_config dib7770p_dib7000p_config = {
965 .output_mpeg2_in_188_bytes = 1,
967 .agc_config_count = 1,
968 .agc = &dib7070_agc_config,
969 .bw = &dib7070_bw_config_12_mhz,
970 .tuner_is_baseband = 1,
973 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
974 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
975 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
977 .hostbus_diversity = 1,
978 .enable_current_mirror = 1,
979 .disable_sample_and_hold = 0,
982 static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap)
984 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
985 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
986 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
987 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
989 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
991 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
992 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
993 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
994 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
996 dib0700_ctrl_clock(adap->dev, 72, 1);
999 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1001 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1003 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1004 &dib7770p_dib7000p_config) != 0) {
1005 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1010 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
1011 &dib7770p_dib7000p_config);
1012 return adap->fe == NULL ? -ENODEV : 0;
1015 /* DIB807x generic */
1016 static struct dibx000_agc_config dib807x_agc_config[2] = {
1019 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1020 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1021 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1022 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1024 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1025 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1026 (0 << 0), /* setup*/
1029 10, /* time_stabiliz*/
1039 65535, /* agc1_max*/
1042 65535, /* agc2_max*/
1048 206, /* agc1_slope1*/
1049 255, /* agc1_slope2*/
1052 88, /* agc2_slope1*/
1053 90, /* agc2_slope2*/
1060 0, /* perform_agc_softsplit*/
1063 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1064 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1065 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1066 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1068 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1069 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1070 (0 << 0), /* setup */
1073 10, /* time_stabiliz*/
1083 65535, /* agc1_max*/
1086 65535, /* agc2_max*/
1092 206, /* agc1_slope1*/
1093 255, /* agc1_slope2*/
1096 88, /* agc2_slope1*/
1097 90, /* agc2_slope2*/
1104 0, /* perform_agc_softsplit*/
1108 static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
1109 60000, 15000, /* internal, sampling*/
1110 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/
1111 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
1113 (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1114 (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1116 12000000, /* xtal_hz*/
1119 static struct dib8000_config dib807x_dib8000_config[2] = {
1121 .output_mpeg2_in_188_bytes = 1,
1123 .agc_config_count = 2,
1124 .agc = dib807x_agc_config,
1125 .pll = &dib807x_bw_config_12_mhz,
1126 .tuner_is_baseband = 1,
1128 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1129 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1130 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1132 .hostbus_diversity = 1,
1134 .agc_control = &dib0070_ctrl_agc_filter,
1135 .output_mode = OUTMODE_MPEG2_FIFO,
1138 .output_mpeg2_in_188_bytes = 1,
1140 .agc_config_count = 2,
1141 .agc = dib807x_agc_config,
1142 .pll = &dib807x_bw_config_12_mhz,
1143 .tuner_is_baseband = 1,
1145 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1146 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1147 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1149 .hostbus_diversity = 1,
1150 .agc_control = &dib0070_ctrl_agc_filter,
1151 .output_mode = OUTMODE_MPEG2_FIFO,
1156 static int dib80xx_tuner_reset(struct dvb_frontend *fe, int onoff)
1158 return dib8000_set_gpio(fe, 5, 0, !onoff);
1161 static int dib80xx_tuner_sleep(struct dvb_frontend *fe, int onoff)
1163 return dib8000_set_gpio(fe, 0, 0, onoff);
1166 static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
1171 static struct dib0070_config dib807x_dib0070_config[2] = {
1173 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1174 .reset = dib80xx_tuner_reset,
1175 .sleep = dib80xx_tuner_sleep,
1177 .clock_pad_drive = 4,
1179 .force_crystal_mode = 1,
1180 .enable_third_order_filter = 1,
1182 .wbd_gain = dib8070_wbd_gain_cfg,
1183 .osc_buffer_state = 0,
1184 .freq_offset_khz_uhf = -100,
1185 .freq_offset_khz_vhf = -100,
1187 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1188 .reset = dib80xx_tuner_reset,
1189 .sleep = dib80xx_tuner_sleep,
1191 .clock_pad_drive = 2,
1193 .force_crystal_mode = 1,
1194 .enable_third_order_filter = 1,
1196 .wbd_gain = dib8070_wbd_gain_cfg,
1197 .osc_buffer_state = 0,
1198 .freq_offset_khz_uhf = -25,
1199 .freq_offset_khz_vhf = -25,
1203 static int dib807x_set_param_override(struct dvb_frontend *fe,
1204 struct dvb_frontend_parameters *fep)
1206 struct dvb_usb_adapter *adap = fe->dvb->priv;
1207 struct dib0700_adapter_state *state = adap->priv;
1209 u16 offset = dib0070_wbd_offset(fe);
1210 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1215 case BAND_UHF: /* fall-thru wanted */
1217 offset += 250; break;
1219 deb_info("WBD for DiB8000: %d\n", offset);
1220 dib8000_set_wbd_ref(fe, offset);
1222 return state->set_param_save(fe, fep);
1225 static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1227 struct dib0700_adapter_state *st = adap->priv;
1228 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe,
1229 DIBX000_I2C_INTERFACE_TUNER, 1);
1231 if (adap->id == 0) {
1232 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1233 &dib807x_dib0070_config[0]) == NULL)
1236 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1237 &dib807x_dib0070_config[1]) == NULL)
1241 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1242 adap->fe->ops.tuner_ops.set_params = dib807x_set_param_override;
1246 static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index,
1249 return dib8000_pid_filter(adapter->fe, index, pid, onoff);
1252 static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter,
1255 return dib8000_pid_filter_ctrl(adapter->fe, onoff);
1259 static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
1261 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1263 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1264 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1265 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1267 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1269 dib0700_ctrl_clock(adap->dev, 72, 1);
1272 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1274 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1276 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1279 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1280 &dib807x_dib8000_config[0]);
1282 return adap->fe == NULL ? -ENODEV : 0;
1286 static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
1288 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1290 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1292 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1293 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1294 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1296 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1298 dib0700_ctrl_clock(adap->dev, 72, 1);
1301 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1303 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1305 /* initialize IC 0 */
1306 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80);
1308 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1309 &dib807x_dib8000_config[0]);
1311 return adap->fe == NULL ? -ENODEV : 0;
1314 static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
1316 /* initialize IC 1 */
1317 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82);
1319 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82,
1320 &dib807x_dib8000_config[1]);
1322 return adap->fe == NULL ? -ENODEV : 0;
1326 struct dibx000_agc_config dib8090_agc_config[2] = {
1328 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
1329 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1330 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1331 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1332 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1333 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1371 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1372 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1373 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1374 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1375 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1413 static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = {
1417 (3 << 14) | (1 << 12) | (599 << 0),
1423 static int dib8090_get_adc_power(struct dvb_frontend *fe)
1425 return dib8000_get_adc_power(fe, 1);
1428 static struct dib8000_config dib809x_dib8000_config[2] = {
1430 .output_mpeg2_in_188_bytes = 1,
1432 .agc_config_count = 2,
1433 .agc = dib8090_agc_config,
1434 .agc_control = dib0090_dcc_freq,
1435 .pll = &dib8090_pll_config_12mhz,
1436 .tuner_is_baseband = 1,
1438 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1439 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1440 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1442 .hostbus_diversity = 1,
1444 .output_mode = OUTMODE_MPEG2_FIFO,
1446 .diversity_delay = 48,
1449 .output_mpeg2_in_188_bytes = 1,
1451 .agc_config_count = 2,
1452 .agc = dib8090_agc_config,
1453 .agc_control = dib0090_dcc_freq,
1454 .pll = &dib8090_pll_config_12mhz,
1455 .tuner_is_baseband = 1,
1457 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1458 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1459 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1461 .hostbus_diversity = 1,
1463 .output_mode = OUTMODE_DIVERSITY,
1465 .diversity_delay = 1,
1470 static struct dib0090_wbd_slope dib8090_wbd_table[] = {
1471 /* max freq ; cold slope ; cold offset ; warm slope ; warm offset ; wbd gain */
1472 { 120, 0, 500, 0, 500, 4 }, /* CBAND */
1473 { 170, 0, 450, 0, 450, 4 }, /* CBAND */
1474 { 380, 48, 373, 28, 259, 6 }, /* VHF */
1475 { 860, 34, 700, 36, 616, 6 }, /* high UHF */
1476 { 0xFFFF, 34, 700, 36, 616, 6 }, /* default */
1479 static struct dib0090_config dib809x_dib0090_config = {
1483 .io.pll_loopdiv = 20,
1484 .io.adc_clock_ratio = 8,
1485 .io.pll_int_loop_filt = 0,
1486 .io.clock_khz = 12000,
1487 .reset = dib80xx_tuner_reset,
1488 .sleep = dib80xx_tuner_sleep,
1491 .i2c_address = DEFAULT_DIB0090_I2C_ADDRESS,
1494 .get_adc_power = dib8090_get_adc_power,
1495 .freq_offset_khz_uhf = -63,
1496 .freq_offset_khz_vhf = -143,
1497 .wbd = dib8090_wbd_table,
1498 .fref_clock_ratio = 6,
1501 static int dib8096_set_param_override(struct dvb_frontend *fe,
1502 struct dvb_frontend_parameters *fep)
1504 struct dvb_usb_adapter *adap = fe->dvb->priv;
1505 struct dib0700_adapter_state *state = adap->priv;
1506 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1509 enum frontend_tune_state tune_state = CT_SHUTDOWN;
1510 u16 ltgain, rf_gain_limit;
1512 ret = state->set_param_save(fe, fep);
1516 target = (dib0090_get_wbd_offset(fe) * 8 * 18 / 33 + 1) / 2;
1517 dib8000_set_wbd_ref(fe, target);
1520 if (band == BAND_CBAND) {
1521 deb_info("tuning in CBAND - soft-AGC startup\n");
1522 dib0090_set_tune_state(fe, CT_AGC_START);
1524 ret = dib0090_gain_control(fe);
1526 tune_state = dib0090_get_tune_state(fe);
1527 if (tune_state == CT_AGC_STEP_0)
1528 dib8000_set_gpio(fe, 6, 0, 1);
1529 else if (tune_state == CT_AGC_STEP_1) {
1530 dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, <gain);
1531 if (rf_gain_limit == 0)
1532 dib8000_set_gpio(fe, 6, 0, 0);
1534 } while (tune_state < CT_AGC_STOP);
1535 dib0090_pwm_gain_reset(fe);
1536 dib8000_pwm_agc_reset(fe);
1537 dib8000_set_tune_state(fe, CT_DEMOD_START);
1539 deb_info("not tuning in CBAND - standard AGC startup\n");
1540 dib0090_pwm_gain_reset(fe);
1546 static int dib809x_tuner_attach(struct dvb_usb_adapter *adap)
1548 struct dib0700_adapter_state *st = adap->priv;
1549 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1551 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1554 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1555 adap->fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1559 static int stk809x_frontend_attach(struct dvb_usb_adapter *adap)
1561 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1563 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1564 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1565 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1567 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1569 dib0700_ctrl_clock(adap->dev, 72, 1);
1572 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1574 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1576 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80);
1578 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
1580 return adap->fe == NULL ? -ENODEV : 0;
1583 static int nim8096md_tuner_attach(struct dvb_usb_adapter *adap)
1585 struct dib0700_adapter_state *st = adap->priv;
1586 struct i2c_adapter *tun_i2c;
1587 struct dvb_frontend *fe_slave = dib8000_get_slave_frontend(adap->fe, 1);
1590 tun_i2c = dib8000_get_i2c_master(fe_slave, DIBX000_I2C_INTERFACE_TUNER, 1);
1591 if (dvb_attach(dib0090_register, fe_slave, tun_i2c, &dib809x_dib0090_config) == NULL)
1593 fe_slave->dvb = adap->fe->dvb;
1594 fe_slave->ops.tuner_ops.set_params = dib8096_set_param_override;
1596 tun_i2c = dib8000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1597 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1600 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1601 adap->fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1606 static int nim8096md_frontend_attach(struct dvb_usb_adapter *adap)
1608 struct dvb_frontend *fe_slave;
1610 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1612 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1614 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1615 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1616 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1618 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1620 dib0700_ctrl_clock(adap->dev, 72, 1);
1623 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1625 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1627 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, 0x80);
1629 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
1630 if (adap->fe == NULL)
1633 fe_slave = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82, &dib809x_dib8000_config[1]);
1634 dib8000_set_slave_frontend(adap->fe, fe_slave);
1636 return fe_slave == NULL ? -ENODEV : 0;
1640 static int dib90x0_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
1642 return dib9000_fw_pid_filter(adapter->fe, index, pid, onoff);
1645 static int dib90x0_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
1647 return dib9000_fw_pid_filter_ctrl(adapter->fe, onoff);
1650 static int dib90x0_tuner_reset(struct dvb_frontend *fe, int onoff)
1652 return dib9000_set_gpio(fe, 5, 0, !onoff);
1655 static int dib90x0_tuner_sleep(struct dvb_frontend *fe, int onoff)
1657 return dib9000_set_gpio(fe, 0, 0, onoff);
1660 static int dib01x0_pmu_update(struct i2c_adapter *i2c, u16 *data, u8 len)
1662 u8 wb[4] = { 0xc >> 8, 0xc & 0xff, 0, 0 };
1664 struct i2c_msg msg[2] = {
1665 {.addr = 0x1e >> 1, .flags = 0, .buf = wb, .len = 2},
1666 {.addr = 0x1e >> 1, .flags = I2C_M_RD, .buf = rb, .len = 2},
1670 dibx000_i2c_set_speed(i2c, 250);
1672 if (i2c_transfer(i2c, msg, 2) != 2)
1675 switch (rb[0] << 8 | rb[1]) {
1677 deb_info("Found DiB0170 rev1: This version of DiB0170 is not supported any longer.\n");
1680 deb_info("Found DiB0170 rev2");
1683 deb_info("Found DiB0190 rev2");
1686 deb_info("DiB01x0 not found");
1690 for (index_data = 0; index_data < len; index_data += 2) {
1691 wb[2] = (data[index_data + 1] >> 8) & 0xff;
1692 wb[3] = (data[index_data + 1]) & 0xff;
1694 if (data[index_data] == 0) {
1695 wb[0] = (data[index_data] >> 8) & 0xff;
1696 wb[1] = (data[index_data]) & 0xff;
1698 if (i2c_transfer(i2c, msg, 2) != 2)
1701 wb[3] |= rb[1] & ~(3 << 4);
1704 wb[0] = (data[index_data] >> 8)&0xff;
1705 wb[1] = (data[index_data])&0xff;
1707 if (i2c_transfer(i2c, &msg[0], 1) != 1)
1713 static struct dib9000_config stk9090m_config = {
1714 .output_mpeg2_in_188_bytes = 1,
1715 .output_mode = OUTMODE_MPEG2_FIFO,
1716 .vcxo_timer = 279620,
1717 .timing_frequency = 20452225,
1718 .demod_clock_khz = 60000,
1719 .xtal_clock_khz = 30000,
1720 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
1724 { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0008 } }, /* GPIO 3 to 1 for VHF */
1725 { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0000 } }, /* GPIO 3 to 0 for UHF */
1730 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
1731 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
1735 static struct dib9000_config nim9090md_config[2] = {
1737 .output_mpeg2_in_188_bytes = 1,
1738 .output_mode = OUTMODE_MPEG2_FIFO,
1739 .vcxo_timer = 279620,
1740 .timing_frequency = 20452225,
1741 .demod_clock_khz = 60000,
1742 .xtal_clock_khz = 30000,
1743 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
1745 .output_mpeg2_in_188_bytes = 1,
1746 .output_mode = OUTMODE_DIVERSITY,
1747 .vcxo_timer = 279620,
1748 .timing_frequency = 20452225,
1749 .demod_clock_khz = 60000,
1750 .xtal_clock_khz = 30000,
1751 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
1755 { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0006 } }, /* GPIO 1 and 2 to 1 for VHF */
1756 { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0000 } }, /* GPIO 1 and 2 to 0 for UHF */
1761 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
1762 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
1767 static struct dib0090_config dib9090_dib0090_config = {
1771 .io.pll_loopdiv = 8,
1772 .io.adc_clock_ratio = 8,
1773 .io.pll_int_loop_filt = 0,
1774 .io.clock_khz = 30000,
1775 .reset = dib90x0_tuner_reset,
1776 .sleep = dib90x0_tuner_sleep,
1781 .freq_offset_khz_uhf = 0,
1782 .freq_offset_khz_vhf = 0,
1785 static struct dib0090_config nim9090md_dib0090_config[2] = {
1790 .io.pll_loopdiv = 8,
1791 .io.adc_clock_ratio = 8,
1792 .io.pll_int_loop_filt = 0,
1793 .io.clock_khz = 30000,
1794 .reset = dib90x0_tuner_reset,
1795 .sleep = dib90x0_tuner_sleep,
1800 .freq_offset_khz_uhf = 0,
1801 .freq_offset_khz_vhf = 0,
1806 .io.pll_loopdiv = 8,
1807 .io.adc_clock_ratio = 8,
1808 .io.pll_int_loop_filt = 0,
1809 .io.clock_khz = 30000,
1810 .reset = dib90x0_tuner_reset,
1811 .sleep = dib90x0_tuner_sleep,
1816 .freq_offset_khz_uhf = 0,
1817 .freq_offset_khz_vhf = 0,
1822 static int stk9090m_frontend_attach(struct dvb_usb_adapter *adap)
1824 struct dib0700_adapter_state *state = adap->priv;
1825 struct dib0700_state *st = adap->dev->priv;
1828 /* Make use of the new i2c functions from FW 1.20 */
1829 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
1830 if (fw_version >= 0x10200)
1831 st->fw_use_new_i2c_api = 1;
1832 dib0700_set_i2c_speed(adap->dev, 340);
1834 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1836 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1837 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1838 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1839 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1841 dib0700_ctrl_clock(adap->dev, 72, 1);
1844 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1846 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1848 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80);
1850 if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {
1851 deb_info("%s: Upload failed. (file not found?)\n", __func__);
1854 deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
1856 stk9090m_config.microcode_B_fe_size = state->frontend_firmware->size;
1857 stk9090m_config.microcode_B_fe_buffer = state->frontend_firmware->data;
1859 adap->fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &stk9090m_config);
1861 return adap->fe == NULL ? -ENODEV : 0;
1864 static int dib9090_tuner_attach(struct dvb_usb_adapter *adap)
1866 struct dib0700_adapter_state *state = adap->priv;
1867 struct i2c_adapter *i2c = dib9000_get_tuner_interface(adap->fe);
1868 u16 data_dib190[10] = {
1876 if (dvb_attach(dib0090_fw_register, adap->fe, i2c, &dib9090_dib0090_config) == NULL)
1878 i2c = dib9000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
1879 if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0)
1881 dib0700_set_i2c_speed(adap->dev, 2000);
1882 if (dib9000_firmware_post_pll_init(adap->fe) < 0)
1884 release_firmware(state->frontend_firmware);
1888 static int nim9090md_frontend_attach(struct dvb_usb_adapter *adap)
1890 struct dib0700_adapter_state *state = adap->priv;
1891 struct dib0700_state *st = adap->dev->priv;
1892 struct i2c_adapter *i2c;
1893 struct dvb_frontend *fe_slave;
1896 /* Make use of the new i2c functions from FW 1.20 */
1897 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
1898 if (fw_version >= 0x10200)
1899 st->fw_use_new_i2c_api = 1;
1900 dib0700_set_i2c_speed(adap->dev, 340);
1902 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1904 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1905 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1906 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1907 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1909 dib0700_ctrl_clock(adap->dev, 72, 1);
1912 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1914 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1916 if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {
1917 deb_info("%s: Upload failed. (file not found?)\n", __func__);
1920 deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
1922 nim9090md_config[0].microcode_B_fe_size = state->frontend_firmware->size;
1923 nim9090md_config[0].microcode_B_fe_buffer = state->frontend_firmware->data;
1924 nim9090md_config[1].microcode_B_fe_size = state->frontend_firmware->size;
1925 nim9090md_config[1].microcode_B_fe_buffer = state->frontend_firmware->data;
1927 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, 0x80);
1928 adap->fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &nim9090md_config[0]);
1930 if (adap->fe == NULL)
1933 i2c = dib9000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_GPIO_3_4, 0);
1934 dib9000_i2c_enumeration(i2c, 1, 0x12, 0x82);
1936 fe_slave = dvb_attach(dib9000_attach, i2c, 0x82, &nim9090md_config[1]);
1937 dib9000_set_slave_frontend(adap->fe, fe_slave);
1939 return fe_slave == NULL ? -ENODEV : 0;
1942 static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap)
1944 struct dib0700_adapter_state *state = adap->priv;
1945 struct i2c_adapter *i2c;
1946 struct dvb_frontend *fe_slave;
1947 u16 data_dib190[10] = {
1954 i2c = dib9000_get_tuner_interface(adap->fe);
1955 if (dvb_attach(dib0090_fw_register, adap->fe, i2c, &nim9090md_dib0090_config[0]) == NULL)
1957 i2c = dib9000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
1958 if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0)
1960 dib0700_set_i2c_speed(adap->dev, 2000);
1961 if (dib9000_firmware_post_pll_init(adap->fe) < 0)
1964 fe_slave = dib9000_get_slave_frontend(adap->fe, 1);
1965 if (fe_slave != NULL) {
1966 i2c = dib9000_get_component_bus_interface(adap->fe);
1967 dib9000_set_i2c_adapter(fe_slave, i2c);
1969 i2c = dib9000_get_tuner_interface(fe_slave);
1970 if (dvb_attach(dib0090_fw_register, fe_slave, i2c, &nim9090md_dib0090_config[1]) == NULL)
1972 fe_slave->dvb = adap->fe->dvb;
1973 dib9000_fw_set_component_bus_speed(adap->fe, 2000);
1974 if (dib9000_firmware_post_pll_init(fe_slave) < 0)
1977 release_firmware(state->frontend_firmware);
1983 struct dib7090p_best_adc {
1989 static int dib7090p_get_best_sampling(struct dvb_frontend *fe , struct dib7090p_best_adc *adc)
1991 u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1;
1994 u32 fcp_min = 1900; /* PLL Minimum Frequency comparator KHz */
1995 u32 fcp_max = 20000; /* PLL Maximum Frequency comparator KHz */
1996 u32 fdem_max = 76000;
1997 u32 fdem_min = 69500;
1998 u32 fcp = 0, fs = 0, fdem = 0;
1999 u32 harmonic_id = 0;
2001 adc->pll_loopdiv = loopdiv;
2002 adc->pll_prediv = prediv;
2005 deb_info("bandwidth = %d fdem_min =%d", fe->dtv_property_cache.bandwidth_hz, fdem_min);
2007 /* Find Min and Max prediv */
2008 while ((xtal/max_prediv) >= fcp_min)
2012 min_prediv = max_prediv;
2013 while ((xtal/min_prediv) <= fcp_max) {
2015 if (min_prediv == 1)
2018 deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv);
2022 for (prediv = min_prediv ; prediv < max_prediv; prediv++) {
2023 fcp = xtal / prediv;
2024 if (fcp > fcp_min && fcp < fcp_max) {
2025 for (loopdiv = 1 ; loopdiv < 64 ; loopdiv++) {
2026 fdem = ((xtal/prediv) * loopdiv);
2028 /* test min/max system restrictions */
2030 if ((fdem >= fdem_min) && (fdem <= fdem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz/1000)) {
2032 /* test fs harmonics positions */
2033 for (harmonic_id = (fe->dtv_property_cache.frequency / (1000*fs)) ; harmonic_id <= ((fe->dtv_property_cache.frequency / (1000*fs))+1) ; harmonic_id++) {
2034 if (((fs*harmonic_id) >= ((fe->dtv_property_cache.frequency/1000) - (fe->dtv_property_cache.bandwidth_hz/2000))) && ((fs*harmonic_id) <= ((fe->dtv_property_cache.frequency/1000) + (fe->dtv_property_cache.bandwidth_hz/2000)))) {
2041 adc->pll_loopdiv = loopdiv;
2042 adc->pll_prediv = prediv;
2043 adc->timf = 2396745143UL/fdem*(1 << 9);
2044 adc->timf += ((2396745143UL%fdem) << 9)/fdem;
2045 deb_info("loopdiv=%i prediv=%i timf=%i", loopdiv, prediv, adc->timf);
2056 if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0)
2062 static int dib7090_agc_startup(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
2064 struct dvb_usb_adapter *adap = fe->dvb->priv;
2065 struct dib0700_adapter_state *state = adap->priv;
2066 struct dibx000_bandwidth_config pll;
2068 struct dib7090p_best_adc adc;
2071 ret = state->set_param_save(fe, fep);
2075 memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));
2076 dib0090_pwm_gain_reset(fe);
2077 target = (dib0090_get_wbd_offset(fe) * 8 + 1) / 2;
2078 dib7000p_set_wbd_ref(fe, target);
2080 if (dib7090p_get_best_sampling(fe, &adc) == 0) {
2081 pll.pll_ratio = adc.pll_loopdiv;
2082 pll.pll_prediv = adc.pll_prediv;
2084 dib7000p_update_pll(fe, &pll);
2085 dib7000p_ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf);
2090 static struct dib0090_wbd_slope dib7090_wbd_table[] = {
2091 { 380, 81, 850, 64, 540, 4},
2092 { 860, 51, 866, 21, 375, 4},
2093 {1700, 0, 250, 0, 100, 6},
2094 {2600, 0, 250, 0, 100, 6},
2095 { 0xFFFF, 0, 0, 0, 0, 0},
2098 struct dibx000_agc_config dib7090_agc_config[2] = {
2100 .band_caps = BAND_UHF,
2101 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
2102 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
2103 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2106 .time_stabiliz = 10,
2137 .perform_agc_softsplit = 0,
2139 .band_caps = BAND_FM | BAND_VHF | BAND_CBAND,
2140 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
2141 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
2142 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2145 .time_stabiliz = 10,
2176 .perform_agc_softsplit = 0,
2180 static struct dibx000_bandwidth_config dib7090_clock_config_12_mhz = {
2184 (3 << 14) | (1 << 12) | (524 << 0),
2190 static struct dib7000p_config nim7090_dib7000p_config = {
2191 .output_mpeg2_in_188_bytes = 1,
2192 .hostbus_diversity = 1,
2193 .tuner_is_baseband = 1,
2196 .agc_config_count = 2,
2197 .agc = dib7090_agc_config,
2199 .bw = &dib7090_clock_config_12_mhz,
2201 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2202 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2203 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2207 .agc_control = dib7090_agc_restart,
2210 .disable_sample_and_hold = 0,
2211 .enable_current_mirror = 0,
2212 .diversity_delay = 0,
2214 .output_mode = OUTMODE_MPEG2_FIFO,
2218 static struct dib7000p_config tfe7090pvr_dib7000p_config[2] = {
2220 .output_mpeg2_in_188_bytes = 1,
2221 .hostbus_diversity = 1,
2222 .tuner_is_baseband = 1,
2225 .agc_config_count = 2,
2226 .agc = dib7090_agc_config,
2228 .bw = &dib7090_clock_config_12_mhz,
2230 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2231 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2232 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2236 .agc_control = dib7090_agc_restart,
2239 .disable_sample_and_hold = 0,
2240 .enable_current_mirror = 0,
2241 .diversity_delay = 0,
2243 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2244 .default_i2c_addr = 0x90,
2247 .output_mpeg2_in_188_bytes = 1,
2248 .hostbus_diversity = 1,
2249 .tuner_is_baseband = 1,
2252 .agc_config_count = 2,
2253 .agc = dib7090_agc_config,
2255 .bw = &dib7090_clock_config_12_mhz,
2257 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2258 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2259 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2263 .agc_control = dib7090_agc_restart,
2266 .disable_sample_and_hold = 0,
2267 .enable_current_mirror = 0,
2268 .diversity_delay = 0,
2270 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2271 .default_i2c_addr = 0x92,
2276 static const struct dib0090_config nim7090_dib0090_config = {
2277 .io.clock_khz = 12000,
2281 .io.pll_loopdiv = 6,
2282 .io.adc_clock_ratio = 0,
2283 .io.pll_int_loop_filt = 0,
2284 .reset = dib7090_tuner_sleep,
2285 .sleep = dib7090_tuner_sleep,
2287 .freq_offset_khz_uhf = 0,
2288 .freq_offset_khz_vhf = 0,
2290 .get_adc_power = dib7090_get_adc_power,
2295 .wbd_vhf_offset = 0,
2296 .wbd_cband_offset = 0,
2300 .fref_clock_ratio = 0,
2302 .wbd = dib7090_wbd_table,
2304 .ls_cfg_pad_drv = 0,
2310 static const struct dib0090_config tfe7090pvr_dib0090_config[2] = {
2312 .io.clock_khz = 12000,
2316 .io.pll_loopdiv = 6,
2317 .io.adc_clock_ratio = 0,
2318 .io.pll_int_loop_filt = 0,
2319 .reset = dib7090_tuner_sleep,
2320 .sleep = dib7090_tuner_sleep,
2322 .freq_offset_khz_uhf = 50,
2323 .freq_offset_khz_vhf = 70,
2325 .get_adc_power = dib7090_get_adc_power,
2330 .wbd_vhf_offset = 0,
2331 .wbd_cband_offset = 0,
2335 .fref_clock_ratio = 0,
2337 .wbd = dib7090_wbd_table,
2339 .ls_cfg_pad_drv = 0,
2344 .io.clock_khz = 12000,
2348 .io.pll_loopdiv = 6,
2349 .io.adc_clock_ratio = 0,
2350 .io.pll_int_loop_filt = 0,
2351 .reset = dib7090_tuner_sleep,
2352 .sleep = dib7090_tuner_sleep,
2354 .freq_offset_khz_uhf = -50,
2355 .freq_offset_khz_vhf = -70,
2357 .get_adc_power = dib7090_get_adc_power,
2362 .wbd_vhf_offset = 0,
2363 .wbd_cband_offset = 0,
2367 .fref_clock_ratio = 0,
2369 .wbd = dib7090_wbd_table,
2371 .ls_cfg_pad_drv = 0,
2378 static int nim7090_frontend_attach(struct dvb_usb_adapter *adap)
2380 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2382 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2383 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2384 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2385 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2388 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2390 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2392 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, &nim7090_dib7000p_config) != 0) {
2393 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
2396 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &nim7090_dib7000p_config);
2398 return adap->fe == NULL ? -ENODEV : 0;
2401 static int nim7090_tuner_attach(struct dvb_usb_adapter *adap)
2403 struct dib0700_adapter_state *st = adap->priv;
2404 struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe);
2406 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &nim7090_dib0090_config) == NULL)
2409 dib7000p_set_gpio(adap->fe, 8, 0, 1);
2411 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
2412 adap->fe->ops.tuner_ops.set_params = dib7090_agc_startup;
2416 static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter *adap)
2418 struct dib0700_state *st = adap->dev->priv;
2420 /* The TFE7090 requires the dib0700 to not be in master mode */
2421 st->disable_streaming_master_mode = 1;
2423 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2425 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2426 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2427 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2428 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2431 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2433 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2435 /* initialize IC 0 */
2436 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, &tfe7090pvr_dib7000p_config[0]) != 0) {
2437 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
2441 dib0700_set_i2c_speed(adap->dev, 340);
2442 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]);
2443 if (adap->fe == NULL)
2446 dib7090_slave_reset(adap->fe);
2451 static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter *adap)
2453 struct i2c_adapter *i2c;
2455 if (adap->dev->adapter[0].fe == NULL) {
2456 err("the master dib7090 has to be initialized first");
2457 return -ENODEV; /* the master device has not been initialized */
2460 i2c = dib7000p_get_i2c_master(adap->dev->adapter[0].fe, DIBX000_I2C_INTERFACE_GPIO_6_7, 1);
2461 if (dib7000p_i2c_enumeration(i2c, 1, 0x10, &tfe7090pvr_dib7000p_config[1]) != 0) {
2462 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
2466 adap->fe = dvb_attach(dib7000p_attach, i2c, 0x92, &tfe7090pvr_dib7000p_config[1]);
2467 dib0700_set_i2c_speed(adap->dev, 200);
2469 return adap->fe == NULL ? -ENODEV : 0;
2472 static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter *adap)
2474 struct dib0700_adapter_state *st = adap->priv;
2475 struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe);
2477 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &tfe7090pvr_dib0090_config[0]) == NULL)
2480 dib7000p_set_gpio(adap->fe, 8, 0, 1);
2482 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
2483 adap->fe->ops.tuner_ops.set_params = dib7090_agc_startup;
2487 static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter *adap)
2489 struct dib0700_adapter_state *st = adap->priv;
2490 struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe);
2492 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &tfe7090pvr_dib0090_config[1]) == NULL)
2495 dib7000p_set_gpio(adap->fe, 8, 0, 1);
2497 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
2498 adap->fe->ops.tuner_ops.set_params = dib7090_agc_startup;
2503 static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
2505 .output_mpeg2_in_188_bytes = 1,
2507 .agc_config_count = 1,
2508 .agc = &dib7070_agc_config,
2509 .bw = &dib7070_bw_config_12_mhz,
2510 .tuner_is_baseband = 1,
2513 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2514 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2515 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2517 .hostbus_diversity = 1,
2519 .output_mpeg2_in_188_bytes = 1,
2521 .agc_config_count = 1,
2522 .agc = &dib7070_agc_config,
2523 .bw = &dib7070_bw_config_12_mhz,
2524 .tuner_is_baseband = 1,
2527 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2528 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2529 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2531 .hostbus_diversity = 1,
2535 static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
2537 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2539 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2540 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2541 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2542 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2544 dib0700_ctrl_clock(adap->dev, 72, 1);
2547 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2549 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2551 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
2552 stk7070pd_dib7000p_config) != 0) {
2553 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
2558 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
2559 return adap->fe == NULL ? -ENODEV : 0;
2562 static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
2564 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
2565 return adap->fe == NULL ? -ENODEV : 0;
2569 static struct s5h1411_config pinnacle_801e_config = {
2570 .output_mode = S5H1411_PARALLEL_OUTPUT,
2571 .gpio = S5H1411_GPIO_OFF,
2572 .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
2573 .qam_if = S5H1411_IF_44000,
2574 .vsb_if = S5H1411_IF_44000,
2575 .inversion = S5H1411_INVERSION_OFF,
2576 .status_mode = S5H1411_DEMODLOCKING
2579 /* Pinnacle PCTV HD Pro 801e GPIOs map:
2580 GPIO0 - currently unknown
2581 GPIO1 - xc5000 tuner reset
2582 GPIO2 - CX25843 sleep
2583 GPIO3 - currently unknown
2584 GPIO4 - currently unknown
2585 GPIO6 - currently unknown
2586 GPIO7 - currently unknown
2587 GPIO9 - currently unknown
2588 GPIO10 - CX25843 reset
2590 static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
2592 struct dib0700_state *st = adap->dev->priv;
2594 /* Make use of the new i2c functions from FW 1.20 */
2595 st->fw_use_new_i2c_api = 1;
2597 /* The s5h1411 requires the dib0700 to not be in master mode */
2598 st->disable_streaming_master_mode = 1;
2600 /* All msleep values taken from Windows USB trace */
2601 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
2602 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
2603 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2605 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2607 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2609 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2610 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2611 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2612 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2613 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
2616 /* Put the CX25843 to sleep for now since we're in digital mode */
2617 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
2619 /* GPIOs are initialized, do the attach */
2620 adap->fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
2621 &adap->dev->i2c_adap);
2622 return adap->fe == NULL ? -ENODEV : 0;
2625 static int dib0700_xc5000_tuner_callback(void *priv, int component,
2626 int command, int arg)
2628 struct dvb_usb_adapter *adap = priv;
2630 if (command == XC5000_TUNER_RESET) {
2631 /* Reset the tuner */
2632 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
2634 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
2637 err("xc5000: unknown tuner callback command: %d\n", command);
2644 static struct xc5000_config s5h1411_xc5000_tunerconfig = {
2645 .i2c_address = 0x64,
2649 static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
2651 /* FIXME: generalize & move to common area */
2652 adap->fe->callback = dib0700_xc5000_tuner_callback;
2654 return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap,
2655 &s5h1411_xc5000_tunerconfig)
2656 == NULL ? -ENODEV : 0;
2659 static int dib0700_xc4000_tuner_callback(void *priv, int component,
2660 int command, int arg)
2662 struct dvb_usb_adapter *adap = priv;
2664 if (command == XC4000_TUNER_RESET) {
2665 /* Reset the tuner */
2666 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
2668 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
2671 err("xc4000: unknown tuner callback command: %d\n", command);
2678 static struct xc4000_config s5h1411_xc4000_tunerconfig = {
2679 .i2c_address = 0x64,
2683 static int xc4000_tuner_attach(struct dvb_usb_adapter *adap)
2685 err("xc4000: xc4000_tuner_attach");
2686 /* FIXME: generalize & move to common area */
2687 adap->fe->callback = dib0700_xc4000_tuner_callback;
2689 return dvb_attach(xc4000_attach, adap->fe, &adap->dev->i2c_adap,
2690 &s5h1411_xc4000_tunerconfig)
2691 == NULL ? -ENODEV : 0;
2694 static struct lgdt3305_config hcw_lgdt3305_config = {
2696 .mpeg_mode = LGDT3305_MPEG_PARALLEL,
2697 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
2698 .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
2700 .spectral_inversion = 1,
2703 .usref_8vsb = 0x0500,
2706 static struct mxl5007t_config hcw_mxl5007t_config = {
2707 .xtal_freq_hz = MxL_XTAL_25_MHZ,
2708 .if_freq_hz = MxL_IF_6_MHZ,
2713 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
2714 GPIO1 - ANT_SEL (H: VPA, L: MCX)
2720 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
2722 static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
2724 struct dib0700_state *st = adap->dev->priv;
2726 /* Make use of the new i2c functions from FW 1.20 */
2727 st->fw_use_new_i2c_api = 1;
2729 st->disable_streaming_master_mode = 1;
2731 /* fe power enable */
2732 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
2734 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2738 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2740 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2742 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2745 adap->fe = dvb_attach(lgdt3305_attach,
2746 &hcw_lgdt3305_config,
2747 &adap->dev->i2c_adap);
2749 return adap->fe == NULL ? -ENODEV : 0;
2752 static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
2754 return dvb_attach(mxl5007t_attach, adap->fe,
2755 &adap->dev->i2c_adap, 0x60,
2756 &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
2760 /* DVB-USB and USB stuff follows */
2761 struct usb_device_id dib0700_usb_id_table[] = {
2762 /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
2763 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
2764 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
2765 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
2766 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
2767 /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
2768 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
2769 { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
2770 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
2771 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
2772 /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
2773 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
2774 { USB_DEVICE(USB_VID_TERRATEC,
2775 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
2776 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
2777 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
2778 /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
2779 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
2780 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
2781 { USB_DEVICE(USB_VID_PINNACLE,
2782 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
2783 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
2784 /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
2785 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
2786 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
2787 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
2788 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
2789 /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
2790 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
2791 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
2792 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
2793 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
2794 /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
2795 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
2796 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
2797 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
2798 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
2799 /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
2800 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
2801 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
2802 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
2803 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
2804 /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
2805 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
2806 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
2807 { USB_DEVICE(USB_VID_TERRATEC,
2808 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
2809 { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
2810 /* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
2811 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
2812 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
2813 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
2814 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
2815 /* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
2816 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
2817 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
2818 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
2819 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
2820 /* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
2821 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
2822 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV73ESE) },
2823 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV282E) },
2824 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
2825 /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
2826 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
2827 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
2828 { USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x000, 0x3f00) },
2829 { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },
2830 /* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
2831 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
2832 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) },
2833 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) },
2834 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090M) },
2835 /* 70 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM8096MD) },
2836 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090MD) },
2837 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM7090) },
2838 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090PVR) },
2839 { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2) },
2840 /* 75 */{ USB_DEVICE(USB_VID_MEDION, USB_PID_CREATIX_CTX1921) },
2841 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E) },
2842 { 0 } /* Terminating entry */
2844 MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
2846 #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
2847 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
2848 .usb_ctrl = DEVICE_SPECIFIC, \
2849 .firmware = "dvb-usb-dib0700-1.20.fw", \
2850 .download_firmware = dib0700_download_firmware, \
2851 .no_reconnect = 1, \
2852 .size_of_priv = sizeof(struct dib0700_state), \
2853 .i2c_algo = &dib0700_i2c_algo, \
2854 .identify_state = dib0700_identify_state
2856 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
2857 .streaming_ctrl = dib0700_streaming_ctrl, \
2864 .buffersize = 39480, \
2869 struct dvb_usb_device_properties dib0700_devices[] = {
2871 DIB0700_DEFAULT_DEVICE_PROPERTIES,
2876 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2877 .pid_filter_count = 32,
2878 .pid_filter = stk7700p_pid_filter,
2879 .pid_filter_ctrl = stk7700p_pid_filter_ctrl,
2880 .frontend_attach = stk7700p_frontend_attach,
2881 .tuner_attach = stk7700p_tuner_attach,
2883 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2887 .num_device_descs = 8,
2889 { "DiBcom STK7700P reference design",
2890 { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
2893 { "Hauppauge Nova-T Stick",
2894 { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
2897 { "AVerMedia AVerTV DVB-T Volar",
2898 { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
2901 { "Compro Videomate U500",
2902 { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
2905 { "Uniwill STK7700P based (Hama and others)",
2906 { &dib0700_usb_id_table[7], NULL },
2909 { "Leadtek Winfast DTV Dongle (STK7700P based)",
2910 { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
2913 { "AVerMedia AVerTV DVB-T Express",
2914 { &dib0700_usb_id_table[20] },
2918 { &dib0700_usb_id_table[21], NULL },
2924 .rc_interval = DEFAULT_RC_INTERVAL,
2925 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
2926 .rc_query = dib0700_rc_query_old_firmware,
2927 .allowed_protos = RC_TYPE_RC5 |
2930 .change_protocol = dib0700_change_protocol,
2932 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2937 .frontend_attach = bristol_frontend_attach,
2938 .tuner_attach = bristol_tuner_attach,
2940 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2942 .frontend_attach = bristol_frontend_attach,
2943 .tuner_attach = bristol_tuner_attach,
2945 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2949 .num_device_descs = 1,
2951 { "Hauppauge Nova-T 500 Dual DVB-T",
2952 { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
2958 .rc_interval = DEFAULT_RC_INTERVAL,
2959 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
2960 .rc_query = dib0700_rc_query_old_firmware,
2961 .allowed_protos = RC_TYPE_RC5 |
2964 .change_protocol = dib0700_change_protocol,
2966 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2971 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2972 .pid_filter_count = 32,
2973 .pid_filter = stk70x0p_pid_filter,
2974 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2975 .frontend_attach = stk7700d_frontend_attach,
2976 .tuner_attach = stk7700d_tuner_attach,
2978 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2980 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2981 .pid_filter_count = 32,
2982 .pid_filter = stk70x0p_pid_filter,
2983 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2984 .frontend_attach = stk7700d_frontend_attach,
2985 .tuner_attach = stk7700d_tuner_attach,
2987 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2991 .num_device_descs = 5,
2993 { "Pinnacle PCTV 2000e",
2994 { &dib0700_usb_id_table[11], NULL },
2997 { "Terratec Cinergy DT XS Diversity",
2998 { &dib0700_usb_id_table[12], NULL },
3001 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
3002 { &dib0700_usb_id_table[13], NULL },
3005 { "DiBcom STK7700D reference design",
3006 { &dib0700_usb_id_table[14], NULL },
3009 { "YUAN High-Tech DiBcom STK7700D",
3010 { &dib0700_usb_id_table[55], NULL },
3017 .rc_interval = DEFAULT_RC_INTERVAL,
3018 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3019 .rc_query = dib0700_rc_query_old_firmware,
3020 .allowed_protos = RC_TYPE_RC5 |
3023 .change_protocol = dib0700_change_protocol,
3025 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3030 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3031 .pid_filter_count = 32,
3032 .pid_filter = stk70x0p_pid_filter,
3033 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3034 .frontend_attach = stk7700P2_frontend_attach,
3035 .tuner_attach = stk7700d_tuner_attach,
3037 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3041 .num_device_descs = 3,
3043 { "ASUS My Cinema U3000 Mini DVBT Tuner",
3044 { &dib0700_usb_id_table[23], NULL },
3048 { &dib0700_usb_id_table[31], NULL },
3051 { "Terratec Cinergy T Express",
3052 { &dib0700_usb_id_table[42], NULL },
3058 .rc_interval = DEFAULT_RC_INTERVAL,
3059 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3060 .module_name = "dib0700",
3061 .rc_query = dib0700_rc_query_old_firmware,
3062 .allowed_protos = RC_TYPE_RC5 |
3065 .change_protocol = dib0700_change_protocol,
3067 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3072 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3073 .pid_filter_count = 32,
3074 .pid_filter = stk70x0p_pid_filter,
3075 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3076 .frontend_attach = stk7070p_frontend_attach,
3077 .tuner_attach = dib7070p_tuner_attach,
3079 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3081 .size_of_priv = sizeof(struct dib0700_adapter_state),
3085 .num_device_descs = 11,
3087 { "DiBcom STK7070P reference design",
3088 { &dib0700_usb_id_table[15], NULL },
3091 { "Pinnacle PCTV DVB-T Flash Stick",
3092 { &dib0700_usb_id_table[16], NULL },
3095 { "Artec T14BR DVB-T",
3096 { &dib0700_usb_id_table[22], NULL },
3099 { "ASUS My Cinema U3100 Mini DVBT Tuner",
3100 { &dib0700_usb_id_table[24], NULL },
3103 { "Hauppauge Nova-T Stick",
3104 { &dib0700_usb_id_table[25], NULL },
3107 { "Hauppauge Nova-T MyTV.t",
3108 { &dib0700_usb_id_table[26], NULL },
3111 { "Pinnacle PCTV 72e",
3112 { &dib0700_usb_id_table[29], NULL },
3115 { "Pinnacle PCTV 73e",
3116 { &dib0700_usb_id_table[30], NULL },
3119 { "Elgato EyeTV DTT",
3120 { &dib0700_usb_id_table[49], NULL },
3124 { &dib0700_usb_id_table[45], NULL },
3127 { "Elgato EyeTV Dtt Dlx PD378S",
3128 { &dib0700_usb_id_table[50], NULL },
3134 .rc_interval = DEFAULT_RC_INTERVAL,
3135 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3136 .module_name = "dib0700",
3137 .rc_query = dib0700_rc_query_old_firmware,
3138 .allowed_protos = RC_TYPE_RC5 |
3141 .change_protocol = dib0700_change_protocol,
3143 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3148 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3149 .pid_filter_count = 32,
3150 .pid_filter = stk70x0p_pid_filter,
3151 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3152 .frontend_attach = stk7070p_frontend_attach,
3153 .tuner_attach = dib7070p_tuner_attach,
3155 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3157 .size_of_priv = sizeof(struct dib0700_adapter_state),
3161 .num_device_descs = 3,
3163 { "Pinnacle PCTV 73A",
3164 { &dib0700_usb_id_table[56], NULL },
3167 { "Pinnacle PCTV 73e SE",
3168 { &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL },
3171 { "Pinnacle PCTV 282e",
3172 { &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL },
3178 .rc_interval = DEFAULT_RC_INTERVAL,
3179 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3180 .module_name = "dib0700",
3181 .rc_query = dib0700_rc_query_old_firmware,
3182 .allowed_protos = RC_TYPE_RC5 |
3185 .change_protocol = dib0700_change_protocol,
3187 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3192 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3193 .pid_filter_count = 32,
3194 .pid_filter = stk70x0p_pid_filter,
3195 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3196 .frontend_attach = stk7070pd_frontend_attach0,
3197 .tuner_attach = dib7070p_tuner_attach,
3199 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3201 .size_of_priv = sizeof(struct dib0700_adapter_state),
3203 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3204 .pid_filter_count = 32,
3205 .pid_filter = stk70x0p_pid_filter,
3206 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3207 .frontend_attach = stk7070pd_frontend_attach1,
3208 .tuner_attach = dib7070p_tuner_attach,
3210 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3212 .size_of_priv = sizeof(struct dib0700_adapter_state),
3216 .num_device_descs = 6,
3218 { "DiBcom STK7070PD reference design",
3219 { &dib0700_usb_id_table[17], NULL },
3222 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
3223 { &dib0700_usb_id_table[18], NULL },
3226 { "Hauppauge Nova-TD Stick (52009)",
3227 { &dib0700_usb_id_table[35], NULL },
3230 { "Hauppauge Nova-TD-500 (84xxx)",
3231 { &dib0700_usb_id_table[36], NULL },
3234 { "Terratec Cinergy DT USB XS Diversity/ T5",
3235 { &dib0700_usb_id_table[43],
3236 &dib0700_usb_id_table[53], NULL},
3240 { &dib0700_usb_id_table[44], NULL },
3246 .rc_interval = DEFAULT_RC_INTERVAL,
3247 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3248 .module_name = "dib0700",
3249 .rc_query = dib0700_rc_query_old_firmware,
3250 .allowed_protos = RC_TYPE_RC5 |
3253 .change_protocol = dib0700_change_protocol,
3255 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3260 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3261 .pid_filter_count = 32,
3262 .pid_filter = stk70x0p_pid_filter,
3263 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3264 .frontend_attach = stk7070pd_frontend_attach0,
3265 .tuner_attach = dib7070p_tuner_attach,
3267 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3269 .size_of_priv = sizeof(struct dib0700_adapter_state),
3271 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3272 .pid_filter_count = 32,
3273 .pid_filter = stk70x0p_pid_filter,
3274 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3275 .frontend_attach = stk7070pd_frontend_attach1,
3276 .tuner_attach = dib7070p_tuner_attach,
3278 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3280 .size_of_priv = sizeof(struct dib0700_adapter_state),
3284 .num_device_descs = 1,
3286 { "Elgato EyeTV Diversity",
3287 { &dib0700_usb_id_table[68], NULL },
3293 .rc_interval = DEFAULT_RC_INTERVAL,
3294 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
3295 .module_name = "dib0700",
3296 .rc_query = dib0700_rc_query_old_firmware,
3297 .allowed_protos = RC_TYPE_RC5 |
3300 .change_protocol = dib0700_change_protocol,
3302 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3307 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3308 .pid_filter_count = 32,
3309 .pid_filter = stk70x0p_pid_filter,
3310 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3311 .frontend_attach = stk7700ph_frontend_attach,
3312 .tuner_attach = stk7700ph_tuner_attach,
3314 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3316 .size_of_priv = sizeof(struct
3317 dib0700_adapter_state),
3321 .num_device_descs = 9,
3323 { "Terratec Cinergy HT USB XE",
3324 { &dib0700_usb_id_table[27], NULL },
3327 { "Pinnacle Expresscard 320cx",
3328 { &dib0700_usb_id_table[28], NULL },
3331 { "Terratec Cinergy HT Express",
3332 { &dib0700_usb_id_table[32], NULL },
3335 { "Gigabyte U8000-RH",
3336 { &dib0700_usb_id_table[37], NULL },
3339 { "YUAN High-Tech STK7700PH",
3340 { &dib0700_usb_id_table[38], NULL },
3343 { "Asus My Cinema-U3000Hybrid",
3344 { &dib0700_usb_id_table[39], NULL },
3347 { "YUAN High-Tech MC770",
3348 { &dib0700_usb_id_table[48], NULL },
3351 { "Leadtek WinFast DTV Dongle H",
3352 { &dib0700_usb_id_table[51], NULL },
3355 { "YUAN High-Tech STK7700D",
3356 { &dib0700_usb_id_table[54], NULL },
3362 .rc_interval = DEFAULT_RC_INTERVAL,
3363 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3364 .module_name = "dib0700",
3365 .rc_query = dib0700_rc_query_old_firmware,
3366 .allowed_protos = RC_TYPE_RC5 |
3369 .change_protocol = dib0700_change_protocol,
3371 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3375 .frontend_attach = s5h1411_frontend_attach,
3376 .tuner_attach = xc5000_tuner_attach,
3378 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3380 .size_of_priv = sizeof(struct
3381 dib0700_adapter_state),
3385 .num_device_descs = 2,
3387 { "Pinnacle PCTV HD Pro USB Stick",
3388 { &dib0700_usb_id_table[40], NULL },
3391 { "Pinnacle PCTV HD USB Stick",
3392 { &dib0700_usb_id_table[41], NULL },
3398 .rc_interval = DEFAULT_RC_INTERVAL,
3399 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3400 .module_name = "dib0700",
3401 .rc_query = dib0700_rc_query_old_firmware,
3402 .allowed_protos = RC_TYPE_RC5 |
3405 .change_protocol = dib0700_change_protocol,
3407 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3411 .frontend_attach = lgdt3305_frontend_attach,
3412 .tuner_attach = mxl5007t_tuner_attach,
3414 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3416 .size_of_priv = sizeof(struct
3417 dib0700_adapter_state),
3421 .num_device_descs = 2,
3423 { "Hauppauge ATSC MiniCard (B200)",
3424 { &dib0700_usb_id_table[46], NULL },
3427 { "Hauppauge ATSC MiniCard (B210)",
3428 { &dib0700_usb_id_table[47], NULL },
3432 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3437 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3438 .pid_filter_count = 32,
3439 .pid_filter = stk70x0p_pid_filter,
3440 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3441 .frontend_attach = stk7770p_frontend_attach,
3442 .tuner_attach = dib7770p_tuner_attach,
3444 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3447 sizeof(struct dib0700_adapter_state),
3451 .num_device_descs = 4,
3453 { "DiBcom STK7770P reference design",
3454 { &dib0700_usb_id_table[59], NULL },
3457 { "Terratec Cinergy T USB XXS (HD)/ T3",
3458 { &dib0700_usb_id_table[33],
3459 &dib0700_usb_id_table[52],
3460 &dib0700_usb_id_table[60], NULL},
3463 { "TechniSat AirStar TeleStick 2",
3464 { &dib0700_usb_id_table[74], NULL },
3467 { "Medion CTX1921 DVB-T USB",
3468 { &dib0700_usb_id_table[75], NULL },
3474 .rc_interval = DEFAULT_RC_INTERVAL,
3475 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3476 .module_name = "dib0700",
3477 .rc_query = dib0700_rc_query_old_firmware,
3478 .allowed_protos = RC_TYPE_RC5 |
3481 .change_protocol = dib0700_change_protocol,
3483 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3487 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3488 .pid_filter_count = 32,
3489 .pid_filter = stk80xx_pid_filter,
3490 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
3491 .frontend_attach = stk807x_frontend_attach,
3492 .tuner_attach = dib807x_tuner_attach,
3494 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3497 sizeof(struct dib0700_adapter_state),
3501 .num_device_descs = 3,
3503 { "DiBcom STK807xP reference design",
3504 { &dib0700_usb_id_table[62], NULL },
3507 { "Prolink Pixelview SBTVD",
3508 { &dib0700_usb_id_table[63], NULL },
3511 { "EvolutePC TVWay+",
3512 { &dib0700_usb_id_table[64], NULL },
3518 .rc_interval = DEFAULT_RC_INTERVAL,
3519 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
3520 .module_name = "dib0700",
3521 .rc_query = dib0700_rc_query_old_firmware,
3522 .allowed_protos = RC_TYPE_RC5 |
3525 .change_protocol = dib0700_change_protocol,
3527 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3531 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3532 .pid_filter_count = 32,
3533 .pid_filter = stk80xx_pid_filter,
3534 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
3535 .frontend_attach = stk807xpvr_frontend_attach0,
3536 .tuner_attach = dib807x_tuner_attach,
3538 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3541 sizeof(struct dib0700_adapter_state),
3544 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3545 .pid_filter_count = 32,
3546 .pid_filter = stk80xx_pid_filter,
3547 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
3548 .frontend_attach = stk807xpvr_frontend_attach1,
3549 .tuner_attach = dib807x_tuner_attach,
3551 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3554 sizeof(struct dib0700_adapter_state),
3558 .num_device_descs = 1,
3560 { "DiBcom STK807xPVR reference design",
3561 { &dib0700_usb_id_table[61], NULL },
3567 .rc_interval = DEFAULT_RC_INTERVAL,
3568 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3569 .module_name = "dib0700",
3570 .rc_query = dib0700_rc_query_old_firmware,
3571 .allowed_protos = RC_TYPE_RC5 |
3574 .change_protocol = dib0700_change_protocol,
3576 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3580 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3581 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3582 .pid_filter_count = 32,
3583 .pid_filter = stk80xx_pid_filter,
3584 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
3585 .frontend_attach = stk809x_frontend_attach,
3586 .tuner_attach = dib809x_tuner_attach,
3588 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3591 sizeof(struct dib0700_adapter_state),
3595 .num_device_descs = 1,
3597 { "DiBcom STK8096GP reference design",
3598 { &dib0700_usb_id_table[67], NULL },
3604 .rc_interval = DEFAULT_RC_INTERVAL,
3605 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3606 .module_name = "dib0700",
3607 .rc_query = dib0700_rc_query_old_firmware,
3608 .allowed_protos = RC_TYPE_RC5 |
3611 .change_protocol = dib0700_change_protocol,
3613 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3617 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3618 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3619 .pid_filter_count = 32,
3620 .pid_filter = dib90x0_pid_filter,
3621 .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
3622 .frontend_attach = stk9090m_frontend_attach,
3623 .tuner_attach = dib9090_tuner_attach,
3625 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3628 sizeof(struct dib0700_adapter_state),
3632 .num_device_descs = 1,
3634 { "DiBcom STK9090M reference design",
3635 { &dib0700_usb_id_table[69], NULL },
3641 .rc_interval = DEFAULT_RC_INTERVAL,
3642 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3643 .module_name = "dib0700",
3644 .rc_query = dib0700_rc_query_old_firmware,
3645 .allowed_protos = RC_TYPE_RC5 |
3648 .change_protocol = dib0700_change_protocol,
3650 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3654 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3655 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3656 .pid_filter_count = 32,
3657 .pid_filter = stk80xx_pid_filter,
3658 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
3659 .frontend_attach = nim8096md_frontend_attach,
3660 .tuner_attach = nim8096md_tuner_attach,
3662 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3665 sizeof(struct dib0700_adapter_state),
3669 .num_device_descs = 1,
3671 { "DiBcom NIM8096MD reference design",
3672 { &dib0700_usb_id_table[70], NULL },
3678 .rc_interval = DEFAULT_RC_INTERVAL,
3679 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3680 .module_name = "dib0700",
3681 .rc_query = dib0700_rc_query_old_firmware,
3682 .allowed_protos = RC_TYPE_RC5 |
3685 .change_protocol = dib0700_change_protocol,
3687 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3691 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3692 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3693 .pid_filter_count = 32,
3694 .pid_filter = dib90x0_pid_filter,
3695 .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
3696 .frontend_attach = nim9090md_frontend_attach,
3697 .tuner_attach = nim9090md_tuner_attach,
3699 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3702 sizeof(struct dib0700_adapter_state),
3706 .num_device_descs = 1,
3708 { "DiBcom NIM9090MD reference design",
3709 { &dib0700_usb_id_table[71], NULL },
3715 .rc_interval = DEFAULT_RC_INTERVAL,
3716 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3717 .module_name = "dib0700",
3718 .rc_query = dib0700_rc_query_old_firmware,
3719 .allowed_protos = RC_TYPE_RC5 |
3722 .change_protocol = dib0700_change_protocol,
3724 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3728 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3729 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3730 .pid_filter_count = 32,
3731 .pid_filter = stk70x0p_pid_filter,
3732 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3733 .frontend_attach = nim7090_frontend_attach,
3734 .tuner_attach = nim7090_tuner_attach,
3736 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3739 sizeof(struct dib0700_adapter_state),
3743 .num_device_descs = 1,
3745 { "DiBcom NIM7090 reference design",
3746 { &dib0700_usb_id_table[72], NULL },
3752 .rc_interval = DEFAULT_RC_INTERVAL,
3753 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3754 .module_name = "dib0700",
3755 .rc_query = dib0700_rc_query_old_firmware,
3756 .allowed_protos = RC_TYPE_RC5 |
3759 .change_protocol = dib0700_change_protocol,
3761 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3765 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3766 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3767 .pid_filter_count = 32,
3768 .pid_filter = stk70x0p_pid_filter,
3769 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3770 .frontend_attach = tfe7090pvr_frontend0_attach,
3771 .tuner_attach = tfe7090pvr_tuner0_attach,
3773 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3776 sizeof(struct dib0700_adapter_state),
3779 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3780 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3781 .pid_filter_count = 32,
3782 .pid_filter = stk70x0p_pid_filter,
3783 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3784 .frontend_attach = tfe7090pvr_frontend1_attach,
3785 .tuner_attach = tfe7090pvr_tuner1_attach,
3787 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3790 sizeof(struct dib0700_adapter_state),
3794 .num_device_descs = 1,
3796 { "DiBcom TFE7090PVR reference design",
3797 { &dib0700_usb_id_table[73], NULL },
3803 .rc_interval = DEFAULT_RC_INTERVAL,
3804 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3805 .module_name = "dib0700",
3806 .rc_query = dib0700_rc_query_old_firmware,
3807 .allowed_protos = RC_TYPE_RC5 |
3810 .change_protocol = dib0700_change_protocol,
3812 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3816 .frontend_attach = stk7700ph_frontend_attach,
3817 .tuner_attach = xc4000_tuner_attach,
3819 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3821 .size_of_priv = sizeof(struct
3822 dib0700_adapter_state),
3826 .num_device_descs = 1,
3828 { "Pinnacle PCTV 340e HD Pro USB Stick",
3829 { &dib0700_usb_id_table[76], NULL },
3834 .rc_interval = DEFAULT_RC_INTERVAL,
3835 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3836 .module_name = "dib0700",
3837 .rc_query = dib0700_rc_query_old_firmware,
3838 .allowed_protos = RC_TYPE_RC5 |
3841 .change_protocol = dib0700_change_protocol,
3846 int dib0700_device_count = ARRAY_SIZE(dib0700_devices);