1 /* Linux driver for devices based on the DiBcom DiB0700 USB bridge
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the Free
5 * Software Foundation, version 2.
7 * Copyright (C) 2005-9 DiBcom, SA et al
11 #include "dib3000mc.h"
18 #include "tuner-xc2028.h"
27 static int force_lna_activation;
28 module_param(force_lna_activation, int, 0644);
29 MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), "
30 "if applicable for the device (default: 0=automatic/off).");
32 struct dib0700_adapter_state {
33 int (*set_param_save) (struct dvb_frontend *);
34 const struct firmware *frontend_firmware;
35 struct dib7000p_ops dib7000p_ops;
36 struct dib8000_ops dib8000_ops;
39 /* Hauppauge Nova-T 500 (aka Bristol)
40 * has a LNA on GPIO0 which is enabled by setting 1 */
41 static struct mt2060_config bristol_mt2060_config[2] = {
51 static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
52 .band_caps = BAND_VHF | BAND_UHF,
53 .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
73 static struct dib3000mc_config bristol_dib3000mc_config[2] = {
74 { .agc = &bristol_dib3000p_mt2060_agc_config,
76 .ln_adc_level = 0x1cc7,
77 .output_mpeg2_in_188_bytes = 1,
79 { .agc = &bristol_dib3000p_mt2060_agc_config,
81 .ln_adc_level = 0x1cc7,
82 .output_mpeg2_in_188_bytes = 1,
86 static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
88 struct dib0700_state *st = adap->dev->priv;
90 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
91 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
92 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
93 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
95 if (force_lna_activation)
96 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
98 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
100 if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {
101 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
105 st->mt2060_if1[adap->id] = 1220;
106 return (adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
107 (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
110 static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval)
112 struct i2c_msg msg[2] = {
113 { .addr = 0x50, .flags = 0, .buf = &adrs, .len = 1 },
114 { .addr = 0x50, .flags = I2C_M_RD, .buf = pval, .len = 1 },
116 if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO;
120 static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
122 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
123 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe_adap[0].fe, 1);
126 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
127 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) {
128 if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;
130 return dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c,
131 &bristol_mt2060_config[adap->id], if1) == NULL ?
135 /* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
138 static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = {
142 /* 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,
143 * 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 */
144 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
145 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
180 BAND_VHF | BAND_LBAND,
182 /* 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,
183 * 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 */
184 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
185 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
222 static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = {
235 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
240 static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {
241 { .output_mpeg2_in_188_bytes = 1,
242 .hostbus_diversity = 1,
243 .tuner_is_baseband = 1,
245 .agc_config_count = 2,
246 .agc = stk7700d_7000p_mt2266_agc_config,
247 .bw = &stk7700d_mt2266_pll_config,
249 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
250 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
251 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
253 { .output_mpeg2_in_188_bytes = 1,
254 .hostbus_diversity = 1,
255 .tuner_is_baseband = 1,
257 .agc_config_count = 2,
258 .agc = stk7700d_7000p_mt2266_agc_config,
259 .bw = &stk7700d_mt2266_pll_config,
261 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
262 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
263 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
267 static struct mt2266_config stk7700d_mt2266_config[2] = {
268 { .i2c_address = 0x60
270 { .i2c_address = 0x60
274 static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap)
276 struct dib0700_adapter_state *state = adap->priv;
278 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
282 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
284 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
285 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
286 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
287 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
289 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
291 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
292 stk7700d_dib7000p_mt2266_config)
294 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
295 dvb_detach(&state->dib7000p_ops);
300 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap,
301 0x80 + (adap->id << 1),
302 &stk7700d_dib7000p_mt2266_config[adap->id]);
304 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
307 static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap)
309 struct dib0700_adapter_state *state = adap->priv;
311 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
315 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
317 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
318 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
319 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
320 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
322 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
324 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
325 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
326 stk7700d_dib7000p_mt2266_config)
328 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
329 dvb_detach(&state->dib7000p_ops);
334 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap,
335 0x80 + (adap->id << 1),
336 &stk7700d_dib7000p_mt2266_config[adap->id]);
338 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
341 static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap)
343 struct i2c_adapter *tun_i2c;
344 struct dib0700_adapter_state *state = adap->priv;
346 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
347 DIBX000_I2C_INTERFACE_TUNER, 1);
348 return dvb_attach(mt2266_attach, adap->fe_adap[0].fe, tun_i2c,
349 &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;
352 /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
353 static struct dibx000_agc_config xc3028_agc_config = {
354 .band_caps = BAND_VHF | BAND_UHF,
355 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
356 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
357 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
358 .setup = (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
384 .perform_agc_softsplit = 1,
387 /* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
388 static struct dibx000_bandwidth_config xc3028_bw_config = {
401 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
402 .ifreq = (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
407 static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
408 .output_mpeg2_in_188_bytes = 1,
409 .tuner_is_baseband = 1,
411 .agc_config_count = 1,
412 .agc = &xc3028_agc_config,
413 .bw = &xc3028_bw_config,
415 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
416 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
417 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
420 static int stk7700ph_xc3028_callback(void *ptr, int component,
421 int command, int arg)
423 struct dvb_usb_adapter *adap = ptr;
424 struct dib0700_adapter_state *state = adap->priv;
427 case XC2028_TUNER_RESET:
428 /* Send the tuner in then out of reset */
429 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 0);
431 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
433 case XC2028_RESET_CLK:
436 err("%s: unknown command %d, arg %d\n", __func__,
443 static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
444 .fname = XC2028_DEFAULT_FIRMWARE,
446 .demod = XC3028_FE_DIBCOM52,
449 static struct xc2028_config stk7700ph_xc3028_config = {
451 .ctrl = &stk7700ph_xc3028_ctrl,
454 static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
456 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;
457 struct dib0700_adapter_state *state = adap->priv;
459 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
462 if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
463 desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))
464 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
466 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
468 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
469 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
470 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
471 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
473 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
475 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
478 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
479 &stk7700ph_dib7700_xc3028_config) != 0) {
480 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
482 dvb_detach(&state->dib7000p_ops);
486 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80,
487 &stk7700ph_dib7700_xc3028_config);
489 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
492 static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
494 struct i2c_adapter *tun_i2c;
495 struct dib0700_adapter_state *state = adap->priv;
497 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
498 DIBX000_I2C_INTERFACE_TUNER, 1);
500 stk7700ph_xc3028_config.i2c_adap = tun_i2c;
502 /* FIXME: generalize & move to common area */
503 adap->fe_adap[0].fe->callback = stk7700ph_xc3028_callback;
505 return dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &stk7700ph_xc3028_config)
506 == NULL ? -ENODEV : 0;
509 #define DEFAULT_RC_INTERVAL 50
511 static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
514 * This function is used only when firmware is < 1.20 version. Newer
515 * firmwares use bulk mode, with functions implemented at dib0700_core,
516 * at dib0700_rc_urb_completion()
518 static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d)
521 enum rc_type 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 i = dib0700_ctrl_rd(d, rc_request, 2, key, 4);
537 err("RC Query Failed");
541 /* losing half of KEY_0 events from Philipps rc5 remotes.. */
542 if (key[0] == 0 && key[1] == 0 && key[2] == 0 && key[3] == 0)
545 /* info("%d: %2X %2X %2X %2X",dvb_usb_dib0700_ir_proto,(int)key[3-2],(int)key[3-3],(int)key[3-1],(int)key[3]); */
547 dib0700_rc_setup(d, NULL); /* reset ir sensor data to prevent false events */
549 switch (d->props.rc.core.protocol) {
551 /* NEC protocol sends repeat code as 0 0 0 FF */
552 if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&
554 rc_repeat(d->rc_dev);
558 protocol = RC_TYPE_NEC;
559 scancode = RC_SCANCODE_NEC(key[3-2], key[3-3]);
564 /* RC-5 protocol changes toggle bit on new keypress */
565 protocol = RC_TYPE_RC5;
566 scancode = RC_SCANCODE_RC5(key[3-2], key[3-3]);
571 rc_keydown(d->rc_dev, protocol, scancode, toggle);
575 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
576 static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
579 /* 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,
580 * 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 */
581 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
582 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
622 static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
623 .band_caps = BAND_UHF | BAND_VHF,
624 /* 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,
625 * 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 */
626 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
652 .perform_agc_softsplit = 0,
655 static struct dibx000_bandwidth_config stk7700p_pll_config = {
668 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
674 static struct dib7000m_config stk7700p_dib7000m_config = {
676 .output_mpeg2_in_188_bytes = 1,
679 .agc_config_count = 1,
680 .agc = &stk7700p_7000m_mt2060_agc_config,
681 .bw = &stk7700p_pll_config,
683 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
684 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
685 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
688 static struct dib7000p_config stk7700p_dib7000p_config = {
689 .output_mpeg2_in_188_bytes = 1,
691 .agc_config_count = 1,
692 .agc = &stk7700p_7000p_mt2060_agc_config,
693 .bw = &stk7700p_pll_config,
695 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
696 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
697 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
700 static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
702 struct dib0700_state *st = adap->dev->priv;
703 struct dib0700_adapter_state *state = adap->priv;
705 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
708 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
710 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
711 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
713 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
714 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
716 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
717 dib0700_ctrl_clock(adap->dev, 72, 1);
718 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
720 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
722 st->mt2060_if1[0] = 1220;
724 if (state->dib7000p_ops.dib7000pc_detection(&adap->dev->i2c_adap)) {
725 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
726 st->is_dib7000pc = 1;
728 memset(&state->dib7000p_ops, 0, sizeof(state->dib7000p_ops));
729 adap->fe_adap[0].fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
732 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
735 static struct mt2060_config stk7700p_mt2060_config = {
739 static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
741 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
742 struct dib0700_state *st = adap->dev->priv;
743 struct i2c_adapter *tun_i2c;
744 struct dib0700_adapter_state *state = adap->priv;
748 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
749 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
750 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
752 if (st->is_dib7000pc)
753 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
755 tun_i2c = dib7000m_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
757 return dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, &stk7700p_mt2060_config,
758 if1) == NULL ? -ENODEV : 0;
761 /* DIB7070 generic */
762 static struct dibx000_agc_config dib7070_agc_config = {
763 .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
764 /* 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,
765 * 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 */
766 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
792 .perform_agc_softsplit = 0,
795 static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
797 struct dvb_usb_adapter *adap = fe->dvb->priv;
798 struct dib0700_adapter_state *state = adap->priv;
800 deb_info("reset: %d", onoff);
801 return state->dib7000p_ops.set_gpio(fe, 8, 0, !onoff);
804 static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
806 struct dvb_usb_adapter *adap = fe->dvb->priv;
807 struct dib0700_adapter_state *state = adap->priv;
809 deb_info("sleep: %d", onoff);
810 return state->dib7000p_ops.set_gpio(fe, 9, 0, onoff);
813 static struct dib0070_config dib7070p_dib0070_config[2] = {
815 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
816 .reset = dib7070_tuner_reset,
817 .sleep = dib7070_tuner_sleep,
819 .clock_pad_drive = 4,
822 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
823 .reset = dib7070_tuner_reset,
824 .sleep = dib7070_tuner_sleep,
830 static struct dib0070_config dib7770p_dib0070_config = {
831 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
832 .reset = dib7070_tuner_reset,
833 .sleep = dib7070_tuner_sleep,
835 .clock_pad_drive = 0,
840 static int dib7070_set_param_override(struct dvb_frontend *fe)
842 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
843 struct dvb_usb_adapter *adap = fe->dvb->priv;
844 struct dib0700_adapter_state *state = adap->priv;
847 u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
849 case BAND_VHF: offset = 950; break;
851 default: offset = 550; break;
853 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
854 state->dib7000p_ops.set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
855 return state->set_param_save(fe);
858 static int dib7770_set_param_override(struct dvb_frontend *fe)
860 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
861 struct dvb_usb_adapter *adap = fe->dvb->priv;
862 struct dib0700_adapter_state *state = adap->priv;
865 u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
868 state->dib7000p_ops.set_gpio(fe, 0, 0, 1);
873 state->dib7000p_ops.set_gpio(fe, 0, 0, 0);
877 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
878 state->dib7000p_ops.set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
879 return state->set_param_save(fe);
882 static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
884 struct dib0700_adapter_state *st = adap->priv;
885 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
886 DIBX000_I2C_INTERFACE_TUNER, 1);
888 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
889 &dib7770p_dib0070_config) == NULL)
892 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
893 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7770_set_param_override;
897 static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
899 struct dib0700_adapter_state *st = adap->priv;
900 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
903 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
906 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
910 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
911 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override;
915 static int stk7700p_pid_filter(struct dvb_usb_adapter *adapter, int index,
918 struct dib0700_adapter_state *state = adapter->priv;
919 struct dib0700_state *st = adapter->dev->priv;
921 if (st->is_dib7000pc)
922 return state->dib7000p_ops.pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
923 return dib7000m_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
926 static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
928 struct dib0700_state *st = adapter->dev->priv;
929 struct dib0700_adapter_state *state = adapter->priv;
930 if (st->is_dib7000pc)
931 return state->dib7000p_ops.pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
932 return dib7000m_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
935 static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
937 struct dib0700_adapter_state *state = adapter->priv;
938 return state->dib7000p_ops.pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
941 static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
943 struct dib0700_adapter_state *state = adapter->priv;
944 return state->dib7000p_ops.pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
947 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
960 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
961 .ifreq = (0 << 25) | 0,
966 static struct dib7000p_config dib7070p_dib7000p_config = {
967 .output_mpeg2_in_188_bytes = 1,
969 .agc_config_count = 1,
970 .agc = &dib7070_agc_config,
971 .bw = &dib7070_bw_config_12_mhz,
972 .tuner_is_baseband = 1,
975 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
976 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
977 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
979 .hostbus_diversity = 1,
983 static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
985 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
986 struct dib0700_adapter_state *state = adap->priv;
988 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
991 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
992 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
993 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
995 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
997 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
998 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
999 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1000 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1002 dib0700_ctrl_clock(adap->dev, 72, 1);
1005 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1007 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1009 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1010 &dib7070p_dib7000p_config) != 0) {
1011 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
1013 dvb_detach(&state->dib7000p_ops);
1017 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80,
1018 &dib7070p_dib7000p_config);
1019 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1023 static struct dib7000p_config dib7770p_dib7000p_config = {
1024 .output_mpeg2_in_188_bytes = 1,
1026 .agc_config_count = 1,
1027 .agc = &dib7070_agc_config,
1028 .bw = &dib7070_bw_config_12_mhz,
1029 .tuner_is_baseband = 1,
1032 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1033 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1034 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1036 .hostbus_diversity = 1,
1037 .enable_current_mirror = 1,
1038 .disable_sample_and_hold = 0,
1041 static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap)
1043 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
1044 struct dib0700_adapter_state *state = adap->priv;
1046 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
1049 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
1050 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
1051 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1053 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1055 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1056 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1057 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1058 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1060 dib0700_ctrl_clock(adap->dev, 72, 1);
1063 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1065 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1067 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1068 &dib7770p_dib7000p_config) != 0) {
1069 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
1071 dvb_detach(&state->dib7000p_ops);
1075 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80,
1076 &dib7770p_dib7000p_config);
1077 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1080 /* DIB807x generic */
1081 static struct dibx000_agc_config dib807x_agc_config[2] = {
1084 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1085 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1086 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1087 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1089 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1090 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1091 (0 << 0), /* setup*/
1094 10, /* time_stabiliz*/
1104 65535, /* agc1_max*/
1107 65535, /* agc2_max*/
1113 206, /* agc1_slope1*/
1114 255, /* agc1_slope2*/
1117 88, /* agc2_slope1*/
1118 90, /* agc2_slope2*/
1125 0, /* perform_agc_softsplit*/
1128 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1129 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1130 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1131 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1133 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1134 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1135 (0 << 0), /* setup */
1138 10, /* time_stabiliz*/
1148 65535, /* agc1_max*/
1151 65535, /* agc2_max*/
1157 206, /* agc1_slope1*/
1158 255, /* agc1_slope2*/
1161 88, /* agc2_slope1*/
1162 90, /* agc2_slope2*/
1169 0, /* perform_agc_softsplit*/
1173 static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
1183 .IO_CLK_en_core = 1,
1186 .sad_cfg = (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1187 .ifreq = (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1189 .xtal_hz = 12000000,
1192 static struct dib8000_config dib807x_dib8000_config[2] = {
1194 .output_mpeg2_in_188_bytes = 1,
1196 .agc_config_count = 2,
1197 .agc = dib807x_agc_config,
1198 .pll = &dib807x_bw_config_12_mhz,
1199 .tuner_is_baseband = 1,
1201 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1202 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1203 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1205 .hostbus_diversity = 1,
1207 .agc_control = &dib0070_ctrl_agc_filter,
1208 .output_mode = OUTMODE_MPEG2_FIFO,
1211 .output_mpeg2_in_188_bytes = 1,
1213 .agc_config_count = 2,
1214 .agc = dib807x_agc_config,
1215 .pll = &dib807x_bw_config_12_mhz,
1216 .tuner_is_baseband = 1,
1218 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1219 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1220 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1222 .hostbus_diversity = 1,
1223 .agc_control = &dib0070_ctrl_agc_filter,
1224 .output_mode = OUTMODE_MPEG2_FIFO,
1229 static int dib80xx_tuner_reset(struct dvb_frontend *fe, int onoff)
1231 struct dvb_usb_adapter *adap = fe->dvb->priv;
1232 struct dib0700_adapter_state *state = adap->priv;
1234 return state->dib8000_ops.set_gpio(fe, 5, 0, !onoff);
1237 static int dib80xx_tuner_sleep(struct dvb_frontend *fe, int onoff)
1239 struct dvb_usb_adapter *adap = fe->dvb->priv;
1240 struct dib0700_adapter_state *state = adap->priv;
1242 return state->dib8000_ops.set_gpio(fe, 0, 0, onoff);
1245 static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
1250 static struct dib0070_config dib807x_dib0070_config[2] = {
1252 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1253 .reset = dib80xx_tuner_reset,
1254 .sleep = dib80xx_tuner_sleep,
1256 .clock_pad_drive = 4,
1258 .force_crystal_mode = 1,
1259 .enable_third_order_filter = 1,
1261 .wbd_gain = dib8070_wbd_gain_cfg,
1262 .osc_buffer_state = 0,
1263 .freq_offset_khz_uhf = -100,
1264 .freq_offset_khz_vhf = -100,
1266 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1267 .reset = dib80xx_tuner_reset,
1268 .sleep = dib80xx_tuner_sleep,
1270 .clock_pad_drive = 2,
1272 .force_crystal_mode = 1,
1273 .enable_third_order_filter = 1,
1275 .wbd_gain = dib8070_wbd_gain_cfg,
1276 .osc_buffer_state = 0,
1277 .freq_offset_khz_uhf = -25,
1278 .freq_offset_khz_vhf = -25,
1282 static int dib807x_set_param_override(struct dvb_frontend *fe)
1284 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1285 struct dvb_usb_adapter *adap = fe->dvb->priv;
1286 struct dib0700_adapter_state *state = adap->priv;
1288 u16 offset = dib0070_wbd_offset(fe);
1289 u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
1294 case BAND_UHF: /* fall-thru wanted */
1296 offset += 250; break;
1298 deb_info("WBD for DiB8000: %d\n", offset);
1299 state->dib8000_ops.set_wbd_ref(fe, offset);
1301 return state->set_param_save(fe);
1304 static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1306 struct dib0700_adapter_state *st = adap->priv;
1307 struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe,
1308 DIBX000_I2C_INTERFACE_TUNER, 1);
1310 if (adap->id == 0) {
1311 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
1312 &dib807x_dib0070_config[0]) == NULL)
1315 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
1316 &dib807x_dib0070_config[1]) == NULL)
1320 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1321 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib807x_set_param_override;
1325 static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index,
1328 struct dib0700_adapter_state *state = adapter->priv;
1330 return state->dib8000_ops.pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
1333 static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter,
1336 struct dib0700_adapter_state *state = adapter->priv;
1338 return state->dib8000_ops.pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
1342 static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
1344 struct dib0700_adapter_state *state = adap->priv;
1346 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1349 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1351 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1352 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1353 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1355 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1357 dib0700_ctrl_clock(adap->dev, 72, 1);
1360 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1362 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1364 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1367 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80,
1368 &dib807x_dib8000_config[0]);
1370 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1374 static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
1376 struct dib0700_adapter_state *state = adap->priv;
1378 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1381 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1383 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1385 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1386 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1387 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1389 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1391 dib0700_ctrl_clock(adap->dev, 72, 1);
1394 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1396 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1398 /* initialize IC 0 */
1399 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80, 0);
1401 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80,
1402 &dib807x_dib8000_config[0]);
1404 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1407 static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
1409 struct dib0700_adapter_state *state = adap->priv;
1411 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1414 /* initialize IC 1 */
1415 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82, 0);
1417 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x82,
1418 &dib807x_dib8000_config[1]);
1420 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1424 static struct dibx000_agc_config dib8090_agc_config[2] = {
1426 .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
1427 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1428 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1429 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1430 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1431 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1434 .time_stabiliz = 10,
1465 .perform_agc_softsplit = 0,
1468 .band_caps = BAND_CBAND,
1469 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1470 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1471 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1472 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1473 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1476 .time_stabiliz = 10,
1507 .perform_agc_softsplit = 0,
1511 static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = {
1523 .IO_CLK_en_core = 1,
1527 .sad_cfg = (3 << 14) | (1 << 12) | (599 << 0),
1529 .ifreq = (0 << 25) | 0,
1532 .xtal_hz = 12000000,
1535 static int dib8090_get_adc_power(struct dvb_frontend *fe)
1537 struct dvb_usb_adapter *adap = fe->dvb->priv;
1538 struct dib0700_adapter_state *state = adap->priv;
1540 return state->dib8000_ops.get_adc_power(fe, 1);
1543 static void dib8090_agc_control(struct dvb_frontend *fe, u8 restart)
1545 deb_info("AGC control callback: %i\n", restart);
1546 dib0090_dcc_freq(fe, restart);
1548 if (restart == 0) /* before AGC startup */
1549 dib0090_set_dc_servo(fe, 1);
1552 static struct dib8000_config dib809x_dib8000_config[2] = {
1554 .output_mpeg2_in_188_bytes = 1,
1556 .agc_config_count = 2,
1557 .agc = dib8090_agc_config,
1558 .agc_control = dib8090_agc_control,
1559 .pll = &dib8090_pll_config_12mhz,
1560 .tuner_is_baseband = 1,
1562 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1563 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1564 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1566 .hostbus_diversity = 1,
1568 .output_mode = OUTMODE_MPEG2_FIFO,
1570 .diversity_delay = 48,
1573 .output_mpeg2_in_188_bytes = 1,
1575 .agc_config_count = 2,
1576 .agc = dib8090_agc_config,
1577 .agc_control = dib8090_agc_control,
1578 .pll = &dib8090_pll_config_12mhz,
1579 .tuner_is_baseband = 1,
1581 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1582 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1583 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1585 .hostbus_diversity = 1,
1587 .output_mode = OUTMODE_DIVERSITY,
1589 .diversity_delay = 1,
1594 static struct dib0090_wbd_slope dib8090_wbd_table[] = {
1595 /* max freq ; cold slope ; cold offset ; warm slope ; warm offset ; wbd gain */
1596 { 120, 0, 500, 0, 500, 4 }, /* CBAND */
1597 { 170, 0, 450, 0, 450, 4 }, /* CBAND */
1598 { 380, 48, 373, 28, 259, 6 }, /* VHF */
1599 { 860, 34, 700, 36, 616, 6 }, /* high UHF */
1600 { 0xFFFF, 34, 700, 36, 616, 6 }, /* default */
1603 static struct dib0090_config dib809x_dib0090_config = {
1607 .io.pll_loopdiv = 20,
1608 .io.adc_clock_ratio = 8,
1609 .io.pll_int_loop_filt = 0,
1610 .io.clock_khz = 12000,
1611 .reset = dib80xx_tuner_reset,
1612 .sleep = dib80xx_tuner_sleep,
1615 .i2c_address = DEFAULT_DIB0090_I2C_ADDRESS,
1618 .get_adc_power = dib8090_get_adc_power,
1619 .freq_offset_khz_uhf = -63,
1620 .freq_offset_khz_vhf = -143,
1621 .wbd = dib8090_wbd_table,
1622 .fref_clock_ratio = 6,
1625 static u8 dib8090_compute_pll_parameters(struct dvb_frontend *fe)
1627 u8 optimal_pll_ratio = 20;
1628 u32 freq_adc, ratio, rest, max = 0;
1631 for (pll_ratio = 17; pll_ratio <= 20; pll_ratio++) {
1632 freq_adc = 12 * pll_ratio * (1 << 8) / 16;
1633 ratio = ((fe->dtv_property_cache.frequency / 1000) * (1 << 8) / 1000) / freq_adc;
1634 rest = ((fe->dtv_property_cache.frequency / 1000) * (1 << 8) / 1000) - ratio * freq_adc;
1636 if (rest > freq_adc / 2)
1637 rest = freq_adc - rest;
1638 deb_info("PLL ratio=%i rest=%i\n", pll_ratio, rest);
1639 if ((rest > max) && (rest > 717)) {
1640 optimal_pll_ratio = pll_ratio;
1644 deb_info("optimal PLL ratio=%i\n", optimal_pll_ratio);
1646 return optimal_pll_ratio;
1649 static int dib8096_set_param_override(struct dvb_frontend *fe)
1651 struct dvb_usb_adapter *adap = fe->dvb->priv;
1652 struct dib0700_adapter_state *state = adap->priv;
1653 u8 pll_ratio, band = BAND_OF_FREQUENCY(fe->dtv_property_cache.frequency / 1000);
1654 u16 target, ltgain, rf_gain_limit;
1657 enum frontend_tune_state tune_state = CT_SHUTDOWN;
1661 deb_info("Warning : Rf frequency (%iHz) is not in the supported range, using VHF switch ", fe->dtv_property_cache.frequency);
1663 state->dib8000_ops.set_gpio(fe, 3, 0, 1);
1666 state->dib8000_ops.set_gpio(fe, 3, 0, 0);
1670 ret = state->set_param_save(fe);
1674 if (fe->dtv_property_cache.bandwidth_hz != 6000000) {
1675 deb_info("only 6MHz bandwidth is supported\n");
1679 /** Update PLL if needed ratio **/
1680 state->dib8000_ops.update_pll(fe, &dib8090_pll_config_12mhz, fe->dtv_property_cache.bandwidth_hz / 1000, 0);
1682 /** Get optimize PLL ratio to remove spurious **/
1683 pll_ratio = dib8090_compute_pll_parameters(fe);
1684 if (pll_ratio == 17)
1686 else if (pll_ratio == 18)
1688 else if (pll_ratio == 19)
1693 /** Update ratio **/
1694 state->dib8000_ops.update_pll(fe, &dib8090_pll_config_12mhz, fe->dtv_property_cache.bandwidth_hz / 1000, pll_ratio);
1696 state->dib8000_ops.ctrl_timf(fe, DEMOD_TIMF_SET, timf);
1698 if (band != BAND_CBAND) {
1699 /* dib0090_get_wbd_target is returning any possible temperature compensated wbd-target */
1700 target = (dib0090_get_wbd_target(fe) * 8 * 18 / 33 + 1) / 2;
1701 state->dib8000_ops.set_wbd_ref(fe, target);
1704 if (band == BAND_CBAND) {
1705 deb_info("tuning in CBAND - soft-AGC startup\n");
1706 dib0090_set_tune_state(fe, CT_AGC_START);
1709 ret = dib0090_gain_control(fe);
1711 tune_state = dib0090_get_tune_state(fe);
1712 if (tune_state == CT_AGC_STEP_0)
1713 state->dib8000_ops.set_gpio(fe, 6, 0, 1);
1714 else if (tune_state == CT_AGC_STEP_1) {
1715 dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, <gain);
1716 if (rf_gain_limit < 2000) /* activate the external attenuator in case of very high input power */
1717 state->dib8000_ops.set_gpio(fe, 6, 0, 0);
1719 } while (tune_state < CT_AGC_STOP);
1721 deb_info("switching to PWM AGC\n");
1722 dib0090_pwm_gain_reset(fe);
1723 state->dib8000_ops.pwm_agc_reset(fe);
1724 state->dib8000_ops.set_tune_state(fe, CT_DEMOD_START);
1726 /* for everything else than CBAND we are using standard AGC */
1727 deb_info("not tuning in CBAND - standard AGC startup\n");
1728 dib0090_pwm_gain_reset(fe);
1734 static int dib809x_tuner_attach(struct dvb_usb_adapter *adap)
1736 struct dib0700_adapter_state *st = adap->priv;
1737 struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1739 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1742 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1743 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1747 static int stk809x_frontend_attach(struct dvb_usb_adapter *adap)
1749 struct dib0700_adapter_state *state = adap->priv;
1751 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1754 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1756 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1757 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1758 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1760 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1762 dib0700_ctrl_clock(adap->dev, 72, 1);
1765 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1767 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1769 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80, 0);
1771 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
1773 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1776 static int nim8096md_tuner_attach(struct dvb_usb_adapter *adap)
1778 struct dib0700_adapter_state *st = adap->priv;
1779 struct i2c_adapter *tun_i2c;
1780 struct dvb_frontend *fe_slave = st->dib8000_ops.get_slave_frontend(adap->fe_adap[0].fe, 1);
1783 tun_i2c = st->dib8000_ops.get_i2c_master(fe_slave, DIBX000_I2C_INTERFACE_TUNER, 1);
1784 if (dvb_attach(dib0090_register, fe_slave, tun_i2c, &dib809x_dib0090_config) == NULL)
1786 fe_slave->dvb = adap->fe_adap[0].fe->dvb;
1787 fe_slave->ops.tuner_ops.set_params = dib8096_set_param_override;
1789 tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1790 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1793 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1794 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1799 static int nim8096md_frontend_attach(struct dvb_usb_adapter *adap)
1801 struct dvb_frontend *fe_slave;
1802 struct dib0700_adapter_state *state = adap->priv;
1804 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1807 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1809 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1811 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1812 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1813 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1815 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1817 dib0700_ctrl_clock(adap->dev, 72, 1);
1820 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1822 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1824 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 2, 18, 0x80, 0);
1826 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
1827 if (adap->fe_adap[0].fe == NULL)
1830 /* Needed to increment refcount */
1831 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1834 fe_slave = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x82, &dib809x_dib8000_config[1]);
1835 state->dib8000_ops.set_slave_frontend(adap->fe_adap[0].fe, fe_slave);
1837 return fe_slave == NULL ? -ENODEV : 0;
1841 static struct dibx000_agc_config dib8096p_agc_config[2] = {
1843 .band_caps = BAND_UHF,
1844 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1845 P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1846 P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1847 P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1849 .setup = (0 << 15) | (0 << 14) | (5 << 11)
1850 | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5)
1851 | (0 << 4) | (5 << 1) | (0 << 0),
1854 .time_stabiliz = 10,
1885 .perform_agc_softsplit = 0,
1887 .band_caps = BAND_FM | BAND_VHF | BAND_CBAND,
1888 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1889 P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1890 P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1891 P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1893 .setup = (0 << 15) | (0 << 14) | (5 << 11)
1894 | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5)
1895 | (0 << 4) | (5 << 1) | (0 << 0),
1898 .time_stabiliz = 10,
1929 .perform_agc_softsplit = 0,
1933 static struct dibx000_bandwidth_config dib8096p_clock_config_12_mhz = {
1943 .IO_CLK_en_core = 0,
1946 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
1947 .ifreq = (0 << 25) | 0,
1949 .xtal_hz = 12000000,
1952 static struct dib8000_config tfe8096p_dib8000_config = {
1953 .output_mpeg2_in_188_bytes = 1,
1954 .hostbus_diversity = 1,
1957 .agc_config_count = 2,
1958 .agc = dib8096p_agc_config,
1959 .pll = &dib8096p_clock_config_12_mhz,
1961 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1962 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1963 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1965 .agc_control = NULL,
1966 .diversity_delay = 48,
1967 .output_mode = OUTMODE_MPEG2_FIFO,
1971 static struct dib0090_wbd_slope dib8096p_wbd_table[] = {
1972 { 380, 81, 850, 64, 540, 4},
1973 { 860, 51, 866, 21, 375, 4},
1974 {1700, 0, 250, 0, 100, 6},
1975 {2600, 0, 250, 0, 100, 6},
1976 { 0xFFFF, 0, 0, 0, 0, 0},
1979 static struct dib0090_config tfe8096p_dib0090_config = {
1980 .io.clock_khz = 12000,
1984 .io.pll_loopdiv = 6,
1985 .io.adc_clock_ratio = 0,
1986 .io.pll_int_loop_filt = 0,
1988 .freq_offset_khz_uhf = -143,
1989 .freq_offset_khz_vhf = -143,
1991 .get_adc_power = dib8090_get_adc_power,
1996 .wbd_vhf_offset = 0,
1997 .wbd_cband_offset = 0,
2001 .fref_clock_ratio = 1,
2003 .ls_cfg_pad_drv = 0,
2007 .force_cband_input = 0,
2010 struct dibx090p_adc {
2011 u32 freq; /* RF freq MHz */
2012 u32 timf; /* New Timf */
2013 u32 pll_loopdiv; /* New prediv */
2014 u32 pll_prediv; /* New loopdiv */
2017 struct dibx090p_best_adc {
2023 static int dib8096p_get_best_sampling(struct dvb_frontend *fe, struct dibx090p_best_adc *adc)
2025 u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1;
2027 u16 fcp_min = 1900; /* PLL, Minimum Frequency of phase comparator (KHz) */
2028 u16 fcp_max = 20000; /* PLL, Maximum Frequency of phase comparator (KHz) */
2029 u32 fmem_max = 140000; /* 140MHz max SDRAM freq */
2030 u32 fdem_min = 66000;
2031 u32 fcp = 0, fs = 0, fdem = 0, fmem = 0;
2032 u32 harmonic_id = 0;
2035 adc->pll_loopdiv = loopdiv;
2036 adc->pll_prediv = prediv;
2038 deb_info("bandwidth = %d", fe->dtv_property_cache.bandwidth_hz);
2040 /* Find Min and Max prediv */
2041 while ((xtal / max_prediv) >= fcp_min)
2045 min_prediv = max_prediv;
2046 while ((xtal / min_prediv) <= fcp_max) {
2048 if (min_prediv == 1)
2051 deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv);
2055 for (prediv = min_prediv; prediv < max_prediv; prediv++) {
2056 fcp = xtal / prediv;
2057 if (fcp > fcp_min && fcp < fcp_max) {
2058 for (loopdiv = 1; loopdiv < 64; loopdiv++) {
2059 fmem = ((xtal/prediv) * loopdiv);
2063 /* test min/max system restrictions */
2064 if ((fdem >= fdem_min) && (fmem <= fmem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz / 1000)) {
2066 /* test fs harmonics positions */
2067 for (harmonic_id = (fe->dtv_property_cache.frequency / (1000 * fs)); harmonic_id <= ((fe->dtv_property_cache.frequency / (1000 * fs)) + 1); harmonic_id++) {
2068 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)))) {
2075 adc->pll_loopdiv = loopdiv;
2076 adc->pll_prediv = prediv;
2077 adc->timf = (4260880253U / fdem) * (1 << 8);
2078 adc->timf += ((4260880253U % fdem) << 8) / fdem;
2080 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);
2090 if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0)
2095 static int dib8096p_agc_startup(struct dvb_frontend *fe)
2097 struct dvb_usb_adapter *adap = fe->dvb->priv;
2098 struct dib0700_adapter_state *state = adap->priv;
2099 struct dibx000_bandwidth_config pll;
2100 struct dibx090p_best_adc adc;
2104 ret = state->set_param_save(fe);
2107 memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));
2109 dib0090_pwm_gain_reset(fe);
2110 /* dib0090_get_wbd_target is returning any possible
2111 temperature compensated wbd-target */
2112 target = (dib0090_get_wbd_target(fe) * 8 + 1) / 2;
2113 state->dib8000_ops.set_wbd_ref(fe, target);
2115 if (dib8096p_get_best_sampling(fe, &adc) == 0) {
2116 pll.pll_ratio = adc.pll_loopdiv;
2117 pll.pll_prediv = adc.pll_prediv;
2119 dib0700_set_i2c_speed(adap->dev, 200);
2120 state->dib8000_ops.update_pll(fe, &pll, fe->dtv_property_cache.bandwidth_hz / 1000, 0);
2121 state->dib8000_ops.ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf);
2122 dib0700_set_i2c_speed(adap->dev, 1000);
2127 static int tfe8096p_frontend_attach(struct dvb_usb_adapter *adap)
2129 struct dib0700_state *st = adap->dev->priv;
2131 struct dib0700_adapter_state *state = adap->priv;
2133 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
2136 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
2137 if (fw_version >= 0x10200)
2138 st->fw_use_new_i2c_api = 1;
2140 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2142 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2143 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2144 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2146 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2148 dib0700_ctrl_clock(adap->dev, 72, 1);
2151 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2153 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2155 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80, 1);
2157 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap,
2158 0x80, &tfe8096p_dib8000_config);
2160 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
2163 static int tfe8096p_tuner_attach(struct dvb_usb_adapter *adap)
2165 struct dib0700_adapter_state *st = adap->priv;
2166 struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_tuner(adap->fe_adap[0].fe);
2168 tfe8096p_dib0090_config.reset = st->dib8000_ops.tuner_sleep;
2169 tfe8096p_dib0090_config.sleep = st->dib8000_ops.tuner_sleep;
2170 tfe8096p_dib0090_config.wbd = dib8096p_wbd_table;
2172 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c,
2173 &tfe8096p_dib0090_config) == NULL)
2176 st->dib8000_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
2178 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
2179 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096p_agc_startup;
2184 static int dib90x0_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
2186 return dib9000_fw_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
2189 static int dib90x0_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
2191 return dib9000_fw_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
2194 static int dib90x0_tuner_reset(struct dvb_frontend *fe, int onoff)
2196 return dib9000_set_gpio(fe, 5, 0, !onoff);
2199 static int dib90x0_tuner_sleep(struct dvb_frontend *fe, int onoff)
2201 return dib9000_set_gpio(fe, 0, 0, onoff);
2204 static int dib01x0_pmu_update(struct i2c_adapter *i2c, u16 *data, u8 len)
2206 u8 wb[4] = { 0xc >> 8, 0xc & 0xff, 0, 0 };
2208 struct i2c_msg msg[2] = {
2209 {.addr = 0x1e >> 1, .flags = 0, .buf = wb, .len = 2},
2210 {.addr = 0x1e >> 1, .flags = I2C_M_RD, .buf = rb, .len = 2},
2214 dibx000_i2c_set_speed(i2c, 250);
2216 if (i2c_transfer(i2c, msg, 2) != 2)
2219 switch (rb[0] << 8 | rb[1]) {
2221 deb_info("Found DiB0170 rev1: This version of DiB0170 is not supported any longer.\n");
2224 deb_info("Found DiB0170 rev2");
2227 deb_info("Found DiB0190 rev2");
2230 deb_info("DiB01x0 not found");
2234 for (index_data = 0; index_data < len; index_data += 2) {
2235 wb[2] = (data[index_data + 1] >> 8) & 0xff;
2236 wb[3] = (data[index_data + 1]) & 0xff;
2238 if (data[index_data] == 0) {
2239 wb[0] = (data[index_data] >> 8) & 0xff;
2240 wb[1] = (data[index_data]) & 0xff;
2242 if (i2c_transfer(i2c, msg, 2) != 2)
2245 wb[3] |= rb[1] & ~(3 << 4);
2248 wb[0] = (data[index_data] >> 8)&0xff;
2249 wb[1] = (data[index_data])&0xff;
2251 if (i2c_transfer(i2c, &msg[0], 1) != 1)
2257 static struct dib9000_config stk9090m_config = {
2258 .output_mpeg2_in_188_bytes = 1,
2259 .output_mode = OUTMODE_MPEG2_FIFO,
2260 .vcxo_timer = 279620,
2261 .timing_frequency = 20452225,
2262 .demod_clock_khz = 60000,
2263 .xtal_clock_khz = 30000,
2264 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
2268 { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0008 } }, /* GPIO 3 to 1 for VHF */
2269 { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0000 } }, /* GPIO 3 to 0 for UHF */
2274 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
2275 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
2279 static struct dib9000_config nim9090md_config[2] = {
2281 .output_mpeg2_in_188_bytes = 1,
2282 .output_mode = OUTMODE_MPEG2_FIFO,
2283 .vcxo_timer = 279620,
2284 .timing_frequency = 20452225,
2285 .demod_clock_khz = 60000,
2286 .xtal_clock_khz = 30000,
2287 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
2289 .output_mpeg2_in_188_bytes = 1,
2290 .output_mode = OUTMODE_DIVERSITY,
2291 .vcxo_timer = 279620,
2292 .timing_frequency = 20452225,
2293 .demod_clock_khz = 60000,
2294 .xtal_clock_khz = 30000,
2295 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
2299 { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0006 } }, /* GPIO 1 and 2 to 1 for VHF */
2300 { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0000 } }, /* GPIO 1 and 2 to 0 for UHF */
2305 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
2306 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
2311 static struct dib0090_config dib9090_dib0090_config = {
2315 .io.pll_loopdiv = 8,
2316 .io.adc_clock_ratio = 8,
2317 .io.pll_int_loop_filt = 0,
2318 .io.clock_khz = 30000,
2319 .reset = dib90x0_tuner_reset,
2320 .sleep = dib90x0_tuner_sleep,
2325 .freq_offset_khz_uhf = 0,
2326 .freq_offset_khz_vhf = 0,
2329 static struct dib0090_config nim9090md_dib0090_config[2] = {
2334 .io.pll_loopdiv = 8,
2335 .io.adc_clock_ratio = 8,
2336 .io.pll_int_loop_filt = 0,
2337 .io.clock_khz = 30000,
2338 .reset = dib90x0_tuner_reset,
2339 .sleep = dib90x0_tuner_sleep,
2344 .freq_offset_khz_uhf = 0,
2345 .freq_offset_khz_vhf = 0,
2350 .io.pll_loopdiv = 8,
2351 .io.adc_clock_ratio = 8,
2352 .io.pll_int_loop_filt = 0,
2353 .io.clock_khz = 30000,
2354 .reset = dib90x0_tuner_reset,
2355 .sleep = dib90x0_tuner_sleep,
2360 .freq_offset_khz_uhf = 0,
2361 .freq_offset_khz_vhf = 0,
2366 static int stk9090m_frontend_attach(struct dvb_usb_adapter *adap)
2368 struct dib0700_adapter_state *state = adap->priv;
2369 struct dib0700_state *st = adap->dev->priv;
2372 /* Make use of the new i2c functions from FW 1.20 */
2373 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
2374 if (fw_version >= 0x10200)
2375 st->fw_use_new_i2c_api = 1;
2376 dib0700_set_i2c_speed(adap->dev, 340);
2378 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2380 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2381 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2382 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2383 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2385 dib0700_ctrl_clock(adap->dev, 72, 1);
2388 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2390 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2392 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80);
2394 if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {
2395 deb_info("%s: Upload failed. (file not found?)\n", __func__);
2398 deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
2400 stk9090m_config.microcode_B_fe_size = state->frontend_firmware->size;
2401 stk9090m_config.microcode_B_fe_buffer = state->frontend_firmware->data;
2403 adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &stk9090m_config);
2405 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
2408 static int dib9090_tuner_attach(struct dvb_usb_adapter *adap)
2410 struct dib0700_adapter_state *state = adap->priv;
2411 struct i2c_adapter *i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe);
2412 u16 data_dib190[10] = {
2420 if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &dib9090_dib0090_config) == NULL)
2422 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
2423 if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0)
2425 dib0700_set_i2c_speed(adap->dev, 1500);
2426 if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0)
2428 release_firmware(state->frontend_firmware);
2432 static int nim9090md_frontend_attach(struct dvb_usb_adapter *adap)
2434 struct dib0700_adapter_state *state = adap->priv;
2435 struct dib0700_state *st = adap->dev->priv;
2436 struct i2c_adapter *i2c;
2437 struct dvb_frontend *fe_slave;
2440 /* Make use of the new i2c functions from FW 1.20 */
2441 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
2442 if (fw_version >= 0x10200)
2443 st->fw_use_new_i2c_api = 1;
2444 dib0700_set_i2c_speed(adap->dev, 340);
2446 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2448 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2449 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2450 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2451 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2453 dib0700_ctrl_clock(adap->dev, 72, 1);
2456 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2458 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2460 if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {
2461 deb_info("%s: Upload failed. (file not found?)\n", __func__);
2464 deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
2466 nim9090md_config[0].microcode_B_fe_size = state->frontend_firmware->size;
2467 nim9090md_config[0].microcode_B_fe_buffer = state->frontend_firmware->data;
2468 nim9090md_config[1].microcode_B_fe_size = state->frontend_firmware->size;
2469 nim9090md_config[1].microcode_B_fe_buffer = state->frontend_firmware->data;
2471 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, 0x80);
2472 adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &nim9090md_config[0]);
2474 if (adap->fe_adap[0].fe == NULL)
2477 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_3_4, 0);
2478 dib9000_i2c_enumeration(i2c, 1, 0x12, 0x82);
2480 fe_slave = dvb_attach(dib9000_attach, i2c, 0x82, &nim9090md_config[1]);
2481 dib9000_set_slave_frontend(adap->fe_adap[0].fe, fe_slave);
2483 return fe_slave == NULL ? -ENODEV : 0;
2486 static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap)
2488 struct dib0700_adapter_state *state = adap->priv;
2489 struct i2c_adapter *i2c;
2490 struct dvb_frontend *fe_slave;
2491 u16 data_dib190[10] = {
2498 i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe);
2499 if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &nim9090md_dib0090_config[0]) == NULL)
2501 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
2502 if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0)
2505 dib0700_set_i2c_speed(adap->dev, 1500);
2506 if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0)
2509 fe_slave = dib9000_get_slave_frontend(adap->fe_adap[0].fe, 1);
2510 if (fe_slave != NULL) {
2511 i2c = dib9000_get_component_bus_interface(adap->fe_adap[0].fe);
2512 dib9000_set_i2c_adapter(fe_slave, i2c);
2514 i2c = dib9000_get_tuner_interface(fe_slave);
2515 if (dvb_attach(dib0090_fw_register, fe_slave, i2c, &nim9090md_dib0090_config[1]) == NULL)
2517 fe_slave->dvb = adap->fe_adap[0].fe->dvb;
2518 dib9000_fw_set_component_bus_speed(adap->fe_adap[0].fe, 1500);
2519 if (dib9000_firmware_post_pll_init(fe_slave) < 0)
2522 release_firmware(state->frontend_firmware);
2528 static int dib7090p_get_best_sampling(struct dvb_frontend *fe , struct dibx090p_best_adc *adc)
2530 u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1;
2533 u32 fcp_min = 1900; /* PLL Minimum Frequency comparator KHz */
2534 u32 fcp_max = 20000; /* PLL Maximum Frequency comparator KHz */
2535 u32 fdem_max = 76000;
2536 u32 fdem_min = 69500;
2537 u32 fcp = 0, fs = 0, fdem = 0;
2538 u32 harmonic_id = 0;
2540 adc->pll_loopdiv = loopdiv;
2541 adc->pll_prediv = prediv;
2544 deb_info("bandwidth = %d fdem_min =%d", fe->dtv_property_cache.bandwidth_hz, fdem_min);
2546 /* Find Min and Max prediv */
2547 while ((xtal/max_prediv) >= fcp_min)
2551 min_prediv = max_prediv;
2552 while ((xtal/min_prediv) <= fcp_max) {
2554 if (min_prediv == 1)
2557 deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv);
2561 for (prediv = min_prediv ; prediv < max_prediv; prediv++) {
2562 fcp = xtal / prediv;
2563 if (fcp > fcp_min && fcp < fcp_max) {
2564 for (loopdiv = 1 ; loopdiv < 64 ; loopdiv++) {
2565 fdem = ((xtal/prediv) * loopdiv);
2567 /* test min/max system restrictions */
2569 if ((fdem >= fdem_min) && (fdem <= fdem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz/1000)) {
2571 /* test fs harmonics positions */
2572 for (harmonic_id = (fe->dtv_property_cache.frequency / (1000*fs)) ; harmonic_id <= ((fe->dtv_property_cache.frequency / (1000*fs))+1) ; harmonic_id++) {
2573 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)))) {
2580 adc->pll_loopdiv = loopdiv;
2581 adc->pll_prediv = prediv;
2582 adc->timf = 2396745143UL/fdem*(1 << 9);
2583 adc->timf += ((2396745143UL%fdem) << 9)/fdem;
2584 deb_info("loopdiv=%i prediv=%i timf=%i", loopdiv, prediv, adc->timf);
2595 if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0)
2601 static int dib7090_agc_startup(struct dvb_frontend *fe)
2603 struct dvb_usb_adapter *adap = fe->dvb->priv;
2604 struct dib0700_adapter_state *state = adap->priv;
2605 struct dibx000_bandwidth_config pll;
2607 struct dibx090p_best_adc adc;
2610 ret = state->set_param_save(fe);
2614 memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));
2615 dib0090_pwm_gain_reset(fe);
2616 target = (dib0090_get_wbd_target(fe) * 8 + 1) / 2;
2617 state->dib7000p_ops.set_wbd_ref(fe, target);
2619 if (dib7090p_get_best_sampling(fe, &adc) == 0) {
2620 pll.pll_ratio = adc.pll_loopdiv;
2621 pll.pll_prediv = adc.pll_prediv;
2623 state->dib7000p_ops.update_pll(fe, &pll);
2624 state->dib7000p_ops.ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf);
2629 static int dib7090_agc_restart(struct dvb_frontend *fe, u8 restart)
2631 deb_info("AGC restart callback: %d", restart);
2632 if (restart == 0) /* before AGC startup */
2633 dib0090_set_dc_servo(fe, 1);
2637 static int tfe7790p_update_lna(struct dvb_frontend *fe, u16 agc_global)
2639 struct dvb_usb_adapter *adap = fe->dvb->priv;
2640 struct dib0700_adapter_state *state = adap->priv;
2642 deb_info("update LNA: agc global=%i", agc_global);
2644 if (agc_global < 25000) {
2645 state->dib7000p_ops.set_gpio(fe, 8, 0, 0);
2646 state->dib7000p_ops.set_agc1_min(fe, 0);
2648 state->dib7000p_ops.set_gpio(fe, 8, 0, 1);
2649 state->dib7000p_ops.set_agc1_min(fe, 32768);
2655 static struct dib0090_wbd_slope dib7090_wbd_table[] = {
2656 { 380, 81, 850, 64, 540, 4},
2657 { 860, 51, 866, 21, 375, 4},
2658 {1700, 0, 250, 0, 100, 6},
2659 {2600, 0, 250, 0, 100, 6},
2660 { 0xFFFF, 0, 0, 0, 0, 0},
2663 static struct dibx000_agc_config dib7090_agc_config[2] = {
2665 .band_caps = BAND_UHF,
2666 /* 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,
2667 * 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 */
2668 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2671 .time_stabiliz = 10,
2702 .perform_agc_softsplit = 0,
2704 .band_caps = BAND_FM | BAND_VHF | BAND_CBAND,
2705 /* 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,
2706 * 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 */
2707 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2710 .time_stabiliz = 10,
2741 .perform_agc_softsplit = 0,
2745 static struct dibx000_bandwidth_config dib7090_clock_config_12_mhz = {
2755 .IO_CLK_en_core = 1,
2758 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
2759 .ifreq = (0 << 25) | 0,
2761 .xtal_hz = 15000000,
2764 static struct dib7000p_config nim7090_dib7000p_config = {
2765 .output_mpeg2_in_188_bytes = 1,
2766 .hostbus_diversity = 1,
2767 .tuner_is_baseband = 1,
2768 .update_lna = tfe7790p_update_lna, /* GPIO used is the same as TFE7790 */
2770 .agc_config_count = 2,
2771 .agc = dib7090_agc_config,
2773 .bw = &dib7090_clock_config_12_mhz,
2775 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2776 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2777 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2781 .agc_control = dib7090_agc_restart,
2784 .disable_sample_and_hold = 0,
2785 .enable_current_mirror = 0,
2786 .diversity_delay = 0,
2788 .output_mode = OUTMODE_MPEG2_FIFO,
2792 static int tfe7090p_pvr_update_lna(struct dvb_frontend *fe, u16 agc_global)
2794 struct dvb_usb_adapter *adap = fe->dvb->priv;
2795 struct dib0700_adapter_state *state = adap->priv;
2797 deb_info("TFE7090P-PVR update LNA: agc global=%i", agc_global);
2798 if (agc_global < 25000) {
2799 state->dib7000p_ops.set_gpio(fe, 5, 0, 0);
2800 state->dib7000p_ops.set_agc1_min(fe, 0);
2802 state->dib7000p_ops.set_gpio(fe, 5, 0, 1);
2803 state->dib7000p_ops.set_agc1_min(fe, 32768);
2809 static struct dib7000p_config tfe7090pvr_dib7000p_config[2] = {
2811 .output_mpeg2_in_188_bytes = 1,
2812 .hostbus_diversity = 1,
2813 .tuner_is_baseband = 1,
2814 .update_lna = tfe7090p_pvr_update_lna,
2816 .agc_config_count = 2,
2817 .agc = dib7090_agc_config,
2819 .bw = &dib7090_clock_config_12_mhz,
2821 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2822 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2823 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2827 .agc_control = dib7090_agc_restart,
2830 .disable_sample_and_hold = 0,
2831 .enable_current_mirror = 0,
2832 .diversity_delay = 0,
2834 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2835 .default_i2c_addr = 0x90,
2838 .output_mpeg2_in_188_bytes = 1,
2839 .hostbus_diversity = 1,
2840 .tuner_is_baseband = 1,
2841 .update_lna = tfe7090p_pvr_update_lna,
2843 .agc_config_count = 2,
2844 .agc = dib7090_agc_config,
2846 .bw = &dib7090_clock_config_12_mhz,
2848 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2849 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2850 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2854 .agc_control = dib7090_agc_restart,
2857 .disable_sample_and_hold = 0,
2858 .enable_current_mirror = 0,
2859 .diversity_delay = 0,
2861 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2862 .default_i2c_addr = 0x92,
2867 static struct dib0090_config nim7090_dib0090_config = {
2868 .io.clock_khz = 12000,
2872 .io.pll_loopdiv = 6,
2873 .io.adc_clock_ratio = 0,
2874 .io.pll_int_loop_filt = 0,
2876 .freq_offset_khz_uhf = 0,
2877 .freq_offset_khz_vhf = 0,
2882 .wbd_vhf_offset = 0,
2883 .wbd_cband_offset = 0,
2887 .fref_clock_ratio = 0,
2889 .wbd = dib7090_wbd_table,
2891 .ls_cfg_pad_drv = 0,
2897 static struct dib7000p_config tfe7790p_dib7000p_config = {
2898 .output_mpeg2_in_188_bytes = 1,
2899 .hostbus_diversity = 1,
2900 .tuner_is_baseband = 1,
2901 .update_lna = tfe7790p_update_lna,
2903 .agc_config_count = 2,
2904 .agc = dib7090_agc_config,
2906 .bw = &dib7090_clock_config_12_mhz,
2908 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2909 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2910 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2914 .agc_control = dib7090_agc_restart,
2917 .disable_sample_and_hold = 0,
2918 .enable_current_mirror = 0,
2919 .diversity_delay = 0,
2921 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2925 static struct dib0090_config tfe7790p_dib0090_config = {
2926 .io.clock_khz = 12000,
2930 .io.pll_loopdiv = 6,
2931 .io.adc_clock_ratio = 0,
2932 .io.pll_int_loop_filt = 0,
2934 .freq_offset_khz_uhf = 0,
2935 .freq_offset_khz_vhf = 0,
2940 .wbd_vhf_offset = 0,
2941 .wbd_cband_offset = 0,
2945 .fref_clock_ratio = 0,
2947 .wbd = dib7090_wbd_table,
2949 .ls_cfg_pad_drv = 0,
2953 .force_cband_input = 0,
2955 .force_crystal_mode = 1,
2958 static struct dib0090_config tfe7090pvr_dib0090_config[2] = {
2960 .io.clock_khz = 12000,
2964 .io.pll_loopdiv = 6,
2965 .io.adc_clock_ratio = 0,
2966 .io.pll_int_loop_filt = 0,
2968 .freq_offset_khz_uhf = 50,
2969 .freq_offset_khz_vhf = 70,
2974 .wbd_vhf_offset = 0,
2975 .wbd_cband_offset = 0,
2979 .fref_clock_ratio = 0,
2981 .wbd = dib7090_wbd_table,
2983 .ls_cfg_pad_drv = 0,
2988 .io.clock_khz = 12000,
2992 .io.pll_loopdiv = 6,
2993 .io.adc_clock_ratio = 0,
2994 .io.pll_int_loop_filt = 0,
2996 .freq_offset_khz_uhf = -50,
2997 .freq_offset_khz_vhf = -70,
3002 .wbd_vhf_offset = 0,
3003 .wbd_cband_offset = 0,
3007 .fref_clock_ratio = 0,
3009 .wbd = dib7090_wbd_table,
3011 .ls_cfg_pad_drv = 0,
3018 static int nim7090_frontend_attach(struct dvb_usb_adapter *adap)
3020 struct dib0700_adapter_state *state = adap->priv;
3022 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3025 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3027 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3028 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3029 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3030 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3033 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3035 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3037 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, &nim7090_dib7000p_config) != 0) {
3038 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
3039 dvb_detach(&state->dib7000p_ops);
3042 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, &nim7090_dib7000p_config);
3044 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3047 static int nim7090_tuner_attach(struct dvb_usb_adapter *adap)
3049 struct dib0700_adapter_state *st = adap->priv;
3050 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe);
3052 nim7090_dib0090_config.reset = st->dib7000p_ops.tuner_sleep,
3053 nim7090_dib0090_config.sleep = st->dib7000p_ops.tuner_sleep,
3054 nim7090_dib0090_config.get_adc_power = st->dib7000p_ops.get_adc_power;
3056 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &nim7090_dib0090_config) == NULL)
3059 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3061 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3062 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3066 static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter *adap)
3068 struct dib0700_state *st = adap->dev->priv;
3069 struct dib0700_adapter_state *state = adap->priv;
3071 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3074 /* The TFE7090 requires the dib0700 to not be in master mode */
3075 st->disable_streaming_master_mode = 1;
3077 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3079 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3080 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3081 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3082 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3085 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3087 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3089 /* initialize IC 0 */
3090 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, &tfe7090pvr_dib7000p_config[0]) != 0) {
3091 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
3092 dvb_detach(&state->dib7000p_ops);
3096 dib0700_set_i2c_speed(adap->dev, 340);
3097 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]);
3098 if (adap->fe_adap[0].fe == NULL)
3101 state->dib7000p_ops.slave_reset(adap->fe_adap[0].fe);
3106 static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter *adap)
3108 struct i2c_adapter *i2c;
3109 struct dib0700_adapter_state *state = adap->priv;
3111 if (adap->dev->adapter[0].fe_adap[0].fe == NULL) {
3112 err("the master dib7090 has to be initialized first");
3113 return -ENODEV; /* the master device has not been initialized */
3116 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3119 i2c = state->dib7000p_ops.get_i2c_master(adap->dev->adapter[0].fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_6_7, 1);
3120 if (state->dib7000p_ops.i2c_enumeration(i2c, 1, 0x10, &tfe7090pvr_dib7000p_config[1]) != 0) {
3121 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
3122 dvb_detach(&state->dib7000p_ops);
3126 adap->fe_adap[0].fe = state->dib7000p_ops.init(i2c, 0x92, &tfe7090pvr_dib7000p_config[1]);
3127 dib0700_set_i2c_speed(adap->dev, 200);
3129 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3132 static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter *adap)
3134 struct dib0700_adapter_state *st = adap->priv;
3135 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe);
3137 tfe7090pvr_dib0090_config[0].reset = st->dib7000p_ops.tuner_sleep;
3138 tfe7090pvr_dib0090_config[0].sleep = st->dib7000p_ops.tuner_sleep;
3139 tfe7090pvr_dib0090_config[0].get_adc_power = st->dib7000p_ops.get_adc_power;
3141 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[0]) == NULL)
3144 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3146 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3147 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3151 static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter *adap)
3153 struct dib0700_adapter_state *st = adap->priv;
3154 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe);
3156 tfe7090pvr_dib0090_config[1].reset = st->dib7000p_ops.tuner_sleep;
3157 tfe7090pvr_dib0090_config[1].sleep = st->dib7000p_ops.tuner_sleep;
3158 tfe7090pvr_dib0090_config[1].get_adc_power = st->dib7000p_ops.get_adc_power;
3160 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[1]) == NULL)
3163 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3165 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3166 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3170 static int tfe7790p_frontend_attach(struct dvb_usb_adapter *adap)
3172 struct dib0700_state *st = adap->dev->priv;
3173 struct dib0700_adapter_state *state = adap->priv;
3175 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3178 /* The TFE7790P requires the dib0700 to not be in master mode */
3179 st->disable_streaming_master_mode = 1;
3181 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3183 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3184 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3185 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3186 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3188 dib0700_ctrl_clock(adap->dev, 72, 1);
3189 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3191 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3193 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap,
3194 1, 0x10, &tfe7790p_dib7000p_config) != 0) {
3195 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
3197 dvb_detach(&state->dib7000p_ops);
3200 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap,
3201 0x80, &tfe7790p_dib7000p_config);
3203 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3206 static int tfe7790p_tuner_attach(struct dvb_usb_adapter *adap)
3208 struct dib0700_adapter_state *st = adap->priv;
3209 struct i2c_adapter *tun_i2c =
3210 st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe);
3213 tfe7790p_dib0090_config.reset = st->dib7000p_ops.tuner_sleep;
3214 tfe7790p_dib0090_config.sleep = st->dib7000p_ops.tuner_sleep;
3215 tfe7790p_dib0090_config.get_adc_power = st->dib7000p_ops.get_adc_power;
3217 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c,
3218 &tfe7790p_dib0090_config) == NULL)
3221 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3223 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3224 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3229 static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
3231 .output_mpeg2_in_188_bytes = 1,
3233 .agc_config_count = 1,
3234 .agc = &dib7070_agc_config,
3235 .bw = &dib7070_bw_config_12_mhz,
3236 .tuner_is_baseband = 1,
3239 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
3240 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
3241 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
3243 .hostbus_diversity = 1,
3245 .output_mpeg2_in_188_bytes = 1,
3247 .agc_config_count = 1,
3248 .agc = &dib7070_agc_config,
3249 .bw = &dib7070_bw_config_12_mhz,
3250 .tuner_is_baseband = 1,
3253 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
3254 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
3255 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
3257 .hostbus_diversity = 1,
3261 static void stk7070pd_init(struct dvb_usb_device *dev)
3263 dib0700_set_gpio(dev, GPIO6, GPIO_OUT, 1);
3265 dib0700_set_gpio(dev, GPIO9, GPIO_OUT, 1);
3266 dib0700_set_gpio(dev, GPIO4, GPIO_OUT, 1);
3267 dib0700_set_gpio(dev, GPIO7, GPIO_OUT, 1);
3268 dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 0);
3270 dib0700_ctrl_clock(dev, 72, 1);
3273 dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 1);
3276 static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
3278 struct dib0700_adapter_state *state = adap->priv;
3280 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3283 stk7070pd_init(adap->dev);
3286 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3288 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
3289 stk7070pd_dib7000p_config) != 0) {
3290 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
3292 dvb_detach(&state->dib7000p_ops);
3296 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
3297 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3300 static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
3302 struct dib0700_adapter_state *state = adap->priv;
3304 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3307 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
3308 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3311 static int novatd_read_status_override(struct dvb_frontend *fe,
3312 enum fe_status *stat)
3314 struct dvb_usb_adapter *adap = fe->dvb->priv;
3315 struct dvb_usb_device *dev = adap->dev;
3316 struct dib0700_state *state = dev->priv;
3319 ret = state->read_status(fe, stat);
3322 dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT,
3323 !!(*stat & FE_HAS_LOCK));
3328 static int novatd_sleep_override(struct dvb_frontend* fe)
3330 struct dvb_usb_adapter *adap = fe->dvb->priv;
3331 struct dvb_usb_device *dev = adap->dev;
3332 struct dib0700_state *state = dev->priv;
3335 dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT, 0);
3337 return state->sleep(fe);
3341 * novatd_frontend_attach - Nova-TD specific attach
3343 * Nova-TD has GPIO0, 1 and 2 for LEDs. So do not fiddle with them except for
3344 * information purposes.
3346 static int novatd_frontend_attach(struct dvb_usb_adapter *adap)
3348 struct dvb_usb_device *dev = adap->dev;
3349 struct dib0700_state *st = dev->priv;
3350 struct dib0700_adapter_state *state = adap->priv;
3352 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3355 if (adap->id == 0) {
3356 stk7070pd_init(dev);
3358 /* turn the power LED on, the other two off (just in case) */
3359 dib0700_set_gpio(dev, GPIO0, GPIO_OUT, 0);
3360 dib0700_set_gpio(dev, GPIO1, GPIO_OUT, 0);
3361 dib0700_set_gpio(dev, GPIO2, GPIO_OUT, 1);
3363 if (state->dib7000p_ops.i2c_enumeration(&dev->i2c_adap, 2, 18,
3364 stk7070pd_dib7000p_config) != 0) {
3365 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
3367 dvb_detach(&state->dib7000p_ops);
3372 adap->fe_adap[0].fe = state->dib7000p_ops.init(&dev->i2c_adap,
3373 adap->id == 0 ? 0x80 : 0x82,
3374 &stk7070pd_dib7000p_config[adap->id]);
3376 if (adap->fe_adap[0].fe == NULL)
3379 st->read_status = adap->fe_adap[0].fe->ops.read_status;
3380 adap->fe_adap[0].fe->ops.read_status = novatd_read_status_override;
3381 st->sleep = adap->fe_adap[0].fe->ops.sleep;
3382 adap->fe_adap[0].fe->ops.sleep = novatd_sleep_override;
3388 static struct s5h1411_config pinnacle_801e_config = {
3389 .output_mode = S5H1411_PARALLEL_OUTPUT,
3390 .gpio = S5H1411_GPIO_OFF,
3391 .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
3392 .qam_if = S5H1411_IF_44000,
3393 .vsb_if = S5H1411_IF_44000,
3394 .inversion = S5H1411_INVERSION_OFF,
3395 .status_mode = S5H1411_DEMODLOCKING
3398 /* Pinnacle PCTV HD Pro 801e GPIOs map:
3399 GPIO0 - currently unknown
3400 GPIO1 - xc5000 tuner reset
3401 GPIO2 - CX25843 sleep
3402 GPIO3 - currently unknown
3403 GPIO4 - currently unknown
3404 GPIO6 - currently unknown
3405 GPIO7 - currently unknown
3406 GPIO9 - currently unknown
3407 GPIO10 - CX25843 reset
3409 static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
3411 struct dib0700_state *st = adap->dev->priv;
3413 /* Make use of the new i2c functions from FW 1.20 */
3414 st->fw_use_new_i2c_api = 1;
3416 /* The s5h1411 requires the dib0700 to not be in master mode */
3417 st->disable_streaming_master_mode = 1;
3419 /* All msleep values taken from Windows USB trace */
3420 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
3421 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
3422 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3424 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3426 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3428 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3429 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3430 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3431 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3432 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
3435 /* Put the CX25843 to sleep for now since we're in digital mode */
3436 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
3438 /* GPIOs are initialized, do the attach */
3439 adap->fe_adap[0].fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
3440 &adap->dev->i2c_adap);
3441 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3444 static int dib0700_xc5000_tuner_callback(void *priv, int component,
3445 int command, int arg)
3447 struct dvb_usb_adapter *adap = priv;
3449 if (command == XC5000_TUNER_RESET) {
3450 /* Reset the tuner */
3451 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
3453 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
3456 err("xc5000: unknown tuner callback command: %d\n", command);
3463 static struct xc5000_config s5h1411_xc5000_tunerconfig = {
3464 .i2c_address = 0x64,
3468 static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
3470 /* FIXME: generalize & move to common area */
3471 adap->fe_adap[0].fe->callback = dib0700_xc5000_tuner_callback;
3473 return dvb_attach(xc5000_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap,
3474 &s5h1411_xc5000_tunerconfig)
3475 == NULL ? -ENODEV : 0;
3478 static int dib0700_xc4000_tuner_callback(void *priv, int component,
3479 int command, int arg)
3481 struct dvb_usb_adapter *adap = priv;
3482 struct dib0700_adapter_state *state = adap->priv;
3484 if (command == XC4000_TUNER_RESET) {
3485 /* Reset the tuner */
3486 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 0);
3488 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3490 err("xc4000: unknown tuner callback command: %d\n", command);
3497 static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config = {
3498 .band_caps = BAND_UHF | BAND_VHF,
3501 .time_stabiliz = 0x15,
3502 .alpha_level = 0x00,
3515 .agc1_slope1 = 0x00,
3516 .agc1_slope2 = 0x00,
3519 .agc2_slope1 = 0x1d,
3520 .agc2_slope2 = 0x1d,
3525 .perform_agc_softsplit = 0x00,
3528 static struct dibx000_bandwidth_config stk7700p_xc4000_pll_config = {
3538 .IO_CLK_en_core = 1,
3541 .sad_cfg = (3 << 14) | (1 << 12) | 524, /* sad_cfg: refsel, sel, freq_15k */
3547 /* FIXME: none of these inputs are validated yet */
3548 static struct dib7000p_config pctv_340e_config = {
3549 .output_mpeg2_in_188_bytes = 1,
3551 .agc_config_count = 1,
3552 .agc = &stk7700p_7000p_xc4000_agc_config,
3553 .bw = &stk7700p_xc4000_pll_config,
3555 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
3556 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
3557 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
3560 /* PCTV 340e GPIOs map:
3562 GPIO2 - CX25843 sleep
3563 GPIO3 - CS5340 reset
3565 GPIO6 - Power Supply
3566 GPIO8 - LNA (1=off 0=on)
3567 GPIO10 - CX25843 reset
3569 GPIO8 - xc4000 reset
3571 static int pctv340e_frontend_attach(struct dvb_usb_adapter *adap)
3573 struct dib0700_state *st = adap->dev->priv;
3574 struct dib0700_adapter_state *state = adap->priv;
3576 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3579 /* Power Supply on */
3580 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
3582 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3583 msleep(100); /* Allow power supply to settle before probing */
3586 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3587 msleep(1); /* cx25843 datasheet say 350us required */
3588 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3590 /* LNA off for now */
3591 dib0700_set_gpio(adap->dev, GPIO8, GPIO_OUT, 1);
3593 /* Put the CX25843 to sleep for now since we're in digital mode */
3594 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
3596 /* FIXME: not verified yet */
3597 dib0700_ctrl_clock(adap->dev, 72, 1);
3601 if (state->dib7000p_ops.dib7000pc_detection(&adap->dev->i2c_adap) == 0) {
3602 /* Demodulator not found for some reason? */
3603 dvb_detach(&state->dib7000p_ops);
3607 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x12,
3609 st->is_dib7000pc = 1;
3611 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3614 static struct xc4000_config dib7000p_xc4000_tunerconfig = {
3615 .i2c_address = 0x61,
3618 .set_smoothedcvbs = 0,
3622 static int xc4000_tuner_attach(struct dvb_usb_adapter *adap)
3624 struct i2c_adapter *tun_i2c;
3625 struct dib0700_adapter_state *state = adap->priv;
3627 /* The xc4000 is not on the main i2c bus */
3628 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
3629 DIBX000_I2C_INTERFACE_TUNER, 1);
3630 if (tun_i2c == NULL) {
3631 printk(KERN_ERR "Could not reach tuner i2c bus\n");
3635 /* Setup the reset callback */
3636 adap->fe_adap[0].fe->callback = dib0700_xc4000_tuner_callback;
3638 return dvb_attach(xc4000_attach, adap->fe_adap[0].fe, tun_i2c,
3639 &dib7000p_xc4000_tunerconfig)
3640 == NULL ? -ENODEV : 0;
3643 static struct lgdt3305_config hcw_lgdt3305_config = {
3645 .mpeg_mode = LGDT3305_MPEG_PARALLEL,
3646 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
3647 .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
3649 .spectral_inversion = 1,
3652 .usref_8vsb = 0x0500,
3655 static struct mxl5007t_config hcw_mxl5007t_config = {
3656 .xtal_freq_hz = MxL_XTAL_25_MHZ,
3657 .if_freq_hz = MxL_IF_6_MHZ,
3662 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
3663 GPIO1 - ANT_SEL (H: VPA, L: MCX)
3669 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
3671 static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
3673 struct dib0700_state *st = adap->dev->priv;
3675 /* Make use of the new i2c functions from FW 1.20 */
3676 st->fw_use_new_i2c_api = 1;
3678 st->disable_streaming_master_mode = 1;
3680 /* fe power enable */
3681 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
3683 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3687 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3689 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3691 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3694 adap->fe_adap[0].fe = dvb_attach(lgdt3305_attach,
3695 &hcw_lgdt3305_config,
3696 &adap->dev->i2c_adap);
3698 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3701 static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
3703 return dvb_attach(mxl5007t_attach, adap->fe_adap[0].fe,
3704 &adap->dev->i2c_adap, 0x60,
3705 &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
3709 /* DVB-USB and USB stuff follows */
3710 struct usb_device_id dib0700_usb_id_table[] = {
3711 /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
3712 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
3713 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
3714 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
3715 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
3716 /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
3717 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
3718 { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
3719 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
3720 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
3721 /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
3722 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
3723 { USB_DEVICE(USB_VID_TERRATEC,
3724 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
3725 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
3726 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
3727 /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
3728 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
3729 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
3730 { USB_DEVICE(USB_VID_PINNACLE,
3731 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
3732 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
3733 /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
3734 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
3735 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
3736 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
3737 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
3738 /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
3739 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
3740 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
3741 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
3742 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
3743 /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
3744 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
3745 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
3746 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
3747 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
3748 /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
3749 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
3750 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
3751 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
3752 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
3753 /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
3754 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
3755 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
3756 { USB_DEVICE(USB_VID_TERRATEC,
3757 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
3758 { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
3759 /* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
3760 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
3761 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
3762 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
3763 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
3764 /* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
3765 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
3766 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
3767 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
3768 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
3769 /* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
3770 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
3771 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV73ESE) },
3772 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV282E) },
3773 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
3774 /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
3775 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
3776 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
3777 { USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x000, 0x3f00) },
3778 { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },
3779 /* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
3780 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
3781 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) },
3782 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) },
3783 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090M) },
3784 /* 70 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM8096MD) },
3785 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090MD) },
3786 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM7090) },
3787 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090PVR) },
3788 { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2) },
3789 /* 75 */{ USB_DEVICE(USB_VID_MEDION, USB_PID_CREATIX_CTX1921) },
3790 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E) },
3791 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E_SE) },
3792 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7790P) },
3793 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE8096P) },
3794 /* 80 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_2) },
3795 { USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_2002E) },
3796 { USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_2002E_SE) },
3797 { 0 } /* Terminating entry */
3799 MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
3801 #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
3802 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
3803 .usb_ctrl = DEVICE_SPECIFIC, \
3804 .firmware = "dvb-usb-dib0700-1.20.fw", \
3805 .download_firmware = dib0700_download_firmware, \
3806 .no_reconnect = 1, \
3807 .size_of_priv = sizeof(struct dib0700_state), \
3808 .i2c_algo = &dib0700_i2c_algo, \
3809 .identify_state = dib0700_identify_state
3811 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
3812 .streaming_ctrl = dib0700_streaming_ctrl, \
3819 .buffersize = 39480, \
3824 #define DIB0700_NUM_FRONTENDS(n) \
3825 .num_frontends = n, \
3826 .size_of_priv = sizeof(struct dib0700_adapter_state)
3828 struct dvb_usb_device_properties dib0700_devices[] = {
3830 DIB0700_DEFAULT_DEVICE_PROPERTIES,
3835 DIB0700_NUM_FRONTENDS(1),
3837 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3838 .pid_filter_count = 32,
3839 .pid_filter = stk7700p_pid_filter,
3840 .pid_filter_ctrl = stk7700p_pid_filter_ctrl,
3841 .frontend_attach = stk7700p_frontend_attach,
3842 .tuner_attach = stk7700p_tuner_attach,
3844 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3849 .num_device_descs = 8,
3851 { "DiBcom STK7700P reference design",
3852 { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
3855 { "Hauppauge Nova-T Stick",
3856 { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
3859 { "AVerMedia AVerTV DVB-T Volar",
3860 { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
3863 { "Compro Videomate U500",
3864 { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
3867 { "Uniwill STK7700P based (Hama and others)",
3868 { &dib0700_usb_id_table[7], NULL },
3871 { "Leadtek Winfast DTV Dongle (STK7700P based)",
3872 { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
3875 { "AVerMedia AVerTV DVB-T Express",
3876 { &dib0700_usb_id_table[20] },
3880 { &dib0700_usb_id_table[21], NULL },
3886 .rc_interval = DEFAULT_RC_INTERVAL,
3887 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3888 .rc_query = dib0700_rc_query_old_firmware,
3889 .allowed_protos = RC_BIT_RC5 |
3892 .change_protocol = dib0700_change_protocol,
3894 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3899 DIB0700_NUM_FRONTENDS(1),
3901 .frontend_attach = bristol_frontend_attach,
3902 .tuner_attach = bristol_tuner_attach,
3904 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3907 DIB0700_NUM_FRONTENDS(1),
3909 .frontend_attach = bristol_frontend_attach,
3910 .tuner_attach = bristol_tuner_attach,
3912 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3917 .num_device_descs = 1,
3919 { "Hauppauge Nova-T 500 Dual DVB-T",
3920 { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
3926 .rc_interval = DEFAULT_RC_INTERVAL,
3927 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3928 .rc_query = dib0700_rc_query_old_firmware,
3929 .allowed_protos = RC_BIT_RC5 |
3932 .change_protocol = dib0700_change_protocol,
3934 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3939 DIB0700_NUM_FRONTENDS(1),
3941 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3942 .pid_filter_count = 32,
3943 .pid_filter = stk70x0p_pid_filter,
3944 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3945 .frontend_attach = stk7700d_frontend_attach,
3946 .tuner_attach = stk7700d_tuner_attach,
3948 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3951 DIB0700_NUM_FRONTENDS(1),
3953 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3954 .pid_filter_count = 32,
3955 .pid_filter = stk70x0p_pid_filter,
3956 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3957 .frontend_attach = stk7700d_frontend_attach,
3958 .tuner_attach = stk7700d_tuner_attach,
3960 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3965 .num_device_descs = 5,
3967 { "Pinnacle PCTV 2000e",
3968 { &dib0700_usb_id_table[11], NULL },
3971 { "Terratec Cinergy DT XS Diversity",
3972 { &dib0700_usb_id_table[12], NULL },
3975 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
3976 { &dib0700_usb_id_table[13], NULL },
3979 { "DiBcom STK7700D reference design",
3980 { &dib0700_usb_id_table[14], NULL },
3983 { "YUAN High-Tech DiBcom STK7700D",
3984 { &dib0700_usb_id_table[55], NULL },
3991 .rc_interval = DEFAULT_RC_INTERVAL,
3992 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3993 .rc_query = dib0700_rc_query_old_firmware,
3994 .allowed_protos = RC_BIT_RC5 |
3997 .change_protocol = dib0700_change_protocol,
3999 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4004 DIB0700_NUM_FRONTENDS(1),
4006 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4007 .pid_filter_count = 32,
4008 .pid_filter = stk70x0p_pid_filter,
4009 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4010 .frontend_attach = stk7700P2_frontend_attach,
4011 .tuner_attach = stk7700d_tuner_attach,
4013 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4018 .num_device_descs = 3,
4020 { "ASUS My Cinema U3000 Mini DVBT Tuner",
4021 { &dib0700_usb_id_table[23], NULL },
4025 { &dib0700_usb_id_table[31], NULL },
4028 { "Terratec Cinergy T Express",
4029 { &dib0700_usb_id_table[42], NULL },
4035 .rc_interval = DEFAULT_RC_INTERVAL,
4036 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4037 .module_name = "dib0700",
4038 .rc_query = dib0700_rc_query_old_firmware,
4039 .allowed_protos = RC_BIT_RC5 |
4042 .change_protocol = dib0700_change_protocol,
4044 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4049 DIB0700_NUM_FRONTENDS(1),
4051 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4052 .pid_filter_count = 32,
4053 .pid_filter = stk70x0p_pid_filter,
4054 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4055 .frontend_attach = stk7070p_frontend_attach,
4056 .tuner_attach = dib7070p_tuner_attach,
4058 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4063 .num_device_descs = 12,
4065 { "DiBcom STK7070P reference design",
4066 { &dib0700_usb_id_table[15], NULL },
4069 { "Pinnacle PCTV DVB-T Flash Stick",
4070 { &dib0700_usb_id_table[16], NULL },
4073 { "Artec T14BR DVB-T",
4074 { &dib0700_usb_id_table[22], NULL },
4077 { "ASUS My Cinema U3100 Mini DVBT Tuner",
4078 { &dib0700_usb_id_table[24], NULL },
4081 { "Hauppauge Nova-T Stick",
4082 { &dib0700_usb_id_table[25], NULL },
4085 { "Hauppauge Nova-T MyTV.t",
4086 { &dib0700_usb_id_table[26], NULL },
4089 { "Pinnacle PCTV 72e",
4090 { &dib0700_usb_id_table[29], NULL },
4093 { "Pinnacle PCTV 73e",
4094 { &dib0700_usb_id_table[30], NULL },
4097 { "Elgato EyeTV DTT",
4098 { &dib0700_usb_id_table[49], NULL },
4102 { &dib0700_usb_id_table[45], NULL },
4105 { "Elgato EyeTV Dtt Dlx PD378S",
4106 { &dib0700_usb_id_table[50], NULL },
4109 { "Elgato EyeTV DTT rev. 2",
4110 { &dib0700_usb_id_table[80], NULL },
4116 .rc_interval = DEFAULT_RC_INTERVAL,
4117 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4118 .module_name = "dib0700",
4119 .rc_query = dib0700_rc_query_old_firmware,
4120 .allowed_protos = RC_BIT_RC5 |
4123 .change_protocol = dib0700_change_protocol,
4125 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4130 DIB0700_NUM_FRONTENDS(1),
4132 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4133 .pid_filter_count = 32,
4134 .pid_filter = stk70x0p_pid_filter,
4135 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4136 .frontend_attach = stk7070p_frontend_attach,
4137 .tuner_attach = dib7070p_tuner_attach,
4139 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4144 .num_device_descs = 3,
4146 { "Pinnacle PCTV 73A",
4147 { &dib0700_usb_id_table[56], NULL },
4150 { "Pinnacle PCTV 73e SE",
4151 { &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL },
4154 { "Pinnacle PCTV 282e",
4155 { &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL },
4161 .rc_interval = DEFAULT_RC_INTERVAL,
4162 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4163 .module_name = "dib0700",
4164 .rc_query = dib0700_rc_query_old_firmware,
4165 .allowed_protos = RC_BIT_RC5 |
4168 .change_protocol = dib0700_change_protocol,
4170 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4175 DIB0700_NUM_FRONTENDS(1),
4177 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4178 .pid_filter_count = 32,
4179 .pid_filter = stk70x0p_pid_filter,
4180 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4181 .frontend_attach = novatd_frontend_attach,
4182 .tuner_attach = dib7070p_tuner_attach,
4184 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4187 DIB0700_NUM_FRONTENDS(1),
4189 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4190 .pid_filter_count = 32,
4191 .pid_filter = stk70x0p_pid_filter,
4192 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4193 .frontend_attach = novatd_frontend_attach,
4194 .tuner_attach = dib7070p_tuner_attach,
4196 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4201 .num_device_descs = 3,
4203 { "Hauppauge Nova-TD Stick (52009)",
4204 { &dib0700_usb_id_table[35], NULL },
4208 { &dib0700_usb_id_table[81], NULL },
4212 { &dib0700_usb_id_table[82], NULL },
4218 .rc_interval = DEFAULT_RC_INTERVAL,
4219 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4220 .module_name = "dib0700",
4221 .rc_query = dib0700_rc_query_old_firmware,
4222 .allowed_protos = RC_BIT_RC5 |
4225 .change_protocol = dib0700_change_protocol,
4227 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4232 DIB0700_NUM_FRONTENDS(1),
4234 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4235 .pid_filter_count = 32,
4236 .pid_filter = stk70x0p_pid_filter,
4237 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4238 .frontend_attach = stk7070pd_frontend_attach0,
4239 .tuner_attach = dib7070p_tuner_attach,
4241 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4244 DIB0700_NUM_FRONTENDS(1),
4246 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4247 .pid_filter_count = 32,
4248 .pid_filter = stk70x0p_pid_filter,
4249 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4250 .frontend_attach = stk7070pd_frontend_attach1,
4251 .tuner_attach = dib7070p_tuner_attach,
4253 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4258 .num_device_descs = 5,
4260 { "DiBcom STK7070PD reference design",
4261 { &dib0700_usb_id_table[17], NULL },
4264 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
4265 { &dib0700_usb_id_table[18], NULL },
4268 { "Hauppauge Nova-TD-500 (84xxx)",
4269 { &dib0700_usb_id_table[36], NULL },
4272 { "Terratec Cinergy DT USB XS Diversity/ T5",
4273 { &dib0700_usb_id_table[43],
4274 &dib0700_usb_id_table[53], NULL},
4278 { &dib0700_usb_id_table[44], NULL },
4284 .rc_interval = DEFAULT_RC_INTERVAL,
4285 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4286 .module_name = "dib0700",
4287 .rc_query = dib0700_rc_query_old_firmware,
4288 .allowed_protos = RC_BIT_RC5 |
4291 .change_protocol = dib0700_change_protocol,
4293 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4298 DIB0700_NUM_FRONTENDS(1),
4300 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4301 .pid_filter_count = 32,
4302 .pid_filter = stk70x0p_pid_filter,
4303 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4304 .frontend_attach = stk7070pd_frontend_attach0,
4305 .tuner_attach = dib7070p_tuner_attach,
4307 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4310 DIB0700_NUM_FRONTENDS(1),
4312 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4313 .pid_filter_count = 32,
4314 .pid_filter = stk70x0p_pid_filter,
4315 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4316 .frontend_attach = stk7070pd_frontend_attach1,
4317 .tuner_attach = dib7070p_tuner_attach,
4319 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4324 .num_device_descs = 1,
4326 { "Elgato EyeTV Diversity",
4327 { &dib0700_usb_id_table[68], NULL },
4333 .rc_interval = DEFAULT_RC_INTERVAL,
4334 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
4335 .module_name = "dib0700",
4336 .rc_query = dib0700_rc_query_old_firmware,
4337 .allowed_protos = RC_BIT_RC5 |
4340 .change_protocol = dib0700_change_protocol,
4342 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4347 DIB0700_NUM_FRONTENDS(1),
4349 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4350 .pid_filter_count = 32,
4351 .pid_filter = stk70x0p_pid_filter,
4352 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4353 .frontend_attach = stk7700ph_frontend_attach,
4354 .tuner_attach = stk7700ph_tuner_attach,
4356 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4361 .num_device_descs = 9,
4363 { "Terratec Cinergy HT USB XE",
4364 { &dib0700_usb_id_table[27], NULL },
4367 { "Pinnacle Expresscard 320cx",
4368 { &dib0700_usb_id_table[28], NULL },
4371 { "Terratec Cinergy HT Express",
4372 { &dib0700_usb_id_table[32], NULL },
4375 { "Gigabyte U8000-RH",
4376 { &dib0700_usb_id_table[37], NULL },
4379 { "YUAN High-Tech STK7700PH",
4380 { &dib0700_usb_id_table[38], NULL },
4383 { "Asus My Cinema-U3000Hybrid",
4384 { &dib0700_usb_id_table[39], NULL },
4387 { "YUAN High-Tech MC770",
4388 { &dib0700_usb_id_table[48], NULL },
4391 { "Leadtek WinFast DTV Dongle H",
4392 { &dib0700_usb_id_table[51], NULL },
4395 { "YUAN High-Tech STK7700D",
4396 { &dib0700_usb_id_table[54], NULL },
4402 .rc_interval = DEFAULT_RC_INTERVAL,
4403 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4404 .module_name = "dib0700",
4405 .rc_query = dib0700_rc_query_old_firmware,
4406 .allowed_protos = RC_BIT_RC5 |
4409 .change_protocol = dib0700_change_protocol,
4411 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4415 DIB0700_NUM_FRONTENDS(1),
4417 .frontend_attach = s5h1411_frontend_attach,
4418 .tuner_attach = xc5000_tuner_attach,
4420 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4425 .num_device_descs = 2,
4427 { "Pinnacle PCTV HD Pro USB Stick",
4428 { &dib0700_usb_id_table[40], NULL },
4431 { "Pinnacle PCTV HD USB Stick",
4432 { &dib0700_usb_id_table[41], NULL },
4438 .rc_interval = DEFAULT_RC_INTERVAL,
4439 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4440 .module_name = "dib0700",
4441 .rc_query = dib0700_rc_query_old_firmware,
4442 .allowed_protos = RC_BIT_RC5 |
4445 .change_protocol = dib0700_change_protocol,
4447 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4451 DIB0700_NUM_FRONTENDS(1),
4453 .frontend_attach = lgdt3305_frontend_attach,
4454 .tuner_attach = mxl5007t_tuner_attach,
4456 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4461 .num_device_descs = 2,
4463 { "Hauppauge ATSC MiniCard (B200)",
4464 { &dib0700_usb_id_table[46], NULL },
4467 { "Hauppauge ATSC MiniCard (B210)",
4468 { &dib0700_usb_id_table[47], NULL },
4472 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4477 DIB0700_NUM_FRONTENDS(1),
4479 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4480 .pid_filter_count = 32,
4481 .pid_filter = stk70x0p_pid_filter,
4482 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4483 .frontend_attach = stk7770p_frontend_attach,
4484 .tuner_attach = dib7770p_tuner_attach,
4486 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4491 .num_device_descs = 4,
4493 { "DiBcom STK7770P reference design",
4494 { &dib0700_usb_id_table[59], NULL },
4497 { "Terratec Cinergy T USB XXS (HD)/ T3",
4498 { &dib0700_usb_id_table[33],
4499 &dib0700_usb_id_table[52],
4500 &dib0700_usb_id_table[60], NULL},
4503 { "TechniSat AirStar TeleStick 2",
4504 { &dib0700_usb_id_table[74], NULL },
4507 { "Medion CTX1921 DVB-T USB",
4508 { &dib0700_usb_id_table[75], NULL },
4514 .rc_interval = DEFAULT_RC_INTERVAL,
4515 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4516 .module_name = "dib0700",
4517 .rc_query = dib0700_rc_query_old_firmware,
4518 .allowed_protos = RC_BIT_RC5 |
4521 .change_protocol = dib0700_change_protocol,
4523 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4527 DIB0700_NUM_FRONTENDS(1),
4529 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4530 .pid_filter_count = 32,
4531 .pid_filter = stk80xx_pid_filter,
4532 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4533 .frontend_attach = stk807x_frontend_attach,
4534 .tuner_attach = dib807x_tuner_attach,
4536 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4541 .num_device_descs = 3,
4543 { "DiBcom STK807xP reference design",
4544 { &dib0700_usb_id_table[62], NULL },
4547 { "Prolink Pixelview SBTVD",
4548 { &dib0700_usb_id_table[63], NULL },
4551 { "EvolutePC TVWay+",
4552 { &dib0700_usb_id_table[64], NULL },
4558 .rc_interval = DEFAULT_RC_INTERVAL,
4559 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
4560 .module_name = "dib0700",
4561 .rc_query = dib0700_rc_query_old_firmware,
4562 .allowed_protos = RC_BIT_RC5 |
4565 .change_protocol = dib0700_change_protocol,
4567 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4571 DIB0700_NUM_FRONTENDS(1),
4573 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4574 .pid_filter_count = 32,
4575 .pid_filter = stk80xx_pid_filter,
4576 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4577 .frontend_attach = stk807xpvr_frontend_attach0,
4578 .tuner_attach = dib807x_tuner_attach,
4580 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4584 DIB0700_NUM_FRONTENDS(1),
4586 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4587 .pid_filter_count = 32,
4588 .pid_filter = stk80xx_pid_filter,
4589 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4590 .frontend_attach = stk807xpvr_frontend_attach1,
4591 .tuner_attach = dib807x_tuner_attach,
4593 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4598 .num_device_descs = 1,
4600 { "DiBcom STK807xPVR reference design",
4601 { &dib0700_usb_id_table[61], NULL },
4607 .rc_interval = DEFAULT_RC_INTERVAL,
4608 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4609 .module_name = "dib0700",
4610 .rc_query = dib0700_rc_query_old_firmware,
4611 .allowed_protos = RC_BIT_RC5 |
4614 .change_protocol = dib0700_change_protocol,
4616 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4620 DIB0700_NUM_FRONTENDS(1),
4622 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4623 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4624 .pid_filter_count = 32,
4625 .pid_filter = stk80xx_pid_filter,
4626 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4627 .frontend_attach = stk809x_frontend_attach,
4628 .tuner_attach = dib809x_tuner_attach,
4630 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4635 .num_device_descs = 1,
4637 { "DiBcom STK8096GP reference design",
4638 { &dib0700_usb_id_table[67], NULL },
4644 .rc_interval = DEFAULT_RC_INTERVAL,
4645 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4646 .module_name = "dib0700",
4647 .rc_query = dib0700_rc_query_old_firmware,
4648 .allowed_protos = RC_BIT_RC5 |
4651 .change_protocol = dib0700_change_protocol,
4653 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4657 DIB0700_NUM_FRONTENDS(1),
4659 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4660 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4661 .pid_filter_count = 32,
4662 .pid_filter = dib90x0_pid_filter,
4663 .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
4664 .frontend_attach = stk9090m_frontend_attach,
4665 .tuner_attach = dib9090_tuner_attach,
4667 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4672 .num_device_descs = 1,
4674 { "DiBcom STK9090M reference design",
4675 { &dib0700_usb_id_table[69], NULL },
4681 .rc_interval = DEFAULT_RC_INTERVAL,
4682 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4683 .module_name = "dib0700",
4684 .rc_query = dib0700_rc_query_old_firmware,
4685 .allowed_protos = RC_BIT_RC5 |
4688 .change_protocol = dib0700_change_protocol,
4690 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4694 DIB0700_NUM_FRONTENDS(1),
4696 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4697 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4698 .pid_filter_count = 32,
4699 .pid_filter = stk80xx_pid_filter,
4700 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4701 .frontend_attach = nim8096md_frontend_attach,
4702 .tuner_attach = nim8096md_tuner_attach,
4704 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4709 .num_device_descs = 1,
4711 { "DiBcom NIM8096MD reference design",
4712 { &dib0700_usb_id_table[70], NULL },
4718 .rc_interval = DEFAULT_RC_INTERVAL,
4719 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4720 .module_name = "dib0700",
4721 .rc_query = dib0700_rc_query_old_firmware,
4722 .allowed_protos = RC_BIT_RC5 |
4725 .change_protocol = dib0700_change_protocol,
4727 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4731 DIB0700_NUM_FRONTENDS(1),
4733 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4734 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4735 .pid_filter_count = 32,
4736 .pid_filter = dib90x0_pid_filter,
4737 .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
4738 .frontend_attach = nim9090md_frontend_attach,
4739 .tuner_attach = nim9090md_tuner_attach,
4741 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4746 .num_device_descs = 1,
4748 { "DiBcom NIM9090MD reference design",
4749 { &dib0700_usb_id_table[71], NULL },
4755 .rc_interval = DEFAULT_RC_INTERVAL,
4756 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4757 .module_name = "dib0700",
4758 .rc_query = dib0700_rc_query_old_firmware,
4759 .allowed_protos = RC_BIT_RC5 |
4762 .change_protocol = dib0700_change_protocol,
4764 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4768 DIB0700_NUM_FRONTENDS(1),
4770 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4771 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4772 .pid_filter_count = 32,
4773 .pid_filter = stk70x0p_pid_filter,
4774 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4775 .frontend_attach = nim7090_frontend_attach,
4776 .tuner_attach = nim7090_tuner_attach,
4778 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4783 .num_device_descs = 1,
4785 { "DiBcom NIM7090 reference design",
4786 { &dib0700_usb_id_table[72], NULL },
4792 .rc_interval = DEFAULT_RC_INTERVAL,
4793 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4794 .module_name = "dib0700",
4795 .rc_query = dib0700_rc_query_old_firmware,
4796 .allowed_protos = RC_BIT_RC5 |
4799 .change_protocol = dib0700_change_protocol,
4801 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4805 DIB0700_NUM_FRONTENDS(1),
4807 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4808 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4809 .pid_filter_count = 32,
4810 .pid_filter = stk70x0p_pid_filter,
4811 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4812 .frontend_attach = tfe7090pvr_frontend0_attach,
4813 .tuner_attach = tfe7090pvr_tuner0_attach,
4815 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
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 = stk70x0p_pid_filter,
4825 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4826 .frontend_attach = tfe7090pvr_frontend1_attach,
4827 .tuner_attach = tfe7090pvr_tuner1_attach,
4829 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4834 .num_device_descs = 1,
4836 { "DiBcom TFE7090PVR reference design",
4837 { &dib0700_usb_id_table[73], 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_BIT_RC5 |
4850 .change_protocol = dib0700_change_protocol,
4852 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4856 DIB0700_NUM_FRONTENDS(1),
4858 .frontend_attach = pctv340e_frontend_attach,
4859 .tuner_attach = xc4000_tuner_attach,
4861 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4866 .num_device_descs = 2,
4868 { "Pinnacle PCTV 340e HD Pro USB Stick",
4869 { &dib0700_usb_id_table[76], NULL },
4872 { "Pinnacle PCTV Hybrid Stick Solo",
4873 { &dib0700_usb_id_table[77], NULL },
4878 .rc_interval = DEFAULT_RC_INTERVAL,
4879 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4880 .module_name = "dib0700",
4881 .rc_query = dib0700_rc_query_old_firmware,
4882 .allowed_protos = RC_BIT_RC5 |
4885 .change_protocol = dib0700_change_protocol,
4887 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4891 DIB0700_NUM_FRONTENDS(1),
4893 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4894 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4895 .pid_filter_count = 32,
4896 .pid_filter = stk70x0p_pid_filter,
4897 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4898 .frontend_attach = tfe7790p_frontend_attach,
4899 .tuner_attach = tfe7790p_tuner_attach,
4901 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4906 .num_device_descs = 1,
4908 { "DiBcom TFE7790P reference design",
4909 { &dib0700_usb_id_table[78], NULL },
4915 .rc_interval = DEFAULT_RC_INTERVAL,
4916 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4917 .module_name = "dib0700",
4918 .rc_query = dib0700_rc_query_old_firmware,
4919 .allowed_protos = RC_BIT_RC5 |
4922 .change_protocol = dib0700_change_protocol,
4924 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4928 DIB0700_NUM_FRONTENDS(1),
4930 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4931 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4932 .pid_filter_count = 32,
4933 .pid_filter = stk80xx_pid_filter,
4934 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4935 .frontend_attach = tfe8096p_frontend_attach,
4936 .tuner_attach = tfe8096p_tuner_attach,
4938 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4944 .num_device_descs = 1,
4946 { "DiBcom TFE8096P reference design",
4947 { &dib0700_usb_id_table[79], NULL },
4953 .rc_interval = DEFAULT_RC_INTERVAL,
4954 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4955 .module_name = "dib0700",
4956 .rc_query = dib0700_rc_query_old_firmware,
4957 .allowed_protos = RC_BIT_RC5 |
4960 .change_protocol = dib0700_change_protocol,
4965 int dib0700_device_count = ARRAY_SIZE(dib0700_devices);