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 = {
226 (3 << 14) | (1 << 12) | (524 << 0),
231 static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {
232 { .output_mpeg2_in_188_bytes = 1,
233 .hostbus_diversity = 1,
234 .tuner_is_baseband = 1,
236 .agc_config_count = 2,
237 .agc = stk7700d_7000p_mt2266_agc_config,
238 .bw = &stk7700d_mt2266_pll_config,
240 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
241 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
242 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
244 { .output_mpeg2_in_188_bytes = 1,
245 .hostbus_diversity = 1,
246 .tuner_is_baseband = 1,
248 .agc_config_count = 2,
249 .agc = stk7700d_7000p_mt2266_agc_config,
250 .bw = &stk7700d_mt2266_pll_config,
252 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
253 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
254 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
258 static struct mt2266_config stk7700d_mt2266_config[2] = {
259 { .i2c_address = 0x60
261 { .i2c_address = 0x60
265 static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap)
267 struct dib0700_adapter_state *state = adap->priv;
269 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
273 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
275 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
276 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
277 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
278 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
280 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
282 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
283 stk7700d_dib7000p_mt2266_config)
285 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
286 dvb_detach(&state->dib7000p_ops);
291 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap,
292 0x80 + (adap->id << 1),
293 &stk7700d_dib7000p_mt2266_config[adap->id]);
295 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
298 static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap)
300 struct dib0700_adapter_state *state = adap->priv;
302 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
306 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
308 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
309 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
310 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
311 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
313 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
315 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
316 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
317 stk7700d_dib7000p_mt2266_config)
319 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
320 dvb_detach(&state->dib7000p_ops);
325 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap,
326 0x80 + (adap->id << 1),
327 &stk7700d_dib7000p_mt2266_config[adap->id]);
329 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
332 static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap)
334 struct i2c_adapter *tun_i2c;
335 struct dib0700_adapter_state *state = adap->priv;
337 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
338 DIBX000_I2C_INTERFACE_TUNER, 1);
339 return dvb_attach(mt2266_attach, adap->fe_adap[0].fe, tun_i2c,
340 &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;
343 /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
344 static struct dibx000_agc_config xc3028_agc_config = {
345 BAND_VHF | BAND_UHF, /* band_caps */
347 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
348 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
349 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
350 (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
351 (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */
354 21, /* time_stabiliz */
366 39718, /* agc2_max */
375 29, /* agc2_slope1 */
376 29, /* agc2_slope2 */
383 1, /* perform_agc_softsplit */
386 /* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
387 static struct dibx000_bandwidth_config xc3028_bw_config = {
388 60000, 30000, /* internal, sampling */
389 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
390 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc,
392 (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
393 (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
395 30000000, /* xtal_hz */
398 static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
399 .output_mpeg2_in_188_bytes = 1,
400 .tuner_is_baseband = 1,
402 .agc_config_count = 1,
403 .agc = &xc3028_agc_config,
404 .bw = &xc3028_bw_config,
406 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
407 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
408 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
411 static int stk7700ph_xc3028_callback(void *ptr, int component,
412 int command, int arg)
414 struct dvb_usb_adapter *adap = ptr;
415 struct dib0700_adapter_state *state = adap->priv;
418 case XC2028_TUNER_RESET:
419 /* Send the tuner in then out of reset */
420 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 0);
422 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
424 case XC2028_RESET_CLK:
427 err("%s: unknown command %d, arg %d\n", __func__,
434 static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
435 .fname = XC2028_DEFAULT_FIRMWARE,
437 .demod = XC3028_FE_DIBCOM52,
440 static struct xc2028_config stk7700ph_xc3028_config = {
442 .ctrl = &stk7700ph_xc3028_ctrl,
445 static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
447 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;
448 struct dib0700_adapter_state *state = adap->priv;
450 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
453 if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
454 desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))
455 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
457 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
459 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
460 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
461 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
462 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
464 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
466 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
469 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
470 &stk7700ph_dib7700_xc3028_config) != 0) {
471 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
473 dvb_detach(&state->dib7000p_ops);
477 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80,
478 &stk7700ph_dib7700_xc3028_config);
480 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
483 static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
485 struct i2c_adapter *tun_i2c;
486 struct dib0700_adapter_state *state = adap->priv;
488 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
489 DIBX000_I2C_INTERFACE_TUNER, 1);
491 stk7700ph_xc3028_config.i2c_adap = tun_i2c;
493 /* FIXME: generalize & move to common area */
494 adap->fe_adap[0].fe->callback = stk7700ph_xc3028_callback;
496 return dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &stk7700ph_xc3028_config)
497 == NULL ? -ENODEV : 0;
500 #define DEFAULT_RC_INTERVAL 50
502 static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
504 /* Number of keypresses to ignore before start repeating */
505 #define RC_REPEAT_DELAY 6
508 * This function is used only when firmware is < 1.20 version. Newer
509 * firmwares use bulk mode, with functions implemented at dib0700_core,
510 * at dib0700_rc_urb_completion()
512 static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d)
515 enum rc_type protocol;
519 struct dib0700_state *st = d->priv;
521 if (st->fw_version >= 0x10200) {
522 /* For 1.20 firmware , We need to keep the RC polling
523 callback so we can reuse the input device setup in
524 dvb-usb-remote.c. However, the actual work is being done
525 in the bulk URB completion handler. */
529 i = dib0700_ctrl_rd(d, rc_request, 2, key, 4);
531 err("RC Query Failed");
535 /* losing half of KEY_0 events from Philipps rc5 remotes.. */
536 if (key[0] == 0 && key[1] == 0 && key[2] == 0 && key[3] == 0)
539 /* info("%d: %2X %2X %2X %2X",dvb_usb_dib0700_ir_proto,(int)key[3-2],(int)key[3-3],(int)key[3-1],(int)key[3]); */
541 dib0700_rc_setup(d, NULL); /* reset ir sensor data to prevent false events */
543 switch (d->props.rc.core.protocol) {
545 /* NEC protocol sends repeat code as 0 0 0 FF */
546 if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&
548 rc_repeat(d->rc_dev);
552 protocol = RC_TYPE_NEC;
553 scancode = RC_SCANCODE_NEC(key[3-2], key[3-3]);
558 /* RC-5 protocol changes toggle bit on new keypress */
559 protocol = RC_TYPE_RC5;
560 scancode = RC_SCANCODE_RC5(key[3-2], key[3-3]);
565 rc_keydown(d->rc_dev, protocol, scancode, toggle);
569 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
570 static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
573 /* 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,
574 * 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 */
575 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
576 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
616 static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
619 /* 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,
620 * 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 */
621 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
622 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
662 static struct dibx000_bandwidth_config stk7700p_pll_config = {
666 (3 << 14) | (1 << 12) | (524 << 0),
672 static struct dib7000m_config stk7700p_dib7000m_config = {
674 .output_mpeg2_in_188_bytes = 1,
677 .agc_config_count = 1,
678 .agc = &stk7700p_7000m_mt2060_agc_config,
679 .bw = &stk7700p_pll_config,
681 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
682 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
683 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
686 static struct dib7000p_config stk7700p_dib7000p_config = {
687 .output_mpeg2_in_188_bytes = 1,
689 .agc_config_count = 1,
690 .agc = &stk7700p_7000p_mt2060_agc_config,
691 .bw = &stk7700p_pll_config,
693 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
694 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
695 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
698 static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
700 struct dib0700_state *st = adap->dev->priv;
701 struct dib0700_adapter_state *state = adap->priv;
703 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
706 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
708 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
709 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
711 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
712 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
714 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
715 dib0700_ctrl_clock(adap->dev, 72, 1);
716 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
718 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
720 st->mt2060_if1[0] = 1220;
722 if (state->dib7000p_ops.dib7000pc_detection(&adap->dev->i2c_adap)) {
723 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
724 st->is_dib7000pc = 1;
726 memset(&state->dib7000p_ops, 0, sizeof(state->dib7000p_ops));
727 adap->fe_adap[0].fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
730 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
733 static struct mt2060_config stk7700p_mt2060_config = {
737 static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
739 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
740 struct dib0700_state *st = adap->dev->priv;
741 struct i2c_adapter *tun_i2c;
742 struct dib0700_adapter_state *state = adap->priv;
746 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
747 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
748 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
750 if (st->is_dib7000pc)
751 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
753 tun_i2c = dib7000m_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
755 return dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, &stk7700p_mt2060_config,
756 if1) == NULL ? -ENODEV : 0;
759 /* DIB7070 generic */
760 static struct dibx000_agc_config dib7070_agc_config = {
761 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
762 /* 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,
763 * 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 */
764 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
765 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
802 static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
804 struct dvb_usb_adapter *adap = fe->dvb->priv;
805 struct dib0700_adapter_state *state = adap->priv;
807 deb_info("reset: %d", onoff);
808 return state->dib7000p_ops.set_gpio(fe, 8, 0, !onoff);
811 static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
813 struct dvb_usb_adapter *adap = fe->dvb->priv;
814 struct dib0700_adapter_state *state = adap->priv;
816 deb_info("sleep: %d", onoff);
817 return state->dib7000p_ops.set_gpio(fe, 9, 0, onoff);
820 static struct dib0070_config dib7070p_dib0070_config[2] = {
822 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
823 .reset = dib7070_tuner_reset,
824 .sleep = dib7070_tuner_sleep,
826 .clock_pad_drive = 4,
829 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
830 .reset = dib7070_tuner_reset,
831 .sleep = dib7070_tuner_sleep,
837 static struct dib0070_config dib7770p_dib0070_config = {
838 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
839 .reset = dib7070_tuner_reset,
840 .sleep = dib7070_tuner_sleep,
842 .clock_pad_drive = 0,
847 static int dib7070_set_param_override(struct dvb_frontend *fe)
849 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
850 struct dvb_usb_adapter *adap = fe->dvb->priv;
851 struct dib0700_adapter_state *state = adap->priv;
854 u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
856 case BAND_VHF: offset = 950; break;
858 default: offset = 550; break;
860 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
861 state->dib7000p_ops.set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
862 return state->set_param_save(fe);
865 static int dib7770_set_param_override(struct dvb_frontend *fe)
867 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
868 struct dvb_usb_adapter *adap = fe->dvb->priv;
869 struct dib0700_adapter_state *state = adap->priv;
872 u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
875 state->dib7000p_ops.set_gpio(fe, 0, 0, 1);
880 state->dib7000p_ops.set_gpio(fe, 0, 0, 0);
884 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
885 state->dib7000p_ops.set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
886 return state->set_param_save(fe);
889 static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
891 struct dib0700_adapter_state *st = adap->priv;
892 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
893 DIBX000_I2C_INTERFACE_TUNER, 1);
895 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
896 &dib7770p_dib0070_config) == NULL)
899 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
900 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7770_set_param_override;
904 static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
906 struct dib0700_adapter_state *st = adap->priv;
907 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
910 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
913 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
917 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
918 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override;
922 static int stk7700p_pid_filter(struct dvb_usb_adapter *adapter, int index,
925 struct dib0700_adapter_state *state = adapter->priv;
926 struct dib0700_state *st = adapter->dev->priv;
928 if (st->is_dib7000pc)
929 return state->dib7000p_ops.pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
930 return dib7000m_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
933 static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
935 struct dib0700_state *st = adapter->dev->priv;
936 struct dib0700_adapter_state *state = adapter->priv;
937 if (st->is_dib7000pc)
938 return state->dib7000p_ops.pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
939 return dib7000m_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
942 static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
944 struct dib0700_adapter_state *state = adapter->priv;
945 return state->dib7000p_ops.pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
948 static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
950 struct dib0700_adapter_state *state = adapter->priv;
951 return state->dib7000p_ops.pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
954 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
958 (3 << 14) | (1 << 12) | (524 << 0),
964 static struct dib7000p_config dib7070p_dib7000p_config = {
965 .output_mpeg2_in_188_bytes = 1,
967 .agc_config_count = 1,
968 .agc = &dib7070_agc_config,
969 .bw = &dib7070_bw_config_12_mhz,
970 .tuner_is_baseband = 1,
973 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
974 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
975 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
977 .hostbus_diversity = 1,
981 static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
983 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
984 struct dib0700_adapter_state *state = adap->priv;
986 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
989 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
990 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
991 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
993 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
995 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
996 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
997 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
998 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1000 dib0700_ctrl_clock(adap->dev, 72, 1);
1003 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1005 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1007 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1008 &dib7070p_dib7000p_config) != 0) {
1009 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
1011 dvb_detach(&state->dib7000p_ops);
1015 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80,
1016 &dib7070p_dib7000p_config);
1017 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1021 static struct dib7000p_config dib7770p_dib7000p_config = {
1022 .output_mpeg2_in_188_bytes = 1,
1024 .agc_config_count = 1,
1025 .agc = &dib7070_agc_config,
1026 .bw = &dib7070_bw_config_12_mhz,
1027 .tuner_is_baseband = 1,
1030 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1031 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1032 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1034 .hostbus_diversity = 1,
1035 .enable_current_mirror = 1,
1036 .disable_sample_and_hold = 0,
1039 static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap)
1041 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
1042 struct dib0700_adapter_state *state = adap->priv;
1044 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
1047 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
1048 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
1049 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1051 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1053 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1054 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1055 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1056 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1058 dib0700_ctrl_clock(adap->dev, 72, 1);
1061 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1063 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1065 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1066 &dib7770p_dib7000p_config) != 0) {
1067 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
1069 dvb_detach(&state->dib7000p_ops);
1073 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80,
1074 &dib7770p_dib7000p_config);
1075 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1078 /* DIB807x generic */
1079 static struct dibx000_agc_config dib807x_agc_config[2] = {
1082 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1083 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1084 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1085 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1087 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1088 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1089 (0 << 0), /* setup*/
1092 10, /* time_stabiliz*/
1102 65535, /* agc1_max*/
1105 65535, /* agc2_max*/
1111 206, /* agc1_slope1*/
1112 255, /* agc1_slope2*/
1115 88, /* agc2_slope1*/
1116 90, /* agc2_slope2*/
1123 0, /* perform_agc_softsplit*/
1126 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1127 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1128 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1129 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1131 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1132 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1133 (0 << 0), /* setup */
1136 10, /* time_stabiliz*/
1146 65535, /* agc1_max*/
1149 65535, /* agc2_max*/
1155 206, /* agc1_slope1*/
1156 255, /* agc1_slope2*/
1159 88, /* agc2_slope1*/
1160 90, /* agc2_slope2*/
1167 0, /* perform_agc_softsplit*/
1171 static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
1172 60000, 15000, /* internal, sampling*/
1173 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/
1174 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
1176 (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1177 (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1179 12000000, /* xtal_hz*/
1182 static struct dib8000_config dib807x_dib8000_config[2] = {
1184 .output_mpeg2_in_188_bytes = 1,
1186 .agc_config_count = 2,
1187 .agc = dib807x_agc_config,
1188 .pll = &dib807x_bw_config_12_mhz,
1189 .tuner_is_baseband = 1,
1191 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1192 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1193 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1195 .hostbus_diversity = 1,
1197 .agc_control = &dib0070_ctrl_agc_filter,
1198 .output_mode = OUTMODE_MPEG2_FIFO,
1201 .output_mpeg2_in_188_bytes = 1,
1203 .agc_config_count = 2,
1204 .agc = dib807x_agc_config,
1205 .pll = &dib807x_bw_config_12_mhz,
1206 .tuner_is_baseband = 1,
1208 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1209 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1210 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1212 .hostbus_diversity = 1,
1213 .agc_control = &dib0070_ctrl_agc_filter,
1214 .output_mode = OUTMODE_MPEG2_FIFO,
1219 static int dib80xx_tuner_reset(struct dvb_frontend *fe, int onoff)
1221 struct dvb_usb_adapter *adap = fe->dvb->priv;
1222 struct dib0700_adapter_state *state = adap->priv;
1224 return state->dib8000_ops.set_gpio(fe, 5, 0, !onoff);
1227 static int dib80xx_tuner_sleep(struct dvb_frontend *fe, int onoff)
1229 struct dvb_usb_adapter *adap = fe->dvb->priv;
1230 struct dib0700_adapter_state *state = adap->priv;
1232 return state->dib8000_ops.set_gpio(fe, 0, 0, onoff);
1235 static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
1240 static struct dib0070_config dib807x_dib0070_config[2] = {
1242 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1243 .reset = dib80xx_tuner_reset,
1244 .sleep = dib80xx_tuner_sleep,
1246 .clock_pad_drive = 4,
1248 .force_crystal_mode = 1,
1249 .enable_third_order_filter = 1,
1251 .wbd_gain = dib8070_wbd_gain_cfg,
1252 .osc_buffer_state = 0,
1253 .freq_offset_khz_uhf = -100,
1254 .freq_offset_khz_vhf = -100,
1256 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1257 .reset = dib80xx_tuner_reset,
1258 .sleep = dib80xx_tuner_sleep,
1260 .clock_pad_drive = 2,
1262 .force_crystal_mode = 1,
1263 .enable_third_order_filter = 1,
1265 .wbd_gain = dib8070_wbd_gain_cfg,
1266 .osc_buffer_state = 0,
1267 .freq_offset_khz_uhf = -25,
1268 .freq_offset_khz_vhf = -25,
1272 static int dib807x_set_param_override(struct dvb_frontend *fe)
1274 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1275 struct dvb_usb_adapter *adap = fe->dvb->priv;
1276 struct dib0700_adapter_state *state = adap->priv;
1278 u16 offset = dib0070_wbd_offset(fe);
1279 u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
1284 case BAND_UHF: /* fall-thru wanted */
1286 offset += 250; break;
1288 deb_info("WBD for DiB8000: %d\n", offset);
1289 state->dib8000_ops.set_wbd_ref(fe, offset);
1291 return state->set_param_save(fe);
1294 static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1296 struct dib0700_adapter_state *st = adap->priv;
1297 struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe,
1298 DIBX000_I2C_INTERFACE_TUNER, 1);
1300 if (adap->id == 0) {
1301 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
1302 &dib807x_dib0070_config[0]) == NULL)
1305 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
1306 &dib807x_dib0070_config[1]) == NULL)
1310 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1311 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib807x_set_param_override;
1315 static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index,
1318 struct dib0700_adapter_state *state = adapter->priv;
1320 return state->dib8000_ops.pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
1323 static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter,
1326 struct dib0700_adapter_state *state = adapter->priv;
1328 return state->dib8000_ops.pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
1332 static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
1334 struct dib0700_adapter_state *state = adap->priv;
1336 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1339 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1341 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1342 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1343 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1345 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1347 dib0700_ctrl_clock(adap->dev, 72, 1);
1350 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1352 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1354 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1357 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80,
1358 &dib807x_dib8000_config[0]);
1360 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1364 static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
1366 struct dib0700_adapter_state *state = adap->priv;
1368 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1371 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1373 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1375 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1376 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1377 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1379 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1381 dib0700_ctrl_clock(adap->dev, 72, 1);
1384 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1386 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1388 /* initialize IC 0 */
1389 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80, 0);
1391 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80,
1392 &dib807x_dib8000_config[0]);
1394 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1397 static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
1399 struct dib0700_adapter_state *state = adap->priv;
1401 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1404 /* initialize IC 1 */
1405 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82, 0);
1407 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x82,
1408 &dib807x_dib8000_config[1]);
1410 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1414 static struct dibx000_agc_config dib8090_agc_config[2] = {
1416 .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
1417 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1418 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1419 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1420 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1421 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1424 .time_stabiliz = 10,
1455 .perform_agc_softsplit = 0,
1458 .band_caps = BAND_CBAND,
1459 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1460 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1461 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1462 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1463 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1466 .time_stabiliz = 10,
1497 .perform_agc_softsplit = 0,
1501 static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = {
1513 .IO_CLK_en_core = 1,
1517 .sad_cfg = (3 << 14) | (1 << 12) | (599 << 0),
1519 .ifreq = (0 << 25) | 0,
1522 .xtal_hz = 12000000,
1525 static int dib8090_get_adc_power(struct dvb_frontend *fe)
1527 struct dvb_usb_adapter *adap = fe->dvb->priv;
1528 struct dib0700_adapter_state *state = adap->priv;
1530 return state->dib8000_ops.get_adc_power(fe, 1);
1533 static void dib8090_agc_control(struct dvb_frontend *fe, u8 restart)
1535 deb_info("AGC control callback: %i\n", restart);
1536 dib0090_dcc_freq(fe, restart);
1538 if (restart == 0) /* before AGC startup */
1539 dib0090_set_dc_servo(fe, 1);
1542 static struct dib8000_config dib809x_dib8000_config[2] = {
1544 .output_mpeg2_in_188_bytes = 1,
1546 .agc_config_count = 2,
1547 .agc = dib8090_agc_config,
1548 .agc_control = dib8090_agc_control,
1549 .pll = &dib8090_pll_config_12mhz,
1550 .tuner_is_baseband = 1,
1552 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1553 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1554 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1556 .hostbus_diversity = 1,
1558 .output_mode = OUTMODE_MPEG2_FIFO,
1560 .diversity_delay = 48,
1563 .output_mpeg2_in_188_bytes = 1,
1565 .agc_config_count = 2,
1566 .agc = dib8090_agc_config,
1567 .agc_control = dib8090_agc_control,
1568 .pll = &dib8090_pll_config_12mhz,
1569 .tuner_is_baseband = 1,
1571 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1572 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1573 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1575 .hostbus_diversity = 1,
1577 .output_mode = OUTMODE_DIVERSITY,
1579 .diversity_delay = 1,
1584 static struct dib0090_wbd_slope dib8090_wbd_table[] = {
1585 /* max freq ; cold slope ; cold offset ; warm slope ; warm offset ; wbd gain */
1586 { 120, 0, 500, 0, 500, 4 }, /* CBAND */
1587 { 170, 0, 450, 0, 450, 4 }, /* CBAND */
1588 { 380, 48, 373, 28, 259, 6 }, /* VHF */
1589 { 860, 34, 700, 36, 616, 6 }, /* high UHF */
1590 { 0xFFFF, 34, 700, 36, 616, 6 }, /* default */
1593 static struct dib0090_config dib809x_dib0090_config = {
1597 .io.pll_loopdiv = 20,
1598 .io.adc_clock_ratio = 8,
1599 .io.pll_int_loop_filt = 0,
1600 .io.clock_khz = 12000,
1601 .reset = dib80xx_tuner_reset,
1602 .sleep = dib80xx_tuner_sleep,
1605 .i2c_address = DEFAULT_DIB0090_I2C_ADDRESS,
1608 .get_adc_power = dib8090_get_adc_power,
1609 .freq_offset_khz_uhf = -63,
1610 .freq_offset_khz_vhf = -143,
1611 .wbd = dib8090_wbd_table,
1612 .fref_clock_ratio = 6,
1615 static u8 dib8090_compute_pll_parameters(struct dvb_frontend *fe)
1617 u8 optimal_pll_ratio = 20;
1618 u32 freq_adc, ratio, rest, max = 0;
1621 for (pll_ratio = 17; pll_ratio <= 20; pll_ratio++) {
1622 freq_adc = 12 * pll_ratio * (1 << 8) / 16;
1623 ratio = ((fe->dtv_property_cache.frequency / 1000) * (1 << 8) / 1000) / freq_adc;
1624 rest = ((fe->dtv_property_cache.frequency / 1000) * (1 << 8) / 1000) - ratio * freq_adc;
1626 if (rest > freq_adc / 2)
1627 rest = freq_adc - rest;
1628 deb_info("PLL ratio=%i rest=%i\n", pll_ratio, rest);
1629 if ((rest > max) && (rest > 717)) {
1630 optimal_pll_ratio = pll_ratio;
1634 deb_info("optimal PLL ratio=%i\n", optimal_pll_ratio);
1636 return optimal_pll_ratio;
1639 static int dib8096_set_param_override(struct dvb_frontend *fe)
1641 struct dvb_usb_adapter *adap = fe->dvb->priv;
1642 struct dib0700_adapter_state *state = adap->priv;
1643 u8 pll_ratio, band = BAND_OF_FREQUENCY(fe->dtv_property_cache.frequency / 1000);
1644 u16 target, ltgain, rf_gain_limit;
1647 enum frontend_tune_state tune_state = CT_SHUTDOWN;
1651 deb_info("Warning : Rf frequency (%iHz) is not in the supported range, using VHF switch ", fe->dtv_property_cache.frequency);
1653 state->dib8000_ops.set_gpio(fe, 3, 0, 1);
1656 state->dib8000_ops.set_gpio(fe, 3, 0, 0);
1660 ret = state->set_param_save(fe);
1664 if (fe->dtv_property_cache.bandwidth_hz != 6000000) {
1665 deb_info("only 6MHz bandwidth is supported\n");
1669 /** Update PLL if needed ratio **/
1670 state->dib8000_ops.update_pll(fe, &dib8090_pll_config_12mhz, fe->dtv_property_cache.bandwidth_hz / 1000, 0);
1672 /** Get optimize PLL ratio to remove spurious **/
1673 pll_ratio = dib8090_compute_pll_parameters(fe);
1674 if (pll_ratio == 17)
1676 else if (pll_ratio == 18)
1678 else if (pll_ratio == 19)
1683 /** Update ratio **/
1684 state->dib8000_ops.update_pll(fe, &dib8090_pll_config_12mhz, fe->dtv_property_cache.bandwidth_hz / 1000, pll_ratio);
1686 state->dib8000_ops.ctrl_timf(fe, DEMOD_TIMF_SET, timf);
1688 if (band != BAND_CBAND) {
1689 /* dib0090_get_wbd_target is returning any possible temperature compensated wbd-target */
1690 target = (dib0090_get_wbd_target(fe) * 8 * 18 / 33 + 1) / 2;
1691 state->dib8000_ops.set_wbd_ref(fe, target);
1694 if (band == BAND_CBAND) {
1695 deb_info("tuning in CBAND - soft-AGC startup\n");
1696 dib0090_set_tune_state(fe, CT_AGC_START);
1699 ret = dib0090_gain_control(fe);
1701 tune_state = dib0090_get_tune_state(fe);
1702 if (tune_state == CT_AGC_STEP_0)
1703 state->dib8000_ops.set_gpio(fe, 6, 0, 1);
1704 else if (tune_state == CT_AGC_STEP_1) {
1705 dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, <gain);
1706 if (rf_gain_limit < 2000) /* activate the external attenuator in case of very high input power */
1707 state->dib8000_ops.set_gpio(fe, 6, 0, 0);
1709 } while (tune_state < CT_AGC_STOP);
1711 deb_info("switching to PWM AGC\n");
1712 dib0090_pwm_gain_reset(fe);
1713 state->dib8000_ops.pwm_agc_reset(fe);
1714 state->dib8000_ops.set_tune_state(fe, CT_DEMOD_START);
1716 /* for everything else than CBAND we are using standard AGC */
1717 deb_info("not tuning in CBAND - standard AGC startup\n");
1718 dib0090_pwm_gain_reset(fe);
1724 static int dib809x_tuner_attach(struct dvb_usb_adapter *adap)
1726 struct dib0700_adapter_state *st = adap->priv;
1727 struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1729 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1732 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1733 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1737 static int stk809x_frontend_attach(struct dvb_usb_adapter *adap)
1739 struct dib0700_adapter_state *state = adap->priv;
1741 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1744 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1746 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1747 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1748 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1750 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1752 dib0700_ctrl_clock(adap->dev, 72, 1);
1755 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1757 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1759 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80, 0);
1761 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
1763 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1766 static int nim8096md_tuner_attach(struct dvb_usb_adapter *adap)
1768 struct dib0700_adapter_state *st = adap->priv;
1769 struct i2c_adapter *tun_i2c;
1770 struct dvb_frontend *fe_slave = st->dib8000_ops.get_slave_frontend(adap->fe_adap[0].fe, 1);
1773 tun_i2c = st->dib8000_ops.get_i2c_master(fe_slave, DIBX000_I2C_INTERFACE_TUNER, 1);
1774 if (dvb_attach(dib0090_register, fe_slave, tun_i2c, &dib809x_dib0090_config) == NULL)
1776 fe_slave->dvb = adap->fe_adap[0].fe->dvb;
1777 fe_slave->ops.tuner_ops.set_params = dib8096_set_param_override;
1779 tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1780 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1783 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1784 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1789 static int nim8096md_frontend_attach(struct dvb_usb_adapter *adap)
1791 struct dvb_frontend *fe_slave;
1792 struct dib0700_adapter_state *state = adap->priv;
1794 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1797 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1799 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1801 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1802 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1803 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1805 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1807 dib0700_ctrl_clock(adap->dev, 72, 1);
1810 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1812 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1814 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 2, 18, 0x80, 0);
1816 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
1817 if (adap->fe_adap[0].fe == NULL)
1820 /* Needed to increment refcount */
1821 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
1824 fe_slave = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x82, &dib809x_dib8000_config[1]);
1825 state->dib8000_ops.set_slave_frontend(adap->fe_adap[0].fe, fe_slave);
1827 return fe_slave == NULL ? -ENODEV : 0;
1831 static struct dibx000_agc_config dib8096p_agc_config[2] = {
1833 .band_caps = BAND_UHF,
1834 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1835 P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1836 P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1837 P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1839 .setup = (0 << 15) | (0 << 14) | (5 << 11)
1840 | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5)
1841 | (0 << 4) | (5 << 1) | (0 << 0),
1844 .time_stabiliz = 10,
1875 .perform_agc_softsplit = 0,
1877 .band_caps = BAND_FM | BAND_VHF | BAND_CBAND,
1878 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1879 P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1880 P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1881 P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1883 .setup = (0 << 15) | (0 << 14) | (5 << 11)
1884 | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5)
1885 | (0 << 4) | (5 << 1) | (0 << 0),
1888 .time_stabiliz = 10,
1919 .perform_agc_softsplit = 0,
1923 static struct dibx000_bandwidth_config dib8096p_clock_config_12_mhz = {
1927 (3 << 14) | (1 << 12) | (524 << 0),
1933 static struct dib8000_config tfe8096p_dib8000_config = {
1934 .output_mpeg2_in_188_bytes = 1,
1935 .hostbus_diversity = 1,
1938 .agc_config_count = 2,
1939 .agc = dib8096p_agc_config,
1940 .pll = &dib8096p_clock_config_12_mhz,
1942 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1943 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1944 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1946 .agc_control = NULL,
1947 .diversity_delay = 48,
1948 .output_mode = OUTMODE_MPEG2_FIFO,
1952 static struct dib0090_wbd_slope dib8096p_wbd_table[] = {
1953 { 380, 81, 850, 64, 540, 4},
1954 { 860, 51, 866, 21, 375, 4},
1955 {1700, 0, 250, 0, 100, 6},
1956 {2600, 0, 250, 0, 100, 6},
1957 { 0xFFFF, 0, 0, 0, 0, 0},
1960 static struct dib0090_config tfe8096p_dib0090_config = {
1961 .io.clock_khz = 12000,
1965 .io.pll_loopdiv = 6,
1966 .io.adc_clock_ratio = 0,
1967 .io.pll_int_loop_filt = 0,
1969 .freq_offset_khz_uhf = -143,
1970 .freq_offset_khz_vhf = -143,
1972 .get_adc_power = dib8090_get_adc_power,
1977 .wbd_vhf_offset = 0,
1978 .wbd_cband_offset = 0,
1982 .fref_clock_ratio = 1,
1984 .ls_cfg_pad_drv = 0,
1988 .force_cband_input = 0,
1991 struct dibx090p_adc {
1992 u32 freq; /* RF freq MHz */
1993 u32 timf; /* New Timf */
1994 u32 pll_loopdiv; /* New prediv */
1995 u32 pll_prediv; /* New loopdiv */
1998 struct dibx090p_best_adc {
2004 static int dib8096p_get_best_sampling(struct dvb_frontend *fe, struct dibx090p_best_adc *adc)
2006 u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1;
2008 u16 fcp_min = 1900; /* PLL, Minimum Frequency of phase comparator (KHz) */
2009 u16 fcp_max = 20000; /* PLL, Maximum Frequency of phase comparator (KHz) */
2010 u32 fmem_max = 140000; /* 140MHz max SDRAM freq */
2011 u32 fdem_min = 66000;
2012 u32 fcp = 0, fs = 0, fdem = 0, fmem = 0;
2013 u32 harmonic_id = 0;
2016 adc->pll_loopdiv = loopdiv;
2017 adc->pll_prediv = prediv;
2019 deb_info("bandwidth = %d", fe->dtv_property_cache.bandwidth_hz);
2021 /* Find Min and Max prediv */
2022 while ((xtal / max_prediv) >= fcp_min)
2026 min_prediv = max_prediv;
2027 while ((xtal / min_prediv) <= fcp_max) {
2029 if (min_prediv == 1)
2032 deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv);
2036 for (prediv = min_prediv; prediv < max_prediv; prediv++) {
2037 fcp = xtal / prediv;
2038 if (fcp > fcp_min && fcp < fcp_max) {
2039 for (loopdiv = 1; loopdiv < 64; loopdiv++) {
2040 fmem = ((xtal/prediv) * loopdiv);
2044 /* test min/max system restrictions */
2045 if ((fdem >= fdem_min) && (fmem <= fmem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz / 1000)) {
2047 /* test fs harmonics positions */
2048 for (harmonic_id = (fe->dtv_property_cache.frequency / (1000 * fs)); harmonic_id <= ((fe->dtv_property_cache.frequency / (1000 * fs)) + 1); harmonic_id++) {
2049 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)))) {
2056 adc->pll_loopdiv = loopdiv;
2057 adc->pll_prediv = prediv;
2058 adc->timf = (4260880253U / fdem) * (1 << 8);
2059 adc->timf += ((4260880253U % fdem) << 8) / fdem;
2061 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);
2071 if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0)
2076 static int dib8096p_agc_startup(struct dvb_frontend *fe)
2078 struct dvb_usb_adapter *adap = fe->dvb->priv;
2079 struct dib0700_adapter_state *state = adap->priv;
2080 struct dibx000_bandwidth_config pll;
2081 struct dibx090p_best_adc adc;
2085 ret = state->set_param_save(fe);
2088 memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));
2090 dib0090_pwm_gain_reset(fe);
2091 /* dib0090_get_wbd_target is returning any possible
2092 temperature compensated wbd-target */
2093 target = (dib0090_get_wbd_target(fe) * 8 + 1) / 2;
2094 state->dib8000_ops.set_wbd_ref(fe, target);
2096 if (dib8096p_get_best_sampling(fe, &adc) == 0) {
2097 pll.pll_ratio = adc.pll_loopdiv;
2098 pll.pll_prediv = adc.pll_prediv;
2100 dib0700_set_i2c_speed(adap->dev, 200);
2101 state->dib8000_ops.update_pll(fe, &pll, fe->dtv_property_cache.bandwidth_hz / 1000, 0);
2102 state->dib8000_ops.ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf);
2103 dib0700_set_i2c_speed(adap->dev, 1000);
2108 static int tfe8096p_frontend_attach(struct dvb_usb_adapter *adap)
2110 struct dib0700_state *st = adap->dev->priv;
2112 struct dib0700_adapter_state *state = adap->priv;
2114 if (!dvb_attach(dib8000_attach, &state->dib8000_ops))
2117 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
2118 if (fw_version >= 0x10200)
2119 st->fw_use_new_i2c_api = 1;
2121 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2123 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2124 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2125 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2127 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2129 dib0700_ctrl_clock(adap->dev, 72, 1);
2132 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2134 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2136 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80, 1);
2138 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap,
2139 0x80, &tfe8096p_dib8000_config);
2141 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
2144 static int tfe8096p_tuner_attach(struct dvb_usb_adapter *adap)
2146 struct dib0700_adapter_state *st = adap->priv;
2147 struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_tuner(adap->fe_adap[0].fe);
2149 tfe8096p_dib0090_config.reset = st->dib8000_ops.tuner_sleep;
2150 tfe8096p_dib0090_config.sleep = st->dib8000_ops.tuner_sleep;
2151 tfe8096p_dib0090_config.wbd = dib8096p_wbd_table;
2153 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c,
2154 &tfe8096p_dib0090_config) == NULL)
2157 st->dib8000_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
2159 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
2160 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096p_agc_startup;
2165 static int dib90x0_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
2167 return dib9000_fw_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
2170 static int dib90x0_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
2172 return dib9000_fw_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
2175 static int dib90x0_tuner_reset(struct dvb_frontend *fe, int onoff)
2177 return dib9000_set_gpio(fe, 5, 0, !onoff);
2180 static int dib90x0_tuner_sleep(struct dvb_frontend *fe, int onoff)
2182 return dib9000_set_gpio(fe, 0, 0, onoff);
2185 static int dib01x0_pmu_update(struct i2c_adapter *i2c, u16 *data, u8 len)
2187 u8 wb[4] = { 0xc >> 8, 0xc & 0xff, 0, 0 };
2189 struct i2c_msg msg[2] = {
2190 {.addr = 0x1e >> 1, .flags = 0, .buf = wb, .len = 2},
2191 {.addr = 0x1e >> 1, .flags = I2C_M_RD, .buf = rb, .len = 2},
2195 dibx000_i2c_set_speed(i2c, 250);
2197 if (i2c_transfer(i2c, msg, 2) != 2)
2200 switch (rb[0] << 8 | rb[1]) {
2202 deb_info("Found DiB0170 rev1: This version of DiB0170 is not supported any longer.\n");
2205 deb_info("Found DiB0170 rev2");
2208 deb_info("Found DiB0190 rev2");
2211 deb_info("DiB01x0 not found");
2215 for (index_data = 0; index_data < len; index_data += 2) {
2216 wb[2] = (data[index_data + 1] >> 8) & 0xff;
2217 wb[3] = (data[index_data + 1]) & 0xff;
2219 if (data[index_data] == 0) {
2220 wb[0] = (data[index_data] >> 8) & 0xff;
2221 wb[1] = (data[index_data]) & 0xff;
2223 if (i2c_transfer(i2c, msg, 2) != 2)
2226 wb[3] |= rb[1] & ~(3 << 4);
2229 wb[0] = (data[index_data] >> 8)&0xff;
2230 wb[1] = (data[index_data])&0xff;
2232 if (i2c_transfer(i2c, &msg[0], 1) != 1)
2238 static struct dib9000_config stk9090m_config = {
2239 .output_mpeg2_in_188_bytes = 1,
2240 .output_mode = OUTMODE_MPEG2_FIFO,
2241 .vcxo_timer = 279620,
2242 .timing_frequency = 20452225,
2243 .demod_clock_khz = 60000,
2244 .xtal_clock_khz = 30000,
2245 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
2249 { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0008 } }, /* GPIO 3 to 1 for VHF */
2250 { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0000 } }, /* GPIO 3 to 0 for UHF */
2255 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
2256 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
2260 static struct dib9000_config nim9090md_config[2] = {
2262 .output_mpeg2_in_188_bytes = 1,
2263 .output_mode = OUTMODE_MPEG2_FIFO,
2264 .vcxo_timer = 279620,
2265 .timing_frequency = 20452225,
2266 .demod_clock_khz = 60000,
2267 .xtal_clock_khz = 30000,
2268 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
2270 .output_mpeg2_in_188_bytes = 1,
2271 .output_mode = OUTMODE_DIVERSITY,
2272 .vcxo_timer = 279620,
2273 .timing_frequency = 20452225,
2274 .demod_clock_khz = 60000,
2275 .xtal_clock_khz = 30000,
2276 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
2280 { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0006 } }, /* GPIO 1 and 2 to 1 for VHF */
2281 { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0000 } }, /* GPIO 1 and 2 to 0 for UHF */
2286 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
2287 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
2292 static struct dib0090_config dib9090_dib0090_config = {
2296 .io.pll_loopdiv = 8,
2297 .io.adc_clock_ratio = 8,
2298 .io.pll_int_loop_filt = 0,
2299 .io.clock_khz = 30000,
2300 .reset = dib90x0_tuner_reset,
2301 .sleep = dib90x0_tuner_sleep,
2306 .freq_offset_khz_uhf = 0,
2307 .freq_offset_khz_vhf = 0,
2310 static struct dib0090_config nim9090md_dib0090_config[2] = {
2315 .io.pll_loopdiv = 8,
2316 .io.adc_clock_ratio = 8,
2317 .io.pll_int_loop_filt = 0,
2318 .io.clock_khz = 30000,
2319 .reset = dib90x0_tuner_reset,
2320 .sleep = dib90x0_tuner_sleep,
2325 .freq_offset_khz_uhf = 0,
2326 .freq_offset_khz_vhf = 0,
2331 .io.pll_loopdiv = 8,
2332 .io.adc_clock_ratio = 8,
2333 .io.pll_int_loop_filt = 0,
2334 .io.clock_khz = 30000,
2335 .reset = dib90x0_tuner_reset,
2336 .sleep = dib90x0_tuner_sleep,
2341 .freq_offset_khz_uhf = 0,
2342 .freq_offset_khz_vhf = 0,
2347 static int stk9090m_frontend_attach(struct dvb_usb_adapter *adap)
2349 struct dib0700_adapter_state *state = adap->priv;
2350 struct dib0700_state *st = adap->dev->priv;
2353 /* Make use of the new i2c functions from FW 1.20 */
2354 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
2355 if (fw_version >= 0x10200)
2356 st->fw_use_new_i2c_api = 1;
2357 dib0700_set_i2c_speed(adap->dev, 340);
2359 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2361 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2362 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2363 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2364 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2366 dib0700_ctrl_clock(adap->dev, 72, 1);
2369 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2371 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2373 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80);
2375 if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {
2376 deb_info("%s: Upload failed. (file not found?)\n", __func__);
2379 deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
2381 stk9090m_config.microcode_B_fe_size = state->frontend_firmware->size;
2382 stk9090m_config.microcode_B_fe_buffer = state->frontend_firmware->data;
2384 adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &stk9090m_config);
2386 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
2389 static int dib9090_tuner_attach(struct dvb_usb_adapter *adap)
2391 struct dib0700_adapter_state *state = adap->priv;
2392 struct i2c_adapter *i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe);
2393 u16 data_dib190[10] = {
2401 if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &dib9090_dib0090_config) == NULL)
2403 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
2404 if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0)
2406 dib0700_set_i2c_speed(adap->dev, 1500);
2407 if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0)
2409 release_firmware(state->frontend_firmware);
2413 static int nim9090md_frontend_attach(struct dvb_usb_adapter *adap)
2415 struct dib0700_adapter_state *state = adap->priv;
2416 struct dib0700_state *st = adap->dev->priv;
2417 struct i2c_adapter *i2c;
2418 struct dvb_frontend *fe_slave;
2421 /* Make use of the new i2c functions from FW 1.20 */
2422 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
2423 if (fw_version >= 0x10200)
2424 st->fw_use_new_i2c_api = 1;
2425 dib0700_set_i2c_speed(adap->dev, 340);
2427 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2429 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2430 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2431 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2432 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2434 dib0700_ctrl_clock(adap->dev, 72, 1);
2437 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2439 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2441 if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {
2442 deb_info("%s: Upload failed. (file not found?)\n", __func__);
2445 deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
2447 nim9090md_config[0].microcode_B_fe_size = state->frontend_firmware->size;
2448 nim9090md_config[0].microcode_B_fe_buffer = state->frontend_firmware->data;
2449 nim9090md_config[1].microcode_B_fe_size = state->frontend_firmware->size;
2450 nim9090md_config[1].microcode_B_fe_buffer = state->frontend_firmware->data;
2452 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, 0x80);
2453 adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &nim9090md_config[0]);
2455 if (adap->fe_adap[0].fe == NULL)
2458 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_3_4, 0);
2459 dib9000_i2c_enumeration(i2c, 1, 0x12, 0x82);
2461 fe_slave = dvb_attach(dib9000_attach, i2c, 0x82, &nim9090md_config[1]);
2462 dib9000_set_slave_frontend(adap->fe_adap[0].fe, fe_slave);
2464 return fe_slave == NULL ? -ENODEV : 0;
2467 static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap)
2469 struct dib0700_adapter_state *state = adap->priv;
2470 struct i2c_adapter *i2c;
2471 struct dvb_frontend *fe_slave;
2472 u16 data_dib190[10] = {
2479 i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe);
2480 if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &nim9090md_dib0090_config[0]) == NULL)
2482 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
2483 if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0)
2486 dib0700_set_i2c_speed(adap->dev, 1500);
2487 if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0)
2490 fe_slave = dib9000_get_slave_frontend(adap->fe_adap[0].fe, 1);
2491 if (fe_slave != NULL) {
2492 i2c = dib9000_get_component_bus_interface(adap->fe_adap[0].fe);
2493 dib9000_set_i2c_adapter(fe_slave, i2c);
2495 i2c = dib9000_get_tuner_interface(fe_slave);
2496 if (dvb_attach(dib0090_fw_register, fe_slave, i2c, &nim9090md_dib0090_config[1]) == NULL)
2498 fe_slave->dvb = adap->fe_adap[0].fe->dvb;
2499 dib9000_fw_set_component_bus_speed(adap->fe_adap[0].fe, 1500);
2500 if (dib9000_firmware_post_pll_init(fe_slave) < 0)
2503 release_firmware(state->frontend_firmware);
2509 static int dib7090p_get_best_sampling(struct dvb_frontend *fe , struct dibx090p_best_adc *adc)
2511 u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1;
2514 u32 fcp_min = 1900; /* PLL Minimum Frequency comparator KHz */
2515 u32 fcp_max = 20000; /* PLL Maximum Frequency comparator KHz */
2516 u32 fdem_max = 76000;
2517 u32 fdem_min = 69500;
2518 u32 fcp = 0, fs = 0, fdem = 0;
2519 u32 harmonic_id = 0;
2521 adc->pll_loopdiv = loopdiv;
2522 adc->pll_prediv = prediv;
2525 deb_info("bandwidth = %d fdem_min =%d", fe->dtv_property_cache.bandwidth_hz, fdem_min);
2527 /* Find Min and Max prediv */
2528 while ((xtal/max_prediv) >= fcp_min)
2532 min_prediv = max_prediv;
2533 while ((xtal/min_prediv) <= fcp_max) {
2535 if (min_prediv == 1)
2538 deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv);
2542 for (prediv = min_prediv ; prediv < max_prediv; prediv++) {
2543 fcp = xtal / prediv;
2544 if (fcp > fcp_min && fcp < fcp_max) {
2545 for (loopdiv = 1 ; loopdiv < 64 ; loopdiv++) {
2546 fdem = ((xtal/prediv) * loopdiv);
2548 /* test min/max system restrictions */
2550 if ((fdem >= fdem_min) && (fdem <= fdem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz/1000)) {
2552 /* test fs harmonics positions */
2553 for (harmonic_id = (fe->dtv_property_cache.frequency / (1000*fs)) ; harmonic_id <= ((fe->dtv_property_cache.frequency / (1000*fs))+1) ; harmonic_id++) {
2554 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)))) {
2561 adc->pll_loopdiv = loopdiv;
2562 adc->pll_prediv = prediv;
2563 adc->timf = 2396745143UL/fdem*(1 << 9);
2564 adc->timf += ((2396745143UL%fdem) << 9)/fdem;
2565 deb_info("loopdiv=%i prediv=%i timf=%i", loopdiv, prediv, adc->timf);
2576 if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0)
2582 static int dib7090_agc_startup(struct dvb_frontend *fe)
2584 struct dvb_usb_adapter *adap = fe->dvb->priv;
2585 struct dib0700_adapter_state *state = adap->priv;
2586 struct dibx000_bandwidth_config pll;
2588 struct dibx090p_best_adc adc;
2591 ret = state->set_param_save(fe);
2595 memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));
2596 dib0090_pwm_gain_reset(fe);
2597 target = (dib0090_get_wbd_target(fe) * 8 + 1) / 2;
2598 state->dib7000p_ops.set_wbd_ref(fe, target);
2600 if (dib7090p_get_best_sampling(fe, &adc) == 0) {
2601 pll.pll_ratio = adc.pll_loopdiv;
2602 pll.pll_prediv = adc.pll_prediv;
2604 state->dib7000p_ops.update_pll(fe, &pll);
2605 state->dib7000p_ops.ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf);
2610 static int dib7090_agc_restart(struct dvb_frontend *fe, u8 restart)
2612 deb_info("AGC restart callback: %d", restart);
2613 if (restart == 0) /* before AGC startup */
2614 dib0090_set_dc_servo(fe, 1);
2618 static int tfe7790p_update_lna(struct dvb_frontend *fe, u16 agc_global)
2620 struct dvb_usb_adapter *adap = fe->dvb->priv;
2621 struct dib0700_adapter_state *state = adap->priv;
2623 deb_info("update LNA: agc global=%i", agc_global);
2625 if (agc_global < 25000) {
2626 state->dib7000p_ops.set_gpio(fe, 8, 0, 0);
2627 state->dib7000p_ops.set_agc1_min(fe, 0);
2629 state->dib7000p_ops.set_gpio(fe, 8, 0, 1);
2630 state->dib7000p_ops.set_agc1_min(fe, 32768);
2636 static struct dib0090_wbd_slope dib7090_wbd_table[] = {
2637 { 380, 81, 850, 64, 540, 4},
2638 { 860, 51, 866, 21, 375, 4},
2639 {1700, 0, 250, 0, 100, 6},
2640 {2600, 0, 250, 0, 100, 6},
2641 { 0xFFFF, 0, 0, 0, 0, 0},
2644 static struct dibx000_agc_config dib7090_agc_config[2] = {
2646 .band_caps = BAND_UHF,
2647 /* 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,
2648 * 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 */
2649 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2652 .time_stabiliz = 10,
2683 .perform_agc_softsplit = 0,
2685 .band_caps = BAND_FM | BAND_VHF | BAND_CBAND,
2686 /* 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,
2687 * 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 */
2688 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2691 .time_stabiliz = 10,
2722 .perform_agc_softsplit = 0,
2726 static struct dibx000_bandwidth_config dib7090_clock_config_12_mhz = {
2730 (3 << 14) | (1 << 12) | (524 << 0),
2736 static struct dib7000p_config nim7090_dib7000p_config = {
2737 .output_mpeg2_in_188_bytes = 1,
2738 .hostbus_diversity = 1,
2739 .tuner_is_baseband = 1,
2740 .update_lna = tfe7790p_update_lna, /* GPIO used is the same as TFE7790 */
2742 .agc_config_count = 2,
2743 .agc = dib7090_agc_config,
2745 .bw = &dib7090_clock_config_12_mhz,
2747 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2748 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2749 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2753 .agc_control = dib7090_agc_restart,
2756 .disable_sample_and_hold = 0,
2757 .enable_current_mirror = 0,
2758 .diversity_delay = 0,
2760 .output_mode = OUTMODE_MPEG2_FIFO,
2764 static int tfe7090p_pvr_update_lna(struct dvb_frontend *fe, u16 agc_global)
2766 struct dvb_usb_adapter *adap = fe->dvb->priv;
2767 struct dib0700_adapter_state *state = adap->priv;
2769 deb_info("TFE7090P-PVR update LNA: agc global=%i", agc_global);
2770 if (agc_global < 25000) {
2771 state->dib7000p_ops.set_gpio(fe, 5, 0, 0);
2772 state->dib7000p_ops.set_agc1_min(fe, 0);
2774 state->dib7000p_ops.set_gpio(fe, 5, 0, 1);
2775 state->dib7000p_ops.set_agc1_min(fe, 32768);
2781 static struct dib7000p_config tfe7090pvr_dib7000p_config[2] = {
2783 .output_mpeg2_in_188_bytes = 1,
2784 .hostbus_diversity = 1,
2785 .tuner_is_baseband = 1,
2786 .update_lna = tfe7090p_pvr_update_lna,
2788 .agc_config_count = 2,
2789 .agc = dib7090_agc_config,
2791 .bw = &dib7090_clock_config_12_mhz,
2793 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2794 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2795 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2799 .agc_control = dib7090_agc_restart,
2802 .disable_sample_and_hold = 0,
2803 .enable_current_mirror = 0,
2804 .diversity_delay = 0,
2806 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2807 .default_i2c_addr = 0x90,
2810 .output_mpeg2_in_188_bytes = 1,
2811 .hostbus_diversity = 1,
2812 .tuner_is_baseband = 1,
2813 .update_lna = tfe7090p_pvr_update_lna,
2815 .agc_config_count = 2,
2816 .agc = dib7090_agc_config,
2818 .bw = &dib7090_clock_config_12_mhz,
2820 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2821 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2822 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2826 .agc_control = dib7090_agc_restart,
2829 .disable_sample_and_hold = 0,
2830 .enable_current_mirror = 0,
2831 .diversity_delay = 0,
2833 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2834 .default_i2c_addr = 0x92,
2839 static struct dib0090_config nim7090_dib0090_config = {
2840 .io.clock_khz = 12000,
2844 .io.pll_loopdiv = 6,
2845 .io.adc_clock_ratio = 0,
2846 .io.pll_int_loop_filt = 0,
2848 .freq_offset_khz_uhf = 0,
2849 .freq_offset_khz_vhf = 0,
2854 .wbd_vhf_offset = 0,
2855 .wbd_cband_offset = 0,
2859 .fref_clock_ratio = 0,
2861 .wbd = dib7090_wbd_table,
2863 .ls_cfg_pad_drv = 0,
2869 static struct dib7000p_config tfe7790p_dib7000p_config = {
2870 .output_mpeg2_in_188_bytes = 1,
2871 .hostbus_diversity = 1,
2872 .tuner_is_baseband = 1,
2873 .update_lna = tfe7790p_update_lna,
2875 .agc_config_count = 2,
2876 .agc = dib7090_agc_config,
2878 .bw = &dib7090_clock_config_12_mhz,
2880 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2881 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2882 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2886 .agc_control = dib7090_agc_restart,
2889 .disable_sample_and_hold = 0,
2890 .enable_current_mirror = 0,
2891 .diversity_delay = 0,
2893 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2897 static struct dib0090_config tfe7790p_dib0090_config = {
2898 .io.clock_khz = 12000,
2902 .io.pll_loopdiv = 6,
2903 .io.adc_clock_ratio = 0,
2904 .io.pll_int_loop_filt = 0,
2906 .freq_offset_khz_uhf = 0,
2907 .freq_offset_khz_vhf = 0,
2912 .wbd_vhf_offset = 0,
2913 .wbd_cband_offset = 0,
2917 .fref_clock_ratio = 0,
2919 .wbd = dib7090_wbd_table,
2921 .ls_cfg_pad_drv = 0,
2925 .force_cband_input = 0,
2927 .force_crystal_mode = 1,
2930 static struct dib0090_config tfe7090pvr_dib0090_config[2] = {
2932 .io.clock_khz = 12000,
2936 .io.pll_loopdiv = 6,
2937 .io.adc_clock_ratio = 0,
2938 .io.pll_int_loop_filt = 0,
2940 .freq_offset_khz_uhf = 50,
2941 .freq_offset_khz_vhf = 70,
2946 .wbd_vhf_offset = 0,
2947 .wbd_cband_offset = 0,
2951 .fref_clock_ratio = 0,
2953 .wbd = dib7090_wbd_table,
2955 .ls_cfg_pad_drv = 0,
2960 .io.clock_khz = 12000,
2964 .io.pll_loopdiv = 6,
2965 .io.adc_clock_ratio = 0,
2966 .io.pll_int_loop_filt = 0,
2968 .freq_offset_khz_uhf = -50,
2969 .freq_offset_khz_vhf = -70,
2974 .wbd_vhf_offset = 0,
2975 .wbd_cband_offset = 0,
2979 .fref_clock_ratio = 0,
2981 .wbd = dib7090_wbd_table,
2983 .ls_cfg_pad_drv = 0,
2990 static int nim7090_frontend_attach(struct dvb_usb_adapter *adap)
2992 struct dib0700_adapter_state *state = adap->priv;
2994 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
2997 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2999 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3000 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3001 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3002 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3005 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3007 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3009 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, &nim7090_dib7000p_config) != 0) {
3010 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
3011 dvb_detach(&state->dib7000p_ops);
3014 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, &nim7090_dib7000p_config);
3016 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3019 static int nim7090_tuner_attach(struct dvb_usb_adapter *adap)
3021 struct dib0700_adapter_state *st = adap->priv;
3022 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe);
3024 nim7090_dib0090_config.reset = st->dib7000p_ops.tuner_sleep,
3025 nim7090_dib0090_config.sleep = st->dib7000p_ops.tuner_sleep,
3026 nim7090_dib0090_config.get_adc_power = st->dib7000p_ops.get_adc_power;
3028 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &nim7090_dib0090_config) == NULL)
3031 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3033 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3034 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3038 static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter *adap)
3040 struct dib0700_state *st = adap->dev->priv;
3041 struct dib0700_adapter_state *state = adap->priv;
3043 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3046 /* The TFE7090 requires the dib0700 to not be in master mode */
3047 st->disable_streaming_master_mode = 1;
3049 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3051 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3052 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3053 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3054 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3057 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3059 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3061 /* initialize IC 0 */
3062 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, &tfe7090pvr_dib7000p_config[0]) != 0) {
3063 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
3064 dvb_detach(&state->dib7000p_ops);
3068 dib0700_set_i2c_speed(adap->dev, 340);
3069 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]);
3070 if (adap->fe_adap[0].fe == NULL)
3073 state->dib7000p_ops.slave_reset(adap->fe_adap[0].fe);
3078 static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter *adap)
3080 struct i2c_adapter *i2c;
3081 struct dib0700_adapter_state *state = adap->priv;
3083 if (adap->dev->adapter[0].fe_adap[0].fe == NULL) {
3084 err("the master dib7090 has to be initialized first");
3085 return -ENODEV; /* the master device has not been initialized */
3088 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3091 i2c = state->dib7000p_ops.get_i2c_master(adap->dev->adapter[0].fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_6_7, 1);
3092 if (state->dib7000p_ops.i2c_enumeration(i2c, 1, 0x10, &tfe7090pvr_dib7000p_config[1]) != 0) {
3093 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__);
3094 dvb_detach(&state->dib7000p_ops);
3098 adap->fe_adap[0].fe = state->dib7000p_ops.init(i2c, 0x92, &tfe7090pvr_dib7000p_config[1]);
3099 dib0700_set_i2c_speed(adap->dev, 200);
3101 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3104 static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter *adap)
3106 struct dib0700_adapter_state *st = adap->priv;
3107 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe);
3109 tfe7090pvr_dib0090_config[0].reset = st->dib7000p_ops.tuner_sleep;
3110 tfe7090pvr_dib0090_config[0].sleep = st->dib7000p_ops.tuner_sleep;
3111 tfe7090pvr_dib0090_config[0].get_adc_power = st->dib7000p_ops.get_adc_power;
3113 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[0]) == NULL)
3116 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3118 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3119 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3123 static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter *adap)
3125 struct dib0700_adapter_state *st = adap->priv;
3126 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe);
3128 tfe7090pvr_dib0090_config[1].reset = st->dib7000p_ops.tuner_sleep;
3129 tfe7090pvr_dib0090_config[1].sleep = st->dib7000p_ops.tuner_sleep;
3130 tfe7090pvr_dib0090_config[1].get_adc_power = st->dib7000p_ops.get_adc_power;
3132 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[1]) == NULL)
3135 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3137 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3138 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3142 static int tfe7790p_frontend_attach(struct dvb_usb_adapter *adap)
3144 struct dib0700_state *st = adap->dev->priv;
3145 struct dib0700_adapter_state *state = adap->priv;
3147 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3150 /* The TFE7790P requires the dib0700 to not be in master mode */
3151 st->disable_streaming_master_mode = 1;
3153 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3155 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3156 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3157 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3158 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3160 dib0700_ctrl_clock(adap->dev, 72, 1);
3161 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3163 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3165 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap,
3166 1, 0x10, &tfe7790p_dib7000p_config) != 0) {
3167 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
3169 dvb_detach(&state->dib7000p_ops);
3172 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap,
3173 0x80, &tfe7790p_dib7000p_config);
3175 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3178 static int tfe7790p_tuner_attach(struct dvb_usb_adapter *adap)
3180 struct dib0700_adapter_state *st = adap->priv;
3181 struct i2c_adapter *tun_i2c =
3182 st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe);
3185 tfe7790p_dib0090_config.reset = st->dib7000p_ops.tuner_sleep;
3186 tfe7790p_dib0090_config.sleep = st->dib7000p_ops.tuner_sleep;
3187 tfe7790p_dib0090_config.get_adc_power = st->dib7000p_ops.get_adc_power;
3189 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c,
3190 &tfe7790p_dib0090_config) == NULL)
3193 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3195 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3196 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3201 static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
3203 .output_mpeg2_in_188_bytes = 1,
3205 .agc_config_count = 1,
3206 .agc = &dib7070_agc_config,
3207 .bw = &dib7070_bw_config_12_mhz,
3208 .tuner_is_baseband = 1,
3211 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
3212 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
3213 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
3215 .hostbus_diversity = 1,
3217 .output_mpeg2_in_188_bytes = 1,
3219 .agc_config_count = 1,
3220 .agc = &dib7070_agc_config,
3221 .bw = &dib7070_bw_config_12_mhz,
3222 .tuner_is_baseband = 1,
3225 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
3226 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
3227 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
3229 .hostbus_diversity = 1,
3233 static void stk7070pd_init(struct dvb_usb_device *dev)
3235 dib0700_set_gpio(dev, GPIO6, GPIO_OUT, 1);
3237 dib0700_set_gpio(dev, GPIO9, GPIO_OUT, 1);
3238 dib0700_set_gpio(dev, GPIO4, GPIO_OUT, 1);
3239 dib0700_set_gpio(dev, GPIO7, GPIO_OUT, 1);
3240 dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 0);
3242 dib0700_ctrl_clock(dev, 72, 1);
3245 dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 1);
3248 static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
3250 struct dib0700_adapter_state *state = adap->priv;
3252 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3255 stk7070pd_init(adap->dev);
3258 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3260 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
3261 stk7070pd_dib7000p_config) != 0) {
3262 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
3264 dvb_detach(&state->dib7000p_ops);
3268 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
3269 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3272 static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
3274 struct dib0700_adapter_state *state = adap->priv;
3276 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3279 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
3280 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3283 static int novatd_read_status_override(struct dvb_frontend *fe,
3286 struct dvb_usb_adapter *adap = fe->dvb->priv;
3287 struct dvb_usb_device *dev = adap->dev;
3288 struct dib0700_state *state = dev->priv;
3291 ret = state->read_status(fe, stat);
3294 dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT,
3295 !!(*stat & FE_HAS_LOCK));
3300 static int novatd_sleep_override(struct dvb_frontend* fe)
3302 struct dvb_usb_adapter *adap = fe->dvb->priv;
3303 struct dvb_usb_device *dev = adap->dev;
3304 struct dib0700_state *state = dev->priv;
3307 dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT, 0);
3309 return state->sleep(fe);
3313 * novatd_frontend_attach - Nova-TD specific attach
3315 * Nova-TD has GPIO0, 1 and 2 for LEDs. So do not fiddle with them except for
3316 * information purposes.
3318 static int novatd_frontend_attach(struct dvb_usb_adapter *adap)
3320 struct dvb_usb_device *dev = adap->dev;
3321 struct dib0700_state *st = dev->priv;
3322 struct dib0700_adapter_state *state = adap->priv;
3324 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3327 if (adap->id == 0) {
3328 stk7070pd_init(dev);
3330 /* turn the power LED on, the other two off (just in case) */
3331 dib0700_set_gpio(dev, GPIO0, GPIO_OUT, 0);
3332 dib0700_set_gpio(dev, GPIO1, GPIO_OUT, 0);
3333 dib0700_set_gpio(dev, GPIO2, GPIO_OUT, 1);
3335 if (state->dib7000p_ops.i2c_enumeration(&dev->i2c_adap, 2, 18,
3336 stk7070pd_dib7000p_config) != 0) {
3337 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
3339 dvb_detach(&state->dib7000p_ops);
3344 adap->fe_adap[0].fe = state->dib7000p_ops.init(&dev->i2c_adap,
3345 adap->id == 0 ? 0x80 : 0x82,
3346 &stk7070pd_dib7000p_config[adap->id]);
3348 if (adap->fe_adap[0].fe == NULL)
3351 st->read_status = adap->fe_adap[0].fe->ops.read_status;
3352 adap->fe_adap[0].fe->ops.read_status = novatd_read_status_override;
3353 st->sleep = adap->fe_adap[0].fe->ops.sleep;
3354 adap->fe_adap[0].fe->ops.sleep = novatd_sleep_override;
3360 static struct s5h1411_config pinnacle_801e_config = {
3361 .output_mode = S5H1411_PARALLEL_OUTPUT,
3362 .gpio = S5H1411_GPIO_OFF,
3363 .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
3364 .qam_if = S5H1411_IF_44000,
3365 .vsb_if = S5H1411_IF_44000,
3366 .inversion = S5H1411_INVERSION_OFF,
3367 .status_mode = S5H1411_DEMODLOCKING
3370 /* Pinnacle PCTV HD Pro 801e GPIOs map:
3371 GPIO0 - currently unknown
3372 GPIO1 - xc5000 tuner reset
3373 GPIO2 - CX25843 sleep
3374 GPIO3 - currently unknown
3375 GPIO4 - currently unknown
3376 GPIO6 - currently unknown
3377 GPIO7 - currently unknown
3378 GPIO9 - currently unknown
3379 GPIO10 - CX25843 reset
3381 static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
3383 struct dib0700_state *st = adap->dev->priv;
3385 /* Make use of the new i2c functions from FW 1.20 */
3386 st->fw_use_new_i2c_api = 1;
3388 /* The s5h1411 requires the dib0700 to not be in master mode */
3389 st->disable_streaming_master_mode = 1;
3391 /* All msleep values taken from Windows USB trace */
3392 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
3393 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
3394 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3396 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3398 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3400 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3401 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3402 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3403 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3404 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
3407 /* Put the CX25843 to sleep for now since we're in digital mode */
3408 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
3410 /* GPIOs are initialized, do the attach */
3411 adap->fe_adap[0].fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
3412 &adap->dev->i2c_adap);
3413 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3416 static int dib0700_xc5000_tuner_callback(void *priv, int component,
3417 int command, int arg)
3419 struct dvb_usb_adapter *adap = priv;
3421 if (command == XC5000_TUNER_RESET) {
3422 /* Reset the tuner */
3423 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
3425 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
3428 err("xc5000: unknown tuner callback command: %d\n", command);
3435 static struct xc5000_config s5h1411_xc5000_tunerconfig = {
3436 .i2c_address = 0x64,
3440 static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
3442 /* FIXME: generalize & move to common area */
3443 adap->fe_adap[0].fe->callback = dib0700_xc5000_tuner_callback;
3445 return dvb_attach(xc5000_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap,
3446 &s5h1411_xc5000_tunerconfig)
3447 == NULL ? -ENODEV : 0;
3450 static int dib0700_xc4000_tuner_callback(void *priv, int component,
3451 int command, int arg)
3453 struct dvb_usb_adapter *adap = priv;
3454 struct dib0700_adapter_state *state = adap->priv;
3456 if (command == XC4000_TUNER_RESET) {
3457 /* Reset the tuner */
3458 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 0);
3460 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3462 err("xc4000: unknown tuner callback command: %d\n", command);
3469 static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config = {
3470 .band_caps = BAND_UHF | BAND_VHF,
3473 .time_stabiliz = 0x15,
3474 .alpha_level = 0x00,
3487 .agc1_slope1 = 0x00,
3488 .agc1_slope2 = 0x00,
3491 .agc2_slope1 = 0x1d,
3492 .agc2_slope2 = 0x1d,
3497 .perform_agc_softsplit = 0x00,
3500 static struct dibx000_bandwidth_config stk7700p_xc4000_pll_config = {
3501 60000, 30000, /* internal, sampling */
3502 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
3503 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, */
3504 /* ADClkSrc, modulo */
3505 (3 << 14) | (1 << 12) | 524, /* sad_cfg: refsel, sel, freq_15k */
3506 39370534, /* ifreq */
3507 20452225, /* timf */
3511 /* FIXME: none of these inputs are validated yet */
3512 static struct dib7000p_config pctv_340e_config = {
3513 .output_mpeg2_in_188_bytes = 1,
3515 .agc_config_count = 1,
3516 .agc = &stk7700p_7000p_xc4000_agc_config,
3517 .bw = &stk7700p_xc4000_pll_config,
3519 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
3520 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
3521 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
3524 /* PCTV 340e GPIOs map:
3526 GPIO2 - CX25843 sleep
3527 GPIO3 - CS5340 reset
3529 GPIO6 - Power Supply
3530 GPIO8 - LNA (1=off 0=on)
3531 GPIO10 - CX25843 reset
3533 GPIO8 - xc4000 reset
3535 static int pctv340e_frontend_attach(struct dvb_usb_adapter *adap)
3537 struct dib0700_state *st = adap->dev->priv;
3538 struct dib0700_adapter_state *state = adap->priv;
3540 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
3543 /* Power Supply on */
3544 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
3546 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3547 msleep(100); /* Allow power supply to settle before probing */
3550 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3551 msleep(1); /* cx25843 datasheet say 350us required */
3552 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3554 /* LNA off for now */
3555 dib0700_set_gpio(adap->dev, GPIO8, GPIO_OUT, 1);
3557 /* Put the CX25843 to sleep for now since we're in digital mode */
3558 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
3560 /* FIXME: not verified yet */
3561 dib0700_ctrl_clock(adap->dev, 72, 1);
3565 if (state->dib7000p_ops.dib7000pc_detection(&adap->dev->i2c_adap) == 0) {
3566 /* Demodulator not found for some reason? */
3567 dvb_detach(&state->dib7000p_ops);
3571 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x12,
3573 st->is_dib7000pc = 1;
3575 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3578 static struct xc4000_config dib7000p_xc4000_tunerconfig = {
3579 .i2c_address = 0x61,
3582 .set_smoothedcvbs = 0,
3586 static int xc4000_tuner_attach(struct dvb_usb_adapter *adap)
3588 struct i2c_adapter *tun_i2c;
3589 struct dib0700_adapter_state *state = adap->priv;
3591 /* The xc4000 is not on the main i2c bus */
3592 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
3593 DIBX000_I2C_INTERFACE_TUNER, 1);
3594 if (tun_i2c == NULL) {
3595 printk(KERN_ERR "Could not reach tuner i2c bus\n");
3599 /* Setup the reset callback */
3600 adap->fe_adap[0].fe->callback = dib0700_xc4000_tuner_callback;
3602 return dvb_attach(xc4000_attach, adap->fe_adap[0].fe, tun_i2c,
3603 &dib7000p_xc4000_tunerconfig)
3604 == NULL ? -ENODEV : 0;
3607 static struct lgdt3305_config hcw_lgdt3305_config = {
3609 .mpeg_mode = LGDT3305_MPEG_PARALLEL,
3610 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
3611 .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
3613 .spectral_inversion = 1,
3616 .usref_8vsb = 0x0500,
3619 static struct mxl5007t_config hcw_mxl5007t_config = {
3620 .xtal_freq_hz = MxL_XTAL_25_MHZ,
3621 .if_freq_hz = MxL_IF_6_MHZ,
3626 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
3627 GPIO1 - ANT_SEL (H: VPA, L: MCX)
3633 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
3635 static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
3637 struct dib0700_state *st = adap->dev->priv;
3639 /* Make use of the new i2c functions from FW 1.20 */
3640 st->fw_use_new_i2c_api = 1;
3642 st->disable_streaming_master_mode = 1;
3644 /* fe power enable */
3645 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
3647 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3651 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3653 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3655 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3658 adap->fe_adap[0].fe = dvb_attach(lgdt3305_attach,
3659 &hcw_lgdt3305_config,
3660 &adap->dev->i2c_adap);
3662 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
3665 static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
3667 return dvb_attach(mxl5007t_attach, adap->fe_adap[0].fe,
3668 &adap->dev->i2c_adap, 0x60,
3669 &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
3673 /* DVB-USB and USB stuff follows */
3674 struct usb_device_id dib0700_usb_id_table[] = {
3675 /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
3676 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
3677 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
3678 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
3679 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
3680 /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
3681 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
3682 { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
3683 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
3684 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
3685 /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
3686 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
3687 { USB_DEVICE(USB_VID_TERRATEC,
3688 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
3689 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
3690 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
3691 /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
3692 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
3693 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
3694 { USB_DEVICE(USB_VID_PINNACLE,
3695 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
3696 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
3697 /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
3698 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
3699 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
3700 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
3701 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
3702 /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
3703 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
3704 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
3705 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
3706 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
3707 /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
3708 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
3709 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
3710 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
3711 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
3712 /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
3713 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
3714 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
3715 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
3716 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
3717 /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
3718 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
3719 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
3720 { USB_DEVICE(USB_VID_TERRATEC,
3721 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
3722 { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
3723 /* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
3724 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
3725 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
3726 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
3727 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
3728 /* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
3729 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
3730 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
3731 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
3732 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
3733 /* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
3734 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
3735 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV73ESE) },
3736 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV282E) },
3737 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
3738 /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
3739 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
3740 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
3741 { USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x000, 0x3f00) },
3742 { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },
3743 /* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
3744 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
3745 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) },
3746 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) },
3747 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090M) },
3748 /* 70 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM8096MD) },
3749 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090MD) },
3750 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM7090) },
3751 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090PVR) },
3752 { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2) },
3753 /* 75 */{ USB_DEVICE(USB_VID_MEDION, USB_PID_CREATIX_CTX1921) },
3754 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E) },
3755 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E_SE) },
3756 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7790P) },
3757 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE8096P) },
3758 /* 80 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_2) },
3759 { USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_2002E) },
3760 { USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_2002E_SE) },
3761 { 0 } /* Terminating entry */
3763 MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
3765 #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
3766 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
3767 .usb_ctrl = DEVICE_SPECIFIC, \
3768 .firmware = "dvb-usb-dib0700-1.20.fw", \
3769 .download_firmware = dib0700_download_firmware, \
3770 .no_reconnect = 1, \
3771 .size_of_priv = sizeof(struct dib0700_state), \
3772 .i2c_algo = &dib0700_i2c_algo, \
3773 .identify_state = dib0700_identify_state
3775 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
3776 .streaming_ctrl = dib0700_streaming_ctrl, \
3783 .buffersize = 39480, \
3788 struct dvb_usb_device_properties dib0700_devices[] = {
3790 DIB0700_DEFAULT_DEVICE_PROPERTIES,
3797 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3798 .pid_filter_count = 32,
3799 .pid_filter = stk7700p_pid_filter,
3800 .pid_filter_ctrl = stk7700p_pid_filter_ctrl,
3801 .frontend_attach = stk7700p_frontend_attach,
3802 .tuner_attach = stk7700p_tuner_attach,
3804 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3806 .size_of_priv = sizeof(struct dib0700_adapter_state),
3810 .num_device_descs = 8,
3812 { "DiBcom STK7700P reference design",
3813 { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
3816 { "Hauppauge Nova-T Stick",
3817 { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
3820 { "AVerMedia AVerTV DVB-T Volar",
3821 { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
3824 { "Compro Videomate U500",
3825 { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
3828 { "Uniwill STK7700P based (Hama and others)",
3829 { &dib0700_usb_id_table[7], NULL },
3832 { "Leadtek Winfast DTV Dongle (STK7700P based)",
3833 { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
3836 { "AVerMedia AVerTV DVB-T Express",
3837 { &dib0700_usb_id_table[20] },
3841 { &dib0700_usb_id_table[21], NULL },
3847 .rc_interval = DEFAULT_RC_INTERVAL,
3848 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3849 .rc_query = dib0700_rc_query_old_firmware,
3850 .allowed_protos = RC_BIT_RC5 |
3853 .change_protocol = dib0700_change_protocol,
3855 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3862 .frontend_attach = bristol_frontend_attach,
3863 .tuner_attach = bristol_tuner_attach,
3865 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3870 .frontend_attach = bristol_frontend_attach,
3871 .tuner_attach = bristol_tuner_attach,
3873 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3878 .num_device_descs = 1,
3880 { "Hauppauge Nova-T 500 Dual DVB-T",
3881 { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
3887 .rc_interval = DEFAULT_RC_INTERVAL,
3888 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3889 .rc_query = dib0700_rc_query_old_firmware,
3890 .allowed_protos = RC_BIT_RC5 |
3893 .change_protocol = dib0700_change_protocol,
3895 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3902 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3903 .pid_filter_count = 32,
3904 .pid_filter = stk70x0p_pid_filter,
3905 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3906 .frontend_attach = stk7700d_frontend_attach,
3907 .tuner_attach = stk7700d_tuner_attach,
3909 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3914 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3915 .pid_filter_count = 32,
3916 .pid_filter = stk70x0p_pid_filter,
3917 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3918 .frontend_attach = stk7700d_frontend_attach,
3919 .tuner_attach = stk7700d_tuner_attach,
3921 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3926 .num_device_descs = 5,
3928 { "Pinnacle PCTV 2000e",
3929 { &dib0700_usb_id_table[11], NULL },
3932 { "Terratec Cinergy DT XS Diversity",
3933 { &dib0700_usb_id_table[12], NULL },
3936 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
3937 { &dib0700_usb_id_table[13], NULL },
3940 { "DiBcom STK7700D reference design",
3941 { &dib0700_usb_id_table[14], NULL },
3944 { "YUAN High-Tech DiBcom STK7700D",
3945 { &dib0700_usb_id_table[55], NULL },
3952 .rc_interval = DEFAULT_RC_INTERVAL,
3953 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3954 .rc_query = dib0700_rc_query_old_firmware,
3955 .allowed_protos = RC_BIT_RC5 |
3958 .change_protocol = dib0700_change_protocol,
3960 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3967 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3968 .pid_filter_count = 32,
3969 .pid_filter = stk70x0p_pid_filter,
3970 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3971 .frontend_attach = stk7700P2_frontend_attach,
3972 .tuner_attach = stk7700d_tuner_attach,
3974 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3979 .num_device_descs = 3,
3981 { "ASUS My Cinema U3000 Mini DVBT Tuner",
3982 { &dib0700_usb_id_table[23], NULL },
3986 { &dib0700_usb_id_table[31], NULL },
3989 { "Terratec Cinergy T Express",
3990 { &dib0700_usb_id_table[42], NULL },
3996 .rc_interval = DEFAULT_RC_INTERVAL,
3997 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3998 .module_name = "dib0700",
3999 .rc_query = dib0700_rc_query_old_firmware,
4000 .allowed_protos = RC_BIT_RC5 |
4003 .change_protocol = dib0700_change_protocol,
4005 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4012 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4013 .pid_filter_count = 32,
4014 .pid_filter = stk70x0p_pid_filter,
4015 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4016 .frontend_attach = stk7070p_frontend_attach,
4017 .tuner_attach = dib7070p_tuner_attach,
4019 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4021 .size_of_priv = sizeof(struct dib0700_adapter_state),
4025 .num_device_descs = 12,
4027 { "DiBcom STK7070P reference design",
4028 { &dib0700_usb_id_table[15], NULL },
4031 { "Pinnacle PCTV DVB-T Flash Stick",
4032 { &dib0700_usb_id_table[16], NULL },
4035 { "Artec T14BR DVB-T",
4036 { &dib0700_usb_id_table[22], NULL },
4039 { "ASUS My Cinema U3100 Mini DVBT Tuner",
4040 { &dib0700_usb_id_table[24], NULL },
4043 { "Hauppauge Nova-T Stick",
4044 { &dib0700_usb_id_table[25], NULL },
4047 { "Hauppauge Nova-T MyTV.t",
4048 { &dib0700_usb_id_table[26], NULL },
4051 { "Pinnacle PCTV 72e",
4052 { &dib0700_usb_id_table[29], NULL },
4055 { "Pinnacle PCTV 73e",
4056 { &dib0700_usb_id_table[30], NULL },
4059 { "Elgato EyeTV DTT",
4060 { &dib0700_usb_id_table[49], NULL },
4064 { &dib0700_usb_id_table[45], NULL },
4067 { "Elgato EyeTV Dtt Dlx PD378S",
4068 { &dib0700_usb_id_table[50], NULL },
4071 { "Elgato EyeTV DTT rev. 2",
4072 { &dib0700_usb_id_table[80], NULL },
4078 .rc_interval = DEFAULT_RC_INTERVAL,
4079 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4080 .module_name = "dib0700",
4081 .rc_query = dib0700_rc_query_old_firmware,
4082 .allowed_protos = RC_BIT_RC5 |
4085 .change_protocol = dib0700_change_protocol,
4087 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4094 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4095 .pid_filter_count = 32,
4096 .pid_filter = stk70x0p_pid_filter,
4097 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4098 .frontend_attach = stk7070p_frontend_attach,
4099 .tuner_attach = dib7070p_tuner_attach,
4101 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4103 .size_of_priv = sizeof(struct dib0700_adapter_state),
4107 .num_device_descs = 3,
4109 { "Pinnacle PCTV 73A",
4110 { &dib0700_usb_id_table[56], NULL },
4113 { "Pinnacle PCTV 73e SE",
4114 { &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL },
4117 { "Pinnacle PCTV 282e",
4118 { &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL },
4124 .rc_interval = DEFAULT_RC_INTERVAL,
4125 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4126 .module_name = "dib0700",
4127 .rc_query = dib0700_rc_query_old_firmware,
4128 .allowed_protos = RC_BIT_RC5 |
4131 .change_protocol = dib0700_change_protocol,
4133 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4140 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4141 .pid_filter_count = 32,
4142 .pid_filter = stk70x0p_pid_filter,
4143 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4144 .frontend_attach = novatd_frontend_attach,
4145 .tuner_attach = dib7070p_tuner_attach,
4147 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4149 .size_of_priv = sizeof(struct dib0700_adapter_state),
4153 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4154 .pid_filter_count = 32,
4155 .pid_filter = stk70x0p_pid_filter,
4156 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4157 .frontend_attach = novatd_frontend_attach,
4158 .tuner_attach = dib7070p_tuner_attach,
4160 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4162 .size_of_priv = sizeof(struct dib0700_adapter_state),
4166 .num_device_descs = 3,
4168 { "Hauppauge Nova-TD Stick (52009)",
4169 { &dib0700_usb_id_table[35], NULL },
4173 { &dib0700_usb_id_table[81], NULL },
4177 { &dib0700_usb_id_table[82], NULL },
4183 .rc_interval = DEFAULT_RC_INTERVAL,
4184 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4185 .module_name = "dib0700",
4186 .rc_query = dib0700_rc_query_old_firmware,
4187 .allowed_protos = RC_BIT_RC5 |
4190 .change_protocol = dib0700_change_protocol,
4192 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4199 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4200 .pid_filter_count = 32,
4201 .pid_filter = stk70x0p_pid_filter,
4202 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4203 .frontend_attach = stk7070pd_frontend_attach0,
4204 .tuner_attach = dib7070p_tuner_attach,
4206 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4208 .size_of_priv = sizeof(struct dib0700_adapter_state),
4212 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4213 .pid_filter_count = 32,
4214 .pid_filter = stk70x0p_pid_filter,
4215 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4216 .frontend_attach = stk7070pd_frontend_attach1,
4217 .tuner_attach = dib7070p_tuner_attach,
4219 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4221 .size_of_priv = sizeof(struct dib0700_adapter_state),
4225 .num_device_descs = 5,
4227 { "DiBcom STK7070PD reference design",
4228 { &dib0700_usb_id_table[17], NULL },
4231 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
4232 { &dib0700_usb_id_table[18], NULL },
4235 { "Hauppauge Nova-TD-500 (84xxx)",
4236 { &dib0700_usb_id_table[36], NULL },
4239 { "Terratec Cinergy DT USB XS Diversity/ T5",
4240 { &dib0700_usb_id_table[43],
4241 &dib0700_usb_id_table[53], NULL},
4245 { &dib0700_usb_id_table[44], NULL },
4251 .rc_interval = DEFAULT_RC_INTERVAL,
4252 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4253 .module_name = "dib0700",
4254 .rc_query = dib0700_rc_query_old_firmware,
4255 .allowed_protos = RC_BIT_RC5 |
4258 .change_protocol = dib0700_change_protocol,
4260 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4267 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4268 .pid_filter_count = 32,
4269 .pid_filter = stk70x0p_pid_filter,
4270 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4271 .frontend_attach = stk7070pd_frontend_attach0,
4272 .tuner_attach = dib7070p_tuner_attach,
4274 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4276 .size_of_priv = sizeof(struct dib0700_adapter_state),
4280 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4281 .pid_filter_count = 32,
4282 .pid_filter = stk70x0p_pid_filter,
4283 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4284 .frontend_attach = stk7070pd_frontend_attach1,
4285 .tuner_attach = dib7070p_tuner_attach,
4287 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4289 .size_of_priv = sizeof(struct dib0700_adapter_state),
4293 .num_device_descs = 1,
4295 { "Elgato EyeTV Diversity",
4296 { &dib0700_usb_id_table[68], NULL },
4302 .rc_interval = DEFAULT_RC_INTERVAL,
4303 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
4304 .module_name = "dib0700",
4305 .rc_query = dib0700_rc_query_old_firmware,
4306 .allowed_protos = RC_BIT_RC5 |
4309 .change_protocol = dib0700_change_protocol,
4311 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4318 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4319 .pid_filter_count = 32,
4320 .pid_filter = stk70x0p_pid_filter,
4321 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4322 .frontend_attach = stk7700ph_frontend_attach,
4323 .tuner_attach = stk7700ph_tuner_attach,
4325 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4327 .size_of_priv = sizeof(struct
4328 dib0700_adapter_state),
4332 .num_device_descs = 9,
4334 { "Terratec Cinergy HT USB XE",
4335 { &dib0700_usb_id_table[27], NULL },
4338 { "Pinnacle Expresscard 320cx",
4339 { &dib0700_usb_id_table[28], NULL },
4342 { "Terratec Cinergy HT Express",
4343 { &dib0700_usb_id_table[32], NULL },
4346 { "Gigabyte U8000-RH",
4347 { &dib0700_usb_id_table[37], NULL },
4350 { "YUAN High-Tech STK7700PH",
4351 { &dib0700_usb_id_table[38], NULL },
4354 { "Asus My Cinema-U3000Hybrid",
4355 { &dib0700_usb_id_table[39], NULL },
4358 { "YUAN High-Tech MC770",
4359 { &dib0700_usb_id_table[48], NULL },
4362 { "Leadtek WinFast DTV Dongle H",
4363 { &dib0700_usb_id_table[51], NULL },
4366 { "YUAN High-Tech STK7700D",
4367 { &dib0700_usb_id_table[54], NULL },
4373 .rc_interval = DEFAULT_RC_INTERVAL,
4374 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4375 .module_name = "dib0700",
4376 .rc_query = dib0700_rc_query_old_firmware,
4377 .allowed_protos = RC_BIT_RC5 |
4380 .change_protocol = dib0700_change_protocol,
4382 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4388 .frontend_attach = s5h1411_frontend_attach,
4389 .tuner_attach = xc5000_tuner_attach,
4391 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4393 .size_of_priv = sizeof(struct
4394 dib0700_adapter_state),
4398 .num_device_descs = 2,
4400 { "Pinnacle PCTV HD Pro USB Stick",
4401 { &dib0700_usb_id_table[40], NULL },
4404 { "Pinnacle PCTV HD USB Stick",
4405 { &dib0700_usb_id_table[41], NULL },
4411 .rc_interval = DEFAULT_RC_INTERVAL,
4412 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4413 .module_name = "dib0700",
4414 .rc_query = dib0700_rc_query_old_firmware,
4415 .allowed_protos = RC_BIT_RC5 |
4418 .change_protocol = dib0700_change_protocol,
4420 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4426 .frontend_attach = lgdt3305_frontend_attach,
4427 .tuner_attach = mxl5007t_tuner_attach,
4429 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4431 .size_of_priv = sizeof(struct
4432 dib0700_adapter_state),
4436 .num_device_descs = 2,
4438 { "Hauppauge ATSC MiniCard (B200)",
4439 { &dib0700_usb_id_table[46], NULL },
4442 { "Hauppauge ATSC MiniCard (B210)",
4443 { &dib0700_usb_id_table[47], NULL },
4447 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4454 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4455 .pid_filter_count = 32,
4456 .pid_filter = stk70x0p_pid_filter,
4457 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4458 .frontend_attach = stk7770p_frontend_attach,
4459 .tuner_attach = dib7770p_tuner_attach,
4461 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4464 sizeof(struct dib0700_adapter_state),
4468 .num_device_descs = 4,
4470 { "DiBcom STK7770P reference design",
4471 { &dib0700_usb_id_table[59], NULL },
4474 { "Terratec Cinergy T USB XXS (HD)/ T3",
4475 { &dib0700_usb_id_table[33],
4476 &dib0700_usb_id_table[52],
4477 &dib0700_usb_id_table[60], NULL},
4480 { "TechniSat AirStar TeleStick 2",
4481 { &dib0700_usb_id_table[74], NULL },
4484 { "Medion CTX1921 DVB-T USB",
4485 { &dib0700_usb_id_table[75], NULL },
4491 .rc_interval = DEFAULT_RC_INTERVAL,
4492 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4493 .module_name = "dib0700",
4494 .rc_query = dib0700_rc_query_old_firmware,
4495 .allowed_protos = RC_BIT_RC5 |
4498 .change_protocol = dib0700_change_protocol,
4500 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4506 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4507 .pid_filter_count = 32,
4508 .pid_filter = stk80xx_pid_filter,
4509 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4510 .frontend_attach = stk807x_frontend_attach,
4511 .tuner_attach = dib807x_tuner_attach,
4513 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4516 sizeof(struct dib0700_adapter_state),
4520 .num_device_descs = 3,
4522 { "DiBcom STK807xP reference design",
4523 { &dib0700_usb_id_table[62], NULL },
4526 { "Prolink Pixelview SBTVD",
4527 { &dib0700_usb_id_table[63], NULL },
4530 { "EvolutePC TVWay+",
4531 { &dib0700_usb_id_table[64], NULL },
4537 .rc_interval = DEFAULT_RC_INTERVAL,
4538 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
4539 .module_name = "dib0700",
4540 .rc_query = dib0700_rc_query_old_firmware,
4541 .allowed_protos = RC_BIT_RC5 |
4544 .change_protocol = dib0700_change_protocol,
4546 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4552 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4553 .pid_filter_count = 32,
4554 .pid_filter = stk80xx_pid_filter,
4555 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4556 .frontend_attach = stk807xpvr_frontend_attach0,
4557 .tuner_attach = dib807x_tuner_attach,
4559 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4562 sizeof(struct dib0700_adapter_state),
4567 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4568 .pid_filter_count = 32,
4569 .pid_filter = stk80xx_pid_filter,
4570 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4571 .frontend_attach = stk807xpvr_frontend_attach1,
4572 .tuner_attach = dib807x_tuner_attach,
4574 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4577 sizeof(struct dib0700_adapter_state),
4581 .num_device_descs = 1,
4583 { "DiBcom STK807xPVR reference design",
4584 { &dib0700_usb_id_table[61], NULL },
4590 .rc_interval = DEFAULT_RC_INTERVAL,
4591 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4592 .module_name = "dib0700",
4593 .rc_query = dib0700_rc_query_old_firmware,
4594 .allowed_protos = RC_BIT_RC5 |
4597 .change_protocol = dib0700_change_protocol,
4599 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4605 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4606 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4607 .pid_filter_count = 32,
4608 .pid_filter = stk80xx_pid_filter,
4609 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4610 .frontend_attach = stk809x_frontend_attach,
4611 .tuner_attach = dib809x_tuner_attach,
4613 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4616 sizeof(struct dib0700_adapter_state),
4620 .num_device_descs = 1,
4622 { "DiBcom STK8096GP reference design",
4623 { &dib0700_usb_id_table[67], NULL },
4629 .rc_interval = DEFAULT_RC_INTERVAL,
4630 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4631 .module_name = "dib0700",
4632 .rc_query = dib0700_rc_query_old_firmware,
4633 .allowed_protos = RC_BIT_RC5 |
4636 .change_protocol = dib0700_change_protocol,
4638 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4644 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4645 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4646 .pid_filter_count = 32,
4647 .pid_filter = dib90x0_pid_filter,
4648 .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
4649 .frontend_attach = stk9090m_frontend_attach,
4650 .tuner_attach = dib9090_tuner_attach,
4652 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4655 sizeof(struct dib0700_adapter_state),
4659 .num_device_descs = 1,
4661 { "DiBcom STK9090M reference design",
4662 { &dib0700_usb_id_table[69], NULL },
4668 .rc_interval = DEFAULT_RC_INTERVAL,
4669 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4670 .module_name = "dib0700",
4671 .rc_query = dib0700_rc_query_old_firmware,
4672 .allowed_protos = RC_BIT_RC5 |
4675 .change_protocol = dib0700_change_protocol,
4677 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4683 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4684 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4685 .pid_filter_count = 32,
4686 .pid_filter = stk80xx_pid_filter,
4687 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4688 .frontend_attach = nim8096md_frontend_attach,
4689 .tuner_attach = nim8096md_tuner_attach,
4691 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4694 sizeof(struct dib0700_adapter_state),
4698 .num_device_descs = 1,
4700 { "DiBcom NIM8096MD reference design",
4701 { &dib0700_usb_id_table[70], NULL },
4707 .rc_interval = DEFAULT_RC_INTERVAL,
4708 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4709 .module_name = "dib0700",
4710 .rc_query = dib0700_rc_query_old_firmware,
4711 .allowed_protos = RC_BIT_RC5 |
4714 .change_protocol = dib0700_change_protocol,
4716 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4722 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4723 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4724 .pid_filter_count = 32,
4725 .pid_filter = dib90x0_pid_filter,
4726 .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
4727 .frontend_attach = nim9090md_frontend_attach,
4728 .tuner_attach = nim9090md_tuner_attach,
4730 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4733 sizeof(struct dib0700_adapter_state),
4737 .num_device_descs = 1,
4739 { "DiBcom NIM9090MD reference design",
4740 { &dib0700_usb_id_table[71], NULL },
4746 .rc_interval = DEFAULT_RC_INTERVAL,
4747 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4748 .module_name = "dib0700",
4749 .rc_query = dib0700_rc_query_old_firmware,
4750 .allowed_protos = RC_BIT_RC5 |
4753 .change_protocol = dib0700_change_protocol,
4755 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4761 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4762 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4763 .pid_filter_count = 32,
4764 .pid_filter = stk70x0p_pid_filter,
4765 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4766 .frontend_attach = nim7090_frontend_attach,
4767 .tuner_attach = nim7090_tuner_attach,
4769 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4772 sizeof(struct dib0700_adapter_state),
4776 .num_device_descs = 1,
4778 { "DiBcom NIM7090 reference design",
4779 { &dib0700_usb_id_table[72], NULL },
4785 .rc_interval = DEFAULT_RC_INTERVAL,
4786 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4787 .module_name = "dib0700",
4788 .rc_query = dib0700_rc_query_old_firmware,
4789 .allowed_protos = RC_BIT_RC5 |
4792 .change_protocol = dib0700_change_protocol,
4794 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4800 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4801 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4802 .pid_filter_count = 32,
4803 .pid_filter = stk70x0p_pid_filter,
4804 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4805 .frontend_attach = tfe7090pvr_frontend0_attach,
4806 .tuner_attach = tfe7090pvr_tuner0_attach,
4808 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4811 sizeof(struct dib0700_adapter_state),
4816 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4817 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4818 .pid_filter_count = 32,
4819 .pid_filter = stk70x0p_pid_filter,
4820 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4821 .frontend_attach = tfe7090pvr_frontend1_attach,
4822 .tuner_attach = tfe7090pvr_tuner1_attach,
4824 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4827 sizeof(struct dib0700_adapter_state),
4831 .num_device_descs = 1,
4833 { "DiBcom TFE7090PVR reference design",
4834 { &dib0700_usb_id_table[73], NULL },
4840 .rc_interval = DEFAULT_RC_INTERVAL,
4841 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4842 .module_name = "dib0700",
4843 .rc_query = dib0700_rc_query_old_firmware,
4844 .allowed_protos = RC_BIT_RC5 |
4847 .change_protocol = dib0700_change_protocol,
4849 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4855 .frontend_attach = pctv340e_frontend_attach,
4856 .tuner_attach = xc4000_tuner_attach,
4858 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4860 .size_of_priv = sizeof(struct
4861 dib0700_adapter_state),
4865 .num_device_descs = 2,
4867 { "Pinnacle PCTV 340e HD Pro USB Stick",
4868 { &dib0700_usb_id_table[76], NULL },
4871 { "Pinnacle PCTV Hybrid Stick Solo",
4872 { &dib0700_usb_id_table[77], NULL },
4877 .rc_interval = DEFAULT_RC_INTERVAL,
4878 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4879 .module_name = "dib0700",
4880 .rc_query = dib0700_rc_query_old_firmware,
4881 .allowed_protos = RC_BIT_RC5 |
4884 .change_protocol = dib0700_change_protocol,
4886 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4892 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4893 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4894 .pid_filter_count = 32,
4895 .pid_filter = stk70x0p_pid_filter,
4896 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4897 .frontend_attach = tfe7790p_frontend_attach,
4898 .tuner_attach = tfe7790p_tuner_attach,
4900 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4904 sizeof(struct dib0700_adapter_state),
4908 .num_device_descs = 1,
4910 { "DiBcom TFE7790P reference design",
4911 { &dib0700_usb_id_table[78], NULL },
4917 .rc_interval = DEFAULT_RC_INTERVAL,
4918 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4919 .module_name = "dib0700",
4920 .rc_query = dib0700_rc_query_old_firmware,
4921 .allowed_protos = RC_BIT_RC5 |
4924 .change_protocol = dib0700_change_protocol,
4926 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4932 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4933 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4934 .pid_filter_count = 32,
4935 .pid_filter = stk80xx_pid_filter,
4936 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4937 .frontend_attach = tfe8096p_frontend_attach,
4938 .tuner_attach = tfe8096p_tuner_attach,
4940 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4945 sizeof(struct dib0700_adapter_state),
4949 .num_device_descs = 1,
4951 { "DiBcom TFE8096P reference design",
4952 { &dib0700_usb_id_table[79], NULL },
4958 .rc_interval = DEFAULT_RC_INTERVAL,
4959 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4960 .module_name = "dib0700",
4961 .rc_query = dib0700_rc_query_old_firmware,
4962 .allowed_protos = RC_BIT_RC5 |
4965 .change_protocol = dib0700_change_protocol,
4970 int dib0700_device_count = ARRAY_SIZE(dib0700_devices);