1 /* Linux driver for devices based on the DiBcom DiB0700 USB bridge
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the Free
5 * Software Foundation, version 2.
7 * Copyright (C) 2005-9 DiBcom, SA et al
11 #include "dib3000mc.h"
18 #include "tuner-xc2028.h"
27 static int force_lna_activation
;
28 module_param(force_lna_activation
, int, 0644);
29 MODULE_PARM_DESC(force_lna_activation
, "force the activation of Low-Noise-Amplifyer(s) (LNA), if applicable for the device (default: 0=automatic/off).");
31 struct dib0700_adapter_state
{
32 int (*set_param_save
) (struct dvb_frontend
*);
33 const struct firmware
*frontend_firmware
;
34 struct dib7000p_ops dib7000p_ops
;
35 struct dib8000_ops dib8000_ops
;
38 /* Hauppauge Nova-T 500 (aka Bristol)
39 * has a LNA on GPIO0 which is enabled by setting 1 */
40 static struct mt2060_config bristol_mt2060_config
[2] = {
50 static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config
= {
51 .band_caps
= BAND_VHF
| BAND_UHF
,
52 .setup
= (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
72 static struct dib3000mc_config bristol_dib3000mc_config
[2] = {
73 { .agc
= &bristol_dib3000p_mt2060_agc_config
,
75 .ln_adc_level
= 0x1cc7,
76 .output_mpeg2_in_188_bytes
= 1,
78 { .agc
= &bristol_dib3000p_mt2060_agc_config
,
80 .ln_adc_level
= 0x1cc7,
81 .output_mpeg2_in_188_bytes
= 1,
85 static int bristol_frontend_attach(struct dvb_usb_adapter
*adap
)
87 struct dib0700_state
*st
= adap
->dev
->priv
;
89 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0); msleep(10);
90 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1); msleep(10);
91 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0); msleep(10);
92 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1); msleep(10);
94 if (force_lna_activation
)
95 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
97 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 0);
99 if (dib3000mc_i2c_enumeration(&adap
->dev
->i2c_adap
, 2, DEFAULT_DIB3000P_I2C_ADDRESS
, bristol_dib3000mc_config
) != 0) {
100 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0); msleep(10);
104 st
->mt2060_if1
[adap
->id
] = 1220;
105 return (adap
->fe_adap
[0].fe
= dvb_attach(dib3000mc_attach
, &adap
->dev
->i2c_adap
,
106 (10 + adap
->id
) << 1, &bristol_dib3000mc_config
[adap
->id
])) == NULL
? -ENODEV
: 0;
109 static int eeprom_read(struct i2c_adapter
*adap
,u8 adrs
,u8
*pval
)
111 struct i2c_msg msg
[2] = {
112 { .addr
= 0x50, .flags
= 0, .buf
= &adrs
, .len
= 1 },
113 { .addr
= 0x50, .flags
= I2C_M_RD
, .buf
= pval
, .len
= 1 },
115 if (i2c_transfer(adap
, msg
, 2) != 2) return -EREMOTEIO
;
119 static int bristol_tuner_attach(struct dvb_usb_adapter
*adap
)
121 struct i2c_adapter
*prim_i2c
= &adap
->dev
->i2c_adap
;
122 struct i2c_adapter
*tun_i2c
= dib3000mc_get_tuner_i2c_master(adap
->fe_adap
[0].fe
, 1);
125 if (adap
->dev
->udev
->descriptor
.idVendor
== cpu_to_le16(USB_VID_HAUPPAUGE
) &&
126 adap
->dev
->udev
->descriptor
.idProduct
== cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2
)) {
127 if (!eeprom_read(prim_i2c
,0x59 + adap
->id
,&a
)) if1
=1220+a
;
129 return dvb_attach(mt2060_attach
, adap
->fe_adap
[0].fe
, tun_i2c
,
130 &bristol_mt2060_config
[adap
->id
], if1
) == NULL
?
134 /* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
137 static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config
[2] = {
141 /* 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,
142 * 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 */
143 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
144 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
179 BAND_VHF
| BAND_LBAND
,
181 /* 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,
182 * 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 */
183 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
184 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
221 static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config
= {
234 .sad_cfg
= (3 << 14) | (1 << 12) | (524 << 0),
239 static struct dib7000p_config stk7700d_dib7000p_mt2266_config
[] = {
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
,
252 { .output_mpeg2_in_188_bytes
= 1,
253 .hostbus_diversity
= 1,
254 .tuner_is_baseband
= 1,
256 .agc_config_count
= 2,
257 .agc
= stk7700d_7000p_mt2266_agc_config
,
258 .bw
= &stk7700d_mt2266_pll_config
,
260 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
261 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
262 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
266 static struct mt2266_config stk7700d_mt2266_config
[2] = {
267 { .i2c_address
= 0x60
269 { .i2c_address
= 0x60
273 static int stk7700P2_frontend_attach(struct dvb_usb_adapter
*adap
)
275 struct dib0700_adapter_state
*state
= adap
->priv
;
277 if (!dvb_attach(dib7000p_attach
, &state
->dib7000p_ops
))
281 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
283 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
284 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
285 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
286 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
288 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
290 if (state
->dib7000p_ops
.i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
291 stk7700d_dib7000p_mt2266_config
)
293 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__
);
294 dvb_detach(&state
->dib7000p_ops
);
299 adap
->fe_adap
[0].fe
= state
->dib7000p_ops
.init(&adap
->dev
->i2c_adap
,
300 0x80 + (adap
->id
<< 1),
301 &stk7700d_dib7000p_mt2266_config
[adap
->id
]);
303 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
306 static int stk7700d_frontend_attach(struct dvb_usb_adapter
*adap
)
308 struct dib0700_adapter_state
*state
= adap
->priv
;
310 if (!dvb_attach(dib7000p_attach
, &state
->dib7000p_ops
))
314 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
316 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
317 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
318 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
319 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
321 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
323 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
324 if (state
->dib7000p_ops
.i2c_enumeration(&adap
->dev
->i2c_adap
, 2, 18,
325 stk7700d_dib7000p_mt2266_config
)
327 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__
);
328 dvb_detach(&state
->dib7000p_ops
);
333 adap
->fe_adap
[0].fe
= state
->dib7000p_ops
.init(&adap
->dev
->i2c_adap
,
334 0x80 + (adap
->id
<< 1),
335 &stk7700d_dib7000p_mt2266_config
[adap
->id
]);
337 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
340 static int stk7700d_tuner_attach(struct dvb_usb_adapter
*adap
)
342 struct i2c_adapter
*tun_i2c
;
343 struct dib0700_adapter_state
*state
= adap
->priv
;
345 tun_i2c
= state
->dib7000p_ops
.get_i2c_master(adap
->fe_adap
[0].fe
,
346 DIBX000_I2C_INTERFACE_TUNER
, 1);
347 return dvb_attach(mt2266_attach
, adap
->fe_adap
[0].fe
, tun_i2c
,
348 &stk7700d_mt2266_config
[adap
->id
]) == NULL
? -ENODEV
: 0;
351 /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
352 static struct dibx000_agc_config xc3028_agc_config
= {
353 .band_caps
= BAND_VHF
| BAND_UHF
,
354 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
355 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
356 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
357 .setup
= (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
383 .perform_agc_softsplit
= 1,
386 /* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
387 static struct dibx000_bandwidth_config xc3028_bw_config
= {
400 .sad_cfg
= (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
401 .ifreq
= (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
406 static struct dib7000p_config stk7700ph_dib7700_xc3028_config
= {
407 .output_mpeg2_in_188_bytes
= 1,
408 .tuner_is_baseband
= 1,
410 .agc_config_count
= 1,
411 .agc
= &xc3028_agc_config
,
412 .bw
= &xc3028_bw_config
,
414 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
415 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
416 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
419 static int stk7700ph_xc3028_callback(void *ptr
, int component
,
420 int command
, int arg
)
422 struct dvb_usb_adapter
*adap
= ptr
;
423 struct dib0700_adapter_state
*state
= adap
->priv
;
426 case XC2028_TUNER_RESET
:
427 /* Send the tuner in then out of reset */
428 state
->dib7000p_ops
.set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 0);
430 state
->dib7000p_ops
.set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 1);
432 case XC2028_RESET_CLK
:
435 err("%s: unknown command %d, arg %d\n", __func__
,
442 static struct xc2028_ctrl stk7700ph_xc3028_ctrl
= {
443 .fname
= XC2028_DEFAULT_FIRMWARE
,
445 .demod
= XC3028_FE_DIBCOM52
,
448 static struct xc2028_config stk7700ph_xc3028_config
= {
450 .ctrl
= &stk7700ph_xc3028_ctrl
,
453 static int stk7700ph_frontend_attach(struct dvb_usb_adapter
*adap
)
455 struct usb_device_descriptor
*desc
= &adap
->dev
->udev
->descriptor
;
456 struct dib0700_adapter_state
*state
= adap
->priv
;
458 if (!dvb_attach(dib7000p_attach
, &state
->dib7000p_ops
))
461 if (desc
->idVendor
== cpu_to_le16(USB_VID_PINNACLE
) &&
462 desc
->idProduct
== cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX
))
463 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
465 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
467 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
468 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
469 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
470 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
472 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
474 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
477 if (state
->dib7000p_ops
.i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
478 &stk7700ph_dib7700_xc3028_config
) != 0) {
479 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
481 dvb_detach(&state
->dib7000p_ops
);
485 adap
->fe_adap
[0].fe
= state
->dib7000p_ops
.init(&adap
->dev
->i2c_adap
, 0x80,
486 &stk7700ph_dib7700_xc3028_config
);
488 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
491 static int stk7700ph_tuner_attach(struct dvb_usb_adapter
*adap
)
493 struct i2c_adapter
*tun_i2c
;
494 struct dib0700_adapter_state
*state
= adap
->priv
;
496 tun_i2c
= state
->dib7000p_ops
.get_i2c_master(adap
->fe_adap
[0].fe
,
497 DIBX000_I2C_INTERFACE_TUNER
, 1);
499 stk7700ph_xc3028_config
.i2c_adap
= tun_i2c
;
501 /* FIXME: generalize & move to common area */
502 adap
->fe_adap
[0].fe
->callback
= stk7700ph_xc3028_callback
;
504 return dvb_attach(xc2028_attach
, adap
->fe_adap
[0].fe
, &stk7700ph_xc3028_config
)
505 == NULL
? -ENODEV
: 0;
508 #define DEFAULT_RC_INTERVAL 50
511 * This function is used only when firmware is < 1.20 version. Newer
512 * firmwares use bulk mode, with functions implemented at dib0700_core,
513 * at dib0700_rc_urb_completion()
515 static int dib0700_rc_query_old_firmware(struct dvb_usb_device
*d
)
517 enum rc_type protocol
;
521 struct dib0700_state
*st
= d
->priv
;
523 if (st
->fw_version
>= 0x10200) {
524 /* For 1.20 firmware , We need to keep the RC polling
525 callback so we can reuse the input device setup in
526 dvb-usb-remote.c. However, the actual work is being done
527 in the bulk URB completion handler. */
531 st
->buf
[0] = REQUEST_POLL_RC
;
534 i
= dib0700_ctrl_rd(d
, st
->buf
, 2, st
->buf
, 4);
536 err("RC Query Failed");
540 /* losing half of KEY_0 events from Philipps rc5 remotes.. */
541 if (st
->buf
[0] == 0 && st
->buf
[1] == 0
542 && st
->buf
[2] == 0 && st
->buf
[3] == 0)
545 /* info("%d: %2X %2X %2X %2X",dvb_usb_dib0700_ir_proto,(int)st->buf[3 - 2],(int)st->buf[3 - 3],(int)st->buf[3 - 1],(int)st->buf[3]); */
547 dib0700_rc_setup(d
, NULL
); /* reset ir sensor data to prevent false events */
549 switch (d
->props
.rc
.core
.protocol
) {
551 /* NEC protocol sends repeat code as 0 0 0 FF */
552 if ((st
->buf
[3 - 2] == 0x00) && (st
->buf
[3 - 3] == 0x00) &&
553 (st
->buf
[3] == 0xff)) {
554 rc_repeat(d
->rc_dev
);
558 protocol
= RC_TYPE_NEC
;
559 scancode
= RC_SCANCODE_NEC(st
->buf
[3 - 2], st
->buf
[3 - 3]);
564 /* RC-5 protocol changes toggle bit on new keypress */
565 protocol
= RC_TYPE_RC5
;
566 scancode
= RC_SCANCODE_RC5(st
->buf
[3 - 2], st
->buf
[3 - 3]);
567 toggle
= st
->buf
[3 - 1];
571 rc_keydown(d
->rc_dev
, protocol
, scancode
, toggle
);
575 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
576 static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config
= {
579 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
580 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
581 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
582 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
622 static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config
= {
623 .band_caps
= BAND_UHF
| BAND_VHF
,
624 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
625 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
626 .setup
= (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
652 .perform_agc_softsplit
= 0,
655 static struct dibx000_bandwidth_config stk7700p_pll_config
= {
668 .sad_cfg
= (3 << 14) | (1 << 12) | (524 << 0),
674 static struct dib7000m_config stk7700p_dib7000m_config
= {
676 .output_mpeg2_in_188_bytes
= 1,
679 .agc_config_count
= 1,
680 .agc
= &stk7700p_7000m_mt2060_agc_config
,
681 .bw
= &stk7700p_pll_config
,
683 .gpio_dir
= DIB7000M_GPIO_DEFAULT_DIRECTIONS
,
684 .gpio_val
= DIB7000M_GPIO_DEFAULT_VALUES
,
685 .gpio_pwm_pos
= DIB7000M_GPIO_DEFAULT_PWM_POS
,
688 static struct dib7000p_config stk7700p_dib7000p_config
= {
689 .output_mpeg2_in_188_bytes
= 1,
691 .agc_config_count
= 1,
692 .agc
= &stk7700p_7000p_mt2060_agc_config
,
693 .bw
= &stk7700p_pll_config
,
695 .gpio_dir
= DIB7000M_GPIO_DEFAULT_DIRECTIONS
,
696 .gpio_val
= DIB7000M_GPIO_DEFAULT_VALUES
,
697 .gpio_pwm_pos
= DIB7000M_GPIO_DEFAULT_PWM_POS
,
700 static int stk7700p_frontend_attach(struct dvb_usb_adapter
*adap
)
702 struct dib0700_state
*st
= adap
->dev
->priv
;
703 struct dib0700_adapter_state
*state
= adap
->priv
;
705 if (!dvb_attach(dib7000p_attach
, &state
->dib7000p_ops
))
708 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
710 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
711 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0); msleep(50);
713 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1); msleep(10);
714 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
716 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0); msleep(10);
717 dib0700_ctrl_clock(adap
->dev
, 72, 1);
718 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1); msleep(100);
720 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
722 st
->mt2060_if1
[0] = 1220;
724 if (state
->dib7000p_ops
.dib7000pc_detection(&adap
->dev
->i2c_adap
)) {
725 adap
->fe_adap
[0].fe
= state
->dib7000p_ops
.init(&adap
->dev
->i2c_adap
, 18, &stk7700p_dib7000p_config
);
726 st
->is_dib7000pc
= 1;
728 memset(&state
->dib7000p_ops
, 0, sizeof(state
->dib7000p_ops
));
729 adap
->fe_adap
[0].fe
= dvb_attach(dib7000m_attach
, &adap
->dev
->i2c_adap
, 18, &stk7700p_dib7000m_config
);
732 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
735 static struct mt2060_config stk7700p_mt2060_config
= {
739 static int stk7700p_tuner_attach(struct dvb_usb_adapter
*adap
)
741 struct i2c_adapter
*prim_i2c
= &adap
->dev
->i2c_adap
;
742 struct dib0700_state
*st
= adap
->dev
->priv
;
743 struct i2c_adapter
*tun_i2c
;
744 struct dib0700_adapter_state
*state
= adap
->priv
;
748 if (adap
->dev
->udev
->descriptor
.idVendor
== cpu_to_le16(USB_VID_HAUPPAUGE
) &&
749 adap
->dev
->udev
->descriptor
.idProduct
== cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK
)) {
750 if (!eeprom_read(prim_i2c
,0x58,&a
)) if1
=1220+a
;
752 if (st
->is_dib7000pc
)
753 tun_i2c
= state
->dib7000p_ops
.get_i2c_master(adap
->fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_TUNER
, 1);
755 tun_i2c
= dib7000m_get_i2c_master(adap
->fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_TUNER
, 1);
757 return dvb_attach(mt2060_attach
, adap
->fe_adap
[0].fe
, tun_i2c
, &stk7700p_mt2060_config
,
758 if1
) == NULL
? -ENODEV
: 0;
761 /* DIB7070 generic */
762 static struct dibx000_agc_config dib7070_agc_config
= {
763 .band_caps
= BAND_UHF
| BAND_VHF
| BAND_LBAND
| BAND_SBAND
,
764 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
765 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
766 .setup
= (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
792 .perform_agc_softsplit
= 0,
795 static int dib7070_tuner_reset(struct dvb_frontend
*fe
, int onoff
)
797 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
798 struct dib0700_adapter_state
*state
= adap
->priv
;
800 deb_info("reset: %d", onoff
);
801 return state
->dib7000p_ops
.set_gpio(fe
, 8, 0, !onoff
);
804 static int dib7070_tuner_sleep(struct dvb_frontend
*fe
, int onoff
)
806 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
807 struct dib0700_adapter_state
*state
= adap
->priv
;
809 deb_info("sleep: %d", onoff
);
810 return state
->dib7000p_ops
.set_gpio(fe
, 9, 0, onoff
);
813 static struct dib0070_config dib7070p_dib0070_config
[2] = {
815 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
816 .reset
= dib7070_tuner_reset
,
817 .sleep
= dib7070_tuner_sleep
,
819 .clock_pad_drive
= 4,
822 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
823 .reset
= dib7070_tuner_reset
,
824 .sleep
= dib7070_tuner_sleep
,
830 static struct dib0070_config dib7770p_dib0070_config
= {
831 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
832 .reset
= dib7070_tuner_reset
,
833 .sleep
= dib7070_tuner_sleep
,
835 .clock_pad_drive
= 0,
840 static int dib7070_set_param_override(struct dvb_frontend
*fe
)
842 struct dtv_frontend_properties
*p
= &fe
->dtv_property_cache
;
843 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
844 struct dib0700_adapter_state
*state
= adap
->priv
;
847 u8 band
= BAND_OF_FREQUENCY(p
->frequency
/1000);
849 case BAND_VHF
: offset
= 950; break;
851 default: offset
= 550; break;
853 deb_info("WBD for DiB7000P: %d\n", offset
+ dib0070_wbd_offset(fe
));
854 state
->dib7000p_ops
.set_wbd_ref(fe
, offset
+ dib0070_wbd_offset(fe
));
855 return state
->set_param_save(fe
);
858 static int dib7770_set_param_override(struct dvb_frontend
*fe
)
860 struct dtv_frontend_properties
*p
= &fe
->dtv_property_cache
;
861 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
862 struct dib0700_adapter_state
*state
= adap
->priv
;
865 u8 band
= BAND_OF_FREQUENCY(p
->frequency
/1000);
868 state
->dib7000p_ops
.set_gpio(fe
, 0, 0, 1);
873 state
->dib7000p_ops
.set_gpio(fe
, 0, 0, 0);
877 deb_info("WBD for DiB7000P: %d\n", offset
+ dib0070_wbd_offset(fe
));
878 state
->dib7000p_ops
.set_wbd_ref(fe
, offset
+ dib0070_wbd_offset(fe
));
879 return state
->set_param_save(fe
);
882 static int dib7770p_tuner_attach(struct dvb_usb_adapter
*adap
)
884 struct dib0700_adapter_state
*st
= adap
->priv
;
885 struct i2c_adapter
*tun_i2c
= st
->dib7000p_ops
.get_i2c_master(adap
->fe_adap
[0].fe
,
886 DIBX000_I2C_INTERFACE_TUNER
, 1);
888 if (dvb_attach(dib0070_attach
, adap
->fe_adap
[0].fe
, tun_i2c
,
889 &dib7770p_dib0070_config
) == NULL
)
892 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
893 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib7770_set_param_override
;
897 static int dib7070p_tuner_attach(struct dvb_usb_adapter
*adap
)
899 struct dib0700_adapter_state
*st
= adap
->priv
;
900 struct i2c_adapter
*tun_i2c
= st
->dib7000p_ops
.get_i2c_master(adap
->fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_TUNER
, 1);
903 if (dvb_attach(dib0070_attach
, adap
->fe_adap
[0].fe
, tun_i2c
, &dib7070p_dib0070_config
[0]) == NULL
)
906 if (dvb_attach(dib0070_attach
, adap
->fe_adap
[0].fe
, tun_i2c
, &dib7070p_dib0070_config
[1]) == NULL
)
910 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
911 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib7070_set_param_override
;
915 static int stk7700p_pid_filter(struct dvb_usb_adapter
*adapter
, int index
,
918 struct dib0700_adapter_state
*state
= adapter
->priv
;
919 struct dib0700_state
*st
= adapter
->dev
->priv
;
921 if (st
->is_dib7000pc
)
922 return state
->dib7000p_ops
.pid_filter(adapter
->fe_adap
[0].fe
, index
, pid
, onoff
);
923 return dib7000m_pid_filter(adapter
->fe_adap
[0].fe
, index
, pid
, onoff
);
926 static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter
*adapter
, int onoff
)
928 struct dib0700_state
*st
= adapter
->dev
->priv
;
929 struct dib0700_adapter_state
*state
= adapter
->priv
;
930 if (st
->is_dib7000pc
)
931 return state
->dib7000p_ops
.pid_filter_ctrl(adapter
->fe_adap
[0].fe
, onoff
);
932 return dib7000m_pid_filter_ctrl(adapter
->fe_adap
[0].fe
, onoff
);
935 static int stk70x0p_pid_filter(struct dvb_usb_adapter
*adapter
, int index
, u16 pid
, int onoff
)
937 struct dib0700_adapter_state
*state
= adapter
->priv
;
938 return state
->dib7000p_ops
.pid_filter(adapter
->fe_adap
[0].fe
, index
, pid
, onoff
);
941 static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter
*adapter
, int onoff
)
943 struct dib0700_adapter_state
*state
= adapter
->priv
;
944 return state
->dib7000p_ops
.pid_filter_ctrl(adapter
->fe_adap
[0].fe
, onoff
);
947 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz
= {
960 .sad_cfg
= (3 << 14) | (1 << 12) | (524 << 0),
961 .ifreq
= (0 << 25) | 0,
966 static struct dib7000p_config dib7070p_dib7000p_config
= {
967 .output_mpeg2_in_188_bytes
= 1,
969 .agc_config_count
= 1,
970 .agc
= &dib7070_agc_config
,
971 .bw
= &dib7070_bw_config_12_mhz
,
972 .tuner_is_baseband
= 1,
975 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
976 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
977 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
979 .hostbus_diversity
= 1,
983 static int stk7070p_frontend_attach(struct dvb_usb_adapter
*adap
)
985 struct usb_device_descriptor
*p
= &adap
->dev
->udev
->descriptor
;
986 struct dib0700_adapter_state
*state
= adap
->priv
;
988 if (!dvb_attach(dib7000p_attach
, &state
->dib7000p_ops
))
991 if (p
->idVendor
== cpu_to_le16(USB_VID_PINNACLE
) &&
992 p
->idProduct
== cpu_to_le16(USB_PID_PINNACLE_PCTV72E
))
993 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
995 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
997 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
998 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
999 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1000 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1002 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1005 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1007 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1009 if (state
->dib7000p_ops
.i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
1010 &dib7070p_dib7000p_config
) != 0) {
1011 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
1013 dvb_detach(&state
->dib7000p_ops
);
1017 adap
->fe_adap
[0].fe
= state
->dib7000p_ops
.init(&adap
->dev
->i2c_adap
, 0x80,
1018 &dib7070p_dib7000p_config
);
1019 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
1023 static struct dib7000p_config dib7770p_dib7000p_config
= {
1024 .output_mpeg2_in_188_bytes
= 1,
1026 .agc_config_count
= 1,
1027 .agc
= &dib7070_agc_config
,
1028 .bw
= &dib7070_bw_config_12_mhz
,
1029 .tuner_is_baseband
= 1,
1032 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
1033 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
1034 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
1036 .hostbus_diversity
= 1,
1037 .enable_current_mirror
= 1,
1038 .disable_sample_and_hold
= 0,
1041 static int stk7770p_frontend_attach(struct dvb_usb_adapter
*adap
)
1043 struct usb_device_descriptor
*p
= &adap
->dev
->udev
->descriptor
;
1044 struct dib0700_adapter_state
*state
= adap
->priv
;
1046 if (!dvb_attach(dib7000p_attach
, &state
->dib7000p_ops
))
1049 if (p
->idVendor
== cpu_to_le16(USB_VID_PINNACLE
) &&
1050 p
->idProduct
== cpu_to_le16(USB_PID_PINNACLE_PCTV72E
))
1051 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
1053 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
1055 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
1056 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
1057 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1058 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1060 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1063 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1065 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1067 if (state
->dib7000p_ops
.i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
1068 &dib7770p_dib7000p_config
) != 0) {
1069 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
1071 dvb_detach(&state
->dib7000p_ops
);
1075 adap
->fe_adap
[0].fe
= state
->dib7000p_ops
.init(&adap
->dev
->i2c_adap
, 0x80,
1076 &dib7770p_dib7000p_config
);
1077 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
1080 /* DIB807x generic */
1081 static struct dibx000_agc_config dib807x_agc_config
[2] = {
1084 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1085 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1086 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1087 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1089 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1090 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1091 (0 << 0), /* setup*/
1094 10, /* time_stabiliz*/
1104 65535, /* agc1_max*/
1107 65535, /* agc2_max*/
1113 206, /* agc1_slope1*/
1114 255, /* agc1_slope2*/
1117 88, /* agc2_slope1*/
1118 90, /* agc2_slope2*/
1125 0, /* perform_agc_softsplit*/
1128 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1129 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1130 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1131 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1133 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1134 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1135 (0 << 0), /* setup */
1138 10, /* time_stabiliz*/
1148 65535, /* agc1_max*/
1151 65535, /* agc2_max*/
1157 206, /* agc1_slope1*/
1158 255, /* agc1_slope2*/
1161 88, /* agc2_slope1*/
1162 90, /* agc2_slope2*/
1169 0, /* perform_agc_softsplit*/
1173 static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz
= {
1183 .IO_CLK_en_core
= 1,
1186 .sad_cfg
= (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1187 .ifreq
= (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1189 .xtal_hz
= 12000000,
1192 static struct dib8000_config dib807x_dib8000_config
[2] = {
1194 .output_mpeg2_in_188_bytes
= 1,
1196 .agc_config_count
= 2,
1197 .agc
= dib807x_agc_config
,
1198 .pll
= &dib807x_bw_config_12_mhz
,
1199 .tuner_is_baseband
= 1,
1201 .gpio_dir
= DIB8000_GPIO_DEFAULT_DIRECTIONS
,
1202 .gpio_val
= DIB8000_GPIO_DEFAULT_VALUES
,
1203 .gpio_pwm_pos
= DIB8000_GPIO_DEFAULT_PWM_POS
,
1205 .hostbus_diversity
= 1,
1207 .agc_control
= &dib0070_ctrl_agc_filter
,
1208 .output_mode
= OUTMODE_MPEG2_FIFO
,
1211 .output_mpeg2_in_188_bytes
= 1,
1213 .agc_config_count
= 2,
1214 .agc
= dib807x_agc_config
,
1215 .pll
= &dib807x_bw_config_12_mhz
,
1216 .tuner_is_baseband
= 1,
1218 .gpio_dir
= DIB8000_GPIO_DEFAULT_DIRECTIONS
,
1219 .gpio_val
= DIB8000_GPIO_DEFAULT_VALUES
,
1220 .gpio_pwm_pos
= DIB8000_GPIO_DEFAULT_PWM_POS
,
1222 .hostbus_diversity
= 1,
1223 .agc_control
= &dib0070_ctrl_agc_filter
,
1224 .output_mode
= OUTMODE_MPEG2_FIFO
,
1229 static int dib80xx_tuner_reset(struct dvb_frontend
*fe
, int onoff
)
1231 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
1232 struct dib0700_adapter_state
*state
= adap
->priv
;
1234 return state
->dib8000_ops
.set_gpio(fe
, 5, 0, !onoff
);
1237 static int dib80xx_tuner_sleep(struct dvb_frontend
*fe
, int onoff
)
1239 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
1240 struct dib0700_adapter_state
*state
= adap
->priv
;
1242 return state
->dib8000_ops
.set_gpio(fe
, 0, 0, onoff
);
1245 static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg
[] = {
1250 static struct dib0070_config dib807x_dib0070_config
[2] = {
1252 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
1253 .reset
= dib80xx_tuner_reset
,
1254 .sleep
= dib80xx_tuner_sleep
,
1256 .clock_pad_drive
= 4,
1258 .force_crystal_mode
= 1,
1259 .enable_third_order_filter
= 1,
1261 .wbd_gain
= dib8070_wbd_gain_cfg
,
1262 .osc_buffer_state
= 0,
1263 .freq_offset_khz_uhf
= -100,
1264 .freq_offset_khz_vhf
= -100,
1266 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
1267 .reset
= dib80xx_tuner_reset
,
1268 .sleep
= dib80xx_tuner_sleep
,
1270 .clock_pad_drive
= 2,
1272 .force_crystal_mode
= 1,
1273 .enable_third_order_filter
= 1,
1275 .wbd_gain
= dib8070_wbd_gain_cfg
,
1276 .osc_buffer_state
= 0,
1277 .freq_offset_khz_uhf
= -25,
1278 .freq_offset_khz_vhf
= -25,
1282 static int dib807x_set_param_override(struct dvb_frontend
*fe
)
1284 struct dtv_frontend_properties
*p
= &fe
->dtv_property_cache
;
1285 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
1286 struct dib0700_adapter_state
*state
= adap
->priv
;
1288 u16 offset
= dib0070_wbd_offset(fe
);
1289 u8 band
= BAND_OF_FREQUENCY(p
->frequency
/1000);
1294 case BAND_UHF
: /* fall-thru wanted */
1296 offset
+= 250; break;
1298 deb_info("WBD for DiB8000: %d\n", offset
);
1299 state
->dib8000_ops
.set_wbd_ref(fe
, offset
);
1301 return state
->set_param_save(fe
);
1304 static int dib807x_tuner_attach(struct dvb_usb_adapter
*adap
)
1306 struct dib0700_adapter_state
*st
= adap
->priv
;
1307 struct i2c_adapter
*tun_i2c
= st
->dib8000_ops
.get_i2c_master(adap
->fe_adap
[0].fe
,
1308 DIBX000_I2C_INTERFACE_TUNER
, 1);
1310 if (adap
->id
== 0) {
1311 if (dvb_attach(dib0070_attach
, adap
->fe_adap
[0].fe
, tun_i2c
,
1312 &dib807x_dib0070_config
[0]) == NULL
)
1315 if (dvb_attach(dib0070_attach
, adap
->fe_adap
[0].fe
, tun_i2c
,
1316 &dib807x_dib0070_config
[1]) == NULL
)
1320 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
1321 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib807x_set_param_override
;
1325 static int stk80xx_pid_filter(struct dvb_usb_adapter
*adapter
, int index
,
1328 struct dib0700_adapter_state
*state
= adapter
->priv
;
1330 return state
->dib8000_ops
.pid_filter(adapter
->fe_adap
[0].fe
, index
, pid
, onoff
);
1333 static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter
*adapter
,
1336 struct dib0700_adapter_state
*state
= adapter
->priv
;
1338 return state
->dib8000_ops
.pid_filter_ctrl(adapter
->fe_adap
[0].fe
, onoff
);
1342 static int stk807x_frontend_attach(struct dvb_usb_adapter
*adap
)
1344 struct dib0700_adapter_state
*state
= adap
->priv
;
1346 if (!dvb_attach(dib8000_attach
, &state
->dib8000_ops
))
1349 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
1351 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
1352 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
1353 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1355 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1357 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1360 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1362 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1364 state
->dib8000_ops
.i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
1367 adap
->fe_adap
[0].fe
= state
->dib8000_ops
.init(&adap
->dev
->i2c_adap
, 0x80,
1368 &dib807x_dib8000_config
[0]);
1370 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
1374 static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter
*adap
)
1376 struct dib0700_adapter_state
*state
= adap
->priv
;
1378 if (!dvb_attach(dib8000_attach
, &state
->dib8000_ops
))
1381 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
1383 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
1385 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
1386 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
1387 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1389 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1391 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1394 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1396 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1398 /* initialize IC 0 */
1399 state
->dib8000_ops
.i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x22, 0x80, 0);
1401 adap
->fe_adap
[0].fe
= state
->dib8000_ops
.init(&adap
->dev
->i2c_adap
, 0x80,
1402 &dib807x_dib8000_config
[0]);
1404 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
1407 static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter
*adap
)
1409 struct dib0700_adapter_state
*state
= adap
->priv
;
1411 if (!dvb_attach(dib8000_attach
, &state
->dib8000_ops
))
1414 /* initialize IC 1 */
1415 state
->dib8000_ops
.i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x12, 0x82, 0);
1417 adap
->fe_adap
[0].fe
= state
->dib8000_ops
.init(&adap
->dev
->i2c_adap
, 0x82,
1418 &dib807x_dib8000_config
[1]);
1420 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
1424 static struct dibx000_agc_config dib8090_agc_config
[2] = {
1426 .band_caps
= BAND_UHF
| BAND_VHF
| BAND_LBAND
| BAND_SBAND
,
1427 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1428 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1429 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1430 .setup
= (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1431 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1434 .time_stabiliz
= 10,
1465 .perform_agc_softsplit
= 0,
1468 .band_caps
= BAND_CBAND
,
1469 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1470 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1471 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1472 .setup
= (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1473 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1476 .time_stabiliz
= 10,
1507 .perform_agc_softsplit
= 0,
1511 static struct dibx000_bandwidth_config dib8090_pll_config_12mhz
= {
1523 .IO_CLK_en_core
= 1,
1527 .sad_cfg
= (3 << 14) | (1 << 12) | (599 << 0),
1529 .ifreq
= (0 << 25) | 0,
1532 .xtal_hz
= 12000000,
1535 static int dib8090_get_adc_power(struct dvb_frontend
*fe
)
1537 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
1538 struct dib0700_adapter_state
*state
= adap
->priv
;
1540 return state
->dib8000_ops
.get_adc_power(fe
, 1);
1543 static void dib8090_agc_control(struct dvb_frontend
*fe
, u8 restart
)
1545 deb_info("AGC control callback: %i\n", restart
);
1546 dib0090_dcc_freq(fe
, restart
);
1548 if (restart
== 0) /* before AGC startup */
1549 dib0090_set_dc_servo(fe
, 1);
1552 static struct dib8000_config dib809x_dib8000_config
[2] = {
1554 .output_mpeg2_in_188_bytes
= 1,
1556 .agc_config_count
= 2,
1557 .agc
= dib8090_agc_config
,
1558 .agc_control
= dib8090_agc_control
,
1559 .pll
= &dib8090_pll_config_12mhz
,
1560 .tuner_is_baseband
= 1,
1562 .gpio_dir
= DIB8000_GPIO_DEFAULT_DIRECTIONS
,
1563 .gpio_val
= DIB8000_GPIO_DEFAULT_VALUES
,
1564 .gpio_pwm_pos
= DIB8000_GPIO_DEFAULT_PWM_POS
,
1566 .hostbus_diversity
= 1,
1568 .output_mode
= OUTMODE_MPEG2_FIFO
,
1570 .diversity_delay
= 48,
1573 .output_mpeg2_in_188_bytes
= 1,
1575 .agc_config_count
= 2,
1576 .agc
= dib8090_agc_config
,
1577 .agc_control
= dib8090_agc_control
,
1578 .pll
= &dib8090_pll_config_12mhz
,
1579 .tuner_is_baseband
= 1,
1581 .gpio_dir
= DIB8000_GPIO_DEFAULT_DIRECTIONS
,
1582 .gpio_val
= DIB8000_GPIO_DEFAULT_VALUES
,
1583 .gpio_pwm_pos
= DIB8000_GPIO_DEFAULT_PWM_POS
,
1585 .hostbus_diversity
= 1,
1587 .output_mode
= OUTMODE_DIVERSITY
,
1589 .diversity_delay
= 1,
1594 static struct dib0090_wbd_slope dib8090_wbd_table
[] = {
1595 /* max freq ; cold slope ; cold offset ; warm slope ; warm offset ; wbd gain */
1596 { 120, 0, 500, 0, 500, 4 }, /* CBAND */
1597 { 170, 0, 450, 0, 450, 4 }, /* CBAND */
1598 { 380, 48, 373, 28, 259, 6 }, /* VHF */
1599 { 860, 34, 700, 36, 616, 6 }, /* high UHF */
1600 { 0xFFFF, 34, 700, 36, 616, 6 }, /* default */
1603 static struct dib0090_config dib809x_dib0090_config
= {
1607 .io
.pll_loopdiv
= 20,
1608 .io
.adc_clock_ratio
= 8,
1609 .io
.pll_int_loop_filt
= 0,
1610 .io
.clock_khz
= 12000,
1611 .reset
= dib80xx_tuner_reset
,
1612 .sleep
= dib80xx_tuner_sleep
,
1615 .i2c_address
= DEFAULT_DIB0090_I2C_ADDRESS
,
1618 .get_adc_power
= dib8090_get_adc_power
,
1619 .freq_offset_khz_uhf
= -63,
1620 .freq_offset_khz_vhf
= -143,
1621 .wbd
= dib8090_wbd_table
,
1622 .fref_clock_ratio
= 6,
1625 static u8
dib8090_compute_pll_parameters(struct dvb_frontend
*fe
)
1627 u8 optimal_pll_ratio
= 20;
1628 u32 freq_adc
, ratio
, rest
, max
= 0;
1631 for (pll_ratio
= 17; pll_ratio
<= 20; pll_ratio
++) {
1632 freq_adc
= 12 * pll_ratio
* (1 << 8) / 16;
1633 ratio
= ((fe
->dtv_property_cache
.frequency
/ 1000) * (1 << 8) / 1000) / freq_adc
;
1634 rest
= ((fe
->dtv_property_cache
.frequency
/ 1000) * (1 << 8) / 1000) - ratio
* freq_adc
;
1636 if (rest
> freq_adc
/ 2)
1637 rest
= freq_adc
- rest
;
1638 deb_info("PLL ratio=%i rest=%i\n", pll_ratio
, rest
);
1639 if ((rest
> max
) && (rest
> 717)) {
1640 optimal_pll_ratio
= pll_ratio
;
1644 deb_info("optimal PLL ratio=%i\n", optimal_pll_ratio
);
1646 return optimal_pll_ratio
;
1649 static int dib8096_set_param_override(struct dvb_frontend
*fe
)
1651 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
1652 struct dib0700_adapter_state
*state
= adap
->priv
;
1653 u8 pll_ratio
, band
= BAND_OF_FREQUENCY(fe
->dtv_property_cache
.frequency
/ 1000);
1654 u16 target
, ltgain
, rf_gain_limit
;
1657 enum frontend_tune_state tune_state
= CT_SHUTDOWN
;
1661 deb_info("Warning : Rf frequency (%iHz) is not in the supported range, using VHF switch ", fe
->dtv_property_cache
.frequency
);
1664 state
->dib8000_ops
.set_gpio(fe
, 3, 0, 1);
1667 state
->dib8000_ops
.set_gpio(fe
, 3, 0, 0);
1671 ret
= state
->set_param_save(fe
);
1675 if (fe
->dtv_property_cache
.bandwidth_hz
!= 6000000) {
1676 deb_info("only 6MHz bandwidth is supported\n");
1680 /** Update PLL if needed ratio **/
1681 state
->dib8000_ops
.update_pll(fe
, &dib8090_pll_config_12mhz
, fe
->dtv_property_cache
.bandwidth_hz
/ 1000, 0);
1683 /** Get optimize PLL ratio to remove spurious **/
1684 pll_ratio
= dib8090_compute_pll_parameters(fe
);
1685 if (pll_ratio
== 17)
1687 else if (pll_ratio
== 18)
1689 else if (pll_ratio
== 19)
1694 /** Update ratio **/
1695 state
->dib8000_ops
.update_pll(fe
, &dib8090_pll_config_12mhz
, fe
->dtv_property_cache
.bandwidth_hz
/ 1000, pll_ratio
);
1697 state
->dib8000_ops
.ctrl_timf(fe
, DEMOD_TIMF_SET
, timf
);
1699 if (band
!= BAND_CBAND
) {
1700 /* dib0090_get_wbd_target is returning any possible temperature compensated wbd-target */
1701 target
= (dib0090_get_wbd_target(fe
) * 8 * 18 / 33 + 1) / 2;
1702 state
->dib8000_ops
.set_wbd_ref(fe
, target
);
1705 if (band
== BAND_CBAND
) {
1706 deb_info("tuning in CBAND - soft-AGC startup\n");
1707 dib0090_set_tune_state(fe
, CT_AGC_START
);
1710 ret
= dib0090_gain_control(fe
);
1712 tune_state
= dib0090_get_tune_state(fe
);
1713 if (tune_state
== CT_AGC_STEP_0
)
1714 state
->dib8000_ops
.set_gpio(fe
, 6, 0, 1);
1715 else if (tune_state
== CT_AGC_STEP_1
) {
1716 dib0090_get_current_gain(fe
, NULL
, NULL
, &rf_gain_limit
, <gain
);
1717 if (rf_gain_limit
< 2000) /* activate the external attenuator in case of very high input power */
1718 state
->dib8000_ops
.set_gpio(fe
, 6, 0, 0);
1720 } while (tune_state
< CT_AGC_STOP
);
1722 deb_info("switching to PWM AGC\n");
1723 dib0090_pwm_gain_reset(fe
);
1724 state
->dib8000_ops
.pwm_agc_reset(fe
);
1725 state
->dib8000_ops
.set_tune_state(fe
, CT_DEMOD_START
);
1727 /* for everything else than CBAND we are using standard AGC */
1728 deb_info("not tuning in CBAND - standard AGC startup\n");
1729 dib0090_pwm_gain_reset(fe
);
1735 static int dib809x_tuner_attach(struct dvb_usb_adapter
*adap
)
1737 struct dib0700_adapter_state
*st
= adap
->priv
;
1738 struct i2c_adapter
*tun_i2c
= st
->dib8000_ops
.get_i2c_master(adap
->fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_TUNER
, 1);
1740 if (adap
->id
== 0) {
1741 if (dvb_attach(dib0090_register
, adap
->fe_adap
[0].fe
, tun_i2c
, &dib809x_dib0090_config
) == NULL
)
1744 if (dvb_attach(dib0090_register
, adap
->fe_adap
[0].fe
, tun_i2c
, &dib809x_dib0090_config
) == NULL
)
1748 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
1749 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib8096_set_param_override
;
1753 static int stk809x_frontend_attach(struct dvb_usb_adapter
*adap
)
1755 struct dib0700_adapter_state
*state
= adap
->priv
;
1757 if (!dvb_attach(dib8000_attach
, &state
->dib8000_ops
))
1760 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
1762 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
1763 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
1764 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1766 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1768 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1771 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1773 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1775 state
->dib8000_ops
.i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18, 0x80, 0);
1777 adap
->fe_adap
[0].fe
= state
->dib8000_ops
.init(&adap
->dev
->i2c_adap
, 0x80, &dib809x_dib8000_config
[0]);
1779 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
1782 static int stk809x_frontend1_attach(struct dvb_usb_adapter
*adap
)
1784 struct dib0700_adapter_state
*state
= adap
->priv
;
1786 if (!dvb_attach(dib8000_attach
, &state
->dib8000_ops
))
1789 state
->dib8000_ops
.i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x10, 0x82, 0);
1791 adap
->fe_adap
[0].fe
= state
->dib8000_ops
.init(&adap
->dev
->i2c_adap
, 0x82, &dib809x_dib8000_config
[1]);
1793 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
1796 static int nim8096md_tuner_attach(struct dvb_usb_adapter
*adap
)
1798 struct dib0700_adapter_state
*st
= adap
->priv
;
1799 struct i2c_adapter
*tun_i2c
;
1800 struct dvb_frontend
*fe_slave
= st
->dib8000_ops
.get_slave_frontend(adap
->fe_adap
[0].fe
, 1);
1803 tun_i2c
= st
->dib8000_ops
.get_i2c_master(fe_slave
, DIBX000_I2C_INTERFACE_TUNER
, 1);
1804 if (dvb_attach(dib0090_register
, fe_slave
, tun_i2c
, &dib809x_dib0090_config
) == NULL
)
1806 fe_slave
->dvb
= adap
->fe_adap
[0].fe
->dvb
;
1807 fe_slave
->ops
.tuner_ops
.set_params
= dib8096_set_param_override
;
1809 tun_i2c
= st
->dib8000_ops
.get_i2c_master(adap
->fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_TUNER
, 1);
1810 if (dvb_attach(dib0090_register
, adap
->fe_adap
[0].fe
, tun_i2c
, &dib809x_dib0090_config
) == NULL
)
1813 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
1814 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib8096_set_param_override
;
1819 static int nim8096md_frontend_attach(struct dvb_usb_adapter
*adap
)
1821 struct dvb_frontend
*fe_slave
;
1822 struct dib0700_adapter_state
*state
= adap
->priv
;
1824 if (!dvb_attach(dib8000_attach
, &state
->dib8000_ops
))
1827 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
1829 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
1831 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
1832 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
1833 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
1835 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
1837 dib0700_ctrl_clock(adap
->dev
, 72, 1);
1840 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
1842 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
1844 state
->dib8000_ops
.i2c_enumeration(&adap
->dev
->i2c_adap
, 2, 18, 0x80, 0);
1846 adap
->fe_adap
[0].fe
= state
->dib8000_ops
.init(&adap
->dev
->i2c_adap
, 0x80, &dib809x_dib8000_config
[0]);
1847 if (adap
->fe_adap
[0].fe
== NULL
)
1850 /* Needed to increment refcount */
1851 if (!dvb_attach(dib8000_attach
, &state
->dib8000_ops
))
1854 fe_slave
= state
->dib8000_ops
.init(&adap
->dev
->i2c_adap
, 0x82, &dib809x_dib8000_config
[1]);
1855 state
->dib8000_ops
.set_slave_frontend(adap
->fe_adap
[0].fe
, fe_slave
);
1857 return fe_slave
== NULL
? -ENODEV
: 0;
1861 static struct dibx000_agc_config dib8096p_agc_config
[2] = {
1863 .band_caps
= BAND_UHF
,
1864 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1865 P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1866 P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1867 P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1869 .setup
= (0 << 15) | (0 << 14) | (5 << 11)
1870 | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5)
1871 | (0 << 4) | (5 << 1) | (0 << 0),
1874 .time_stabiliz
= 10,
1905 .perform_agc_softsplit
= 0,
1907 .band_caps
= BAND_FM
| BAND_VHF
| BAND_CBAND
,
1908 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1909 P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1910 P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1911 P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1913 .setup
= (0 << 15) | (0 << 14) | (5 << 11)
1914 | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5)
1915 | (0 << 4) | (5 << 1) | (0 << 0),
1918 .time_stabiliz
= 10,
1949 .perform_agc_softsplit
= 0,
1953 static struct dibx000_bandwidth_config dib8096p_clock_config_12_mhz
= {
1963 .IO_CLK_en_core
= 0,
1966 .sad_cfg
= (3 << 14) | (1 << 12) | (524 << 0),
1967 .ifreq
= (0 << 25) | 0,
1969 .xtal_hz
= 12000000,
1972 static struct dib8000_config tfe8096p_dib8000_config
= {
1973 .output_mpeg2_in_188_bytes
= 1,
1974 .hostbus_diversity
= 1,
1977 .agc_config_count
= 2,
1978 .agc
= dib8096p_agc_config
,
1979 .pll
= &dib8096p_clock_config_12_mhz
,
1981 .gpio_dir
= DIB8000_GPIO_DEFAULT_DIRECTIONS
,
1982 .gpio_val
= DIB8000_GPIO_DEFAULT_VALUES
,
1983 .gpio_pwm_pos
= DIB8000_GPIO_DEFAULT_PWM_POS
,
1985 .agc_control
= NULL
,
1986 .diversity_delay
= 48,
1987 .output_mode
= OUTMODE_MPEG2_FIFO
,
1991 static struct dib0090_wbd_slope dib8096p_wbd_table
[] = {
1992 { 380, 81, 850, 64, 540, 4},
1993 { 860, 51, 866, 21, 375, 4},
1994 {1700, 0, 250, 0, 100, 6},
1995 {2600, 0, 250, 0, 100, 6},
1996 { 0xFFFF, 0, 0, 0, 0, 0},
1999 static struct dib0090_config tfe8096p_dib0090_config
= {
2000 .io
.clock_khz
= 12000,
2004 .io
.pll_loopdiv
= 6,
2005 .io
.adc_clock_ratio
= 0,
2006 .io
.pll_int_loop_filt
= 0,
2008 .freq_offset_khz_uhf
= -143,
2009 .freq_offset_khz_vhf
= -143,
2011 .get_adc_power
= dib8090_get_adc_power
,
2016 .wbd_vhf_offset
= 0,
2017 .wbd_cband_offset
= 0,
2021 .fref_clock_ratio
= 1,
2023 .ls_cfg_pad_drv
= 0,
2027 .force_cband_input
= 0,
2030 struct dibx090p_adc
{
2031 u32 freq
; /* RF freq MHz */
2032 u32 timf
; /* New Timf */
2033 u32 pll_loopdiv
; /* New prediv */
2034 u32 pll_prediv
; /* New loopdiv */
2037 struct dibx090p_best_adc
{
2043 static int dib8096p_get_best_sampling(struct dvb_frontend
*fe
, struct dibx090p_best_adc
*adc
)
2045 u8 spur
= 0, prediv
= 0, loopdiv
= 0, min_prediv
= 1, max_prediv
= 1;
2047 u16 fcp_min
= 1900; /* PLL, Minimum Frequency of phase comparator (KHz) */
2048 u16 fcp_max
= 20000; /* PLL, Maximum Frequency of phase comparator (KHz) */
2049 u32 fmem_max
= 140000; /* 140MHz max SDRAM freq */
2050 u32 fdem_min
= 66000;
2051 u32 fcp
= 0, fs
= 0, fdem
= 0, fmem
= 0;
2052 u32 harmonic_id
= 0;
2055 adc
->pll_loopdiv
= loopdiv
;
2056 adc
->pll_prediv
= prediv
;
2058 deb_info("bandwidth = %d", fe
->dtv_property_cache
.bandwidth_hz
);
2060 /* Find Min and Max prediv */
2061 while ((xtal
/ max_prediv
) >= fcp_min
)
2065 min_prediv
= max_prediv
;
2066 while ((xtal
/ min_prediv
) <= fcp_max
) {
2068 if (min_prediv
== 1)
2071 deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv
, max_prediv
);
2075 for (prediv
= min_prediv
; prediv
< max_prediv
; prediv
++) {
2076 fcp
= xtal
/ prediv
;
2077 if (fcp
> fcp_min
&& fcp
< fcp_max
) {
2078 for (loopdiv
= 1; loopdiv
< 64; loopdiv
++) {
2079 fmem
= ((xtal
/prediv
) * loopdiv
);
2083 /* test min/max system restrictions */
2084 if ((fdem
>= fdem_min
) && (fmem
<= fmem_max
) && (fs
>= fe
->dtv_property_cache
.bandwidth_hz
/ 1000)) {
2086 /* test fs harmonics positions */
2087 for (harmonic_id
= (fe
->dtv_property_cache
.frequency
/ (1000 * fs
)); harmonic_id
<= ((fe
->dtv_property_cache
.frequency
/ (1000 * fs
)) + 1); harmonic_id
++) {
2088 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)))) {
2095 adc
->pll_loopdiv
= loopdiv
;
2096 adc
->pll_prediv
= prediv
;
2097 adc
->timf
= (4260880253U / fdem
) * (1 << 8);
2098 adc
->timf
+= ((4260880253U % fdem
) << 8) / fdem
;
2100 deb_info("RF %6d; BW %6d; Xtal %6d; Fmem %6d; Fdem %6d; Fs %6d; Prediv %2d; Loopdiv %2d; Timf %8d;", fe
->dtv_property_cache
.frequency
, fe
->dtv_property_cache
.bandwidth_hz
, xtal
, fmem
, fdem
, fs
, prediv
, loopdiv
, adc
->timf
);
2110 if (adc
->pll_loopdiv
== 0 && adc
->pll_prediv
== 0)
2115 static int dib8096p_agc_startup(struct dvb_frontend
*fe
)
2117 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
2118 struct dib0700_adapter_state
*state
= adap
->priv
;
2119 struct dibx000_bandwidth_config pll
;
2120 struct dibx090p_best_adc adc
;
2124 ret
= state
->set_param_save(fe
);
2127 memset(&pll
, 0, sizeof(struct dibx000_bandwidth_config
));
2129 dib0090_pwm_gain_reset(fe
);
2130 /* dib0090_get_wbd_target is returning any possible
2131 temperature compensated wbd-target */
2132 target
= (dib0090_get_wbd_target(fe
) * 8 + 1) / 2;
2133 state
->dib8000_ops
.set_wbd_ref(fe
, target
);
2135 if (dib8096p_get_best_sampling(fe
, &adc
) == 0) {
2136 pll
.pll_ratio
= adc
.pll_loopdiv
;
2137 pll
.pll_prediv
= adc
.pll_prediv
;
2139 dib0700_set_i2c_speed(adap
->dev
, 200);
2140 state
->dib8000_ops
.update_pll(fe
, &pll
, fe
->dtv_property_cache
.bandwidth_hz
/ 1000, 0);
2141 state
->dib8000_ops
.ctrl_timf(fe
, DEMOD_TIMF_SET
, adc
.timf
);
2142 dib0700_set_i2c_speed(adap
->dev
, 1000);
2147 static int tfe8096p_frontend_attach(struct dvb_usb_adapter
*adap
)
2149 struct dib0700_state
*st
= adap
->dev
->priv
;
2151 struct dib0700_adapter_state
*state
= adap
->priv
;
2153 if (!dvb_attach(dib8000_attach
, &state
->dib8000_ops
))
2156 dib0700_get_version(adap
->dev
, NULL
, NULL
, &fw_version
, NULL
);
2157 if (fw_version
>= 0x10200)
2158 st
->fw_use_new_i2c_api
= 1;
2160 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
2162 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
2163 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
2164 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
2166 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
2168 dib0700_ctrl_clock(adap
->dev
, 72, 1);
2171 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
2173 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
2175 state
->dib8000_ops
.i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x10, 0x80, 1);
2177 adap
->fe_adap
[0].fe
= state
->dib8000_ops
.init(&adap
->dev
->i2c_adap
,
2178 0x80, &tfe8096p_dib8000_config
);
2180 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
2183 static int tfe8096p_tuner_attach(struct dvb_usb_adapter
*adap
)
2185 struct dib0700_adapter_state
*st
= adap
->priv
;
2186 struct i2c_adapter
*tun_i2c
= st
->dib8000_ops
.get_i2c_tuner(adap
->fe_adap
[0].fe
);
2188 tfe8096p_dib0090_config
.reset
= st
->dib8000_ops
.tuner_sleep
;
2189 tfe8096p_dib0090_config
.sleep
= st
->dib8000_ops
.tuner_sleep
;
2190 tfe8096p_dib0090_config
.wbd
= dib8096p_wbd_table
;
2192 if (dvb_attach(dib0090_register
, adap
->fe_adap
[0].fe
, tun_i2c
,
2193 &tfe8096p_dib0090_config
) == NULL
)
2196 st
->dib8000_ops
.set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 1);
2198 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
2199 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib8096p_agc_startup
;
2204 static int dib90x0_pid_filter(struct dvb_usb_adapter
*adapter
, int index
, u16 pid
, int onoff
)
2206 return dib9000_fw_pid_filter(adapter
->fe_adap
[0].fe
, index
, pid
, onoff
);
2209 static int dib90x0_pid_filter_ctrl(struct dvb_usb_adapter
*adapter
, int onoff
)
2211 return dib9000_fw_pid_filter_ctrl(adapter
->fe_adap
[0].fe
, onoff
);
2214 static int dib90x0_tuner_reset(struct dvb_frontend
*fe
, int onoff
)
2216 return dib9000_set_gpio(fe
, 5, 0, !onoff
);
2219 static int dib90x0_tuner_sleep(struct dvb_frontend
*fe
, int onoff
)
2221 return dib9000_set_gpio(fe
, 0, 0, onoff
);
2224 static int dib01x0_pmu_update(struct i2c_adapter
*i2c
, u16
*data
, u8 len
)
2226 u8 wb
[4] = { 0xc >> 8, 0xc & 0xff, 0, 0 };
2228 struct i2c_msg msg
[2] = {
2229 {.addr
= 0x1e >> 1, .flags
= 0, .buf
= wb
, .len
= 2},
2230 {.addr
= 0x1e >> 1, .flags
= I2C_M_RD
, .buf
= rb
, .len
= 2},
2234 dibx000_i2c_set_speed(i2c
, 250);
2236 if (i2c_transfer(i2c
, msg
, 2) != 2)
2239 switch (rb
[0] << 8 | rb
[1]) {
2241 deb_info("Found DiB0170 rev1: This version of DiB0170 is not supported any longer.\n");
2244 deb_info("Found DiB0170 rev2");
2247 deb_info("Found DiB0190 rev2");
2250 deb_info("DiB01x0 not found");
2254 for (index_data
= 0; index_data
< len
; index_data
+= 2) {
2255 wb
[2] = (data
[index_data
+ 1] >> 8) & 0xff;
2256 wb
[3] = (data
[index_data
+ 1]) & 0xff;
2258 if (data
[index_data
] == 0) {
2259 wb
[0] = (data
[index_data
] >> 8) & 0xff;
2260 wb
[1] = (data
[index_data
]) & 0xff;
2262 if (i2c_transfer(i2c
, msg
, 2) != 2)
2265 wb
[3] |= rb
[1] & ~(3 << 4);
2268 wb
[0] = (data
[index_data
] >> 8)&0xff;
2269 wb
[1] = (data
[index_data
])&0xff;
2271 if (i2c_transfer(i2c
, &msg
[0], 1) != 1)
2277 static struct dib9000_config stk9090m_config
= {
2278 .output_mpeg2_in_188_bytes
= 1,
2279 .output_mode
= OUTMODE_MPEG2_FIFO
,
2280 .vcxo_timer
= 279620,
2281 .timing_frequency
= 20452225,
2282 .demod_clock_khz
= 60000,
2283 .xtal_clock_khz
= 30000,
2284 .if_drives
= (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
2288 { 240, { BOARD_GPIO_COMPONENT_DEMOD
, BOARD_GPIO_FUNCTION_SUBBAND_GPIO
, 0x0008, 0x0000, 0x0008 } }, /* GPIO 3 to 1 for VHF */
2289 { 890, { BOARD_GPIO_COMPONENT_DEMOD
, BOARD_GPIO_FUNCTION_SUBBAND_GPIO
, 0x0008, 0x0000, 0x0000 } }, /* GPIO 3 to 0 for UHF */
2294 { .component
= BOARD_GPIO_COMPONENT_DEMOD
, .function
= BOARD_GPIO_FUNCTION_COMPONENT_ON
, .mask
= 0x10 | 0x21, .direction
= 0 & ~0x21, .value
= (0x10 & ~0x1) | 0x20 },
2295 { .component
= BOARD_GPIO_COMPONENT_DEMOD
, .function
= BOARD_GPIO_FUNCTION_COMPONENT_OFF
, .mask
= 0x10 | 0x21, .direction
= 0 & ~0x21, .value
= 0 | 0x21 },
2299 static struct dib9000_config nim9090md_config
[2] = {
2301 .output_mpeg2_in_188_bytes
= 1,
2302 .output_mode
= OUTMODE_MPEG2_FIFO
,
2303 .vcxo_timer
= 279620,
2304 .timing_frequency
= 20452225,
2305 .demod_clock_khz
= 60000,
2306 .xtal_clock_khz
= 30000,
2307 .if_drives
= (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
2309 .output_mpeg2_in_188_bytes
= 1,
2310 .output_mode
= OUTMODE_DIVERSITY
,
2311 .vcxo_timer
= 279620,
2312 .timing_frequency
= 20452225,
2313 .demod_clock_khz
= 60000,
2314 .xtal_clock_khz
= 30000,
2315 .if_drives
= (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
2319 { 240, { BOARD_GPIO_COMPONENT_DEMOD
, BOARD_GPIO_FUNCTION_SUBBAND_GPIO
, 0x0006, 0x0000, 0x0006 } }, /* GPIO 1 and 2 to 1 for VHF */
2320 { 890, { BOARD_GPIO_COMPONENT_DEMOD
, BOARD_GPIO_FUNCTION_SUBBAND_GPIO
, 0x0006, 0x0000, 0x0000 } }, /* GPIO 1 and 2 to 0 for UHF */
2325 { .component
= BOARD_GPIO_COMPONENT_DEMOD
, .function
= BOARD_GPIO_FUNCTION_COMPONENT_ON
, .mask
= 0x10 | 0x21, .direction
= 0 & ~0x21, .value
= (0x10 & ~0x1) | 0x20 },
2326 { .component
= BOARD_GPIO_COMPONENT_DEMOD
, .function
= BOARD_GPIO_FUNCTION_COMPONENT_OFF
, .mask
= 0x10 | 0x21, .direction
= 0 & ~0x21, .value
= 0 | 0x21 },
2331 static struct dib0090_config dib9090_dib0090_config
= {
2335 .io
.pll_loopdiv
= 8,
2336 .io
.adc_clock_ratio
= 8,
2337 .io
.pll_int_loop_filt
= 0,
2338 .io
.clock_khz
= 30000,
2339 .reset
= dib90x0_tuner_reset
,
2340 .sleep
= dib90x0_tuner_sleep
,
2345 .freq_offset_khz_uhf
= 0,
2346 .freq_offset_khz_vhf
= 0,
2349 static struct dib0090_config nim9090md_dib0090_config
[2] = {
2354 .io
.pll_loopdiv
= 8,
2355 .io
.adc_clock_ratio
= 8,
2356 .io
.pll_int_loop_filt
= 0,
2357 .io
.clock_khz
= 30000,
2358 .reset
= dib90x0_tuner_reset
,
2359 .sleep
= dib90x0_tuner_sleep
,
2364 .freq_offset_khz_uhf
= 0,
2365 .freq_offset_khz_vhf
= 0,
2370 .io
.pll_loopdiv
= 8,
2371 .io
.adc_clock_ratio
= 8,
2372 .io
.pll_int_loop_filt
= 0,
2373 .io
.clock_khz
= 30000,
2374 .reset
= dib90x0_tuner_reset
,
2375 .sleep
= dib90x0_tuner_sleep
,
2380 .freq_offset_khz_uhf
= 0,
2381 .freq_offset_khz_vhf
= 0,
2386 static int stk9090m_frontend_attach(struct dvb_usb_adapter
*adap
)
2388 struct dib0700_adapter_state
*state
= adap
->priv
;
2389 struct dib0700_state
*st
= adap
->dev
->priv
;
2392 /* Make use of the new i2c functions from FW 1.20 */
2393 dib0700_get_version(adap
->dev
, NULL
, NULL
, &fw_version
, NULL
);
2394 if (fw_version
>= 0x10200)
2395 st
->fw_use_new_i2c_api
= 1;
2396 dib0700_set_i2c_speed(adap
->dev
, 340);
2398 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
2400 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
2401 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
2402 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
2403 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
2405 dib0700_ctrl_clock(adap
->dev
, 72, 1);
2408 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
2410 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
2412 dib9000_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x10, 0x80);
2414 if (request_firmware(&state
->frontend_firmware
, "dib9090.fw", &adap
->dev
->udev
->dev
)) {
2415 deb_info("%s: Upload failed. (file not found?)\n", __func__
);
2418 deb_info("%s: firmware read %zu bytes.\n", __func__
, state
->frontend_firmware
->size
);
2420 stk9090m_config
.microcode_B_fe_size
= state
->frontend_firmware
->size
;
2421 stk9090m_config
.microcode_B_fe_buffer
= state
->frontend_firmware
->data
;
2423 adap
->fe_adap
[0].fe
= dvb_attach(dib9000_attach
, &adap
->dev
->i2c_adap
, 0x80, &stk9090m_config
);
2425 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
2428 static int dib9090_tuner_attach(struct dvb_usb_adapter
*adap
)
2430 struct dib0700_adapter_state
*state
= adap
->priv
;
2431 struct i2c_adapter
*i2c
= dib9000_get_tuner_interface(adap
->fe_adap
[0].fe
);
2432 u16 data_dib190
[10] = {
2440 if (dvb_attach(dib0090_fw_register
, adap
->fe_adap
[0].fe
, i2c
, &dib9090_dib0090_config
) == NULL
)
2442 i2c
= dib9000_get_i2c_master(adap
->fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_GPIO_1_2
, 0);
2443 if (dib01x0_pmu_update(i2c
, data_dib190
, 10) != 0)
2445 dib0700_set_i2c_speed(adap
->dev
, 1500);
2446 if (dib9000_firmware_post_pll_init(adap
->fe_adap
[0].fe
) < 0)
2448 release_firmware(state
->frontend_firmware
);
2452 static int nim9090md_frontend_attach(struct dvb_usb_adapter
*adap
)
2454 struct dib0700_adapter_state
*state
= adap
->priv
;
2455 struct dib0700_state
*st
= adap
->dev
->priv
;
2456 struct i2c_adapter
*i2c
;
2457 struct dvb_frontend
*fe_slave
;
2460 /* Make use of the new i2c functions from FW 1.20 */
2461 dib0700_get_version(adap
->dev
, NULL
, NULL
, &fw_version
, NULL
);
2462 if (fw_version
>= 0x10200)
2463 st
->fw_use_new_i2c_api
= 1;
2464 dib0700_set_i2c_speed(adap
->dev
, 340);
2466 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
2468 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
2469 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
2470 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
2471 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
2473 dib0700_ctrl_clock(adap
->dev
, 72, 1);
2476 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
2478 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
2480 if (request_firmware(&state
->frontend_firmware
, "dib9090.fw", &adap
->dev
->udev
->dev
)) {
2481 deb_info("%s: Upload failed. (file not found?)\n", __func__
);
2484 deb_info("%s: firmware read %zu bytes.\n", __func__
, state
->frontend_firmware
->size
);
2486 nim9090md_config
[0].microcode_B_fe_size
= state
->frontend_firmware
->size
;
2487 nim9090md_config
[0].microcode_B_fe_buffer
= state
->frontend_firmware
->data
;
2488 nim9090md_config
[1].microcode_B_fe_size
= state
->frontend_firmware
->size
;
2489 nim9090md_config
[1].microcode_B_fe_buffer
= state
->frontend_firmware
->data
;
2491 dib9000_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x20, 0x80);
2492 adap
->fe_adap
[0].fe
= dvb_attach(dib9000_attach
, &adap
->dev
->i2c_adap
, 0x80, &nim9090md_config
[0]);
2494 if (adap
->fe_adap
[0].fe
== NULL
)
2497 i2c
= dib9000_get_i2c_master(adap
->fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_GPIO_3_4
, 0);
2498 dib9000_i2c_enumeration(i2c
, 1, 0x12, 0x82);
2500 fe_slave
= dvb_attach(dib9000_attach
, i2c
, 0x82, &nim9090md_config
[1]);
2501 dib9000_set_slave_frontend(adap
->fe_adap
[0].fe
, fe_slave
);
2503 return fe_slave
== NULL
? -ENODEV
: 0;
2506 static int nim9090md_tuner_attach(struct dvb_usb_adapter
*adap
)
2508 struct dib0700_adapter_state
*state
= adap
->priv
;
2509 struct i2c_adapter
*i2c
;
2510 struct dvb_frontend
*fe_slave
;
2511 u16 data_dib190
[10] = {
2518 i2c
= dib9000_get_tuner_interface(adap
->fe_adap
[0].fe
);
2519 if (dvb_attach(dib0090_fw_register
, adap
->fe_adap
[0].fe
, i2c
, &nim9090md_dib0090_config
[0]) == NULL
)
2521 i2c
= dib9000_get_i2c_master(adap
->fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_GPIO_1_2
, 0);
2522 if (dib01x0_pmu_update(i2c
, data_dib190
, 10) < 0)
2525 dib0700_set_i2c_speed(adap
->dev
, 1500);
2526 if (dib9000_firmware_post_pll_init(adap
->fe_adap
[0].fe
) < 0)
2529 fe_slave
= dib9000_get_slave_frontend(adap
->fe_adap
[0].fe
, 1);
2530 if (fe_slave
!= NULL
) {
2531 i2c
= dib9000_get_component_bus_interface(adap
->fe_adap
[0].fe
);
2532 dib9000_set_i2c_adapter(fe_slave
, i2c
);
2534 i2c
= dib9000_get_tuner_interface(fe_slave
);
2535 if (dvb_attach(dib0090_fw_register
, fe_slave
, i2c
, &nim9090md_dib0090_config
[1]) == NULL
)
2537 fe_slave
->dvb
= adap
->fe_adap
[0].fe
->dvb
;
2538 dib9000_fw_set_component_bus_speed(adap
->fe_adap
[0].fe
, 1500);
2539 if (dib9000_firmware_post_pll_init(fe_slave
) < 0)
2542 release_firmware(state
->frontend_firmware
);
2548 static int dib7090p_get_best_sampling(struct dvb_frontend
*fe
, struct dibx090p_best_adc
*adc
)
2550 u8 spur
= 0, prediv
= 0, loopdiv
= 0, min_prediv
= 1, max_prediv
= 1;
2553 u32 fcp_min
= 1900; /* PLL Minimum Frequency comparator KHz */
2554 u32 fcp_max
= 20000; /* PLL Maximum Frequency comparator KHz */
2555 u32 fdem_max
= 76000;
2556 u32 fdem_min
= 69500;
2557 u32 fcp
= 0, fs
= 0, fdem
= 0;
2558 u32 harmonic_id
= 0;
2560 adc
->pll_loopdiv
= loopdiv
;
2561 adc
->pll_prediv
= prediv
;
2564 deb_info("bandwidth = %d fdem_min =%d", fe
->dtv_property_cache
.bandwidth_hz
, fdem_min
);
2566 /* Find Min and Max prediv */
2567 while ((xtal
/max_prediv
) >= fcp_min
)
2571 min_prediv
= max_prediv
;
2572 while ((xtal
/min_prediv
) <= fcp_max
) {
2574 if (min_prediv
== 1)
2577 deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv
, max_prediv
);
2581 for (prediv
= min_prediv
; prediv
< max_prediv
; prediv
++) {
2582 fcp
= xtal
/ prediv
;
2583 if (fcp
> fcp_min
&& fcp
< fcp_max
) {
2584 for (loopdiv
= 1 ; loopdiv
< 64 ; loopdiv
++) {
2585 fdem
= ((xtal
/prediv
) * loopdiv
);
2587 /* test min/max system restrictions */
2589 if ((fdem
>= fdem_min
) && (fdem
<= fdem_max
) && (fs
>= fe
->dtv_property_cache
.bandwidth_hz
/1000)) {
2591 /* test fs harmonics positions */
2592 for (harmonic_id
= (fe
->dtv_property_cache
.frequency
/ (1000*fs
)) ; harmonic_id
<= ((fe
->dtv_property_cache
.frequency
/ (1000*fs
))+1) ; harmonic_id
++) {
2593 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)))) {
2600 adc
->pll_loopdiv
= loopdiv
;
2601 adc
->pll_prediv
= prediv
;
2602 adc
->timf
= 2396745143UL/fdem
*(1 << 9);
2603 adc
->timf
+= ((2396745143UL%fdem
) << 9)/fdem
;
2604 deb_info("loopdiv=%i prediv=%i timf=%i", loopdiv
, prediv
, adc
->timf
);
2615 if (adc
->pll_loopdiv
== 0 && adc
->pll_prediv
== 0)
2621 static int dib7090_agc_startup(struct dvb_frontend
*fe
)
2623 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
2624 struct dib0700_adapter_state
*state
= adap
->priv
;
2625 struct dibx000_bandwidth_config pll
;
2627 struct dibx090p_best_adc adc
;
2630 ret
= state
->set_param_save(fe
);
2634 memset(&pll
, 0, sizeof(struct dibx000_bandwidth_config
));
2635 dib0090_pwm_gain_reset(fe
);
2636 target
= (dib0090_get_wbd_target(fe
) * 8 + 1) / 2;
2637 state
->dib7000p_ops
.set_wbd_ref(fe
, target
);
2639 if (dib7090p_get_best_sampling(fe
, &adc
) == 0) {
2640 pll
.pll_ratio
= adc
.pll_loopdiv
;
2641 pll
.pll_prediv
= adc
.pll_prediv
;
2643 state
->dib7000p_ops
.update_pll(fe
, &pll
);
2644 state
->dib7000p_ops
.ctrl_timf(fe
, DEMOD_TIMF_SET
, adc
.timf
);
2649 static int dib7090_agc_restart(struct dvb_frontend
*fe
, u8 restart
)
2651 deb_info("AGC restart callback: %d", restart
);
2652 if (restart
== 0) /* before AGC startup */
2653 dib0090_set_dc_servo(fe
, 1);
2657 static int tfe7790p_update_lna(struct dvb_frontend
*fe
, u16 agc_global
)
2659 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
2660 struct dib0700_adapter_state
*state
= adap
->priv
;
2662 deb_info("update LNA: agc global=%i", agc_global
);
2664 if (agc_global
< 25000) {
2665 state
->dib7000p_ops
.set_gpio(fe
, 8, 0, 0);
2666 state
->dib7000p_ops
.set_agc1_min(fe
, 0);
2668 state
->dib7000p_ops
.set_gpio(fe
, 8, 0, 1);
2669 state
->dib7000p_ops
.set_agc1_min(fe
, 32768);
2675 static struct dib0090_wbd_slope dib7090_wbd_table
[] = {
2676 { 380, 81, 850, 64, 540, 4},
2677 { 860, 51, 866, 21, 375, 4},
2678 {1700, 0, 250, 0, 100, 6},
2679 {2600, 0, 250, 0, 100, 6},
2680 { 0xFFFF, 0, 0, 0, 0, 0},
2683 static struct dibx000_agc_config dib7090_agc_config
[2] = {
2685 .band_caps
= BAND_UHF
,
2686 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
2687 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
2688 .setup
= (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2691 .time_stabiliz
= 10,
2722 .perform_agc_softsplit
= 0,
2724 .band_caps
= BAND_FM
| BAND_VHF
| BAND_CBAND
,
2725 /* 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,
2726 * 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 */
2727 .setup
= (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2730 .time_stabiliz
= 10,
2761 .perform_agc_softsplit
= 0,
2765 static struct dibx000_bandwidth_config dib7090_clock_config_12_mhz
= {
2775 .IO_CLK_en_core
= 1,
2778 .sad_cfg
= (3 << 14) | (1 << 12) | (524 << 0),
2779 .ifreq
= (0 << 25) | 0,
2781 .xtal_hz
= 15000000,
2784 static struct dib7000p_config nim7090_dib7000p_config
= {
2785 .output_mpeg2_in_188_bytes
= 1,
2786 .hostbus_diversity
= 1,
2787 .tuner_is_baseband
= 1,
2788 .update_lna
= tfe7790p_update_lna
, /* GPIO used is the same as TFE7790 */
2790 .agc_config_count
= 2,
2791 .agc
= dib7090_agc_config
,
2793 .bw
= &dib7090_clock_config_12_mhz
,
2795 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
2796 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
2797 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
2801 .agc_control
= dib7090_agc_restart
,
2804 .disable_sample_and_hold
= 0,
2805 .enable_current_mirror
= 0,
2806 .diversity_delay
= 0,
2808 .output_mode
= OUTMODE_MPEG2_FIFO
,
2812 static int tfe7090p_pvr_update_lna(struct dvb_frontend
*fe
, u16 agc_global
)
2814 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
2815 struct dib0700_adapter_state
*state
= adap
->priv
;
2817 deb_info("TFE7090P-PVR update LNA: agc global=%i", agc_global
);
2818 if (agc_global
< 25000) {
2819 state
->dib7000p_ops
.set_gpio(fe
, 5, 0, 0);
2820 state
->dib7000p_ops
.set_agc1_min(fe
, 0);
2822 state
->dib7000p_ops
.set_gpio(fe
, 5, 0, 1);
2823 state
->dib7000p_ops
.set_agc1_min(fe
, 32768);
2829 static struct dib7000p_config tfe7090pvr_dib7000p_config
[2] = {
2831 .output_mpeg2_in_188_bytes
= 1,
2832 .hostbus_diversity
= 1,
2833 .tuner_is_baseband
= 1,
2834 .update_lna
= tfe7090p_pvr_update_lna
,
2836 .agc_config_count
= 2,
2837 .agc
= dib7090_agc_config
,
2839 .bw
= &dib7090_clock_config_12_mhz
,
2841 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
2842 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
2843 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
2847 .agc_control
= dib7090_agc_restart
,
2850 .disable_sample_and_hold
= 0,
2851 .enable_current_mirror
= 0,
2852 .diversity_delay
= 0,
2854 .output_mode
= OUTMODE_MPEG2_PAR_GATED_CLK
,
2855 .default_i2c_addr
= 0x90,
2858 .output_mpeg2_in_188_bytes
= 1,
2859 .hostbus_diversity
= 1,
2860 .tuner_is_baseband
= 1,
2861 .update_lna
= tfe7090p_pvr_update_lna
,
2863 .agc_config_count
= 2,
2864 .agc
= dib7090_agc_config
,
2866 .bw
= &dib7090_clock_config_12_mhz
,
2868 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
2869 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
2870 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
2874 .agc_control
= dib7090_agc_restart
,
2877 .disable_sample_and_hold
= 0,
2878 .enable_current_mirror
= 0,
2879 .diversity_delay
= 0,
2881 .output_mode
= OUTMODE_MPEG2_PAR_GATED_CLK
,
2882 .default_i2c_addr
= 0x92,
2887 static struct dib0090_config nim7090_dib0090_config
= {
2888 .io
.clock_khz
= 12000,
2892 .io
.pll_loopdiv
= 6,
2893 .io
.adc_clock_ratio
= 0,
2894 .io
.pll_int_loop_filt
= 0,
2896 .freq_offset_khz_uhf
= 0,
2897 .freq_offset_khz_vhf
= 0,
2902 .wbd_vhf_offset
= 0,
2903 .wbd_cband_offset
= 0,
2907 .fref_clock_ratio
= 0,
2909 .wbd
= dib7090_wbd_table
,
2911 .ls_cfg_pad_drv
= 0,
2917 static struct dib7000p_config tfe7790p_dib7000p_config
= {
2918 .output_mpeg2_in_188_bytes
= 1,
2919 .hostbus_diversity
= 1,
2920 .tuner_is_baseband
= 1,
2921 .update_lna
= tfe7790p_update_lna
,
2923 .agc_config_count
= 2,
2924 .agc
= dib7090_agc_config
,
2926 .bw
= &dib7090_clock_config_12_mhz
,
2928 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
2929 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
2930 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
2934 .agc_control
= dib7090_agc_restart
,
2937 .disable_sample_and_hold
= 0,
2938 .enable_current_mirror
= 0,
2939 .diversity_delay
= 0,
2941 .output_mode
= OUTMODE_MPEG2_PAR_GATED_CLK
,
2945 static struct dib0090_config tfe7790p_dib0090_config
= {
2946 .io
.clock_khz
= 12000,
2950 .io
.pll_loopdiv
= 6,
2951 .io
.adc_clock_ratio
= 0,
2952 .io
.pll_int_loop_filt
= 0,
2954 .freq_offset_khz_uhf
= 0,
2955 .freq_offset_khz_vhf
= 0,
2960 .wbd_vhf_offset
= 0,
2961 .wbd_cband_offset
= 0,
2965 .fref_clock_ratio
= 0,
2967 .wbd
= dib7090_wbd_table
,
2969 .ls_cfg_pad_drv
= 0,
2973 .force_cband_input
= 0,
2975 .force_crystal_mode
= 1,
2978 static struct dib0090_config tfe7090pvr_dib0090_config
[2] = {
2980 .io
.clock_khz
= 12000,
2984 .io
.pll_loopdiv
= 6,
2985 .io
.adc_clock_ratio
= 0,
2986 .io
.pll_int_loop_filt
= 0,
2988 .freq_offset_khz_uhf
= 50,
2989 .freq_offset_khz_vhf
= 70,
2994 .wbd_vhf_offset
= 0,
2995 .wbd_cband_offset
= 0,
2999 .fref_clock_ratio
= 0,
3001 .wbd
= dib7090_wbd_table
,
3003 .ls_cfg_pad_drv
= 0,
3008 .io
.clock_khz
= 12000,
3012 .io
.pll_loopdiv
= 6,
3013 .io
.adc_clock_ratio
= 0,
3014 .io
.pll_int_loop_filt
= 0,
3016 .freq_offset_khz_uhf
= -50,
3017 .freq_offset_khz_vhf
= -70,
3022 .wbd_vhf_offset
= 0,
3023 .wbd_cband_offset
= 0,
3027 .fref_clock_ratio
= 0,
3029 .wbd
= dib7090_wbd_table
,
3031 .ls_cfg_pad_drv
= 0,
3038 static int nim7090_frontend_attach(struct dvb_usb_adapter
*adap
)
3040 struct dib0700_adapter_state
*state
= adap
->priv
;
3042 if (!dvb_attach(dib7000p_attach
, &state
->dib7000p_ops
))
3045 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
3047 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
3048 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
3049 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
3050 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
3053 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
3055 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
3057 if (state
->dib7000p_ops
.i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x10, &nim7090_dib7000p_config
) != 0) {
3058 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__
);
3059 dvb_detach(&state
->dib7000p_ops
);
3062 adap
->fe_adap
[0].fe
= state
->dib7000p_ops
.init(&adap
->dev
->i2c_adap
, 0x80, &nim7090_dib7000p_config
);
3064 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
3067 static int nim7090_tuner_attach(struct dvb_usb_adapter
*adap
)
3069 struct dib0700_adapter_state
*st
= adap
->priv
;
3070 struct i2c_adapter
*tun_i2c
= st
->dib7000p_ops
.get_i2c_tuner(adap
->fe_adap
[0].fe
);
3072 nim7090_dib0090_config
.reset
= st
->dib7000p_ops
.tuner_sleep
,
3073 nim7090_dib0090_config
.sleep
= st
->dib7000p_ops
.tuner_sleep
,
3074 nim7090_dib0090_config
.get_adc_power
= st
->dib7000p_ops
.get_adc_power
;
3076 if (dvb_attach(dib0090_register
, adap
->fe_adap
[0].fe
, tun_i2c
, &nim7090_dib0090_config
) == NULL
)
3079 st
->dib7000p_ops
.set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 1);
3081 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
3082 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib7090_agc_startup
;
3086 static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter
*adap
)
3088 struct dib0700_state
*st
= adap
->dev
->priv
;
3089 struct dib0700_adapter_state
*state
= adap
->priv
;
3091 if (!dvb_attach(dib7000p_attach
, &state
->dib7000p_ops
))
3094 /* The TFE7090 requires the dib0700 to not be in master mode */
3095 st
->disable_streaming_master_mode
= 1;
3097 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
3099 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
3100 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
3101 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
3102 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
3105 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
3107 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
3109 /* initialize IC 0 */
3110 if (state
->dib7000p_ops
.i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 0x20, &tfe7090pvr_dib7000p_config
[0]) != 0) {
3111 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__
);
3112 dvb_detach(&state
->dib7000p_ops
);
3116 dib0700_set_i2c_speed(adap
->dev
, 340);
3117 adap
->fe_adap
[0].fe
= state
->dib7000p_ops
.init(&adap
->dev
->i2c_adap
, 0x90, &tfe7090pvr_dib7000p_config
[0]);
3118 if (adap
->fe_adap
[0].fe
== NULL
)
3121 state
->dib7000p_ops
.slave_reset(adap
->fe_adap
[0].fe
);
3126 static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter
*adap
)
3128 struct i2c_adapter
*i2c
;
3129 struct dib0700_adapter_state
*state
= adap
->priv
;
3131 if (adap
->dev
->adapter
[0].fe_adap
[0].fe
== NULL
) {
3132 err("the master dib7090 has to be initialized first");
3133 return -ENODEV
; /* the master device has not been initialized */
3136 if (!dvb_attach(dib7000p_attach
, &state
->dib7000p_ops
))
3139 i2c
= state
->dib7000p_ops
.get_i2c_master(adap
->dev
->adapter
[0].fe_adap
[0].fe
, DIBX000_I2C_INTERFACE_GPIO_6_7
, 1);
3140 if (state
->dib7000p_ops
.i2c_enumeration(i2c
, 1, 0x10, &tfe7090pvr_dib7000p_config
[1]) != 0) {
3141 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__
);
3142 dvb_detach(&state
->dib7000p_ops
);
3146 adap
->fe_adap
[0].fe
= state
->dib7000p_ops
.init(i2c
, 0x92, &tfe7090pvr_dib7000p_config
[1]);
3147 dib0700_set_i2c_speed(adap
->dev
, 200);
3149 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
3152 static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter
*adap
)
3154 struct dib0700_adapter_state
*st
= adap
->priv
;
3155 struct i2c_adapter
*tun_i2c
= st
->dib7000p_ops
.get_i2c_tuner(adap
->fe_adap
[0].fe
);
3157 tfe7090pvr_dib0090_config
[0].reset
= st
->dib7000p_ops
.tuner_sleep
;
3158 tfe7090pvr_dib0090_config
[0].sleep
= st
->dib7000p_ops
.tuner_sleep
;
3159 tfe7090pvr_dib0090_config
[0].get_adc_power
= st
->dib7000p_ops
.get_adc_power
;
3161 if (dvb_attach(dib0090_register
, adap
->fe_adap
[0].fe
, tun_i2c
, &tfe7090pvr_dib0090_config
[0]) == NULL
)
3164 st
->dib7000p_ops
.set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 1);
3166 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
3167 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib7090_agc_startup
;
3171 static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter
*adap
)
3173 struct dib0700_adapter_state
*st
= adap
->priv
;
3174 struct i2c_adapter
*tun_i2c
= st
->dib7000p_ops
.get_i2c_tuner(adap
->fe_adap
[0].fe
);
3176 tfe7090pvr_dib0090_config
[1].reset
= st
->dib7000p_ops
.tuner_sleep
;
3177 tfe7090pvr_dib0090_config
[1].sleep
= st
->dib7000p_ops
.tuner_sleep
;
3178 tfe7090pvr_dib0090_config
[1].get_adc_power
= st
->dib7000p_ops
.get_adc_power
;
3180 if (dvb_attach(dib0090_register
, adap
->fe_adap
[0].fe
, tun_i2c
, &tfe7090pvr_dib0090_config
[1]) == NULL
)
3183 st
->dib7000p_ops
.set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 1);
3185 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
3186 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib7090_agc_startup
;
3190 static int tfe7790p_frontend_attach(struct dvb_usb_adapter
*adap
)
3192 struct dib0700_state
*st
= adap
->dev
->priv
;
3193 struct dib0700_adapter_state
*state
= adap
->priv
;
3195 if (!dvb_attach(dib7000p_attach
, &state
->dib7000p_ops
))
3198 /* The TFE7790P requires the dib0700 to not be in master mode */
3199 st
->disable_streaming_master_mode
= 1;
3201 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
3203 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
3204 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
3205 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
3206 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
3208 dib0700_ctrl_clock(adap
->dev
, 72, 1);
3209 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
3211 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
3213 if (state
->dib7000p_ops
.i2c_enumeration(&adap
->dev
->i2c_adap
,
3214 1, 0x10, &tfe7790p_dib7000p_config
) != 0) {
3215 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
3217 dvb_detach(&state
->dib7000p_ops
);
3220 adap
->fe_adap
[0].fe
= state
->dib7000p_ops
.init(&adap
->dev
->i2c_adap
,
3221 0x80, &tfe7790p_dib7000p_config
);
3223 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
3226 static int tfe7790p_tuner_attach(struct dvb_usb_adapter
*adap
)
3228 struct dib0700_adapter_state
*st
= adap
->priv
;
3229 struct i2c_adapter
*tun_i2c
=
3230 st
->dib7000p_ops
.get_i2c_tuner(adap
->fe_adap
[0].fe
);
3233 tfe7790p_dib0090_config
.reset
= st
->dib7000p_ops
.tuner_sleep
;
3234 tfe7790p_dib0090_config
.sleep
= st
->dib7000p_ops
.tuner_sleep
;
3235 tfe7790p_dib0090_config
.get_adc_power
= st
->dib7000p_ops
.get_adc_power
;
3237 if (dvb_attach(dib0090_register
, adap
->fe_adap
[0].fe
, tun_i2c
,
3238 &tfe7790p_dib0090_config
) == NULL
)
3241 st
->dib7000p_ops
.set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 1);
3243 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
3244 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib7090_agc_startup
;
3249 static struct dib7000p_config stk7070pd_dib7000p_config
[2] = {
3251 .output_mpeg2_in_188_bytes
= 1,
3253 .agc_config_count
= 1,
3254 .agc
= &dib7070_agc_config
,
3255 .bw
= &dib7070_bw_config_12_mhz
,
3256 .tuner_is_baseband
= 1,
3259 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
3260 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
3261 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
3263 .hostbus_diversity
= 1,
3265 .output_mpeg2_in_188_bytes
= 1,
3267 .agc_config_count
= 1,
3268 .agc
= &dib7070_agc_config
,
3269 .bw
= &dib7070_bw_config_12_mhz
,
3270 .tuner_is_baseband
= 1,
3273 .gpio_dir
= DIB7000P_GPIO_DEFAULT_DIRECTIONS
,
3274 .gpio_val
= DIB7000P_GPIO_DEFAULT_VALUES
,
3275 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
3277 .hostbus_diversity
= 1,
3281 static void stk7070pd_init(struct dvb_usb_device
*dev
)
3283 dib0700_set_gpio(dev
, GPIO6
, GPIO_OUT
, 1);
3285 dib0700_set_gpio(dev
, GPIO9
, GPIO_OUT
, 1);
3286 dib0700_set_gpio(dev
, GPIO4
, GPIO_OUT
, 1);
3287 dib0700_set_gpio(dev
, GPIO7
, GPIO_OUT
, 1);
3288 dib0700_set_gpio(dev
, GPIO10
, GPIO_OUT
, 0);
3290 dib0700_ctrl_clock(dev
, 72, 1);
3293 dib0700_set_gpio(dev
, GPIO10
, GPIO_OUT
, 1);
3296 static int stk7070pd_frontend_attach0(struct dvb_usb_adapter
*adap
)
3298 struct dib0700_adapter_state
*state
= adap
->priv
;
3300 if (!dvb_attach(dib7000p_attach
, &state
->dib7000p_ops
))
3303 stk7070pd_init(adap
->dev
);
3306 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
3308 if (state
->dib7000p_ops
.i2c_enumeration(&adap
->dev
->i2c_adap
, 2, 18,
3309 stk7070pd_dib7000p_config
) != 0) {
3310 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
3312 dvb_detach(&state
->dib7000p_ops
);
3316 adap
->fe_adap
[0].fe
= state
->dib7000p_ops
.init(&adap
->dev
->i2c_adap
, 0x80, &stk7070pd_dib7000p_config
[0]);
3317 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
3320 static int stk7070pd_frontend_attach1(struct dvb_usb_adapter
*adap
)
3322 struct dib0700_adapter_state
*state
= adap
->priv
;
3324 if (!dvb_attach(dib7000p_attach
, &state
->dib7000p_ops
))
3327 adap
->fe_adap
[0].fe
= state
->dib7000p_ops
.init(&adap
->dev
->i2c_adap
, 0x82, &stk7070pd_dib7000p_config
[1]);
3328 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
3331 static int novatd_read_status_override(struct dvb_frontend
*fe
,
3332 enum fe_status
*stat
)
3334 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
3335 struct dvb_usb_device
*dev
= adap
->dev
;
3336 struct dib0700_state
*state
= dev
->priv
;
3339 ret
= state
->read_status(fe
, stat
);
3342 dib0700_set_gpio(dev
, adap
->id
== 0 ? GPIO1
: GPIO0
, GPIO_OUT
,
3343 !!(*stat
& FE_HAS_LOCK
));
3348 static int novatd_sleep_override(struct dvb_frontend
* fe
)
3350 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
3351 struct dvb_usb_device
*dev
= adap
->dev
;
3352 struct dib0700_state
*state
= dev
->priv
;
3355 dib0700_set_gpio(dev
, adap
->id
== 0 ? GPIO1
: GPIO0
, GPIO_OUT
, 0);
3357 return state
->sleep(fe
);
3361 * novatd_frontend_attach - Nova-TD specific attach
3363 * Nova-TD has GPIO0, 1 and 2 for LEDs. So do not fiddle with them except for
3364 * information purposes.
3366 static int novatd_frontend_attach(struct dvb_usb_adapter
*adap
)
3368 struct dvb_usb_device
*dev
= adap
->dev
;
3369 struct dib0700_state
*st
= dev
->priv
;
3370 struct dib0700_adapter_state
*state
= adap
->priv
;
3372 if (!dvb_attach(dib7000p_attach
, &state
->dib7000p_ops
))
3375 if (adap
->id
== 0) {
3376 stk7070pd_init(dev
);
3378 /* turn the power LED on, the other two off (just in case) */
3379 dib0700_set_gpio(dev
, GPIO0
, GPIO_OUT
, 0);
3380 dib0700_set_gpio(dev
, GPIO1
, GPIO_OUT
, 0);
3381 dib0700_set_gpio(dev
, GPIO2
, GPIO_OUT
, 1);
3383 if (state
->dib7000p_ops
.i2c_enumeration(&dev
->i2c_adap
, 2, 18,
3384 stk7070pd_dib7000p_config
) != 0) {
3385 err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n",
3387 dvb_detach(&state
->dib7000p_ops
);
3392 adap
->fe_adap
[0].fe
= state
->dib7000p_ops
.init(&dev
->i2c_adap
,
3393 adap
->id
== 0 ? 0x80 : 0x82,
3394 &stk7070pd_dib7000p_config
[adap
->id
]);
3396 if (adap
->fe_adap
[0].fe
== NULL
)
3399 st
->read_status
= adap
->fe_adap
[0].fe
->ops
.read_status
;
3400 adap
->fe_adap
[0].fe
->ops
.read_status
= novatd_read_status_override
;
3401 st
->sleep
= adap
->fe_adap
[0].fe
->ops
.sleep
;
3402 adap
->fe_adap
[0].fe
->ops
.sleep
= novatd_sleep_override
;
3408 static struct s5h1411_config pinnacle_801e_config
= {
3409 .output_mode
= S5H1411_PARALLEL_OUTPUT
,
3410 .gpio
= S5H1411_GPIO_OFF
,
3411 .mpeg_timing
= S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK
,
3412 .qam_if
= S5H1411_IF_44000
,
3413 .vsb_if
= S5H1411_IF_44000
,
3414 .inversion
= S5H1411_INVERSION_OFF
,
3415 .status_mode
= S5H1411_DEMODLOCKING
3418 /* Pinnacle PCTV HD Pro 801e GPIOs map:
3419 GPIO0 - currently unknown
3420 GPIO1 - xc5000 tuner reset
3421 GPIO2 - CX25843 sleep
3422 GPIO3 - currently unknown
3423 GPIO4 - currently unknown
3424 GPIO6 - currently unknown
3425 GPIO7 - currently unknown
3426 GPIO9 - currently unknown
3427 GPIO10 - CX25843 reset
3429 static int s5h1411_frontend_attach(struct dvb_usb_adapter
*adap
)
3431 struct dib0700_state
*st
= adap
->dev
->priv
;
3433 /* Make use of the new i2c functions from FW 1.20 */
3434 st
->fw_use_new_i2c_api
= 1;
3436 /* The s5h1411 requires the dib0700 to not be in master mode */
3437 st
->disable_streaming_master_mode
= 1;
3439 /* All msleep values taken from Windows USB trace */
3440 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 0);
3441 dib0700_set_gpio(adap
->dev
, GPIO3
, GPIO_OUT
, 0);
3442 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
3444 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
3446 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
3448 dib0700_set_gpio(adap
->dev
, GPIO0
, GPIO_OUT
, 1);
3449 dib0700_set_gpio(adap
->dev
, GPIO9
, GPIO_OUT
, 1);
3450 dib0700_set_gpio(adap
->dev
, GPIO4
, GPIO_OUT
, 1);
3451 dib0700_set_gpio(adap
->dev
, GPIO7
, GPIO_OUT
, 1);
3452 dib0700_set_gpio(adap
->dev
, GPIO2
, GPIO_OUT
, 0);
3455 /* Put the CX25843 to sleep for now since we're in digital mode */
3456 dib0700_set_gpio(adap
->dev
, GPIO2
, GPIO_OUT
, 1);
3458 /* GPIOs are initialized, do the attach */
3459 adap
->fe_adap
[0].fe
= dvb_attach(s5h1411_attach
, &pinnacle_801e_config
,
3460 &adap
->dev
->i2c_adap
);
3461 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
3464 static int dib0700_xc5000_tuner_callback(void *priv
, int component
,
3465 int command
, int arg
)
3467 struct dvb_usb_adapter
*adap
= priv
;
3469 if (command
== XC5000_TUNER_RESET
) {
3470 /* Reset the tuner */
3471 dib0700_set_gpio(adap
->dev
, GPIO1
, GPIO_OUT
, 0);
3473 dib0700_set_gpio(adap
->dev
, GPIO1
, GPIO_OUT
, 1);
3476 err("xc5000: unknown tuner callback command: %d\n", command
);
3483 static struct xc5000_config s5h1411_xc5000_tunerconfig
= {
3484 .i2c_address
= 0x64,
3488 static int xc5000_tuner_attach(struct dvb_usb_adapter
*adap
)
3490 /* FIXME: generalize & move to common area */
3491 adap
->fe_adap
[0].fe
->callback
= dib0700_xc5000_tuner_callback
;
3493 return dvb_attach(xc5000_attach
, adap
->fe_adap
[0].fe
, &adap
->dev
->i2c_adap
,
3494 &s5h1411_xc5000_tunerconfig
)
3495 == NULL
? -ENODEV
: 0;
3498 static int dib0700_xc4000_tuner_callback(void *priv
, int component
,
3499 int command
, int arg
)
3501 struct dvb_usb_adapter
*adap
= priv
;
3502 struct dib0700_adapter_state
*state
= adap
->priv
;
3504 if (command
== XC4000_TUNER_RESET
) {
3505 /* Reset the tuner */
3506 state
->dib7000p_ops
.set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 0);
3508 state
->dib7000p_ops
.set_gpio(adap
->fe_adap
[0].fe
, 8, 0, 1);
3510 err("xc4000: unknown tuner callback command: %d\n", command
);
3517 static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config
= {
3518 .band_caps
= BAND_UHF
| BAND_VHF
,
3521 .time_stabiliz
= 0x15,
3522 .alpha_level
= 0x00,
3535 .agc1_slope1
= 0x00,
3536 .agc1_slope2
= 0x00,
3539 .agc2_slope1
= 0x1d,
3540 .agc2_slope2
= 0x1d,
3545 .perform_agc_softsplit
= 0x00,
3548 static struct dibx000_bandwidth_config stk7700p_xc4000_pll_config
= {
3558 .IO_CLK_en_core
= 1,
3561 .sad_cfg
= (3 << 14) | (1 << 12) | 524, /* sad_cfg: refsel, sel, freq_15k */
3567 /* FIXME: none of these inputs are validated yet */
3568 static struct dib7000p_config pctv_340e_config
= {
3569 .output_mpeg2_in_188_bytes
= 1,
3571 .agc_config_count
= 1,
3572 .agc
= &stk7700p_7000p_xc4000_agc_config
,
3573 .bw
= &stk7700p_xc4000_pll_config
,
3575 .gpio_dir
= DIB7000M_GPIO_DEFAULT_DIRECTIONS
,
3576 .gpio_val
= DIB7000M_GPIO_DEFAULT_VALUES
,
3577 .gpio_pwm_pos
= DIB7000M_GPIO_DEFAULT_PWM_POS
,
3580 /* PCTV 340e GPIOs map:
3582 GPIO2 - CX25843 sleep
3583 GPIO3 - CS5340 reset
3585 GPIO6 - Power Supply
3586 GPIO8 - LNA (1=off 0=on)
3587 GPIO10 - CX25843 reset
3589 GPIO8 - xc4000 reset
3591 static int pctv340e_frontend_attach(struct dvb_usb_adapter
*adap
)
3593 struct dib0700_state
*st
= adap
->dev
->priv
;
3594 struct dib0700_adapter_state
*state
= adap
->priv
;
3596 if (!dvb_attach(dib7000p_attach
, &state
->dib7000p_ops
))
3599 /* Power Supply on */
3600 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
3602 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
3603 msleep(100); /* Allow power supply to settle before probing */
3606 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
3607 msleep(1); /* cx25843 datasheet say 350us required */
3608 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
3610 /* LNA off for now */
3611 dib0700_set_gpio(adap
->dev
, GPIO8
, GPIO_OUT
, 1);
3613 /* Put the CX25843 to sleep for now since we're in digital mode */
3614 dib0700_set_gpio(adap
->dev
, GPIO2
, GPIO_OUT
, 1);
3616 /* FIXME: not verified yet */
3617 dib0700_ctrl_clock(adap
->dev
, 72, 1);
3621 if (state
->dib7000p_ops
.dib7000pc_detection(&adap
->dev
->i2c_adap
) == 0) {
3622 /* Demodulator not found for some reason? */
3623 dvb_detach(&state
->dib7000p_ops
);
3627 adap
->fe_adap
[0].fe
= state
->dib7000p_ops
.init(&adap
->dev
->i2c_adap
, 0x12,
3629 st
->is_dib7000pc
= 1;
3631 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
3634 static struct xc4000_config dib7000p_xc4000_tunerconfig
= {
3635 .i2c_address
= 0x61,
3638 .set_smoothedcvbs
= 0,
3642 static int xc4000_tuner_attach(struct dvb_usb_adapter
*adap
)
3644 struct i2c_adapter
*tun_i2c
;
3645 struct dib0700_adapter_state
*state
= adap
->priv
;
3647 /* The xc4000 is not on the main i2c bus */
3648 tun_i2c
= state
->dib7000p_ops
.get_i2c_master(adap
->fe_adap
[0].fe
,
3649 DIBX000_I2C_INTERFACE_TUNER
, 1);
3650 if (tun_i2c
== NULL
) {
3651 printk(KERN_ERR
"Could not reach tuner i2c bus\n");
3655 /* Setup the reset callback */
3656 adap
->fe_adap
[0].fe
->callback
= dib0700_xc4000_tuner_callback
;
3658 return dvb_attach(xc4000_attach
, adap
->fe_adap
[0].fe
, tun_i2c
,
3659 &dib7000p_xc4000_tunerconfig
)
3660 == NULL
? -ENODEV
: 0;
3663 static struct lgdt3305_config hcw_lgdt3305_config
= {
3665 .mpeg_mode
= LGDT3305_MPEG_PARALLEL
,
3666 .tpclk_edge
= LGDT3305_TPCLK_FALLING_EDGE
,
3667 .tpvalid_polarity
= LGDT3305_TP_VALID_LOW
,
3669 .spectral_inversion
= 1,
3672 .usref_8vsb
= 0x0500,
3675 static struct mxl5007t_config hcw_mxl5007t_config
= {
3676 .xtal_freq_hz
= MxL_XTAL_25_MHZ
,
3677 .if_freq_hz
= MxL_IF_6_MHZ
,
3682 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
3683 GPIO1 - ANT_SEL (H: VPA, L: MCX)
3689 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
3691 static int lgdt3305_frontend_attach(struct dvb_usb_adapter
*adap
)
3693 struct dib0700_state
*st
= adap
->dev
->priv
;
3695 /* Make use of the new i2c functions from FW 1.20 */
3696 st
->fw_use_new_i2c_api
= 1;
3698 st
->disable_streaming_master_mode
= 1;
3700 /* fe power enable */
3701 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 0);
3703 dib0700_set_gpio(adap
->dev
, GPIO6
, GPIO_OUT
, 1);
3707 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
3709 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 0);
3711 dib0700_set_gpio(adap
->dev
, GPIO10
, GPIO_OUT
, 1);
3714 adap
->fe_adap
[0].fe
= dvb_attach(lgdt3305_attach
,
3715 &hcw_lgdt3305_config
,
3716 &adap
->dev
->i2c_adap
);
3718 return adap
->fe_adap
[0].fe
== NULL
? -ENODEV
: 0;
3721 static int mxl5007t_tuner_attach(struct dvb_usb_adapter
*adap
)
3723 return dvb_attach(mxl5007t_attach
, adap
->fe_adap
[0].fe
,
3724 &adap
->dev
->i2c_adap
, 0x60,
3725 &hcw_mxl5007t_config
) == NULL
? -ENODEV
: 0;
3729 /* DVB-USB and USB stuff follows */
3730 struct usb_device_id dib0700_usb_id_table
[] = {
3731 /* 0 */ { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7700P
) },
3732 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7700P_PC
) },
3733 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_500
) },
3734 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_500_2
) },
3735 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_STICK
) },
3736 /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_VOLAR
) },
3737 { USB_DEVICE(USB_VID_COMPRO
, USB_PID_COMPRO_VIDEOMATE_U500
) },
3738 { USB_DEVICE(USB_VID_UNIWILL
, USB_PID_UNIWILL_STK7700P
) },
3739 { USB_DEVICE(USB_VID_LEADTEK
, USB_PID_WINFAST_DTV_DONGLE_STK7700P
) },
3740 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_STICK_2
) },
3741 /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_VOLAR_2
) },
3742 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV2000E
) },
3743 { USB_DEVICE(USB_VID_TERRATEC
,
3744 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY
) },
3745 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_TD_STICK
) },
3746 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7700D
) },
3747 /* 15 */{ USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7070P
) },
3748 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV_DVB_T_FLASH
) },
3749 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7070PD
) },
3750 { USB_DEVICE(USB_VID_PINNACLE
,
3751 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T
) },
3752 { USB_DEVICE(USB_VID_COMPRO
, USB_PID_COMPRO_VIDEOMATE_U500_PC
) },
3753 /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_EXPRESS
) },
3754 { USB_DEVICE(USB_VID_GIGABYTE
, USB_PID_GIGABYTE_U7000
) },
3755 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC
, USB_PID_ARTEC_T14BR
) },
3756 { USB_DEVICE(USB_VID_ASUS
, USB_PID_ASUS_U3000
) },
3757 { USB_DEVICE(USB_VID_ASUS
, USB_PID_ASUS_U3100
) },
3758 /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_STICK_3
) },
3759 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_MYTV_T
) },
3760 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_HT_USB_XE
) },
3761 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_EXPRESSCARD_320CX
) },
3762 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV72E
) },
3763 /* 30 */{ USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV73E
) },
3764 { USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_EC372S
) },
3765 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_HT_EXPRESS
) },
3766 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_T_XXS
) },
3767 { USB_DEVICE(USB_VID_LEADTEK
, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2
) },
3768 /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009
) },
3769 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_NOVA_T_500_3
) },
3770 { USB_DEVICE(USB_VID_GIGABYTE
, USB_PID_GIGABYTE_U8000
) },
3771 { USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_STK7700PH
) },
3772 { USB_DEVICE(USB_VID_ASUS
, USB_PID_ASUS_U3000H
) },
3773 /* 40 */{ USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV801E
) },
3774 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV801E_SE
) },
3775 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_T_EXPRESS
) },
3776 { USB_DEVICE(USB_VID_TERRATEC
,
3777 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2
) },
3778 { USB_DEVICE(USB_VID_SONY
, USB_PID_SONY_PLAYTV
) },
3779 /* 45 */{ USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_PD378S
) },
3780 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_TIGER_ATSC
) },
3781 { USB_DEVICE(USB_VID_HAUPPAUGE
, USB_PID_HAUPPAUGE_TIGER_ATSC_B210
) },
3782 { USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_MC770
) },
3783 { USB_DEVICE(USB_VID_ELGATO
, USB_PID_ELGATO_EYETV_DTT
) },
3784 /* 50 */{ USB_DEVICE(USB_VID_ELGATO
, USB_PID_ELGATO_EYETV_DTT_Dlx
) },
3785 { USB_DEVICE(USB_VID_LEADTEK
, USB_PID_WINFAST_DTV_DONGLE_H
) },
3786 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_T3
) },
3787 { USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_T5
) },
3788 { USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_STK7700D
) },
3789 /* 55 */{ USB_DEVICE(USB_VID_YUAN
, USB_PID_YUAN_STK7700D_2
) },
3790 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV73A
) },
3791 { USB_DEVICE(USB_VID_PCTV
, USB_PID_PINNACLE_PCTV73ESE
) },
3792 { USB_DEVICE(USB_VID_PCTV
, USB_PID_PINNACLE_PCTV282E
) },
3793 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK7770P
) },
3794 /* 60 */{ USB_DEVICE(USB_VID_TERRATEC
, USB_PID_TERRATEC_CINERGY_T_XXS_2
) },
3795 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK807XPVR
) },
3796 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK807XP
) },
3797 { USB_DEVICE_VER(USB_VID_PIXELVIEW
, USB_PID_PIXELVIEW_SBTVD
, 0x000, 0x3f00) },
3798 { USB_DEVICE(USB_VID_EVOLUTEPC
, USB_PID_TVWAY_PLUS
) },
3799 /* 65 */{ USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV73ESE
) },
3800 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV282E
) },
3801 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK8096GP
) },
3802 { USB_DEVICE(USB_VID_ELGATO
, USB_PID_ELGATO_EYETV_DIVERSITY
) },
3803 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_NIM9090M
) },
3804 /* 70 */{ USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_NIM8096MD
) },
3805 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_NIM9090MD
) },
3806 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_NIM7090
) },
3807 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_TFE7090PVR
) },
3808 { USB_DEVICE(USB_VID_TECHNISAT
, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2
) },
3809 /* 75 */{ USB_DEVICE(USB_VID_MEDION
, USB_PID_CREATIX_CTX1921
) },
3810 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV340E
) },
3811 { USB_DEVICE(USB_VID_PINNACLE
, USB_PID_PINNACLE_PCTV340E_SE
) },
3812 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_TFE7790P
) },
3813 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_TFE8096P
) },
3814 /* 80 */{ USB_DEVICE(USB_VID_ELGATO
, USB_PID_ELGATO_EYETV_DTT_2
) },
3815 { USB_DEVICE(USB_VID_PCTV
, USB_PID_PCTV_2002E
) },
3816 { USB_DEVICE(USB_VID_PCTV
, USB_PID_PCTV_2002E_SE
) },
3817 { USB_DEVICE(USB_VID_PCTV
, USB_PID_DIBCOM_STK8096PVR
) },
3818 { USB_DEVICE(USB_VID_DIBCOM
, USB_PID_DIBCOM_STK8096PVR
) },
3819 { USB_DEVICE(USB_VID_HAMA
, USB_PID_HAMA_DVBT_HYBRID
) },
3820 { 0 } /* Terminating entry */
3822 MODULE_DEVICE_TABLE(usb
, dib0700_usb_id_table
);
3824 #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
3825 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
3826 .usb_ctrl = DEVICE_SPECIFIC, \
3827 .firmware = "dvb-usb-dib0700-1.20.fw", \
3828 .download_firmware = dib0700_download_firmware, \
3829 .no_reconnect = 1, \
3830 .size_of_priv = sizeof(struct dib0700_state), \
3831 .i2c_algo = &dib0700_i2c_algo, \
3832 .identify_state = dib0700_identify_state
3834 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
3835 .streaming_ctrl = dib0700_streaming_ctrl, \
3842 .buffersize = 39480, \
3847 #define DIB0700_NUM_FRONTENDS(n) \
3848 .num_frontends = n, \
3849 .size_of_priv = sizeof(struct dib0700_adapter_state)
3851 struct dvb_usb_device_properties dib0700_devices
[] = {
3853 DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3858 DIB0700_NUM_FRONTENDS(1),
3860 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3861 .pid_filter_count
= 32,
3862 .pid_filter
= stk7700p_pid_filter
,
3863 .pid_filter_ctrl
= stk7700p_pid_filter_ctrl
,
3864 .frontend_attach
= stk7700p_frontend_attach
,
3865 .tuner_attach
= stk7700p_tuner_attach
,
3867 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3872 .num_device_descs
= 8,
3874 { "DiBcom STK7700P reference design",
3875 { &dib0700_usb_id_table
[0], &dib0700_usb_id_table
[1] },
3878 { "Hauppauge Nova-T Stick",
3879 { &dib0700_usb_id_table
[4], &dib0700_usb_id_table
[9], NULL
},
3882 { "AVerMedia AVerTV DVB-T Volar",
3883 { &dib0700_usb_id_table
[5], &dib0700_usb_id_table
[10] },
3886 { "Compro Videomate U500",
3887 { &dib0700_usb_id_table
[6], &dib0700_usb_id_table
[19] },
3890 { "Uniwill STK7700P based (Hama and others)",
3891 { &dib0700_usb_id_table
[7], NULL
},
3894 { "Leadtek Winfast DTV Dongle (STK7700P based)",
3895 { &dib0700_usb_id_table
[8], &dib0700_usb_id_table
[34] },
3898 { "AVerMedia AVerTV DVB-T Express",
3899 { &dib0700_usb_id_table
[20] },
3903 { &dib0700_usb_id_table
[21], NULL
},
3909 .rc_interval
= DEFAULT_RC_INTERVAL
,
3910 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3911 .rc_query
= dib0700_rc_query_old_firmware
,
3912 .allowed_protos
= RC_BIT_RC5
|
3915 .change_protocol
= dib0700_change_protocol
,
3917 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3922 DIB0700_NUM_FRONTENDS(1),
3924 .frontend_attach
= bristol_frontend_attach
,
3925 .tuner_attach
= bristol_tuner_attach
,
3927 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3930 DIB0700_NUM_FRONTENDS(1),
3932 .frontend_attach
= bristol_frontend_attach
,
3933 .tuner_attach
= bristol_tuner_attach
,
3935 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3940 .num_device_descs
= 1,
3942 { "Hauppauge Nova-T 500 Dual DVB-T",
3943 { &dib0700_usb_id_table
[2], &dib0700_usb_id_table
[3], NULL
},
3949 .rc_interval
= DEFAULT_RC_INTERVAL
,
3950 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
3951 .rc_query
= dib0700_rc_query_old_firmware
,
3952 .allowed_protos
= RC_BIT_RC5
|
3955 .change_protocol
= dib0700_change_protocol
,
3957 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
3962 DIB0700_NUM_FRONTENDS(1),
3964 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3965 .pid_filter_count
= 32,
3966 .pid_filter
= stk70x0p_pid_filter
,
3967 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3968 .frontend_attach
= stk7700d_frontend_attach
,
3969 .tuner_attach
= stk7700d_tuner_attach
,
3971 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3974 DIB0700_NUM_FRONTENDS(1),
3976 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
3977 .pid_filter_count
= 32,
3978 .pid_filter
= stk70x0p_pid_filter
,
3979 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
3980 .frontend_attach
= stk7700d_frontend_attach
,
3981 .tuner_attach
= stk7700d_tuner_attach
,
3983 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3988 .num_device_descs
= 5,
3990 { "Pinnacle PCTV 2000e",
3991 { &dib0700_usb_id_table
[11], NULL
},
3994 { "Terratec Cinergy DT XS Diversity",
3995 { &dib0700_usb_id_table
[12], NULL
},
3998 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
3999 { &dib0700_usb_id_table
[13], NULL
},
4002 { "DiBcom STK7700D reference design",
4003 { &dib0700_usb_id_table
[14], NULL
},
4006 { "YUAN High-Tech DiBcom STK7700D",
4007 { &dib0700_usb_id_table
[55], NULL
},
4014 .rc_interval
= DEFAULT_RC_INTERVAL
,
4015 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4016 .rc_query
= dib0700_rc_query_old_firmware
,
4017 .allowed_protos
= RC_BIT_RC5
|
4020 .change_protocol
= dib0700_change_protocol
,
4022 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4027 DIB0700_NUM_FRONTENDS(1),
4029 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4030 .pid_filter_count
= 32,
4031 .pid_filter
= stk70x0p_pid_filter
,
4032 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4033 .frontend_attach
= stk7700P2_frontend_attach
,
4034 .tuner_attach
= stk7700d_tuner_attach
,
4036 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4041 .num_device_descs
= 3,
4043 { "ASUS My Cinema U3000 Mini DVBT Tuner",
4044 { &dib0700_usb_id_table
[23], NULL
},
4048 { &dib0700_usb_id_table
[31], NULL
},
4051 { "Terratec Cinergy T Express",
4052 { &dib0700_usb_id_table
[42], NULL
},
4058 .rc_interval
= DEFAULT_RC_INTERVAL
,
4059 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4060 .module_name
= "dib0700",
4061 .rc_query
= dib0700_rc_query_old_firmware
,
4062 .allowed_protos
= RC_BIT_RC5
|
4065 .change_protocol
= dib0700_change_protocol
,
4067 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4072 DIB0700_NUM_FRONTENDS(1),
4074 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4075 .pid_filter_count
= 32,
4076 .pid_filter
= stk70x0p_pid_filter
,
4077 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4078 .frontend_attach
= stk7070p_frontend_attach
,
4079 .tuner_attach
= dib7070p_tuner_attach
,
4081 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4086 .num_device_descs
= 12,
4088 { "DiBcom STK7070P reference design",
4089 { &dib0700_usb_id_table
[15], NULL
},
4092 { "Pinnacle PCTV DVB-T Flash Stick",
4093 { &dib0700_usb_id_table
[16], NULL
},
4096 { "Artec T14BR DVB-T",
4097 { &dib0700_usb_id_table
[22], NULL
},
4100 { "ASUS My Cinema U3100 Mini DVBT Tuner",
4101 { &dib0700_usb_id_table
[24], NULL
},
4104 { "Hauppauge Nova-T Stick",
4105 { &dib0700_usb_id_table
[25], NULL
},
4108 { "Hauppauge Nova-T MyTV.t",
4109 { &dib0700_usb_id_table
[26], NULL
},
4112 { "Pinnacle PCTV 72e",
4113 { &dib0700_usb_id_table
[29], NULL
},
4116 { "Pinnacle PCTV 73e",
4117 { &dib0700_usb_id_table
[30], NULL
},
4120 { "Elgato EyeTV DTT",
4121 { &dib0700_usb_id_table
[49], NULL
},
4125 { &dib0700_usb_id_table
[45], NULL
},
4128 { "Elgato EyeTV Dtt Dlx PD378S",
4129 { &dib0700_usb_id_table
[50], NULL
},
4132 { "Elgato EyeTV DTT rev. 2",
4133 { &dib0700_usb_id_table
[80], NULL
},
4139 .rc_interval
= DEFAULT_RC_INTERVAL
,
4140 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4141 .module_name
= "dib0700",
4142 .rc_query
= dib0700_rc_query_old_firmware
,
4143 .allowed_protos
= RC_BIT_RC5
|
4146 .change_protocol
= dib0700_change_protocol
,
4148 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4153 DIB0700_NUM_FRONTENDS(1),
4155 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4156 .pid_filter_count
= 32,
4157 .pid_filter
= stk70x0p_pid_filter
,
4158 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4159 .frontend_attach
= stk7070p_frontend_attach
,
4160 .tuner_attach
= dib7070p_tuner_attach
,
4162 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4167 .num_device_descs
= 3,
4169 { "Pinnacle PCTV 73A",
4170 { &dib0700_usb_id_table
[56], NULL
},
4173 { "Pinnacle PCTV 73e SE",
4174 { &dib0700_usb_id_table
[57], &dib0700_usb_id_table
[65], NULL
},
4177 { "Pinnacle PCTV 282e",
4178 { &dib0700_usb_id_table
[58], &dib0700_usb_id_table
[66], NULL
},
4184 .rc_interval
= DEFAULT_RC_INTERVAL
,
4185 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4186 .module_name
= "dib0700",
4187 .rc_query
= dib0700_rc_query_old_firmware
,
4188 .allowed_protos
= RC_BIT_RC5
|
4191 .change_protocol
= dib0700_change_protocol
,
4193 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4198 DIB0700_NUM_FRONTENDS(1),
4200 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4201 .pid_filter_count
= 32,
4202 .pid_filter
= stk70x0p_pid_filter
,
4203 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4204 .frontend_attach
= novatd_frontend_attach
,
4205 .tuner_attach
= dib7070p_tuner_attach
,
4207 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4210 DIB0700_NUM_FRONTENDS(1),
4212 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4213 .pid_filter_count
= 32,
4214 .pid_filter
= stk70x0p_pid_filter
,
4215 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4216 .frontend_attach
= novatd_frontend_attach
,
4217 .tuner_attach
= dib7070p_tuner_attach
,
4219 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4224 .num_device_descs
= 3,
4226 { "Hauppauge Nova-TD Stick (52009)",
4227 { &dib0700_usb_id_table
[35], NULL
},
4231 { &dib0700_usb_id_table
[81], NULL
},
4235 { &dib0700_usb_id_table
[82], NULL
},
4241 .rc_interval
= DEFAULT_RC_INTERVAL
,
4242 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4243 .module_name
= "dib0700",
4244 .rc_query
= dib0700_rc_query_old_firmware
,
4245 .allowed_protos
= RC_BIT_RC5
|
4248 .change_protocol
= dib0700_change_protocol
,
4250 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4255 DIB0700_NUM_FRONTENDS(1),
4257 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4258 .pid_filter_count
= 32,
4259 .pid_filter
= stk70x0p_pid_filter
,
4260 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4261 .frontend_attach
= stk7070pd_frontend_attach0
,
4262 .tuner_attach
= dib7070p_tuner_attach
,
4264 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4267 DIB0700_NUM_FRONTENDS(1),
4269 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4270 .pid_filter_count
= 32,
4271 .pid_filter
= stk70x0p_pid_filter
,
4272 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4273 .frontend_attach
= stk7070pd_frontend_attach1
,
4274 .tuner_attach
= dib7070p_tuner_attach
,
4276 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4281 .num_device_descs
= 5,
4283 { "DiBcom STK7070PD reference design",
4284 { &dib0700_usb_id_table
[17], NULL
},
4287 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
4288 { &dib0700_usb_id_table
[18], NULL
},
4291 { "Hauppauge Nova-TD-500 (84xxx)",
4292 { &dib0700_usb_id_table
[36], NULL
},
4295 { "Terratec Cinergy DT USB XS Diversity/ T5",
4296 { &dib0700_usb_id_table
[43],
4297 &dib0700_usb_id_table
[53], NULL
},
4301 { &dib0700_usb_id_table
[44], NULL
},
4307 .rc_interval
= DEFAULT_RC_INTERVAL
,
4308 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4309 .module_name
= "dib0700",
4310 .rc_query
= dib0700_rc_query_old_firmware
,
4311 .allowed_protos
= RC_BIT_RC5
|
4314 .change_protocol
= dib0700_change_protocol
,
4316 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4321 DIB0700_NUM_FRONTENDS(1),
4323 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4324 .pid_filter_count
= 32,
4325 .pid_filter
= stk70x0p_pid_filter
,
4326 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4327 .frontend_attach
= stk7070pd_frontend_attach0
,
4328 .tuner_attach
= dib7070p_tuner_attach
,
4330 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4333 DIB0700_NUM_FRONTENDS(1),
4335 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4336 .pid_filter_count
= 32,
4337 .pid_filter
= stk70x0p_pid_filter
,
4338 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4339 .frontend_attach
= stk7070pd_frontend_attach1
,
4340 .tuner_attach
= dib7070p_tuner_attach
,
4342 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4347 .num_device_descs
= 1,
4349 { "Elgato EyeTV Diversity",
4350 { &dib0700_usb_id_table
[68], NULL
},
4356 .rc_interval
= DEFAULT_RC_INTERVAL
,
4357 .rc_codes
= RC_MAP_DIB0700_NEC_TABLE
,
4358 .module_name
= "dib0700",
4359 .rc_query
= dib0700_rc_query_old_firmware
,
4360 .allowed_protos
= RC_BIT_RC5
|
4363 .change_protocol
= dib0700_change_protocol
,
4365 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4370 DIB0700_NUM_FRONTENDS(1),
4372 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4373 .pid_filter_count
= 32,
4374 .pid_filter
= stk70x0p_pid_filter
,
4375 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4376 .frontend_attach
= stk7700ph_frontend_attach
,
4377 .tuner_attach
= stk7700ph_tuner_attach
,
4379 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4384 .num_device_descs
= 10,
4386 { "Terratec Cinergy HT USB XE",
4387 { &dib0700_usb_id_table
[27], NULL
},
4390 { "Pinnacle Expresscard 320cx",
4391 { &dib0700_usb_id_table
[28], NULL
},
4394 { "Terratec Cinergy HT Express",
4395 { &dib0700_usb_id_table
[32], NULL
},
4398 { "Gigabyte U8000-RH",
4399 { &dib0700_usb_id_table
[37], NULL
},
4402 { "YUAN High-Tech STK7700PH",
4403 { &dib0700_usb_id_table
[38], NULL
},
4406 { "Asus My Cinema-U3000Hybrid",
4407 { &dib0700_usb_id_table
[39], NULL
},
4410 { "YUAN High-Tech MC770",
4411 { &dib0700_usb_id_table
[48], NULL
},
4414 { "Leadtek WinFast DTV Dongle H",
4415 { &dib0700_usb_id_table
[51], NULL
},
4418 { "YUAN High-Tech STK7700D",
4419 { &dib0700_usb_id_table
[54], NULL
},
4422 { "Hama DVB=T Hybrid USB Stick",
4423 { &dib0700_usb_id_table
[85], NULL
},
4429 .rc_interval
= DEFAULT_RC_INTERVAL
,
4430 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4431 .module_name
= "dib0700",
4432 .rc_query
= dib0700_rc_query_old_firmware
,
4433 .allowed_protos
= RC_BIT_RC5
|
4436 .change_protocol
= dib0700_change_protocol
,
4438 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4442 DIB0700_NUM_FRONTENDS(1),
4444 .frontend_attach
= s5h1411_frontend_attach
,
4445 .tuner_attach
= xc5000_tuner_attach
,
4447 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4452 .num_device_descs
= 2,
4454 { "Pinnacle PCTV HD Pro USB Stick",
4455 { &dib0700_usb_id_table
[40], NULL
},
4458 { "Pinnacle PCTV HD USB Stick",
4459 { &dib0700_usb_id_table
[41], NULL
},
4465 .rc_interval
= DEFAULT_RC_INTERVAL
,
4466 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4467 .module_name
= "dib0700",
4468 .rc_query
= dib0700_rc_query_old_firmware
,
4469 .allowed_protos
= RC_BIT_RC5
|
4472 .change_protocol
= dib0700_change_protocol
,
4474 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4478 DIB0700_NUM_FRONTENDS(1),
4480 .frontend_attach
= lgdt3305_frontend_attach
,
4481 .tuner_attach
= mxl5007t_tuner_attach
,
4483 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4488 .num_device_descs
= 2,
4490 { "Hauppauge ATSC MiniCard (B200)",
4491 { &dib0700_usb_id_table
[46], NULL
},
4494 { "Hauppauge ATSC MiniCard (B210)",
4495 { &dib0700_usb_id_table
[47], NULL
},
4499 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4504 DIB0700_NUM_FRONTENDS(1),
4506 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4507 .pid_filter_count
= 32,
4508 .pid_filter
= stk70x0p_pid_filter
,
4509 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4510 .frontend_attach
= stk7770p_frontend_attach
,
4511 .tuner_attach
= dib7770p_tuner_attach
,
4513 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4518 .num_device_descs
= 4,
4520 { "DiBcom STK7770P reference design",
4521 { &dib0700_usb_id_table
[59], NULL
},
4524 { "Terratec Cinergy T USB XXS (HD)/ T3",
4525 { &dib0700_usb_id_table
[33],
4526 &dib0700_usb_id_table
[52],
4527 &dib0700_usb_id_table
[60], NULL
},
4530 { "TechniSat AirStar TeleStick 2",
4531 { &dib0700_usb_id_table
[74], NULL
},
4534 { "Medion CTX1921 DVB-T USB",
4535 { &dib0700_usb_id_table
[75], NULL
},
4541 .rc_interval
= DEFAULT_RC_INTERVAL
,
4542 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4543 .module_name
= "dib0700",
4544 .rc_query
= dib0700_rc_query_old_firmware
,
4545 .allowed_protos
= RC_BIT_RC5
|
4548 .change_protocol
= dib0700_change_protocol
,
4550 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4554 DIB0700_NUM_FRONTENDS(1),
4556 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4557 .pid_filter_count
= 32,
4558 .pid_filter
= stk80xx_pid_filter
,
4559 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
4560 .frontend_attach
= stk807x_frontend_attach
,
4561 .tuner_attach
= dib807x_tuner_attach
,
4563 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4568 .num_device_descs
= 3,
4570 { "DiBcom STK807xP reference design",
4571 { &dib0700_usb_id_table
[62], NULL
},
4574 { "Prolink Pixelview SBTVD",
4575 { &dib0700_usb_id_table
[63], NULL
},
4578 { "EvolutePC TVWay+",
4579 { &dib0700_usb_id_table
[64], NULL
},
4585 .rc_interval
= DEFAULT_RC_INTERVAL
,
4586 .rc_codes
= RC_MAP_DIB0700_NEC_TABLE
,
4587 .module_name
= "dib0700",
4588 .rc_query
= dib0700_rc_query_old_firmware
,
4589 .allowed_protos
= RC_BIT_RC5
|
4592 .change_protocol
= dib0700_change_protocol
,
4594 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4598 DIB0700_NUM_FRONTENDS(1),
4600 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4601 .pid_filter_count
= 32,
4602 .pid_filter
= stk80xx_pid_filter
,
4603 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
4604 .frontend_attach
= stk807xpvr_frontend_attach0
,
4605 .tuner_attach
= dib807x_tuner_attach
,
4607 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4611 DIB0700_NUM_FRONTENDS(1),
4613 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
| DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4614 .pid_filter_count
= 32,
4615 .pid_filter
= stk80xx_pid_filter
,
4616 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
4617 .frontend_attach
= stk807xpvr_frontend_attach1
,
4618 .tuner_attach
= dib807x_tuner_attach
,
4620 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4625 .num_device_descs
= 1,
4627 { "DiBcom STK807xPVR reference design",
4628 { &dib0700_usb_id_table
[61], NULL
},
4634 .rc_interval
= DEFAULT_RC_INTERVAL
,
4635 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4636 .module_name
= "dib0700",
4637 .rc_query
= dib0700_rc_query_old_firmware
,
4638 .allowed_protos
= RC_BIT_RC5
|
4641 .change_protocol
= dib0700_change_protocol
,
4643 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4647 DIB0700_NUM_FRONTENDS(1),
4649 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4650 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4651 .pid_filter_count
= 32,
4652 .pid_filter
= stk80xx_pid_filter
,
4653 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
4654 .frontend_attach
= stk809x_frontend_attach
,
4655 .tuner_attach
= dib809x_tuner_attach
,
4657 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4662 .num_device_descs
= 1,
4664 { "DiBcom STK8096GP reference design",
4665 { &dib0700_usb_id_table
[67], NULL
},
4671 .rc_interval
= DEFAULT_RC_INTERVAL
,
4672 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4673 .module_name
= "dib0700",
4674 .rc_query
= dib0700_rc_query_old_firmware
,
4675 .allowed_protos
= RC_BIT_RC5
|
4678 .change_protocol
= dib0700_change_protocol
,
4680 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4684 DIB0700_NUM_FRONTENDS(1),
4686 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4687 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4688 .pid_filter_count
= 32,
4689 .pid_filter
= dib90x0_pid_filter
,
4690 .pid_filter_ctrl
= dib90x0_pid_filter_ctrl
,
4691 .frontend_attach
= stk9090m_frontend_attach
,
4692 .tuner_attach
= dib9090_tuner_attach
,
4694 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4699 .num_device_descs
= 1,
4701 { "DiBcom STK9090M reference design",
4702 { &dib0700_usb_id_table
[69], NULL
},
4708 .rc_interval
= DEFAULT_RC_INTERVAL
,
4709 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4710 .module_name
= "dib0700",
4711 .rc_query
= dib0700_rc_query_old_firmware
,
4712 .allowed_protos
= RC_BIT_RC5
|
4715 .change_protocol
= dib0700_change_protocol
,
4717 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4721 DIB0700_NUM_FRONTENDS(1),
4723 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4724 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4725 .pid_filter_count
= 32,
4726 .pid_filter
= stk80xx_pid_filter
,
4727 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
4728 .frontend_attach
= nim8096md_frontend_attach
,
4729 .tuner_attach
= nim8096md_tuner_attach
,
4731 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4736 .num_device_descs
= 1,
4738 { "DiBcom NIM8096MD reference design",
4739 { &dib0700_usb_id_table
[70], NULL
},
4745 .rc_interval
= DEFAULT_RC_INTERVAL
,
4746 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4747 .module_name
= "dib0700",
4748 .rc_query
= dib0700_rc_query_old_firmware
,
4749 .allowed_protos
= RC_BIT_RC5
|
4752 .change_protocol
= dib0700_change_protocol
,
4754 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4758 DIB0700_NUM_FRONTENDS(1),
4760 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4761 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4762 .pid_filter_count
= 32,
4763 .pid_filter
= dib90x0_pid_filter
,
4764 .pid_filter_ctrl
= dib90x0_pid_filter_ctrl
,
4765 .frontend_attach
= nim9090md_frontend_attach
,
4766 .tuner_attach
= nim9090md_tuner_attach
,
4768 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4773 .num_device_descs
= 1,
4775 { "DiBcom NIM9090MD reference design",
4776 { &dib0700_usb_id_table
[71], NULL
},
4782 .rc_interval
= DEFAULT_RC_INTERVAL
,
4783 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4784 .module_name
= "dib0700",
4785 .rc_query
= dib0700_rc_query_old_firmware
,
4786 .allowed_protos
= RC_BIT_RC5
|
4789 .change_protocol
= dib0700_change_protocol
,
4791 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4795 DIB0700_NUM_FRONTENDS(1),
4797 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4798 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4799 .pid_filter_count
= 32,
4800 .pid_filter
= stk70x0p_pid_filter
,
4801 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4802 .frontend_attach
= nim7090_frontend_attach
,
4803 .tuner_attach
= nim7090_tuner_attach
,
4805 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4810 .num_device_descs
= 1,
4812 { "DiBcom NIM7090 reference design",
4813 { &dib0700_usb_id_table
[72], NULL
},
4819 .rc_interval
= DEFAULT_RC_INTERVAL
,
4820 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4821 .module_name
= "dib0700",
4822 .rc_query
= dib0700_rc_query_old_firmware
,
4823 .allowed_protos
= RC_BIT_RC5
|
4826 .change_protocol
= dib0700_change_protocol
,
4828 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4832 DIB0700_NUM_FRONTENDS(1),
4834 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4835 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4836 .pid_filter_count
= 32,
4837 .pid_filter
= stk70x0p_pid_filter
,
4838 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4839 .frontend_attach
= tfe7090pvr_frontend0_attach
,
4840 .tuner_attach
= tfe7090pvr_tuner0_attach
,
4842 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4846 DIB0700_NUM_FRONTENDS(1),
4848 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4849 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4850 .pid_filter_count
= 32,
4851 .pid_filter
= stk70x0p_pid_filter
,
4852 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4853 .frontend_attach
= tfe7090pvr_frontend1_attach
,
4854 .tuner_attach
= tfe7090pvr_tuner1_attach
,
4856 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4861 .num_device_descs
= 1,
4863 { "DiBcom TFE7090PVR reference design",
4864 { &dib0700_usb_id_table
[73], NULL
},
4870 .rc_interval
= DEFAULT_RC_INTERVAL
,
4871 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4872 .module_name
= "dib0700",
4873 .rc_query
= dib0700_rc_query_old_firmware
,
4874 .allowed_protos
= RC_BIT_RC5
|
4877 .change_protocol
= dib0700_change_protocol
,
4879 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4883 DIB0700_NUM_FRONTENDS(1),
4885 .frontend_attach
= pctv340e_frontend_attach
,
4886 .tuner_attach
= xc4000_tuner_attach
,
4888 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4893 .num_device_descs
= 2,
4895 { "Pinnacle PCTV 340e HD Pro USB Stick",
4896 { &dib0700_usb_id_table
[76], NULL
},
4899 { "Pinnacle PCTV Hybrid Stick Solo",
4900 { &dib0700_usb_id_table
[77], NULL
},
4905 .rc_interval
= DEFAULT_RC_INTERVAL
,
4906 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4907 .module_name
= "dib0700",
4908 .rc_query
= dib0700_rc_query_old_firmware
,
4909 .allowed_protos
= RC_BIT_RC5
|
4912 .change_protocol
= dib0700_change_protocol
,
4914 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4918 DIB0700_NUM_FRONTENDS(1),
4920 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4921 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4922 .pid_filter_count
= 32,
4923 .pid_filter
= stk70x0p_pid_filter
,
4924 .pid_filter_ctrl
= stk70x0p_pid_filter_ctrl
,
4925 .frontend_attach
= tfe7790p_frontend_attach
,
4926 .tuner_attach
= tfe7790p_tuner_attach
,
4928 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4933 .num_device_descs
= 1,
4935 { "DiBcom TFE7790P reference design",
4936 { &dib0700_usb_id_table
[78], NULL
},
4942 .rc_interval
= DEFAULT_RC_INTERVAL
,
4943 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4944 .module_name
= "dib0700",
4945 .rc_query
= dib0700_rc_query_old_firmware
,
4946 .allowed_protos
= RC_BIT_RC5
|
4949 .change_protocol
= dib0700_change_protocol
,
4951 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4955 DIB0700_NUM_FRONTENDS(1),
4957 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4958 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4959 .pid_filter_count
= 32,
4960 .pid_filter
= stk80xx_pid_filter
,
4961 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
4962 .frontend_attach
= tfe8096p_frontend_attach
,
4963 .tuner_attach
= tfe8096p_tuner_attach
,
4965 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4971 .num_device_descs
= 1,
4973 { "DiBcom TFE8096P reference design",
4974 { &dib0700_usb_id_table
[79], NULL
},
4980 .rc_interval
= DEFAULT_RC_INTERVAL
,
4981 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
4982 .module_name
= "dib0700",
4983 .rc_query
= dib0700_rc_query_old_firmware
,
4984 .allowed_protos
= RC_BIT_RC5
|
4987 .change_protocol
= dib0700_change_protocol
,
4989 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES
,
4995 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
4996 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
4997 .pid_filter_count
= 32,
4998 .pid_filter
= stk80xx_pid_filter
,
4999 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
5000 .frontend_attach
= stk809x_frontend_attach
,
5001 .tuner_attach
= dib809x_tuner_attach
,
5003 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
5006 sizeof(struct dib0700_adapter_state
),
5010 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
5011 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
5012 .pid_filter_count
= 32,
5013 .pid_filter
= stk80xx_pid_filter
,
5014 .pid_filter_ctrl
= stk80xx_pid_filter_ctrl
,
5015 .frontend_attach
= stk809x_frontend1_attach
,
5016 .tuner_attach
= dib809x_tuner_attach
,
5018 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
5021 sizeof(struct dib0700_adapter_state
),
5024 .num_device_descs
= 1,
5026 { "DiBcom STK8096-PVR reference design",
5027 { &dib0700_usb_id_table
[83],
5028 &dib0700_usb_id_table
[84], NULL
},
5034 .rc_interval
= DEFAULT_RC_INTERVAL
,
5035 .rc_codes
= RC_MAP_DIB0700_RC5_TABLE
,
5036 .module_name
= "dib0700",
5037 .rc_query
= dib0700_rc_query_old_firmware
,
5038 .allowed_protos
= RC_BIT_RC5
|
5041 .change_protocol
= dib0700_change_protocol
,
5046 int dib0700_device_count
= ARRAY_SIZE(dib0700_devices
);