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"
30 static int force_lna_activation;
31 module_param(force_lna_activation, int, 0644);
32 MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), if applicable for the device (default: 0=automatic/off).");
34 struct dib0700_adapter_state {
35 int (*set_param_save) (struct dvb_frontend *);
36 const struct firmware *frontend_firmware;
37 struct dib7000p_ops dib7000p_ops;
38 struct dib8000_ops dib8000_ops;
41 /* Hauppauge Nova-T 500 (aka Bristol)
42 * has a LNA on GPIO0 which is enabled by setting 1 */
43 static struct mt2060_config bristol_mt2060_config[2] = {
53 static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
54 .band_caps = BAND_VHF | BAND_UHF,
55 .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
75 static struct dib3000mc_config bristol_dib3000mc_config[2] = {
76 { .agc = &bristol_dib3000p_mt2060_agc_config,
78 .ln_adc_level = 0x1cc7,
79 .output_mpeg2_in_188_bytes = 1,
81 { .agc = &bristol_dib3000p_mt2060_agc_config,
83 .ln_adc_level = 0x1cc7,
84 .output_mpeg2_in_188_bytes = 1,
88 static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
90 struct dib0700_state *st = adap->dev->priv;
92 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
93 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
94 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
95 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
97 if (force_lna_activation)
98 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
100 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
102 if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {
103 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
107 st->mt2060_if1[adap->id] = 1220;
108 return (adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
109 (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
112 static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval)
114 struct i2c_msg msg[2] = {
115 { .addr = 0x50, .flags = 0, .buf = &adrs, .len = 1 },
116 { .addr = 0x50, .flags = I2C_M_RD, .buf = pval, .len = 1 },
118 if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO;
122 static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
124 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
125 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe_adap[0].fe, 1);
128 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
129 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) {
130 if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;
132 return dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c,
133 &bristol_mt2060_config[adap->id], if1) == NULL ?
137 /* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
140 static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = {
144 /* 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,
145 * 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 */
146 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
147 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
182 BAND_VHF | BAND_LBAND,
184 /* 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,
185 * 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 */
186 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
187 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
224 static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = {
237 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
242 static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {
243 { .output_mpeg2_in_188_bytes = 1,
244 .hostbus_diversity = 1,
245 .tuner_is_baseband = 1,
247 .agc_config_count = 2,
248 .agc = stk7700d_7000p_mt2266_agc_config,
249 .bw = &stk7700d_mt2266_pll_config,
251 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
252 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
253 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
255 { .output_mpeg2_in_188_bytes = 1,
256 .hostbus_diversity = 1,
257 .tuner_is_baseband = 1,
259 .agc_config_count = 2,
260 .agc = stk7700d_7000p_mt2266_agc_config,
261 .bw = &stk7700d_mt2266_pll_config,
263 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
264 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
265 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
269 static struct mt2266_config stk7700d_mt2266_config[2] = {
270 { .i2c_address = 0x60
272 { .i2c_address = 0x60
276 static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap)
278 struct dib0700_adapter_state *state = adap->priv;
280 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
284 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
286 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
287 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
288 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
289 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
291 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
293 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
294 stk7700d_dib7000p_mt2266_config)
296 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
297 dvb_detach(state->dib7000p_ops.set_wbd_ref);
302 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap,
303 0x80 + (adap->id << 1),
304 &stk7700d_dib7000p_mt2266_config[adap->id]);
306 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
309 static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap)
311 struct dib0700_adapter_state *state = adap->priv;
313 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
317 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
319 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
320 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
321 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
322 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
324 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
326 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
327 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
328 stk7700d_dib7000p_mt2266_config)
330 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
331 dvb_detach(state->dib7000p_ops.set_wbd_ref);
336 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap,
337 0x80 + (adap->id << 1),
338 &stk7700d_dib7000p_mt2266_config[adap->id]);
340 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
343 static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap)
345 struct i2c_adapter *tun_i2c;
346 struct dib0700_adapter_state *state = adap->priv;
348 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
349 DIBX000_I2C_INTERFACE_TUNER, 1);
350 return dvb_attach(mt2266_attach, adap->fe_adap[0].fe, tun_i2c,
351 &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;
354 /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
355 static struct dibx000_agc_config xc3028_agc_config = {
356 .band_caps = BAND_VHF | BAND_UHF,
357 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
358 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
359 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
360 .setup = (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
386 .perform_agc_softsplit = 1,
389 /* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
390 static struct dibx000_bandwidth_config xc3028_bw_config = {
403 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
404 .ifreq = (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
409 static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
410 .output_mpeg2_in_188_bytes = 1,
411 .tuner_is_baseband = 1,
413 .agc_config_count = 1,
414 .agc = &xc3028_agc_config,
415 .bw = &xc3028_bw_config,
417 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
418 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
419 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
422 static int stk7700ph_xc3028_callback(void *ptr, int component,
423 int command, int arg)
425 struct dvb_usb_adapter *adap = ptr;
426 struct dib0700_adapter_state *state = adap->priv;
429 case XC2028_TUNER_RESET:
430 /* Send the tuner in then out of reset */
431 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 0);
433 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
435 case XC2028_RESET_CLK:
436 case XC2028_I2C_FLUSH:
439 err("%s: unknown command %d, arg %d\n", __func__,
446 static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
447 .fname = "/*(DEBLOBBED)*/",
449 .demod = XC3028_FE_DIBCOM52,
452 static struct xc2028_config stk7700ph_xc3028_config = {
454 .ctrl = &stk7700ph_xc3028_ctrl,
457 static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
459 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;
460 struct dib0700_adapter_state *state = adap->priv;
462 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
465 if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
466 desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))
467 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
469 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
471 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
472 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
473 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
474 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
476 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
478 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
481 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
482 &stk7700ph_dib7700_xc3028_config) != 0) {
483 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
485 dvb_detach(state->dib7000p_ops.set_wbd_ref);
489 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80,
490 &stk7700ph_dib7700_xc3028_config);
492 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
495 static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
497 struct i2c_adapter *tun_i2c;
498 struct dib0700_adapter_state *state = adap->priv;
500 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
501 DIBX000_I2C_INTERFACE_TUNER, 1);
503 stk7700ph_xc3028_config.i2c_adap = tun_i2c;
505 /* FIXME: generalize & move to common area */
506 adap->fe_adap[0].fe->callback = stk7700ph_xc3028_callback;
508 return dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &stk7700ph_xc3028_config)
509 == NULL ? -ENODEV : 0;
512 #define DEFAULT_RC_INTERVAL 50
515 * This function is used only when firmware is < 1.20 version. Newer
516 * firmwares use bulk mode, with functions implemented at dib0700_core,
517 * at dib0700_rc_urb_completion()
519 static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d)
521 enum rc_proto protocol;
525 struct dib0700_state *st = d->priv;
527 if (st->fw_version >= 0x10200) {
528 /* For 1.20 firmware , We need to keep the RC polling
529 callback so we can reuse the input device setup in
530 dvb-usb-remote.c. However, the actual work is being done
531 in the bulk URB completion handler. */
535 st->buf[0] = REQUEST_POLL_RC;
538 i = dib0700_ctrl_rd(d, st->buf, 2, st->buf, 4);
540 err("RC Query Failed");
544 /* losing half of KEY_0 events from Philipps rc5 remotes.. */
545 if (st->buf[0] == 0 && st->buf[1] == 0
546 && st->buf[2] == 0 && st->buf[3] == 0)
549 /* info("%d: %2X %2X %2X %2X",dvb_usb_dib0700_ir_proto,(int)st->buf[3 - 2],(int)st->buf[3 - 3],(int)st->buf[3 - 1],(int)st->buf[3]); */
551 dib0700_rc_setup(d, NULL); /* reset ir sensor data to prevent false events */
553 switch (d->props.rc.core.protocol) {
554 case RC_PROTO_BIT_NEC:
555 /* NEC protocol sends repeat code as 0 0 0 FF */
556 if ((st->buf[3 - 2] == 0x00) && (st->buf[3 - 3] == 0x00) &&
557 (st->buf[3] == 0xff)) {
558 rc_repeat(d->rc_dev);
562 protocol = RC_PROTO_NEC;
563 scancode = RC_SCANCODE_NEC(st->buf[3 - 2], st->buf[3 - 3]);
568 /* RC-5 protocol changes toggle bit on new keypress */
569 protocol = RC_PROTO_RC5;
570 scancode = RC_SCANCODE_RC5(st->buf[3 - 2], st->buf[3 - 3]);
571 toggle = st->buf[3 - 1];
575 rc_keydown(d->rc_dev, protocol, scancode, toggle);
579 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
580 static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
583 /* 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,
584 * 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 */
585 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
586 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
626 static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
627 .band_caps = BAND_UHF | BAND_VHF,
628 /* 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,
629 * 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 */
630 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
656 .perform_agc_softsplit = 0,
659 static struct dibx000_bandwidth_config stk7700p_pll_config = {
672 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
678 static struct dib7000m_config stk7700p_dib7000m_config = {
680 .output_mpeg2_in_188_bytes = 1,
683 .agc_config_count = 1,
684 .agc = &stk7700p_7000m_mt2060_agc_config,
685 .bw = &stk7700p_pll_config,
687 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
688 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
689 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
692 static struct dib7000p_config stk7700p_dib7000p_config = {
693 .output_mpeg2_in_188_bytes = 1,
695 .agc_config_count = 1,
696 .agc = &stk7700p_7000p_mt2060_agc_config,
697 .bw = &stk7700p_pll_config,
699 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
700 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
701 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
704 static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
706 struct dib0700_state *st = adap->dev->priv;
707 struct dib0700_adapter_state *state = adap->priv;
709 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
712 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
714 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
715 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
717 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
718 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
720 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
721 dib0700_ctrl_clock(adap->dev, 72, 1);
722 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
724 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
726 st->mt2060_if1[0] = 1220;
728 if (state->dib7000p_ops.dib7000pc_detection(&adap->dev->i2c_adap)) {
729 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
730 st->is_dib7000pc = 1;
732 memset(&state->dib7000p_ops, 0, sizeof(state->dib7000p_ops));
733 adap->fe_adap[0].fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
736 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
739 static struct mt2060_config stk7700p_mt2060_config = {
743 static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
745 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
746 struct dib0700_state *st = adap->dev->priv;
747 struct i2c_adapter *tun_i2c;
748 struct dib0700_adapter_state *state = adap->priv;
752 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
753 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
754 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
756 if (st->is_dib7000pc)
757 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
759 tun_i2c = dib7000m_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
761 return dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, &stk7700p_mt2060_config,
762 if1) == NULL ? -ENODEV : 0;
765 /* DIB7070 generic */
766 static struct dibx000_agc_config dib7070_agc_config = {
767 .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
768 /* 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,
769 * 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 */
770 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
796 .perform_agc_softsplit = 0,
799 static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
801 struct dvb_usb_adapter *adap = fe->dvb->priv;
802 struct dib0700_adapter_state *state = adap->priv;
804 deb_info("reset: %d", onoff);
805 return state->dib7000p_ops.set_gpio(fe, 8, 0, !onoff);
808 static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
810 struct dvb_usb_adapter *adap = fe->dvb->priv;
811 struct dib0700_adapter_state *state = adap->priv;
813 deb_info("sleep: %d", onoff);
814 return state->dib7000p_ops.set_gpio(fe, 9, 0, onoff);
817 static struct dib0070_config dib7070p_dib0070_config[2] = {
819 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
820 .reset = dib7070_tuner_reset,
821 .sleep = dib7070_tuner_sleep,
823 .clock_pad_drive = 4,
826 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
827 .reset = dib7070_tuner_reset,
828 .sleep = dib7070_tuner_sleep,
834 static struct dib0070_config dib7770p_dib0070_config = {
835 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
836 .reset = dib7070_tuner_reset,
837 .sleep = dib7070_tuner_sleep,
839 .clock_pad_drive = 0,
844 static int dib7070_set_param_override(struct dvb_frontend *fe)
846 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
847 struct dvb_usb_adapter *adap = fe->dvb->priv;
848 struct dib0700_adapter_state *state = adap->priv;
851 u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
853 case BAND_VHF: offset = 950; break;
855 default: offset = 550; break;
857 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
858 state->dib7000p_ops.set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
859 return state->set_param_save(fe);
862 static int dib7770_set_param_override(struct dvb_frontend *fe)
864 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
865 struct dvb_usb_adapter *adap = fe->dvb->priv;
866 struct dib0700_adapter_state *state = adap->priv;
869 u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
872 state->dib7000p_ops.set_gpio(fe, 0, 0, 1);
877 state->dib7000p_ops.set_gpio(fe, 0, 0, 0);
881 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
882 state->dib7000p_ops.set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
883 return state->set_param_save(fe);
886 static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
888 struct dib0700_adapter_state *st = adap->priv;
889 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
890 DIBX000_I2C_INTERFACE_TUNER, 1);
892 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
893 &dib7770p_dib0070_config) == NULL)
896 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
897 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7770_set_param_override;
901 static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
903 struct dib0700_adapter_state *st = adap->priv;
904 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
907 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
910 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
914 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
915 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override;
919 static int stk7700p_pid_filter(struct dvb_usb_adapter *adapter, int index,
922 struct dib0700_adapter_state *state = adapter->priv;
923 struct dib0700_state *st = adapter->dev->priv;
925 if (st->is_dib7000pc)
926 return state->dib7000p_ops.pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
927 return dib7000m_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
930 static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
932 struct dib0700_state *st = adapter->dev->priv;
933 struct dib0700_adapter_state *state = adapter->priv;
934 if (st->is_dib7000pc)
935 return state->dib7000p_ops.pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
936 return dib7000m_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
939 static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
941 struct dib0700_adapter_state *state = adapter->priv;
942 return state->dib7000p_ops.pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
945 static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
947 struct dib0700_adapter_state *state = adapter->priv;
948 return state->dib7000p_ops.pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
951 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
964 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
965 .ifreq = (0 << 25) | 0,
970 static struct dib7000p_config dib7070p_dib7000p_config = {
971 .output_mpeg2_in_188_bytes = 1,
973 .agc_config_count = 1,
974 .agc = &dib7070_agc_config,
975 .bw = &dib7070_bw_config_12_mhz,
976 .tuner_is_baseband = 1,
979 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
980 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
981 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
983 .hostbus_diversity = 1,
987 static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
989 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
990 struct dib0700_adapter_state *state = adap->priv;
992 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
995 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
996 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
997 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
999 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1001 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1002 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1003 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1004 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1006 dib0700_ctrl_clock(adap->dev, 72, 1);
1009 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1011 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1013 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1014 &dib7070p_dib7000p_config) != 0) {
1015 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
1017 dvb_detach(state->dib7000p_ops.set_wbd_ref);
1021 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80,
1022 &dib7070p_dib7000p_config);
1023 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1027 static struct dib7000p_config dib7770p_dib7000p_config = {
1028 .output_mpeg2_in_188_bytes = 1,
1030 .agc_config_count = 1,
1031 .agc = &dib7070_agc_config,
1032 .bw = &dib7070_bw_config_12_mhz,
1033 .tuner_is_baseband = 1,
1036 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1037 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1038 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1040 .hostbus_diversity = 1,
1041 .enable_current_mirror = 1,
1042 .disable_sample_and_hold = 0,
1045 static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap)
1047 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
1048 struct dib0700_adapter_state *state = adap->priv;
1050 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
1053 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
1054 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
1055 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1057 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1059 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1060 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1061 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1062 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1064 dib0700_ctrl_clock(adap->dev, 72, 1);
1067 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1069 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1071 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1072 &dib7770p_dib7000p_config) != 0) {
1073 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
1075 dvb_detach(state->dib7000p_ops.set_wbd_ref);
1079 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80,
1080 &dib7770p_dib7000p_config);
1081 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1084 /* DIB807x generic */
1085 static struct dibx000_agc_config dib807x_agc_config[2] = {
1088 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1089 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1090 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1091 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1093 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1094 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1095 (0 << 0), /* setup*/
1098 10, /* time_stabiliz*/
1108 65535, /* agc1_max*/
1111 65535, /* agc2_max*/
1117 206, /* agc1_slope1*/
1118 255, /* agc1_slope2*/
1121 88, /* agc2_slope1*/
1122 90, /* agc2_slope2*/
1129 0, /* perform_agc_softsplit*/
1132 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1133 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1134 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1135 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1137 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1138 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1139 (0 << 0), /* setup */
1142 10, /* time_stabiliz*/
1152 65535, /* agc1_max*/
1155 65535, /* agc2_max*/
1161 206, /* agc1_slope1*/
1162 255, /* agc1_slope2*/
1165 88, /* agc2_slope1*/
1166 90, /* agc2_slope2*/
1173 0, /* perform_agc_softsplit*/
1177 static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
1187 .IO_CLK_en_core = 1,
1190 .sad_cfg = (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1191 .ifreq = (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1193 .xtal_hz = 12000000,
1196 static struct dib8000_config dib807x_dib8000_config[2] = {
1198 .output_mpeg2_in_188_bytes = 1,
1200 .agc_config_count = 2,
1201 .agc = dib807x_agc_config,
1202 .pll = &dib807x_bw_config_12_mhz,
1203 .tuner_is_baseband = 1,
1205 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1206 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1207 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1209 .hostbus_diversity = 1,
1211 .agc_control = &dib0070_ctrl_agc_filter,
1212 .output_mode = OUTMODE_MPEG2_FIFO,
1215 .output_mpeg2_in_188_bytes = 1,
1217 .agc_config_count = 2,
1218 .agc = dib807x_agc_config,
1219 .pll = &dib807x_bw_config_12_mhz,
1220 .tuner_is_baseband = 1,
1222 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1223 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1224 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1226 .hostbus_diversity = 1,
1227 .agc_control = &dib0070_ctrl_agc_filter,
1228 .output_mode = OUTMODE_MPEG2_FIFO,
1233 static int dib80xx_tuner_reset(struct dvb_frontend *fe, int onoff)
1235 struct dvb_usb_adapter *adap = fe->dvb->priv;
1236 struct dib0700_adapter_state *state = adap->priv;
1238 return state->dib8000_ops.set_gpio(fe, 5, 0, !onoff);
1241 static int dib80xx_tuner_sleep(struct dvb_frontend *fe, int onoff)
1243 struct dvb_usb_adapter *adap = fe->dvb->priv;
1244 struct dib0700_adapter_state *state = adap->priv;
1246 return state->dib8000_ops.set_gpio(fe, 0, 0, onoff);
1249 static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
1254 static struct dib0070_config dib807x_dib0070_config[2] = {
1256 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1257 .reset = dib80xx_tuner_reset,
1258 .sleep = dib80xx_tuner_sleep,
1260 .clock_pad_drive = 4,
1262 .force_crystal_mode = 1,
1263 .enable_third_order_filter = 1,
1265 .wbd_gain = dib8070_wbd_gain_cfg,
1266 .osc_buffer_state = 0,
1267 .freq_offset_khz_uhf = -100,
1268 .freq_offset_khz_vhf = -100,
1270 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1271 .reset = dib80xx_tuner_reset,
1272 .sleep = dib80xx_tuner_sleep,
1274 .clock_pad_drive = 2,
1276 .force_crystal_mode = 1,
1277 .enable_third_order_filter = 1,
1279 .wbd_gain = dib8070_wbd_gain_cfg,
1280 .osc_buffer_state = 0,
1281 .freq_offset_khz_uhf = -25,
1282 .freq_offset_khz_vhf = -25,
1286 static int dib807x_set_param_override(struct dvb_frontend *fe)
1288 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1289 struct dvb_usb_adapter *adap = fe->dvb->priv;
1290 struct dib0700_adapter_state *state = adap->priv;
1292 u16 offset = dib0070_wbd_offset(fe);
1293 u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
1298 case BAND_UHF: /* fall-thru wanted */
1300 offset += 250; break;
1302 deb_info("WBD for DiB8000: %d\n", offset);
1303 state->dib8000_ops.set_wbd_ref(fe, offset);
1305 return state->set_param_save(fe);
1308 static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1310 struct dib0700_adapter_state *st = adap->priv;
1311 struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe,
1312 DIBX000_I2C_INTERFACE_TUNER, 1);
1314 if (adap->id == 0) {
1315 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
1316 &dib807x_dib0070_config[0]) == NULL)
1319 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
1320 &dib807x_dib0070_config[1]) == NULL)
1324 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1325 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib807x_set_param_override;
1329 static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index,
1332 struct dib0700_adapter_state *state = adapter->priv;
1334 return state->dib8000_ops.pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
1337 static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter,
1340 struct dib0700_adapter_state *state = adapter->priv;
1342 return state->dib8000_ops.pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
1346 static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
1348 struct dib0700_adapter_state *state = adap->priv;
1350 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1353 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1355 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1356 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1357 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1359 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1361 dib0700_ctrl_clock(adap->dev, 72, 1);
1364 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1366 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1368 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1371 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80,
1372 &dib807x_dib8000_config[0]);
1374 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1378 static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
1380 struct dib0700_adapter_state *state = adap->priv;
1382 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1385 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1387 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1389 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1390 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1391 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1393 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1395 dib0700_ctrl_clock(adap->dev, 72, 1);
1398 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1400 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1402 /* initialize IC 0 */
1403 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80, 0);
1405 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80,
1406 &dib807x_dib8000_config[0]);
1408 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1411 static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
1413 struct dib0700_adapter_state *state = adap->priv;
1415 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1418 /* initialize IC 1 */
1419 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82, 0);
1421 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x82,
1422 &dib807x_dib8000_config[1]);
1424 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1428 static struct dibx000_agc_config dib8090_agc_config[2] = {
1430 .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
1431 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1432 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1433 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1434 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1435 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1438 .time_stabiliz = 10,
1469 .perform_agc_softsplit = 0,
1472 .band_caps = BAND_CBAND,
1473 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1474 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1475 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1476 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1477 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1480 .time_stabiliz = 10,
1511 .perform_agc_softsplit = 0,
1515 static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = {
1527 .IO_CLK_en_core = 1,
1531 .sad_cfg = (3 << 14) | (1 << 12) | (599 << 0),
1533 .ifreq = (0 << 25) | 0,
1536 .xtal_hz = 12000000,
1539 static int dib8090_get_adc_power(struct dvb_frontend *fe)
1541 struct dvb_usb_adapter *adap = fe->dvb->priv;
1542 struct dib0700_adapter_state *state = adap->priv;
1544 return state->dib8000_ops.get_adc_power(fe, 1);
1547 static void dib8090_agc_control(struct dvb_frontend *fe, u8 restart)
1549 deb_info("AGC control callback: %i\n", restart);
1550 dib0090_dcc_freq(fe, restart);
1552 if (restart == 0) /* before AGC startup */
1553 dib0090_set_dc_servo(fe, 1);
1556 static struct dib8000_config dib809x_dib8000_config[2] = {
1558 .output_mpeg2_in_188_bytes = 1,
1560 .agc_config_count = 2,
1561 .agc = dib8090_agc_config,
1562 .agc_control = dib8090_agc_control,
1563 .pll = &dib8090_pll_config_12mhz,
1564 .tuner_is_baseband = 1,
1566 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1567 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1568 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1570 .hostbus_diversity = 1,
1572 .output_mode = OUTMODE_MPEG2_FIFO,
1574 .diversity_delay = 48,
1577 .output_mpeg2_in_188_bytes = 1,
1579 .agc_config_count = 2,
1580 .agc = dib8090_agc_config,
1581 .agc_control = dib8090_agc_control,
1582 .pll = &dib8090_pll_config_12mhz,
1583 .tuner_is_baseband = 1,
1585 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1586 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1587 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1589 .hostbus_diversity = 1,
1591 .output_mode = OUTMODE_DIVERSITY,
1593 .diversity_delay = 1,
1598 static struct dib0090_wbd_slope dib8090_wbd_table[] = {
1599 /* max freq ; cold slope ; cold offset ; warm slope ; warm offset ; wbd gain */
1600 { 120, 0, 500, 0, 500, 4 }, /* CBAND */
1601 { 170, 0, 450, 0, 450, 4 }, /* CBAND */
1602 { 380, 48, 373, 28, 259, 6 }, /* VHF */
1603 { 860, 34, 700, 36, 616, 6 }, /* high UHF */
1604 { 0xFFFF, 34, 700, 36, 616, 6 }, /* default */
1607 static struct dib0090_config dib809x_dib0090_config = {
1611 .io.pll_loopdiv = 20,
1612 .io.adc_clock_ratio = 8,
1613 .io.pll_int_loop_filt = 0,
1614 .io.clock_khz = 12000,
1615 .reset = dib80xx_tuner_reset,
1616 .sleep = dib80xx_tuner_sleep,
1619 .i2c_address = DEFAULT_DIB0090_I2C_ADDRESS,
1622 .get_adc_power = dib8090_get_adc_power,
1623 .freq_offset_khz_uhf = -63,
1624 .freq_offset_khz_vhf = -143,
1625 .wbd = dib8090_wbd_table,
1626 .fref_clock_ratio = 6,
1629 static u8 dib8090_compute_pll_parameters(struct dvb_frontend *fe)
1631 u8 optimal_pll_ratio = 20;
1632 u32 freq_adc, ratio, rest, max = 0;
1635 for (pll_ratio = 17; pll_ratio <= 20; pll_ratio++) {
1636 freq_adc = 12 * pll_ratio * (1 << 8) / 16;
1637 ratio = ((fe->dtv_property_cache.frequency / 1000) * (1 << 8) / 1000) / freq_adc;
1638 rest = ((fe->dtv_property_cache.frequency / 1000) * (1 << 8) / 1000) - ratio * freq_adc;
1640 if (rest > freq_adc / 2)
1641 rest = freq_adc - rest;
1642 deb_info("PLL ratio=%i rest=%i\n", pll_ratio, rest);
1643 if ((rest > max) && (rest > 717)) {
1644 optimal_pll_ratio = pll_ratio;
1648 deb_info("optimal PLL ratio=%i\n", optimal_pll_ratio);
1650 return optimal_pll_ratio;
1653 static int dib8096_set_param_override(struct dvb_frontend *fe)
1655 struct dvb_usb_adapter *adap = fe->dvb->priv;
1656 struct dib0700_adapter_state *state = adap->priv;
1657 u8 pll_ratio, band = BAND_OF_FREQUENCY(fe->dtv_property_cache.frequency / 1000);
1658 u16 target, ltgain, rf_gain_limit;
1661 enum frontend_tune_state tune_state = CT_SHUTDOWN;
1665 deb_info("Warning : Rf frequency (%iHz) is not in the supported range, using VHF switch ", fe->dtv_property_cache.frequency);
1668 state->dib8000_ops.set_gpio(fe, 3, 0, 1);
1671 state->dib8000_ops.set_gpio(fe, 3, 0, 0);
1675 ret = state->set_param_save(fe);
1679 if (fe->dtv_property_cache.bandwidth_hz != 6000000) {
1680 deb_info("only 6MHz bandwidth is supported\n");
1684 /* Update PLL if needed ratio */
1685 state->dib8000_ops.update_pll(fe, &dib8090_pll_config_12mhz, fe->dtv_property_cache.bandwidth_hz / 1000, 0);
1687 /* Get optimize PLL ratio to remove spurious */
1688 pll_ratio = dib8090_compute_pll_parameters(fe);
1689 if (pll_ratio == 17)
1691 else if (pll_ratio == 18)
1693 else if (pll_ratio == 19)
1699 state->dib8000_ops.update_pll(fe, &dib8090_pll_config_12mhz, fe->dtv_property_cache.bandwidth_hz / 1000, pll_ratio);
1701 state->dib8000_ops.ctrl_timf(fe, DEMOD_TIMF_SET, timf);
1703 if (band != BAND_CBAND) {
1704 /* dib0090_get_wbd_target is returning any possible temperature compensated wbd-target */
1705 target = (dib0090_get_wbd_target(fe) * 8 * 18 / 33 + 1) / 2;
1706 state->dib8000_ops.set_wbd_ref(fe, target);
1709 if (band == BAND_CBAND) {
1710 deb_info("tuning in CBAND - soft-AGC startup\n");
1711 dib0090_set_tune_state(fe, CT_AGC_START);
1714 ret = dib0090_gain_control(fe);
1716 tune_state = dib0090_get_tune_state(fe);
1717 if (tune_state == CT_AGC_STEP_0)
1718 state->dib8000_ops.set_gpio(fe, 6, 0, 1);
1719 else if (tune_state == CT_AGC_STEP_1) {
1720 dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, <gain);
1721 if (rf_gain_limit < 2000) /* activate the external attenuator in case of very high input power */
1722 state->dib8000_ops.set_gpio(fe, 6, 0, 0);
1724 } while (tune_state < CT_AGC_STOP);
1726 deb_info("switching to PWM AGC\n");
1727 dib0090_pwm_gain_reset(fe);
1728 state->dib8000_ops.pwm_agc_reset(fe);
1729 state->dib8000_ops.set_tune_state(fe, CT_DEMOD_START);
1731 /* for everything else than CBAND we are using standard AGC */
1732 deb_info("not tuning in CBAND - standard AGC startup\n");
1733 dib0090_pwm_gain_reset(fe);
1739 static int dib809x_tuner_attach(struct dvb_usb_adapter *adap)
1741 struct dib0700_adapter_state *st = adap->priv;
1742 struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1744 if (adap->id == 0) {
1745 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1748 /* FIXME: check if it is fe_adap[1] */
1749 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1753 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1754 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1758 static int stk809x_frontend_attach(struct dvb_usb_adapter *adap)
1760 struct dib0700_adapter_state *state = adap->priv;
1762 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1765 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1767 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1768 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1769 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1771 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1773 dib0700_ctrl_clock(adap->dev, 72, 1);
1776 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1778 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1780 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80, 0);
1782 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
1784 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1787 static int stk809x_frontend1_attach(struct dvb_usb_adapter *adap)
1789 struct dib0700_adapter_state *state = adap->priv;
1791 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1794 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x82, 0);
1796 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x82, &dib809x_dib8000_config[1]);
1798 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1801 static int nim8096md_tuner_attach(struct dvb_usb_adapter *adap)
1803 struct dib0700_adapter_state *st = adap->priv;
1804 struct i2c_adapter *tun_i2c;
1805 struct dvb_frontend *fe_slave = st->dib8000_ops.get_slave_frontend(adap->fe_adap[0].fe, 1);
1808 tun_i2c = st->dib8000_ops.get_i2c_master(fe_slave, DIBX000_I2C_INTERFACE_TUNER, 1);
1809 if (dvb_attach(dib0090_register, fe_slave, tun_i2c, &dib809x_dib0090_config) == NULL)
1811 fe_slave->dvb = adap->fe_adap[0].fe->dvb;
1812 fe_slave->ops.tuner_ops.set_params = dib8096_set_param_override;
1814 tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1815 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1818 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1819 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1824 static int nim8096md_frontend_attach(struct dvb_usb_adapter *adap)
1826 struct dvb_frontend *fe_slave;
1827 struct dib0700_adapter_state *state = adap->priv;
1829 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1832 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
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);
1840 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1842 dib0700_ctrl_clock(adap->dev, 72, 1);
1845 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1847 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1849 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 2, 18, 0x80, 0);
1851 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
1852 if (adap->fe_adap[0].fe == NULL)
1855 /* Needed to increment refcount */
1856 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1859 fe_slave = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x82, &dib809x_dib8000_config[1]);
1860 state->dib8000_ops.set_slave_frontend(adap->fe_adap[0].fe, fe_slave);
1862 return fe_slave == NULL ? -ENODEV : 0;
1866 static struct dibx000_agc_config dib8096p_agc_config[2] = {
1868 .band_caps = BAND_UHF,
1869 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1870 P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1871 P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1872 P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1874 .setup = (0 << 15) | (0 << 14) | (5 << 11)
1875 | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5)
1876 | (0 << 4) | (5 << 1) | (0 << 0),
1879 .time_stabiliz = 10,
1910 .perform_agc_softsplit = 0,
1912 .band_caps = BAND_FM | BAND_VHF | BAND_CBAND,
1913 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1914 P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1915 P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1916 P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1918 .setup = (0 << 15) | (0 << 14) | (5 << 11)
1919 | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5)
1920 | (0 << 4) | (5 << 1) | (0 << 0),
1923 .time_stabiliz = 10,
1954 .perform_agc_softsplit = 0,
1958 static struct dibx000_bandwidth_config dib8096p_clock_config_12_mhz = {
1968 .IO_CLK_en_core = 0,
1971 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
1972 .ifreq = (0 << 25) | 0,
1974 .xtal_hz = 12000000,
1977 static struct dib8000_config tfe8096p_dib8000_config = {
1978 .output_mpeg2_in_188_bytes = 1,
1979 .hostbus_diversity = 1,
1982 .agc_config_count = 2,
1983 .agc = dib8096p_agc_config,
1984 .pll = &dib8096p_clock_config_12_mhz,
1986 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1987 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1988 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1990 .agc_control = NULL,
1991 .diversity_delay = 48,
1992 .output_mode = OUTMODE_MPEG2_FIFO,
1996 static struct dib0090_wbd_slope dib8096p_wbd_table[] = {
1997 { 380, 81, 850, 64, 540, 4},
1998 { 860, 51, 866, 21, 375, 4},
1999 {1700, 0, 250, 0, 100, 6},
2000 {2600, 0, 250, 0, 100, 6},
2001 { 0xFFFF, 0, 0, 0, 0, 0},
2004 static struct dib0090_config tfe8096p_dib0090_config = {
2005 .io.clock_khz = 12000,
2009 .io.pll_loopdiv = 6,
2010 .io.adc_clock_ratio = 0,
2011 .io.pll_int_loop_filt = 0,
2013 .freq_offset_khz_uhf = -143,
2014 .freq_offset_khz_vhf = -143,
2016 .get_adc_power = dib8090_get_adc_power,
2021 .wbd_vhf_offset = 0,
2022 .wbd_cband_offset = 0,
2026 .fref_clock_ratio = 1,
2028 .ls_cfg_pad_drv = 0,
2032 .force_cband_input = 0,
2035 struct dibx090p_adc {
2036 u32 freq; /* RF freq MHz */
2037 u32 timf; /* New Timf */
2038 u32 pll_loopdiv; /* New prediv */
2039 u32 pll_prediv; /* New loopdiv */
2042 struct dibx090p_best_adc {
2048 static int dib8096p_get_best_sampling(struct dvb_frontend *fe, struct dibx090p_best_adc *adc)
2050 u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1;
2052 u16 fcp_min = 1900; /* PLL, Minimum Frequency of phase comparator (KHz) */
2053 u16 fcp_max = 20000; /* PLL, Maximum Frequency of phase comparator (KHz) */
2054 u32 fmem_max = 140000; /* 140MHz max SDRAM freq */
2055 u32 fdem_min = 66000;
2056 u32 fcp = 0, fs = 0, fdem = 0, fmem = 0;
2057 u32 harmonic_id = 0;
2060 adc->pll_loopdiv = loopdiv;
2061 adc->pll_prediv = prediv;
2063 deb_info("bandwidth = %d", fe->dtv_property_cache.bandwidth_hz);
2065 /* Find Min and Max prediv */
2066 while ((xtal / max_prediv) >= fcp_min)
2070 min_prediv = max_prediv;
2071 while ((xtal / min_prediv) <= fcp_max) {
2073 if (min_prediv == 1)
2076 deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv);
2080 for (prediv = min_prediv; prediv < max_prediv; prediv++) {
2081 fcp = xtal / prediv;
2082 if (fcp > fcp_min && fcp < fcp_max) {
2083 for (loopdiv = 1; loopdiv < 64; loopdiv++) {
2084 fmem = ((xtal/prediv) * loopdiv);
2088 /* test min/max system restrictions */
2089 if ((fdem >= fdem_min) && (fmem <= fmem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz / 1000)) {
2091 /* test fs harmonics positions */
2092 for (harmonic_id = (fe->dtv_property_cache.frequency / (1000 * fs)); harmonic_id <= ((fe->dtv_property_cache.frequency / (1000 * fs)) + 1); harmonic_id++) {
2093 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)))) {
2100 adc->pll_loopdiv = loopdiv;
2101 adc->pll_prediv = prediv;
2102 adc->timf = (4260880253U / fdem) * (1 << 8);
2103 adc->timf += ((4260880253U % fdem) << 8) / fdem;
2105 deb_info("RF %6d; BW %6d; Xtal %6d; Fmem %6d; Fdem %6d; Fs %6d; Prediv %2d; Loopdiv %2d; Timf %8d;", fe->dtv_property_cache.frequency, fe->dtv_property_cache.bandwidth_hz, xtal, fmem, fdem, fs, prediv, loopdiv, adc->timf);
2115 if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0)
2120 static int dib8096p_agc_startup(struct dvb_frontend *fe)
2122 struct dvb_usb_adapter *adap = fe->dvb->priv;
2123 struct dib0700_adapter_state *state = adap->priv;
2124 struct dibx000_bandwidth_config pll;
2125 struct dibx090p_best_adc adc;
2129 ret = state->set_param_save(fe);
2132 memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));
2134 dib0090_pwm_gain_reset(fe);
2135 /* dib0090_get_wbd_target is returning any possible
2136 temperature compensated wbd-target */
2137 target = (dib0090_get_wbd_target(fe) * 8 + 1) / 2;
2138 state->dib8000_ops.set_wbd_ref(fe, target);
2140 if (dib8096p_get_best_sampling(fe, &adc) == 0) {
2141 pll.pll_ratio = adc.pll_loopdiv;
2142 pll.pll_prediv = adc.pll_prediv;
2144 dib0700_set_i2c_speed(adap->dev, 200);
2145 state->dib8000_ops.update_pll(fe, &pll, fe->dtv_property_cache.bandwidth_hz / 1000, 0);
2146 state->dib8000_ops.ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf);
2147 dib0700_set_i2c_speed(adap->dev, 1000);
2152 static int tfe8096p_frontend_attach(struct dvb_usb_adapter *adap)
2154 struct dib0700_state *st = adap->dev->priv;
2156 struct dib0700_adapter_state *state = adap->priv;
2158 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
2161 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
2162 if (fw_version >= 0x10200)
2163 st->fw_use_new_i2c_api = 1;
2165 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2167 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2168 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2169 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2171 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2173 dib0700_ctrl_clock(adap->dev, 72, 1);
2176 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2178 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2180 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80, 1);
2182 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap,
2183 0x80, &tfe8096p_dib8000_config);
2185 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
2188 static int tfe8096p_tuner_attach(struct dvb_usb_adapter *adap)
2190 struct dib0700_adapter_state *st = adap->priv;
2191 struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_tuner(adap->fe_adap[0].fe);
2193 tfe8096p_dib0090_config.reset = st->dib8000_ops.tuner_sleep;
2194 tfe8096p_dib0090_config.sleep = st->dib8000_ops.tuner_sleep;
2195 tfe8096p_dib0090_config.wbd = dib8096p_wbd_table;
2197 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c,
2198 &tfe8096p_dib0090_config) == NULL)
2201 st->dib8000_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
2203 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
2204 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096p_agc_startup;
2209 static int dib90x0_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
2211 return dib9000_fw_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
2214 static int dib90x0_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
2216 return dib9000_fw_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
2219 static int dib90x0_tuner_reset(struct dvb_frontend *fe, int onoff)
2221 return dib9000_set_gpio(fe, 5, 0, !onoff);
2224 static int dib90x0_tuner_sleep(struct dvb_frontend *fe, int onoff)
2226 return dib9000_set_gpio(fe, 0, 0, onoff);
2229 static int dib01x0_pmu_update(struct i2c_adapter *i2c, u16 *data, u8 len)
2231 u8 wb[4] = { 0xc >> 8, 0xc & 0xff, 0, 0 };
2233 struct i2c_msg msg[2] = {
2234 {.addr = 0x1e >> 1, .flags = 0, .buf = wb, .len = 2},
2235 {.addr = 0x1e >> 1, .flags = I2C_M_RD, .buf = rb, .len = 2},
2239 dibx000_i2c_set_speed(i2c, 250);
2241 if (i2c_transfer(i2c, msg, 2) != 2)
2244 switch (rb[0] << 8 | rb[1]) {
2246 deb_info("Found DiB0170 rev1: This version of DiB0170 is not supported any longer.\n");
2249 deb_info("Found DiB0170 rev2");
2252 deb_info("Found DiB0190 rev2");
2255 deb_info("DiB01x0 not found");
2259 for (index_data = 0; index_data < len; index_data += 2) {
2260 wb[2] = (data[index_data + 1] >> 8) & 0xff;
2261 wb[3] = (data[index_data + 1]) & 0xff;
2263 if (data[index_data] == 0) {
2264 wb[0] = (data[index_data] >> 8) & 0xff;
2265 wb[1] = (data[index_data]) & 0xff;
2267 if (i2c_transfer(i2c, msg, 2) != 2)
2270 wb[3] |= rb[1] & ~(3 << 4);
2273 wb[0] = (data[index_data] >> 8)&0xff;
2274 wb[1] = (data[index_data])&0xff;
2276 if (i2c_transfer(i2c, &msg[0], 1) != 1)
2282 static struct dib9000_config stk9090m_config = {
2283 .output_mpeg2_in_188_bytes = 1,
2284 .output_mode = OUTMODE_MPEG2_FIFO,
2285 .vcxo_timer = 279620,
2286 .timing_frequency = 20452225,
2287 .demod_clock_khz = 60000,
2288 .xtal_clock_khz = 30000,
2289 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
2293 { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0008 } }, /* GPIO 3 to 1 for VHF */
2294 { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0000 } }, /* GPIO 3 to 0 for UHF */
2299 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
2300 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
2304 static struct dib9000_config nim9090md_config[2] = {
2306 .output_mpeg2_in_188_bytes = 1,
2307 .output_mode = OUTMODE_MPEG2_FIFO,
2308 .vcxo_timer = 279620,
2309 .timing_frequency = 20452225,
2310 .demod_clock_khz = 60000,
2311 .xtal_clock_khz = 30000,
2312 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
2314 .output_mpeg2_in_188_bytes = 1,
2315 .output_mode = OUTMODE_DIVERSITY,
2316 .vcxo_timer = 279620,
2317 .timing_frequency = 20452225,
2318 .demod_clock_khz = 60000,
2319 .xtal_clock_khz = 30000,
2320 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
2324 { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0006 } }, /* GPIO 1 and 2 to 1 for VHF */
2325 { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0000 } }, /* GPIO 1 and 2 to 0 for UHF */
2330 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
2331 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
2336 static struct dib0090_config dib9090_dib0090_config = {
2340 .io.pll_loopdiv = 8,
2341 .io.adc_clock_ratio = 8,
2342 .io.pll_int_loop_filt = 0,
2343 .io.clock_khz = 30000,
2344 .reset = dib90x0_tuner_reset,
2345 .sleep = dib90x0_tuner_sleep,
2350 .freq_offset_khz_uhf = 0,
2351 .freq_offset_khz_vhf = 0,
2354 static struct dib0090_config nim9090md_dib0090_config[2] = {
2359 .io.pll_loopdiv = 8,
2360 .io.adc_clock_ratio = 8,
2361 .io.pll_int_loop_filt = 0,
2362 .io.clock_khz = 30000,
2363 .reset = dib90x0_tuner_reset,
2364 .sleep = dib90x0_tuner_sleep,
2369 .freq_offset_khz_uhf = 0,
2370 .freq_offset_khz_vhf = 0,
2375 .io.pll_loopdiv = 8,
2376 .io.adc_clock_ratio = 8,
2377 .io.pll_int_loop_filt = 0,
2378 .io.clock_khz = 30000,
2379 .reset = dib90x0_tuner_reset,
2380 .sleep = dib90x0_tuner_sleep,
2385 .freq_offset_khz_uhf = 0,
2386 .freq_offset_khz_vhf = 0,
2391 static int stk9090m_frontend_attach(struct dvb_usb_adapter *adap)
2393 struct dib0700_adapter_state *state = adap->priv;
2394 struct dib0700_state *st = adap->dev->priv;
2397 /* Make use of the new i2c functions from FW 1.20 */
2398 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
2399 if (fw_version >= 0x10200)
2400 st->fw_use_new_i2c_api = 1;
2401 dib0700_set_i2c_speed(adap->dev, 340);
2403 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2405 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2406 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2407 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2408 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2410 dib0700_ctrl_clock(adap->dev, 72, 1);
2413 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2415 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2417 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80);
2419 if (reject_firmware(&state->frontend_firmware, "/*(DEBLOBBED)*/", &adap->dev->udev->dev)) {
2420 deb_info("%s: Upload failed. (file not found?)\n", __func__);
2423 deb_info("%s: firmware read %zu bytes.\n", __func__, state->frontend_firmware->size);
2425 stk9090m_config.microcode_B_fe_size = state->frontend_firmware->size;
2426 stk9090m_config.microcode_B_fe_buffer = state->frontend_firmware->data;
2428 adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &stk9090m_config);
2430 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
2433 static int dib9090_tuner_attach(struct dvb_usb_adapter *adap)
2435 struct dib0700_adapter_state *state = adap->priv;
2436 struct i2c_adapter *i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe);
2437 u16 data_dib190[10] = {
2445 if (!IS_ENABLED(CONFIG_DVB_DIB9000))
2447 if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &dib9090_dib0090_config) == NULL)
2449 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
2452 if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0)
2454 dib0700_set_i2c_speed(adap->dev, 1500);
2455 if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0)
2457 release_firmware(state->frontend_firmware);
2461 static int nim9090md_frontend_attach(struct dvb_usb_adapter *adap)
2463 struct dib0700_adapter_state *state = adap->priv;
2464 struct dib0700_state *st = adap->dev->priv;
2465 struct i2c_adapter *i2c;
2466 struct dvb_frontend *fe_slave;
2469 /* Make use of the new i2c functions from FW 1.20 */
2470 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
2471 if (fw_version >= 0x10200)
2472 st->fw_use_new_i2c_api = 1;
2473 dib0700_set_i2c_speed(adap->dev, 340);
2475 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2477 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2478 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2479 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2480 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2482 dib0700_ctrl_clock(adap->dev, 72, 1);
2485 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2487 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2489 if (reject_firmware(&state->frontend_firmware, "/*(DEBLOBBED)*/", &adap->dev->udev->dev)) {
2490 deb_info("%s: Upload failed. (file not found?)\n", __func__);
2493 deb_info("%s: firmware read %zu bytes.\n", __func__, state->frontend_firmware->size);
2495 nim9090md_config[0].microcode_B_fe_size = state->frontend_firmware->size;
2496 nim9090md_config[0].microcode_B_fe_buffer = state->frontend_firmware->data;
2497 nim9090md_config[1].microcode_B_fe_size = state->frontend_firmware->size;
2498 nim9090md_config[1].microcode_B_fe_buffer = state->frontend_firmware->data;
2500 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, 0x80);
2501 adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &nim9090md_config[0]);
2503 if (adap->fe_adap[0].fe == NULL)
2506 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_3_4, 0);
2507 dib9000_i2c_enumeration(i2c, 1, 0x12, 0x82);
2509 fe_slave = dvb_attach(dib9000_attach, i2c, 0x82, &nim9090md_config[1]);
2510 dib9000_set_slave_frontend(adap->fe_adap[0].fe, fe_slave);
2512 return fe_slave == NULL ? -ENODEV : 0;
2515 static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap)
2517 struct dib0700_adapter_state *state = adap->priv;
2518 struct i2c_adapter *i2c;
2519 struct dvb_frontend *fe_slave;
2520 u16 data_dib190[10] = {
2527 if (!IS_ENABLED(CONFIG_DVB_DIB9000))
2529 i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe);
2530 if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &nim9090md_dib0090_config[0]) == NULL)
2532 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
2535 if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0)
2538 dib0700_set_i2c_speed(adap->dev, 1500);
2539 if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0)
2542 fe_slave = dib9000_get_slave_frontend(adap->fe_adap[0].fe, 1);
2543 if (fe_slave != NULL) {
2544 i2c = dib9000_get_component_bus_interface(adap->fe_adap[0].fe);
2545 dib9000_set_i2c_adapter(fe_slave, i2c);
2547 i2c = dib9000_get_tuner_interface(fe_slave);
2548 if (dvb_attach(dib0090_fw_register, fe_slave, i2c, &nim9090md_dib0090_config[1]) == NULL)
2550 fe_slave->dvb = adap->fe_adap[0].fe->dvb;
2551 dib9000_fw_set_component_bus_speed(adap->fe_adap[0].fe, 1500);
2552 if (dib9000_firmware_post_pll_init(fe_slave) < 0)
2555 release_firmware(state->frontend_firmware);
2561 static int dib7090p_get_best_sampling(struct dvb_frontend *fe , struct dibx090p_best_adc *adc)
2563 u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1;
2566 u32 fcp_min = 1900; /* PLL Minimum Frequency comparator KHz */
2567 u32 fcp_max = 20000; /* PLL Maximum Frequency comparator KHz */
2568 u32 fdem_max = 76000;
2569 u32 fdem_min = 69500;
2570 u32 fcp = 0, fs = 0, fdem = 0;
2571 u32 harmonic_id = 0;
2573 adc->pll_loopdiv = loopdiv;
2574 adc->pll_prediv = prediv;
2577 deb_info("bandwidth = %d fdem_min =%d", fe->dtv_property_cache.bandwidth_hz, fdem_min);
2579 /* Find Min and Max prediv */
2580 while ((xtal/max_prediv) >= fcp_min)
2584 min_prediv = max_prediv;
2585 while ((xtal/min_prediv) <= fcp_max) {
2587 if (min_prediv == 1)
2590 deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv);
2594 for (prediv = min_prediv ; prediv < max_prediv; prediv++) {
2595 fcp = xtal / prediv;
2596 if (fcp > fcp_min && fcp < fcp_max) {
2597 for (loopdiv = 1 ; loopdiv < 64 ; loopdiv++) {
2598 fdem = ((xtal/prediv) * loopdiv);
2600 /* test min/max system restrictions */
2602 if ((fdem >= fdem_min) && (fdem <= fdem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz/1000)) {
2604 /* test fs harmonics positions */
2605 for (harmonic_id = (fe->dtv_property_cache.frequency / (1000*fs)) ; harmonic_id <= ((fe->dtv_property_cache.frequency / (1000*fs))+1) ; harmonic_id++) {
2606 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)))) {
2613 adc->pll_loopdiv = loopdiv;
2614 adc->pll_prediv = prediv;
2615 adc->timf = 2396745143UL/fdem*(1 << 9);
2616 adc->timf += ((2396745143UL%fdem) << 9)/fdem;
2617 deb_info("loopdiv=%i prediv=%i timf=%i", loopdiv, prediv, adc->timf);
2628 if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0)
2634 static int dib7090_agc_startup(struct dvb_frontend *fe)
2636 struct dvb_usb_adapter *adap = fe->dvb->priv;
2637 struct dib0700_adapter_state *state = adap->priv;
2638 struct dibx000_bandwidth_config pll;
2640 struct dibx090p_best_adc adc;
2643 ret = state->set_param_save(fe);
2647 memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));
2648 dib0090_pwm_gain_reset(fe);
2649 target = (dib0090_get_wbd_target(fe) * 8 + 1) / 2;
2650 state->dib7000p_ops.set_wbd_ref(fe, target);
2652 if (dib7090p_get_best_sampling(fe, &adc) == 0) {
2653 pll.pll_ratio = adc.pll_loopdiv;
2654 pll.pll_prediv = adc.pll_prediv;
2656 state->dib7000p_ops.update_pll(fe, &pll);
2657 state->dib7000p_ops.ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf);
2662 static int dib7090_agc_restart(struct dvb_frontend *fe, u8 restart)
2664 deb_info("AGC restart callback: %d", restart);
2665 if (restart == 0) /* before AGC startup */
2666 dib0090_set_dc_servo(fe, 1);
2670 static int tfe7790p_update_lna(struct dvb_frontend *fe, u16 agc_global)
2672 struct dvb_usb_adapter *adap = fe->dvb->priv;
2673 struct dib0700_adapter_state *state = adap->priv;
2675 deb_info("update LNA: agc global=%i", agc_global);
2677 if (agc_global < 25000) {
2678 state->dib7000p_ops.set_gpio(fe, 8, 0, 0);
2679 state->dib7000p_ops.set_agc1_min(fe, 0);
2681 state->dib7000p_ops.set_gpio(fe, 8, 0, 1);
2682 state->dib7000p_ops.set_agc1_min(fe, 32768);
2688 static struct dib0090_wbd_slope dib7090_wbd_table[] = {
2689 { 380, 81, 850, 64, 540, 4},
2690 { 860, 51, 866, 21, 375, 4},
2691 {1700, 0, 250, 0, 100, 6},
2692 {2600, 0, 250, 0, 100, 6},
2693 { 0xFFFF, 0, 0, 0, 0, 0},
2696 static struct dibx000_agc_config dib7090_agc_config[2] = {
2698 .band_caps = BAND_UHF,
2699 /* 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,
2700 * 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 */
2701 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2704 .time_stabiliz = 10,
2735 .perform_agc_softsplit = 0,
2737 .band_caps = BAND_FM | BAND_VHF | BAND_CBAND,
2738 /* 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,
2739 * 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 */
2740 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2743 .time_stabiliz = 10,
2774 .perform_agc_softsplit = 0,
2778 static struct dibx000_bandwidth_config dib7090_clock_config_12_mhz = {
2788 .IO_CLK_en_core = 1,
2791 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
2792 .ifreq = (0 << 25) | 0,
2794 .xtal_hz = 15000000,
2797 static struct dib7000p_config nim7090_dib7000p_config = {
2798 .output_mpeg2_in_188_bytes = 1,
2799 .hostbus_diversity = 1,
2800 .tuner_is_baseband = 1,
2801 .update_lna = tfe7790p_update_lna, /* GPIO used is the same as TFE7790 */
2803 .agc_config_count = 2,
2804 .agc = dib7090_agc_config,
2806 .bw = &dib7090_clock_config_12_mhz,
2808 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2809 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2810 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2814 .agc_control = dib7090_agc_restart,
2817 .disable_sample_and_hold = 0,
2818 .enable_current_mirror = 0,
2819 .diversity_delay = 0,
2821 .output_mode = OUTMODE_MPEG2_FIFO,
2825 static int tfe7090p_pvr_update_lna(struct dvb_frontend *fe, u16 agc_global)
2827 struct dvb_usb_adapter *adap = fe->dvb->priv;
2828 struct dib0700_adapter_state *state = adap->priv;
2830 deb_info("TFE7090P-PVR update LNA: agc global=%i", agc_global);
2831 if (agc_global < 25000) {
2832 state->dib7000p_ops.set_gpio(fe, 5, 0, 0);
2833 state->dib7000p_ops.set_agc1_min(fe, 0);
2835 state->dib7000p_ops.set_gpio(fe, 5, 0, 1);
2836 state->dib7000p_ops.set_agc1_min(fe, 32768);
2842 static struct dib7000p_config tfe7090pvr_dib7000p_config[2] = {
2844 .output_mpeg2_in_188_bytes = 1,
2845 .hostbus_diversity = 1,
2846 .tuner_is_baseband = 1,
2847 .update_lna = tfe7090p_pvr_update_lna,
2849 .agc_config_count = 2,
2850 .agc = dib7090_agc_config,
2852 .bw = &dib7090_clock_config_12_mhz,
2854 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2855 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2856 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2860 .agc_control = dib7090_agc_restart,
2863 .disable_sample_and_hold = 0,
2864 .enable_current_mirror = 0,
2865 .diversity_delay = 0,
2867 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2868 .default_i2c_addr = 0x90,
2871 .output_mpeg2_in_188_bytes = 1,
2872 .hostbus_diversity = 1,
2873 .tuner_is_baseband = 1,
2874 .update_lna = tfe7090p_pvr_update_lna,
2876 .agc_config_count = 2,
2877 .agc = dib7090_agc_config,
2879 .bw = &dib7090_clock_config_12_mhz,
2881 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2882 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2883 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2887 .agc_control = dib7090_agc_restart,
2890 .disable_sample_and_hold = 0,
2891 .enable_current_mirror = 0,
2892 .diversity_delay = 0,
2894 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2895 .default_i2c_addr = 0x92,
2900 static struct dib0090_config nim7090_dib0090_config = {
2901 .io.clock_khz = 12000,
2905 .io.pll_loopdiv = 6,
2906 .io.adc_clock_ratio = 0,
2907 .io.pll_int_loop_filt = 0,
2909 .freq_offset_khz_uhf = 0,
2910 .freq_offset_khz_vhf = 0,
2915 .wbd_vhf_offset = 0,
2916 .wbd_cband_offset = 0,
2920 .fref_clock_ratio = 0,
2922 .wbd = dib7090_wbd_table,
2924 .ls_cfg_pad_drv = 0,
2930 static struct dib7000p_config tfe7790p_dib7000p_config = {
2931 .output_mpeg2_in_188_bytes = 1,
2932 .hostbus_diversity = 1,
2933 .tuner_is_baseband = 1,
2934 .update_lna = tfe7790p_update_lna,
2936 .agc_config_count = 2,
2937 .agc = dib7090_agc_config,
2939 .bw = &dib7090_clock_config_12_mhz,
2941 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2942 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2943 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2947 .agc_control = dib7090_agc_restart,
2950 .disable_sample_and_hold = 0,
2951 .enable_current_mirror = 0,
2952 .diversity_delay = 0,
2954 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2958 static struct dib0090_config tfe7790p_dib0090_config = {
2959 .io.clock_khz = 12000,
2963 .io.pll_loopdiv = 6,
2964 .io.adc_clock_ratio = 0,
2965 .io.pll_int_loop_filt = 0,
2967 .freq_offset_khz_uhf = 0,
2968 .freq_offset_khz_vhf = 0,
2973 .wbd_vhf_offset = 0,
2974 .wbd_cband_offset = 0,
2978 .fref_clock_ratio = 0,
2980 .wbd = dib7090_wbd_table,
2982 .ls_cfg_pad_drv = 0,
2986 .force_cband_input = 0,
2988 .force_crystal_mode = 1,
2991 static struct dib0090_config tfe7090pvr_dib0090_config[2] = {
2993 .io.clock_khz = 12000,
2997 .io.pll_loopdiv = 6,
2998 .io.adc_clock_ratio = 0,
2999 .io.pll_int_loop_filt = 0,
3001 .freq_offset_khz_uhf = 50,
3002 .freq_offset_khz_vhf = 70,
3007 .wbd_vhf_offset = 0,
3008 .wbd_cband_offset = 0,
3012 .fref_clock_ratio = 0,
3014 .wbd = dib7090_wbd_table,
3016 .ls_cfg_pad_drv = 0,
3021 .io.clock_khz = 12000,
3025 .io.pll_loopdiv = 6,
3026 .io.adc_clock_ratio = 0,
3027 .io.pll_int_loop_filt = 0,
3029 .freq_offset_khz_uhf = -50,
3030 .freq_offset_khz_vhf = -70,
3035 .wbd_vhf_offset = 0,
3036 .wbd_cband_offset = 0,
3040 .fref_clock_ratio = 0,
3042 .wbd = dib7090_wbd_table,
3044 .ls_cfg_pad_drv = 0,
3051 static int nim7090_frontend_attach(struct dvb_usb_adapter *adap)
3053 struct dib0700_adapter_state *state = adap->priv;
3055 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3058 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3060 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3061 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3062 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3063 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3066 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3068 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3070 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, &nim7090_dib7000p_config) != 0) {
3071 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
3072 dvb_detach(state->dib7000p_ops.set_wbd_ref);
3075 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, &nim7090_dib7000p_config);
3077 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3080 static int nim7090_tuner_attach(struct dvb_usb_adapter *adap)
3082 struct dib0700_adapter_state *st = adap->priv;
3083 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe);
3085 nim7090_dib0090_config.reset = st->dib7000p_ops.tuner_sleep,
3086 nim7090_dib0090_config.sleep = st->dib7000p_ops.tuner_sleep,
3087 nim7090_dib0090_config.get_adc_power = st->dib7000p_ops.get_adc_power;
3089 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &nim7090_dib0090_config) == NULL)
3092 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3094 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3095 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3099 static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter *adap)
3101 struct dib0700_state *st = adap->dev->priv;
3102 struct dib0700_adapter_state *state = adap->priv;
3104 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3107 /* The TFE7090 requires the dib0700 to not be in master mode */
3108 st->disable_streaming_master_mode = 1;
3110 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3112 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3113 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3114 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3115 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3118 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3120 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3122 /* initialize IC 0 */
3123 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, &tfe7090pvr_dib7000p_config[0]) != 0) {
3124 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
3125 dvb_detach(state->dib7000p_ops.set_wbd_ref);
3129 dib0700_set_i2c_speed(adap->dev, 340);
3130 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]);
3131 if (adap->fe_adap[0].fe == NULL)
3134 state->dib7000p_ops.slave_reset(adap->fe_adap[0].fe);
3139 static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter *adap)
3141 struct i2c_adapter *i2c;
3142 struct dib0700_adapter_state *state = adap->priv;
3144 if (adap->dev->adapter[0].fe_adap[0].fe == NULL) {
3145 err("the master dib7090 has to be initialized first");
3146 return -ENODEV; /* the master device has not been initialized */
3149 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3152 i2c = state->dib7000p_ops.get_i2c_master(adap->dev->adapter[0].fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_6_7, 1);
3153 if (state->dib7000p_ops.i2c_enumeration(i2c, 1, 0x10, &tfe7090pvr_dib7000p_config[1]) != 0) {
3154 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
3155 dvb_detach(state->dib7000p_ops.set_wbd_ref);
3159 adap->fe_adap[0].fe = state->dib7000p_ops.init(i2c, 0x92, &tfe7090pvr_dib7000p_config[1]);
3160 dib0700_set_i2c_speed(adap->dev, 200);
3162 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3165 static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter *adap)
3167 struct dib0700_adapter_state *st = adap->priv;
3168 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe);
3170 tfe7090pvr_dib0090_config[0].reset = st->dib7000p_ops.tuner_sleep;
3171 tfe7090pvr_dib0090_config[0].sleep = st->dib7000p_ops.tuner_sleep;
3172 tfe7090pvr_dib0090_config[0].get_adc_power = st->dib7000p_ops.get_adc_power;
3174 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[0]) == NULL)
3177 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3179 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3180 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3184 static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter *adap)
3186 struct dib0700_adapter_state *st = adap->priv;
3187 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe);
3189 tfe7090pvr_dib0090_config[1].reset = st->dib7000p_ops.tuner_sleep;
3190 tfe7090pvr_dib0090_config[1].sleep = st->dib7000p_ops.tuner_sleep;
3191 tfe7090pvr_dib0090_config[1].get_adc_power = st->dib7000p_ops.get_adc_power;
3193 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[1]) == NULL)
3196 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3198 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3199 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3203 static int tfe7790p_frontend_attach(struct dvb_usb_adapter *adap)
3205 struct dib0700_state *st = adap->dev->priv;
3206 struct dib0700_adapter_state *state = adap->priv;
3208 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3211 /* The TFE7790P requires the dib0700 to not be in master mode */
3212 st->disable_streaming_master_mode = 1;
3214 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3216 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3217 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3218 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3219 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3221 dib0700_ctrl_clock(adap->dev, 72, 1);
3222 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3224 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3226 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap,
3227 1, 0x10, &tfe7790p_dib7000p_config) != 0) {
3228 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
3230 dvb_detach(state->dib7000p_ops.set_wbd_ref);
3233 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap,
3234 0x80, &tfe7790p_dib7000p_config);
3236 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3239 static int tfe7790p_tuner_attach(struct dvb_usb_adapter *adap)
3241 struct dib0700_adapter_state *st = adap->priv;
3242 struct i2c_adapter *tun_i2c =
3243 st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe);
3246 tfe7790p_dib0090_config.reset = st->dib7000p_ops.tuner_sleep;
3247 tfe7790p_dib0090_config.sleep = st->dib7000p_ops.tuner_sleep;
3248 tfe7790p_dib0090_config.get_adc_power = st->dib7000p_ops.get_adc_power;
3250 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c,
3251 &tfe7790p_dib0090_config) == NULL)
3254 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3256 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3257 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3262 static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
3264 .output_mpeg2_in_188_bytes = 1,
3266 .agc_config_count = 1,
3267 .agc = &dib7070_agc_config,
3268 .bw = &dib7070_bw_config_12_mhz,
3269 .tuner_is_baseband = 1,
3272 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
3273 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
3274 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
3276 .hostbus_diversity = 1,
3278 .output_mpeg2_in_188_bytes = 1,
3280 .agc_config_count = 1,
3281 .agc = &dib7070_agc_config,
3282 .bw = &dib7070_bw_config_12_mhz,
3283 .tuner_is_baseband = 1,
3286 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
3287 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
3288 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
3290 .hostbus_diversity = 1,
3294 static void stk7070pd_init(struct dvb_usb_device *dev)
3296 dib0700_set_gpio(dev, GPIO6, GPIO_OUT, 1);
3298 dib0700_set_gpio(dev, GPIO9, GPIO_OUT, 1);
3299 dib0700_set_gpio(dev, GPIO4, GPIO_OUT, 1);
3300 dib0700_set_gpio(dev, GPIO7, GPIO_OUT, 1);
3301 dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 0);
3303 dib0700_ctrl_clock(dev, 72, 1);
3306 dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 1);
3309 static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
3311 struct dib0700_adapter_state *state = adap->priv;
3313 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3316 stk7070pd_init(adap->dev);
3319 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3321 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
3322 stk7070pd_dib7000p_config) != 0) {
3323 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
3325 dvb_detach(state->dib7000p_ops.set_wbd_ref);
3329 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
3330 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3333 static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
3335 struct dib0700_adapter_state *state = adap->priv;
3337 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3340 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
3341 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3344 static int novatd_read_status_override(struct dvb_frontend *fe,
3345 enum fe_status *stat)
3347 struct dvb_usb_adapter *adap = fe->dvb->priv;
3348 struct dvb_usb_device *dev = adap->dev;
3349 struct dib0700_state *state = dev->priv;
3352 ret = state->read_status(fe, stat);
3355 dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT,
3356 !!(*stat & FE_HAS_LOCK));
3361 static int novatd_sleep_override(struct dvb_frontend* fe)
3363 struct dvb_usb_adapter *adap = fe->dvb->priv;
3364 struct dvb_usb_device *dev = adap->dev;
3365 struct dib0700_state *state = dev->priv;
3368 dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT, 0);
3370 return state->sleep(fe);
3374 * novatd_frontend_attach - Nova-TD specific attach
3376 * Nova-TD has GPIO0, 1 and 2 for LEDs. So do not fiddle with them except for
3377 * information purposes.
3379 static int novatd_frontend_attach(struct dvb_usb_adapter *adap)
3381 struct dvb_usb_device *dev = adap->dev;
3382 struct dib0700_state *st = dev->priv;
3383 struct dib0700_adapter_state *state = adap->priv;
3385 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3388 if (adap->id == 0) {
3389 stk7070pd_init(dev);
3391 /* turn the power LED on, the other two off (just in case) */
3392 dib0700_set_gpio(dev, GPIO0, GPIO_OUT, 0);
3393 dib0700_set_gpio(dev, GPIO1, GPIO_OUT, 0);
3394 dib0700_set_gpio(dev, GPIO2, GPIO_OUT, 1);
3396 if (state->dib7000p_ops.i2c_enumeration(&dev->i2c_adap, 2, 18,
3397 stk7070pd_dib7000p_config) != 0) {
3398 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
3400 dvb_detach(state->dib7000p_ops.set_wbd_ref);
3405 adap->fe_adap[0].fe = state->dib7000p_ops.init(&dev->i2c_adap,
3406 adap->id == 0 ? 0x80 : 0x82,
3407 &stk7070pd_dib7000p_config[adap->id]);
3409 if (adap->fe_adap[0].fe == NULL)
3412 st->read_status = adap->fe_adap[0].fe->ops.read_status;
3413 adap->fe_adap[0].fe->ops.read_status = novatd_read_status_override;
3414 st->sleep = adap->fe_adap[0].fe->ops.sleep;
3415 adap->fe_adap[0].fe->ops.sleep = novatd_sleep_override;
3421 static struct s5h1411_config pinnacle_801e_config = {
3422 .output_mode = S5H1411_PARALLEL_OUTPUT,
3423 .gpio = S5H1411_GPIO_OFF,
3424 .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINUOUS_NONINVERTING_CLOCK,
3425 .qam_if = S5H1411_IF_44000,
3426 .vsb_if = S5H1411_IF_44000,
3427 .inversion = S5H1411_INVERSION_OFF,
3428 .status_mode = S5H1411_DEMODLOCKING
3431 /* Pinnacle PCTV HD Pro 801e GPIOs map:
3432 GPIO0 - currently unknown
3433 GPIO1 - xc5000 tuner reset
3434 GPIO2 - CX25843 sleep
3435 GPIO3 - currently unknown
3436 GPIO4 - currently unknown
3437 GPIO6 - currently unknown
3438 GPIO7 - currently unknown
3439 GPIO9 - currently unknown
3440 GPIO10 - CX25843 reset
3442 static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
3444 struct dib0700_state *st = adap->dev->priv;
3446 /* Make use of the new i2c functions from FW 1.20 */
3447 st->fw_use_new_i2c_api = 1;
3449 /* The s5h1411 requires the dib0700 to not be in master mode */
3450 st->disable_streaming_master_mode = 1;
3452 /* All msleep values taken from Windows USB trace */
3453 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
3454 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
3455 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3457 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3459 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3461 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3462 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3463 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3464 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3465 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
3468 /* Put the CX25843 to sleep for now since we're in digital mode */
3469 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
3471 /* GPIOs are initialized, do the attach */
3472 adap->fe_adap[0].fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
3473 &adap->dev->i2c_adap);
3474 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3477 static int dib0700_xc5000_tuner_callback(void *priv, int component,
3478 int command, int arg)
3480 struct dvb_usb_adapter *adap = priv;
3482 if (command == XC5000_TUNER_RESET) {
3483 /* Reset the tuner */
3484 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
3486 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
3489 err("xc5000: unknown tuner callback command: %d\n", command);
3496 static struct xc5000_config s5h1411_xc5000_tunerconfig = {
3497 .i2c_address = 0x64,
3501 static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
3503 /* FIXME: generalize & move to common area */
3504 adap->fe_adap[0].fe->callback = dib0700_xc5000_tuner_callback;
3506 return dvb_attach(xc5000_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap,
3507 &s5h1411_xc5000_tunerconfig)
3508 == NULL ? -ENODEV : 0;
3511 static int dib0700_xc4000_tuner_callback(void *priv, int component,
3512 int command, int arg)
3514 struct dvb_usb_adapter *adap = priv;
3515 struct dib0700_adapter_state *state = adap->priv;
3517 if (command == XC4000_TUNER_RESET) {
3518 /* Reset the tuner */
3519 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 0);
3521 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3523 err("xc4000: unknown tuner callback command: %d\n", command);
3530 static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config = {
3531 .band_caps = BAND_UHF | BAND_VHF,
3534 .time_stabiliz = 0x15,
3535 .alpha_level = 0x00,
3548 .agc1_slope1 = 0x00,
3549 .agc1_slope2 = 0x00,
3552 .agc2_slope1 = 0x1d,
3553 .agc2_slope2 = 0x1d,
3558 .perform_agc_softsplit = 0x00,
3561 static struct dibx000_bandwidth_config stk7700p_xc4000_pll_config = {
3571 .IO_CLK_en_core = 1,
3574 .sad_cfg = (3 << 14) | (1 << 12) | 524, /* sad_cfg: refsel, sel, freq_15k */
3580 /* FIXME: none of these inputs are validated yet */
3581 static struct dib7000p_config pctv_340e_config = {
3582 .output_mpeg2_in_188_bytes = 1,
3584 .agc_config_count = 1,
3585 .agc = &stk7700p_7000p_xc4000_agc_config,
3586 .bw = &stk7700p_xc4000_pll_config,
3588 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
3589 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
3590 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
3593 /* PCTV 340e GPIOs map:
3595 GPIO2 - CX25843 sleep
3596 GPIO3 - CS5340 reset
3598 GPIO6 - Power Supply
3599 GPIO8 - LNA (1=off 0=on)
3600 GPIO10 - CX25843 reset
3602 GPIO8 - xc4000 reset
3604 static int pctv340e_frontend_attach(struct dvb_usb_adapter *adap)
3606 struct dib0700_state *st = adap->dev->priv;
3607 struct dib0700_adapter_state *state = adap->priv;
3609 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3612 /* Power Supply on */
3613 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
3615 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3616 msleep(100); /* Allow power supply to settle before probing */
3619 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3620 msleep(1); /* cx25843 datasheet say 350us required */
3621 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3623 /* LNA off for now */
3624 dib0700_set_gpio(adap->dev, GPIO8, GPIO_OUT, 1);
3626 /* Put the CX25843 to sleep for now since we're in digital mode */
3627 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
3629 /* FIXME: not verified yet */
3630 dib0700_ctrl_clock(adap->dev, 72, 1);
3634 if (state->dib7000p_ops.dib7000pc_detection(&adap->dev->i2c_adap) == 0) {
3635 /* Demodulator not found for some reason? */
3636 dvb_detach(state->dib7000p_ops.set_wbd_ref);
3640 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x12,
3642 st->is_dib7000pc = 1;
3644 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3647 static struct xc4000_config dib7000p_xc4000_tunerconfig = {
3648 .i2c_address = 0x61,
3651 .set_smoothedcvbs = 0,
3655 static int xc4000_tuner_attach(struct dvb_usb_adapter *adap)
3657 struct i2c_adapter *tun_i2c;
3658 struct dib0700_adapter_state *state = adap->priv;
3660 /* The xc4000 is not on the main i2c bus */
3661 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
3662 DIBX000_I2C_INTERFACE_TUNER, 1);
3663 if (tun_i2c == NULL) {
3664 printk(KERN_ERR "Could not reach tuner i2c bus\n");
3668 /* Setup the reset callback */
3669 adap->fe_adap[0].fe->callback = dib0700_xc4000_tuner_callback;
3671 return dvb_attach(xc4000_attach, adap->fe_adap[0].fe, tun_i2c,
3672 &dib7000p_xc4000_tunerconfig)
3673 == NULL ? -ENODEV : 0;
3676 static struct lgdt3305_config hcw_lgdt3305_config = {
3678 .mpeg_mode = LGDT3305_MPEG_PARALLEL,
3679 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
3680 .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
3682 .spectral_inversion = 1,
3685 .usref_8vsb = 0x0500,
3688 static struct mxl5007t_config hcw_mxl5007t_config = {
3689 .xtal_freq_hz = MxL_XTAL_25_MHZ,
3690 .if_freq_hz = MxL_IF_6_MHZ,
3695 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
3696 GPIO1 - ANT_SEL (H: VPA, L: MCX)
3702 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
3704 static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
3706 struct dib0700_state *st = adap->dev->priv;
3708 /* Make use of the new i2c functions from FW 1.20 */
3709 st->fw_use_new_i2c_api = 1;
3711 st->disable_streaming_master_mode = 1;
3713 /* fe power enable */
3714 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
3716 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3720 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3722 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3724 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3727 adap->fe_adap[0].fe = dvb_attach(lgdt3305_attach,
3728 &hcw_lgdt3305_config,
3729 &adap->dev->i2c_adap);
3731 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3734 static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
3736 return dvb_attach(mxl5007t_attach, adap->fe_adap[0].fe,
3737 &adap->dev->i2c_adap, 0x60,
3738 &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
3741 static int xbox_one_attach(struct dvb_usb_adapter *adap)
3743 struct dib0700_state *st = adap->dev->priv;
3744 struct i2c_client *client_demod, *client_tuner;
3745 struct dvb_usb_device *d = adap->dev;
3746 struct mn88472_config mn88472_config = { };
3747 struct tda18250_config tda18250_config;
3748 struct i2c_board_info info;
3750 st->fw_use_new_i2c_api = 1;
3751 st->disable_streaming_master_mode = 1;
3753 /* fe power enable */
3754 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
3756 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3760 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3762 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3764 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3768 mn88472_config.fe = &adap->fe_adap[0].fe;
3769 mn88472_config.i2c_wr_max = 22;
3770 mn88472_config.xtal = 20500000;
3771 mn88472_config.ts_mode = PARALLEL_TS_MODE;
3772 mn88472_config.ts_clock = FIXED_TS_CLOCK;
3773 memset(&info, 0, sizeof(struct i2c_board_info));
3774 strlcpy(info.type, "mn88472", I2C_NAME_SIZE);
3776 info.platform_data = &mn88472_config;
3777 request_module(info.type);
3778 client_demod = i2c_new_device(&d->i2c_adap, &info);
3779 if (client_demod == NULL || client_demod->dev.driver == NULL)
3780 goto fail_demod_device;
3781 if (!try_module_get(client_demod->dev.driver->owner))
3782 goto fail_demod_module;
3784 st->i2c_client_demod = client_demod;
3786 adap->fe_adap[0].fe = mn88472_config.get_dvb_frontend(client_demod);
3789 memset(&tda18250_config, 0, sizeof(tda18250_config));
3790 tda18250_config.if_dvbt_6 = 3950;
3791 tda18250_config.if_dvbt_7 = 4450;
3792 tda18250_config.if_dvbt_8 = 4950;
3793 tda18250_config.if_dvbc_6 = 4950;
3794 tda18250_config.if_dvbc_8 = 4950;
3795 tda18250_config.if_atsc = 4079;
3796 tda18250_config.loopthrough = true;
3797 tda18250_config.xtal_freq = TDA18250_XTAL_FREQ_27MHZ;
3798 tda18250_config.fe = adap->fe_adap[0].fe;
3800 memset(&info, 0, sizeof(struct i2c_board_info));
3801 strlcpy(info.type, "tda18250", I2C_NAME_SIZE);
3803 info.platform_data = &tda18250_config;
3805 request_module(info.type);
3806 client_tuner = i2c_new_device(&adap->dev->i2c_adap, &info);
3807 if (client_tuner == NULL || client_tuner->dev.driver == NULL)
3808 goto fail_tuner_device;
3809 if (!try_module_get(client_tuner->dev.driver->owner))
3810 goto fail_tuner_module;
3812 st->i2c_client_tuner = client_tuner;
3816 i2c_unregister_device(client_tuner);
3818 module_put(client_demod->dev.driver->owner);
3820 i2c_unregister_device(client_demod);
3826 /* DVB-USB and USB stuff follows */
3827 struct usb_device_id dib0700_usb_id_table[] = {
3828 /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
3829 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
3830 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
3831 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
3832 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
3833 /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
3834 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
3835 { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
3836 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
3837 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
3838 /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
3839 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
3840 { USB_DEVICE(USB_VID_TERRATEC,
3841 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
3842 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
3843 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
3844 /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
3845 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
3846 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
3847 { USB_DEVICE(USB_VID_PINNACLE,
3848 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
3849 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
3850 /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
3851 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
3852 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
3853 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
3854 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
3855 /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
3856 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
3857 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
3858 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
3859 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
3860 /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
3861 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
3862 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
3863 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
3864 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
3865 /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
3866 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
3867 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
3868 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
3869 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
3870 /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
3871 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
3872 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
3873 { USB_DEVICE(USB_VID_TERRATEC,
3874 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
3875 { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
3876 /* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
3877 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
3878 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
3879 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
3880 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
3881 /* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
3882 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
3883 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
3884 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
3885 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
3886 /* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
3887 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
3888 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV73ESE) },
3889 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV282E) },
3890 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
3891 /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
3892 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
3893 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
3894 { USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x000, 0x3f00) },
3895 { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },
3896 /* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
3897 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
3898 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) },
3899 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) },
3900 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090M) },
3901 /* 70 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM8096MD) },
3902 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090MD) },
3903 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM7090) },
3904 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090PVR) },
3905 { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2) },
3906 /* 75 */{ USB_DEVICE(USB_VID_MEDION, USB_PID_CREATIX_CTX1921) },
3907 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E) },
3908 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E_SE) },
3909 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7790P) },
3910 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE8096P) },
3911 /* 80 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_2) },
3912 { USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_2002E) },
3913 { USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_2002E_SE) },
3914 { USB_DEVICE(USB_VID_PCTV, USB_PID_DIBCOM_STK8096PVR) },
3915 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096PVR) },
3916 /* 85 */{ USB_DEVICE(USB_VID_HAMA, USB_PID_HAMA_DVBT_HYBRID) },
3917 { USB_DEVICE(USB_VID_MICROSOFT, USB_PID_XBOX_ONE_TUNER) },
3918 { 0 } /* Terminating entry */
3920 MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
3922 #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
3923 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
3924 .usb_ctrl = DEVICE_SPECIFIC, \
3925 .firmware = "/*(DEBLOBBED)*/", \
3926 .download_firmware = dib0700_download_firmware, \
3927 .no_reconnect = 1, \
3928 .size_of_priv = sizeof(struct dib0700_state), \
3929 .i2c_algo = &dib0700_i2c_algo, \
3930 .identify_state = dib0700_identify_state
3932 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
3933 .streaming_ctrl = dib0700_streaming_ctrl, \
3940 .buffersize = 39480, \
3945 #define DIB0700_NUM_FRONTENDS(n) \
3946 .num_frontends = n, \
3947 .size_of_priv = sizeof(struct dib0700_adapter_state)
3949 struct dvb_usb_device_properties dib0700_devices[] = {
3951 DIB0700_DEFAULT_DEVICE_PROPERTIES,
3956 DIB0700_NUM_FRONTENDS(1),
3958 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3959 .pid_filter_count = 32,
3960 .pid_filter = stk7700p_pid_filter,
3961 .pid_filter_ctrl = stk7700p_pid_filter_ctrl,
3962 .frontend_attach = stk7700p_frontend_attach,
3963 .tuner_attach = stk7700p_tuner_attach,
3965 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3970 .num_device_descs = 8,
3972 { "DiBcom STK7700P reference design",
3973 { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
3976 { "Hauppauge Nova-T Stick",
3977 { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
3980 { "AVerMedia AVerTV DVB-T Volar",
3981 { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
3984 { "Compro Videomate U500",
3985 { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
3988 { "Uniwill STK7700P based (Hama and others)",
3989 { &dib0700_usb_id_table[7], NULL },
3992 { "Leadtek Winfast DTV Dongle (STK7700P based)",
3993 { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
3996 { "AVerMedia AVerTV DVB-T Express",
3997 { &dib0700_usb_id_table[20] },
4001 { &dib0700_usb_id_table[21], NULL },
4007 .rc_interval = DEFAULT_RC_INTERVAL,
4008 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4009 .rc_query = dib0700_rc_query_old_firmware,
4010 .allowed_protos = RC_PROTO_BIT_RC5 |
4011 RC_PROTO_BIT_RC6_MCE |
4013 .change_protocol = dib0700_change_protocol,
4015 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4020 DIB0700_NUM_FRONTENDS(1),
4022 .frontend_attach = bristol_frontend_attach,
4023 .tuner_attach = bristol_tuner_attach,
4025 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4028 DIB0700_NUM_FRONTENDS(1),
4030 .frontend_attach = bristol_frontend_attach,
4031 .tuner_attach = bristol_tuner_attach,
4033 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4038 .num_device_descs = 1,
4040 { "Hauppauge Nova-T 500 Dual DVB-T",
4041 { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
4047 .rc_interval = DEFAULT_RC_INTERVAL,
4048 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4049 .rc_query = dib0700_rc_query_old_firmware,
4050 .allowed_protos = RC_PROTO_BIT_RC5 |
4051 RC_PROTO_BIT_RC6_MCE |
4053 .change_protocol = dib0700_change_protocol,
4055 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4060 DIB0700_NUM_FRONTENDS(1),
4062 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4063 .pid_filter_count = 32,
4064 .pid_filter = stk70x0p_pid_filter,
4065 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4066 .frontend_attach = stk7700d_frontend_attach,
4067 .tuner_attach = stk7700d_tuner_attach,
4069 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4072 DIB0700_NUM_FRONTENDS(1),
4074 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4075 .pid_filter_count = 32,
4076 .pid_filter = stk70x0p_pid_filter,
4077 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4078 .frontend_attach = stk7700d_frontend_attach,
4079 .tuner_attach = stk7700d_tuner_attach,
4081 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4086 .num_device_descs = 5,
4088 { "Pinnacle PCTV 2000e",
4089 { &dib0700_usb_id_table[11], NULL },
4092 { "Terratec Cinergy DT XS Diversity",
4093 { &dib0700_usb_id_table[12], NULL },
4096 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
4097 { &dib0700_usb_id_table[13], NULL },
4100 { "DiBcom STK7700D reference design",
4101 { &dib0700_usb_id_table[14], NULL },
4104 { "YUAN High-Tech DiBcom STK7700D",
4105 { &dib0700_usb_id_table[55], NULL },
4112 .rc_interval = DEFAULT_RC_INTERVAL,
4113 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4114 .rc_query = dib0700_rc_query_old_firmware,
4115 .allowed_protos = RC_PROTO_BIT_RC5 |
4116 RC_PROTO_BIT_RC6_MCE |
4118 .change_protocol = dib0700_change_protocol,
4120 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4125 DIB0700_NUM_FRONTENDS(1),
4127 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4128 .pid_filter_count = 32,
4129 .pid_filter = stk70x0p_pid_filter,
4130 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4131 .frontend_attach = stk7700P2_frontend_attach,
4132 .tuner_attach = stk7700d_tuner_attach,
4134 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4139 .num_device_descs = 3,
4141 { "ASUS My Cinema U3000 Mini DVBT Tuner",
4142 { &dib0700_usb_id_table[23], NULL },
4146 { &dib0700_usb_id_table[31], NULL },
4149 { "Terratec Cinergy T Express",
4150 { &dib0700_usb_id_table[42], NULL },
4156 .rc_interval = DEFAULT_RC_INTERVAL,
4157 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4158 .module_name = "dib0700",
4159 .rc_query = dib0700_rc_query_old_firmware,
4160 .allowed_protos = RC_PROTO_BIT_RC5 |
4161 RC_PROTO_BIT_RC6_MCE |
4163 .change_protocol = dib0700_change_protocol,
4165 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4170 DIB0700_NUM_FRONTENDS(1),
4172 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4173 .pid_filter_count = 32,
4174 .pid_filter = stk70x0p_pid_filter,
4175 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4176 .frontend_attach = stk7070p_frontend_attach,
4177 .tuner_attach = dib7070p_tuner_attach,
4179 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4184 .num_device_descs = 12,
4186 { "DiBcom STK7070P reference design",
4187 { &dib0700_usb_id_table[15], NULL },
4190 { "Pinnacle PCTV DVB-T Flash Stick",
4191 { &dib0700_usb_id_table[16], NULL },
4194 { "Artec T14BR DVB-T",
4195 { &dib0700_usb_id_table[22], NULL },
4198 { "ASUS My Cinema U3100 Mini DVBT Tuner",
4199 { &dib0700_usb_id_table[24], NULL },
4202 { "Hauppauge Nova-T Stick",
4203 { &dib0700_usb_id_table[25], NULL },
4206 { "Hauppauge Nova-T MyTV.t",
4207 { &dib0700_usb_id_table[26], NULL },
4210 { "Pinnacle PCTV 72e",
4211 { &dib0700_usb_id_table[29], NULL },
4214 { "Pinnacle PCTV 73e",
4215 { &dib0700_usb_id_table[30], NULL },
4218 { "Elgato EyeTV DTT",
4219 { &dib0700_usb_id_table[49], NULL },
4223 { &dib0700_usb_id_table[45], NULL },
4226 { "Elgato EyeTV Dtt Dlx PD378S",
4227 { &dib0700_usb_id_table[50], NULL },
4230 { "Elgato EyeTV DTT rev. 2",
4231 { &dib0700_usb_id_table[80], NULL },
4237 .rc_interval = DEFAULT_RC_INTERVAL,
4238 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4239 .module_name = "dib0700",
4240 .rc_query = dib0700_rc_query_old_firmware,
4241 .allowed_protos = RC_PROTO_BIT_RC5 |
4242 RC_PROTO_BIT_RC6_MCE |
4244 .change_protocol = dib0700_change_protocol,
4246 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4251 DIB0700_NUM_FRONTENDS(1),
4253 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4254 .pid_filter_count = 32,
4255 .pid_filter = stk70x0p_pid_filter,
4256 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4257 .frontend_attach = stk7070p_frontend_attach,
4258 .tuner_attach = dib7070p_tuner_attach,
4260 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4265 .num_device_descs = 3,
4267 { "Pinnacle PCTV 73A",
4268 { &dib0700_usb_id_table[56], NULL },
4271 { "Pinnacle PCTV 73e SE",
4272 { &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL },
4275 { "Pinnacle PCTV 282e",
4276 { &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL },
4282 .rc_interval = DEFAULT_RC_INTERVAL,
4283 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4284 .module_name = "dib0700",
4285 .rc_query = dib0700_rc_query_old_firmware,
4286 .allowed_protos = RC_PROTO_BIT_RC5 |
4287 RC_PROTO_BIT_RC6_MCE |
4289 .change_protocol = dib0700_change_protocol,
4291 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4296 DIB0700_NUM_FRONTENDS(1),
4298 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4299 .pid_filter_count = 32,
4300 .pid_filter = stk70x0p_pid_filter,
4301 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4302 .frontend_attach = novatd_frontend_attach,
4303 .tuner_attach = dib7070p_tuner_attach,
4305 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4308 DIB0700_NUM_FRONTENDS(1),
4310 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4311 .pid_filter_count = 32,
4312 .pid_filter = stk70x0p_pid_filter,
4313 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4314 .frontend_attach = novatd_frontend_attach,
4315 .tuner_attach = dib7070p_tuner_attach,
4317 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4322 .num_device_descs = 3,
4324 { "Hauppauge Nova-TD Stick (52009)",
4325 { &dib0700_usb_id_table[35], NULL },
4329 { &dib0700_usb_id_table[81], NULL },
4333 { &dib0700_usb_id_table[82], NULL },
4339 .rc_interval = DEFAULT_RC_INTERVAL,
4340 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4341 .module_name = "dib0700",
4342 .rc_query = dib0700_rc_query_old_firmware,
4343 .allowed_protos = RC_PROTO_BIT_RC5 |
4344 RC_PROTO_BIT_RC6_MCE |
4346 .change_protocol = dib0700_change_protocol,
4348 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4353 DIB0700_NUM_FRONTENDS(1),
4355 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4356 .pid_filter_count = 32,
4357 .pid_filter = stk70x0p_pid_filter,
4358 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4359 .frontend_attach = stk7070pd_frontend_attach0,
4360 .tuner_attach = dib7070p_tuner_attach,
4362 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4365 DIB0700_NUM_FRONTENDS(1),
4367 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4368 .pid_filter_count = 32,
4369 .pid_filter = stk70x0p_pid_filter,
4370 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4371 .frontend_attach = stk7070pd_frontend_attach1,
4372 .tuner_attach = dib7070p_tuner_attach,
4374 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4379 .num_device_descs = 5,
4381 { "DiBcom STK7070PD reference design",
4382 { &dib0700_usb_id_table[17], NULL },
4385 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
4386 { &dib0700_usb_id_table[18], NULL },
4389 { "Hauppauge Nova-TD-500 (84xxx)",
4390 { &dib0700_usb_id_table[36], NULL },
4393 { "Terratec Cinergy DT USB XS Diversity/ T5",
4394 { &dib0700_usb_id_table[43],
4395 &dib0700_usb_id_table[53], NULL},
4399 { &dib0700_usb_id_table[44], NULL },
4405 .rc_interval = DEFAULT_RC_INTERVAL,
4406 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4407 .module_name = "dib0700",
4408 .rc_query = dib0700_rc_query_old_firmware,
4409 .allowed_protos = RC_PROTO_BIT_RC5 |
4410 RC_PROTO_BIT_RC6_MCE |
4412 .change_protocol = dib0700_change_protocol,
4414 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4419 DIB0700_NUM_FRONTENDS(1),
4421 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4422 .pid_filter_count = 32,
4423 .pid_filter = stk70x0p_pid_filter,
4424 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4425 .frontend_attach = stk7070pd_frontend_attach0,
4426 .tuner_attach = dib7070p_tuner_attach,
4428 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4431 DIB0700_NUM_FRONTENDS(1),
4433 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4434 .pid_filter_count = 32,
4435 .pid_filter = stk70x0p_pid_filter,
4436 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4437 .frontend_attach = stk7070pd_frontend_attach1,
4438 .tuner_attach = dib7070p_tuner_attach,
4440 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4445 .num_device_descs = 1,
4447 { "Elgato EyeTV Diversity",
4448 { &dib0700_usb_id_table[68], NULL },
4454 .rc_interval = DEFAULT_RC_INTERVAL,
4455 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
4456 .module_name = "dib0700",
4457 .rc_query = dib0700_rc_query_old_firmware,
4458 .allowed_protos = RC_PROTO_BIT_RC5 |
4459 RC_PROTO_BIT_RC6_MCE |
4461 .change_protocol = dib0700_change_protocol,
4463 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4468 DIB0700_NUM_FRONTENDS(1),
4470 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4471 .pid_filter_count = 32,
4472 .pid_filter = stk70x0p_pid_filter,
4473 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4474 .frontend_attach = stk7700ph_frontend_attach,
4475 .tuner_attach = stk7700ph_tuner_attach,
4477 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4482 .num_device_descs = 10,
4484 { "Terratec Cinergy HT USB XE",
4485 { &dib0700_usb_id_table[27], NULL },
4488 { "Pinnacle Expresscard 320cx",
4489 { &dib0700_usb_id_table[28], NULL },
4492 { "Terratec Cinergy HT Express",
4493 { &dib0700_usb_id_table[32], NULL },
4496 { "Gigabyte U8000-RH",
4497 { &dib0700_usb_id_table[37], NULL },
4500 { "YUAN High-Tech STK7700PH",
4501 { &dib0700_usb_id_table[38], NULL },
4504 { "Asus My Cinema-U3000Hybrid",
4505 { &dib0700_usb_id_table[39], NULL },
4508 { "YUAN High-Tech MC770",
4509 { &dib0700_usb_id_table[48], NULL },
4512 { "Leadtek WinFast DTV Dongle H",
4513 { &dib0700_usb_id_table[51], NULL },
4516 { "YUAN High-Tech STK7700D",
4517 { &dib0700_usb_id_table[54], NULL },
4520 { "Hama DVB=T Hybrid USB Stick",
4521 { &dib0700_usb_id_table[85], NULL },
4527 .rc_interval = DEFAULT_RC_INTERVAL,
4528 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4529 .module_name = "dib0700",
4530 .rc_query = dib0700_rc_query_old_firmware,
4531 .allowed_protos = RC_PROTO_BIT_RC5 |
4532 RC_PROTO_BIT_RC6_MCE |
4534 .change_protocol = dib0700_change_protocol,
4536 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4540 DIB0700_NUM_FRONTENDS(1),
4542 .frontend_attach = s5h1411_frontend_attach,
4543 .tuner_attach = xc5000_tuner_attach,
4545 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4550 .num_device_descs = 2,
4552 { "Pinnacle PCTV HD Pro USB Stick",
4553 { &dib0700_usb_id_table[40], NULL },
4556 { "Pinnacle PCTV HD USB Stick",
4557 { &dib0700_usb_id_table[41], NULL },
4563 .rc_interval = DEFAULT_RC_INTERVAL,
4564 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4565 .module_name = "dib0700",
4566 .rc_query = dib0700_rc_query_old_firmware,
4567 .allowed_protos = RC_PROTO_BIT_RC5 |
4568 RC_PROTO_BIT_RC6_MCE |
4570 .change_protocol = dib0700_change_protocol,
4572 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4576 DIB0700_NUM_FRONTENDS(1),
4578 .frontend_attach = lgdt3305_frontend_attach,
4579 .tuner_attach = mxl5007t_tuner_attach,
4581 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4586 .num_device_descs = 2,
4588 { "Hauppauge ATSC MiniCard (B200)",
4589 { &dib0700_usb_id_table[46], NULL },
4592 { "Hauppauge ATSC MiniCard (B210)",
4593 { &dib0700_usb_id_table[47], NULL },
4597 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4602 DIB0700_NUM_FRONTENDS(1),
4604 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4605 .pid_filter_count = 32,
4606 .pid_filter = stk70x0p_pid_filter,
4607 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4608 .frontend_attach = stk7770p_frontend_attach,
4609 .tuner_attach = dib7770p_tuner_attach,
4611 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4616 .num_device_descs = 4,
4618 { "DiBcom STK7770P reference design",
4619 { &dib0700_usb_id_table[59], NULL },
4622 { "Terratec Cinergy T USB XXS (HD)/ T3",
4623 { &dib0700_usb_id_table[33],
4624 &dib0700_usb_id_table[52],
4625 &dib0700_usb_id_table[60], NULL},
4628 { "TechniSat AirStar TeleStick 2",
4629 { &dib0700_usb_id_table[74], NULL },
4632 { "Medion CTX1921 DVB-T USB",
4633 { &dib0700_usb_id_table[75], NULL },
4639 .rc_interval = DEFAULT_RC_INTERVAL,
4640 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4641 .module_name = "dib0700",
4642 .rc_query = dib0700_rc_query_old_firmware,
4643 .allowed_protos = RC_PROTO_BIT_RC5 |
4644 RC_PROTO_BIT_RC6_MCE |
4646 .change_protocol = dib0700_change_protocol,
4648 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4652 DIB0700_NUM_FRONTENDS(1),
4654 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4655 .pid_filter_count = 32,
4656 .pid_filter = stk80xx_pid_filter,
4657 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4658 .frontend_attach = stk807x_frontend_attach,
4659 .tuner_attach = dib807x_tuner_attach,
4661 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4666 .num_device_descs = 3,
4668 { "DiBcom STK807xP reference design",
4669 { &dib0700_usb_id_table[62], NULL },
4672 { "Prolink Pixelview SBTVD",
4673 { &dib0700_usb_id_table[63], NULL },
4676 { "EvolutePC TVWay+",
4677 { &dib0700_usb_id_table[64], NULL },
4683 .rc_interval = DEFAULT_RC_INTERVAL,
4684 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
4685 .module_name = "dib0700",
4686 .rc_query = dib0700_rc_query_old_firmware,
4687 .allowed_protos = RC_PROTO_BIT_RC5 |
4688 RC_PROTO_BIT_RC6_MCE |
4690 .change_protocol = dib0700_change_protocol,
4692 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4696 DIB0700_NUM_FRONTENDS(1),
4698 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4699 .pid_filter_count = 32,
4700 .pid_filter = stk80xx_pid_filter,
4701 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4702 .frontend_attach = stk807xpvr_frontend_attach0,
4703 .tuner_attach = dib807x_tuner_attach,
4705 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4709 DIB0700_NUM_FRONTENDS(1),
4711 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4712 .pid_filter_count = 32,
4713 .pid_filter = stk80xx_pid_filter,
4714 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4715 .frontend_attach = stk807xpvr_frontend_attach1,
4716 .tuner_attach = dib807x_tuner_attach,
4718 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4723 .num_device_descs = 1,
4725 { "DiBcom STK807xPVR reference design",
4726 { &dib0700_usb_id_table[61], NULL },
4732 .rc_interval = DEFAULT_RC_INTERVAL,
4733 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4734 .module_name = "dib0700",
4735 .rc_query = dib0700_rc_query_old_firmware,
4736 .allowed_protos = RC_PROTO_BIT_RC5 |
4737 RC_PROTO_BIT_RC6_MCE |
4739 .change_protocol = dib0700_change_protocol,
4741 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4745 DIB0700_NUM_FRONTENDS(1),
4747 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4748 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4749 .pid_filter_count = 32,
4750 .pid_filter = stk80xx_pid_filter,
4751 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4752 .frontend_attach = stk809x_frontend_attach,
4753 .tuner_attach = dib809x_tuner_attach,
4755 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4760 .num_device_descs = 1,
4762 { "DiBcom STK8096GP reference design",
4763 { &dib0700_usb_id_table[67], NULL },
4769 .rc_interval = DEFAULT_RC_INTERVAL,
4770 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4771 .module_name = "dib0700",
4772 .rc_query = dib0700_rc_query_old_firmware,
4773 .allowed_protos = RC_PROTO_BIT_RC5 |
4774 RC_PROTO_BIT_RC6_MCE |
4776 .change_protocol = dib0700_change_protocol,
4778 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4782 DIB0700_NUM_FRONTENDS(1),
4784 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4785 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4786 .pid_filter_count = 32,
4787 .pid_filter = dib90x0_pid_filter,
4788 .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
4789 .frontend_attach = stk9090m_frontend_attach,
4790 .tuner_attach = dib9090_tuner_attach,
4792 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4797 .num_device_descs = 1,
4799 { "DiBcom STK9090M reference design",
4800 { &dib0700_usb_id_table[69], NULL },
4806 .rc_interval = DEFAULT_RC_INTERVAL,
4807 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4808 .module_name = "dib0700",
4809 .rc_query = dib0700_rc_query_old_firmware,
4810 .allowed_protos = RC_PROTO_BIT_RC5 |
4811 RC_PROTO_BIT_RC6_MCE |
4813 .change_protocol = dib0700_change_protocol,
4815 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4819 DIB0700_NUM_FRONTENDS(1),
4821 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4822 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4823 .pid_filter_count = 32,
4824 .pid_filter = stk80xx_pid_filter,
4825 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4826 .frontend_attach = nim8096md_frontend_attach,
4827 .tuner_attach = nim8096md_tuner_attach,
4829 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4834 .num_device_descs = 1,
4836 { "DiBcom NIM8096MD reference design",
4837 { &dib0700_usb_id_table[70], NULL },
4843 .rc_interval = DEFAULT_RC_INTERVAL,
4844 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4845 .module_name = "dib0700",
4846 .rc_query = dib0700_rc_query_old_firmware,
4847 .allowed_protos = RC_PROTO_BIT_RC5 |
4848 RC_PROTO_BIT_RC6_MCE |
4850 .change_protocol = dib0700_change_protocol,
4852 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4856 DIB0700_NUM_FRONTENDS(1),
4858 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4859 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4860 .pid_filter_count = 32,
4861 .pid_filter = dib90x0_pid_filter,
4862 .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
4863 .frontend_attach = nim9090md_frontend_attach,
4864 .tuner_attach = nim9090md_tuner_attach,
4866 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4871 .num_device_descs = 1,
4873 { "DiBcom NIM9090MD reference design",
4874 { &dib0700_usb_id_table[71], NULL },
4880 .rc_interval = DEFAULT_RC_INTERVAL,
4881 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4882 .module_name = "dib0700",
4883 .rc_query = dib0700_rc_query_old_firmware,
4884 .allowed_protos = RC_PROTO_BIT_RC5 |
4885 RC_PROTO_BIT_RC6_MCE |
4887 .change_protocol = dib0700_change_protocol,
4889 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4893 DIB0700_NUM_FRONTENDS(1),
4895 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4896 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4897 .pid_filter_count = 32,
4898 .pid_filter = stk70x0p_pid_filter,
4899 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4900 .frontend_attach = nim7090_frontend_attach,
4901 .tuner_attach = nim7090_tuner_attach,
4903 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4908 .num_device_descs = 1,
4910 { "DiBcom NIM7090 reference design",
4911 { &dib0700_usb_id_table[72], NULL },
4917 .rc_interval = DEFAULT_RC_INTERVAL,
4918 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4919 .module_name = "dib0700",
4920 .rc_query = dib0700_rc_query_old_firmware,
4921 .allowed_protos = RC_PROTO_BIT_RC5 |
4922 RC_PROTO_BIT_RC6_MCE |
4924 .change_protocol = dib0700_change_protocol,
4926 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4930 DIB0700_NUM_FRONTENDS(1),
4932 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4933 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4934 .pid_filter_count = 32,
4935 .pid_filter = stk70x0p_pid_filter,
4936 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4937 .frontend_attach = tfe7090pvr_frontend0_attach,
4938 .tuner_attach = tfe7090pvr_tuner0_attach,
4940 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4944 DIB0700_NUM_FRONTENDS(1),
4946 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4947 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4948 .pid_filter_count = 32,
4949 .pid_filter = stk70x0p_pid_filter,
4950 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4951 .frontend_attach = tfe7090pvr_frontend1_attach,
4952 .tuner_attach = tfe7090pvr_tuner1_attach,
4954 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4959 .num_device_descs = 1,
4961 { "DiBcom TFE7090PVR reference design",
4962 { &dib0700_usb_id_table[73], NULL },
4968 .rc_interval = DEFAULT_RC_INTERVAL,
4969 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4970 .module_name = "dib0700",
4971 .rc_query = dib0700_rc_query_old_firmware,
4972 .allowed_protos = RC_PROTO_BIT_RC5 |
4973 RC_PROTO_BIT_RC6_MCE |
4975 .change_protocol = dib0700_change_protocol,
4977 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4981 DIB0700_NUM_FRONTENDS(1),
4983 .frontend_attach = pctv340e_frontend_attach,
4984 .tuner_attach = xc4000_tuner_attach,
4986 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4991 .num_device_descs = 2,
4993 { "Pinnacle PCTV 340e HD Pro USB Stick",
4994 { &dib0700_usb_id_table[76], NULL },
4997 { "Pinnacle PCTV Hybrid Stick Solo",
4998 { &dib0700_usb_id_table[77], NULL },
5003 .rc_interval = DEFAULT_RC_INTERVAL,
5004 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
5005 .module_name = "dib0700",
5006 .rc_query = dib0700_rc_query_old_firmware,
5007 .allowed_protos = RC_PROTO_BIT_RC5 |
5008 RC_PROTO_BIT_RC6_MCE |
5010 .change_protocol = dib0700_change_protocol,
5012 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
5016 DIB0700_NUM_FRONTENDS(1),
5018 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
5019 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
5020 .pid_filter_count = 32,
5021 .pid_filter = stk70x0p_pid_filter,
5022 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
5023 .frontend_attach = tfe7790p_frontend_attach,
5024 .tuner_attach = tfe7790p_tuner_attach,
5026 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
5031 .num_device_descs = 1,
5033 { "DiBcom TFE7790P reference design",
5034 { &dib0700_usb_id_table[78], NULL },
5040 .rc_interval = DEFAULT_RC_INTERVAL,
5041 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
5042 .module_name = "dib0700",
5043 .rc_query = dib0700_rc_query_old_firmware,
5044 .allowed_protos = RC_PROTO_BIT_RC5 |
5045 RC_PROTO_BIT_RC6_MCE |
5047 .change_protocol = dib0700_change_protocol,
5049 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
5053 DIB0700_NUM_FRONTENDS(1),
5055 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
5056 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
5057 .pid_filter_count = 32,
5058 .pid_filter = stk80xx_pid_filter,
5059 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
5060 .frontend_attach = tfe8096p_frontend_attach,
5061 .tuner_attach = tfe8096p_tuner_attach,
5063 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
5069 .num_device_descs = 1,
5071 { "DiBcom TFE8096P reference design",
5072 { &dib0700_usb_id_table[79], NULL },
5078 .rc_interval = DEFAULT_RC_INTERVAL,
5079 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
5080 .module_name = "dib0700",
5081 .rc_query = dib0700_rc_query_old_firmware,
5082 .allowed_protos = RC_PROTO_BIT_RC5 |
5083 RC_PROTO_BIT_RC6_MCE |
5085 .change_protocol = dib0700_change_protocol,
5087 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
5093 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
5094 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
5095 .pid_filter_count = 32,
5096 .pid_filter = stk80xx_pid_filter,
5097 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
5098 .frontend_attach = stk809x_frontend_attach,
5099 .tuner_attach = dib809x_tuner_attach,
5101 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
5104 sizeof(struct dib0700_adapter_state),
5108 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
5109 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
5110 .pid_filter_count = 32,
5111 .pid_filter = stk80xx_pid_filter,
5112 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
5113 .frontend_attach = stk809x_frontend1_attach,
5114 .tuner_attach = dib809x_tuner_attach,
5116 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
5119 sizeof(struct dib0700_adapter_state),
5122 .num_device_descs = 1,
5124 { "DiBcom STK8096-PVR reference design",
5125 { &dib0700_usb_id_table[83],
5126 &dib0700_usb_id_table[84], NULL},
5132 .rc_interval = DEFAULT_RC_INTERVAL,
5133 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
5134 .module_name = "dib0700",
5135 .rc_query = dib0700_rc_query_old_firmware,
5136 .allowed_protos = RC_PROTO_BIT_RC5 |
5137 RC_PROTO_BIT_RC6_MCE |
5139 .change_protocol = dib0700_change_protocol,
5141 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
5145 DIB0700_NUM_FRONTENDS(1),
5147 .frontend_attach = xbox_one_attach,
5149 DIB0700_DEFAULT_STREAMING_CONFIG(0x82),
5153 .num_device_descs = 1,
5155 { "Microsoft Xbox One Digital TV Tuner",
5156 { &dib0700_usb_id_table[86], NULL },
5163 int dib0700_device_count = ARRAY_SIZE(dib0700_devices);