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"
26 static int force_lna_activation
;
27 module_param(force_lna_activation
, int, 0644);
28 MODULE_PARM_DESC(force_lna_activation
, "force the activation of Low-Noise-Amplifyer(s) (LNA), "
29 "if applicable for the device (default: 0=automatic/off).");
31 struct dib0700_adapter_state
{
32 int (*set_param_save
) (struct dvb_frontend
*, struct dvb_frontend_parameters
*);
33 const struct firmware
*frontend_firmware
;
36 /* Hauppauge Nova-T 500 (aka Bristol)
37 * has a LNA on GPIO0 which is enabled by setting 1 */
38 static struct mt2060_config bristol_mt2060_config
[2] = {
48 static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config
= {
49 .band_caps
= BAND_VHF
| BAND_UHF
,
50 .setup
= (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
70 static struct dib3000mc_config bristol_dib3000mc_config
[2] = {
71 { .agc
= &bristol_dib3000p_mt2060_agc_config
,
73 .ln_adc_level
= 0x1cc7,
74 .output_mpeg2_in_188_bytes
= 1,
76 { .agc
= &bristol_dib3000p_mt2060_agc_config
,
78 .ln_adc_level
= 0x1cc7,
79 .output_mpeg2_in_188_bytes
= 1,
83 static int bristol_frontend_attach(struct dvb_usb_adapter
*adap
)
85 struct dib0700_state
*st
= adap
->dev
->priv
;
87 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0); msleep(10);
88 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1); msleep(10);
89 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0); msleep(10);
90 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1); msleep(10);
92 if (force_lna_activation
)
93 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
95 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 0);
97 if (dib3000mc_i2c_enumeration(&adap
->dev
->i2c_adap
, 2, DEFAULT_DIB3000P_I2C_ADDRESS
, bristol_dib3000mc_config
) != 0) {
98 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0); msleep(10);
102 st
->mt2060_if1
[adap
->id
] = 1220;
103 return (adap
->fe
= dvb_attach(dib3000mc_attach
, &adap
->dev
->i2c_adap
,
104 (10 + adap
->id
) << 1, &bristol_dib3000mc_config
[adap
->id
])) == NULL
? -ENODEV
: 0;
107 static int eeprom_read(struct i2c_adapter
*adap
,u8 adrs
,u8
*pval
)
109 struct i2c_msg msg
[2] = {
110 { .addr
= 0x50, .flags
= 0, .buf
= &adrs
, .len
= 1 },
111 { .addr
= 0x50, .flags
= I2C_M_RD
, .buf
= pval
, .len
= 1 },
113 if (i2c_transfer(adap
, msg
, 2) != 2) return -EREMOTEIO
;
117 static int bristol_tuner_attach(struct dvb_usb_adapter
*adap
)
119 struct i2c_adapter
*prim_i2c
= &adap
->dev
->i2c_adap
;
120 struct i2c_adapter
*tun_i2c
= dib3000mc_get_tuner_i2c_master(adap
->fe
, 1);
123 if (adap
->dev
->udev
->descriptor
.idVendor
== cpu_to_le16(USB_VID_HAUPPAUGE
) &&
124 adap
->dev
->udev
->descriptor
.idProduct
== cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2
)) {
125 if (!eeprom_read(prim_i2c
,0x59 + adap
->id
,&a
)) if1
=1220+a
;
127 return dvb_attach(mt2060_attach
,adap
->fe
, tun_i2c
,&bristol_mt2060_config
[adap
->id
],
128 if1
) == NULL
? -ENODEV
: 0;
131 /* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
134 static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config
[2] = {
138 /* 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,
139 * 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 */
140 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
141 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
176 BAND_VHF
| BAND_LBAND
,
178 /* 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,
179 * 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 */
180 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
181 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
218 static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config
= {
222 (3 << 14) | (1 << 12) | (524 << 0),
227 static struct dib7000p_config stk7700d_dib7000p_mt2266_config
[] = {
228 { .output_mpeg2_in_188_bytes
= 1,
229 .hostbus_diversity
= 1,
230 .tuner_is_baseband
= 1,
232 .agc_config_count
= 2,
233 .agc
= stk7700d_7000p_mt2266_agc_config
,
234 .bw
= &stk7700d_mt2266_pll_config
,
236 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
237 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
238 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
240 { .output_mpeg2_in_188_bytes
= 1,
241 .hostbus_diversity
= 1,
242 .tuner_is_baseband
= 1,
244 .agc_config_count
= 2,
245 .agc
= stk7700d_7000p_mt2266_agc_config
,
246 .bw
= &stk7700d_mt2266_pll_config
,
248 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
249 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
250 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
254 static struct mt2266_config stk7700d_mt2266_config
[2] = {
255 { .i2c_address
= 0x60
257 { .i2c_address
= 0x60
261 static int stk7700P2_frontend_attach(struct dvb_usb_adapter
*adap
)
264 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
266 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
267 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
268 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
269 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
271 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
273 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
274 stk7700d_dib7000p_mt2266_config
)
276 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__
);
281 adap
->fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
,0x80+(adap
->id
<< 1),
282 &stk7700d_dib7000p_mt2266_config
[adap
->id
]);
284 return adap
->fe
== NULL
? -ENODEV
: 0;
287 static int stk7700d_frontend_attach(struct dvb_usb_adapter
*adap
)
290 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
292 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
293 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
294 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
295 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
297 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
299 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
300 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 2, 18,
301 stk7700d_dib7000p_mt2266_config
)
303 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__
);
308 adap
->fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
,0x80+(adap
->id
<< 1),
309 &stk7700d_dib7000p_mt2266_config
[adap
->id
]);
311 return adap
->fe
== NULL
? -ENODEV
: 0;
314 static int stk7700d_tuner_attach(struct dvb_usb_adapter
*adap
)
316 struct i2c_adapter
*tun_i2c
;
317 tun_i2c
= dib7000p_get_i2c_master(adap
->fe
, DIBX000_I2C_INTERFACE_TUNER
, 1);
318 return dvb_attach(mt2266_attach
, adap
->fe
, tun_i2c
,
319 &stk7700d_mt2266_config
[adap
->id
]) == NULL
? -ENODEV
: 0;
322 /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
323 static struct dibx000_agc_config xc3028_agc_config
= {
324 BAND_VHF
| BAND_UHF
, /* band_caps */
326 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
327 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
328 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
329 (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
330 (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */
333 21, /* time_stabiliz */
345 39718, /* agc2_max */
354 29, /* agc2_slope1 */
355 29, /* agc2_slope2 */
362 1, /* perform_agc_softsplit */
365 /* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
366 static struct dibx000_bandwidth_config xc3028_bw_config
= {
367 60000, 30000, /* internal, sampling */
368 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
369 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc,
371 (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
372 (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
374 30000000, /* xtal_hz */
377 static struct dib7000p_config stk7700ph_dib7700_xc3028_config
= {
378 .output_mpeg2_in_188_bytes
= 1,
379 .tuner_is_baseband
= 1,
381 .agc_config_count
= 1,
382 .agc
= &xc3028_agc_config
,
383 .bw
= &xc3028_bw_config
,
385 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
386 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
387 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
390 static int stk7700ph_xc3028_callback(void *ptr
, int component
,
391 int command
, int arg
)
393 struct dvb_usb_adapter
*adap
= ptr
;
396 case XC2028_TUNER_RESET
:
397 /* Send the tuner in then out of reset */
398 dib7000p_set_gpio(adap
->fe
, 8, 0, 0); msleep(10);
399 dib7000p_set_gpio(adap
->fe
, 8, 0, 1);
401 case XC2028_RESET_CLK
:
404 err("%s: unknown command %d, arg %d\n", __func__
,
411 static struct xc2028_ctrl stk7700ph_xc3028_ctrl
= {
412 .fname
= XC2028_DEFAULT_FIRMWARE
,
414 .demod
= XC3028_FE_DIBCOM52
,
417 static struct xc2028_config stk7700ph_xc3028_config
= {
419 .ctrl
= &stk7700ph_xc3028_ctrl
,
422 static int stk7700ph_frontend_attach(struct dvb_usb_adapter
*adap
)
424 struct usb_device_descriptor
*desc
= &adap
->dev
->udev
->descriptor
;
426 if (desc
->idVendor
== cpu_to_le16(USB_VID_PINNACLE
) &&
427 desc
->idProduct
== cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX
))
428 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
430 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
432 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
433 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
434 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
435 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
437 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
439 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
442 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
443 &stk7700ph_dib7700_xc3028_config
) != 0) {
444 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
449 adap
->fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x80,
450 &stk7700ph_dib7700_xc3028_config
);
452 return adap
->fe
== NULL
? -ENODEV
: 0;
455 static int stk7700ph_tuner_attach(struct dvb_usb_adapter
*adap
)
457 struct i2c_adapter
*tun_i2c
;
459 tun_i2c
= dib7000p_get_i2c_master(adap
->fe
,
460 DIBX000_I2C_INTERFACE_TUNER
, 1);
462 stk7700ph_xc3028_config
.i2c_adap
= tun_i2c
;
464 /* FIXME: generalize & move to common area */
465 adap
->fe
->callback
= stk7700ph_xc3028_callback
;
467 return dvb_attach(xc2028_attach
, adap
->fe
, &stk7700ph_xc3028_config
)
468 == NULL
? -ENODEV
: 0;
471 #define DEFAULT_RC_INTERVAL 50
473 static u8 rc_request
[] = { REQUEST_POLL_RC
, 0 };
475 /* Number of keypresses to ignore before start repeating */
476 #define RC_REPEAT_DELAY 6
479 * This function is used only when firmware is < 1.20 version. Newer
480 * firmwares use bulk mode, with functions implemented at dib0700_core,
481 * at dib0700_rc_urb_completion()
483 static int dib0700_rc_query_old_firmware(struct dvb_usb_device
*d
)
489 struct dib0700_state
*st
= d
->priv
;
491 if (st
->fw_version
>= 0x10200) {
492 /* For 1.20 firmware , We need to keep the RC polling
493 callback so we can reuse the input device setup in
494 dvb-usb-remote.c. However, the actual work is being done
495 in the bulk URB completion handler. */
499 i
= dib0700_ctrl_rd(d
, rc_request
, 2, key
, 4);
501 err("RC Query Failed");
505 /* losing half of KEY_0 events from Philipps rc5 remotes.. */
506 if (key
[0] == 0 && key
[1] == 0 && key
[2] == 0 && key
[3] == 0)
509 /* 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]); */
511 dib0700_rc_setup(d
); /* reset ir sensor data to prevent false events */
514 switch (d
->props
.rc
.core
.protocol
) {
516 /* NEC protocol sends repeat code as 0 0 0 FF */
517 if ((key
[3-2] == 0x00) && (key
[3-3] == 0x00) &&
519 keycode
= d
->last_event
;
521 keycode
= key
[3-2] << 8 | key
[3-3];
522 d
->last_event
= keycode
;
525 rc_keydown(d
->rc_dev
, keycode
, 0);
528 /* RC-5 protocol changes toggle bit on new keypress */
529 keycode
= key
[3-2] << 8 | key
[3-3];
531 rc_keydown(d
->rc_dev
, keycode
, toggle
);
538 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
539 static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config
= {
542 /* 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,
543 * 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 */
544 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
545 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
585 static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config
= {
588 /* 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,
589 * 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 */
590 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
591 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
631 static struct dibx000_bandwidth_config stk7700p_pll_config
= {
635 (3 << 14) | (1 << 12) | (524 << 0),
641 static struct dib7000m_config stk7700p_dib7000m_config
= {
643 .output_mpeg2_in_188_bytes
= 1,
646 .agc_config_count
= 1,
647 .agc
= &stk7700p_7000m_mt2060_agc_config
,
648 .bw
= &stk7700p_pll_config
,
650 .gpio_dir
= DIB7000M_GPIO_DEFAULT_DIRECTIONS
,
651 .gpio_val
= DIB7000M_GPIO_DEFAULT_VALUES
,
652 .gpio_pwm_pos
= DIB7000M_GPIO_DEFAULT_PWM_POS
,
655 static struct dib7000p_config stk7700p_dib7000p_config
= {
656 .output_mpeg2_in_188_bytes
= 1,
658 .agc_config_count
= 1,
659 .agc
= &stk7700p_7000p_mt2060_agc_config
,
660 .bw
= &stk7700p_pll_config
,
662 .gpio_dir
= DIB7000M_GPIO_DEFAULT_DIRECTIONS
,
663 .gpio_val
= DIB7000M_GPIO_DEFAULT_VALUES
,
664 .gpio_pwm_pos
= DIB7000M_GPIO_DEFAULT_PWM_POS
,
667 static int stk7700p_frontend_attach(struct dvb_usb_adapter
*adap
)
669 struct dib0700_state
*st
= adap
->dev
->priv
;
670 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
672 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
673 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0); msleep(50);
675 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1); msleep(10);
676 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
678 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0); msleep(10);
679 dib0700_ctrl_clock(adap
->dev
, 72, 1);
680 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1); msleep(100);
682 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
684 st
->mt2060_if1
[0] = 1220;
686 if (dib7000pc_detection(&adap
->dev
->i2c_adap
)) {
687 adap
->fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 18, &stk7700p_dib7000p_config
);
688 st
->is_dib7000pc
= 1;
690 adap
->fe
= dvb_attach(dib7000m_attach
, &adap
->dev
->i2c_adap
, 18, &stk7700p_dib7000m_config
);
692 return adap
->fe
== NULL
? -ENODEV
: 0;
695 static struct mt2060_config stk7700p_mt2060_config
= {
699 static int stk7700p_tuner_attach(struct dvb_usb_adapter
*adap
)
701 struct i2c_adapter
*prim_i2c
= &adap
->dev
->i2c_adap
;
702 struct dib0700_state
*st
= adap
->dev
->priv
;
703 struct i2c_adapter
*tun_i2c
;
706 if (adap
->dev
->udev
->descriptor
.idVendor
== cpu_to_le16(USB_VID_HAUPPAUGE
) &&
707 adap
->dev
->udev
->descriptor
.idProduct
== cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK
)) {
708 if (!eeprom_read(prim_i2c
,0x58,&a
)) if1
=1220+a
;
710 if (st
->is_dib7000pc
)
711 tun_i2c
= dib7000p_get_i2c_master(adap
->fe
, DIBX000_I2C_INTERFACE_TUNER
, 1);
713 tun_i2c
= dib7000m_get_i2c_master(adap
->fe
, DIBX000_I2C_INTERFACE_TUNER
, 1);
715 return dvb_attach(mt2060_attach
, adap
->fe
, tun_i2c
, &stk7700p_mt2060_config
,
716 if1
) == NULL
? -ENODEV
: 0;
719 /* DIB7070 generic */
720 static struct dibx000_agc_config dib7070_agc_config
= {
721 BAND_UHF
| BAND_VHF
| BAND_LBAND
| BAND_SBAND
,
722 /* 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,
723 * 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 */
724 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
725 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
762 static int dib7070_tuner_reset(struct dvb_frontend
*fe
, int onoff
)
764 deb_info("reset: %d", onoff
);
765 return dib7000p_set_gpio(fe
, 8, 0, !onoff
);
768 static int dib7070_tuner_sleep(struct dvb_frontend
*fe
, int onoff
)
770 deb_info("sleep: %d", onoff
);
771 return dib7000p_set_gpio(fe
, 9, 0, onoff
);
774 static struct dib0070_config dib7070p_dib0070_config
[2] = {
776 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
777 .reset
= dib7070_tuner_reset
,
778 .sleep
= dib7070_tuner_sleep
,
780 .clock_pad_drive
= 4,
783 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
784 .reset
= dib7070_tuner_reset
,
785 .sleep
= dib7070_tuner_sleep
,
791 static struct dib0070_config dib7770p_dib0070_config
= {
792 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
793 .reset
= dib7070_tuner_reset
,
794 .sleep
= dib7070_tuner_sleep
,
796 .clock_pad_drive
= 0,
801 static int dib7070_set_param_override(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*fep
)
803 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
804 struct dib0700_adapter_state
*state
= adap
->priv
;
807 u8 band
= BAND_OF_FREQUENCY(fep
->frequency
/1000);
809 case BAND_VHF
: offset
= 950; break;
811 default: offset
= 550; break;
813 deb_info("WBD for DiB7000P: %d\n", offset
+ dib0070_wbd_offset(fe
));
814 dib7000p_set_wbd_ref(fe
, offset
+ dib0070_wbd_offset(fe
));
815 return state
->set_param_save(fe
, fep
);
818 static int dib7770_set_param_override(struct dvb_frontend
*fe
,
819 struct dvb_frontend_parameters
*fep
)
821 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
822 struct dib0700_adapter_state
*state
= adap
->priv
;
825 u8 band
= BAND_OF_FREQUENCY(fep
->frequency
/1000);
828 dib7000p_set_gpio(fe
, 0, 0, 1);
833 dib7000p_set_gpio(fe
, 0, 0, 0);
837 deb_info("WBD for DiB7000P: %d\n", offset
+ dib0070_wbd_offset(fe
));
838 dib7000p_set_wbd_ref(fe
, offset
+ dib0070_wbd_offset(fe
));
839 return state
->set_param_save(fe
, fep
);
842 static int dib7770p_tuner_attach(struct dvb_usb_adapter
*adap
)
844 struct dib0700_adapter_state
*st
= adap
->priv
;
845 struct i2c_adapter
*tun_i2c
= dib7000p_get_i2c_master(adap
->fe
,
846 DIBX000_I2C_INTERFACE_TUNER
, 1);
848 if (dvb_attach(dib0070_attach
, adap
->fe
, tun_i2c
,
849 &dib7770p_dib0070_config
) == NULL
)
852 st
->set_param_save
= adap
->fe
->ops
.tuner_ops
.set_params
;
853 adap
->fe
->ops
.tuner_ops
.set_params
= dib7770_set_param_override
;
857 static int dib7070p_tuner_attach(struct dvb_usb_adapter
*adap
)
859 struct dib0700_adapter_state
*st
= adap
->priv
;
860 struct i2c_adapter
*tun_i2c
= dib7000p_get_i2c_master(adap
->fe
, DIBX000_I2C_INTERFACE_TUNER
, 1);
863 if (dvb_attach(dib0070_attach
, adap
->fe
, tun_i2c
, &dib7070p_dib0070_config
[0]) == NULL
)
866 if (dvb_attach(dib0070_attach
, adap
->fe
, tun_i2c
, &dib7070p_dib0070_config
[1]) == NULL
)
870 st
->set_param_save
= adap
->fe
->ops
.tuner_ops
.set_params
;
871 adap
->fe
->ops
.tuner_ops
.set_params
= dib7070_set_param_override
;
875 static int stk7700p_pid_filter(struct dvb_usb_adapter
*adapter
, int index
,
878 struct dib0700_state
*st
= adapter
->dev
->priv
;
879 if (st
->is_dib7000pc
)
880 return dib7000p_pid_filter(adapter
->fe
, index
, pid
, onoff
);
881 return dib7000m_pid_filter(adapter
->fe
, index
, pid
, onoff
);
884 static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter
*adapter
, int onoff
)
886 struct dib0700_state
*st
= adapter
->dev
->priv
;
887 if (st
->is_dib7000pc
)
888 return dib7000p_pid_filter_ctrl(adapter
->fe
, onoff
);
889 return dib7000m_pid_filter_ctrl(adapter
->fe
, onoff
);
892 static int stk70x0p_pid_filter(struct dvb_usb_adapter
*adapter
, int index
, u16 pid
, int onoff
)
894 return dib7000p_pid_filter(adapter
->fe
, index
, pid
, onoff
);
897 static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter
*adapter
, int onoff
)
899 return dib7000p_pid_filter_ctrl(adapter
->fe
, onoff
);
902 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz
= {
906 (3 << 14) | (1 << 12) | (524 << 0),
912 static struct dib7000p_config dib7070p_dib7000p_config
= {
913 .output_mpeg2_in_188_bytes
= 1,
915 .agc_config_count
= 1,
916 .agc
= &dib7070_agc_config
,
917 .bw
= &dib7070_bw_config_12_mhz
,
918 .tuner_is_baseband
= 1,
921 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
922 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
923 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
925 .hostbus_diversity
= 1,
929 static int stk7070p_frontend_attach(struct dvb_usb_adapter
*adap
)
931 struct usb_device_descriptor
*p
= &adap
->dev
->udev
->descriptor
;
932 if (p
->idVendor
== cpu_to_le16(USB_VID_PINNACLE
) &&
933 p
->idProduct
== cpu_to_le16(USB_PID_PINNACLE_PCTV72E
))
934 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
936 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
938 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
939 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
940 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
941 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
943 dib0700_ctrl_clock(adap
->dev
, 72, 1);
946 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
948 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
950 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
951 &dib7070p_dib7000p_config
) != 0) {
952 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
957 adap
->fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x80,
958 &dib7070p_dib7000p_config
);
959 return adap
->fe
== NULL
? -ENODEV
: 0;
963 static struct dib7000p_config dib7770p_dib7000p_config
= {
964 .output_mpeg2_in_188_bytes
= 1,
966 .agc_config_count
= 1,
967 .agc
= &dib7070_agc_config
,
968 .bw
= &dib7070_bw_config_12_mhz
,
969 .tuner_is_baseband
= 1,
972 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
973 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
974 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
976 .hostbus_diversity
= 1,
977 .enable_current_mirror
= 1,
978 .disable_sample_and_hold
= 0,
981 static int stk7770p_frontend_attach(struct dvb_usb_adapter
*adap
)
983 struct usb_device_descriptor
*p
= &adap
->dev
->udev
->descriptor
;
984 if (p
->idVendor
== cpu_to_le16(USB_VID_PINNACLE
) &&
985 p
->idProduct
== cpu_to_le16(USB_PID_PINNACLE_PCTV72E
))
986 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
988 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
990 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
991 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
992 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
993 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
995 dib0700_ctrl_clock(adap
->dev
, 72, 1);
998 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1000 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1002 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
1003 &dib7770p_dib7000p_config
) != 0) {
1004 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1009 adap
->fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x80,
1010 &dib7770p_dib7000p_config
);
1011 return adap
->fe
== NULL
? -ENODEV
: 0;
1014 /* DIB807x generic */
1015 static struct dibx000_agc_config dib807x_agc_config
[2] = {
1018 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1019 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1020 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1021 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1023 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1024 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1025 (0 << 0), /* setup*/
1028 10, /* time_stabiliz*/
1038 65535, /* agc1_max*/
1041 65535, /* agc2_max*/
1047 206, /* agc1_slope1*/
1048 255, /* agc1_slope2*/
1051 88, /* agc2_slope1*/
1052 90, /* agc2_slope2*/
1059 0, /* perform_agc_softsplit*/
1062 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1063 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1064 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1065 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1067 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1068 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1069 (0 << 0), /* setup */
1072 10, /* time_stabiliz*/
1082 65535, /* agc1_max*/
1085 65535, /* agc2_max*/
1091 206, /* agc1_slope1*/
1092 255, /* agc1_slope2*/
1095 88, /* agc2_slope1*/
1096 90, /* agc2_slope2*/
1103 0, /* perform_agc_softsplit*/
1107 static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz
= {
1108 60000, 15000, /* internal, sampling*/
1109 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/
1110 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
1112 (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1113 (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1115 12000000, /* xtal_hz*/
1118 static struct dib8000_config dib807x_dib8000_config
[2] = {
1120 .output_mpeg2_in_188_bytes
= 1,
1122 .agc_config_count
= 2,
1123 .agc
= dib807x_agc_config
,
1124 .pll
= &dib807x_bw_config_12_mhz
,
1125 .tuner_is_baseband
= 1,
1127 .gpio_dir
= DIB8000_GPIO_DEFAULT_DIRECTIONS
,
1128 .gpio_val
= DIB8000_GPIO_DEFAULT_VALUES
,
1129 .gpio_pwm_pos
= DIB8000_GPIO_DEFAULT_PWM_POS
,
1131 .hostbus_diversity
= 1,
1133 .agc_control
= &dib0070_ctrl_agc_filter
,
1134 .output_mode
= OUTMODE_MPEG2_FIFO
,
1137 .output_mpeg2_in_188_bytes
= 1,
1139 .agc_config_count
= 2,
1140 .agc
= dib807x_agc_config
,
1141 .pll
= &dib807x_bw_config_12_mhz
,
1142 .tuner_is_baseband
= 1,
1144 .gpio_dir
= DIB8000_GPIO_DEFAULT_DIRECTIONS
,
1145 .gpio_val
= DIB8000_GPIO_DEFAULT_VALUES
,
1146 .gpio_pwm_pos
= DIB8000_GPIO_DEFAULT_PWM_POS
,
1148 .hostbus_diversity
= 1,
1149 .agc_control
= &dib0070_ctrl_agc_filter
,
1150 .output_mode
= OUTMODE_MPEG2_FIFO
,
1155 static int dib80xx_tuner_reset(struct dvb_frontend
*fe
, int onoff
)
1157 return dib8000_set_gpio(fe
, 5, 0, !onoff
);
1160 static int dib80xx_tuner_sleep(struct dvb_frontend
*fe
, int onoff
)
1162 return dib8000_set_gpio(fe
, 0, 0, onoff
);
1165 static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg
[] = {
1170 static struct dib0070_config dib807x_dib0070_config
[2] = {
1172 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
1173 .reset
= dib80xx_tuner_reset
,
1174 .sleep
= dib80xx_tuner_sleep
,
1176 .clock_pad_drive
= 4,
1178 .force_crystal_mode
= 1,
1179 .enable_third_order_filter
= 1,
1181 .wbd_gain
= dib8070_wbd_gain_cfg
,
1182 .osc_buffer_state
= 0,
1183 .freq_offset_khz_uhf
= -100,
1184 .freq_offset_khz_vhf
= -100,
1186 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
1187 .reset
= dib80xx_tuner_reset
,
1188 .sleep
= dib80xx_tuner_sleep
,
1190 .clock_pad_drive
= 2,
1192 .force_crystal_mode
= 1,
1193 .enable_third_order_filter
= 1,
1195 .wbd_gain
= dib8070_wbd_gain_cfg
,
1196 .osc_buffer_state
= 0,
1197 .freq_offset_khz_uhf
= -25,
1198 .freq_offset_khz_vhf
= -25,
1202 static int dib807x_set_param_override(struct dvb_frontend
*fe
,
1203 struct dvb_frontend_parameters
*fep
)
1205 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
1206 struct dib0700_adapter_state
*state
= adap
->priv
;
1208 u16 offset
= dib0070_wbd_offset(fe
);
1209 u8 band
= BAND_OF_FREQUENCY(fep
->frequency
/1000);
1214 case BAND_UHF
: /* fall-thru wanted */
1216 offset
+= 250; break;
1218 deb_info("WBD for DiB8000: %d\n", offset
);
1219 dib8000_set_wbd_ref(fe
, offset
);
1221 return state
->set_param_save(fe
, fep
);
1224 static int dib807x_tuner_attach(struct dvb_usb_adapter
*adap
)
1226 struct dib0700_adapter_state
*st
= adap
->priv
;
1227 struct i2c_adapter
*tun_i2c
= dib8000_get_i2c_master(adap
->fe
,
1228 DIBX000_I2C_INTERFACE_TUNER
, 1);
1230 if (adap
->id
== 0) {
1231 if (dvb_attach(dib0070_attach
, adap
->fe
, tun_i2c
,
1232 &dib807x_dib0070_config
[0]) == NULL
)
1235 if (dvb_attach(dib0070_attach
, adap
->fe
, tun_i2c
,
1236 &dib807x_dib0070_config
[1]) == NULL
)
1240 st
->set_param_save
= adap
->fe
->ops
.tuner_ops
.set_params
;
1241 adap
->fe
->ops
.tuner_ops
.set_params
= dib807x_set_param_override
;
1245 static int stk80xx_pid_filter(struct dvb_usb_adapter
*adapter
, int index
,
1248 return dib8000_pid_filter(adapter
->fe
, index
, pid
, onoff
);
1251 static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter
*adapter
,
1254 return dib8000_pid_filter_ctrl(adapter
->fe
, onoff
);
1258 static int stk807x_frontend_attach(struct dvb_usb_adapter
*adap
)
1260 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
1262 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
1263 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
1264 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1266 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1268 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1271 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1273 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1275 dib8000_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
1278 adap
->fe
= dvb_attach(dib8000_attach
, &adap
->dev
->i2c_adap
, 0x80,
1279 &dib807x_dib8000_config
[0]);
1281 return adap
->fe
== NULL
? -ENODEV
: 0;
1285 static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter
*adap
)
1287 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
1289 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
1291 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
1292 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
1293 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1295 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1297 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1300 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1302 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1304 /* initialize IC 0 */
1305 dib8000_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x22, 0x80);
1307 adap
->fe
= dvb_attach(dib8000_attach
, &adap
->dev
->i2c_adap
, 0x80,
1308 &dib807x_dib8000_config
[0]);
1310 return adap
->fe
== NULL
? -ENODEV
: 0;
1313 static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter
*adap
)
1315 /* initialize IC 1 */
1316 dib8000_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x12, 0x82);
1318 adap
->fe
= dvb_attach(dib8000_attach
, &adap
->dev
->i2c_adap
, 0x82,
1319 &dib807x_dib8000_config
[1]);
1321 return adap
->fe
== NULL
? -ENODEV
: 0;
1325 struct dibx000_agc_config dib8090_agc_config
[2] = {
1327 BAND_UHF
| BAND_VHF
| BAND_LBAND
| BAND_SBAND
,
1328 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1329 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1330 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1331 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1332 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1370 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1371 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1372 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1373 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1374 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1412 static struct dibx000_bandwidth_config dib8090_pll_config_12mhz
= {
1416 (3 << 14) | (1 << 12) | (599 << 0),
1422 static int dib8090_get_adc_power(struct dvb_frontend
*fe
)
1424 return dib8000_get_adc_power(fe
, 1);
1427 static struct dib8000_config dib809x_dib8000_config
[2] = {
1429 .output_mpeg2_in_188_bytes
= 1,
1431 .agc_config_count
= 2,
1432 .agc
= dib8090_agc_config
,
1433 .agc_control
= dib0090_dcc_freq
,
1434 .pll
= &dib8090_pll_config_12mhz
,
1435 .tuner_is_baseband
= 1,
1437 .gpio_dir
= DIB8000_GPIO_DEFAULT_DIRECTIONS
,
1438 .gpio_val
= DIB8000_GPIO_DEFAULT_VALUES
,
1439 .gpio_pwm_pos
= DIB8000_GPIO_DEFAULT_PWM_POS
,
1441 .hostbus_diversity
= 1,
1443 .output_mode
= OUTMODE_MPEG2_FIFO
,
1445 .diversity_delay
= 48,
1448 .output_mpeg2_in_188_bytes
= 1,
1450 .agc_config_count
= 2,
1451 .agc
= dib8090_agc_config
,
1452 .agc_control
= dib0090_dcc_freq
,
1453 .pll
= &dib8090_pll_config_12mhz
,
1454 .tuner_is_baseband
= 1,
1456 .gpio_dir
= DIB8000_GPIO_DEFAULT_DIRECTIONS
,
1457 .gpio_val
= DIB8000_GPIO_DEFAULT_VALUES
,
1458 .gpio_pwm_pos
= DIB8000_GPIO_DEFAULT_PWM_POS
,
1460 .hostbus_diversity
= 1,
1462 .output_mode
= OUTMODE_DIVERSITY
,
1464 .diversity_delay
= 1,
1469 static struct dib0090_wbd_slope dib8090_wbd_table
[] = {
1470 /* max freq ; cold slope ; cold offset ; warm slope ; warm offset ; wbd gain */
1471 { 120, 0, 500, 0, 500, 4 }, /* CBAND */
1472 { 170, 0, 450, 0, 450, 4 }, /* CBAND */
1473 { 380, 48, 373, 28, 259, 6 }, /* VHF */
1474 { 860, 34, 700, 36, 616, 6 }, /* high UHF */
1475 { 0xFFFF, 34, 700, 36, 616, 6 }, /* default */
1478 static struct dib0090_config dib809x_dib0090_config
= {
1482 .io
.pll_loopdiv
= 20,
1483 .io
.adc_clock_ratio
= 8,
1484 .io
.pll_int_loop_filt
= 0,
1485 .io
.clock_khz
= 12000,
1486 .reset
= dib80xx_tuner_reset
,
1487 .sleep
= dib80xx_tuner_sleep
,
1490 .i2c_address
= DEFAULT_DIB0090_I2C_ADDRESS
,
1493 .get_adc_power
= dib8090_get_adc_power
,
1494 .freq_offset_khz_uhf
= -63,
1495 .freq_offset_khz_vhf
= -143,
1496 .wbd
= dib8090_wbd_table
,
1497 .fref_clock_ratio
= 6,
1500 static int dib8096_set_param_override(struct dvb_frontend
*fe
,
1501 struct dvb_frontend_parameters
*fep
)
1503 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
1504 struct dib0700_adapter_state
*state
= adap
->priv
;
1505 u8 band
= BAND_OF_FREQUENCY(fep
->frequency
/1000);
1508 enum frontend_tune_state tune_state
= CT_SHUTDOWN
;
1509 u16 ltgain
, rf_gain_limit
;
1511 ret
= state
->set_param_save(fe
, fep
);
1515 target
= (dib0090_get_wbd_offset(fe
) * 8 * 18 / 33 + 1) / 2;
1516 dib8000_set_wbd_ref(fe
, target
);
1519 if (band
== BAND_CBAND
) {
1520 deb_info("tuning in CBAND - soft-AGC startup\n");
1521 dib0090_set_tune_state(fe
, CT_AGC_START
);
1523 ret
= dib0090_gain_control(fe
);
1525 tune_state
= dib0090_get_tune_state(fe
);
1526 if (tune_state
== CT_AGC_STEP_0
)
1527 dib8000_set_gpio(fe
, 6, 0, 1);
1528 else if (tune_state
== CT_AGC_STEP_1
) {
1529 dib0090_get_current_gain(fe
, NULL
, NULL
, &rf_gain_limit
, <gain
);
1530 if (rf_gain_limit
== 0)
1531 dib8000_set_gpio(fe
, 6, 0, 0);
1533 } while (tune_state
< CT_AGC_STOP
);
1534 dib0090_pwm_gain_reset(fe
);
1535 dib8000_pwm_agc_reset(fe
);
1536 dib8000_set_tune_state(fe
, CT_DEMOD_START
);
1538 deb_info("not tuning in CBAND - standard AGC startup\n");
1539 dib0090_pwm_gain_reset(fe
);
1545 static int dib809x_tuner_attach(struct dvb_usb_adapter
*adap
)
1547 struct dib0700_adapter_state
*st
= adap
->priv
;
1548 struct i2c_adapter
*tun_i2c
= dib8000_get_i2c_master(adap
->fe
, DIBX000_I2C_INTERFACE_TUNER
, 1);
1550 if (dvb_attach(dib0090_register
, adap
->fe
, tun_i2c
, &dib809x_dib0090_config
) == NULL
)
1553 st
->set_param_save
= adap
->fe
->ops
.tuner_ops
.set_params
;
1554 adap
->fe
->ops
.tuner_ops
.set_params
= dib8096_set_param_override
;
1558 static int stk809x_frontend_attach(struct dvb_usb_adapter
*adap
)
1560 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
1562 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
1563 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
1564 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1566 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1568 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1571 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1573 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1575 dib8000_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18, 0x80);
1577 adap
->fe
= dvb_attach(dib8000_attach
, &adap
->dev
->i2c_adap
, 0x80, &dib809x_dib8000_config
[0]);
1579 return adap
->fe
== NULL
? -ENODEV
: 0;
1582 static int nim8096md_tuner_attach(struct dvb_usb_adapter
*adap
)
1584 struct dib0700_adapter_state
*st
= adap
->priv
;
1585 struct i2c_adapter
*tun_i2c
;
1586 struct dvb_frontend
*fe_slave
= dib8000_get_slave_frontend(adap
->fe
, 1);
1589 tun_i2c
= dib8000_get_i2c_master(fe_slave
, DIBX000_I2C_INTERFACE_TUNER
, 1);
1590 if (dvb_attach(dib0090_register
, fe_slave
, tun_i2c
, &dib809x_dib0090_config
) == NULL
)
1592 fe_slave
->dvb
= adap
->fe
->dvb
;
1593 fe_slave
->ops
.tuner_ops
.set_params
= dib8096_set_param_override
;
1595 tun_i2c
= dib8000_get_i2c_master(adap
->fe
, DIBX000_I2C_INTERFACE_TUNER
, 1);
1596 if (dvb_attach(dib0090_register
, adap
->fe
, tun_i2c
, &dib809x_dib0090_config
) == NULL
)
1599 st
->set_param_save
= adap
->fe
->ops
.tuner_ops
.set_params
;
1600 adap
->fe
->ops
.tuner_ops
.set_params
= dib8096_set_param_override
;
1605 static int nim8096md_frontend_attach(struct dvb_usb_adapter
*adap
)
1607 struct dvb_frontend
*fe_slave
;
1609 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
1611 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
1613 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
1614 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
1615 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1617 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1619 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1622 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1624 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1626 dib8000_i2c_enumeration(&adap
->dev
->i2c_adap
, 2, 18, 0x80);
1628 adap
->fe
= dvb_attach(dib8000_attach
, &adap
->dev
->i2c_adap
, 0x80, &dib809x_dib8000_config
[0]);
1629 if (adap
->fe
== NULL
)
1632 fe_slave
= dvb_attach(dib8000_attach
, &adap
->dev
->i2c_adap
, 0x82, &dib809x_dib8000_config
[1]);
1633 dib8000_set_slave_frontend(adap
->fe
, fe_slave
);
1635 return fe_slave
== NULL
? -ENODEV
: 0;
1639 static int dib90x0_pid_filter(struct dvb_usb_adapter
*adapter
, int index
, u16 pid
, int onoff
)
1641 return dib9000_fw_pid_filter(adapter
->fe
, index
, pid
, onoff
);
1644 static int dib90x0_pid_filter_ctrl(struct dvb_usb_adapter
*adapter
, int onoff
)
1646 return dib9000_fw_pid_filter_ctrl(adapter
->fe
, onoff
);
1649 static int dib90x0_tuner_reset(struct dvb_frontend
*fe
, int onoff
)
1651 return dib9000_set_gpio(fe
, 5, 0, !onoff
);
1654 static int dib90x0_tuner_sleep(struct dvb_frontend
*fe
, int onoff
)
1656 return dib9000_set_gpio(fe
, 0, 0, onoff
);
1659 static int dib01x0_pmu_update(struct i2c_adapter
*i2c
, u16
*data
, u8 len
)
1661 u8 wb
[4] = { 0xc >> 8, 0xc & 0xff, 0, 0 };
1663 struct i2c_msg msg
[2] = {
1664 {.addr
= 0x1e >> 1, .flags
= 0, .buf
= wb
, .len
= 2},
1665 {.addr
= 0x1e >> 1, .flags
= I2C_M_RD
, .buf
= rb
, .len
= 2},
1669 dibx000_i2c_set_speed(i2c
, 250);
1671 if (i2c_transfer(i2c
, msg
, 2) != 2)
1674 switch (rb
[0] << 8 | rb
[1]) {
1676 deb_info("Found DiB0170 rev1: This version of DiB0170 is not supported any longer.\n");
1679 deb_info("Found DiB0170 rev2");
1682 deb_info("Found DiB0190 rev2");
1685 deb_info("DiB01x0 not found");
1689 for (index_data
= 0; index_data
< len
; index_data
+= 2) {
1690 wb
[2] = (data
[index_data
+ 1] >> 8) & 0xff;
1691 wb
[3] = (data
[index_data
+ 1]) & 0xff;
1693 if (data
[index_data
] == 0) {
1694 wb
[0] = (data
[index_data
] >> 8) & 0xff;
1695 wb
[1] = (data
[index_data
]) & 0xff;
1697 if (i2c_transfer(i2c
, msg
, 2) != 2)
1700 wb
[3] |= rb
[1] & ~(3 << 4);
1703 wb
[0] = (data
[index_data
] >> 8)&0xff;
1704 wb
[1] = (data
[index_data
])&0xff;
1706 if (i2c_transfer(i2c
, &msg
[0], 1) != 1)
1712 static struct dib9000_config stk9090m_config
= {
1713 .output_mpeg2_in_188_bytes
= 1,
1714 .output_mode
= OUTMODE_MPEG2_FIFO
,
1715 .vcxo_timer
= 279620,
1716 .timing_frequency
= 20452225,
1717 .demod_clock_khz
= 60000,
1718 .xtal_clock_khz
= 30000,
1719 .if_drives
= (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
1723 { 240, { BOARD_GPIO_COMPONENT_DEMOD
, BOARD_GPIO_FUNCTION_SUBBAND_GPIO
, 0x0008, 0x0000, 0x0008 } }, /* GPIO 3 to 1 for VHF */
1724 { 890, { BOARD_GPIO_COMPONENT_DEMOD
, BOARD_GPIO_FUNCTION_SUBBAND_GPIO
, 0x0008, 0x0000, 0x0000 } }, /* GPIO 3 to 0 for UHF */
1729 { .component
= BOARD_GPIO_COMPONENT_DEMOD
, .function
= BOARD_GPIO_FUNCTION_COMPONENT_ON
, .mask
= 0x10 | 0x21, .direction
= 0 & ~0x21, .value
= (0x10 & ~0x1) | 0x20 },
1730 { .component
= BOARD_GPIO_COMPONENT_DEMOD
, .function
= BOARD_GPIO_FUNCTION_COMPONENT_OFF
, .mask
= 0x10 | 0x21, .direction
= 0 & ~0x21, .value
= 0 | 0x21 },
1734 static struct dib9000_config nim9090md_config
[2] = {
1736 .output_mpeg2_in_188_bytes
= 1,
1737 .output_mode
= OUTMODE_MPEG2_FIFO
,
1738 .vcxo_timer
= 279620,
1739 .timing_frequency
= 20452225,
1740 .demod_clock_khz
= 60000,
1741 .xtal_clock_khz
= 30000,
1742 .if_drives
= (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
1744 .output_mpeg2_in_188_bytes
= 1,
1745 .output_mode
= OUTMODE_DIVERSITY
,
1746 .vcxo_timer
= 279620,
1747 .timing_frequency
= 20452225,
1748 .demod_clock_khz
= 60000,
1749 .xtal_clock_khz
= 30000,
1750 .if_drives
= (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
1754 { 240, { BOARD_GPIO_COMPONENT_DEMOD
, BOARD_GPIO_FUNCTION_SUBBAND_GPIO
, 0x0006, 0x0000, 0x0006 } }, /* GPIO 1 and 2 to 1 for VHF */
1755 { 890, { BOARD_GPIO_COMPONENT_DEMOD
, BOARD_GPIO_FUNCTION_SUBBAND_GPIO
, 0x0006, 0x0000, 0x0000 } }, /* GPIO 1 and 2 to 0 for UHF */
1760 { .component
= BOARD_GPIO_COMPONENT_DEMOD
, .function
= BOARD_GPIO_FUNCTION_COMPONENT_ON
, .mask
= 0x10 | 0x21, .direction
= 0 & ~0x21, .value
= (0x10 & ~0x1) | 0x20 },
1761 { .component
= BOARD_GPIO_COMPONENT_DEMOD
, .function
= BOARD_GPIO_FUNCTION_COMPONENT_OFF
, .mask
= 0x10 | 0x21, .direction
= 0 & ~0x21, .value
= 0 | 0x21 },
1766 static struct dib0090_config dib9090_dib0090_config
= {
1770 .io
.pll_loopdiv
= 8,
1771 .io
.adc_clock_ratio
= 8,
1772 .io
.pll_int_loop_filt
= 0,
1773 .io
.clock_khz
= 30000,
1774 .reset
= dib90x0_tuner_reset
,
1775 .sleep
= dib90x0_tuner_sleep
,
1780 .freq_offset_khz_uhf
= 0,
1781 .freq_offset_khz_vhf
= 0,
1784 static struct dib0090_config nim9090md_dib0090_config
[2] = {
1789 .io
.pll_loopdiv
= 8,
1790 .io
.adc_clock_ratio
= 8,
1791 .io
.pll_int_loop_filt
= 0,
1792 .io
.clock_khz
= 30000,
1793 .reset
= dib90x0_tuner_reset
,
1794 .sleep
= dib90x0_tuner_sleep
,
1799 .freq_offset_khz_uhf
= 0,
1800 .freq_offset_khz_vhf
= 0,
1805 .io
.pll_loopdiv
= 8,
1806 .io
.adc_clock_ratio
= 8,
1807 .io
.pll_int_loop_filt
= 0,
1808 .io
.clock_khz
= 30000,
1809 .reset
= dib90x0_tuner_reset
,
1810 .sleep
= dib90x0_tuner_sleep
,
1815 .freq_offset_khz_uhf
= 0,
1816 .freq_offset_khz_vhf
= 0,
1821 static int stk9090m_frontend_attach(struct dvb_usb_adapter
*adap
)
1823 struct dib0700_adapter_state
*state
= adap
->priv
;
1824 struct dib0700_state
*st
= adap
->dev
->priv
;
1827 /* Make use of the new i2c functions from FW 1.20 */
1828 dib0700_get_version(adap
->dev
, NULL
, NULL
, &fw_version
, NULL
);
1829 if (fw_version
>= 0x10200)
1830 st
->fw_use_new_i2c_api
= 1;
1831 dib0700_set_i2c_speed(adap
->dev
, 340);
1833 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
1835 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
1836 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
1837 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1838 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1840 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1843 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1845 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1847 dib9000_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x10, 0x80);
1849 if (request_firmware(&state
->frontend_firmware
, "dib9090.fw", &adap
->dev
->udev
->dev
)) {
1850 deb_info("%s: Upload failed. (file not found?)\n", __func__
);
1853 deb_info("%s: firmware read %Zu bytes.\n", __func__
, state
->frontend_firmware
->size
);
1855 stk9090m_config
.microcode_B_fe_size
= state
->frontend_firmware
->size
;
1856 stk9090m_config
.microcode_B_fe_buffer
= state
->frontend_firmware
->data
;
1858 adap
->fe
= dvb_attach(dib9000_attach
, &adap
->dev
->i2c_adap
, 0x80, &stk9090m_config
);
1860 return adap
->fe
== NULL
? -ENODEV
: 0;
1863 static int dib9090_tuner_attach(struct dvb_usb_adapter
*adap
)
1865 struct dib0700_adapter_state
*state
= adap
->priv
;
1866 struct i2c_adapter
*i2c
= dib9000_get_tuner_interface(adap
->fe
);
1867 u16 data_dib190
[10] = {
1875 if (dvb_attach(dib0090_fw_register
, adap
->fe
, i2c
, &dib9090_dib0090_config
) == NULL
)
1877 i2c
= dib9000_get_i2c_master(adap
->fe
, DIBX000_I2C_INTERFACE_GPIO_1_2
, 0);
1878 if (dib01x0_pmu_update(i2c
, data_dib190
, 10) != 0)
1880 dib0700_set_i2c_speed(adap
->dev
, 2000);
1881 if (dib9000_firmware_post_pll_init(adap
->fe
) < 0)
1883 release_firmware(state
->frontend_firmware
);
1887 static int nim9090md_frontend_attach(struct dvb_usb_adapter
*adap
)
1889 struct dib0700_adapter_state
*state
= adap
->priv
;
1890 struct dib0700_state
*st
= adap
->dev
->priv
;
1891 struct i2c_adapter
*i2c
;
1892 struct dvb_frontend
*fe_slave
;
1895 /* Make use of the new i2c functions from FW 1.20 */
1896 dib0700_get_version(adap
->dev
, NULL
, NULL
, &fw_version
, NULL
);
1897 if (fw_version
>= 0x10200)
1898 st
->fw_use_new_i2c_api
= 1;
1899 dib0700_set_i2c_speed(adap
->dev
, 340);
1901 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
1903 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
1904 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
1905 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1906 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1908 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1911 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1913 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1915 if (request_firmware(&state
->frontend_firmware
, "dib9090.fw", &adap
->dev
->udev
->dev
)) {
1916 deb_info("%s: Upload failed. (file not found?)\n", __func__
);
1919 deb_info("%s: firmware read %Zu bytes.\n", __func__
, state
->frontend_firmware
->size
);
1921 nim9090md_config
[0].microcode_B_fe_size
= state
->frontend_firmware
->size
;
1922 nim9090md_config
[0].microcode_B_fe_buffer
= state
->frontend_firmware
->data
;
1923 nim9090md_config
[1].microcode_B_fe_size
= state
->frontend_firmware
->size
;
1924 nim9090md_config
[1].microcode_B_fe_buffer
= state
->frontend_firmware
->data
;
1926 dib9000_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x20, 0x80);
1927 adap
->fe
= dvb_attach(dib9000_attach
, &adap
->dev
->i2c_adap
, 0x80, &nim9090md_config
[0]);
1929 if (adap
->fe
== NULL
)
1932 i2c
= dib9000_get_i2c_master(adap
->fe
, DIBX000_I2C_INTERFACE_GPIO_3_4
, 0);
1933 dib9000_i2c_enumeration(i2c
, 1, 0x12, 0x82);
1935 fe_slave
= dvb_attach(dib9000_attach
, i2c
, 0x82, &nim9090md_config
[1]);
1936 dib9000_set_slave_frontend(adap
->fe
, fe_slave
);
1938 return fe_slave
== NULL
? -ENODEV
: 0;
1941 static int nim9090md_tuner_attach(struct dvb_usb_adapter
*adap
)
1943 struct dib0700_adapter_state
*state
= adap
->priv
;
1944 struct i2c_adapter
*i2c
;
1945 struct dvb_frontend
*fe_slave
;
1946 u16 data_dib190
[10] = {
1953 i2c
= dib9000_get_tuner_interface(adap
->fe
);
1954 if (dvb_attach(dib0090_fw_register
, adap
->fe
, i2c
, &nim9090md_dib0090_config
[0]) == NULL
)
1956 i2c
= dib9000_get_i2c_master(adap
->fe
, DIBX000_I2C_INTERFACE_GPIO_1_2
, 0);
1957 if (dib01x0_pmu_update(i2c
, data_dib190
, 10) < 0)
1959 dib0700_set_i2c_speed(adap
->dev
, 2000);
1960 if (dib9000_firmware_post_pll_init(adap
->fe
) < 0)
1963 fe_slave
= dib9000_get_slave_frontend(adap
->fe
, 1);
1964 if (fe_slave
!= NULL
) {
1965 i2c
= dib9000_get_component_bus_interface(adap
->fe
);
1966 dib9000_set_i2c_adapter(fe_slave
, i2c
);
1968 i2c
= dib9000_get_tuner_interface(fe_slave
);
1969 if (dvb_attach(dib0090_fw_register
, fe_slave
, i2c
, &nim9090md_dib0090_config
[1]) == NULL
)
1971 fe_slave
->dvb
= adap
->fe
->dvb
;
1972 dib9000_fw_set_component_bus_speed(adap
->fe
, 2000);
1973 if (dib9000_firmware_post_pll_init(fe_slave
) < 0)
1976 release_firmware(state
->frontend_firmware
);
1982 struct dib7090p_best_adc
{
1988 static int dib7090p_get_best_sampling(struct dvb_frontend
*fe
, struct dib7090p_best_adc
*adc
)
1990 u8 spur
= 0, prediv
= 0, loopdiv
= 0, min_prediv
= 1, max_prediv
= 1;
1993 u32 fcp_min
= 1900; /* PLL Minimum Frequency comparator KHz */
1994 u32 fcp_max
= 20000; /* PLL Maximum Frequency comparator KHz */
1995 u32 fdem_max
= 76000;
1996 u32 fdem_min
= 69500;
1997 u32 fcp
= 0, fs
= 0, fdem
= 0;
1998 u32 harmonic_id
= 0;
2000 adc
->pll_loopdiv
= loopdiv
;
2001 adc
->pll_prediv
= prediv
;
2004 deb_info("bandwidth = %d fdem_min =%d", fe
->dtv_property_cache
.bandwidth_hz
, fdem_min
);
2006 /* Find Min and Max prediv */
2007 while ((xtal
/max_prediv
) >= fcp_min
)
2011 min_prediv
= max_prediv
;
2012 while ((xtal
/min_prediv
) <= fcp_max
) {
2014 if (min_prediv
== 1)
2017 deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv
, max_prediv
);
2021 for (prediv
= min_prediv
; prediv
< max_prediv
; prediv
++) {
2022 fcp
= xtal
/ prediv
;
2023 if (fcp
> fcp_min
&& fcp
< fcp_max
) {
2024 for (loopdiv
= 1 ; loopdiv
< 64 ; loopdiv
++) {
2025 fdem
= ((xtal
/prediv
) * loopdiv
);
2027 /* test min/max system restrictions */
2029 if ((fdem
>= fdem_min
) && (fdem
<= fdem_max
) && (fs
>= fe
->dtv_property_cache
.bandwidth_hz
/1000)) {
2031 /* test fs harmonics positions */
2032 for (harmonic_id
= (fe
->dtv_property_cache
.frequency
/ (1000*fs
)) ; harmonic_id
<= ((fe
->dtv_property_cache
.frequency
/ (1000*fs
))+1) ; harmonic_id
++) {
2033 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)))) {
2040 adc
->pll_loopdiv
= loopdiv
;
2041 adc
->pll_prediv
= prediv
;
2042 adc
->timf
= 2396745143UL/fdem
*(1 << 9);
2043 adc
->timf
+= ((2396745143UL%fdem
) << 9)/fdem
;
2044 deb_info("loopdiv=%i prediv=%i timf=%i", loopdiv
, prediv
, adc
->timf
);
2055 if (adc
->pll_loopdiv
== 0 && adc
->pll_prediv
== 0)
2061 static int dib7090_agc_startup(struct dvb_frontend
*fe
, struct dvb_frontend_parameters
*fep
)
2063 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
2064 struct dib0700_adapter_state
*state
= adap
->priv
;
2065 struct dibx000_bandwidth_config pll
;
2067 struct dib7090p_best_adc adc
;
2070 ret
= state
->set_param_save(fe
, fep
);
2074 memset(&pll
, 0, sizeof(struct dibx000_bandwidth_config
));
2075 dib0090_pwm_gain_reset(fe
);
2076 target
= (dib0090_get_wbd_offset(fe
) * 8 + 1) / 2;
2077 dib7000p_set_wbd_ref(fe
, target
);
2079 if (dib7090p_get_best_sampling(fe
, &adc
) == 0) {
2080 pll
.pll_ratio
= adc
.pll_loopdiv
;
2081 pll
.pll_prediv
= adc
.pll_prediv
;
2083 dib7000p_update_pll(fe
, &pll
);
2084 dib7000p_ctrl_timf(fe
, DEMOD_TIMF_SET
, adc
.timf
);
2089 static struct dib0090_wbd_slope dib7090_wbd_table
[] = {
2090 { 380, 81, 850, 64, 540, 4},
2091 { 860, 51, 866, 21, 375, 4},
2092 {1700, 0, 250, 0, 100, 6},
2093 {2600, 0, 250, 0, 100, 6},
2094 { 0xFFFF, 0, 0, 0, 0, 0},
2097 struct dibx000_agc_config dib7090_agc_config
[2] = {
2099 .band_caps
= BAND_UHF
,
2100 /* 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,
2101 * 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 */
2102 .setup
= (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2105 .time_stabiliz
= 10,
2136 .perform_agc_softsplit
= 0,
2138 .band_caps
= BAND_FM
| BAND_VHF
| BAND_CBAND
,
2139 /* 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,
2140 * 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 */
2141 .setup
= (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2144 .time_stabiliz
= 10,
2175 .perform_agc_softsplit
= 0,
2179 static struct dibx000_bandwidth_config dib7090_clock_config_12_mhz
= {
2183 (3 << 14) | (1 << 12) | (524 << 0),
2189 static struct dib7000p_config nim7090_dib7000p_config
= {
2190 .output_mpeg2_in_188_bytes
= 1,
2191 .hostbus_diversity
= 1,
2192 .tuner_is_baseband
= 1,
2195 .agc_config_count
= 2,
2196 .agc
= dib7090_agc_config
,
2198 .bw
= &dib7090_clock_config_12_mhz
,
2200 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
2201 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
2202 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
2206 .agc_control
= dib7090_agc_restart
,
2209 .disable_sample_and_hold
= 0,
2210 .enable_current_mirror
= 0,
2211 .diversity_delay
= 0,
2213 .output_mode
= OUTMODE_MPEG2_FIFO
,
2217 static struct dib7000p_config tfe7090pvr_dib7000p_config
[2] = {
2219 .output_mpeg2_in_188_bytes
= 1,
2220 .hostbus_diversity
= 1,
2221 .tuner_is_baseband
= 1,
2224 .agc_config_count
= 2,
2225 .agc
= dib7090_agc_config
,
2227 .bw
= &dib7090_clock_config_12_mhz
,
2229 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
2230 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
2231 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
2235 .agc_control
= dib7090_agc_restart
,
2238 .disable_sample_and_hold
= 0,
2239 .enable_current_mirror
= 0,
2240 .diversity_delay
= 0,
2242 .output_mode
= OUTMODE_MPEG2_PAR_GATED_CLK
,
2243 .default_i2c_addr
= 0x90,
2246 .output_mpeg2_in_188_bytes
= 1,
2247 .hostbus_diversity
= 1,
2248 .tuner_is_baseband
= 1,
2251 .agc_config_count
= 2,
2252 .agc
= dib7090_agc_config
,
2254 .bw
= &dib7090_clock_config_12_mhz
,
2256 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
2257 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
2258 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
2262 .agc_control
= dib7090_agc_restart
,
2265 .disable_sample_and_hold
= 0,
2266 .enable_current_mirror
= 0,
2267 .diversity_delay
= 0,
2269 .output_mode
= OUTMODE_MPEG2_PAR_GATED_CLK
,
2270 .default_i2c_addr
= 0x92,
2275 static const struct dib0090_config nim7090_dib0090_config
= {
2276 .io
.clock_khz
= 12000,
2280 .io
.pll_loopdiv
= 6,
2281 .io
.adc_clock_ratio
= 0,
2282 .io
.pll_int_loop_filt
= 0,
2283 .reset
= dib7090_tuner_sleep
,
2284 .sleep
= dib7090_tuner_sleep
,
2286 .freq_offset_khz_uhf
= 0,
2287 .freq_offset_khz_vhf
= 0,
2289 .get_adc_power
= dib7090_get_adc_power
,
2294 .wbd_vhf_offset
= 0,
2295 .wbd_cband_offset
= 0,
2299 .fref_clock_ratio
= 0,
2301 .wbd
= dib7090_wbd_table
,
2303 .ls_cfg_pad_drv
= 0,
2309 static const struct dib0090_config tfe7090pvr_dib0090_config
[2] = {
2311 .io
.clock_khz
= 12000,
2315 .io
.pll_loopdiv
= 6,
2316 .io
.adc_clock_ratio
= 0,
2317 .io
.pll_int_loop_filt
= 0,
2318 .reset
= dib7090_tuner_sleep
,
2319 .sleep
= dib7090_tuner_sleep
,
2321 .freq_offset_khz_uhf
= 50,
2322 .freq_offset_khz_vhf
= 70,
2324 .get_adc_power
= dib7090_get_adc_power
,
2329 .wbd_vhf_offset
= 0,
2330 .wbd_cband_offset
= 0,
2334 .fref_clock_ratio
= 0,
2336 .wbd
= dib7090_wbd_table
,
2338 .ls_cfg_pad_drv
= 0,
2343 .io
.clock_khz
= 12000,
2347 .io
.pll_loopdiv
= 6,
2348 .io
.adc_clock_ratio
= 0,
2349 .io
.pll_int_loop_filt
= 0,
2350 .reset
= dib7090_tuner_sleep
,
2351 .sleep
= dib7090_tuner_sleep
,
2353 .freq_offset_khz_uhf
= -50,
2354 .freq_offset_khz_vhf
= -70,
2356 .get_adc_power
= dib7090_get_adc_power
,
2361 .wbd_vhf_offset
= 0,
2362 .wbd_cband_offset
= 0,
2366 .fref_clock_ratio
= 0,
2368 .wbd
= dib7090_wbd_table
,
2370 .ls_cfg_pad_drv
= 0,
2377 static int nim7090_frontend_attach(struct dvb_usb_adapter
*adap
)
2379 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
2381 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
2382 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
2383 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
2384 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
2387 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
2389 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
2391 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x10, &nim7090_dib7000p_config
) != 0) {
2392 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__
);
2395 adap
->fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x80, &nim7090_dib7000p_config
);
2397 return adap
->fe
== NULL
? -ENODEV
: 0;
2400 static int nim7090_tuner_attach(struct dvb_usb_adapter
*adap
)
2402 struct dib0700_adapter_state
*st
= adap
->priv
;
2403 struct i2c_adapter
*tun_i2c
= dib7090_get_i2c_tuner(adap
->fe
);
2405 if (dvb_attach(dib0090_register
, adap
->fe
, tun_i2c
, &nim7090_dib0090_config
) == NULL
)
2408 dib7000p_set_gpio(adap
->fe
, 8, 0, 1);
2410 st
->set_param_save
= adap
->fe
->ops
.tuner_ops
.set_params
;
2411 adap
->fe
->ops
.tuner_ops
.set_params
= dib7090_agc_startup
;
2415 static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter
*adap
)
2417 struct dib0700_state
*st
= adap
->dev
->priv
;
2419 /* The TFE7090 requires the dib0700 to not be in master mode */
2420 st
->disable_streaming_master_mode
= 1;
2422 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
2424 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
2425 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
2426 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
2427 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
2430 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
2432 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
2434 /* initialize IC 0 */
2435 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x20, &tfe7090pvr_dib7000p_config
[0]) != 0) {
2436 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__
);
2440 dib0700_set_i2c_speed(adap
->dev
, 340);
2441 adap
->fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x90, &tfe7090pvr_dib7000p_config
[0]);
2443 dib7090_slave_reset(adap
->fe
);
2445 if (adap
->fe
== NULL
)
2451 static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter
*adap
)
2453 struct i2c_adapter
*i2c
;
2455 if (adap
->dev
->adapter
[0].fe
== NULL
) {
2456 err("the master dib7090 has to be initialized first");
2457 return -ENODEV
; /* the master device has not been initialized */
2460 i2c
= dib7000p_get_i2c_master(adap
->dev
->adapter
[0].fe
, DIBX000_I2C_INTERFACE_GPIO_6_7
, 1);
2461 if (dib7000p_i2c_enumeration(i2c
, 1, 0x10, &tfe7090pvr_dib7000p_config
[1]) != 0) {
2462 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__
);
2466 adap
->fe
= dvb_attach(dib7000p_attach
, i2c
, 0x92, &tfe7090pvr_dib7000p_config
[1]);
2467 dib0700_set_i2c_speed(adap
->dev
, 200);
2469 return adap
->fe
== NULL
? -ENODEV
: 0;
2472 static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter
*adap
)
2474 struct dib0700_adapter_state
*st
= adap
->priv
;
2475 struct i2c_adapter
*tun_i2c
= dib7090_get_i2c_tuner(adap
->fe
);
2477 if (dvb_attach(dib0090_register
, adap
->fe
, tun_i2c
, &tfe7090pvr_dib0090_config
[0]) == NULL
)
2480 dib7000p_set_gpio(adap
->fe
, 8, 0, 1);
2482 st
->set_param_save
= adap
->fe
->ops
.tuner_ops
.set_params
;
2483 adap
->fe
->ops
.tuner_ops
.set_params
= dib7090_agc_startup
;
2487 static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter
*adap
)
2489 struct dib0700_adapter_state
*st
= adap
->priv
;
2490 struct i2c_adapter
*tun_i2c
= dib7090_get_i2c_tuner(adap
->fe
);
2492 if (dvb_attach(dib0090_register
, adap
->fe
, tun_i2c
, &tfe7090pvr_dib0090_config
[1]) == NULL
)
2495 dib7000p_set_gpio(adap
->fe
, 8, 0, 1);
2497 st
->set_param_save
= adap
->fe
->ops
.tuner_ops
.set_params
;
2498 adap
->fe
->ops
.tuner_ops
.set_params
= dib7090_agc_startup
;
2503 static struct dib7000p_config stk7070pd_dib7000p_config
[2] = {
2505 .output_mpeg2_in_188_bytes
= 1,
2507 .agc_config_count
= 1,
2508 .agc
= &dib7070_agc_config
,
2509 .bw
= &dib7070_bw_config_12_mhz
,
2510 .tuner_is_baseband
= 1,
2513 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
2514 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
2515 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
2517 .hostbus_diversity
= 1,
2519 .output_mpeg2_in_188_bytes
= 1,
2521 .agc_config_count
= 1,
2522 .agc
= &dib7070_agc_config
,
2523 .bw
= &dib7070_bw_config_12_mhz
,
2524 .tuner_is_baseband
= 1,
2527 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
2528 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
2529 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
2531 .hostbus_diversity
= 1,
2535 static int stk7070pd_frontend_attach0(struct dvb_usb_adapter
*adap
)
2537 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
2539 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
2540 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
2541 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
2542 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
2544 dib0700_ctrl_clock(adap
->dev
, 72, 1);
2547 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
2549 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
2551 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 2, 18,
2552 stk7070pd_dib7000p_config
) != 0) {
2553 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
2558 adap
->fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x80, &stk7070pd_dib7000p_config
[0]);
2559 return adap
->fe
== NULL
? -ENODEV
: 0;
2562 static int stk7070pd_frontend_attach1(struct dvb_usb_adapter
*adap
)
2564 adap
->fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x82, &stk7070pd_dib7000p_config
[1]);
2565 return adap
->fe
== NULL
? -ENODEV
: 0;
2569 static struct s5h1411_config pinnacle_801e_config
= {
2570 .output_mode
= S5H1411_PARALLEL_OUTPUT
,
2571 .gpio
= S5H1411_GPIO_OFF
,
2572 .mpeg_timing
= S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK
,
2573 .qam_if
= S5H1411_IF_44000
,
2574 .vsb_if
= S5H1411_IF_44000
,
2575 .inversion
= S5H1411_INVERSION_OFF
,
2576 .status_mode
= S5H1411_DEMODLOCKING
2579 /* Pinnacle PCTV HD Pro 801e GPIOs map:
2580 GPIO0 - currently unknown
2581 GPIO1 - xc5000 tuner reset
2582 GPIO2 - CX25843 sleep
2583 GPIO3 - currently unknown
2584 GPIO4 - currently unknown
2585 GPIO6 - currently unknown
2586 GPIO7 - currently unknown
2587 GPIO9 - currently unknown
2588 GPIO10 - CX25843 reset
2590 static int s5h1411_frontend_attach(struct dvb_usb_adapter
*adap
)
2592 struct dib0700_state
*st
= adap
->dev
->priv
;
2594 /* Make use of the new i2c functions from FW 1.20 */
2595 st
->fw_use_new_i2c_api
= 1;
2597 /* The s5h1411 requires the dib0700 to not be in master mode */
2598 st
->disable_streaming_master_mode
= 1;
2600 /* All msleep values taken from Windows USB trace */
2601 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 0);
2602 dib0700_set_gpio(adap
->dev
, GPIO3
, GPIO_OUT
, 0);
2603 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
2605 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
2607 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
2609 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
2610 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
2611 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
2612 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
2613 dib0700_set_gpio(adap
->dev
, GPIO2
, GPIO_OUT
, 0);
2616 /* Put the CX25843 to sleep for now since we're in digital mode */
2617 dib0700_set_gpio(adap
->dev
, GPIO2
, GPIO_OUT
, 1);
2619 /* GPIOs are initialized, do the attach */
2620 adap
->fe
= dvb_attach(s5h1411_attach
, &pinnacle_801e_config
,
2621 &adap
->dev
->i2c_adap
);
2622 return adap
->fe
== NULL
? -ENODEV
: 0;
2625 static int dib0700_xc5000_tuner_callback(void *priv
, int component
,
2626 int command
, int arg
)
2628 struct dvb_usb_adapter
*adap
= priv
;
2630 if (command
== XC5000_TUNER_RESET
) {
2631 /* Reset the tuner */
2632 dib0700_set_gpio(adap
->dev
, GPIO1
, GPIO_OUT
, 0);
2634 dib0700_set_gpio(adap
->dev
, GPIO1
, GPIO_OUT
, 1);
2637 err("xc5000: unknown tuner callback command: %d\n", command
);
2644 static struct xc5000_config s5h1411_xc5000_tunerconfig
= {
2645 .i2c_address
= 0x64,
2649 static int xc5000_tuner_attach(struct dvb_usb_adapter
*adap
)
2651 /* FIXME: generalize & move to common area */
2652 adap
->fe
->callback
= dib0700_xc5000_tuner_callback
;
2654 return dvb_attach(xc5000_attach
, adap
->fe
, &adap
->dev
->i2c_adap
,
2655 &s5h1411_xc5000_tunerconfig
)
2656 == NULL
? -ENODEV
: 0;
2659 static struct lgdt3305_config hcw_lgdt3305_config
= {
2661 .mpeg_mode
= LGDT3305_MPEG_PARALLEL
,
2662 .tpclk_edge
= LGDT3305_TPCLK_FALLING_EDGE
,
2663 .tpvalid_polarity
= LGDT3305_TP_VALID_LOW
,
2665 .spectral_inversion
= 1,
2668 .usref_8vsb
= 0x0500,
2671 static struct mxl5007t_config hcw_mxl5007t_config
= {
2672 .xtal_freq_hz
= MxL_XTAL_25_MHZ
,
2673 .if_freq_hz
= MxL_IF_6_MHZ
,
2678 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
2679 GPIO1 - ANT_SEL (H: VPA, L: MCX)
2685 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
2687 static int lgdt3305_frontend_attach(struct dvb_usb_adapter
*adap
)
2689 struct dib0700_state
*st
= adap
->dev
->priv
;
2691 /* Make use of the new i2c functions from FW 1.20 */
2692 st
->fw_use_new_i2c_api
= 1;
2694 st
->disable_streaming_master_mode
= 1;
2696 /* fe power enable */
2697 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
2699 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
2703 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
2705 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
2707 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
2710 adap
->fe
= dvb_attach(lgdt3305_attach
,
2711 &hcw_lgdt3305_config
,
2712 &adap
->dev
->i2c_adap
);
2714 return adap
->fe
== NULL
? -ENODEV
: 0;
2717 static int mxl5007t_tuner_attach(struct dvb_usb_adapter
*adap
)
2719 return dvb_attach(mxl5007t_attach
, adap
->fe
,
2720 &adap
->dev
->i2c_adap
, 0x60,
2721 &hcw_mxl5007t_config
) == NULL
? -ENODEV
: 0;
2725 /* DVB-USB and USB stuff follows */
2726 struct usb_device_id dib0700_usb_id_table
[] = {
2727 /* 0 */ { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7700P
) },
2728 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7700P_PC
) },
2729 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_500
) },
2730 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_500_2
) },
2731 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_STICK
) },
2732 /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_VOLAR
) },
2733 { USB_DEVICE(USB_VID_COMPRO
, USB_PID_COMPRO_VIDEOMATE_U500
) },
2734 { USB_DEVICE(USB_VID_UNIWILL
, USB_PID_UNIWILL_STK7700P
) },
2735 { USB_DEVICE(USB_VID_LEADTEK
, USB_PID_WINFAST_DTV_DONGLE_STK7700P
) },
2736 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_STICK_2
) },
2737 /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_VOLAR_2
) },
2738 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV2000E
) },
2739 { USB_DEVICE(USB_VID_TERRATEC
,
2740 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY
) },
2741 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_TD_STICK
) },
2742 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7700D
) },
2743 /* 15 */{ USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7070P
) },
2744 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV_DVB_T_FLASH
) },
2745 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7070PD
) },
2746 { USB_DEVICE(USB_VID_PINNACLE
,
2747 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T
) },
2748 { USB_DEVICE(USB_VID_COMPRO
, USB_PID_COMPRO_VIDEOMATE_U500_PC
) },
2749 /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_EXPRESS
) },
2750 { USB_DEVICE(USB_VID_GIGABYTE
, USB_PID_GIGABYTE_U7000
) },
2751 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC
, USB_PID_ARTEC_T14BR
) },
2752 { USB_DEVICE(USB_VID_ASUS
, USB_PID_ASUS_U3000
) },
2753 { USB_DEVICE(USB_VID_ASUS
, USB_PID_ASUS_U3100
) },
2754 /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_STICK_3
) },
2755 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_MYTV_T
) },
2756 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_HT_USB_XE
) },
2757 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_EXPRESSCARD_320CX
) },
2758 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV72E
) },
2759 /* 30 */{ USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV73E
) },
2760 { USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_EC372S
) },
2761 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_HT_EXPRESS
) },
2762 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_T_XXS
) },
2763 { USB_DEVICE(USB_VID_LEADTEK
, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2
) },
2764 /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009
) },
2765 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_500_3
) },
2766 { USB_DEVICE(USB_VID_GIGABYTE
, USB_PID_GIGABYTE_U8000
) },
2767 { USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_STK7700PH
) },
2768 { USB_DEVICE(USB_VID_ASUS
, USB_PID_ASUS_U3000H
) },
2769 /* 40 */{ USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV801E
) },
2770 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV801E_SE
) },
2771 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_T_EXPRESS
) },
2772 { USB_DEVICE(USB_VID_TERRATEC
,
2773 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2
) },
2774 { USB_DEVICE(USB_VID_SONY
, USB_PID_SONY_PLAYTV
) },
2775 /* 45 */{ USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_PD378S
) },
2776 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_TIGER_ATSC
) },
2777 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_TIGER_ATSC_B210
) },
2778 { USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_MC770
) },
2779 { USB_DEVICE(USB_VID_ELGATO
, USB_PID_ELGATO_EYETV_DTT
) },
2780 /* 50 */{ USB_DEVICE(USB_VID_ELGATO
, USB_PID_ELGATO_EYETV_DTT_Dlx
) },
2781 { USB_DEVICE(USB_VID_LEADTEK
, USB_PID_WINFAST_DTV_DONGLE_H
) },
2782 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_T3
) },
2783 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_T5
) },
2784 { USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_STK7700D
) },
2785 /* 55 */{ USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_STK7700D_2
) },
2786 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV73A
) },
2787 { USB_DEVICE(USB_VID_PCTV
, USB_PID_PINNACLE_PCTV73ESE
) },
2788 { USB_DEVICE(USB_VID_PCTV
, USB_PID_PINNACLE_PCTV282E
) },
2789 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7770P
) },
2790 /* 60 */{ USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_T_XXS_2
) },
2791 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK807XPVR
) },
2792 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK807XP
) },
2793 { USB_DEVICE_VER(USB_VID_PIXELVIEW
, USB_PID_PIXELVIEW_SBTVD
, 0x000, 0x3f00) },
2794 { USB_DEVICE(USB_VID_EVOLUTEPC
, USB_PID_TVWAY_PLUS
) },
2795 /* 65 */{ USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV73ESE
) },
2796 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV282E
) },
2797 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK8096GP
) },
2798 { USB_DEVICE(USB_VID_ELGATO
, USB_PID_ELGATO_EYETV_DIVERSITY
) },
2799 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_NIM9090M
) },
2800 /* 70 */{ USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_NIM8096MD
) },
2801 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_NIM9090MD
) },
2802 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_NIM7090
) },
2803 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_TFE7090PVR
) },
2804 { USB_DEVICE(USB_VID_TECHNISAT
, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2
) },
2805 { 0 } /* Terminating entry */
2807 MODULE_DEVICE_TABLE(usb
, dib0700_usb_id_table
);
2809 #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
2810 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
2811 .usb_ctrl = DEVICE_SPECIFIC, \
2812 .firmware = "dvb-usb-dib0700-1.20.fw", \
2813 .download_firmware = dib0700_download_firmware, \
2814 .no_reconnect = 1, \
2815 .size_of_priv = sizeof(struct dib0700_state), \
2816 .i2c_algo = &dib0700_i2c_algo, \
2817 .identify_state = dib0700_identify_state
2819 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
2820 .streaming_ctrl = dib0700_streaming_ctrl, \
2827 .buffersize = 39480, \
2832 struct dvb_usb_device_properties dib0700_devices
[] = {
2834 DIB0700_DEFAULT_DEVICE_PROPERTIES
,
2839 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
2840 .pid_filter_count
= 32,
2841 .pid_filter
= stk7700p_pid_filter
,
2842 .pid_filter_ctrl
= stk7700p_pid_filter_ctrl
,
2843 .frontend_attach
= stk7700p_frontend_attach
,
2844 .tuner_attach
= stk7700p_tuner_attach
,
2846 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2850 .num_device_descs
= 8,
2852 { "DiBcom STK7700P reference design",
2853 { &dib0700_usb_id_table
[0], &dib0700_usb_id_table
[1] },
2856 { "Hauppauge Nova-T Stick",
2857 { &dib0700_usb_id_table
[4], &dib0700_usb_id_table
[9], NULL
},
2860 { "AVerMedia AVerTV DVB-T Volar",
2861 { &dib0700_usb_id_table
[5], &dib0700_usb_id_table
[10] },
2864 { "Compro Videomate U500",
2865 { &dib0700_usb_id_table
[6], &dib0700_usb_id_table
[19] },
2868 { "Uniwill STK7700P based (Hama and others)",
2869 { &dib0700_usb_id_table
[7], NULL
},
2872 { "Leadtek Winfast DTV Dongle (STK7700P based)",
2873 { &dib0700_usb_id_table
[8], &dib0700_usb_id_table
[34] },
2876 { "AVerMedia AVerTV DVB-T Express",
2877 { &dib0700_usb_id_table
[20] },
2881 { &dib0700_usb_id_table
[21], NULL
},
2887 .rc_interval
= DEFAULT_RC_INTERVAL
,
2888 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
2889 .rc_query
= dib0700_rc_query_old_firmware
,
2890 .allowed_protos
= RC_TYPE_RC5
|
2893 .change_protocol
= dib0700_change_protocol
,
2895 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
2900 .frontend_attach
= bristol_frontend_attach
,
2901 .tuner_attach
= bristol_tuner_attach
,
2903 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2905 .frontend_attach
= bristol_frontend_attach
,
2906 .tuner_attach
= bristol_tuner_attach
,
2908 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2912 .num_device_descs
= 1,
2914 { "Hauppauge Nova-T 500 Dual DVB-T",
2915 { &dib0700_usb_id_table
[2], &dib0700_usb_id_table
[3], NULL
},
2921 .rc_interval
= DEFAULT_RC_INTERVAL
,
2922 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
2923 .rc_query
= dib0700_rc_query_old_firmware
,
2924 .allowed_protos
= RC_TYPE_RC5
|
2927 .change_protocol
= dib0700_change_protocol
,
2929 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
2934 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
2935 .pid_filter_count
= 32,
2936 .pid_filter
= stk70x0p_pid_filter
,
2937 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
2938 .frontend_attach
= stk7700d_frontend_attach
,
2939 .tuner_attach
= stk7700d_tuner_attach
,
2941 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2943 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
2944 .pid_filter_count
= 32,
2945 .pid_filter
= stk70x0p_pid_filter
,
2946 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
2947 .frontend_attach
= stk7700d_frontend_attach
,
2948 .tuner_attach
= stk7700d_tuner_attach
,
2950 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2954 .num_device_descs
= 5,
2956 { "Pinnacle PCTV 2000e",
2957 { &dib0700_usb_id_table
[11], NULL
},
2960 { "Terratec Cinergy DT XS Diversity",
2961 { &dib0700_usb_id_table
[12], NULL
},
2964 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
2965 { &dib0700_usb_id_table
[13], NULL
},
2968 { "DiBcom STK7700D reference design",
2969 { &dib0700_usb_id_table
[14], NULL
},
2972 { "YUAN High-Tech DiBcom STK7700D",
2973 { &dib0700_usb_id_table
[55], NULL
},
2980 .rc_interval
= DEFAULT_RC_INTERVAL
,
2981 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
2982 .rc_query
= dib0700_rc_query_old_firmware
,
2983 .allowed_protos
= RC_TYPE_RC5
|
2986 .change_protocol
= dib0700_change_protocol
,
2988 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
2993 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
2994 .pid_filter_count
= 32,
2995 .pid_filter
= stk70x0p_pid_filter
,
2996 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
2997 .frontend_attach
= stk7700P2_frontend_attach
,
2998 .tuner_attach
= stk7700d_tuner_attach
,
3000 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3004 .num_device_descs
= 3,
3006 { "ASUS My Cinema U3000 Mini DVBT Tuner",
3007 { &dib0700_usb_id_table
[23], NULL
},
3011 { &dib0700_usb_id_table
[31], NULL
},
3014 { "Terratec Cinergy T Express",
3015 { &dib0700_usb_id_table
[42], NULL
},
3021 .rc_interval
= DEFAULT_RC_INTERVAL
,
3022 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3023 .module_name
= "dib0700",
3024 .rc_query
= dib0700_rc_query_old_firmware
,
3025 .allowed_protos
= RC_TYPE_RC5
|
3028 .change_protocol
= dib0700_change_protocol
,
3030 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3035 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3036 .pid_filter_count
= 32,
3037 .pid_filter
= stk70x0p_pid_filter
,
3038 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3039 .frontend_attach
= stk7070p_frontend_attach
,
3040 .tuner_attach
= dib7070p_tuner_attach
,
3042 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3044 .size_of_priv
= sizeof(struct dib0700_adapter_state
),
3048 .num_device_descs
= 11,
3050 { "DiBcom STK7070P reference design",
3051 { &dib0700_usb_id_table
[15], NULL
},
3054 { "Pinnacle PCTV DVB-T Flash Stick",
3055 { &dib0700_usb_id_table
[16], NULL
},
3058 { "Artec T14BR DVB-T",
3059 { &dib0700_usb_id_table
[22], NULL
},
3062 { "ASUS My Cinema U3100 Mini DVBT Tuner",
3063 { &dib0700_usb_id_table
[24], NULL
},
3066 { "Hauppauge Nova-T Stick",
3067 { &dib0700_usb_id_table
[25], NULL
},
3070 { "Hauppauge Nova-T MyTV.t",
3071 { &dib0700_usb_id_table
[26], NULL
},
3074 { "Pinnacle PCTV 72e",
3075 { &dib0700_usb_id_table
[29], NULL
},
3078 { "Pinnacle PCTV 73e",
3079 { &dib0700_usb_id_table
[30], NULL
},
3082 { "Elgato EyeTV DTT",
3083 { &dib0700_usb_id_table
[49], NULL
},
3087 { &dib0700_usb_id_table
[45], NULL
},
3090 { "Elgato EyeTV Dtt Dlx PD378S",
3091 { &dib0700_usb_id_table
[50], NULL
},
3097 .rc_interval
= DEFAULT_RC_INTERVAL
,
3098 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3099 .module_name
= "dib0700",
3100 .rc_query
= dib0700_rc_query_old_firmware
,
3101 .allowed_protos
= RC_TYPE_RC5
|
3104 .change_protocol
= dib0700_change_protocol
,
3106 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3111 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3112 .pid_filter_count
= 32,
3113 .pid_filter
= stk70x0p_pid_filter
,
3114 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3115 .frontend_attach
= stk7070p_frontend_attach
,
3116 .tuner_attach
= dib7070p_tuner_attach
,
3118 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3120 .size_of_priv
= sizeof(struct dib0700_adapter_state
),
3124 .num_device_descs
= 3,
3126 { "Pinnacle PCTV 73A",
3127 { &dib0700_usb_id_table
[56], NULL
},
3130 { "Pinnacle PCTV 73e SE",
3131 { &dib0700_usb_id_table
[57], &dib0700_usb_id_table
[65], NULL
},
3134 { "Pinnacle PCTV 282e",
3135 { &dib0700_usb_id_table
[58], &dib0700_usb_id_table
[66], NULL
},
3141 .rc_interval
= DEFAULT_RC_INTERVAL
,
3142 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3143 .module_name
= "dib0700",
3144 .rc_query
= dib0700_rc_query_old_firmware
,
3145 .allowed_protos
= RC_TYPE_RC5
|
3148 .change_protocol
= dib0700_change_protocol
,
3150 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3155 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3156 .pid_filter_count
= 32,
3157 .pid_filter
= stk70x0p_pid_filter
,
3158 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3159 .frontend_attach
= stk7070pd_frontend_attach0
,
3160 .tuner_attach
= dib7070p_tuner_attach
,
3162 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3164 .size_of_priv
= sizeof(struct dib0700_adapter_state
),
3166 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3167 .pid_filter_count
= 32,
3168 .pid_filter
= stk70x0p_pid_filter
,
3169 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3170 .frontend_attach
= stk7070pd_frontend_attach1
,
3171 .tuner_attach
= dib7070p_tuner_attach
,
3173 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3175 .size_of_priv
= sizeof(struct dib0700_adapter_state
),
3179 .num_device_descs
= 6,
3181 { "DiBcom STK7070PD reference design",
3182 { &dib0700_usb_id_table
[17], NULL
},
3185 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
3186 { &dib0700_usb_id_table
[18], NULL
},
3189 { "Hauppauge Nova-TD Stick (52009)",
3190 { &dib0700_usb_id_table
[35], NULL
},
3193 { "Hauppauge Nova-TD-500 (84xxx)",
3194 { &dib0700_usb_id_table
[36], NULL
},
3197 { "Terratec Cinergy DT USB XS Diversity/ T5",
3198 { &dib0700_usb_id_table
[43],
3199 &dib0700_usb_id_table
[53], NULL
},
3203 { &dib0700_usb_id_table
[44], NULL
},
3209 .rc_interval
= DEFAULT_RC_INTERVAL
,
3210 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3211 .module_name
= "dib0700",
3212 .rc_query
= dib0700_rc_query_old_firmware
,
3213 .allowed_protos
= RC_TYPE_RC5
|
3216 .change_protocol
= dib0700_change_protocol
,
3218 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3223 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3224 .pid_filter_count
= 32,
3225 .pid_filter
= stk70x0p_pid_filter
,
3226 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3227 .frontend_attach
= stk7070pd_frontend_attach0
,
3228 .tuner_attach
= dib7070p_tuner_attach
,
3230 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3232 .size_of_priv
= sizeof(struct dib0700_adapter_state
),
3234 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3235 .pid_filter_count
= 32,
3236 .pid_filter
= stk70x0p_pid_filter
,
3237 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3238 .frontend_attach
= stk7070pd_frontend_attach1
,
3239 .tuner_attach
= dib7070p_tuner_attach
,
3241 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3243 .size_of_priv
= sizeof(struct dib0700_adapter_state
),
3247 .num_device_descs
= 1,
3249 { "Elgato EyeTV Diversity",
3250 { &dib0700_usb_id_table
[68], NULL
},
3256 .rc_interval
= DEFAULT_RC_INTERVAL
,
3257 .rc_codes
= RC_MAP_DIB0700_NEC_TABLE
,
3258 .module_name
= "dib0700",
3259 .rc_query
= dib0700_rc_query_old_firmware
,
3260 .allowed_protos
= RC_TYPE_RC5
|
3263 .change_protocol
= dib0700_change_protocol
,
3265 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3270 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3271 .pid_filter_count
= 32,
3272 .pid_filter
= stk70x0p_pid_filter
,
3273 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3274 .frontend_attach
= stk7700ph_frontend_attach
,
3275 .tuner_attach
= stk7700ph_tuner_attach
,
3277 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3279 .size_of_priv
= sizeof(struct
3280 dib0700_adapter_state
),
3284 .num_device_descs
= 9,
3286 { "Terratec Cinergy HT USB XE",
3287 { &dib0700_usb_id_table
[27], NULL
},
3290 { "Pinnacle Expresscard 320cx",
3291 { &dib0700_usb_id_table
[28], NULL
},
3294 { "Terratec Cinergy HT Express",
3295 { &dib0700_usb_id_table
[32], NULL
},
3298 { "Gigabyte U8000-RH",
3299 { &dib0700_usb_id_table
[37], NULL
},
3302 { "YUAN High-Tech STK7700PH",
3303 { &dib0700_usb_id_table
[38], NULL
},
3306 { "Asus My Cinema-U3000Hybrid",
3307 { &dib0700_usb_id_table
[39], NULL
},
3310 { "YUAN High-Tech MC770",
3311 { &dib0700_usb_id_table
[48], NULL
},
3314 { "Leadtek WinFast DTV Dongle H",
3315 { &dib0700_usb_id_table
[51], NULL
},
3318 { "YUAN High-Tech STK7700D",
3319 { &dib0700_usb_id_table
[54], NULL
},
3325 .rc_interval
= DEFAULT_RC_INTERVAL
,
3326 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3327 .module_name
= "dib0700",
3328 .rc_query
= dib0700_rc_query_old_firmware
,
3329 .allowed_protos
= RC_TYPE_RC5
|
3332 .change_protocol
= dib0700_change_protocol
,
3334 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3338 .frontend_attach
= s5h1411_frontend_attach
,
3339 .tuner_attach
= xc5000_tuner_attach
,
3341 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3343 .size_of_priv
= sizeof(struct
3344 dib0700_adapter_state
),
3348 .num_device_descs
= 2,
3350 { "Pinnacle PCTV HD Pro USB Stick",
3351 { &dib0700_usb_id_table
[40], NULL
},
3354 { "Pinnacle PCTV HD USB Stick",
3355 { &dib0700_usb_id_table
[41], NULL
},
3361 .rc_interval
= DEFAULT_RC_INTERVAL
,
3362 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3363 .module_name
= "dib0700",
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
,
3374 .frontend_attach
= lgdt3305_frontend_attach
,
3375 .tuner_attach
= mxl5007t_tuner_attach
,
3377 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3379 .size_of_priv
= sizeof(struct
3380 dib0700_adapter_state
),
3384 .num_device_descs
= 2,
3386 { "Hauppauge ATSC MiniCard (B200)",
3387 { &dib0700_usb_id_table
[46], NULL
},
3390 { "Hauppauge ATSC MiniCard (B210)",
3391 { &dib0700_usb_id_table
[47], NULL
},
3395 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3400 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3401 .pid_filter_count
= 32,
3402 .pid_filter
= stk70x0p_pid_filter
,
3403 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3404 .frontend_attach
= stk7770p_frontend_attach
,
3405 .tuner_attach
= dib7770p_tuner_attach
,
3407 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3410 sizeof(struct dib0700_adapter_state
),
3414 .num_device_descs
= 3,
3416 { "DiBcom STK7770P reference design",
3417 { &dib0700_usb_id_table
[59], NULL
},
3420 { "Terratec Cinergy T USB XXS (HD)/ T3",
3421 { &dib0700_usb_id_table
[33],
3422 &dib0700_usb_id_table
[52],
3423 &dib0700_usb_id_table
[60], NULL
},
3426 { "TechniSat AirStar TeleStick 2",
3427 { &dib0700_usb_id_table
[74], NULL
},
3433 .rc_interval
= DEFAULT_RC_INTERVAL
,
3434 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3435 .module_name
= "dib0700",
3436 .rc_query
= dib0700_rc_query_old_firmware
,
3437 .allowed_protos
= RC_TYPE_RC5
|
3440 .change_protocol
= dib0700_change_protocol
,
3442 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3446 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3447 .pid_filter_count
= 32,
3448 .pid_filter
= stk80xx_pid_filter
,
3449 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
3450 .frontend_attach
= stk807x_frontend_attach
,
3451 .tuner_attach
= dib807x_tuner_attach
,
3453 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3456 sizeof(struct dib0700_adapter_state
),
3460 .num_device_descs
= 3,
3462 { "DiBcom STK807xP reference design",
3463 { &dib0700_usb_id_table
[62], NULL
},
3466 { "Prolink Pixelview SBTVD",
3467 { &dib0700_usb_id_table
[63], NULL
},
3470 { "EvolutePC TVWay+",
3471 { &dib0700_usb_id_table
[64], NULL
},
3477 .rc_interval
= DEFAULT_RC_INTERVAL
,
3478 .rc_codes
= RC_MAP_DIB0700_NEC_TABLE
,
3479 .module_name
= "dib0700",
3480 .rc_query
= dib0700_rc_query_old_firmware
,
3481 .allowed_protos
= RC_TYPE_RC5
|
3484 .change_protocol
= dib0700_change_protocol
,
3486 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3490 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3491 .pid_filter_count
= 32,
3492 .pid_filter
= stk80xx_pid_filter
,
3493 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
3494 .frontend_attach
= stk807xpvr_frontend_attach0
,
3495 .tuner_attach
= dib807x_tuner_attach
,
3497 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3500 sizeof(struct dib0700_adapter_state
),
3503 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3504 .pid_filter_count
= 32,
3505 .pid_filter
= stk80xx_pid_filter
,
3506 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
3507 .frontend_attach
= stk807xpvr_frontend_attach1
,
3508 .tuner_attach
= dib807x_tuner_attach
,
3510 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3513 sizeof(struct dib0700_adapter_state
),
3517 .num_device_descs
= 1,
3519 { "DiBcom STK807xPVR reference design",
3520 { &dib0700_usb_id_table
[61], NULL
},
3526 .rc_interval
= DEFAULT_RC_INTERVAL
,
3527 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3528 .module_name
= "dib0700",
3529 .rc_query
= dib0700_rc_query_old_firmware
,
3530 .allowed_protos
= RC_TYPE_RC5
|
3533 .change_protocol
= dib0700_change_protocol
,
3535 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3539 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
3540 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3541 .pid_filter_count
= 32,
3542 .pid_filter
= stk80xx_pid_filter
,
3543 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
3544 .frontend_attach
= stk809x_frontend_attach
,
3545 .tuner_attach
= dib809x_tuner_attach
,
3547 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3550 sizeof(struct dib0700_adapter_state
),
3554 .num_device_descs
= 1,
3556 { "DiBcom STK8096GP reference design",
3557 { &dib0700_usb_id_table
[67], NULL
},
3563 .rc_interval
= DEFAULT_RC_INTERVAL
,
3564 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3565 .module_name
= "dib0700",
3566 .rc_query
= dib0700_rc_query_old_firmware
,
3567 .allowed_protos
= RC_TYPE_RC5
|
3570 .change_protocol
= dib0700_change_protocol
,
3572 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3576 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
3577 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3578 .pid_filter_count
= 32,
3579 .pid_filter
= dib90x0_pid_filter
,
3580 .pid_filter_ctrl
= dib90x0_pid_filter_ctrl
,
3581 .frontend_attach
= stk9090m_frontend_attach
,
3582 .tuner_attach
= dib9090_tuner_attach
,
3584 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3587 sizeof(struct dib0700_adapter_state
),
3591 .num_device_descs
= 1,
3593 { "DiBcom STK9090M reference design",
3594 { &dib0700_usb_id_table
[69], NULL
},
3600 .rc_interval
= DEFAULT_RC_INTERVAL
,
3601 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3602 .module_name
= "dib0700",
3603 .rc_query
= dib0700_rc_query_old_firmware
,
3604 .allowed_protos
= RC_TYPE_RC5
|
3607 .change_protocol
= dib0700_change_protocol
,
3609 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3613 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
3614 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3615 .pid_filter_count
= 32,
3616 .pid_filter
= stk80xx_pid_filter
,
3617 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
3618 .frontend_attach
= nim8096md_frontend_attach
,
3619 .tuner_attach
= nim8096md_tuner_attach
,
3621 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3624 sizeof(struct dib0700_adapter_state
),
3628 .num_device_descs
= 1,
3630 { "DiBcom NIM8096MD reference design",
3631 { &dib0700_usb_id_table
[70], NULL
},
3637 .rc_interval
= DEFAULT_RC_INTERVAL
,
3638 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3639 .module_name
= "dib0700",
3640 .rc_query
= dib0700_rc_query_old_firmware
,
3641 .allowed_protos
= RC_TYPE_RC5
|
3644 .change_protocol
= dib0700_change_protocol
,
3646 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3650 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
3651 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3652 .pid_filter_count
= 32,
3653 .pid_filter
= dib90x0_pid_filter
,
3654 .pid_filter_ctrl
= dib90x0_pid_filter_ctrl
,
3655 .frontend_attach
= nim9090md_frontend_attach
,
3656 .tuner_attach
= nim9090md_tuner_attach
,
3658 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3661 sizeof(struct dib0700_adapter_state
),
3665 .num_device_descs
= 1,
3667 { "DiBcom NIM9090MD reference design",
3668 { &dib0700_usb_id_table
[71], NULL
},
3674 .rc_interval
= DEFAULT_RC_INTERVAL
,
3675 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3676 .module_name
= "dib0700",
3677 .rc_query
= dib0700_rc_query_old_firmware
,
3678 .allowed_protos
= RC_TYPE_RC5
|
3681 .change_protocol
= dib0700_change_protocol
,
3683 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3687 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
3688 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3689 .pid_filter_count
= 32,
3690 .pid_filter
= stk70x0p_pid_filter
,
3691 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3692 .frontend_attach
= nim7090_frontend_attach
,
3693 .tuner_attach
= nim7090_tuner_attach
,
3695 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3698 sizeof(struct dib0700_adapter_state
),
3702 .num_device_descs
= 1,
3704 { "DiBcom NIM7090 reference design",
3705 { &dib0700_usb_id_table
[72], NULL
},
3711 .rc_interval
= DEFAULT_RC_INTERVAL
,
3712 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3713 .module_name
= "dib0700",
3714 .rc_query
= dib0700_rc_query_old_firmware
,
3715 .allowed_protos
= RC_TYPE_RC5
|
3718 .change_protocol
= dib0700_change_protocol
,
3720 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3724 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
3725 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3726 .pid_filter_count
= 32,
3727 .pid_filter
= stk70x0p_pid_filter
,
3728 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3729 .frontend_attach
= tfe7090pvr_frontend0_attach
,
3730 .tuner_attach
= tfe7090pvr_tuner0_attach
,
3732 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3735 sizeof(struct dib0700_adapter_state
),
3738 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
3739 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3740 .pid_filter_count
= 32,
3741 .pid_filter
= stk70x0p_pid_filter
,
3742 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3743 .frontend_attach
= tfe7090pvr_frontend1_attach
,
3744 .tuner_attach
= tfe7090pvr_tuner1_attach
,
3746 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3749 sizeof(struct dib0700_adapter_state
),
3753 .num_device_descs
= 1,
3755 { "DiBcom TFE7090PVR reference design",
3756 { &dib0700_usb_id_table
[73], NULL
},
3762 .rc_interval
= DEFAULT_RC_INTERVAL
,
3763 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3764 .module_name
= "dib0700",
3765 .rc_query
= dib0700_rc_query_old_firmware
,
3766 .allowed_protos
= RC_TYPE_RC5
|
3769 .change_protocol
= dib0700_change_protocol
,
3774 int dib0700_device_count
= ARRAY_SIZE(dib0700_devices
);