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.set_wbd_ref);
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.set_wbd_ref);
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:
434 case XC2028_I2C_FLUSH:
437 err("%s: unknown command %d, arg %d\n", __func__,
444 static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
445 .fname = "/*(DEBLOBBED)*/",
447 .demod = XC3028_FE_DIBCOM52,
450 static struct xc2028_config stk7700ph_xc3028_config = {
452 .ctrl = &stk7700ph_xc3028_ctrl,
455 static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
457 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;
458 struct dib0700_adapter_state *state = adap->priv;
460 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
463 if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
464 desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))
465 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
467 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
469 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
470 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
471 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
472 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
474 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
476 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
479 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
480 &stk7700ph_dib7700_xc3028_config) != 0) {
481 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
483 dvb_detach(state->dib7000p_ops.set_wbd_ref);
487 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80,
488 &stk7700ph_dib7700_xc3028_config);
490 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
493 static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
495 struct i2c_adapter *tun_i2c;
496 struct dib0700_adapter_state *state = adap->priv;
498 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
499 DIBX000_I2C_INTERFACE_TUNER, 1);
501 stk7700ph_xc3028_config.i2c_adap = tun_i2c;
503 /* FIXME: generalize & move to common area */
504 adap->fe_adap[0].fe->callback = stk7700ph_xc3028_callback;
506 return dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &stk7700ph_xc3028_config)
507 == NULL ? -ENODEV : 0;
510 #define DEFAULT_RC_INTERVAL 50
513 * This function is used only when firmware is < 1.20 version. Newer
514 * firmwares use bulk mode, with functions implemented at dib0700_core,
515 * at dib0700_rc_urb_completion()
517 static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d)
519 enum rc_type protocol;
523 struct dib0700_state *st = d->priv;
525 if (st->fw_version >= 0x10200) {
526 /* For 1.20 firmware , We need to keep the RC polling
527 callback so we can reuse the input device setup in
528 dvb-usb-remote.c. However, the actual work is being done
529 in the bulk URB completion handler. */
533 st->buf[0] = REQUEST_POLL_RC;
536 i = dib0700_ctrl_rd(d, st->buf, 2, st->buf, 4);
538 err("RC Query Failed");
542 /* losing half of KEY_0 events from Philipps rc5 remotes.. */
543 if (st->buf[0] == 0 && st->buf[1] == 0
544 && st->buf[2] == 0 && st->buf[3] == 0)
547 /* info("%d: %2X %2X %2X %2X",dvb_usb_dib0700_ir_proto,(int)st->buf[3 - 2],(int)st->buf[3 - 3],(int)st->buf[3 - 1],(int)st->buf[3]); */
549 dib0700_rc_setup(d, NULL); /* reset ir sensor data to prevent false events */
551 switch (d->props.rc.core.protocol) {
553 /* NEC protocol sends repeat code as 0 0 0 FF */
554 if ((st->buf[3 - 2] == 0x00) && (st->buf[3 - 3] == 0x00) &&
555 (st->buf[3] == 0xff)) {
556 rc_repeat(d->rc_dev);
560 protocol = RC_TYPE_NEC;
561 scancode = RC_SCANCODE_NEC(st->buf[3 - 2], st->buf[3 - 3]);
566 /* RC-5 protocol changes toggle bit on new keypress */
567 protocol = RC_TYPE_RC5;
568 scancode = RC_SCANCODE_RC5(st->buf[3 - 2], st->buf[3 - 3]);
569 toggle = st->buf[3 - 1];
573 rc_keydown(d->rc_dev, protocol, scancode, toggle);
577 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
578 static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
581 /* 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,
582 * 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 */
583 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
584 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
624 static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
625 .band_caps = BAND_UHF | BAND_VHF,
626 /* 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,
627 * 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 */
628 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
654 .perform_agc_softsplit = 0,
657 static struct dibx000_bandwidth_config stk7700p_pll_config = {
670 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
676 static struct dib7000m_config stk7700p_dib7000m_config = {
678 .output_mpeg2_in_188_bytes = 1,
681 .agc_config_count = 1,
682 .agc = &stk7700p_7000m_mt2060_agc_config,
683 .bw = &stk7700p_pll_config,
685 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
686 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
687 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
690 static struct dib7000p_config stk7700p_dib7000p_config = {
691 .output_mpeg2_in_188_bytes = 1,
693 .agc_config_count = 1,
694 .agc = &stk7700p_7000p_mt2060_agc_config,
695 .bw = &stk7700p_pll_config,
697 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
698 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
699 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
702 static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
704 struct dib0700_state *st = adap->dev->priv;
705 struct dib0700_adapter_state *state = adap->priv;
707 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
710 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
712 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
713 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
715 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
716 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
718 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
719 dib0700_ctrl_clock(adap->dev, 72, 1);
720 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
722 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
724 st->mt2060_if1[0] = 1220;
726 if (state->dib7000p_ops.dib7000pc_detection(&adap->dev->i2c_adap)) {
727 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
728 st->is_dib7000pc = 1;
730 memset(&state->dib7000p_ops, 0, sizeof(state->dib7000p_ops));
731 adap->fe_adap[0].fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
734 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
737 static struct mt2060_config stk7700p_mt2060_config = {
741 static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
743 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
744 struct dib0700_state *st = adap->dev->priv;
745 struct i2c_adapter *tun_i2c;
746 struct dib0700_adapter_state *state = adap->priv;
750 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
751 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
752 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
754 if (st->is_dib7000pc)
755 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
757 tun_i2c = dib7000m_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
759 return dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, &stk7700p_mt2060_config,
760 if1) == NULL ? -ENODEV : 0;
763 /* DIB7070 generic */
764 static struct dibx000_agc_config dib7070_agc_config = {
765 .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
766 /* 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,
767 * 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 */
768 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
794 .perform_agc_softsplit = 0,
797 static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
799 struct dvb_usb_adapter *adap = fe->dvb->priv;
800 struct dib0700_adapter_state *state = adap->priv;
802 deb_info("reset: %d", onoff);
803 return state->dib7000p_ops.set_gpio(fe, 8, 0, !onoff);
806 static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
808 struct dvb_usb_adapter *adap = fe->dvb->priv;
809 struct dib0700_adapter_state *state = adap->priv;
811 deb_info("sleep: %d", onoff);
812 return state->dib7000p_ops.set_gpio(fe, 9, 0, onoff);
815 static struct dib0070_config dib7070p_dib0070_config[2] = {
817 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
818 .reset = dib7070_tuner_reset,
819 .sleep = dib7070_tuner_sleep,
821 .clock_pad_drive = 4,
824 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
825 .reset = dib7070_tuner_reset,
826 .sleep = dib7070_tuner_sleep,
832 static struct dib0070_config dib7770p_dib0070_config = {
833 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
834 .reset = dib7070_tuner_reset,
835 .sleep = dib7070_tuner_sleep,
837 .clock_pad_drive = 0,
842 static int dib7070_set_param_override(struct dvb_frontend *fe)
844 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
845 struct dvb_usb_adapter *adap = fe->dvb->priv;
846 struct dib0700_adapter_state *state = adap->priv;
849 u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
851 case BAND_VHF: offset = 950; break;
853 default: offset = 550; break;
855 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
856 state->dib7000p_ops.set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
857 return state->set_param_save(fe);
860 static int dib7770_set_param_override(struct dvb_frontend *fe)
862 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
863 struct dvb_usb_adapter *adap = fe->dvb->priv;
864 struct dib0700_adapter_state *state = adap->priv;
867 u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
870 state->dib7000p_ops.set_gpio(fe, 0, 0, 1);
875 state->dib7000p_ops.set_gpio(fe, 0, 0, 0);
879 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
880 state->dib7000p_ops.set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
881 return state->set_param_save(fe);
884 static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
886 struct dib0700_adapter_state *st = adap->priv;
887 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
888 DIBX000_I2C_INTERFACE_TUNER, 1);
890 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
891 &dib7770p_dib0070_config) == NULL)
894 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
895 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7770_set_param_override;
899 static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
901 struct dib0700_adapter_state *st = adap->priv;
902 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
905 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
908 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
912 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
913 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override;
917 static int stk7700p_pid_filter(struct dvb_usb_adapter *adapter, int index,
920 struct dib0700_adapter_state *state = adapter->priv;
921 struct dib0700_state *st = adapter->dev->priv;
923 if (st->is_dib7000pc)
924 return state->dib7000p_ops.pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
925 return dib7000m_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
928 static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
930 struct dib0700_state *st = adapter->dev->priv;
931 struct dib0700_adapter_state *state = adapter->priv;
932 if (st->is_dib7000pc)
933 return state->dib7000p_ops.pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
934 return dib7000m_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
937 static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
939 struct dib0700_adapter_state *state = adapter->priv;
940 return state->dib7000p_ops.pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
943 static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
945 struct dib0700_adapter_state *state = adapter->priv;
946 return state->dib7000p_ops.pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
949 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
962 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
963 .ifreq = (0 << 25) | 0,
968 static struct dib7000p_config dib7070p_dib7000p_config = {
969 .output_mpeg2_in_188_bytes = 1,
971 .agc_config_count = 1,
972 .agc = &dib7070_agc_config,
973 .bw = &dib7070_bw_config_12_mhz,
974 .tuner_is_baseband = 1,
977 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
978 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
979 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
981 .hostbus_diversity = 1,
985 static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
987 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
988 struct dib0700_adapter_state *state = adap->priv;
990 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
993 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
994 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
995 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
997 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
999 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1000 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1001 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1002 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1004 dib0700_ctrl_clock(adap->dev, 72, 1);
1007 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1009 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1011 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1012 &dib7070p_dib7000p_config) != 0) {
1013 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
1015 dvb_detach(state->dib7000p_ops.set_wbd_ref);
1019 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80,
1020 &dib7070p_dib7000p_config);
1021 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1025 static struct dib7000p_config dib7770p_dib7000p_config = {
1026 .output_mpeg2_in_188_bytes = 1,
1028 .agc_config_count = 1,
1029 .agc = &dib7070_agc_config,
1030 .bw = &dib7070_bw_config_12_mhz,
1031 .tuner_is_baseband = 1,
1034 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1035 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1036 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1038 .hostbus_diversity = 1,
1039 .enable_current_mirror = 1,
1040 .disable_sample_and_hold = 0,
1043 static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap)
1045 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
1046 struct dib0700_adapter_state *state = adap->priv;
1048 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
1051 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
1052 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
1053 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1055 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1057 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1058 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1059 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1060 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1062 dib0700_ctrl_clock(adap->dev, 72, 1);
1065 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1067 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1069 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1070 &dib7770p_dib7000p_config) != 0) {
1071 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
1073 dvb_detach(state->dib7000p_ops.set_wbd_ref);
1077 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80,
1078 &dib7770p_dib7000p_config);
1079 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1082 /* DIB807x generic */
1083 static struct dibx000_agc_config dib807x_agc_config[2] = {
1086 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1087 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1088 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1089 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1091 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1092 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1093 (0 << 0), /* setup*/
1096 10, /* time_stabiliz*/
1106 65535, /* agc1_max*/
1109 65535, /* agc2_max*/
1115 206, /* agc1_slope1*/
1116 255, /* agc1_slope2*/
1119 88, /* agc2_slope1*/
1120 90, /* agc2_slope2*/
1127 0, /* perform_agc_softsplit*/
1130 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1131 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1132 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1133 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1135 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1136 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1137 (0 << 0), /* setup */
1140 10, /* time_stabiliz*/
1150 65535, /* agc1_max*/
1153 65535, /* agc2_max*/
1159 206, /* agc1_slope1*/
1160 255, /* agc1_slope2*/
1163 88, /* agc2_slope1*/
1164 90, /* agc2_slope2*/
1171 0, /* perform_agc_softsplit*/
1175 static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
1185 .IO_CLK_en_core = 1,
1188 .sad_cfg = (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1189 .ifreq = (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1191 .xtal_hz = 12000000,
1194 static struct dib8000_config dib807x_dib8000_config[2] = {
1196 .output_mpeg2_in_188_bytes = 1,
1198 .agc_config_count = 2,
1199 .agc = dib807x_agc_config,
1200 .pll = &dib807x_bw_config_12_mhz,
1201 .tuner_is_baseband = 1,
1203 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1204 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1205 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1207 .hostbus_diversity = 1,
1209 .agc_control = &dib0070_ctrl_agc_filter,
1210 .output_mode = OUTMODE_MPEG2_FIFO,
1213 .output_mpeg2_in_188_bytes = 1,
1215 .agc_config_count = 2,
1216 .agc = dib807x_agc_config,
1217 .pll = &dib807x_bw_config_12_mhz,
1218 .tuner_is_baseband = 1,
1220 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1221 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1222 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1224 .hostbus_diversity = 1,
1225 .agc_control = &dib0070_ctrl_agc_filter,
1226 .output_mode = OUTMODE_MPEG2_FIFO,
1231 static int dib80xx_tuner_reset(struct dvb_frontend *fe, int onoff)
1233 struct dvb_usb_adapter *adap = fe->dvb->priv;
1234 struct dib0700_adapter_state *state = adap->priv;
1236 return state->dib8000_ops.set_gpio(fe, 5, 0, !onoff);
1239 static int dib80xx_tuner_sleep(struct dvb_frontend *fe, int onoff)
1241 struct dvb_usb_adapter *adap = fe->dvb->priv;
1242 struct dib0700_adapter_state *state = adap->priv;
1244 return state->dib8000_ops.set_gpio(fe, 0, 0, onoff);
1247 static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
1252 static struct dib0070_config dib807x_dib0070_config[2] = {
1254 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1255 .reset = dib80xx_tuner_reset,
1256 .sleep = dib80xx_tuner_sleep,
1258 .clock_pad_drive = 4,
1260 .force_crystal_mode = 1,
1261 .enable_third_order_filter = 1,
1263 .wbd_gain = dib8070_wbd_gain_cfg,
1264 .osc_buffer_state = 0,
1265 .freq_offset_khz_uhf = -100,
1266 .freq_offset_khz_vhf = -100,
1268 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1269 .reset = dib80xx_tuner_reset,
1270 .sleep = dib80xx_tuner_sleep,
1272 .clock_pad_drive = 2,
1274 .force_crystal_mode = 1,
1275 .enable_third_order_filter = 1,
1277 .wbd_gain = dib8070_wbd_gain_cfg,
1278 .osc_buffer_state = 0,
1279 .freq_offset_khz_uhf = -25,
1280 .freq_offset_khz_vhf = -25,
1284 static int dib807x_set_param_override(struct dvb_frontend *fe)
1286 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1287 struct dvb_usb_adapter *adap = fe->dvb->priv;
1288 struct dib0700_adapter_state *state = adap->priv;
1290 u16 offset = dib0070_wbd_offset(fe);
1291 u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
1296 case BAND_UHF: /* fall-thru wanted */
1298 offset += 250; break;
1300 deb_info("WBD for DiB8000: %d\n", offset);
1301 state->dib8000_ops.set_wbd_ref(fe, offset);
1303 return state->set_param_save(fe);
1306 static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1308 struct dib0700_adapter_state *st = adap->priv;
1309 struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe,
1310 DIBX000_I2C_INTERFACE_TUNER, 1);
1312 if (adap->id == 0) {
1313 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
1314 &dib807x_dib0070_config[0]) == NULL)
1317 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
1318 &dib807x_dib0070_config[1]) == NULL)
1322 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1323 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib807x_set_param_override;
1327 static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index,
1330 struct dib0700_adapter_state *state = adapter->priv;
1332 return state->dib8000_ops.pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
1335 static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter,
1338 struct dib0700_adapter_state *state = adapter->priv;
1340 return state->dib8000_ops.pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
1344 static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
1346 struct dib0700_adapter_state *state = adap->priv;
1348 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1351 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1353 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1354 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1355 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1357 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1359 dib0700_ctrl_clock(adap->dev, 72, 1);
1362 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1364 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1366 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1369 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80,
1370 &dib807x_dib8000_config[0]);
1372 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1376 static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
1378 struct dib0700_adapter_state *state = adap->priv;
1380 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1383 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1385 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1387 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1388 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1389 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1391 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1393 dib0700_ctrl_clock(adap->dev, 72, 1);
1396 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1398 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1400 /* initialize IC 0 */
1401 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80, 0);
1403 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80,
1404 &dib807x_dib8000_config[0]);
1406 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1409 static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
1411 struct dib0700_adapter_state *state = adap->priv;
1413 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1416 /* initialize IC 1 */
1417 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82, 0);
1419 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x82,
1420 &dib807x_dib8000_config[1]);
1422 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1426 static struct dibx000_agc_config dib8090_agc_config[2] = {
1428 .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
1429 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1430 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1431 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1432 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1433 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1436 .time_stabiliz = 10,
1467 .perform_agc_softsplit = 0,
1470 .band_caps = BAND_CBAND,
1471 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1472 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1473 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1474 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1475 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1478 .time_stabiliz = 10,
1509 .perform_agc_softsplit = 0,
1513 static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = {
1525 .IO_CLK_en_core = 1,
1529 .sad_cfg = (3 << 14) | (1 << 12) | (599 << 0),
1531 .ifreq = (0 << 25) | 0,
1534 .xtal_hz = 12000000,
1537 static int dib8090_get_adc_power(struct dvb_frontend *fe)
1539 struct dvb_usb_adapter *adap = fe->dvb->priv;
1540 struct dib0700_adapter_state *state = adap->priv;
1542 return state->dib8000_ops.get_adc_power(fe, 1);
1545 static void dib8090_agc_control(struct dvb_frontend *fe, u8 restart)
1547 deb_info("AGC control callback: %i\n", restart);
1548 dib0090_dcc_freq(fe, restart);
1550 if (restart == 0) /* before AGC startup */
1551 dib0090_set_dc_servo(fe, 1);
1554 static struct dib8000_config dib809x_dib8000_config[2] = {
1556 .output_mpeg2_in_188_bytes = 1,
1558 .agc_config_count = 2,
1559 .agc = dib8090_agc_config,
1560 .agc_control = dib8090_agc_control,
1561 .pll = &dib8090_pll_config_12mhz,
1562 .tuner_is_baseband = 1,
1564 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1565 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1566 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1568 .hostbus_diversity = 1,
1570 .output_mode = OUTMODE_MPEG2_FIFO,
1572 .diversity_delay = 48,
1575 .output_mpeg2_in_188_bytes = 1,
1577 .agc_config_count = 2,
1578 .agc = dib8090_agc_config,
1579 .agc_control = dib8090_agc_control,
1580 .pll = &dib8090_pll_config_12mhz,
1581 .tuner_is_baseband = 1,
1583 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1584 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1585 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1587 .hostbus_diversity = 1,
1589 .output_mode = OUTMODE_DIVERSITY,
1591 .diversity_delay = 1,
1596 static struct dib0090_wbd_slope dib8090_wbd_table[] = {
1597 /* max freq ; cold slope ; cold offset ; warm slope ; warm offset ; wbd gain */
1598 { 120, 0, 500, 0, 500, 4 }, /* CBAND */
1599 { 170, 0, 450, 0, 450, 4 }, /* CBAND */
1600 { 380, 48, 373, 28, 259, 6 }, /* VHF */
1601 { 860, 34, 700, 36, 616, 6 }, /* high UHF */
1602 { 0xFFFF, 34, 700, 36, 616, 6 }, /* default */
1605 static struct dib0090_config dib809x_dib0090_config = {
1609 .io.pll_loopdiv = 20,
1610 .io.adc_clock_ratio = 8,
1611 .io.pll_int_loop_filt = 0,
1612 .io.clock_khz = 12000,
1613 .reset = dib80xx_tuner_reset,
1614 .sleep = dib80xx_tuner_sleep,
1617 .i2c_address = DEFAULT_DIB0090_I2C_ADDRESS,
1620 .get_adc_power = dib8090_get_adc_power,
1621 .freq_offset_khz_uhf = -63,
1622 .freq_offset_khz_vhf = -143,
1623 .wbd = dib8090_wbd_table,
1624 .fref_clock_ratio = 6,
1627 static u8 dib8090_compute_pll_parameters(struct dvb_frontend *fe)
1629 u8 optimal_pll_ratio = 20;
1630 u32 freq_adc, ratio, rest, max = 0;
1633 for (pll_ratio = 17; pll_ratio <= 20; pll_ratio++) {
1634 freq_adc = 12 * pll_ratio * (1 << 8) / 16;
1635 ratio = ((fe->dtv_property_cache.frequency / 1000) * (1 << 8) / 1000) / freq_adc;
1636 rest = ((fe->dtv_property_cache.frequency / 1000) * (1 << 8) / 1000) - ratio * freq_adc;
1638 if (rest > freq_adc / 2)
1639 rest = freq_adc - rest;
1640 deb_info("PLL ratio=%i rest=%i\n", pll_ratio, rest);
1641 if ((rest > max) && (rest > 717)) {
1642 optimal_pll_ratio = pll_ratio;
1646 deb_info("optimal PLL ratio=%i\n", optimal_pll_ratio);
1648 return optimal_pll_ratio;
1651 static int dib8096_set_param_override(struct dvb_frontend *fe)
1653 struct dvb_usb_adapter *adap = fe->dvb->priv;
1654 struct dib0700_adapter_state *state = adap->priv;
1655 u8 pll_ratio, band = BAND_OF_FREQUENCY(fe->dtv_property_cache.frequency / 1000);
1656 u16 target, ltgain, rf_gain_limit;
1659 enum frontend_tune_state tune_state = CT_SHUTDOWN;
1663 deb_info("Warning : Rf frequency (%iHz) is not in the supported range, using VHF switch ", fe->dtv_property_cache.frequency);
1665 state->dib8000_ops.set_gpio(fe, 3, 0, 1);
1668 state->dib8000_ops.set_gpio(fe, 3, 0, 0);
1672 ret = state->set_param_save(fe);
1676 if (fe->dtv_property_cache.bandwidth_hz != 6000000) {
1677 deb_info("only 6MHz bandwidth is supported\n");
1681 /** Update PLL if needed ratio **/
1682 state->dib8000_ops.update_pll(fe, &dib8090_pll_config_12mhz, fe->dtv_property_cache.bandwidth_hz / 1000, 0);
1684 /** Get optimize PLL ratio to remove spurious **/
1685 pll_ratio = dib8090_compute_pll_parameters(fe);
1686 if (pll_ratio == 17)
1688 else if (pll_ratio == 18)
1690 else if (pll_ratio == 19)
1695 /** Update ratio **/
1696 state->dib8000_ops.update_pll(fe, &dib8090_pll_config_12mhz, fe->dtv_property_cache.bandwidth_hz / 1000, pll_ratio);
1698 state->dib8000_ops.ctrl_timf(fe, DEMOD_TIMF_SET, timf);
1700 if (band != BAND_CBAND) {
1701 /* dib0090_get_wbd_target is returning any possible temperature compensated wbd-target */
1702 target = (dib0090_get_wbd_target(fe) * 8 * 18 / 33 + 1) / 2;
1703 state->dib8000_ops.set_wbd_ref(fe, target);
1706 if (band == BAND_CBAND) {
1707 deb_info("tuning in CBAND - soft-AGC startup\n");
1708 dib0090_set_tune_state(fe, CT_AGC_START);
1711 ret = dib0090_gain_control(fe);
1713 tune_state = dib0090_get_tune_state(fe);
1714 if (tune_state == CT_AGC_STEP_0)
1715 state->dib8000_ops.set_gpio(fe, 6, 0, 1);
1716 else if (tune_state == CT_AGC_STEP_1) {
1717 dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, <gain);
1718 if (rf_gain_limit < 2000) /* activate the external attenuator in case of very high input power */
1719 state->dib8000_ops.set_gpio(fe, 6, 0, 0);
1721 } while (tune_state < CT_AGC_STOP);
1723 deb_info("switching to PWM AGC\n");
1724 dib0090_pwm_gain_reset(fe);
1725 state->dib8000_ops.pwm_agc_reset(fe);
1726 state->dib8000_ops.set_tune_state(fe, CT_DEMOD_START);
1728 /* for everything else than CBAND we are using standard AGC */
1729 deb_info("not tuning in CBAND - standard AGC startup\n");
1730 dib0090_pwm_gain_reset(fe);
1736 static int dib809x_tuner_attach(struct dvb_usb_adapter *adap)
1738 struct dib0700_adapter_state *st = adap->priv;
1739 struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1741 if (adap->id == 0) {
1742 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1745 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1749 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1750 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1754 static int stk809x_frontend_attach(struct dvb_usb_adapter *adap)
1756 struct dib0700_adapter_state *state = adap->priv;
1758 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1761 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1763 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1764 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1765 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1767 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1769 dib0700_ctrl_clock(adap->dev, 72, 1);
1772 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1774 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1776 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80, 0);
1778 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
1780 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1783 static int stk809x_frontend1_attach(struct dvb_usb_adapter *adap)
1785 struct dib0700_adapter_state *state = adap->priv;
1787 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1790 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x82, 0);
1792 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x82, &dib809x_dib8000_config[1]);
1794 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1797 static int nim8096md_tuner_attach(struct dvb_usb_adapter *adap)
1799 struct dib0700_adapter_state *st = adap->priv;
1800 struct i2c_adapter *tun_i2c;
1801 struct dvb_frontend *fe_slave = st->dib8000_ops.get_slave_frontend(adap->fe_adap[0].fe, 1);
1804 tun_i2c = st->dib8000_ops.get_i2c_master(fe_slave, DIBX000_I2C_INTERFACE_TUNER, 1);
1805 if (dvb_attach(dib0090_register, fe_slave, tun_i2c, &dib809x_dib0090_config) == NULL)
1807 fe_slave->dvb = adap->fe_adap[0].fe->dvb;
1808 fe_slave->ops.tuner_ops.set_params = dib8096_set_param_override;
1810 tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1811 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1814 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1815 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1820 static int nim8096md_frontend_attach(struct dvb_usb_adapter *adap)
1822 struct dvb_frontend *fe_slave;
1823 struct dib0700_adapter_state *state = adap->priv;
1825 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1828 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1830 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1832 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1833 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1834 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1836 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1838 dib0700_ctrl_clock(adap->dev, 72, 1);
1841 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1843 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1845 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 2, 18, 0x80, 0);
1847 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
1848 if (adap->fe_adap[0].fe == NULL)
1851 /* Needed to increment refcount */
1852 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1855 fe_slave = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x82, &dib809x_dib8000_config[1]);
1856 state->dib8000_ops.set_slave_frontend(adap->fe_adap[0].fe, fe_slave);
1858 return fe_slave == NULL ? -ENODEV : 0;
1862 static struct dibx000_agc_config dib8096p_agc_config[2] = {
1864 .band_caps = BAND_UHF,
1865 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1866 P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1867 P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1868 P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1870 .setup = (0 << 15) | (0 << 14) | (5 << 11)
1871 | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5)
1872 | (0 << 4) | (5 << 1) | (0 << 0),
1875 .time_stabiliz = 10,
1906 .perform_agc_softsplit = 0,
1908 .band_caps = BAND_FM | BAND_VHF | BAND_CBAND,
1909 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1910 P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1911 P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1912 P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1914 .setup = (0 << 15) | (0 << 14) | (5 << 11)
1915 | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5)
1916 | (0 << 4) | (5 << 1) | (0 << 0),
1919 .time_stabiliz = 10,
1950 .perform_agc_softsplit = 0,
1954 static struct dibx000_bandwidth_config dib8096p_clock_config_12_mhz = {
1964 .IO_CLK_en_core = 0,
1967 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
1968 .ifreq = (0 << 25) | 0,
1970 .xtal_hz = 12000000,
1973 static struct dib8000_config tfe8096p_dib8000_config = {
1974 .output_mpeg2_in_188_bytes = 1,
1975 .hostbus_diversity = 1,
1978 .agc_config_count = 2,
1979 .agc = dib8096p_agc_config,
1980 .pll = &dib8096p_clock_config_12_mhz,
1982 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1983 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1984 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1986 .agc_control = NULL,
1987 .diversity_delay = 48,
1988 .output_mode = OUTMODE_MPEG2_FIFO,
1992 static struct dib0090_wbd_slope dib8096p_wbd_table[] = {
1993 { 380, 81, 850, 64, 540, 4},
1994 { 860, 51, 866, 21, 375, 4},
1995 {1700, 0, 250, 0, 100, 6},
1996 {2600, 0, 250, 0, 100, 6},
1997 { 0xFFFF, 0, 0, 0, 0, 0},
2000 static struct dib0090_config tfe8096p_dib0090_config = {
2001 .io.clock_khz = 12000,
2005 .io.pll_loopdiv = 6,
2006 .io.adc_clock_ratio = 0,
2007 .io.pll_int_loop_filt = 0,
2009 .freq_offset_khz_uhf = -143,
2010 .freq_offset_khz_vhf = -143,
2012 .get_adc_power = dib8090_get_adc_power,
2017 .wbd_vhf_offset = 0,
2018 .wbd_cband_offset = 0,
2022 .fref_clock_ratio = 1,
2024 .ls_cfg_pad_drv = 0,
2028 .force_cband_input = 0,
2031 struct dibx090p_adc {
2032 u32 freq; /* RF freq MHz */
2033 u32 timf; /* New Timf */
2034 u32 pll_loopdiv; /* New prediv */
2035 u32 pll_prediv; /* New loopdiv */
2038 struct dibx090p_best_adc {
2044 static int dib8096p_get_best_sampling(struct dvb_frontend *fe, struct dibx090p_best_adc *adc)
2046 u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1;
2048 u16 fcp_min = 1900; /* PLL, Minimum Frequency of phase comparator (KHz) */
2049 u16 fcp_max = 20000; /* PLL, Maximum Frequency of phase comparator (KHz) */
2050 u32 fmem_max = 140000; /* 140MHz max SDRAM freq */
2051 u32 fdem_min = 66000;
2052 u32 fcp = 0, fs = 0, fdem = 0, fmem = 0;
2053 u32 harmonic_id = 0;
2056 adc->pll_loopdiv = loopdiv;
2057 adc->pll_prediv = prediv;
2059 deb_info("bandwidth = %d", fe->dtv_property_cache.bandwidth_hz);
2061 /* Find Min and Max prediv */
2062 while ((xtal / max_prediv) >= fcp_min)
2066 min_prediv = max_prediv;
2067 while ((xtal / min_prediv) <= fcp_max) {
2069 if (min_prediv == 1)
2072 deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv);
2076 for (prediv = min_prediv; prediv < max_prediv; prediv++) {
2077 fcp = xtal / prediv;
2078 if (fcp > fcp_min && fcp < fcp_max) {
2079 for (loopdiv = 1; loopdiv < 64; loopdiv++) {
2080 fmem = ((xtal/prediv) * loopdiv);
2084 /* test min/max system restrictions */
2085 if ((fdem >= fdem_min) && (fmem <= fmem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz / 1000)) {
2087 /* test fs harmonics positions */
2088 for (harmonic_id = (fe->dtv_property_cache.frequency / (1000 * fs)); harmonic_id <= ((fe->dtv_property_cache.frequency / (1000 * fs)) + 1); harmonic_id++) {
2089 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)))) {
2096 adc->pll_loopdiv = loopdiv;
2097 adc->pll_prediv = prediv;
2098 adc->timf = (4260880253U / fdem) * (1 << 8);
2099 adc->timf += ((4260880253U % fdem) << 8) / fdem;
2101 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);
2111 if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0)
2116 static int dib8096p_agc_startup(struct dvb_frontend *fe)
2118 struct dvb_usb_adapter *adap = fe->dvb->priv;
2119 struct dib0700_adapter_state *state = adap->priv;
2120 struct dibx000_bandwidth_config pll;
2121 struct dibx090p_best_adc adc;
2125 ret = state->set_param_save(fe);
2128 memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));
2130 dib0090_pwm_gain_reset(fe);
2131 /* dib0090_get_wbd_target is returning any possible
2132 temperature compensated wbd-target */
2133 target = (dib0090_get_wbd_target(fe) * 8 + 1) / 2;
2134 state->dib8000_ops.set_wbd_ref(fe, target);
2136 if (dib8096p_get_best_sampling(fe, &adc) == 0) {
2137 pll.pll_ratio = adc.pll_loopdiv;
2138 pll.pll_prediv = adc.pll_prediv;
2140 dib0700_set_i2c_speed(adap->dev, 200);
2141 state->dib8000_ops.update_pll(fe, &pll, fe->dtv_property_cache.bandwidth_hz / 1000, 0);
2142 state->dib8000_ops.ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf);
2143 dib0700_set_i2c_speed(adap->dev, 1000);
2148 static int tfe8096p_frontend_attach(struct dvb_usb_adapter *adap)
2150 struct dib0700_state *st = adap->dev->priv;
2152 struct dib0700_adapter_state *state = adap->priv;
2154 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
2157 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
2158 if (fw_version >= 0x10200)
2159 st->fw_use_new_i2c_api = 1;
2161 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2163 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2164 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2165 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2167 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2169 dib0700_ctrl_clock(adap->dev, 72, 1);
2172 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2174 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2176 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80, 1);
2178 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap,
2179 0x80, &tfe8096p_dib8000_config);
2181 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
2184 static int tfe8096p_tuner_attach(struct dvb_usb_adapter *adap)
2186 struct dib0700_adapter_state *st = adap->priv;
2187 struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_tuner(adap->fe_adap[0].fe);
2189 tfe8096p_dib0090_config.reset = st->dib8000_ops.tuner_sleep;
2190 tfe8096p_dib0090_config.sleep = st->dib8000_ops.tuner_sleep;
2191 tfe8096p_dib0090_config.wbd = dib8096p_wbd_table;
2193 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c,
2194 &tfe8096p_dib0090_config) == NULL)
2197 st->dib8000_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
2199 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
2200 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096p_agc_startup;
2205 static int dib90x0_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
2207 return dib9000_fw_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
2210 static int dib90x0_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
2212 return dib9000_fw_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
2215 static int dib90x0_tuner_reset(struct dvb_frontend *fe, int onoff)
2217 return dib9000_set_gpio(fe, 5, 0, !onoff);
2220 static int dib90x0_tuner_sleep(struct dvb_frontend *fe, int onoff)
2222 return dib9000_set_gpio(fe, 0, 0, onoff);
2225 static int dib01x0_pmu_update(struct i2c_adapter *i2c, u16 *data, u8 len)
2227 u8 wb[4] = { 0xc >> 8, 0xc & 0xff, 0, 0 };
2229 struct i2c_msg msg[2] = {
2230 {.addr = 0x1e >> 1, .flags = 0, .buf = wb, .len = 2},
2231 {.addr = 0x1e >> 1, .flags = I2C_M_RD, .buf = rb, .len = 2},
2235 dibx000_i2c_set_speed(i2c, 250);
2237 if (i2c_transfer(i2c, msg, 2) != 2)
2240 switch (rb[0] << 8 | rb[1]) {
2242 deb_info("Found DiB0170 rev1: This version of DiB0170 is not supported any longer.\n");
2245 deb_info("Found DiB0170 rev2");
2248 deb_info("Found DiB0190 rev2");
2251 deb_info("DiB01x0 not found");
2255 for (index_data = 0; index_data < len; index_data += 2) {
2256 wb[2] = (data[index_data + 1] >> 8) & 0xff;
2257 wb[3] = (data[index_data + 1]) & 0xff;
2259 if (data[index_data] == 0) {
2260 wb[0] = (data[index_data] >> 8) & 0xff;
2261 wb[1] = (data[index_data]) & 0xff;
2263 if (i2c_transfer(i2c, msg, 2) != 2)
2266 wb[3] |= rb[1] & ~(3 << 4);
2269 wb[0] = (data[index_data] >> 8)&0xff;
2270 wb[1] = (data[index_data])&0xff;
2272 if (i2c_transfer(i2c, &msg[0], 1) != 1)
2278 static struct dib9000_config stk9090m_config = {
2279 .output_mpeg2_in_188_bytes = 1,
2280 .output_mode = OUTMODE_MPEG2_FIFO,
2281 .vcxo_timer = 279620,
2282 .timing_frequency = 20452225,
2283 .demod_clock_khz = 60000,
2284 .xtal_clock_khz = 30000,
2285 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
2289 { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0008 } }, /* GPIO 3 to 1 for VHF */
2290 { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0000 } }, /* GPIO 3 to 0 for UHF */
2295 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
2296 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
2300 static struct dib9000_config nim9090md_config[2] = {
2302 .output_mpeg2_in_188_bytes = 1,
2303 .output_mode = OUTMODE_MPEG2_FIFO,
2304 .vcxo_timer = 279620,
2305 .timing_frequency = 20452225,
2306 .demod_clock_khz = 60000,
2307 .xtal_clock_khz = 30000,
2308 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
2310 .output_mpeg2_in_188_bytes = 1,
2311 .output_mode = OUTMODE_DIVERSITY,
2312 .vcxo_timer = 279620,
2313 .timing_frequency = 20452225,
2314 .demod_clock_khz = 60000,
2315 .xtal_clock_khz = 30000,
2316 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
2320 { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0006 } }, /* GPIO 1 and 2 to 1 for VHF */
2321 { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0000 } }, /* GPIO 1 and 2 to 0 for UHF */
2326 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
2327 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
2332 static struct dib0090_config dib9090_dib0090_config = {
2336 .io.pll_loopdiv = 8,
2337 .io.adc_clock_ratio = 8,
2338 .io.pll_int_loop_filt = 0,
2339 .io.clock_khz = 30000,
2340 .reset = dib90x0_tuner_reset,
2341 .sleep = dib90x0_tuner_sleep,
2346 .freq_offset_khz_uhf = 0,
2347 .freq_offset_khz_vhf = 0,
2350 static struct dib0090_config nim9090md_dib0090_config[2] = {
2355 .io.pll_loopdiv = 8,
2356 .io.adc_clock_ratio = 8,
2357 .io.pll_int_loop_filt = 0,
2358 .io.clock_khz = 30000,
2359 .reset = dib90x0_tuner_reset,
2360 .sleep = dib90x0_tuner_sleep,
2365 .freq_offset_khz_uhf = 0,
2366 .freq_offset_khz_vhf = 0,
2371 .io.pll_loopdiv = 8,
2372 .io.adc_clock_ratio = 8,
2373 .io.pll_int_loop_filt = 0,
2374 .io.clock_khz = 30000,
2375 .reset = dib90x0_tuner_reset,
2376 .sleep = dib90x0_tuner_sleep,
2381 .freq_offset_khz_uhf = 0,
2382 .freq_offset_khz_vhf = 0,
2387 static int stk9090m_frontend_attach(struct dvb_usb_adapter *adap)
2389 struct dib0700_adapter_state *state = adap->priv;
2390 struct dib0700_state *st = adap->dev->priv;
2393 /* Make use of the new i2c functions from FW 1.20 */
2394 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
2395 if (fw_version >= 0x10200)
2396 st->fw_use_new_i2c_api = 1;
2397 dib0700_set_i2c_speed(adap->dev, 340);
2399 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2401 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2402 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2403 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2404 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2406 dib0700_ctrl_clock(adap->dev, 72, 1);
2409 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2411 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2413 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80);
2415 if (reject_firmware(&state->frontend_firmware, "/*(DEBLOBBED)*/", &adap->dev->udev->dev)) {
2416 deb_info("%s: Upload failed. (file not found?)\n", __func__);
2419 deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
2421 stk9090m_config.microcode_B_fe_size = state->frontend_firmware->size;
2422 stk9090m_config.microcode_B_fe_buffer = state->frontend_firmware->data;
2424 adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &stk9090m_config);
2426 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
2429 static int dib9090_tuner_attach(struct dvb_usb_adapter *adap)
2431 struct dib0700_adapter_state *state = adap->priv;
2432 struct i2c_adapter *i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe);
2433 u16 data_dib190[10] = {
2441 if (!IS_ENABLED(CONFIG_DVB_DIB9000))
2443 if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &dib9090_dib0090_config) == NULL)
2445 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
2448 if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0)
2450 dib0700_set_i2c_speed(adap->dev, 1500);
2451 if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0)
2453 release_firmware(state->frontend_firmware);
2457 static int nim9090md_frontend_attach(struct dvb_usb_adapter *adap)
2459 struct dib0700_adapter_state *state = adap->priv;
2460 struct dib0700_state *st = adap->dev->priv;
2461 struct i2c_adapter *i2c;
2462 struct dvb_frontend *fe_slave;
2465 /* Make use of the new i2c functions from FW 1.20 */
2466 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
2467 if (fw_version >= 0x10200)
2468 st->fw_use_new_i2c_api = 1;
2469 dib0700_set_i2c_speed(adap->dev, 340);
2471 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2473 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2474 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2475 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2476 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2478 dib0700_ctrl_clock(adap->dev, 72, 1);
2481 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2483 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2485 if (reject_firmware(&state->frontend_firmware, "/*(DEBLOBBED)*/", &adap->dev->udev->dev)) {
2486 deb_info("%s: Upload failed. (file not found?)\n", __func__);
2489 deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
2491 nim9090md_config[0].microcode_B_fe_size = state->frontend_firmware->size;
2492 nim9090md_config[0].microcode_B_fe_buffer = state->frontend_firmware->data;
2493 nim9090md_config[1].microcode_B_fe_size = state->frontend_firmware->size;
2494 nim9090md_config[1].microcode_B_fe_buffer = state->frontend_firmware->data;
2496 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, 0x80);
2497 adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &nim9090md_config[0]);
2499 if (adap->fe_adap[0].fe == NULL)
2502 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_3_4, 0);
2503 dib9000_i2c_enumeration(i2c, 1, 0x12, 0x82);
2505 fe_slave = dvb_attach(dib9000_attach, i2c, 0x82, &nim9090md_config[1]);
2506 dib9000_set_slave_frontend(adap->fe_adap[0].fe, fe_slave);
2508 return fe_slave == NULL ? -ENODEV : 0;
2511 static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap)
2513 struct dib0700_adapter_state *state = adap->priv;
2514 struct i2c_adapter *i2c;
2515 struct dvb_frontend *fe_slave;
2516 u16 data_dib190[10] = {
2523 if (!IS_ENABLED(CONFIG_DVB_DIB9000))
2525 i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe);
2526 if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &nim9090md_dib0090_config[0]) == NULL)
2528 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
2531 if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0)
2534 dib0700_set_i2c_speed(adap->dev, 1500);
2535 if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0)
2538 fe_slave = dib9000_get_slave_frontend(adap->fe_adap[0].fe, 1);
2539 if (fe_slave != NULL) {
2540 i2c = dib9000_get_component_bus_interface(adap->fe_adap[0].fe);
2541 dib9000_set_i2c_adapter(fe_slave, i2c);
2543 i2c = dib9000_get_tuner_interface(fe_slave);
2544 if (dvb_attach(dib0090_fw_register, fe_slave, i2c, &nim9090md_dib0090_config[1]) == NULL)
2546 fe_slave->dvb = adap->fe_adap[0].fe->dvb;
2547 dib9000_fw_set_component_bus_speed(adap->fe_adap[0].fe, 1500);
2548 if (dib9000_firmware_post_pll_init(fe_slave) < 0)
2551 release_firmware(state->frontend_firmware);
2557 static int dib7090p_get_best_sampling(struct dvb_frontend *fe , struct dibx090p_best_adc *adc)
2559 u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1;
2562 u32 fcp_min = 1900; /* PLL Minimum Frequency comparator KHz */
2563 u32 fcp_max = 20000; /* PLL Maximum Frequency comparator KHz */
2564 u32 fdem_max = 76000;
2565 u32 fdem_min = 69500;
2566 u32 fcp = 0, fs = 0, fdem = 0;
2567 u32 harmonic_id = 0;
2569 adc->pll_loopdiv = loopdiv;
2570 adc->pll_prediv = prediv;
2573 deb_info("bandwidth = %d fdem_min =%d", fe->dtv_property_cache.bandwidth_hz, fdem_min);
2575 /* Find Min and Max prediv */
2576 while ((xtal/max_prediv) >= fcp_min)
2580 min_prediv = max_prediv;
2581 while ((xtal/min_prediv) <= fcp_max) {
2583 if (min_prediv == 1)
2586 deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv);
2590 for (prediv = min_prediv ; prediv < max_prediv; prediv++) {
2591 fcp = xtal / prediv;
2592 if (fcp > fcp_min && fcp < fcp_max) {
2593 for (loopdiv = 1 ; loopdiv < 64 ; loopdiv++) {
2594 fdem = ((xtal/prediv) * loopdiv);
2596 /* test min/max system restrictions */
2598 if ((fdem >= fdem_min) && (fdem <= fdem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz/1000)) {
2600 /* test fs harmonics positions */
2601 for (harmonic_id = (fe->dtv_property_cache.frequency / (1000*fs)) ; harmonic_id <= ((fe->dtv_property_cache.frequency / (1000*fs))+1) ; harmonic_id++) {
2602 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)))) {
2609 adc->pll_loopdiv = loopdiv;
2610 adc->pll_prediv = prediv;
2611 adc->timf = 2396745143UL/fdem*(1 << 9);
2612 adc->timf += ((2396745143UL%fdem) << 9)/fdem;
2613 deb_info("loopdiv=%i prediv=%i timf=%i", loopdiv, prediv, adc->timf);
2624 if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0)
2630 static int dib7090_agc_startup(struct dvb_frontend *fe)
2632 struct dvb_usb_adapter *adap = fe->dvb->priv;
2633 struct dib0700_adapter_state *state = adap->priv;
2634 struct dibx000_bandwidth_config pll;
2636 struct dibx090p_best_adc adc;
2639 ret = state->set_param_save(fe);
2643 memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));
2644 dib0090_pwm_gain_reset(fe);
2645 target = (dib0090_get_wbd_target(fe) * 8 + 1) / 2;
2646 state->dib7000p_ops.set_wbd_ref(fe, target);
2648 if (dib7090p_get_best_sampling(fe, &adc) == 0) {
2649 pll.pll_ratio = adc.pll_loopdiv;
2650 pll.pll_prediv = adc.pll_prediv;
2652 state->dib7000p_ops.update_pll(fe, &pll);
2653 state->dib7000p_ops.ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf);
2658 static int dib7090_agc_restart(struct dvb_frontend *fe, u8 restart)
2660 deb_info("AGC restart callback: %d", restart);
2661 if (restart == 0) /* before AGC startup */
2662 dib0090_set_dc_servo(fe, 1);
2666 static int tfe7790p_update_lna(struct dvb_frontend *fe, u16 agc_global)
2668 struct dvb_usb_adapter *adap = fe->dvb->priv;
2669 struct dib0700_adapter_state *state = adap->priv;
2671 deb_info("update LNA: agc global=%i", agc_global);
2673 if (agc_global < 25000) {
2674 state->dib7000p_ops.set_gpio(fe, 8, 0, 0);
2675 state->dib7000p_ops.set_agc1_min(fe, 0);
2677 state->dib7000p_ops.set_gpio(fe, 8, 0, 1);
2678 state->dib7000p_ops.set_agc1_min(fe, 32768);
2684 static struct dib0090_wbd_slope dib7090_wbd_table[] = {
2685 { 380, 81, 850, 64, 540, 4},
2686 { 860, 51, 866, 21, 375, 4},
2687 {1700, 0, 250, 0, 100, 6},
2688 {2600, 0, 250, 0, 100, 6},
2689 { 0xFFFF, 0, 0, 0, 0, 0},
2692 static struct dibx000_agc_config dib7090_agc_config[2] = {
2694 .band_caps = BAND_UHF,
2695 /* 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,
2696 * 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 */
2697 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2700 .time_stabiliz = 10,
2731 .perform_agc_softsplit = 0,
2733 .band_caps = BAND_FM | BAND_VHF | BAND_CBAND,
2734 /* 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,
2735 * 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 */
2736 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2739 .time_stabiliz = 10,
2770 .perform_agc_softsplit = 0,
2774 static struct dibx000_bandwidth_config dib7090_clock_config_12_mhz = {
2784 .IO_CLK_en_core = 1,
2787 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
2788 .ifreq = (0 << 25) | 0,
2790 .xtal_hz = 15000000,
2793 static struct dib7000p_config nim7090_dib7000p_config = {
2794 .output_mpeg2_in_188_bytes = 1,
2795 .hostbus_diversity = 1,
2796 .tuner_is_baseband = 1,
2797 .update_lna = tfe7790p_update_lna, /* GPIO used is the same as TFE7790 */
2799 .agc_config_count = 2,
2800 .agc = dib7090_agc_config,
2802 .bw = &dib7090_clock_config_12_mhz,
2804 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2805 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2806 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2810 .agc_control = dib7090_agc_restart,
2813 .disable_sample_and_hold = 0,
2814 .enable_current_mirror = 0,
2815 .diversity_delay = 0,
2817 .output_mode = OUTMODE_MPEG2_FIFO,
2821 static int tfe7090p_pvr_update_lna(struct dvb_frontend *fe, u16 agc_global)
2823 struct dvb_usb_adapter *adap = fe->dvb->priv;
2824 struct dib0700_adapter_state *state = adap->priv;
2826 deb_info("TFE7090P-PVR update LNA: agc global=%i", agc_global);
2827 if (agc_global < 25000) {
2828 state->dib7000p_ops.set_gpio(fe, 5, 0, 0);
2829 state->dib7000p_ops.set_agc1_min(fe, 0);
2831 state->dib7000p_ops.set_gpio(fe, 5, 0, 1);
2832 state->dib7000p_ops.set_agc1_min(fe, 32768);
2838 static struct dib7000p_config tfe7090pvr_dib7000p_config[2] = {
2840 .output_mpeg2_in_188_bytes = 1,
2841 .hostbus_diversity = 1,
2842 .tuner_is_baseband = 1,
2843 .update_lna = tfe7090p_pvr_update_lna,
2845 .agc_config_count = 2,
2846 .agc = dib7090_agc_config,
2848 .bw = &dib7090_clock_config_12_mhz,
2850 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2851 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2852 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2856 .agc_control = dib7090_agc_restart,
2859 .disable_sample_and_hold = 0,
2860 .enable_current_mirror = 0,
2861 .diversity_delay = 0,
2863 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2864 .default_i2c_addr = 0x90,
2867 .output_mpeg2_in_188_bytes = 1,
2868 .hostbus_diversity = 1,
2869 .tuner_is_baseband = 1,
2870 .update_lna = tfe7090p_pvr_update_lna,
2872 .agc_config_count = 2,
2873 .agc = dib7090_agc_config,
2875 .bw = &dib7090_clock_config_12_mhz,
2877 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2878 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2879 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2883 .agc_control = dib7090_agc_restart,
2886 .disable_sample_and_hold = 0,
2887 .enable_current_mirror = 0,
2888 .diversity_delay = 0,
2890 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2891 .default_i2c_addr = 0x92,
2896 static struct dib0090_config nim7090_dib0090_config = {
2897 .io.clock_khz = 12000,
2901 .io.pll_loopdiv = 6,
2902 .io.adc_clock_ratio = 0,
2903 .io.pll_int_loop_filt = 0,
2905 .freq_offset_khz_uhf = 0,
2906 .freq_offset_khz_vhf = 0,
2911 .wbd_vhf_offset = 0,
2912 .wbd_cband_offset = 0,
2916 .fref_clock_ratio = 0,
2918 .wbd = dib7090_wbd_table,
2920 .ls_cfg_pad_drv = 0,
2926 static struct dib7000p_config tfe7790p_dib7000p_config = {
2927 .output_mpeg2_in_188_bytes = 1,
2928 .hostbus_diversity = 1,
2929 .tuner_is_baseband = 1,
2930 .update_lna = tfe7790p_update_lna,
2932 .agc_config_count = 2,
2933 .agc = dib7090_agc_config,
2935 .bw = &dib7090_clock_config_12_mhz,
2937 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2938 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2939 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2943 .agc_control = dib7090_agc_restart,
2946 .disable_sample_and_hold = 0,
2947 .enable_current_mirror = 0,
2948 .diversity_delay = 0,
2950 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2954 static struct dib0090_config tfe7790p_dib0090_config = {
2955 .io.clock_khz = 12000,
2959 .io.pll_loopdiv = 6,
2960 .io.adc_clock_ratio = 0,
2961 .io.pll_int_loop_filt = 0,
2963 .freq_offset_khz_uhf = 0,
2964 .freq_offset_khz_vhf = 0,
2969 .wbd_vhf_offset = 0,
2970 .wbd_cband_offset = 0,
2974 .fref_clock_ratio = 0,
2976 .wbd = dib7090_wbd_table,
2978 .ls_cfg_pad_drv = 0,
2982 .force_cband_input = 0,
2984 .force_crystal_mode = 1,
2987 static struct dib0090_config tfe7090pvr_dib0090_config[2] = {
2989 .io.clock_khz = 12000,
2993 .io.pll_loopdiv = 6,
2994 .io.adc_clock_ratio = 0,
2995 .io.pll_int_loop_filt = 0,
2997 .freq_offset_khz_uhf = 50,
2998 .freq_offset_khz_vhf = 70,
3003 .wbd_vhf_offset = 0,
3004 .wbd_cband_offset = 0,
3008 .fref_clock_ratio = 0,
3010 .wbd = dib7090_wbd_table,
3012 .ls_cfg_pad_drv = 0,
3017 .io.clock_khz = 12000,
3021 .io.pll_loopdiv = 6,
3022 .io.adc_clock_ratio = 0,
3023 .io.pll_int_loop_filt = 0,
3025 .freq_offset_khz_uhf = -50,
3026 .freq_offset_khz_vhf = -70,
3031 .wbd_vhf_offset = 0,
3032 .wbd_cband_offset = 0,
3036 .fref_clock_ratio = 0,
3038 .wbd = dib7090_wbd_table,
3040 .ls_cfg_pad_drv = 0,
3047 static int nim7090_frontend_attach(struct dvb_usb_adapter *adap)
3049 struct dib0700_adapter_state *state = adap->priv;
3051 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3054 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3056 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3057 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3058 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3059 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3062 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3064 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3066 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, &nim7090_dib7000p_config) != 0) {
3067 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
3068 dvb_detach(state->dib7000p_ops.set_wbd_ref);
3071 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, &nim7090_dib7000p_config);
3073 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3076 static int nim7090_tuner_attach(struct dvb_usb_adapter *adap)
3078 struct dib0700_adapter_state *st = adap->priv;
3079 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe);
3081 nim7090_dib0090_config.reset = st->dib7000p_ops.tuner_sleep,
3082 nim7090_dib0090_config.sleep = st->dib7000p_ops.tuner_sleep,
3083 nim7090_dib0090_config.get_adc_power = st->dib7000p_ops.get_adc_power;
3085 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &nim7090_dib0090_config) == NULL)
3088 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3090 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3091 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3095 static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter *adap)
3097 struct dib0700_state *st = adap->dev->priv;
3098 struct dib0700_adapter_state *state = adap->priv;
3100 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3103 /* The TFE7090 requires the dib0700 to not be in master mode */
3104 st->disable_streaming_master_mode = 1;
3106 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3108 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3109 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3110 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3111 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3114 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3116 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3118 /* initialize IC 0 */
3119 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, &tfe7090pvr_dib7000p_config[0]) != 0) {
3120 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
3121 dvb_detach(state->dib7000p_ops.set_wbd_ref);
3125 dib0700_set_i2c_speed(adap->dev, 340);
3126 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]);
3127 if (adap->fe_adap[0].fe == NULL)
3130 state->dib7000p_ops.slave_reset(adap->fe_adap[0].fe);
3135 static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter *adap)
3137 struct i2c_adapter *i2c;
3138 struct dib0700_adapter_state *state = adap->priv;
3140 if (adap->dev->adapter[0].fe_adap[0].fe == NULL) {
3141 err("the master dib7090 has to be initialized first");
3142 return -ENODEV; /* the master device has not been initialized */
3145 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3148 i2c = state->dib7000p_ops.get_i2c_master(adap->dev->adapter[0].fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_6_7, 1);
3149 if (state->dib7000p_ops.i2c_enumeration(i2c, 1, 0x10, &tfe7090pvr_dib7000p_config[1]) != 0) {
3150 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
3151 dvb_detach(state->dib7000p_ops.set_wbd_ref);
3155 adap->fe_adap[0].fe = state->dib7000p_ops.init(i2c, 0x92, &tfe7090pvr_dib7000p_config[1]);
3156 dib0700_set_i2c_speed(adap->dev, 200);
3158 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3161 static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter *adap)
3163 struct dib0700_adapter_state *st = adap->priv;
3164 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe);
3166 tfe7090pvr_dib0090_config[0].reset = st->dib7000p_ops.tuner_sleep;
3167 tfe7090pvr_dib0090_config[0].sleep = st->dib7000p_ops.tuner_sleep;
3168 tfe7090pvr_dib0090_config[0].get_adc_power = st->dib7000p_ops.get_adc_power;
3170 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[0]) == NULL)
3173 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3175 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3176 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3180 static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter *adap)
3182 struct dib0700_adapter_state *st = adap->priv;
3183 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe);
3185 tfe7090pvr_dib0090_config[1].reset = st->dib7000p_ops.tuner_sleep;
3186 tfe7090pvr_dib0090_config[1].sleep = st->dib7000p_ops.tuner_sleep;
3187 tfe7090pvr_dib0090_config[1].get_adc_power = st->dib7000p_ops.get_adc_power;
3189 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[1]) == NULL)
3192 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3194 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3195 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3199 static int tfe7790p_frontend_attach(struct dvb_usb_adapter *adap)
3201 struct dib0700_state *st = adap->dev->priv;
3202 struct dib0700_adapter_state *state = adap->priv;
3204 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3207 /* The TFE7790P requires the dib0700 to not be in master mode */
3208 st->disable_streaming_master_mode = 1;
3210 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3212 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3213 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3214 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3215 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3217 dib0700_ctrl_clock(adap->dev, 72, 1);
3218 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3220 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3222 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap,
3223 1, 0x10, &tfe7790p_dib7000p_config) != 0) {
3224 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
3226 dvb_detach(state->dib7000p_ops.set_wbd_ref);
3229 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap,
3230 0x80, &tfe7790p_dib7000p_config);
3232 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3235 static int tfe7790p_tuner_attach(struct dvb_usb_adapter *adap)
3237 struct dib0700_adapter_state *st = adap->priv;
3238 struct i2c_adapter *tun_i2c =
3239 st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe);
3242 tfe7790p_dib0090_config.reset = st->dib7000p_ops.tuner_sleep;
3243 tfe7790p_dib0090_config.sleep = st->dib7000p_ops.tuner_sleep;
3244 tfe7790p_dib0090_config.get_adc_power = st->dib7000p_ops.get_adc_power;
3246 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c,
3247 &tfe7790p_dib0090_config) == NULL)
3250 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3252 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3253 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3258 static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
3260 .output_mpeg2_in_188_bytes = 1,
3262 .agc_config_count = 1,
3263 .agc = &dib7070_agc_config,
3264 .bw = &dib7070_bw_config_12_mhz,
3265 .tuner_is_baseband = 1,
3268 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
3269 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
3270 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
3272 .hostbus_diversity = 1,
3274 .output_mpeg2_in_188_bytes = 1,
3276 .agc_config_count = 1,
3277 .agc = &dib7070_agc_config,
3278 .bw = &dib7070_bw_config_12_mhz,
3279 .tuner_is_baseband = 1,
3282 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
3283 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
3284 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
3286 .hostbus_diversity = 1,
3290 static void stk7070pd_init(struct dvb_usb_device *dev)
3292 dib0700_set_gpio(dev, GPIO6, GPIO_OUT, 1);
3294 dib0700_set_gpio(dev, GPIO9, GPIO_OUT, 1);
3295 dib0700_set_gpio(dev, GPIO4, GPIO_OUT, 1);
3296 dib0700_set_gpio(dev, GPIO7, GPIO_OUT, 1);
3297 dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 0);
3299 dib0700_ctrl_clock(dev, 72, 1);
3302 dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 1);
3305 static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
3307 struct dib0700_adapter_state *state = adap->priv;
3309 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3312 stk7070pd_init(adap->dev);
3315 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3317 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
3318 stk7070pd_dib7000p_config) != 0) {
3319 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
3321 dvb_detach(state->dib7000p_ops.set_wbd_ref);
3325 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
3326 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3329 static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
3331 struct dib0700_adapter_state *state = adap->priv;
3333 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3336 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
3337 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3340 static int novatd_read_status_override(struct dvb_frontend *fe,
3341 enum fe_status *stat)
3343 struct dvb_usb_adapter *adap = fe->dvb->priv;
3344 struct dvb_usb_device *dev = adap->dev;
3345 struct dib0700_state *state = dev->priv;
3348 ret = state->read_status(fe, stat);
3351 dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT,
3352 !!(*stat & FE_HAS_LOCK));
3357 static int novatd_sleep_override(struct dvb_frontend* fe)
3359 struct dvb_usb_adapter *adap = fe->dvb->priv;
3360 struct dvb_usb_device *dev = adap->dev;
3361 struct dib0700_state *state = dev->priv;
3364 dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT, 0);
3366 return state->sleep(fe);
3370 * novatd_frontend_attach - Nova-TD specific attach
3372 * Nova-TD has GPIO0, 1 and 2 for LEDs. So do not fiddle with them except for
3373 * information purposes.
3375 static int novatd_frontend_attach(struct dvb_usb_adapter *adap)
3377 struct dvb_usb_device *dev = adap->dev;
3378 struct dib0700_state *st = dev->priv;
3379 struct dib0700_adapter_state *state = adap->priv;
3381 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3384 if (adap->id == 0) {
3385 stk7070pd_init(dev);
3387 /* turn the power LED on, the other two off (just in case) */
3388 dib0700_set_gpio(dev, GPIO0, GPIO_OUT, 0);
3389 dib0700_set_gpio(dev, GPIO1, GPIO_OUT, 0);
3390 dib0700_set_gpio(dev, GPIO2, GPIO_OUT, 1);
3392 if (state->dib7000p_ops.i2c_enumeration(&dev->i2c_adap, 2, 18,
3393 stk7070pd_dib7000p_config) != 0) {
3394 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
3396 dvb_detach(state->dib7000p_ops.set_wbd_ref);
3401 adap->fe_adap[0].fe = state->dib7000p_ops.init(&dev->i2c_adap,
3402 adap->id == 0 ? 0x80 : 0x82,
3403 &stk7070pd_dib7000p_config[adap->id]);
3405 if (adap->fe_adap[0].fe == NULL)
3408 st->read_status = adap->fe_adap[0].fe->ops.read_status;
3409 adap->fe_adap[0].fe->ops.read_status = novatd_read_status_override;
3410 st->sleep = adap->fe_adap[0].fe->ops.sleep;
3411 adap->fe_adap[0].fe->ops.sleep = novatd_sleep_override;
3417 static struct s5h1411_config pinnacle_801e_config = {
3418 .output_mode = S5H1411_PARALLEL_OUTPUT,
3419 .gpio = S5H1411_GPIO_OFF,
3420 .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
3421 .qam_if = S5H1411_IF_44000,
3422 .vsb_if = S5H1411_IF_44000,
3423 .inversion = S5H1411_INVERSION_OFF,
3424 .status_mode = S5H1411_DEMODLOCKING
3427 /* Pinnacle PCTV HD Pro 801e GPIOs map:
3428 GPIO0 - currently unknown
3429 GPIO1 - xc5000 tuner reset
3430 GPIO2 - CX25843 sleep
3431 GPIO3 - currently unknown
3432 GPIO4 - currently unknown
3433 GPIO6 - currently unknown
3434 GPIO7 - currently unknown
3435 GPIO9 - currently unknown
3436 GPIO10 - CX25843 reset
3438 static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
3440 struct dib0700_state *st = adap->dev->priv;
3442 /* Make use of the new i2c functions from FW 1.20 */
3443 st->fw_use_new_i2c_api = 1;
3445 /* The s5h1411 requires the dib0700 to not be in master mode */
3446 st->disable_streaming_master_mode = 1;
3448 /* All msleep values taken from Windows USB trace */
3449 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
3450 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
3451 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3453 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3455 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3457 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3458 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3459 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3460 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3461 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
3464 /* Put the CX25843 to sleep for now since we're in digital mode */
3465 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
3467 /* GPIOs are initialized, do the attach */
3468 adap->fe_adap[0].fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
3469 &adap->dev->i2c_adap);
3470 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3473 static int dib0700_xc5000_tuner_callback(void *priv, int component,
3474 int command, int arg)
3476 struct dvb_usb_adapter *adap = priv;
3478 if (command == XC5000_TUNER_RESET) {
3479 /* Reset the tuner */
3480 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
3482 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
3485 err("xc5000: unknown tuner callback command: %d\n", command);
3492 static struct xc5000_config s5h1411_xc5000_tunerconfig = {
3493 .i2c_address = 0x64,
3497 static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
3499 /* FIXME: generalize & move to common area */
3500 adap->fe_adap[0].fe->callback = dib0700_xc5000_tuner_callback;
3502 return dvb_attach(xc5000_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap,
3503 &s5h1411_xc5000_tunerconfig)
3504 == NULL ? -ENODEV : 0;
3507 static int dib0700_xc4000_tuner_callback(void *priv, int component,
3508 int command, int arg)
3510 struct dvb_usb_adapter *adap = priv;
3511 struct dib0700_adapter_state *state = adap->priv;
3513 if (command == XC4000_TUNER_RESET) {
3514 /* Reset the tuner */
3515 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 0);
3517 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3519 err("xc4000: unknown tuner callback command: %d\n", command);
3526 static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config = {
3527 .band_caps = BAND_UHF | BAND_VHF,
3530 .time_stabiliz = 0x15,
3531 .alpha_level = 0x00,
3544 .agc1_slope1 = 0x00,
3545 .agc1_slope2 = 0x00,
3548 .agc2_slope1 = 0x1d,
3549 .agc2_slope2 = 0x1d,
3554 .perform_agc_softsplit = 0x00,
3557 static struct dibx000_bandwidth_config stk7700p_xc4000_pll_config = {
3567 .IO_CLK_en_core = 1,
3570 .sad_cfg = (3 << 14) | (1 << 12) | 524, /* sad_cfg: refsel, sel, freq_15k */
3576 /* FIXME: none of these inputs are validated yet */
3577 static struct dib7000p_config pctv_340e_config = {
3578 .output_mpeg2_in_188_bytes = 1,
3580 .agc_config_count = 1,
3581 .agc = &stk7700p_7000p_xc4000_agc_config,
3582 .bw = &stk7700p_xc4000_pll_config,
3584 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
3585 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
3586 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
3589 /* PCTV 340e GPIOs map:
3591 GPIO2 - CX25843 sleep
3592 GPIO3 - CS5340 reset
3594 GPIO6 - Power Supply
3595 GPIO8 - LNA (1=off 0=on)
3596 GPIO10 - CX25843 reset
3598 GPIO8 - xc4000 reset
3600 static int pctv340e_frontend_attach(struct dvb_usb_adapter *adap)
3602 struct dib0700_state *st = adap->dev->priv;
3603 struct dib0700_adapter_state *state = adap->priv;
3605 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3608 /* Power Supply on */
3609 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
3611 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3612 msleep(100); /* Allow power supply to settle before probing */
3615 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3616 msleep(1); /* cx25843 datasheet say 350us required */
3617 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3619 /* LNA off for now */
3620 dib0700_set_gpio(adap->dev, GPIO8, GPIO_OUT, 1);
3622 /* Put the CX25843 to sleep for now since we're in digital mode */
3623 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
3625 /* FIXME: not verified yet */
3626 dib0700_ctrl_clock(adap->dev, 72, 1);
3630 if (state->dib7000p_ops.dib7000pc_detection(&adap->dev->i2c_adap) == 0) {
3631 /* Demodulator not found for some reason? */
3632 dvb_detach(state->dib7000p_ops.set_wbd_ref);
3636 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x12,
3638 st->is_dib7000pc = 1;
3640 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3643 static struct xc4000_config dib7000p_xc4000_tunerconfig = {
3644 .i2c_address = 0x61,
3647 .set_smoothedcvbs = 0,
3651 static int xc4000_tuner_attach(struct dvb_usb_adapter *adap)
3653 struct i2c_adapter *tun_i2c;
3654 struct dib0700_adapter_state *state = adap->priv;
3656 /* The xc4000 is not on the main i2c bus */
3657 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
3658 DIBX000_I2C_INTERFACE_TUNER, 1);
3659 if (tun_i2c == NULL) {
3660 printk(KERN_ERR "Could not reach tuner i2c bus\n");
3664 /* Setup the reset callback */
3665 adap->fe_adap[0].fe->callback = dib0700_xc4000_tuner_callback;
3667 return dvb_attach(xc4000_attach, adap->fe_adap[0].fe, tun_i2c,
3668 &dib7000p_xc4000_tunerconfig)
3669 == NULL ? -ENODEV : 0;
3672 static struct lgdt3305_config hcw_lgdt3305_config = {
3674 .mpeg_mode = LGDT3305_MPEG_PARALLEL,
3675 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
3676 .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
3678 .spectral_inversion = 1,
3681 .usref_8vsb = 0x0500,
3684 static struct mxl5007t_config hcw_mxl5007t_config = {
3685 .xtal_freq_hz = MxL_XTAL_25_MHZ,
3686 .if_freq_hz = MxL_IF_6_MHZ,
3691 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
3692 GPIO1 - ANT_SEL (H: VPA, L: MCX)
3698 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
3700 static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
3702 struct dib0700_state *st = adap->dev->priv;
3704 /* Make use of the new i2c functions from FW 1.20 */
3705 st->fw_use_new_i2c_api = 1;
3707 st->disable_streaming_master_mode = 1;
3709 /* fe power enable */
3710 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
3712 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3716 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3718 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3720 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3723 adap->fe_adap[0].fe = dvb_attach(lgdt3305_attach,
3724 &hcw_lgdt3305_config,
3725 &adap->dev->i2c_adap);
3727 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3730 static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
3732 return dvb_attach(mxl5007t_attach, adap->fe_adap[0].fe,
3733 &adap->dev->i2c_adap, 0x60,
3734 &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
3738 /* DVB-USB and USB stuff follows */
3739 struct usb_device_id dib0700_usb_id_table[] = {
3740 /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
3741 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
3742 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
3743 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
3744 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
3745 /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
3746 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
3747 { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
3748 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
3749 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
3750 /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
3751 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
3752 { USB_DEVICE(USB_VID_TERRATEC,
3753 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
3754 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
3755 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
3756 /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
3757 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
3758 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
3759 { USB_DEVICE(USB_VID_PINNACLE,
3760 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
3761 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
3762 /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
3763 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
3764 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
3765 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
3766 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
3767 /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
3768 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
3769 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
3770 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
3771 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
3772 /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
3773 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
3774 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
3775 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
3776 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
3777 /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
3778 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
3779 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
3780 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
3781 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
3782 /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
3783 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
3784 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
3785 { USB_DEVICE(USB_VID_TERRATEC,
3786 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
3787 { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
3788 /* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
3789 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
3790 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
3791 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
3792 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
3793 /* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
3794 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
3795 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
3796 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
3797 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
3798 /* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
3799 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
3800 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV73ESE) },
3801 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV282E) },
3802 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
3803 /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
3804 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
3805 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
3806 { USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x000, 0x3f00) },
3807 { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },
3808 /* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
3809 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
3810 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) },
3811 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) },
3812 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090M) },
3813 /* 70 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM8096MD) },
3814 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090MD) },
3815 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM7090) },
3816 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090PVR) },
3817 { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2) },
3818 /* 75 */{ USB_DEVICE(USB_VID_MEDION, USB_PID_CREATIX_CTX1921) },
3819 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E) },
3820 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E_SE) },
3821 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7790P) },
3822 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE8096P) },
3823 /* 80 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_2) },
3824 { USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_2002E) },
3825 { USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_2002E_SE) },
3826 { USB_DEVICE(USB_VID_PCTV, USB_PID_DIBCOM_STK8096PVR) },
3827 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096PVR) },
3828 { 0 } /* Terminating entry */
3830 MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
3832 #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
3833 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
3834 .usb_ctrl = DEVICE_SPECIFIC, \
3835 .firmware = "/*(DEBLOBBED)*/", \
3836 .download_firmware = dib0700_download_firmware, \
3837 .no_reconnect = 1, \
3838 .size_of_priv = sizeof(struct dib0700_state), \
3839 .i2c_algo = &dib0700_i2c_algo, \
3840 .identify_state = dib0700_identify_state
3842 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
3843 .streaming_ctrl = dib0700_streaming_ctrl, \
3850 .buffersize = 39480, \
3855 #define DIB0700_NUM_FRONTENDS(n) \
3856 .num_frontends = n, \
3857 .size_of_priv = sizeof(struct dib0700_adapter_state)
3859 struct dvb_usb_device_properties dib0700_devices[] = {
3861 DIB0700_DEFAULT_DEVICE_PROPERTIES,
3866 DIB0700_NUM_FRONTENDS(1),
3868 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3869 .pid_filter_count = 32,
3870 .pid_filter = stk7700p_pid_filter,
3871 .pid_filter_ctrl = stk7700p_pid_filter_ctrl,
3872 .frontend_attach = stk7700p_frontend_attach,
3873 .tuner_attach = stk7700p_tuner_attach,
3875 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3880 .num_device_descs = 8,
3882 { "DiBcom STK7700P reference design",
3883 { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
3886 { "Hauppauge Nova-T Stick",
3887 { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
3890 { "AVerMedia AVerTV DVB-T Volar",
3891 { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
3894 { "Compro Videomate U500",
3895 { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
3898 { "Uniwill STK7700P based (Hama and others)",
3899 { &dib0700_usb_id_table[7], NULL },
3902 { "Leadtek Winfast DTV Dongle (STK7700P based)",
3903 { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
3906 { "AVerMedia AVerTV DVB-T Express",
3907 { &dib0700_usb_id_table[20] },
3911 { &dib0700_usb_id_table[21], NULL },
3917 .rc_interval = DEFAULT_RC_INTERVAL,
3918 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3919 .rc_query = dib0700_rc_query_old_firmware,
3920 .allowed_protos = RC_BIT_RC5 |
3923 .change_protocol = dib0700_change_protocol,
3925 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3930 DIB0700_NUM_FRONTENDS(1),
3932 .frontend_attach = bristol_frontend_attach,
3933 .tuner_attach = bristol_tuner_attach,
3935 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3938 DIB0700_NUM_FRONTENDS(1),
3940 .frontend_attach = bristol_frontend_attach,
3941 .tuner_attach = bristol_tuner_attach,
3943 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3948 .num_device_descs = 1,
3950 { "Hauppauge Nova-T 500 Dual DVB-T",
3951 { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
3957 .rc_interval = DEFAULT_RC_INTERVAL,
3958 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3959 .rc_query = dib0700_rc_query_old_firmware,
3960 .allowed_protos = RC_BIT_RC5 |
3963 .change_protocol = dib0700_change_protocol,
3965 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3970 DIB0700_NUM_FRONTENDS(1),
3972 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3973 .pid_filter_count = 32,
3974 .pid_filter = stk70x0p_pid_filter,
3975 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3976 .frontend_attach = stk7700d_frontend_attach,
3977 .tuner_attach = stk7700d_tuner_attach,
3979 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3982 DIB0700_NUM_FRONTENDS(1),
3984 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3985 .pid_filter_count = 32,
3986 .pid_filter = stk70x0p_pid_filter,
3987 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3988 .frontend_attach = stk7700d_frontend_attach,
3989 .tuner_attach = stk7700d_tuner_attach,
3991 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3996 .num_device_descs = 5,
3998 { "Pinnacle PCTV 2000e",
3999 { &dib0700_usb_id_table[11], NULL },
4002 { "Terratec Cinergy DT XS Diversity",
4003 { &dib0700_usb_id_table[12], NULL },
4006 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
4007 { &dib0700_usb_id_table[13], NULL },
4010 { "DiBcom STK7700D reference design",
4011 { &dib0700_usb_id_table[14], NULL },
4014 { "YUAN High-Tech DiBcom STK7700D",
4015 { &dib0700_usb_id_table[55], NULL },
4022 .rc_interval = DEFAULT_RC_INTERVAL,
4023 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4024 .rc_query = dib0700_rc_query_old_firmware,
4025 .allowed_protos = RC_BIT_RC5 |
4028 .change_protocol = dib0700_change_protocol,
4030 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4035 DIB0700_NUM_FRONTENDS(1),
4037 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4038 .pid_filter_count = 32,
4039 .pid_filter = stk70x0p_pid_filter,
4040 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4041 .frontend_attach = stk7700P2_frontend_attach,
4042 .tuner_attach = stk7700d_tuner_attach,
4044 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4049 .num_device_descs = 3,
4051 { "ASUS My Cinema U3000 Mini DVBT Tuner",
4052 { &dib0700_usb_id_table[23], NULL },
4056 { &dib0700_usb_id_table[31], NULL },
4059 { "Terratec Cinergy T Express",
4060 { &dib0700_usb_id_table[42], NULL },
4066 .rc_interval = DEFAULT_RC_INTERVAL,
4067 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4068 .module_name = "dib0700",
4069 .rc_query = dib0700_rc_query_old_firmware,
4070 .allowed_protos = RC_BIT_RC5 |
4073 .change_protocol = dib0700_change_protocol,
4075 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4080 DIB0700_NUM_FRONTENDS(1),
4082 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4083 .pid_filter_count = 32,
4084 .pid_filter = stk70x0p_pid_filter,
4085 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4086 .frontend_attach = stk7070p_frontend_attach,
4087 .tuner_attach = dib7070p_tuner_attach,
4089 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4094 .num_device_descs = 12,
4096 { "DiBcom STK7070P reference design",
4097 { &dib0700_usb_id_table[15], NULL },
4100 { "Pinnacle PCTV DVB-T Flash Stick",
4101 { &dib0700_usb_id_table[16], NULL },
4104 { "Artec T14BR DVB-T",
4105 { &dib0700_usb_id_table[22], NULL },
4108 { "ASUS My Cinema U3100 Mini DVBT Tuner",
4109 { &dib0700_usb_id_table[24], NULL },
4112 { "Hauppauge Nova-T Stick",
4113 { &dib0700_usb_id_table[25], NULL },
4116 { "Hauppauge Nova-T MyTV.t",
4117 { &dib0700_usb_id_table[26], NULL },
4120 { "Pinnacle PCTV 72e",
4121 { &dib0700_usb_id_table[29], NULL },
4124 { "Pinnacle PCTV 73e",
4125 { &dib0700_usb_id_table[30], NULL },
4128 { "Elgato EyeTV DTT",
4129 { &dib0700_usb_id_table[49], NULL },
4133 { &dib0700_usb_id_table[45], NULL },
4136 { "Elgato EyeTV Dtt Dlx PD378S",
4137 { &dib0700_usb_id_table[50], NULL },
4140 { "Elgato EyeTV DTT rev. 2",
4141 { &dib0700_usb_id_table[80], NULL },
4147 .rc_interval = DEFAULT_RC_INTERVAL,
4148 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4149 .module_name = "dib0700",
4150 .rc_query = dib0700_rc_query_old_firmware,
4151 .allowed_protos = RC_BIT_RC5 |
4154 .change_protocol = dib0700_change_protocol,
4156 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4161 DIB0700_NUM_FRONTENDS(1),
4163 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4164 .pid_filter_count = 32,
4165 .pid_filter = stk70x0p_pid_filter,
4166 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4167 .frontend_attach = stk7070p_frontend_attach,
4168 .tuner_attach = dib7070p_tuner_attach,
4170 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4175 .num_device_descs = 3,
4177 { "Pinnacle PCTV 73A",
4178 { &dib0700_usb_id_table[56], NULL },
4181 { "Pinnacle PCTV 73e SE",
4182 { &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL },
4185 { "Pinnacle PCTV 282e",
4186 { &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL },
4192 .rc_interval = DEFAULT_RC_INTERVAL,
4193 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4194 .module_name = "dib0700",
4195 .rc_query = dib0700_rc_query_old_firmware,
4196 .allowed_protos = RC_BIT_RC5 |
4199 .change_protocol = dib0700_change_protocol,
4201 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4206 DIB0700_NUM_FRONTENDS(1),
4208 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4209 .pid_filter_count = 32,
4210 .pid_filter = stk70x0p_pid_filter,
4211 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4212 .frontend_attach = novatd_frontend_attach,
4213 .tuner_attach = dib7070p_tuner_attach,
4215 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4218 DIB0700_NUM_FRONTENDS(1),
4220 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4221 .pid_filter_count = 32,
4222 .pid_filter = stk70x0p_pid_filter,
4223 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4224 .frontend_attach = novatd_frontend_attach,
4225 .tuner_attach = dib7070p_tuner_attach,
4227 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4232 .num_device_descs = 3,
4234 { "Hauppauge Nova-TD Stick (52009)",
4235 { &dib0700_usb_id_table[35], NULL },
4239 { &dib0700_usb_id_table[81], NULL },
4243 { &dib0700_usb_id_table[82], NULL },
4249 .rc_interval = DEFAULT_RC_INTERVAL,
4250 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4251 .module_name = "dib0700",
4252 .rc_query = dib0700_rc_query_old_firmware,
4253 .allowed_protos = RC_BIT_RC5 |
4256 .change_protocol = dib0700_change_protocol,
4258 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4263 DIB0700_NUM_FRONTENDS(1),
4265 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4266 .pid_filter_count = 32,
4267 .pid_filter = stk70x0p_pid_filter,
4268 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4269 .frontend_attach = stk7070pd_frontend_attach0,
4270 .tuner_attach = dib7070p_tuner_attach,
4272 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4275 DIB0700_NUM_FRONTENDS(1),
4277 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4278 .pid_filter_count = 32,
4279 .pid_filter = stk70x0p_pid_filter,
4280 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4281 .frontend_attach = stk7070pd_frontend_attach1,
4282 .tuner_attach = dib7070p_tuner_attach,
4284 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4289 .num_device_descs = 5,
4291 { "DiBcom STK7070PD reference design",
4292 { &dib0700_usb_id_table[17], NULL },
4295 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
4296 { &dib0700_usb_id_table[18], NULL },
4299 { "Hauppauge Nova-TD-500 (84xxx)",
4300 { &dib0700_usb_id_table[36], NULL },
4303 { "Terratec Cinergy DT USB XS Diversity/ T5",
4304 { &dib0700_usb_id_table[43],
4305 &dib0700_usb_id_table[53], NULL},
4309 { &dib0700_usb_id_table[44], NULL },
4315 .rc_interval = DEFAULT_RC_INTERVAL,
4316 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4317 .module_name = "dib0700",
4318 .rc_query = dib0700_rc_query_old_firmware,
4319 .allowed_protos = RC_BIT_RC5 |
4322 .change_protocol = dib0700_change_protocol,
4324 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4329 DIB0700_NUM_FRONTENDS(1),
4331 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4332 .pid_filter_count = 32,
4333 .pid_filter = stk70x0p_pid_filter,
4334 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4335 .frontend_attach = stk7070pd_frontend_attach0,
4336 .tuner_attach = dib7070p_tuner_attach,
4338 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4341 DIB0700_NUM_FRONTENDS(1),
4343 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4344 .pid_filter_count = 32,
4345 .pid_filter = stk70x0p_pid_filter,
4346 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4347 .frontend_attach = stk7070pd_frontend_attach1,
4348 .tuner_attach = dib7070p_tuner_attach,
4350 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4355 .num_device_descs = 1,
4357 { "Elgato EyeTV Diversity",
4358 { &dib0700_usb_id_table[68], NULL },
4364 .rc_interval = DEFAULT_RC_INTERVAL,
4365 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
4366 .module_name = "dib0700",
4367 .rc_query = dib0700_rc_query_old_firmware,
4368 .allowed_protos = RC_BIT_RC5 |
4371 .change_protocol = dib0700_change_protocol,
4373 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4378 DIB0700_NUM_FRONTENDS(1),
4380 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4381 .pid_filter_count = 32,
4382 .pid_filter = stk70x0p_pid_filter,
4383 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4384 .frontend_attach = stk7700ph_frontend_attach,
4385 .tuner_attach = stk7700ph_tuner_attach,
4387 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4392 .num_device_descs = 9,
4394 { "Terratec Cinergy HT USB XE",
4395 { &dib0700_usb_id_table[27], NULL },
4398 { "Pinnacle Expresscard 320cx",
4399 { &dib0700_usb_id_table[28], NULL },
4402 { "Terratec Cinergy HT Express",
4403 { &dib0700_usb_id_table[32], NULL },
4406 { "Gigabyte U8000-RH",
4407 { &dib0700_usb_id_table[37], NULL },
4410 { "YUAN High-Tech STK7700PH",
4411 { &dib0700_usb_id_table[38], NULL },
4414 { "Asus My Cinema-U3000Hybrid",
4415 { &dib0700_usb_id_table[39], NULL },
4418 { "YUAN High-Tech MC770",
4419 { &dib0700_usb_id_table[48], NULL },
4422 { "Leadtek WinFast DTV Dongle H",
4423 { &dib0700_usb_id_table[51], NULL },
4426 { "YUAN High-Tech STK7700D",
4427 { &dib0700_usb_id_table[54], NULL },
4433 .rc_interval = DEFAULT_RC_INTERVAL,
4434 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4435 .module_name = "dib0700",
4436 .rc_query = dib0700_rc_query_old_firmware,
4437 .allowed_protos = RC_BIT_RC5 |
4440 .change_protocol = dib0700_change_protocol,
4442 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4446 DIB0700_NUM_FRONTENDS(1),
4448 .frontend_attach = s5h1411_frontend_attach,
4449 .tuner_attach = xc5000_tuner_attach,
4451 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4456 .num_device_descs = 2,
4458 { "Pinnacle PCTV HD Pro USB Stick",
4459 { &dib0700_usb_id_table[40], NULL },
4462 { "Pinnacle PCTV HD USB Stick",
4463 { &dib0700_usb_id_table[41], NULL },
4469 .rc_interval = DEFAULT_RC_INTERVAL,
4470 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4471 .module_name = "dib0700",
4472 .rc_query = dib0700_rc_query_old_firmware,
4473 .allowed_protos = RC_BIT_RC5 |
4476 .change_protocol = dib0700_change_protocol,
4478 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4482 DIB0700_NUM_FRONTENDS(1),
4484 .frontend_attach = lgdt3305_frontend_attach,
4485 .tuner_attach = mxl5007t_tuner_attach,
4487 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4492 .num_device_descs = 2,
4494 { "Hauppauge ATSC MiniCard (B200)",
4495 { &dib0700_usb_id_table[46], NULL },
4498 { "Hauppauge ATSC MiniCard (B210)",
4499 { &dib0700_usb_id_table[47], NULL },
4503 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4508 DIB0700_NUM_FRONTENDS(1),
4510 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4511 .pid_filter_count = 32,
4512 .pid_filter = stk70x0p_pid_filter,
4513 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4514 .frontend_attach = stk7770p_frontend_attach,
4515 .tuner_attach = dib7770p_tuner_attach,
4517 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4522 .num_device_descs = 4,
4524 { "DiBcom STK7770P reference design",
4525 { &dib0700_usb_id_table[59], NULL },
4528 { "Terratec Cinergy T USB XXS (HD)/ T3",
4529 { &dib0700_usb_id_table[33],
4530 &dib0700_usb_id_table[52],
4531 &dib0700_usb_id_table[60], NULL},
4534 { "TechniSat AirStar TeleStick 2",
4535 { &dib0700_usb_id_table[74], NULL },
4538 { "Medion CTX1921 DVB-T USB",
4539 { &dib0700_usb_id_table[75], NULL },
4545 .rc_interval = DEFAULT_RC_INTERVAL,
4546 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4547 .module_name = "dib0700",
4548 .rc_query = dib0700_rc_query_old_firmware,
4549 .allowed_protos = RC_BIT_RC5 |
4552 .change_protocol = dib0700_change_protocol,
4554 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4558 DIB0700_NUM_FRONTENDS(1),
4560 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4561 .pid_filter_count = 32,
4562 .pid_filter = stk80xx_pid_filter,
4563 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4564 .frontend_attach = stk807x_frontend_attach,
4565 .tuner_attach = dib807x_tuner_attach,
4567 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4572 .num_device_descs = 3,
4574 { "DiBcom STK807xP reference design",
4575 { &dib0700_usb_id_table[62], NULL },
4578 { "Prolink Pixelview SBTVD",
4579 { &dib0700_usb_id_table[63], NULL },
4582 { "EvolutePC TVWay+",
4583 { &dib0700_usb_id_table[64], NULL },
4589 .rc_interval = DEFAULT_RC_INTERVAL,
4590 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
4591 .module_name = "dib0700",
4592 .rc_query = dib0700_rc_query_old_firmware,
4593 .allowed_protos = RC_BIT_RC5 |
4596 .change_protocol = dib0700_change_protocol,
4598 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4602 DIB0700_NUM_FRONTENDS(1),
4604 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4605 .pid_filter_count = 32,
4606 .pid_filter = stk80xx_pid_filter,
4607 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4608 .frontend_attach = stk807xpvr_frontend_attach0,
4609 .tuner_attach = dib807x_tuner_attach,
4611 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4615 DIB0700_NUM_FRONTENDS(1),
4617 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4618 .pid_filter_count = 32,
4619 .pid_filter = stk80xx_pid_filter,
4620 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4621 .frontend_attach = stk807xpvr_frontend_attach1,
4622 .tuner_attach = dib807x_tuner_attach,
4624 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4629 .num_device_descs = 1,
4631 { "DiBcom STK807xPVR reference design",
4632 { &dib0700_usb_id_table[61], NULL },
4638 .rc_interval = DEFAULT_RC_INTERVAL,
4639 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4640 .module_name = "dib0700",
4641 .rc_query = dib0700_rc_query_old_firmware,
4642 .allowed_protos = RC_BIT_RC5 |
4645 .change_protocol = dib0700_change_protocol,
4647 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4651 DIB0700_NUM_FRONTENDS(1),
4653 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4654 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4655 .pid_filter_count = 32,
4656 .pid_filter = stk80xx_pid_filter,
4657 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4658 .frontend_attach = stk809x_frontend_attach,
4659 .tuner_attach = dib809x_tuner_attach,
4661 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4666 .num_device_descs = 1,
4668 { "DiBcom STK8096GP reference design",
4669 { &dib0700_usb_id_table[67], NULL },
4675 .rc_interval = DEFAULT_RC_INTERVAL,
4676 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4677 .module_name = "dib0700",
4678 .rc_query = dib0700_rc_query_old_firmware,
4679 .allowed_protos = RC_BIT_RC5 |
4682 .change_protocol = dib0700_change_protocol,
4684 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4688 DIB0700_NUM_FRONTENDS(1),
4690 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4691 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4692 .pid_filter_count = 32,
4693 .pid_filter = dib90x0_pid_filter,
4694 .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
4695 .frontend_attach = stk9090m_frontend_attach,
4696 .tuner_attach = dib9090_tuner_attach,
4698 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4703 .num_device_descs = 1,
4705 { "DiBcom STK9090M reference design",
4706 { &dib0700_usb_id_table[69], NULL },
4712 .rc_interval = DEFAULT_RC_INTERVAL,
4713 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4714 .module_name = "dib0700",
4715 .rc_query = dib0700_rc_query_old_firmware,
4716 .allowed_protos = RC_BIT_RC5 |
4719 .change_protocol = dib0700_change_protocol,
4721 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4725 DIB0700_NUM_FRONTENDS(1),
4727 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4728 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4729 .pid_filter_count = 32,
4730 .pid_filter = stk80xx_pid_filter,
4731 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4732 .frontend_attach = nim8096md_frontend_attach,
4733 .tuner_attach = nim8096md_tuner_attach,
4735 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4740 .num_device_descs = 1,
4742 { "DiBcom NIM8096MD reference design",
4743 { &dib0700_usb_id_table[70], NULL },
4749 .rc_interval = DEFAULT_RC_INTERVAL,
4750 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4751 .module_name = "dib0700",
4752 .rc_query = dib0700_rc_query_old_firmware,
4753 .allowed_protos = RC_BIT_RC5 |
4756 .change_protocol = dib0700_change_protocol,
4758 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4762 DIB0700_NUM_FRONTENDS(1),
4764 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4765 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4766 .pid_filter_count = 32,
4767 .pid_filter = dib90x0_pid_filter,
4768 .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
4769 .frontend_attach = nim9090md_frontend_attach,
4770 .tuner_attach = nim9090md_tuner_attach,
4772 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4777 .num_device_descs = 1,
4779 { "DiBcom NIM9090MD reference design",
4780 { &dib0700_usb_id_table[71], NULL },
4786 .rc_interval = DEFAULT_RC_INTERVAL,
4787 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4788 .module_name = "dib0700",
4789 .rc_query = dib0700_rc_query_old_firmware,
4790 .allowed_protos = RC_BIT_RC5 |
4793 .change_protocol = dib0700_change_protocol,
4795 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4799 DIB0700_NUM_FRONTENDS(1),
4801 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4802 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4803 .pid_filter_count = 32,
4804 .pid_filter = stk70x0p_pid_filter,
4805 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4806 .frontend_attach = nim7090_frontend_attach,
4807 .tuner_attach = nim7090_tuner_attach,
4809 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4814 .num_device_descs = 1,
4816 { "DiBcom NIM7090 reference design",
4817 { &dib0700_usb_id_table[72], NULL },
4823 .rc_interval = DEFAULT_RC_INTERVAL,
4824 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4825 .module_name = "dib0700",
4826 .rc_query = dib0700_rc_query_old_firmware,
4827 .allowed_protos = RC_BIT_RC5 |
4830 .change_protocol = dib0700_change_protocol,
4832 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4836 DIB0700_NUM_FRONTENDS(1),
4838 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4839 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4840 .pid_filter_count = 32,
4841 .pid_filter = stk70x0p_pid_filter,
4842 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4843 .frontend_attach = tfe7090pvr_frontend0_attach,
4844 .tuner_attach = tfe7090pvr_tuner0_attach,
4846 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4850 DIB0700_NUM_FRONTENDS(1),
4852 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4853 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4854 .pid_filter_count = 32,
4855 .pid_filter = stk70x0p_pid_filter,
4856 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4857 .frontend_attach = tfe7090pvr_frontend1_attach,
4858 .tuner_attach = tfe7090pvr_tuner1_attach,
4860 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4865 .num_device_descs = 1,
4867 { "DiBcom TFE7090PVR reference design",
4868 { &dib0700_usb_id_table[73], NULL },
4874 .rc_interval = DEFAULT_RC_INTERVAL,
4875 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4876 .module_name = "dib0700",
4877 .rc_query = dib0700_rc_query_old_firmware,
4878 .allowed_protos = RC_BIT_RC5 |
4881 .change_protocol = dib0700_change_protocol,
4883 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4887 DIB0700_NUM_FRONTENDS(1),
4889 .frontend_attach = pctv340e_frontend_attach,
4890 .tuner_attach = xc4000_tuner_attach,
4892 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4897 .num_device_descs = 2,
4899 { "Pinnacle PCTV 340e HD Pro USB Stick",
4900 { &dib0700_usb_id_table[76], NULL },
4903 { "Pinnacle PCTV Hybrid Stick Solo",
4904 { &dib0700_usb_id_table[77], NULL },
4909 .rc_interval = DEFAULT_RC_INTERVAL,
4910 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4911 .module_name = "dib0700",
4912 .rc_query = dib0700_rc_query_old_firmware,
4913 .allowed_protos = RC_BIT_RC5 |
4916 .change_protocol = dib0700_change_protocol,
4918 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4922 DIB0700_NUM_FRONTENDS(1),
4924 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4925 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4926 .pid_filter_count = 32,
4927 .pid_filter = stk70x0p_pid_filter,
4928 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4929 .frontend_attach = tfe7790p_frontend_attach,
4930 .tuner_attach = tfe7790p_tuner_attach,
4932 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4937 .num_device_descs = 1,
4939 { "DiBcom TFE7790P reference design",
4940 { &dib0700_usb_id_table[78], NULL },
4946 .rc_interval = DEFAULT_RC_INTERVAL,
4947 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4948 .module_name = "dib0700",
4949 .rc_query = dib0700_rc_query_old_firmware,
4950 .allowed_protos = RC_BIT_RC5 |
4953 .change_protocol = dib0700_change_protocol,
4955 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4959 DIB0700_NUM_FRONTENDS(1),
4961 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4962 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4963 .pid_filter_count = 32,
4964 .pid_filter = stk80xx_pid_filter,
4965 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4966 .frontend_attach = tfe8096p_frontend_attach,
4967 .tuner_attach = tfe8096p_tuner_attach,
4969 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4975 .num_device_descs = 1,
4977 { "DiBcom TFE8096P reference design",
4978 { &dib0700_usb_id_table[79], NULL },
4984 .rc_interval = DEFAULT_RC_INTERVAL,
4985 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4986 .module_name = "dib0700",
4987 .rc_query = dib0700_rc_query_old_firmware,
4988 .allowed_protos = RC_BIT_RC5 |
4991 .change_protocol = dib0700_change_protocol,
4993 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4999 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
5000 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
5001 .pid_filter_count = 32,
5002 .pid_filter = stk80xx_pid_filter,
5003 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
5004 .frontend_attach = stk809x_frontend_attach,
5005 .tuner_attach = dib809x_tuner_attach,
5007 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
5010 sizeof(struct dib0700_adapter_state),
5014 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
5015 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
5016 .pid_filter_count = 32,
5017 .pid_filter = stk80xx_pid_filter,
5018 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
5019 .frontend_attach = stk809x_frontend1_attach,
5020 .tuner_attach = dib809x_tuner_attach,
5022 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
5025 sizeof(struct dib0700_adapter_state),
5028 .num_device_descs = 1,
5030 { "DiBcom STK8096-PVR reference design",
5031 { &dib0700_usb_id_table[83],
5032 &dib0700_usb_id_table[84], NULL},
5038 .rc_interval = DEFAULT_RC_INTERVAL,
5039 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
5040 .module_name = "dib0700",
5041 .rc_query = dib0700_rc_query_old_firmware,
5042 .allowed_protos = RC_BIT_RC5 |
5045 .change_protocol = dib0700_change_protocol,
5050 int dib0700_device_count = ARRAY_SIZE(dib0700_devices);