1 /* Linux driver for devices based on the DiBcom DiB0700 USB bridge
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the Free
5 * Software Foundation, version 2.
7 * Copyright (C) 2005-9 DiBcom, SA et al
11 #include "dib3000mc.h"
18 #include "tuner-xc2028.h"
27 static int force_lna_activation
;
28 module_param(force_lna_activation
, int, 0644);
29 MODULE_PARM_DESC(force_lna_activation
, "force the activation of Low-Noise-Amplifyer(s) (LNA), "
30 "if applicable for the device (default: 0=automatic/off).");
32 struct dib0700_adapter_state
{
33 int (*set_param_save
) (struct dvb_frontend
*, struct dvb_frontend_parameters
*);
34 const struct firmware
*frontend_firmware
;
37 /* Hauppauge Nova-T 500 (aka Bristol)
38 * has a LNA on GPIO0 which is enabled by setting 1 */
39 static struct mt2060_config bristol_mt2060_config
[2] = {
49 static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config
= {
50 .band_caps
= BAND_VHF
| BAND_UHF
,
51 .setup
= (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
71 static struct dib3000mc_config bristol_dib3000mc_config
[2] = {
72 { .agc
= &bristol_dib3000p_mt2060_agc_config
,
74 .ln_adc_level
= 0x1cc7,
75 .output_mpeg2_in_188_bytes
= 1,
77 { .agc
= &bristol_dib3000p_mt2060_agc_config
,
79 .ln_adc_level
= 0x1cc7,
80 .output_mpeg2_in_188_bytes
= 1,
84 static int bristol_frontend_attach(struct dvb_usb_adapter
*adap
)
86 struct dib0700_state
*st
= adap
->dev
->priv
;
88 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0); msleep(10);
89 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1); msleep(10);
90 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0); msleep(10);
91 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1); msleep(10);
93 if (force_lna_activation
)
94 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
96 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 0);
98 if (dib3000mc_i2c_enumeration(&adap
->dev
->i2c_adap
, 2, DEFAULT_DIB3000P_I2C_ADDRESS
, bristol_dib3000mc_config
) != 0) {
99 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0); msleep(10);
103 st
->mt2060_if1
[adap
->id
] = 1220;
104 return (adap
->fe_adap
[0].fe
= dvb_attach(dib3000mc_attach
, &adap
->dev
->i2c_adap
,
105 (10 + adap
->id
) << 1, &bristol_dib3000mc_config
[adap
->id
])) == NULL
? -ENODEV
: 0;
108 static int eeprom_read(struct i2c_adapter
*adap
,u8 adrs
,u8
*pval
)
110 struct i2c_msg msg
[2] = {
111 { .addr
= 0x50, .flags
= 0, .buf
= &adrs
, .len
= 1 },
112 { .addr
= 0x50, .flags
= I2C_M_RD
, .buf
= pval
, .len
= 1 },
114 if (i2c_transfer(adap
, msg
, 2) != 2) return -EREMOTEIO
;
118 static int bristol_tuner_attach(struct dvb_usb_adapter
*adap
)
120 struct i2c_adapter
*prim_i2c
= &adap
->dev
->i2c_adap
;
121 struct i2c_adapter
*tun_i2c
= dib3000mc_get_tuner_i2c_master(adap
->fe_adap
[0].fe
, 1);
124 if (adap
->dev
->udev
->descriptor
.idVendor
== cpu_to_le16(USB_VID_HAUPPAUGE
) &&
125 adap
->dev
->udev
->descriptor
.idProduct
== cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2
)) {
126 if (!eeprom_read(prim_i2c
,0x59 + adap
->id
,&a
)) if1
=1220+a
;
128 return dvb_attach(mt2060_attach
, adap
->fe_adap
[0].fe
, tun_i2c
,
129 &bristol_mt2060_config
[adap
->id
], if1
) == NULL
?
133 /* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
136 static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config
[2] = {
140 /* 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,
141 * 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 */
142 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
143 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
178 BAND_VHF
| BAND_LBAND
,
180 /* 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,
181 * 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 */
182 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
183 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
220 static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config
= {
224 (3 << 14) | (1 << 12) | (524 << 0),
229 static struct dib7000p_config stk7700d_dib7000p_mt2266_config
[] = {
230 { .output_mpeg2_in_188_bytes
= 1,
231 .hostbus_diversity
= 1,
232 .tuner_is_baseband
= 1,
234 .agc_config_count
= 2,
235 .agc
= stk7700d_7000p_mt2266_agc_config
,
236 .bw
= &stk7700d_mt2266_pll_config
,
238 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
239 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
240 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
242 { .output_mpeg2_in_188_bytes
= 1,
243 .hostbus_diversity
= 1,
244 .tuner_is_baseband
= 1,
246 .agc_config_count
= 2,
247 .agc
= stk7700d_7000p_mt2266_agc_config
,
248 .bw
= &stk7700d_mt2266_pll_config
,
250 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
251 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
252 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
256 static struct mt2266_config stk7700d_mt2266_config
[2] = {
257 { .i2c_address
= 0x60
259 { .i2c_address
= 0x60
263 static int stk7700P2_frontend_attach(struct dvb_usb_adapter
*adap
)
266 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
268 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
269 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
270 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
271 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
273 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
275 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
276 stk7700d_dib7000p_mt2266_config
)
278 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__
);
283 adap
->fe_adap
[0].fe
=
284 dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
,
285 0x80 + (adap
->id
<< 1),
286 &stk7700d_dib7000p_mt2266_config
[adap
->id
]);
288 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
291 static int stk7700d_frontend_attach(struct dvb_usb_adapter
*adap
)
294 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
296 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
297 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
298 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
299 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
301 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
303 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
304 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 2, 18,
305 stk7700d_dib7000p_mt2266_config
)
307 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__
);
312 adap
->fe_adap
[0].fe
=
313 dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
,
314 0x80 + (adap
->id
<< 1),
315 &stk7700d_dib7000p_mt2266_config
[adap
->id
]);
317 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
320 static int stk7700d_tuner_attach(struct dvb_usb_adapter
*adap
)
322 struct i2c_adapter
*tun_i2c
;
323 tun_i2c
= dib7000p_get_i2c_master(adap
->fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_TUNER
, 1);
324 return dvb_attach(mt2266_attach
, adap
->fe_adap
[0].fe
, tun_i2c
,
325 &stk7700d_mt2266_config
[adap
->id
]) == NULL
? -ENODEV
: 0;
328 /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
329 static struct dibx000_agc_config xc3028_agc_config
= {
330 BAND_VHF
| BAND_UHF
, /* band_caps */
332 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
333 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
334 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
335 (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
336 (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */
339 21, /* time_stabiliz */
351 39718, /* agc2_max */
360 29, /* agc2_slope1 */
361 29, /* agc2_slope2 */
368 1, /* perform_agc_softsplit */
371 /* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
372 static struct dibx000_bandwidth_config xc3028_bw_config
= {
373 60000, 30000, /* internal, sampling */
374 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
375 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc,
377 (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
378 (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
380 30000000, /* xtal_hz */
383 static struct dib7000p_config stk7700ph_dib7700_xc3028_config
= {
384 .output_mpeg2_in_188_bytes
= 1,
385 .tuner_is_baseband
= 1,
387 .agc_config_count
= 1,
388 .agc
= &xc3028_agc_config
,
389 .bw
= &xc3028_bw_config
,
391 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
392 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
393 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
396 static int stk7700ph_xc3028_callback(void *ptr
, int component
,
397 int command
, int arg
)
399 struct dvb_usb_adapter
*adap
= ptr
;
402 case XC2028_TUNER_RESET
:
403 /* Send the tuner in then out of reset */
404 dib7000p_set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 0); msleep(10);
405 dib7000p_set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 1);
407 case XC2028_RESET_CLK
:
410 err("%s: unknown command %d, arg %d\n", __func__
,
417 static struct xc2028_ctrl stk7700ph_xc3028_ctrl
= {
418 .fname
= XC2028_DEFAULT_FIRMWARE
,
420 .demod
= XC3028_FE_DIBCOM52
,
423 static struct xc2028_config stk7700ph_xc3028_config
= {
425 .ctrl
= &stk7700ph_xc3028_ctrl
,
428 static int stk7700ph_frontend_attach(struct dvb_usb_adapter
*adap
)
430 struct usb_device_descriptor
*desc
= &adap
->dev
->udev
->descriptor
;
432 if (desc
->idVendor
== cpu_to_le16(USB_VID_PINNACLE
) &&
433 desc
->idProduct
== cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX
))
434 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
436 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
438 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
439 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
440 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
441 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
443 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
445 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
448 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
449 &stk7700ph_dib7700_xc3028_config
) != 0) {
450 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
455 adap
->fe_adap
[0].fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x80,
456 &stk7700ph_dib7700_xc3028_config
);
458 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
461 static int stk7700ph_tuner_attach(struct dvb_usb_adapter
*adap
)
463 struct i2c_adapter
*tun_i2c
;
465 tun_i2c
= dib7000p_get_i2c_master(adap
->fe_adap
[0].fe
,
466 DIBX000_I2C_INTERFACE_TUNER
, 1);
468 stk7700ph_xc3028_config
.i2c_adap
= tun_i2c
;
470 /* FIXME: generalize & move to common area */
471 adap
->fe_adap
[0].fe
->callback
= stk7700ph_xc3028_callback
;
473 return dvb_attach(xc2028_attach
, adap
->fe_adap
[0].fe
, &stk7700ph_xc3028_config
)
474 == NULL
? -ENODEV
: 0;
477 #define DEFAULT_RC_INTERVAL 50
479 static u8 rc_request
[] = { REQUEST_POLL_RC
, 0 };
481 /* Number of keypresses to ignore before start repeating */
482 #define RC_REPEAT_DELAY 6
485 * This function is used only when firmware is < 1.20 version. Newer
486 * firmwares use bulk mode, with functions implemented at dib0700_core,
487 * at dib0700_rc_urb_completion()
489 static int dib0700_rc_query_old_firmware(struct dvb_usb_device
*d
)
495 struct dib0700_state
*st
= d
->priv
;
497 if (st
->fw_version
>= 0x10200) {
498 /* For 1.20 firmware , We need to keep the RC polling
499 callback so we can reuse the input device setup in
500 dvb-usb-remote.c. However, the actual work is being done
501 in the bulk URB completion handler. */
505 i
= dib0700_ctrl_rd(d
, rc_request
, 2, key
, 4);
507 err("RC Query Failed");
511 /* losing half of KEY_0 events from Philipps rc5 remotes.. */
512 if (key
[0] == 0 && key
[1] == 0 && key
[2] == 0 && key
[3] == 0)
515 /* 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]); */
517 dib0700_rc_setup(d
); /* reset ir sensor data to prevent false events */
520 switch (d
->props
.rc
.core
.protocol
) {
522 /* NEC protocol sends repeat code as 0 0 0 FF */
523 if ((key
[3-2] == 0x00) && (key
[3-3] == 0x00) &&
525 keycode
= d
->last_event
;
527 keycode
= key
[3-2] << 8 | key
[3-3];
528 d
->last_event
= keycode
;
531 rc_keydown(d
->rc_dev
, keycode
, 0);
534 /* RC-5 protocol changes toggle bit on new keypress */
535 keycode
= key
[3-2] << 8 | key
[3-3];
537 rc_keydown(d
->rc_dev
, keycode
, toggle
);
544 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
545 static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config
= {
548 /* 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,
549 * 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 */
550 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
551 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
591 static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config
= {
594 /* 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,
595 * 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 */
596 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
597 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
637 static struct dibx000_bandwidth_config stk7700p_pll_config
= {
641 (3 << 14) | (1 << 12) | (524 << 0),
647 static struct dib7000m_config stk7700p_dib7000m_config
= {
649 .output_mpeg2_in_188_bytes
= 1,
652 .agc_config_count
= 1,
653 .agc
= &stk7700p_7000m_mt2060_agc_config
,
654 .bw
= &stk7700p_pll_config
,
656 .gpio_dir
= DIB7000M_GPIO_DEFAULT_DIRECTIONS
,
657 .gpio_val
= DIB7000M_GPIO_DEFAULT_VALUES
,
658 .gpio_pwm_pos
= DIB7000M_GPIO_DEFAULT_PWM_POS
,
661 static struct dib7000p_config stk7700p_dib7000p_config
= {
662 .output_mpeg2_in_188_bytes
= 1,
664 .agc_config_count
= 1,
665 .agc
= &stk7700p_7000p_mt2060_agc_config
,
666 .bw
= &stk7700p_pll_config
,
668 .gpio_dir
= DIB7000M_GPIO_DEFAULT_DIRECTIONS
,
669 .gpio_val
= DIB7000M_GPIO_DEFAULT_VALUES
,
670 .gpio_pwm_pos
= DIB7000M_GPIO_DEFAULT_PWM_POS
,
673 static int stk7700p_frontend_attach(struct dvb_usb_adapter
*adap
)
675 struct dib0700_state
*st
= adap
->dev
->priv
;
676 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
678 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
679 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0); msleep(50);
681 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1); msleep(10);
682 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
684 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0); msleep(10);
685 dib0700_ctrl_clock(adap
->dev
, 72, 1);
686 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1); msleep(100);
688 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
690 st
->mt2060_if1
[0] = 1220;
692 if (dib7000pc_detection(&adap
->dev
->i2c_adap
)) {
693 adap
->fe_adap
[0].fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 18, &stk7700p_dib7000p_config
);
694 st
->is_dib7000pc
= 1;
696 adap
->fe_adap
[0].fe
= dvb_attach(dib7000m_attach
, &adap
->dev
->i2c_adap
, 18, &stk7700p_dib7000m_config
);
698 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
701 static struct mt2060_config stk7700p_mt2060_config
= {
705 static int stk7700p_tuner_attach(struct dvb_usb_adapter
*adap
)
707 struct i2c_adapter
*prim_i2c
= &adap
->dev
->i2c_adap
;
708 struct dib0700_state
*st
= adap
->dev
->priv
;
709 struct i2c_adapter
*tun_i2c
;
712 if (adap
->dev
->udev
->descriptor
.idVendor
== cpu_to_le16(USB_VID_HAUPPAUGE
) &&
713 adap
->dev
->udev
->descriptor
.idProduct
== cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK
)) {
714 if (!eeprom_read(prim_i2c
,0x58,&a
)) if1
=1220+a
;
716 if (st
->is_dib7000pc
)
717 tun_i2c
= dib7000p_get_i2c_master(adap
->fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_TUNER
, 1);
719 tun_i2c
= dib7000m_get_i2c_master(adap
->fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_TUNER
, 1);
721 return dvb_attach(mt2060_attach
, adap
->fe_adap
[0].fe
, tun_i2c
, &stk7700p_mt2060_config
,
722 if1
) == NULL
? -ENODEV
: 0;
725 /* DIB7070 generic */
726 static struct dibx000_agc_config dib7070_agc_config
= {
727 BAND_UHF
| BAND_VHF
| BAND_LBAND
| BAND_SBAND
,
728 /* 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,
729 * 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 */
730 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
731 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
768 static int dib7070_tuner_reset(struct dvb_frontend
*fe
, int onoff
)
770 deb_info("reset: %d", onoff
);
771 return dib7000p_set_gpio(fe
, 8, 0, !onoff
);
774 static int dib7070_tuner_sleep(struct dvb_frontend
*fe
, int onoff
)
776 deb_info("sleep: %d", onoff
);
777 return dib7000p_set_gpio(fe
, 9, 0, onoff
);
780 static struct dib0070_config dib7070p_dib0070_config
[2] = {
782 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
783 .reset
= dib7070_tuner_reset
,
784 .sleep
= dib7070_tuner_sleep
,
786 .clock_pad_drive
= 4,
789 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
790 .reset
= dib7070_tuner_reset
,
791 .sleep
= dib7070_tuner_sleep
,
797 static struct dib0070_config dib7770p_dib0070_config
= {
798 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
799 .reset
= dib7070_tuner_reset
,
800 .sleep
= dib7070_tuner_sleep
,
802 .clock_pad_drive
= 0,
807 static int dib7070_set_param_override(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*fep
)
809 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
810 struct dib0700_adapter_state
*state
= adap
->priv
;
813 u8 band
= BAND_OF_FREQUENCY(fep
->frequency
/1000);
815 case BAND_VHF
: offset
= 950; break;
817 default: offset
= 550; break;
819 deb_info("WBD for DiB7000P: %d\n", offset
+ dib0070_wbd_offset(fe
));
820 dib7000p_set_wbd_ref(fe
, offset
+ dib0070_wbd_offset(fe
));
821 return state
->set_param_save(fe
, fep
);
824 static int dib7770_set_param_override(struct dvb_frontend
*fe
,
825 struct dvb_frontend_parameters
*fep
)
827 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
828 struct dib0700_adapter_state
*state
= adap
->priv
;
831 u8 band
= BAND_OF_FREQUENCY(fep
->frequency
/1000);
834 dib7000p_set_gpio(fe
, 0, 0, 1);
839 dib7000p_set_gpio(fe
, 0, 0, 0);
843 deb_info("WBD for DiB7000P: %d\n", offset
+ dib0070_wbd_offset(fe
));
844 dib7000p_set_wbd_ref(fe
, offset
+ dib0070_wbd_offset(fe
));
845 return state
->set_param_save(fe
, fep
);
848 static int dib7770p_tuner_attach(struct dvb_usb_adapter
*adap
)
850 struct dib0700_adapter_state
*st
= adap
->priv
;
851 struct i2c_adapter
*tun_i2c
= dib7000p_get_i2c_master(adap
->fe_adap
[0].fe
,
852 DIBX000_I2C_INTERFACE_TUNER
, 1);
854 if (dvb_attach(dib0070_attach
, adap
->fe_adap
[0].fe
, tun_i2c
,
855 &dib7770p_dib0070_config
) == NULL
)
858 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
859 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib7770_set_param_override
;
863 static int dib7070p_tuner_attach(struct dvb_usb_adapter
*adap
)
865 struct dib0700_adapter_state
*st
= adap
->priv
;
866 struct i2c_adapter
*tun_i2c
= dib7000p_get_i2c_master(adap
->fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_TUNER
, 1);
869 if (dvb_attach(dib0070_attach
, adap
->fe_adap
[0].fe
, tun_i2c
, &dib7070p_dib0070_config
[0]) == NULL
)
872 if (dvb_attach(dib0070_attach
, adap
->fe_adap
[0].fe
, tun_i2c
, &dib7070p_dib0070_config
[1]) == NULL
)
876 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
877 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib7070_set_param_override
;
881 static int stk7700p_pid_filter(struct dvb_usb_adapter
*adapter
, int index
,
884 struct dib0700_state
*st
= adapter
->dev
->priv
;
885 if (st
->is_dib7000pc
)
886 return dib7000p_pid_filter(adapter
->fe_adap
[0].fe
, index
, pid
, onoff
);
887 return dib7000m_pid_filter(adapter
->fe_adap
[0].fe
, index
, pid
, onoff
);
890 static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter
*adapter
, int onoff
)
892 struct dib0700_state
*st
= adapter
->dev
->priv
;
893 if (st
->is_dib7000pc
)
894 return dib7000p_pid_filter_ctrl(adapter
->fe_adap
[0].fe
, onoff
);
895 return dib7000m_pid_filter_ctrl(adapter
->fe_adap
[0].fe
, onoff
);
898 static int stk70x0p_pid_filter(struct dvb_usb_adapter
*adapter
, int index
, u16 pid
, int onoff
)
900 return dib7000p_pid_filter(adapter
->fe_adap
[0].fe
, index
, pid
, onoff
);
903 static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter
*adapter
, int onoff
)
905 return dib7000p_pid_filter_ctrl(adapter
->fe_adap
[0].fe
, onoff
);
908 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz
= {
912 (3 << 14) | (1 << 12) | (524 << 0),
918 static struct dib7000p_config dib7070p_dib7000p_config
= {
919 .output_mpeg2_in_188_bytes
= 1,
921 .agc_config_count
= 1,
922 .agc
= &dib7070_agc_config
,
923 .bw
= &dib7070_bw_config_12_mhz
,
924 .tuner_is_baseband
= 1,
927 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
928 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
929 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
931 .hostbus_diversity
= 1,
935 static int stk7070p_frontend_attach(struct dvb_usb_adapter
*adap
)
937 struct usb_device_descriptor
*p
= &adap
->dev
->udev
->descriptor
;
938 if (p
->idVendor
== cpu_to_le16(USB_VID_PINNACLE
) &&
939 p
->idProduct
== cpu_to_le16(USB_PID_PINNACLE_PCTV72E
))
940 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
942 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
944 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
945 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
946 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
947 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
949 dib0700_ctrl_clock(adap
->dev
, 72, 1);
952 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
954 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
956 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
957 &dib7070p_dib7000p_config
) != 0) {
958 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
963 adap
->fe_adap
[0].fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x80,
964 &dib7070p_dib7000p_config
);
965 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
969 static struct dib7000p_config dib7770p_dib7000p_config
= {
970 .output_mpeg2_in_188_bytes
= 1,
972 .agc_config_count
= 1,
973 .agc
= &dib7070_agc_config
,
974 .bw
= &dib7070_bw_config_12_mhz
,
975 .tuner_is_baseband
= 1,
978 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
979 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
980 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
982 .hostbus_diversity
= 1,
983 .enable_current_mirror
= 1,
984 .disable_sample_and_hold
= 0,
987 static int stk7770p_frontend_attach(struct dvb_usb_adapter
*adap
)
989 struct usb_device_descriptor
*p
= &adap
->dev
->udev
->descriptor
;
990 if (p
->idVendor
== cpu_to_le16(USB_VID_PINNACLE
) &&
991 p
->idProduct
== cpu_to_le16(USB_PID_PINNACLE_PCTV72E
))
992 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
994 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
996 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
997 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
998 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
999 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1001 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1004 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1006 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1008 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
1009 &dib7770p_dib7000p_config
) != 0) {
1010 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1015 adap
->fe_adap
[0].fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x80,
1016 &dib7770p_dib7000p_config
);
1017 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
1020 /* DIB807x generic */
1021 static struct dibx000_agc_config dib807x_agc_config
[2] = {
1024 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1025 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1026 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1027 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1029 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1030 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1031 (0 << 0), /* setup*/
1034 10, /* time_stabiliz*/
1044 65535, /* agc1_max*/
1047 65535, /* agc2_max*/
1053 206, /* agc1_slope1*/
1054 255, /* agc1_slope2*/
1057 88, /* agc2_slope1*/
1058 90, /* agc2_slope2*/
1065 0, /* perform_agc_softsplit*/
1068 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1069 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1070 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1071 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1073 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1074 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1075 (0 << 0), /* setup */
1078 10, /* time_stabiliz*/
1088 65535, /* agc1_max*/
1091 65535, /* agc2_max*/
1097 206, /* agc1_slope1*/
1098 255, /* agc1_slope2*/
1101 88, /* agc2_slope1*/
1102 90, /* agc2_slope2*/
1109 0, /* perform_agc_softsplit*/
1113 static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz
= {
1114 60000, 15000, /* internal, sampling*/
1115 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/
1116 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
1118 (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1119 (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1121 12000000, /* xtal_hz*/
1124 static struct dib8000_config dib807x_dib8000_config
[2] = {
1126 .output_mpeg2_in_188_bytes
= 1,
1128 .agc_config_count
= 2,
1129 .agc
= dib807x_agc_config
,
1130 .pll
= &dib807x_bw_config_12_mhz
,
1131 .tuner_is_baseband
= 1,
1133 .gpio_dir
= DIB8000_GPIO_DEFAULT_DIRECTIONS
,
1134 .gpio_val
= DIB8000_GPIO_DEFAULT_VALUES
,
1135 .gpio_pwm_pos
= DIB8000_GPIO_DEFAULT_PWM_POS
,
1137 .hostbus_diversity
= 1,
1139 .agc_control
= &dib0070_ctrl_agc_filter
,
1140 .output_mode
= OUTMODE_MPEG2_FIFO
,
1143 .output_mpeg2_in_188_bytes
= 1,
1145 .agc_config_count
= 2,
1146 .agc
= dib807x_agc_config
,
1147 .pll
= &dib807x_bw_config_12_mhz
,
1148 .tuner_is_baseband
= 1,
1150 .gpio_dir
= DIB8000_GPIO_DEFAULT_DIRECTIONS
,
1151 .gpio_val
= DIB8000_GPIO_DEFAULT_VALUES
,
1152 .gpio_pwm_pos
= DIB8000_GPIO_DEFAULT_PWM_POS
,
1154 .hostbus_diversity
= 1,
1155 .agc_control
= &dib0070_ctrl_agc_filter
,
1156 .output_mode
= OUTMODE_MPEG2_FIFO
,
1161 static int dib80xx_tuner_reset(struct dvb_frontend
*fe
, int onoff
)
1163 return dib8000_set_gpio(fe
, 5, 0, !onoff
);
1166 static int dib80xx_tuner_sleep(struct dvb_frontend
*fe
, int onoff
)
1168 return dib8000_set_gpio(fe
, 0, 0, onoff
);
1171 static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg
[] = {
1176 static struct dib0070_config dib807x_dib0070_config
[2] = {
1178 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
1179 .reset
= dib80xx_tuner_reset
,
1180 .sleep
= dib80xx_tuner_sleep
,
1182 .clock_pad_drive
= 4,
1184 .force_crystal_mode
= 1,
1185 .enable_third_order_filter
= 1,
1187 .wbd_gain
= dib8070_wbd_gain_cfg
,
1188 .osc_buffer_state
= 0,
1189 .freq_offset_khz_uhf
= -100,
1190 .freq_offset_khz_vhf
= -100,
1192 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
1193 .reset
= dib80xx_tuner_reset
,
1194 .sleep
= dib80xx_tuner_sleep
,
1196 .clock_pad_drive
= 2,
1198 .force_crystal_mode
= 1,
1199 .enable_third_order_filter
= 1,
1201 .wbd_gain
= dib8070_wbd_gain_cfg
,
1202 .osc_buffer_state
= 0,
1203 .freq_offset_khz_uhf
= -25,
1204 .freq_offset_khz_vhf
= -25,
1208 static int dib807x_set_param_override(struct dvb_frontend
*fe
,
1209 struct dvb_frontend_parameters
*fep
)
1211 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
1212 struct dib0700_adapter_state
*state
= adap
->priv
;
1214 u16 offset
= dib0070_wbd_offset(fe
);
1215 u8 band
= BAND_OF_FREQUENCY(fep
->frequency
/1000);
1220 case BAND_UHF
: /* fall-thru wanted */
1222 offset
+= 250; break;
1224 deb_info("WBD for DiB8000: %d\n", offset
);
1225 dib8000_set_wbd_ref(fe
, offset
);
1227 return state
->set_param_save(fe
, fep
);
1230 static int dib807x_tuner_attach(struct dvb_usb_adapter
*adap
)
1232 struct dib0700_adapter_state
*st
= adap
->priv
;
1233 struct i2c_adapter
*tun_i2c
= dib8000_get_i2c_master(adap
->fe_adap
[0].fe
,
1234 DIBX000_I2C_INTERFACE_TUNER
, 1);
1236 if (adap
->id
== 0) {
1237 if (dvb_attach(dib0070_attach
, adap
->fe_adap
[0].fe
, tun_i2c
,
1238 &dib807x_dib0070_config
[0]) == NULL
)
1241 if (dvb_attach(dib0070_attach
, adap
->fe_adap
[0].fe
, tun_i2c
,
1242 &dib807x_dib0070_config
[1]) == NULL
)
1246 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
1247 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib807x_set_param_override
;
1251 static int stk80xx_pid_filter(struct dvb_usb_adapter
*adapter
, int index
,
1254 return dib8000_pid_filter(adapter
->fe_adap
[0].fe
, index
, pid
, onoff
);
1257 static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter
*adapter
,
1260 return dib8000_pid_filter_ctrl(adapter
->fe_adap
[0].fe
, onoff
);
1264 static int stk807x_frontend_attach(struct dvb_usb_adapter
*adap
)
1266 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
1268 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
1269 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
1270 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1272 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1274 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1277 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1279 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1281 dib8000_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
1284 adap
->fe_adap
[0].fe
= dvb_attach(dib8000_attach
, &adap
->dev
->i2c_adap
, 0x80,
1285 &dib807x_dib8000_config
[0]);
1287 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
1291 static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter
*adap
)
1293 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
1295 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
1297 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
1298 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
1299 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1301 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1303 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1306 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1308 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1310 /* initialize IC 0 */
1311 dib8000_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x22, 0x80);
1313 adap
->fe_adap
[0].fe
= dvb_attach(dib8000_attach
, &adap
->dev
->i2c_adap
, 0x80,
1314 &dib807x_dib8000_config
[0]);
1316 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
1319 static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter
*adap
)
1321 /* initialize IC 1 */
1322 dib8000_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x12, 0x82);
1324 adap
->fe_adap
[0].fe
= dvb_attach(dib8000_attach
, &adap
->dev
->i2c_adap
, 0x82,
1325 &dib807x_dib8000_config
[1]);
1327 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
1331 static struct dibx000_agc_config dib8090_agc_config
[2] = {
1333 BAND_UHF
| BAND_VHF
| BAND_LBAND
| BAND_SBAND
,
1334 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1335 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1336 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1337 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1338 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1376 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1377 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1378 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1379 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1380 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1418 static struct dibx000_bandwidth_config dib8090_pll_config_12mhz
= {
1422 (3 << 14) | (1 << 12) | (599 << 0),
1428 static int dib8090_get_adc_power(struct dvb_frontend
*fe
)
1430 return dib8000_get_adc_power(fe
, 1);
1433 static struct dib8000_config dib809x_dib8000_config
[2] = {
1435 .output_mpeg2_in_188_bytes
= 1,
1437 .agc_config_count
= 2,
1438 .agc
= dib8090_agc_config
,
1439 .agc_control
= dib0090_dcc_freq
,
1440 .pll
= &dib8090_pll_config_12mhz
,
1441 .tuner_is_baseband
= 1,
1443 .gpio_dir
= DIB8000_GPIO_DEFAULT_DIRECTIONS
,
1444 .gpio_val
= DIB8000_GPIO_DEFAULT_VALUES
,
1445 .gpio_pwm_pos
= DIB8000_GPIO_DEFAULT_PWM_POS
,
1447 .hostbus_diversity
= 1,
1449 .output_mode
= OUTMODE_MPEG2_FIFO
,
1451 .diversity_delay
= 48,
1454 .output_mpeg2_in_188_bytes
= 1,
1456 .agc_config_count
= 2,
1457 .agc
= dib8090_agc_config
,
1458 .agc_control
= dib0090_dcc_freq
,
1459 .pll
= &dib8090_pll_config_12mhz
,
1460 .tuner_is_baseband
= 1,
1462 .gpio_dir
= DIB8000_GPIO_DEFAULT_DIRECTIONS
,
1463 .gpio_val
= DIB8000_GPIO_DEFAULT_VALUES
,
1464 .gpio_pwm_pos
= DIB8000_GPIO_DEFAULT_PWM_POS
,
1466 .hostbus_diversity
= 1,
1468 .output_mode
= OUTMODE_DIVERSITY
,
1470 .diversity_delay
= 1,
1475 static struct dib0090_wbd_slope dib8090_wbd_table
[] = {
1476 /* max freq ; cold slope ; cold offset ; warm slope ; warm offset ; wbd gain */
1477 { 120, 0, 500, 0, 500, 4 }, /* CBAND */
1478 { 170, 0, 450, 0, 450, 4 }, /* CBAND */
1479 { 380, 48, 373, 28, 259, 6 }, /* VHF */
1480 { 860, 34, 700, 36, 616, 6 }, /* high UHF */
1481 { 0xFFFF, 34, 700, 36, 616, 6 }, /* default */
1484 static struct dib0090_config dib809x_dib0090_config
= {
1488 .io
.pll_loopdiv
= 20,
1489 .io
.adc_clock_ratio
= 8,
1490 .io
.pll_int_loop_filt
= 0,
1491 .io
.clock_khz
= 12000,
1492 .reset
= dib80xx_tuner_reset
,
1493 .sleep
= dib80xx_tuner_sleep
,
1496 .i2c_address
= DEFAULT_DIB0090_I2C_ADDRESS
,
1499 .get_adc_power
= dib8090_get_adc_power
,
1500 .freq_offset_khz_uhf
= -63,
1501 .freq_offset_khz_vhf
= -143,
1502 .wbd
= dib8090_wbd_table
,
1503 .fref_clock_ratio
= 6,
1506 static int dib8096_set_param_override(struct dvb_frontend
*fe
,
1507 struct dvb_frontend_parameters
*fep
)
1509 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
1510 struct dib0700_adapter_state
*state
= adap
->priv
;
1511 u8 band
= BAND_OF_FREQUENCY(fep
->frequency
/1000);
1514 enum frontend_tune_state tune_state
= CT_SHUTDOWN
;
1515 u16 ltgain
, rf_gain_limit
;
1517 ret
= state
->set_param_save(fe
, fep
);
1521 target
= (dib0090_get_wbd_target(fe
) * 8 * 18 / 33 + 1) / 2;
1522 dib8000_set_wbd_ref(fe
, target
);
1525 if (band
== BAND_CBAND
) {
1526 deb_info("tuning in CBAND - soft-AGC startup\n");
1527 dib0090_set_tune_state(fe
, CT_AGC_START
);
1529 ret
= dib0090_gain_control(fe
);
1531 tune_state
= dib0090_get_tune_state(fe
);
1532 if (tune_state
== CT_AGC_STEP_0
)
1533 dib8000_set_gpio(fe
, 6, 0, 1);
1534 else if (tune_state
== CT_AGC_STEP_1
) {
1535 dib0090_get_current_gain(fe
, NULL
, NULL
, &rf_gain_limit
, <gain
);
1536 if (rf_gain_limit
== 0)
1537 dib8000_set_gpio(fe
, 6, 0, 0);
1539 } while (tune_state
< CT_AGC_STOP
);
1540 dib0090_pwm_gain_reset(fe
);
1541 dib8000_pwm_agc_reset(fe
);
1542 dib8000_set_tune_state(fe
, CT_DEMOD_START
);
1544 deb_info("not tuning in CBAND - standard AGC startup\n");
1545 dib0090_pwm_gain_reset(fe
);
1551 static int dib809x_tuner_attach(struct dvb_usb_adapter
*adap
)
1553 struct dib0700_adapter_state
*st
= adap
->priv
;
1554 struct i2c_adapter
*tun_i2c
= dib8000_get_i2c_master(adap
->fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_TUNER
, 1);
1556 if (dvb_attach(dib0090_register
, adap
->fe_adap
[0].fe
, tun_i2c
, &dib809x_dib0090_config
) == NULL
)
1559 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
1560 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib8096_set_param_override
;
1564 static int stk809x_frontend_attach(struct dvb_usb_adapter
*adap
)
1566 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
1568 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
1569 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
1570 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1572 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1574 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1577 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1579 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1581 dib8000_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18, 0x80);
1583 adap
->fe_adap
[0].fe
= dvb_attach(dib8000_attach
, &adap
->dev
->i2c_adap
, 0x80, &dib809x_dib8000_config
[0]);
1585 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
1588 static int nim8096md_tuner_attach(struct dvb_usb_adapter
*adap
)
1590 struct dib0700_adapter_state
*st
= adap
->priv
;
1591 struct i2c_adapter
*tun_i2c
;
1592 struct dvb_frontend
*fe_slave
= dib8000_get_slave_frontend(adap
->fe_adap
[0].fe
, 1);
1595 tun_i2c
= dib8000_get_i2c_master(fe_slave
, DIBX000_I2C_INTERFACE_TUNER
, 1);
1596 if (dvb_attach(dib0090_register
, fe_slave
, tun_i2c
, &dib809x_dib0090_config
) == NULL
)
1598 fe_slave
->dvb
= adap
->fe_adap
[0].fe
->dvb
;
1599 fe_slave
->ops
.tuner_ops
.set_params
= dib8096_set_param_override
;
1601 tun_i2c
= dib8000_get_i2c_master(adap
->fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_TUNER
, 1);
1602 if (dvb_attach(dib0090_register
, adap
->fe_adap
[0].fe
, tun_i2c
, &dib809x_dib0090_config
) == NULL
)
1605 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
1606 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib8096_set_param_override
;
1611 static int nim8096md_frontend_attach(struct dvb_usb_adapter
*adap
)
1613 struct dvb_frontend
*fe_slave
;
1615 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
1617 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
1619 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
1620 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
1621 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1623 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1625 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1628 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1630 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1632 dib8000_i2c_enumeration(&adap
->dev
->i2c_adap
, 2, 18, 0x80);
1634 adap
->fe_adap
[0].fe
= dvb_attach(dib8000_attach
, &adap
->dev
->i2c_adap
, 0x80, &dib809x_dib8000_config
[0]);
1635 if (adap
->fe_adap
[0].fe
== NULL
)
1638 fe_slave
= dvb_attach(dib8000_attach
, &adap
->dev
->i2c_adap
, 0x82, &dib809x_dib8000_config
[1]);
1639 dib8000_set_slave_frontend(adap
->fe_adap
[0].fe
, fe_slave
);
1641 return fe_slave
== NULL
? -ENODEV
: 0;
1645 static int dib90x0_pid_filter(struct dvb_usb_adapter
*adapter
, int index
, u16 pid
, int onoff
)
1647 return dib9000_fw_pid_filter(adapter
->fe_adap
[0].fe
, index
, pid
, onoff
);
1650 static int dib90x0_pid_filter_ctrl(struct dvb_usb_adapter
*adapter
, int onoff
)
1652 return dib9000_fw_pid_filter_ctrl(adapter
->fe_adap
[0].fe
, onoff
);
1655 static int dib90x0_tuner_reset(struct dvb_frontend
*fe
, int onoff
)
1657 return dib9000_set_gpio(fe
, 5, 0, !onoff
);
1660 static int dib90x0_tuner_sleep(struct dvb_frontend
*fe
, int onoff
)
1662 return dib9000_set_gpio(fe
, 0, 0, onoff
);
1665 static int dib01x0_pmu_update(struct i2c_adapter
*i2c
, u16
*data
, u8 len
)
1667 u8 wb
[4] = { 0xc >> 8, 0xc & 0xff, 0, 0 };
1669 struct i2c_msg msg
[2] = {
1670 {.addr
= 0x1e >> 1, .flags
= 0, .buf
= wb
, .len
= 2},
1671 {.addr
= 0x1e >> 1, .flags
= I2C_M_RD
, .buf
= rb
, .len
= 2},
1675 dibx000_i2c_set_speed(i2c
, 250);
1677 if (i2c_transfer(i2c
, msg
, 2) != 2)
1680 switch (rb
[0] << 8 | rb
[1]) {
1682 deb_info("Found DiB0170 rev1: This version of DiB0170 is not supported any longer.\n");
1685 deb_info("Found DiB0170 rev2");
1688 deb_info("Found DiB0190 rev2");
1691 deb_info("DiB01x0 not found");
1695 for (index_data
= 0; index_data
< len
; index_data
+= 2) {
1696 wb
[2] = (data
[index_data
+ 1] >> 8) & 0xff;
1697 wb
[3] = (data
[index_data
+ 1]) & 0xff;
1699 if (data
[index_data
] == 0) {
1700 wb
[0] = (data
[index_data
] >> 8) & 0xff;
1701 wb
[1] = (data
[index_data
]) & 0xff;
1703 if (i2c_transfer(i2c
, msg
, 2) != 2)
1706 wb
[3] |= rb
[1] & ~(3 << 4);
1709 wb
[0] = (data
[index_data
] >> 8)&0xff;
1710 wb
[1] = (data
[index_data
])&0xff;
1712 if (i2c_transfer(i2c
, &msg
[0], 1) != 1)
1718 static struct dib9000_config stk9090m_config
= {
1719 .output_mpeg2_in_188_bytes
= 1,
1720 .output_mode
= OUTMODE_MPEG2_FIFO
,
1721 .vcxo_timer
= 279620,
1722 .timing_frequency
= 20452225,
1723 .demod_clock_khz
= 60000,
1724 .xtal_clock_khz
= 30000,
1725 .if_drives
= (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
1729 { 240, { BOARD_GPIO_COMPONENT_DEMOD
, BOARD_GPIO_FUNCTION_SUBBAND_GPIO
, 0x0008, 0x0000, 0x0008 } }, /* GPIO 3 to 1 for VHF */
1730 { 890, { BOARD_GPIO_COMPONENT_DEMOD
, BOARD_GPIO_FUNCTION_SUBBAND_GPIO
, 0x0008, 0x0000, 0x0000 } }, /* GPIO 3 to 0 for UHF */
1735 { .component
= BOARD_GPIO_COMPONENT_DEMOD
, .function
= BOARD_GPIO_FUNCTION_COMPONENT_ON
, .mask
= 0x10 | 0x21, .direction
= 0 & ~0x21, .value
= (0x10 & ~0x1) | 0x20 },
1736 { .component
= BOARD_GPIO_COMPONENT_DEMOD
, .function
= BOARD_GPIO_FUNCTION_COMPONENT_OFF
, .mask
= 0x10 | 0x21, .direction
= 0 & ~0x21, .value
= 0 | 0x21 },
1740 static struct dib9000_config nim9090md_config
[2] = {
1742 .output_mpeg2_in_188_bytes
= 1,
1743 .output_mode
= OUTMODE_MPEG2_FIFO
,
1744 .vcxo_timer
= 279620,
1745 .timing_frequency
= 20452225,
1746 .demod_clock_khz
= 60000,
1747 .xtal_clock_khz
= 30000,
1748 .if_drives
= (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
1750 .output_mpeg2_in_188_bytes
= 1,
1751 .output_mode
= OUTMODE_DIVERSITY
,
1752 .vcxo_timer
= 279620,
1753 .timing_frequency
= 20452225,
1754 .demod_clock_khz
= 60000,
1755 .xtal_clock_khz
= 30000,
1756 .if_drives
= (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
1760 { 240, { BOARD_GPIO_COMPONENT_DEMOD
, BOARD_GPIO_FUNCTION_SUBBAND_GPIO
, 0x0006, 0x0000, 0x0006 } }, /* GPIO 1 and 2 to 1 for VHF */
1761 { 890, { BOARD_GPIO_COMPONENT_DEMOD
, BOARD_GPIO_FUNCTION_SUBBAND_GPIO
, 0x0006, 0x0000, 0x0000 } }, /* GPIO 1 and 2 to 0 for UHF */
1766 { .component
= BOARD_GPIO_COMPONENT_DEMOD
, .function
= BOARD_GPIO_FUNCTION_COMPONENT_ON
, .mask
= 0x10 | 0x21, .direction
= 0 & ~0x21, .value
= (0x10 & ~0x1) | 0x20 },
1767 { .component
= BOARD_GPIO_COMPONENT_DEMOD
, .function
= BOARD_GPIO_FUNCTION_COMPONENT_OFF
, .mask
= 0x10 | 0x21, .direction
= 0 & ~0x21, .value
= 0 | 0x21 },
1772 static struct dib0090_config dib9090_dib0090_config
= {
1776 .io
.pll_loopdiv
= 8,
1777 .io
.adc_clock_ratio
= 8,
1778 .io
.pll_int_loop_filt
= 0,
1779 .io
.clock_khz
= 30000,
1780 .reset
= dib90x0_tuner_reset
,
1781 .sleep
= dib90x0_tuner_sleep
,
1786 .freq_offset_khz_uhf
= 0,
1787 .freq_offset_khz_vhf
= 0,
1790 static struct dib0090_config nim9090md_dib0090_config
[2] = {
1795 .io
.pll_loopdiv
= 8,
1796 .io
.adc_clock_ratio
= 8,
1797 .io
.pll_int_loop_filt
= 0,
1798 .io
.clock_khz
= 30000,
1799 .reset
= dib90x0_tuner_reset
,
1800 .sleep
= dib90x0_tuner_sleep
,
1805 .freq_offset_khz_uhf
= 0,
1806 .freq_offset_khz_vhf
= 0,
1811 .io
.pll_loopdiv
= 8,
1812 .io
.adc_clock_ratio
= 8,
1813 .io
.pll_int_loop_filt
= 0,
1814 .io
.clock_khz
= 30000,
1815 .reset
= dib90x0_tuner_reset
,
1816 .sleep
= dib90x0_tuner_sleep
,
1821 .freq_offset_khz_uhf
= 0,
1822 .freq_offset_khz_vhf
= 0,
1827 static int stk9090m_frontend_attach(struct dvb_usb_adapter
*adap
)
1829 struct dib0700_adapter_state
*state
= adap
->priv
;
1830 struct dib0700_state
*st
= adap
->dev
->priv
;
1833 /* Make use of the new i2c functions from FW 1.20 */
1834 dib0700_get_version(adap
->dev
, NULL
, NULL
, &fw_version
, NULL
);
1835 if (fw_version
>= 0x10200)
1836 st
->fw_use_new_i2c_api
= 1;
1837 dib0700_set_i2c_speed(adap
->dev
, 340);
1839 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
1841 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
1842 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
1843 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1844 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1846 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1849 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1851 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1853 dib9000_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x10, 0x80);
1855 if (request_firmware(&state
->frontend_firmware
, "dib9090.fw", &adap
->dev
->udev
->dev
)) {
1856 deb_info("%s: Upload failed. (file not found?)\n", __func__
);
1859 deb_info("%s: firmware read %Zu bytes.\n", __func__
, state
->frontend_firmware
->size
);
1861 stk9090m_config
.microcode_B_fe_size
= state
->frontend_firmware
->size
;
1862 stk9090m_config
.microcode_B_fe_buffer
= state
->frontend_firmware
->data
;
1864 adap
->fe_adap
[0].fe
= dvb_attach(dib9000_attach
, &adap
->dev
->i2c_adap
, 0x80, &stk9090m_config
);
1866 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
1869 static int dib9090_tuner_attach(struct dvb_usb_adapter
*adap
)
1871 struct dib0700_adapter_state
*state
= adap
->priv
;
1872 struct i2c_adapter
*i2c
= dib9000_get_tuner_interface(adap
->fe_adap
[0].fe
);
1873 u16 data_dib190
[10] = {
1881 if (dvb_attach(dib0090_fw_register
, adap
->fe_adap
[0].fe
, i2c
, &dib9090_dib0090_config
) == NULL
)
1883 i2c
= dib9000_get_i2c_master(adap
->fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_GPIO_1_2
, 0);
1884 if (dib01x0_pmu_update(i2c
, data_dib190
, 10) != 0)
1886 dib0700_set_i2c_speed(adap
->dev
, 2000);
1887 if (dib9000_firmware_post_pll_init(adap
->fe_adap
[0].fe
) < 0)
1889 release_firmware(state
->frontend_firmware
);
1893 static int nim9090md_frontend_attach(struct dvb_usb_adapter
*adap
)
1895 struct dib0700_adapter_state
*state
= adap
->priv
;
1896 struct dib0700_state
*st
= adap
->dev
->priv
;
1897 struct i2c_adapter
*i2c
;
1898 struct dvb_frontend
*fe_slave
;
1901 /* Make use of the new i2c functions from FW 1.20 */
1902 dib0700_get_version(adap
->dev
, NULL
, NULL
, &fw_version
, NULL
);
1903 if (fw_version
>= 0x10200)
1904 st
->fw_use_new_i2c_api
= 1;
1905 dib0700_set_i2c_speed(adap
->dev
, 340);
1907 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
1909 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
1910 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
1911 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1912 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1914 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1917 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1919 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1921 if (request_firmware(&state
->frontend_firmware
, "dib9090.fw", &adap
->dev
->udev
->dev
)) {
1922 deb_info("%s: Upload failed. (file not found?)\n", __func__
);
1925 deb_info("%s: firmware read %Zu bytes.\n", __func__
, state
->frontend_firmware
->size
);
1927 nim9090md_config
[0].microcode_B_fe_size
= state
->frontend_firmware
->size
;
1928 nim9090md_config
[0].microcode_B_fe_buffer
= state
->frontend_firmware
->data
;
1929 nim9090md_config
[1].microcode_B_fe_size
= state
->frontend_firmware
->size
;
1930 nim9090md_config
[1].microcode_B_fe_buffer
= state
->frontend_firmware
->data
;
1932 dib9000_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x20, 0x80);
1933 adap
->fe_adap
[0].fe
= dvb_attach(dib9000_attach
, &adap
->dev
->i2c_adap
, 0x80, &nim9090md_config
[0]);
1935 if (adap
->fe_adap
[0].fe
== NULL
)
1938 i2c
= dib9000_get_i2c_master(adap
->fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_GPIO_3_4
, 0);
1939 dib9000_i2c_enumeration(i2c
, 1, 0x12, 0x82);
1941 fe_slave
= dvb_attach(dib9000_attach
, i2c
, 0x82, &nim9090md_config
[1]);
1942 dib9000_set_slave_frontend(adap
->fe_adap
[0].fe
, fe_slave
);
1944 return fe_slave
== NULL
? -ENODEV
: 0;
1947 static int nim9090md_tuner_attach(struct dvb_usb_adapter
*adap
)
1949 struct dib0700_adapter_state
*state
= adap
->priv
;
1950 struct i2c_adapter
*i2c
;
1951 struct dvb_frontend
*fe_slave
;
1952 u16 data_dib190
[10] = {
1959 i2c
= dib9000_get_tuner_interface(adap
->fe_adap
[0].fe
);
1960 if (dvb_attach(dib0090_fw_register
, adap
->fe_adap
[0].fe
, i2c
, &nim9090md_dib0090_config
[0]) == NULL
)
1962 i2c
= dib9000_get_i2c_master(adap
->fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_GPIO_1_2
, 0);
1963 if (dib01x0_pmu_update(i2c
, data_dib190
, 10) < 0)
1965 dib0700_set_i2c_speed(adap
->dev
, 2000);
1966 if (dib9000_firmware_post_pll_init(adap
->fe_adap
[0].fe
) < 0)
1969 fe_slave
= dib9000_get_slave_frontend(adap
->fe_adap
[0].fe
, 1);
1970 if (fe_slave
!= NULL
) {
1971 i2c
= dib9000_get_component_bus_interface(adap
->fe_adap
[0].fe
);
1972 dib9000_set_i2c_adapter(fe_slave
, i2c
);
1974 i2c
= dib9000_get_tuner_interface(fe_slave
);
1975 if (dvb_attach(dib0090_fw_register
, fe_slave
, i2c
, &nim9090md_dib0090_config
[1]) == NULL
)
1977 fe_slave
->dvb
= adap
->fe_adap
[0].fe
->dvb
;
1978 dib9000_fw_set_component_bus_speed(adap
->fe_adap
[0].fe
, 2000);
1979 if (dib9000_firmware_post_pll_init(fe_slave
) < 0)
1982 release_firmware(state
->frontend_firmware
);
1988 struct dib7090p_best_adc
{
1994 static int dib7090p_get_best_sampling(struct dvb_frontend
*fe
, struct dib7090p_best_adc
*adc
)
1996 u8 spur
= 0, prediv
= 0, loopdiv
= 0, min_prediv
= 1, max_prediv
= 1;
1999 u32 fcp_min
= 1900; /* PLL Minimum Frequency comparator KHz */
2000 u32 fcp_max
= 20000; /* PLL Maximum Frequency comparator KHz */
2001 u32 fdem_max
= 76000;
2002 u32 fdem_min
= 69500;
2003 u32 fcp
= 0, fs
= 0, fdem
= 0;
2004 u32 harmonic_id
= 0;
2006 adc
->pll_loopdiv
= loopdiv
;
2007 adc
->pll_prediv
= prediv
;
2010 deb_info("bandwidth = %d fdem_min =%d", fe
->dtv_property_cache
.bandwidth_hz
, fdem_min
);
2012 /* Find Min and Max prediv */
2013 while ((xtal
/max_prediv
) >= fcp_min
)
2017 min_prediv
= max_prediv
;
2018 while ((xtal
/min_prediv
) <= fcp_max
) {
2020 if (min_prediv
== 1)
2023 deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv
, max_prediv
);
2027 for (prediv
= min_prediv
; prediv
< max_prediv
; prediv
++) {
2028 fcp
= xtal
/ prediv
;
2029 if (fcp
> fcp_min
&& fcp
< fcp_max
) {
2030 for (loopdiv
= 1 ; loopdiv
< 64 ; loopdiv
++) {
2031 fdem
= ((xtal
/prediv
) * loopdiv
);
2033 /* test min/max system restrictions */
2035 if ((fdem
>= fdem_min
) && (fdem
<= fdem_max
) && (fs
>= fe
->dtv_property_cache
.bandwidth_hz
/1000)) {
2037 /* test fs harmonics positions */
2038 for (harmonic_id
= (fe
->dtv_property_cache
.frequency
/ (1000*fs
)) ; harmonic_id
<= ((fe
->dtv_property_cache
.frequency
/ (1000*fs
))+1) ; harmonic_id
++) {
2039 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)))) {
2046 adc
->pll_loopdiv
= loopdiv
;
2047 adc
->pll_prediv
= prediv
;
2048 adc
->timf
= 2396745143UL/fdem
*(1 << 9);
2049 adc
->timf
+= ((2396745143UL%fdem
) << 9)/fdem
;
2050 deb_info("loopdiv=%i prediv=%i timf=%i", loopdiv
, prediv
, adc
->timf
);
2061 if (adc
->pll_loopdiv
== 0 && adc
->pll_prediv
== 0)
2067 static int dib7090_agc_startup(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*fep
)
2069 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
2070 struct dib0700_adapter_state
*state
= adap
->priv
;
2071 struct dibx000_bandwidth_config pll
;
2073 struct dib7090p_best_adc adc
;
2076 ret
= state
->set_param_save(fe
, fep
);
2080 memset(&pll
, 0, sizeof(struct dibx000_bandwidth_config
));
2081 dib0090_pwm_gain_reset(fe
);
2082 target
= (dib0090_get_wbd_target(fe
) * 8 + 1) / 2;
2083 dib7000p_set_wbd_ref(fe
, target
);
2085 if (dib7090p_get_best_sampling(fe
, &adc
) == 0) {
2086 pll
.pll_ratio
= adc
.pll_loopdiv
;
2087 pll
.pll_prediv
= adc
.pll_prediv
;
2089 dib7000p_update_pll(fe
, &pll
);
2090 dib7000p_ctrl_timf(fe
, DEMOD_TIMF_SET
, adc
.timf
);
2095 static int dib7090_agc_restart(struct dvb_frontend
*fe
, u8 restart
)
2097 deb_info("AGC restart callback: %d", restart
);
2098 if (restart
== 0) /* before AGC startup */
2099 dib0090_set_dc_servo(fe
, 1);
2103 static int dib7090e_update_lna(struct dvb_frontend
*fe
, u16 agc_global
)
2105 u16 agc1
= 0, agc2
, wbd
= 0, wbd_target
, wbd_offset
, threshold_agc1
;
2108 if ((fe
->dtv_property_cache
.frequency
) < 400000000)
2109 threshold_agc1
= 25000;
2111 threshold_agc1
= 30000;
2113 wbd_target
= (dib0090_get_wbd_target(fe
)*8+1)/2;
2114 wbd_offset
= dib0090_get_wbd_offset(fe
);
2115 dib7000p_get_agc_values(fe
, NULL
, &agc1
, &agc2
, &wbd
);
2116 wbd_delta
= (s16
)wbd
- (((s16
)wbd_offset
+10)*4) ;
2118 deb_info("update lna, agc_global=%d agc1=%d agc2=%d",
2119 agc_global
, agc1
, agc2
);
2120 deb_info("update lna, wbd=%d wbd target=%d wbd offset=%d wbd delta=%d",
2121 wbd
, wbd_target
, wbd_offset
, wbd_delta
);
2123 if ((agc1
< threshold_agc1
) && (wbd_delta
> 0)) {
2124 dib0090_set_switch(fe
, 1, 1, 1);
2125 dib0090_set_vga(fe
, 0);
2126 dib0090_update_rframp_7090(fe
, 0);
2127 dib0090_update_tuning_table_7090(fe
, 0);
2129 dib0090_set_vga(fe
, 1);
2130 dib0090_update_rframp_7090(fe
, 1);
2131 dib0090_update_tuning_table_7090(fe
, 1);
2132 dib0090_set_switch(fe
, 0, 0, 0);
2138 static struct dib0090_wbd_slope dib7090_wbd_table
[] = {
2139 { 380, 81, 850, 64, 540, 4},
2140 { 860, 51, 866, 21, 375, 4},
2141 {1700, 0, 250, 0, 100, 6},
2142 {2600, 0, 250, 0, 100, 6},
2143 { 0xFFFF, 0, 0, 0, 0, 0},
2146 static struct dib0090_wbd_slope dib7090e_wbd_table
[] = {
2147 { 380, 81, 850, 64, 540, 4},
2148 { 700, 51, 866, 21, 320, 4},
2149 { 860, 48, 666, 18, 330, 6},
2150 {1700, 0, 250, 0, 100, 6},
2151 {2600, 0, 250, 0, 100, 6},
2152 { 0xFFFF, 0, 0, 0, 0, 0},
2155 static struct dibx000_agc_config dib7090_agc_config
[2] = {
2157 .band_caps
= BAND_UHF
,
2158 /* 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,
2159 * 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 */
2160 .setup
= (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2163 .time_stabiliz
= 10,
2194 .perform_agc_softsplit
= 0,
2196 .band_caps
= BAND_FM
| BAND_VHF
| BAND_CBAND
,
2197 /* 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,
2198 * 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 */
2199 .setup
= (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2202 .time_stabiliz
= 10,
2233 .perform_agc_softsplit
= 0,
2237 static struct dibx000_bandwidth_config dib7090_clock_config_12_mhz
= {
2241 (3 << 14) | (1 << 12) | (524 << 0),
2247 static struct dib7000p_config nim7090_dib7000p_config
= {
2248 .output_mpeg2_in_188_bytes
= 1,
2249 .hostbus_diversity
= 1,
2250 .tuner_is_baseband
= 1,
2253 .agc_config_count
= 2,
2254 .agc
= dib7090_agc_config
,
2256 .bw
= &dib7090_clock_config_12_mhz
,
2258 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
2259 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
2260 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
2264 .agc_control
= dib7090_agc_restart
,
2267 .disable_sample_and_hold
= 0,
2268 .enable_current_mirror
= 0,
2269 .diversity_delay
= 0,
2271 .output_mode
= OUTMODE_MPEG2_FIFO
,
2275 static struct dib7000p_config tfe7090pvr_dib7000p_config
[2] = {
2277 .output_mpeg2_in_188_bytes
= 1,
2278 .hostbus_diversity
= 1,
2279 .tuner_is_baseband
= 1,
2282 .agc_config_count
= 2,
2283 .agc
= dib7090_agc_config
,
2285 .bw
= &dib7090_clock_config_12_mhz
,
2287 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
2288 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
2289 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
2293 .agc_control
= dib7090_agc_restart
,
2296 .disable_sample_and_hold
= 0,
2297 .enable_current_mirror
= 0,
2298 .diversity_delay
= 0,
2300 .output_mode
= OUTMODE_MPEG2_PAR_GATED_CLK
,
2301 .default_i2c_addr
= 0x90,
2304 .output_mpeg2_in_188_bytes
= 1,
2305 .hostbus_diversity
= 1,
2306 .tuner_is_baseband
= 1,
2309 .agc_config_count
= 2,
2310 .agc
= dib7090_agc_config
,
2312 .bw
= &dib7090_clock_config_12_mhz
,
2314 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
2315 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
2316 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
2320 .agc_control
= dib7090_agc_restart
,
2323 .disable_sample_and_hold
= 0,
2324 .enable_current_mirror
= 0,
2325 .diversity_delay
= 0,
2327 .output_mode
= OUTMODE_MPEG2_PAR_GATED_CLK
,
2328 .default_i2c_addr
= 0x92,
2333 static struct dib7000p_config tfe7090e_dib7000p_config
= {
2334 .output_mpeg2_in_188_bytes
= 1,
2335 .hostbus_diversity
= 1,
2336 .tuner_is_baseband
= 1,
2337 .update_lna
= dib7090e_update_lna
,
2339 .agc_config_count
= 2,
2340 .agc
= dib7090_agc_config
,
2342 .bw
= &dib7090_clock_config_12_mhz
,
2344 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
2345 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
2346 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
2350 .agc_control
= dib7090_agc_restart
,
2353 .disable_sample_and_hold
= 0,
2354 .enable_current_mirror
= 0,
2355 .diversity_delay
= 0,
2357 .output_mode
= OUTMODE_MPEG2_FIFO
,
2361 static const struct dib0090_config nim7090_dib0090_config
= {
2362 .io
.clock_khz
= 12000,
2366 .io
.pll_loopdiv
= 6,
2367 .io
.adc_clock_ratio
= 0,
2368 .io
.pll_int_loop_filt
= 0,
2369 .reset
= dib7090_tuner_sleep
,
2370 .sleep
= dib7090_tuner_sleep
,
2372 .freq_offset_khz_uhf
= 0,
2373 .freq_offset_khz_vhf
= 0,
2375 .get_adc_power
= dib7090_get_adc_power
,
2380 .wbd_vhf_offset
= 0,
2381 .wbd_cband_offset
= 0,
2385 .fref_clock_ratio
= 0,
2387 .wbd
= dib7090_wbd_table
,
2389 .ls_cfg_pad_drv
= 0,
2395 static const struct dib0090_config tfe7090e_dib0090_config
= {
2396 .io
.clock_khz
= 12000,
2400 .io
.pll_loopdiv
= 6,
2401 .io
.adc_clock_ratio
= 0,
2402 .io
.pll_int_loop_filt
= 0,
2403 .reset
= dib7090_tuner_sleep
,
2404 .sleep
= dib7090_tuner_sleep
,
2406 .freq_offset_khz_uhf
= 0,
2407 .freq_offset_khz_vhf
= 0,
2409 .get_adc_power
= dib7090_get_adc_power
,
2414 .wbd_vhf_offset
= 0,
2415 .wbd_cband_offset
= 0,
2419 .fref_clock_ratio
= 0,
2421 .wbd
= dib7090e_wbd_table
,
2423 .ls_cfg_pad_drv
= 0,
2427 .force_cband_input
= 1,
2431 static struct dib7000p_config tfe7790e_dib7000p_config
= {
2432 .output_mpeg2_in_188_bytes
= 1,
2433 .hostbus_diversity
= 1,
2434 .tuner_is_baseband
= 1,
2435 .update_lna
= dib7090e_update_lna
,
2437 .agc_config_count
= 2,
2438 .agc
= dib7090_agc_config
,
2440 .bw
= &dib7090_clock_config_12_mhz
,
2442 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
2443 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
2444 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
2448 .agc_control
= dib7090_agc_restart
,
2451 .disable_sample_and_hold
= 0,
2452 .enable_current_mirror
= 0,
2453 .diversity_delay
= 0,
2455 .output_mode
= OUTMODE_MPEG2_PAR_GATED_CLK
,
2459 static const struct dib0090_config tfe7790e_dib0090_config
= {
2460 .io
.clock_khz
= 12000,
2464 .io
.pll_loopdiv
= 6,
2465 .io
.adc_clock_ratio
= 0,
2466 .io
.pll_int_loop_filt
= 0,
2467 .reset
= dib7090_tuner_sleep
,
2468 .sleep
= dib7090_tuner_sleep
,
2470 .freq_offset_khz_uhf
= 0,
2471 .freq_offset_khz_vhf
= 0,
2473 .get_adc_power
= dib7090_get_adc_power
,
2478 .wbd_vhf_offset
= 0,
2479 .wbd_cband_offset
= 0,
2483 .fref_clock_ratio
= 0,
2485 .wbd
= dib7090e_wbd_table
,
2487 .ls_cfg_pad_drv
= 0,
2491 .force_cband_input
= 1,
2493 .force_crystal_mode
= 1,
2496 static const struct dib0090_config tfe7090pvr_dib0090_config
[2] = {
2498 .io
.clock_khz
= 12000,
2502 .io
.pll_loopdiv
= 6,
2503 .io
.adc_clock_ratio
= 0,
2504 .io
.pll_int_loop_filt
= 0,
2505 .reset
= dib7090_tuner_sleep
,
2506 .sleep
= dib7090_tuner_sleep
,
2508 .freq_offset_khz_uhf
= 50,
2509 .freq_offset_khz_vhf
= 70,
2511 .get_adc_power
= dib7090_get_adc_power
,
2516 .wbd_vhf_offset
= 0,
2517 .wbd_cband_offset
= 0,
2521 .fref_clock_ratio
= 0,
2523 .wbd
= dib7090_wbd_table
,
2525 .ls_cfg_pad_drv
= 0,
2530 .io
.clock_khz
= 12000,
2534 .io
.pll_loopdiv
= 6,
2535 .io
.adc_clock_ratio
= 0,
2536 .io
.pll_int_loop_filt
= 0,
2537 .reset
= dib7090_tuner_sleep
,
2538 .sleep
= dib7090_tuner_sleep
,
2540 .freq_offset_khz_uhf
= -50,
2541 .freq_offset_khz_vhf
= -70,
2543 .get_adc_power
= dib7090_get_adc_power
,
2548 .wbd_vhf_offset
= 0,
2549 .wbd_cband_offset
= 0,
2553 .fref_clock_ratio
= 0,
2555 .wbd
= dib7090_wbd_table
,
2557 .ls_cfg_pad_drv
= 0,
2564 static int nim7090_frontend_attach(struct dvb_usb_adapter
*adap
)
2566 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
2568 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
2569 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
2570 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
2571 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
2574 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
2576 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
2578 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x10, &nim7090_dib7000p_config
) != 0) {
2579 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__
);
2582 adap
->fe_adap
[0].fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x80, &nim7090_dib7000p_config
);
2584 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
2587 static int nim7090_tuner_attach(struct dvb_usb_adapter
*adap
)
2589 struct dib0700_adapter_state
*st
= adap
->priv
;
2590 struct i2c_adapter
*tun_i2c
= dib7090_get_i2c_tuner(adap
->fe_adap
[0].fe
);
2592 if (dvb_attach(dib0090_register
, adap
->fe_adap
[0].fe
, tun_i2c
, &nim7090_dib0090_config
) == NULL
)
2595 dib7000p_set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 1);
2597 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
2598 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib7090_agc_startup
;
2602 static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter
*adap
)
2604 struct dib0700_state
*st
= adap
->dev
->priv
;
2606 /* The TFE7090 requires the dib0700 to not be in master mode */
2607 st
->disable_streaming_master_mode
= 1;
2609 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
2611 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
2612 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
2613 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
2614 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
2617 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
2619 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
2621 /* initialize IC 0 */
2622 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x20, &tfe7090pvr_dib7000p_config
[0]) != 0) {
2623 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__
);
2627 dib0700_set_i2c_speed(adap
->dev
, 340);
2628 adap
->fe_adap
[0].fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x90, &tfe7090pvr_dib7000p_config
[0]);
2629 if (adap
->fe_adap
[0].fe
== NULL
)
2632 dib7090_slave_reset(adap
->fe_adap
[0].fe
);
2637 static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter
*adap
)
2639 struct i2c_adapter
*i2c
;
2641 if (adap
->dev
->adapter
[0].fe_adap
[0].fe
== NULL
) {
2642 err("the master dib7090 has to be initialized first");
2643 return -ENODEV
; /* the master device has not been initialized */
2646 i2c
= dib7000p_get_i2c_master(adap
->dev
->adapter
[0].fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_GPIO_6_7
, 1);
2647 if (dib7000p_i2c_enumeration(i2c
, 1, 0x10, &tfe7090pvr_dib7000p_config
[1]) != 0) {
2648 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__
);
2652 adap
->fe_adap
[0].fe
= dvb_attach(dib7000p_attach
, i2c
, 0x92, &tfe7090pvr_dib7000p_config
[1]);
2653 dib0700_set_i2c_speed(adap
->dev
, 200);
2655 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
2658 static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter
*adap
)
2660 struct dib0700_adapter_state
*st
= adap
->priv
;
2661 struct i2c_adapter
*tun_i2c
= dib7090_get_i2c_tuner(adap
->fe_adap
[0].fe
);
2663 if (dvb_attach(dib0090_register
, adap
->fe_adap
[0].fe
, tun_i2c
, &tfe7090pvr_dib0090_config
[0]) == NULL
)
2666 dib7000p_set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 1);
2668 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
2669 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib7090_agc_startup
;
2673 static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter
*adap
)
2675 struct dib0700_adapter_state
*st
= adap
->priv
;
2676 struct i2c_adapter
*tun_i2c
= dib7090_get_i2c_tuner(adap
->fe_adap
[0].fe
);
2678 if (dvb_attach(dib0090_register
, adap
->fe_adap
[0].fe
, tun_i2c
, &tfe7090pvr_dib0090_config
[1]) == NULL
)
2681 dib7000p_set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 1);
2683 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
2684 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib7090_agc_startup
;
2688 static int tfe7090e_frontend_attach(struct dvb_usb_adapter
*adap
)
2690 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
2692 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
2693 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
2694 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
2695 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
2698 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
2700 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
2702 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
,
2703 1, 0x10, &tfe7090e_dib7000p_config
) != 0) {
2704 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
2708 adap
->fe_adap
[0].fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
,
2709 0x80, &tfe7090e_dib7000p_config
);
2711 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
2714 static int tfe7790e_frontend_attach(struct dvb_usb_adapter
*adap
)
2716 struct dib0700_state
*st
= adap
->dev
->priv
;
2718 /* The TFE7790E requires the dib0700 to not be in master mode */
2719 st
->disable_streaming_master_mode
= 1;
2721 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
2723 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
2724 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
2725 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
2726 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
2728 dib0700_ctrl_clock(adap
->dev
, 72, 1);
2729 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
2731 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
2733 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
,
2734 1, 0x10, &tfe7790e_dib7000p_config
) != 0) {
2735 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
2739 adap
->fe_adap
[0].fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
,
2740 0x80, &tfe7790e_dib7000p_config
);
2742 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
2745 static int tfe7790e_tuner_attach(struct dvb_usb_adapter
*adap
)
2747 struct dib0700_adapter_state
*st
= adap
->priv
;
2748 struct i2c_adapter
*tun_i2c
=
2749 dib7090_get_i2c_tuner(adap
->fe_adap
[0].fe
);
2751 if (dvb_attach(dib0090_register
, adap
->fe_adap
[0].fe
, tun_i2c
,
2752 &tfe7790e_dib0090_config
) == NULL
)
2755 dib7000p_set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 1);
2757 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
2758 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib7090_agc_startup
;
2762 static int tfe7090e_tuner_attach(struct dvb_usb_adapter
*adap
)
2764 struct dib0700_adapter_state
*st
= adap
->priv
;
2765 struct i2c_adapter
*tun_i2c
=
2766 dib7090_get_i2c_tuner(adap
->fe_adap
[0].fe
);
2768 if (dvb_attach(dib0090_register
, adap
->fe_adap
[0].fe
, tun_i2c
,
2769 &tfe7090e_dib0090_config
) == NULL
)
2772 dib7000p_set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 1);
2774 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
2775 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib7090_agc_startup
;
2780 static struct dib7000p_config stk7070pd_dib7000p_config
[2] = {
2782 .output_mpeg2_in_188_bytes
= 1,
2784 .agc_config_count
= 1,
2785 .agc
= &dib7070_agc_config
,
2786 .bw
= &dib7070_bw_config_12_mhz
,
2787 .tuner_is_baseband
= 1,
2790 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
2791 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
2792 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
2794 .hostbus_diversity
= 1,
2796 .output_mpeg2_in_188_bytes
= 1,
2798 .agc_config_count
= 1,
2799 .agc
= &dib7070_agc_config
,
2800 .bw
= &dib7070_bw_config_12_mhz
,
2801 .tuner_is_baseband
= 1,
2804 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
2805 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
2806 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
2808 .hostbus_diversity
= 1,
2812 static int stk7070pd_frontend_attach0(struct dvb_usb_adapter
*adap
)
2814 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
2816 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
2817 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
2818 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
2819 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
2821 dib0700_ctrl_clock(adap
->dev
, 72, 1);
2824 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
2826 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
2828 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 2, 18,
2829 stk7070pd_dib7000p_config
) != 0) {
2830 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
2835 adap
->fe_adap
[0].fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x80, &stk7070pd_dib7000p_config
[0]);
2836 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
2839 static int stk7070pd_frontend_attach1(struct dvb_usb_adapter
*adap
)
2841 adap
->fe_adap
[0].fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x82, &stk7070pd_dib7000p_config
[1]);
2842 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
2846 static struct s5h1411_config pinnacle_801e_config
= {
2847 .output_mode
= S5H1411_PARALLEL_OUTPUT
,
2848 .gpio
= S5H1411_GPIO_OFF
,
2849 .mpeg_timing
= S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK
,
2850 .qam_if
= S5H1411_IF_44000
,
2851 .vsb_if
= S5H1411_IF_44000
,
2852 .inversion
= S5H1411_INVERSION_OFF
,
2853 .status_mode
= S5H1411_DEMODLOCKING
2856 /* Pinnacle PCTV HD Pro 801e GPIOs map:
2857 GPIO0 - currently unknown
2858 GPIO1 - xc5000 tuner reset
2859 GPIO2 - CX25843 sleep
2860 GPIO3 - currently unknown
2861 GPIO4 - currently unknown
2862 GPIO6 - currently unknown
2863 GPIO7 - currently unknown
2864 GPIO9 - currently unknown
2865 GPIO10 - CX25843 reset
2867 static int s5h1411_frontend_attach(struct dvb_usb_adapter
*adap
)
2869 struct dib0700_state
*st
= adap
->dev
->priv
;
2871 /* Make use of the new i2c functions from FW 1.20 */
2872 st
->fw_use_new_i2c_api
= 1;
2874 /* The s5h1411 requires the dib0700 to not be in master mode */
2875 st
->disable_streaming_master_mode
= 1;
2877 /* All msleep values taken from Windows USB trace */
2878 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 0);
2879 dib0700_set_gpio(adap
->dev
, GPIO3
, GPIO_OUT
, 0);
2880 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
2882 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
2884 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
2886 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
2887 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
2888 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
2889 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
2890 dib0700_set_gpio(adap
->dev
, GPIO2
, GPIO_OUT
, 0);
2893 /* Put the CX25843 to sleep for now since we're in digital mode */
2894 dib0700_set_gpio(adap
->dev
, GPIO2
, GPIO_OUT
, 1);
2896 /* GPIOs are initialized, do the attach */
2897 adap
->fe_adap
[0].fe
= dvb_attach(s5h1411_attach
, &pinnacle_801e_config
,
2898 &adap
->dev
->i2c_adap
);
2899 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
2902 static int dib0700_xc5000_tuner_callback(void *priv
, int component
,
2903 int command
, int arg
)
2905 struct dvb_usb_adapter
*adap
= priv
;
2907 if (command
== XC5000_TUNER_RESET
) {
2908 /* Reset the tuner */
2909 dib0700_set_gpio(adap
->dev
, GPIO1
, GPIO_OUT
, 0);
2911 dib0700_set_gpio(adap
->dev
, GPIO1
, GPIO_OUT
, 1);
2914 err("xc5000: unknown tuner callback command: %d\n", command
);
2921 static struct xc5000_config s5h1411_xc5000_tunerconfig
= {
2922 .i2c_address
= 0x64,
2926 static int xc5000_tuner_attach(struct dvb_usb_adapter
*adap
)
2928 /* FIXME: generalize & move to common area */
2929 adap
->fe_adap
[0].fe
->callback
= dib0700_xc5000_tuner_callback
;
2931 return dvb_attach(xc5000_attach
, adap
->fe_adap
[0].fe
, &adap
->dev
->i2c_adap
,
2932 &s5h1411_xc5000_tunerconfig
)
2933 == NULL
? -ENODEV
: 0;
2936 static int dib0700_xc4000_tuner_callback(void *priv
, int component
,
2937 int command
, int arg
)
2939 struct dvb_usb_adapter
*adap
= priv
;
2941 if (command
== XC4000_TUNER_RESET
) {
2942 /* Reset the tuner */
2943 dib7000p_set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 0);
2945 dib7000p_set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 1);
2947 err("xc4000: unknown tuner callback command: %d\n", command
);
2954 static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config
= {
2955 .band_caps
= BAND_UHF
| BAND_VHF
,
2958 .time_stabiliz
= 0x15,
2959 .alpha_level
= 0x00,
2972 .agc1_slope1
= 0x00,
2973 .agc1_slope2
= 0x00,
2976 .agc2_slope1
= 0x1d,
2977 .agc2_slope2
= 0x1d,
2982 .perform_agc_softsplit
= 0x00,
2985 static struct dibx000_bandwidth_config stk7700p_xc4000_pll_config
= {
2986 60000, 30000, /* internal, sampling */
2987 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
2988 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, */
2989 /* ADClkSrc, modulo */
2990 (3 << 14) | (1 << 12) | 524, /* sad_cfg: refsel, sel, freq_15k */
2991 39370534, /* ifreq */
2992 20452225, /* timf */
2996 /* FIXME: none of these inputs are validated yet */
2997 static struct dib7000p_config pctv_340e_config
= {
2998 .output_mpeg2_in_188_bytes
= 1,
3000 .agc_config_count
= 1,
3001 .agc
= &stk7700p_7000p_xc4000_agc_config
,
3002 .bw
= &stk7700p_xc4000_pll_config
,
3004 .gpio_dir
= DIB7000M_GPIO_DEFAULT_DIRECTIONS
,
3005 .gpio_val
= DIB7000M_GPIO_DEFAULT_VALUES
,
3006 .gpio_pwm_pos
= DIB7000M_GPIO_DEFAULT_PWM_POS
,
3009 /* PCTV 340e GPIOs map:
3011 GPIO2 - CX25843 sleep
3012 GPIO3 - CS5340 reset
3014 GPIO6 - Power Supply
3015 GPIO8 - LNA (1=off 0=on)
3016 GPIO10 - CX25843 reset
3018 GPIO8 - xc4000 reset
3020 static int pctv340e_frontend_attach(struct dvb_usb_adapter
*adap
)
3022 struct dib0700_state
*st
= adap
->dev
->priv
;
3024 /* Power Supply on */
3025 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
3027 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
3028 msleep(100); /* Allow power supply to settle before probing */
3031 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
3032 msleep(1); /* cx25843 datasheet say 350us required */
3033 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
3035 /* LNA off for now */
3036 dib0700_set_gpio(adap
->dev
, GPIO8
, GPIO_OUT
, 1);
3038 /* Put the CX25843 to sleep for now since we're in digital mode */
3039 dib0700_set_gpio(adap
->dev
, GPIO2
, GPIO_OUT
, 1);
3041 /* FIXME: not verified yet */
3042 dib0700_ctrl_clock(adap
->dev
, 72, 1);
3046 if (dib7000pc_detection(&adap
->dev
->i2c_adap
) == 0) {
3047 /* Demodulator not found for some reason? */
3051 adap
->fe_adap
[0].fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x12,
3053 st
->is_dib7000pc
= 1;
3055 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
3058 static struct xc4000_config dib7000p_xc4000_tunerconfig
= {
3059 .i2c_address
= 0x61,
3062 .set_smoothedcvbs
= 0,
3066 static int xc4000_tuner_attach(struct dvb_usb_adapter
*adap
)
3068 struct i2c_adapter
*tun_i2c
;
3070 /* The xc4000 is not on the main i2c bus */
3071 tun_i2c
= dib7000p_get_i2c_master(adap
->fe_adap
[0].fe
,
3072 DIBX000_I2C_INTERFACE_TUNER
, 1);
3073 if (tun_i2c
== NULL
) {
3074 printk(KERN_ERR
"Could not reach tuner i2c bus\n");
3078 /* Setup the reset callback */
3079 adap
->fe_adap
[0].fe
->callback
= dib0700_xc4000_tuner_callback
;
3081 return dvb_attach(xc4000_attach
, adap
->fe_adap
[0].fe
, tun_i2c
,
3082 &dib7000p_xc4000_tunerconfig
)
3083 == NULL
? -ENODEV
: 0;
3086 static struct lgdt3305_config hcw_lgdt3305_config
= {
3088 .mpeg_mode
= LGDT3305_MPEG_PARALLEL
,
3089 .tpclk_edge
= LGDT3305_TPCLK_FALLING_EDGE
,
3090 .tpvalid_polarity
= LGDT3305_TP_VALID_LOW
,
3092 .spectral_inversion
= 1,
3095 .usref_8vsb
= 0x0500,
3098 static struct mxl5007t_config hcw_mxl5007t_config
= {
3099 .xtal_freq_hz
= MxL_XTAL_25_MHZ
,
3100 .if_freq_hz
= MxL_IF_6_MHZ
,
3105 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
3106 GPIO1 - ANT_SEL (H: VPA, L: MCX)
3112 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
3114 static int lgdt3305_frontend_attach(struct dvb_usb_adapter
*adap
)
3116 struct dib0700_state
*st
= adap
->dev
->priv
;
3118 /* Make use of the new i2c functions from FW 1.20 */
3119 st
->fw_use_new_i2c_api
= 1;
3121 st
->disable_streaming_master_mode
= 1;
3123 /* fe power enable */
3124 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
3126 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
3130 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
3132 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
3134 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
3137 adap
->fe_adap
[0].fe
= dvb_attach(lgdt3305_attach
,
3138 &hcw_lgdt3305_config
,
3139 &adap
->dev
->i2c_adap
);
3141 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
3144 static int mxl5007t_tuner_attach(struct dvb_usb_adapter
*adap
)
3146 return dvb_attach(mxl5007t_attach
, adap
->fe_adap
[0].fe
,
3147 &adap
->dev
->i2c_adap
, 0x60,
3148 &hcw_mxl5007t_config
) == NULL
? -ENODEV
: 0;
3152 /* DVB-USB and USB stuff follows */
3153 struct usb_device_id dib0700_usb_id_table
[] = {
3154 /* 0 */ { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7700P
) },
3155 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7700P_PC
) },
3156 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_500
) },
3157 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_500_2
) },
3158 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_STICK
) },
3159 /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_VOLAR
) },
3160 { USB_DEVICE(USB_VID_COMPRO
, USB_PID_COMPRO_VIDEOMATE_U500
) },
3161 { USB_DEVICE(USB_VID_UNIWILL
, USB_PID_UNIWILL_STK7700P
) },
3162 { USB_DEVICE(USB_VID_LEADTEK
, USB_PID_WINFAST_DTV_DONGLE_STK7700P
) },
3163 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_STICK_2
) },
3164 /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_VOLAR_2
) },
3165 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV2000E
) },
3166 { USB_DEVICE(USB_VID_TERRATEC
,
3167 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY
) },
3168 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_TD_STICK
) },
3169 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7700D
) },
3170 /* 15 */{ USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7070P
) },
3171 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV_DVB_T_FLASH
) },
3172 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7070PD
) },
3173 { USB_DEVICE(USB_VID_PINNACLE
,
3174 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T
) },
3175 { USB_DEVICE(USB_VID_COMPRO
, USB_PID_COMPRO_VIDEOMATE_U500_PC
) },
3176 /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_EXPRESS
) },
3177 { USB_DEVICE(USB_VID_GIGABYTE
, USB_PID_GIGABYTE_U7000
) },
3178 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC
, USB_PID_ARTEC_T14BR
) },
3179 { USB_DEVICE(USB_VID_ASUS
, USB_PID_ASUS_U3000
) },
3180 { USB_DEVICE(USB_VID_ASUS
, USB_PID_ASUS_U3100
) },
3181 /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_STICK_3
) },
3182 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_MYTV_T
) },
3183 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_HT_USB_XE
) },
3184 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_EXPRESSCARD_320CX
) },
3185 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV72E
) },
3186 /* 30 */{ USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV73E
) },
3187 { USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_EC372S
) },
3188 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_HT_EXPRESS
) },
3189 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_T_XXS
) },
3190 { USB_DEVICE(USB_VID_LEADTEK
, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2
) },
3191 /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009
) },
3192 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_500_3
) },
3193 { USB_DEVICE(USB_VID_GIGABYTE
, USB_PID_GIGABYTE_U8000
) },
3194 { USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_STK7700PH
) },
3195 { USB_DEVICE(USB_VID_ASUS
, USB_PID_ASUS_U3000H
) },
3196 /* 40 */{ USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV801E
) },
3197 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV801E_SE
) },
3198 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_T_EXPRESS
) },
3199 { USB_DEVICE(USB_VID_TERRATEC
,
3200 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2
) },
3201 { USB_DEVICE(USB_VID_SONY
, USB_PID_SONY_PLAYTV
) },
3202 /* 45 */{ USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_PD378S
) },
3203 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_TIGER_ATSC
) },
3204 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_TIGER_ATSC_B210
) },
3205 { USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_MC770
) },
3206 { USB_DEVICE(USB_VID_ELGATO
, USB_PID_ELGATO_EYETV_DTT
) },
3207 /* 50 */{ USB_DEVICE(USB_VID_ELGATO
, USB_PID_ELGATO_EYETV_DTT_Dlx
) },
3208 { USB_DEVICE(USB_VID_LEADTEK
, USB_PID_WINFAST_DTV_DONGLE_H
) },
3209 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_T3
) },
3210 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_T5
) },
3211 { USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_STK7700D
) },
3212 /* 55 */{ USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_STK7700D_2
) },
3213 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV73A
) },
3214 { USB_DEVICE(USB_VID_PCTV
, USB_PID_PINNACLE_PCTV73ESE
) },
3215 { USB_DEVICE(USB_VID_PCTV
, USB_PID_PINNACLE_PCTV282E
) },
3216 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7770P
) },
3217 /* 60 */{ USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_T_XXS_2
) },
3218 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK807XPVR
) },
3219 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK807XP
) },
3220 { USB_DEVICE_VER(USB_VID_PIXELVIEW
, USB_PID_PIXELVIEW_SBTVD
, 0x000, 0x3f00) },
3221 { USB_DEVICE(USB_VID_EVOLUTEPC
, USB_PID_TVWAY_PLUS
) },
3222 /* 65 */{ USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV73ESE
) },
3223 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV282E
) },
3224 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK8096GP
) },
3225 { USB_DEVICE(USB_VID_ELGATO
, USB_PID_ELGATO_EYETV_DIVERSITY
) },
3226 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_NIM9090M
) },
3227 /* 70 */{ USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_NIM8096MD
) },
3228 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_NIM9090MD
) },
3229 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_NIM7090
) },
3230 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_TFE7090PVR
) },
3231 { USB_DEVICE(USB_VID_TECHNISAT
, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2
) },
3232 /* 75 */{ USB_DEVICE(USB_VID_MEDION
, USB_PID_CREATIX_CTX1921
) },
3233 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV340E
) },
3234 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV340E_SE
) },
3235 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_TFE7090E
) },
3236 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_TFE7790E
) },
3237 { 0 } /* Terminating entry */
3239 MODULE_DEVICE_TABLE(usb
, dib0700_usb_id_table
);
3241 #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
3242 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
3243 .usb_ctrl = DEVICE_SPECIFIC, \
3244 .firmware = "dvb-usb-dib0700-1.20.fw", \
3245 .download_firmware = dib0700_download_firmware, \
3246 .no_reconnect = 1, \
3247 .size_of_priv = sizeof(struct dib0700_state), \
3248 .i2c_algo = &dib0700_i2c_algo, \
3249 .identify_state = dib0700_identify_state
3251 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
3252 .streaming_ctrl = dib0700_streaming_ctrl, \
3259 .buffersize = 39480, \
3264 struct dvb_usb_device_properties dib0700_devices
[] = {
3266 DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3273 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3274 .pid_filter_count
= 32,
3275 .pid_filter
= stk7700p_pid_filter
,
3276 .pid_filter_ctrl
= stk7700p_pid_filter_ctrl
,
3277 .frontend_attach
= stk7700p_frontend_attach
,
3278 .tuner_attach
= stk7700p_tuner_attach
,
3280 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3285 .num_device_descs
= 8,
3287 { "DiBcom STK7700P reference design",
3288 { &dib0700_usb_id_table
[0], &dib0700_usb_id_table
[1] },
3291 { "Hauppauge Nova-T Stick",
3292 { &dib0700_usb_id_table
[4], &dib0700_usb_id_table
[9], NULL
},
3295 { "AVerMedia AVerTV DVB-T Volar",
3296 { &dib0700_usb_id_table
[5], &dib0700_usb_id_table
[10] },
3299 { "Compro Videomate U500",
3300 { &dib0700_usb_id_table
[6], &dib0700_usb_id_table
[19] },
3303 { "Uniwill STK7700P based (Hama and others)",
3304 { &dib0700_usb_id_table
[7], NULL
},
3307 { "Leadtek Winfast DTV Dongle (STK7700P based)",
3308 { &dib0700_usb_id_table
[8], &dib0700_usb_id_table
[34] },
3311 { "AVerMedia AVerTV DVB-T Express",
3312 { &dib0700_usb_id_table
[20] },
3316 { &dib0700_usb_id_table
[21], NULL
},
3322 .rc_interval
= DEFAULT_RC_INTERVAL
,
3323 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3324 .rc_query
= dib0700_rc_query_old_firmware
,
3325 .allowed_protos
= RC_TYPE_RC5
|
3328 .change_protocol
= dib0700_change_protocol
,
3330 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3337 .frontend_attach
= bristol_frontend_attach
,
3338 .tuner_attach
= bristol_tuner_attach
,
3340 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3345 .frontend_attach
= bristol_frontend_attach
,
3346 .tuner_attach
= bristol_tuner_attach
,
3348 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3353 .num_device_descs
= 1,
3355 { "Hauppauge Nova-T 500 Dual DVB-T",
3356 { &dib0700_usb_id_table
[2], &dib0700_usb_id_table
[3], NULL
},
3362 .rc_interval
= DEFAULT_RC_INTERVAL
,
3363 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3364 .rc_query
= dib0700_rc_query_old_firmware
,
3365 .allowed_protos
= RC_TYPE_RC5
|
3368 .change_protocol
= dib0700_change_protocol
,
3370 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3377 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3378 .pid_filter_count
= 32,
3379 .pid_filter
= stk70x0p_pid_filter
,
3380 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3381 .frontend_attach
= stk7700d_frontend_attach
,
3382 .tuner_attach
= stk7700d_tuner_attach
,
3384 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3389 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3390 .pid_filter_count
= 32,
3391 .pid_filter
= stk70x0p_pid_filter
,
3392 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3393 .frontend_attach
= stk7700d_frontend_attach
,
3394 .tuner_attach
= stk7700d_tuner_attach
,
3396 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3401 .num_device_descs
= 5,
3403 { "Pinnacle PCTV 2000e",
3404 { &dib0700_usb_id_table
[11], NULL
},
3407 { "Terratec Cinergy DT XS Diversity",
3408 { &dib0700_usb_id_table
[12], NULL
},
3411 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
3412 { &dib0700_usb_id_table
[13], NULL
},
3415 { "DiBcom STK7700D reference design",
3416 { &dib0700_usb_id_table
[14], NULL
},
3419 { "YUAN High-Tech DiBcom STK7700D",
3420 { &dib0700_usb_id_table
[55], NULL
},
3427 .rc_interval
= DEFAULT_RC_INTERVAL
,
3428 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3429 .rc_query
= dib0700_rc_query_old_firmware
,
3430 .allowed_protos
= RC_TYPE_RC5
|
3433 .change_protocol
= dib0700_change_protocol
,
3435 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3442 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3443 .pid_filter_count
= 32,
3444 .pid_filter
= stk70x0p_pid_filter
,
3445 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3446 .frontend_attach
= stk7700P2_frontend_attach
,
3447 .tuner_attach
= stk7700d_tuner_attach
,
3449 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3454 .num_device_descs
= 3,
3456 { "ASUS My Cinema U3000 Mini DVBT Tuner",
3457 { &dib0700_usb_id_table
[23], NULL
},
3461 { &dib0700_usb_id_table
[31], NULL
},
3464 { "Terratec Cinergy T Express",
3465 { &dib0700_usb_id_table
[42], NULL
},
3471 .rc_interval
= DEFAULT_RC_INTERVAL
,
3472 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3473 .module_name
= "dib0700",
3474 .rc_query
= dib0700_rc_query_old_firmware
,
3475 .allowed_protos
= RC_TYPE_RC5
|
3478 .change_protocol
= dib0700_change_protocol
,
3480 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3487 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3488 .pid_filter_count
= 32,
3489 .pid_filter
= stk70x0p_pid_filter
,
3490 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3491 .frontend_attach
= stk7070p_frontend_attach
,
3492 .tuner_attach
= dib7070p_tuner_attach
,
3494 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3496 .size_of_priv
= sizeof(struct dib0700_adapter_state
),
3500 .num_device_descs
= 11,
3502 { "DiBcom STK7070P reference design",
3503 { &dib0700_usb_id_table
[15], NULL
},
3506 { "Pinnacle PCTV DVB-T Flash Stick",
3507 { &dib0700_usb_id_table
[16], NULL
},
3510 { "Artec T14BR DVB-T",
3511 { &dib0700_usb_id_table
[22], NULL
},
3514 { "ASUS My Cinema U3100 Mini DVBT Tuner",
3515 { &dib0700_usb_id_table
[24], NULL
},
3518 { "Hauppauge Nova-T Stick",
3519 { &dib0700_usb_id_table
[25], NULL
},
3522 { "Hauppauge Nova-T MyTV.t",
3523 { &dib0700_usb_id_table
[26], NULL
},
3526 { "Pinnacle PCTV 72e",
3527 { &dib0700_usb_id_table
[29], NULL
},
3530 { "Pinnacle PCTV 73e",
3531 { &dib0700_usb_id_table
[30], NULL
},
3534 { "Elgato EyeTV DTT",
3535 { &dib0700_usb_id_table
[49], NULL
},
3539 { &dib0700_usb_id_table
[45], NULL
},
3542 { "Elgato EyeTV Dtt Dlx PD378S",
3543 { &dib0700_usb_id_table
[50], NULL
},
3549 .rc_interval
= DEFAULT_RC_INTERVAL
,
3550 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3551 .module_name
= "dib0700",
3552 .rc_query
= dib0700_rc_query_old_firmware
,
3553 .allowed_protos
= RC_TYPE_RC5
|
3556 .change_protocol
= dib0700_change_protocol
,
3558 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3565 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3566 .pid_filter_count
= 32,
3567 .pid_filter
= stk70x0p_pid_filter
,
3568 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3569 .frontend_attach
= stk7070p_frontend_attach
,
3570 .tuner_attach
= dib7070p_tuner_attach
,
3572 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3574 .size_of_priv
= sizeof(struct dib0700_adapter_state
),
3578 .num_device_descs
= 3,
3580 { "Pinnacle PCTV 73A",
3581 { &dib0700_usb_id_table
[56], NULL
},
3584 { "Pinnacle PCTV 73e SE",
3585 { &dib0700_usb_id_table
[57], &dib0700_usb_id_table
[65], NULL
},
3588 { "Pinnacle PCTV 282e",
3589 { &dib0700_usb_id_table
[58], &dib0700_usb_id_table
[66], NULL
},
3595 .rc_interval
= DEFAULT_RC_INTERVAL
,
3596 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3597 .module_name
= "dib0700",
3598 .rc_query
= dib0700_rc_query_old_firmware
,
3599 .allowed_protos
= RC_TYPE_RC5
|
3602 .change_protocol
= dib0700_change_protocol
,
3604 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3611 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3612 .pid_filter_count
= 32,
3613 .pid_filter
= stk70x0p_pid_filter
,
3614 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3615 .frontend_attach
= stk7070pd_frontend_attach0
,
3616 .tuner_attach
= dib7070p_tuner_attach
,
3618 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3620 .size_of_priv
= sizeof(struct dib0700_adapter_state
),
3624 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3625 .pid_filter_count
= 32,
3626 .pid_filter
= stk70x0p_pid_filter
,
3627 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3628 .frontend_attach
= stk7070pd_frontend_attach1
,
3629 .tuner_attach
= dib7070p_tuner_attach
,
3631 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3633 .size_of_priv
= sizeof(struct dib0700_adapter_state
),
3637 .num_device_descs
= 6,
3639 { "DiBcom STK7070PD reference design",
3640 { &dib0700_usb_id_table
[17], NULL
},
3643 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
3644 { &dib0700_usb_id_table
[18], NULL
},
3647 { "Hauppauge Nova-TD Stick (52009)",
3648 { &dib0700_usb_id_table
[35], NULL
},
3651 { "Hauppauge Nova-TD-500 (84xxx)",
3652 { &dib0700_usb_id_table
[36], NULL
},
3655 { "Terratec Cinergy DT USB XS Diversity/ T5",
3656 { &dib0700_usb_id_table
[43],
3657 &dib0700_usb_id_table
[53], NULL
},
3661 { &dib0700_usb_id_table
[44], NULL
},
3667 .rc_interval
= DEFAULT_RC_INTERVAL
,
3668 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3669 .module_name
= "dib0700",
3670 .rc_query
= dib0700_rc_query_old_firmware
,
3671 .allowed_protos
= RC_TYPE_RC5
|
3674 .change_protocol
= dib0700_change_protocol
,
3676 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3683 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3684 .pid_filter_count
= 32,
3685 .pid_filter
= stk70x0p_pid_filter
,
3686 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3687 .frontend_attach
= stk7070pd_frontend_attach0
,
3688 .tuner_attach
= dib7070p_tuner_attach
,
3690 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3692 .size_of_priv
= sizeof(struct dib0700_adapter_state
),
3696 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3697 .pid_filter_count
= 32,
3698 .pid_filter
= stk70x0p_pid_filter
,
3699 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3700 .frontend_attach
= stk7070pd_frontend_attach1
,
3701 .tuner_attach
= dib7070p_tuner_attach
,
3703 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3705 .size_of_priv
= sizeof(struct dib0700_adapter_state
),
3709 .num_device_descs
= 1,
3711 { "Elgato EyeTV Diversity",
3712 { &dib0700_usb_id_table
[68], NULL
},
3718 .rc_interval
= DEFAULT_RC_INTERVAL
,
3719 .rc_codes
= RC_MAP_DIB0700_NEC_TABLE
,
3720 .module_name
= "dib0700",
3721 .rc_query
= dib0700_rc_query_old_firmware
,
3722 .allowed_protos
= RC_TYPE_RC5
|
3725 .change_protocol
= dib0700_change_protocol
,
3727 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3734 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3735 .pid_filter_count
= 32,
3736 .pid_filter
= stk70x0p_pid_filter
,
3737 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3738 .frontend_attach
= stk7700ph_frontend_attach
,
3739 .tuner_attach
= stk7700ph_tuner_attach
,
3741 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3743 .size_of_priv
= sizeof(struct
3744 dib0700_adapter_state
),
3748 .num_device_descs
= 9,
3750 { "Terratec Cinergy HT USB XE",
3751 { &dib0700_usb_id_table
[27], NULL
},
3754 { "Pinnacle Expresscard 320cx",
3755 { &dib0700_usb_id_table
[28], NULL
},
3758 { "Terratec Cinergy HT Express",
3759 { &dib0700_usb_id_table
[32], NULL
},
3762 { "Gigabyte U8000-RH",
3763 { &dib0700_usb_id_table
[37], NULL
},
3766 { "YUAN High-Tech STK7700PH",
3767 { &dib0700_usb_id_table
[38], NULL
},
3770 { "Asus My Cinema-U3000Hybrid",
3771 { &dib0700_usb_id_table
[39], NULL
},
3774 { "YUAN High-Tech MC770",
3775 { &dib0700_usb_id_table
[48], NULL
},
3778 { "Leadtek WinFast DTV Dongle H",
3779 { &dib0700_usb_id_table
[51], NULL
},
3782 { "YUAN High-Tech STK7700D",
3783 { &dib0700_usb_id_table
[54], NULL
},
3789 .rc_interval
= DEFAULT_RC_INTERVAL
,
3790 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3791 .module_name
= "dib0700",
3792 .rc_query
= dib0700_rc_query_old_firmware
,
3793 .allowed_protos
= RC_TYPE_RC5
|
3796 .change_protocol
= dib0700_change_protocol
,
3798 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3804 .frontend_attach
= s5h1411_frontend_attach
,
3805 .tuner_attach
= xc5000_tuner_attach
,
3807 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3809 .size_of_priv
= sizeof(struct
3810 dib0700_adapter_state
),
3814 .num_device_descs
= 2,
3816 { "Pinnacle PCTV HD Pro USB Stick",
3817 { &dib0700_usb_id_table
[40], NULL
},
3820 { "Pinnacle PCTV HD USB Stick",
3821 { &dib0700_usb_id_table
[41], NULL
},
3827 .rc_interval
= DEFAULT_RC_INTERVAL
,
3828 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3829 .module_name
= "dib0700",
3830 .rc_query
= dib0700_rc_query_old_firmware
,
3831 .allowed_protos
= RC_TYPE_RC5
|
3834 .change_protocol
= dib0700_change_protocol
,
3836 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3842 .frontend_attach
= lgdt3305_frontend_attach
,
3843 .tuner_attach
= mxl5007t_tuner_attach
,
3845 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3847 .size_of_priv
= sizeof(struct
3848 dib0700_adapter_state
),
3852 .num_device_descs
= 2,
3854 { "Hauppauge ATSC MiniCard (B200)",
3855 { &dib0700_usb_id_table
[46], NULL
},
3858 { "Hauppauge ATSC MiniCard (B210)",
3859 { &dib0700_usb_id_table
[47], NULL
},
3863 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3870 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3871 .pid_filter_count
= 32,
3872 .pid_filter
= stk70x0p_pid_filter
,
3873 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3874 .frontend_attach
= stk7770p_frontend_attach
,
3875 .tuner_attach
= dib7770p_tuner_attach
,
3877 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3880 sizeof(struct dib0700_adapter_state
),
3884 .num_device_descs
= 4,
3886 { "DiBcom STK7770P reference design",
3887 { &dib0700_usb_id_table
[59], NULL
},
3890 { "Terratec Cinergy T USB XXS (HD)/ T3",
3891 { &dib0700_usb_id_table
[33],
3892 &dib0700_usb_id_table
[52],
3893 &dib0700_usb_id_table
[60], NULL
},
3896 { "TechniSat AirStar TeleStick 2",
3897 { &dib0700_usb_id_table
[74], NULL
},
3900 { "Medion CTX1921 DVB-T USB",
3901 { &dib0700_usb_id_table
[75], NULL
},
3907 .rc_interval
= DEFAULT_RC_INTERVAL
,
3908 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3909 .module_name
= "dib0700",
3910 .rc_query
= dib0700_rc_query_old_firmware
,
3911 .allowed_protos
= RC_TYPE_RC5
|
3914 .change_protocol
= dib0700_change_protocol
,
3916 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3922 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3923 .pid_filter_count
= 32,
3924 .pid_filter
= stk80xx_pid_filter
,
3925 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
3926 .frontend_attach
= stk807x_frontend_attach
,
3927 .tuner_attach
= dib807x_tuner_attach
,
3929 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3932 sizeof(struct dib0700_adapter_state
),
3936 .num_device_descs
= 3,
3938 { "DiBcom STK807xP reference design",
3939 { &dib0700_usb_id_table
[62], NULL
},
3942 { "Prolink Pixelview SBTVD",
3943 { &dib0700_usb_id_table
[63], NULL
},
3946 { "EvolutePC TVWay+",
3947 { &dib0700_usb_id_table
[64], NULL
},
3953 .rc_interval
= DEFAULT_RC_INTERVAL
,
3954 .rc_codes
= RC_MAP_DIB0700_NEC_TABLE
,
3955 .module_name
= "dib0700",
3956 .rc_query
= dib0700_rc_query_old_firmware
,
3957 .allowed_protos
= RC_TYPE_RC5
|
3960 .change_protocol
= dib0700_change_protocol
,
3962 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3968 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3969 .pid_filter_count
= 32,
3970 .pid_filter
= stk80xx_pid_filter
,
3971 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
3972 .frontend_attach
= stk807xpvr_frontend_attach0
,
3973 .tuner_attach
= dib807x_tuner_attach
,
3975 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3978 sizeof(struct dib0700_adapter_state
),
3983 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3984 .pid_filter_count
= 32,
3985 .pid_filter
= stk80xx_pid_filter
,
3986 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
3987 .frontend_attach
= stk807xpvr_frontend_attach1
,
3988 .tuner_attach
= dib807x_tuner_attach
,
3990 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3993 sizeof(struct dib0700_adapter_state
),
3997 .num_device_descs
= 1,
3999 { "DiBcom STK807xPVR reference design",
4000 { &dib0700_usb_id_table
[61], NULL
},
4006 .rc_interval
= DEFAULT_RC_INTERVAL
,
4007 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4008 .module_name
= "dib0700",
4009 .rc_query
= dib0700_rc_query_old_firmware
,
4010 .allowed_protos
= RC_TYPE_RC5
|
4013 .change_protocol
= dib0700_change_protocol
,
4015 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4021 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4022 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4023 .pid_filter_count
= 32,
4024 .pid_filter
= stk80xx_pid_filter
,
4025 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
4026 .frontend_attach
= stk809x_frontend_attach
,
4027 .tuner_attach
= dib809x_tuner_attach
,
4029 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4032 sizeof(struct dib0700_adapter_state
),
4036 .num_device_descs
= 1,
4038 { "DiBcom STK8096GP reference design",
4039 { &dib0700_usb_id_table
[67], NULL
},
4045 .rc_interval
= DEFAULT_RC_INTERVAL
,
4046 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4047 .module_name
= "dib0700",
4048 .rc_query
= dib0700_rc_query_old_firmware
,
4049 .allowed_protos
= RC_TYPE_RC5
|
4052 .change_protocol
= dib0700_change_protocol
,
4054 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4060 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4061 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4062 .pid_filter_count
= 32,
4063 .pid_filter
= dib90x0_pid_filter
,
4064 .pid_filter_ctrl
= dib90x0_pid_filter_ctrl
,
4065 .frontend_attach
= stk9090m_frontend_attach
,
4066 .tuner_attach
= dib9090_tuner_attach
,
4068 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4071 sizeof(struct dib0700_adapter_state
),
4075 .num_device_descs
= 1,
4077 { "DiBcom STK9090M reference design",
4078 { &dib0700_usb_id_table
[69], NULL
},
4084 .rc_interval
= DEFAULT_RC_INTERVAL
,
4085 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4086 .module_name
= "dib0700",
4087 .rc_query
= dib0700_rc_query_old_firmware
,
4088 .allowed_protos
= RC_TYPE_RC5
|
4091 .change_protocol
= dib0700_change_protocol
,
4093 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4099 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4100 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4101 .pid_filter_count
= 32,
4102 .pid_filter
= stk80xx_pid_filter
,
4103 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
4104 .frontend_attach
= nim8096md_frontend_attach
,
4105 .tuner_attach
= nim8096md_tuner_attach
,
4107 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4110 sizeof(struct dib0700_adapter_state
),
4114 .num_device_descs
= 1,
4116 { "DiBcom NIM8096MD reference design",
4117 { &dib0700_usb_id_table
[70], NULL
},
4123 .rc_interval
= DEFAULT_RC_INTERVAL
,
4124 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4125 .module_name
= "dib0700",
4126 .rc_query
= dib0700_rc_query_old_firmware
,
4127 .allowed_protos
= RC_TYPE_RC5
|
4130 .change_protocol
= dib0700_change_protocol
,
4132 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4138 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4139 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4140 .pid_filter_count
= 32,
4141 .pid_filter
= dib90x0_pid_filter
,
4142 .pid_filter_ctrl
= dib90x0_pid_filter_ctrl
,
4143 .frontend_attach
= nim9090md_frontend_attach
,
4144 .tuner_attach
= nim9090md_tuner_attach
,
4146 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4149 sizeof(struct dib0700_adapter_state
),
4153 .num_device_descs
= 1,
4155 { "DiBcom NIM9090MD reference design",
4156 { &dib0700_usb_id_table
[71], NULL
},
4162 .rc_interval
= DEFAULT_RC_INTERVAL
,
4163 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4164 .module_name
= "dib0700",
4165 .rc_query
= dib0700_rc_query_old_firmware
,
4166 .allowed_protos
= RC_TYPE_RC5
|
4169 .change_protocol
= dib0700_change_protocol
,
4171 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4177 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4178 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4179 .pid_filter_count
= 32,
4180 .pid_filter
= stk70x0p_pid_filter
,
4181 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4182 .frontend_attach
= nim7090_frontend_attach
,
4183 .tuner_attach
= nim7090_tuner_attach
,
4185 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4188 sizeof(struct dib0700_adapter_state
),
4192 .num_device_descs
= 1,
4194 { "DiBcom NIM7090 reference design",
4195 { &dib0700_usb_id_table
[72], NULL
},
4201 .rc_interval
= DEFAULT_RC_INTERVAL
,
4202 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4203 .module_name
= "dib0700",
4204 .rc_query
= dib0700_rc_query_old_firmware
,
4205 .allowed_protos
= RC_TYPE_RC5
|
4208 .change_protocol
= dib0700_change_protocol
,
4210 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4216 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4217 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4218 .pid_filter_count
= 32,
4219 .pid_filter
= stk70x0p_pid_filter
,
4220 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4221 .frontend_attach
= tfe7090pvr_frontend0_attach
,
4222 .tuner_attach
= tfe7090pvr_tuner0_attach
,
4224 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4227 sizeof(struct dib0700_adapter_state
),
4232 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4233 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4234 .pid_filter_count
= 32,
4235 .pid_filter
= stk70x0p_pid_filter
,
4236 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4237 .frontend_attach
= tfe7090pvr_frontend1_attach
,
4238 .tuner_attach
= tfe7090pvr_tuner1_attach
,
4240 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4243 sizeof(struct dib0700_adapter_state
),
4247 .num_device_descs
= 1,
4249 { "DiBcom TFE7090PVR reference design",
4250 { &dib0700_usb_id_table
[73], NULL
},
4256 .rc_interval
= DEFAULT_RC_INTERVAL
,
4257 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4258 .module_name
= "dib0700",
4259 .rc_query
= dib0700_rc_query_old_firmware
,
4260 .allowed_protos
= RC_TYPE_RC5
|
4263 .change_protocol
= dib0700_change_protocol
,
4265 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4271 .frontend_attach
= pctv340e_frontend_attach
,
4272 .tuner_attach
= xc4000_tuner_attach
,
4274 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4276 .size_of_priv
= sizeof(struct
4277 dib0700_adapter_state
),
4281 .num_device_descs
= 2,
4283 { "Pinnacle PCTV 340e HD Pro USB Stick",
4284 { &dib0700_usb_id_table
[76], NULL
},
4287 { "Pinnacle PCTV Hybrid Stick Solo",
4288 { &dib0700_usb_id_table
[77], NULL
},
4293 .rc_interval
= DEFAULT_RC_INTERVAL
,
4294 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4295 .module_name
= "dib0700",
4296 .rc_query
= dib0700_rc_query_old_firmware
,
4297 .allowed_protos
= RC_TYPE_RC5
|
4300 .change_protocol
= dib0700_change_protocol
,
4302 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4308 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4309 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4310 .pid_filter_count
= 32,
4311 .pid_filter
= stk70x0p_pid_filter
,
4312 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4313 .frontend_attach
= tfe7090e_frontend_attach
,
4314 .tuner_attach
= tfe7090e_tuner_attach
,
4316 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4320 sizeof(struct dib0700_adapter_state
),
4324 .num_device_descs
= 1,
4326 { "DiBcom TFE7090E reference design",
4327 { &dib0700_usb_id_table
[78], NULL
},
4333 .rc_interval
= DEFAULT_RC_INTERVAL
,
4334 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4335 .module_name
= "dib0700",
4336 .rc_query
= dib0700_rc_query_old_firmware
,
4337 .allowed_protos
= RC_TYPE_RC5
|
4340 .change_protocol
= dib0700_change_protocol
,
4342 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4348 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4349 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4350 .pid_filter_count
= 32,
4351 .pid_filter
= stk70x0p_pid_filter
,
4352 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4353 .frontend_attach
= tfe7790e_frontend_attach
,
4354 .tuner_attach
= tfe7790e_tuner_attach
,
4356 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4360 sizeof(struct dib0700_adapter_state
),
4364 .num_device_descs
= 1,
4366 { "DiBcom TFE7790E reference design",
4367 { &dib0700_usb_id_table
[79], 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_TYPE_RC5
|
4380 .change_protocol
= dib0700_change_protocol
,
4385 int dib0700_device_count
= ARRAY_SIZE(dib0700_devices
);