FRV: Use generic show_interrupts()
[cris-mirror.git] / drivers / media / dvb / dvb-usb / dib0700_devices.c
blob97af266d7f1deb8543fe2343be238853e9e154be
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
8 */
9 #include "dib0700.h"
11 #include "dib3000mc.h"
12 #include "dib7000m.h"
13 #include "dib7000p.h"
14 #include "dib8000.h"
15 #include "dib9000.h"
16 #include "mt2060.h"
17 #include "mt2266.h"
18 #include "tuner-xc2028.h"
19 #include "xc5000.h"
20 #include "s5h1411.h"
21 #include "dib0070.h"
22 #include "dib0090.h"
23 #include "lgdt3305.h"
24 #include "mxl5007t.h"
26 static int force_lna_activation;
27 module_param(force_lna_activation, int, 0644);
28 MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), "
29 "if applicable for the device (default: 0=automatic/off).");
31 struct dib0700_adapter_state {
32 int (*set_param_save) (struct dvb_frontend *, struct dvb_frontend_parameters *);
33 const struct firmware *frontend_firmware;
36 /* Hauppauge Nova-T 500 (aka Bristol)
37 * has a LNA on GPIO0 which is enabled by setting 1 */
38 static struct mt2060_config bristol_mt2060_config[2] = {
40 .i2c_address = 0x60,
41 .clock_out = 3,
42 }, {
43 .i2c_address = 0x61,
48 static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
49 .band_caps = BAND_VHF | BAND_UHF,
50 .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
52 .agc1_max = 42598,
53 .agc1_min = 17694,
54 .agc2_max = 45875,
55 .agc2_min = 0,
57 .agc1_pt1 = 0,
58 .agc1_pt2 = 59,
60 .agc1_slope1 = 0,
61 .agc1_slope2 = 69,
63 .agc2_pt1 = 0,
64 .agc2_pt2 = 59,
66 .agc2_slope1 = 111,
67 .agc2_slope2 = 28,
70 static struct dib3000mc_config bristol_dib3000mc_config[2] = {
71 { .agc = &bristol_dib3000p_mt2060_agc_config,
72 .max_time = 0x196,
73 .ln_adc_level = 0x1cc7,
74 .output_mpeg2_in_188_bytes = 1,
76 { .agc = &bristol_dib3000p_mt2060_agc_config,
77 .max_time = 0x196,
78 .ln_adc_level = 0x1cc7,
79 .output_mpeg2_in_188_bytes = 1,
83 static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
85 struct dib0700_state *st = adap->dev->priv;
86 if (adap->id == 0) {
87 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
88 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
89 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
90 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
92 if (force_lna_activation)
93 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
94 else
95 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
97 if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {
98 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
99 return -ENODEV;
102 st->mt2060_if1[adap->id] = 1220;
103 return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
104 (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
107 static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval)
109 struct i2c_msg msg[2] = {
110 { .addr = 0x50, .flags = 0, .buf = &adrs, .len = 1 },
111 { .addr = 0x50, .flags = I2C_M_RD, .buf = pval, .len = 1 },
113 if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO;
114 return 0;
117 static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
119 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
120 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
121 s8 a;
122 int if1=1220;
123 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
124 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) {
125 if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;
127 return dvb_attach(mt2060_attach,adap->fe, tun_i2c,&bristol_mt2060_config[adap->id],
128 if1) == NULL ? -ENODEV : 0;
131 /* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
133 /* MT226x */
134 static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = {
136 BAND_UHF,
138 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=1, P_agc_inv_pwm2=1,
139 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
140 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
141 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
143 1130,
147 118,
150 3530,
154 65535,
155 33770,
156 65535,
157 23592,
161 255,
164 132,
165 192,
175 }, {
176 BAND_VHF | BAND_LBAND,
178 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=1, P_agc_inv_pwm2=1,
179 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
180 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
181 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
183 2372,
187 118,
190 3530,
194 65535,
196 65535,
197 23592,
200 128,
201 128,
202 128,
204 128,
205 253,
218 static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = {
219 60000, 30000,
220 1, 8, 3, 1, 0,
221 0, 0, 1, 1, 2,
222 (3 << 14) | (1 << 12) | (524 << 0),
224 20452225,
227 static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {
228 { .output_mpeg2_in_188_bytes = 1,
229 .hostbus_diversity = 1,
230 .tuner_is_baseband = 1,
232 .agc_config_count = 2,
233 .agc = stk7700d_7000p_mt2266_agc_config,
234 .bw = &stk7700d_mt2266_pll_config,
236 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
237 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
238 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
240 { .output_mpeg2_in_188_bytes = 1,
241 .hostbus_diversity = 1,
242 .tuner_is_baseband = 1,
244 .agc_config_count = 2,
245 .agc = stk7700d_7000p_mt2266_agc_config,
246 .bw = &stk7700d_mt2266_pll_config,
248 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
249 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
250 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
254 static struct mt2266_config stk7700d_mt2266_config[2] = {
255 { .i2c_address = 0x60
257 { .i2c_address = 0x60
261 static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap)
263 if (adap->id == 0) {
264 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
265 msleep(10);
266 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
267 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
268 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
269 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
270 msleep(10);
271 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
272 msleep(10);
273 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
274 stk7700d_dib7000p_mt2266_config)
275 != 0) {
276 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
277 return -ENODEV;
281 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
282 &stk7700d_dib7000p_mt2266_config[adap->id]);
284 return adap->fe == NULL ? -ENODEV : 0;
287 static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap)
289 if (adap->id == 0) {
290 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
291 msleep(10);
292 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
293 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
294 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
295 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
296 msleep(10);
297 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
298 msleep(10);
299 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
300 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
301 stk7700d_dib7000p_mt2266_config)
302 != 0) {
303 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
304 return -ENODEV;
308 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
309 &stk7700d_dib7000p_mt2266_config[adap->id]);
311 return adap->fe == NULL ? -ENODEV : 0;
314 static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap)
316 struct i2c_adapter *tun_i2c;
317 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
318 return dvb_attach(mt2266_attach, adap->fe, tun_i2c,
319 &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;
322 /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
323 static struct dibx000_agc_config xc3028_agc_config = {
324 BAND_VHF | BAND_UHF, /* band_caps */
326 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
327 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
328 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
329 (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
330 (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */
332 712, /* inv_gain */
333 21, /* time_stabiliz */
335 0, /* alpha_level */
336 118, /* thlock */
338 0, /* wbd_inv */
339 2867, /* wbd_ref */
340 0, /* wbd_sel */
341 2, /* wbd_alpha */
343 0, /* agc1_max */
344 0, /* agc1_min */
345 39718, /* agc2_max */
346 9930, /* agc2_min */
347 0, /* agc1_pt1 */
348 0, /* agc1_pt2 */
349 0, /* agc1_pt3 */
350 0, /* agc1_slope1 */
351 0, /* agc1_slope2 */
352 0, /* agc2_pt1 */
353 128, /* agc2_pt2 */
354 29, /* agc2_slope1 */
355 29, /* agc2_slope2 */
357 17, /* alpha_mant */
358 27, /* alpha_exp */
359 23, /* beta_mant */
360 51, /* beta_exp */
362 1, /* perform_agc_softsplit */
365 /* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
366 static struct dibx000_bandwidth_config xc3028_bw_config = {
367 60000, 30000, /* internal, sampling */
368 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
369 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc,
370 modulo */
371 (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
372 (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
373 20452225, /* timf */
374 30000000, /* xtal_hz */
377 static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
378 .output_mpeg2_in_188_bytes = 1,
379 .tuner_is_baseband = 1,
381 .agc_config_count = 1,
382 .agc = &xc3028_agc_config,
383 .bw = &xc3028_bw_config,
385 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
386 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
387 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
390 static int stk7700ph_xc3028_callback(void *ptr, int component,
391 int command, int arg)
393 struct dvb_usb_adapter *adap = ptr;
395 switch (command) {
396 case XC2028_TUNER_RESET:
397 /* Send the tuner in then out of reset */
398 dib7000p_set_gpio(adap->fe, 8, 0, 0); msleep(10);
399 dib7000p_set_gpio(adap->fe, 8, 0, 1);
400 break;
401 case XC2028_RESET_CLK:
402 break;
403 default:
404 err("%s: unknown command %d, arg %d\n", __func__,
405 command, arg);
406 return -EINVAL;
408 return 0;
411 static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
412 .fname = XC2028_DEFAULT_FIRMWARE,
413 .max_len = 64,
414 .demod = XC3028_FE_DIBCOM52,
417 static struct xc2028_config stk7700ph_xc3028_config = {
418 .i2c_addr = 0x61,
419 .ctrl = &stk7700ph_xc3028_ctrl,
422 static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
424 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;
426 if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
427 desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))
428 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
429 else
430 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
431 msleep(20);
432 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
433 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
434 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
435 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
436 msleep(10);
437 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
438 msleep(20);
439 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
440 msleep(10);
442 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
443 &stk7700ph_dib7700_xc3028_config) != 0) {
444 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
445 __func__);
446 return -ENODEV;
449 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
450 &stk7700ph_dib7700_xc3028_config);
452 return adap->fe == NULL ? -ENODEV : 0;
455 static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
457 struct i2c_adapter *tun_i2c;
459 tun_i2c = dib7000p_get_i2c_master(adap->fe,
460 DIBX000_I2C_INTERFACE_TUNER, 1);
462 stk7700ph_xc3028_config.i2c_adap = tun_i2c;
464 /* FIXME: generalize & move to common area */
465 adap->fe->callback = stk7700ph_xc3028_callback;
467 return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config)
468 == NULL ? -ENODEV : 0;
471 #define DEFAULT_RC_INTERVAL 50
473 static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
475 /* Number of keypresses to ignore before start repeating */
476 #define RC_REPEAT_DELAY 6
479 * This function is used only when firmware is < 1.20 version. Newer
480 * firmwares use bulk mode, with functions implemented at dib0700_core,
481 * at dib0700_rc_urb_completion()
483 static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d)
485 u8 key[4];
486 u32 keycode;
487 u8 toggle;
488 int i;
489 struct dib0700_state *st = d->priv;
491 if (st->fw_version >= 0x10200) {
492 /* For 1.20 firmware , We need to keep the RC polling
493 callback so we can reuse the input device setup in
494 dvb-usb-remote.c. However, the actual work is being done
495 in the bulk URB completion handler. */
496 return 0;
499 i = dib0700_ctrl_rd(d, rc_request, 2, key, 4);
500 if (i <= 0) {
501 err("RC Query Failed");
502 return -1;
505 /* losing half of KEY_0 events from Philipps rc5 remotes.. */
506 if (key[0] == 0 && key[1] == 0 && key[2] == 0 && key[3] == 0)
507 return 0;
509 /* info("%d: %2X %2X %2X %2X",dvb_usb_dib0700_ir_proto,(int)key[3-2],(int)key[3-3],(int)key[3-1],(int)key[3]); */
511 dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */
513 d->last_event = 0;
514 switch (d->props.rc.core.protocol) {
515 case RC_TYPE_NEC:
516 /* NEC protocol sends repeat code as 0 0 0 FF */
517 if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&
518 (key[3] == 0xff))
519 keycode = d->last_event;
520 else {
521 keycode = key[3-2] << 8 | key[3-3];
522 d->last_event = keycode;
525 rc_keydown(d->rc_dev, keycode, 0);
526 break;
527 default:
528 /* RC-5 protocol changes toggle bit on new keypress */
529 keycode = key[3-2] << 8 | key[3-3];
530 toggle = key[3-1];
531 rc_keydown(d->rc_dev, keycode, toggle);
533 break;
535 return 0;
538 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
539 static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
540 BAND_UHF | BAND_VHF,
542 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
543 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
544 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
545 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
547 712,
551 118,
554 4095,
558 42598,
559 17694,
560 45875,
561 2621,
564 139,
567 107,
568 172,
578 { 0,
579 107,
580 51800,
581 24700
585 static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
586 BAND_UHF | BAND_VHF,
588 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
589 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
590 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
591 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
593 712,
597 118,
600 4095,
604 42598,
605 16384,
606 42598,
610 137,
611 255,
614 255,
631 static struct dibx000_bandwidth_config stk7700p_pll_config = {
632 60000, 30000,
633 1, 8, 3, 1, 0,
634 0, 0, 1, 1, 0,
635 (3 << 14) | (1 << 12) | (524 << 0),
636 60258167,
637 20452225,
638 30000000,
641 static struct dib7000m_config stk7700p_dib7000m_config = {
642 .dvbt_mode = 1,
643 .output_mpeg2_in_188_bytes = 1,
644 .quartz_direct = 1,
646 .agc_config_count = 1,
647 .agc = &stk7700p_7000m_mt2060_agc_config,
648 .bw = &stk7700p_pll_config,
650 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
651 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
652 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
655 static struct dib7000p_config stk7700p_dib7000p_config = {
656 .output_mpeg2_in_188_bytes = 1,
658 .agc_config_count = 1,
659 .agc = &stk7700p_7000p_mt2060_agc_config,
660 .bw = &stk7700p_pll_config,
662 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
663 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
664 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
667 static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
669 struct dib0700_state *st = adap->dev->priv;
670 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
672 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
673 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
675 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
676 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
678 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
679 dib0700_ctrl_clock(adap->dev, 72, 1);
680 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
682 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
684 st->mt2060_if1[0] = 1220;
686 if (dib7000pc_detection(&adap->dev->i2c_adap)) {
687 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
688 st->is_dib7000pc = 1;
689 } else
690 adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
692 return adap->fe == NULL ? -ENODEV : 0;
695 static struct mt2060_config stk7700p_mt2060_config = {
696 0x60
699 static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
701 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
702 struct dib0700_state *st = adap->dev->priv;
703 struct i2c_adapter *tun_i2c;
704 s8 a;
705 int if1=1220;
706 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
707 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
708 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
710 if (st->is_dib7000pc)
711 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
712 else
713 tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
715 return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config,
716 if1) == NULL ? -ENODEV : 0;
719 /* DIB7070 generic */
720 static struct dibx000_agc_config dib7070_agc_config = {
721 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
722 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
723 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
724 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
725 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
727 600,
731 118,
734 3530,
738 65535,
741 65535,
746 183,
747 206,
748 255,
750 152,
762 static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
764 deb_info("reset: %d", onoff);
765 return dib7000p_set_gpio(fe, 8, 0, !onoff);
768 static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
770 deb_info("sleep: %d", onoff);
771 return dib7000p_set_gpio(fe, 9, 0, onoff);
774 static struct dib0070_config dib7070p_dib0070_config[2] = {
776 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
777 .reset = dib7070_tuner_reset,
778 .sleep = dib7070_tuner_sleep,
779 .clock_khz = 12000,
780 .clock_pad_drive = 4,
781 .charge_pump = 2,
782 }, {
783 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
784 .reset = dib7070_tuner_reset,
785 .sleep = dib7070_tuner_sleep,
786 .clock_khz = 12000,
787 .charge_pump = 2,
791 static struct dib0070_config dib7770p_dib0070_config = {
792 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
793 .reset = dib7070_tuner_reset,
794 .sleep = dib7070_tuner_sleep,
795 .clock_khz = 12000,
796 .clock_pad_drive = 0,
797 .flip_chip = 1,
798 .charge_pump = 2,
801 static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
803 struct dvb_usb_adapter *adap = fe->dvb->priv;
804 struct dib0700_adapter_state *state = adap->priv;
806 u16 offset;
807 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
808 switch (band) {
809 case BAND_VHF: offset = 950; break;
810 case BAND_UHF:
811 default: offset = 550; break;
813 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
814 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
815 return state->set_param_save(fe, fep);
818 static int dib7770_set_param_override(struct dvb_frontend *fe,
819 struct dvb_frontend_parameters *fep)
821 struct dvb_usb_adapter *adap = fe->dvb->priv;
822 struct dib0700_adapter_state *state = adap->priv;
824 u16 offset;
825 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
826 switch (band) {
827 case BAND_VHF:
828 dib7000p_set_gpio(fe, 0, 0, 1);
829 offset = 850;
830 break;
831 case BAND_UHF:
832 default:
833 dib7000p_set_gpio(fe, 0, 0, 0);
834 offset = 250;
835 break;
837 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
838 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
839 return state->set_param_save(fe, fep);
842 static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
844 struct dib0700_adapter_state *st = adap->priv;
845 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe,
846 DIBX000_I2C_INTERFACE_TUNER, 1);
848 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
849 &dib7770p_dib0070_config) == NULL)
850 return -ENODEV;
852 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
853 adap->fe->ops.tuner_ops.set_params = dib7770_set_param_override;
854 return 0;
857 static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
859 struct dib0700_adapter_state *st = adap->priv;
860 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
862 if (adap->id == 0) {
863 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
864 return -ENODEV;
865 } else {
866 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
867 return -ENODEV;
870 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
871 adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override;
872 return 0;
875 static int stk7700p_pid_filter(struct dvb_usb_adapter *adapter, int index,
876 u16 pid, int onoff)
878 struct dib0700_state *st = adapter->dev->priv;
879 if (st->is_dib7000pc)
880 return dib7000p_pid_filter(adapter->fe, index, pid, onoff);
881 return dib7000m_pid_filter(adapter->fe, index, pid, onoff);
884 static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
886 struct dib0700_state *st = adapter->dev->priv;
887 if (st->is_dib7000pc)
888 return dib7000p_pid_filter_ctrl(adapter->fe, onoff);
889 return dib7000m_pid_filter_ctrl(adapter->fe, onoff);
892 static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
894 return dib7000p_pid_filter(adapter->fe, index, pid, onoff);
897 static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
899 return dib7000p_pid_filter_ctrl(adapter->fe, onoff);
902 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
903 60000, 15000,
904 1, 20, 3, 1, 0,
905 0, 0, 1, 1, 2,
906 (3 << 14) | (1 << 12) | (524 << 0),
907 (0 << 25) | 0,
908 20452225,
909 12000000,
912 static struct dib7000p_config dib7070p_dib7000p_config = {
913 .output_mpeg2_in_188_bytes = 1,
915 .agc_config_count = 1,
916 .agc = &dib7070_agc_config,
917 .bw = &dib7070_bw_config_12_mhz,
918 .tuner_is_baseband = 1,
919 .spur_protect = 1,
921 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
922 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
923 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
925 .hostbus_diversity = 1,
928 /* STK7070P */
929 static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
931 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
932 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
933 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
934 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
935 else
936 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
937 msleep(10);
938 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
939 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
940 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
941 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
943 dib0700_ctrl_clock(adap->dev, 72, 1);
945 msleep(10);
946 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
947 msleep(10);
948 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
950 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
951 &dib7070p_dib7000p_config) != 0) {
952 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
953 __func__);
954 return -ENODEV;
957 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
958 &dib7070p_dib7000p_config);
959 return adap->fe == NULL ? -ENODEV : 0;
962 /* STK7770P */
963 static struct dib7000p_config dib7770p_dib7000p_config = {
964 .output_mpeg2_in_188_bytes = 1,
966 .agc_config_count = 1,
967 .agc = &dib7070_agc_config,
968 .bw = &dib7070_bw_config_12_mhz,
969 .tuner_is_baseband = 1,
970 .spur_protect = 1,
972 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
973 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
974 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
976 .hostbus_diversity = 1,
977 .enable_current_mirror = 1,
978 .disable_sample_and_hold = 0,
981 static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap)
983 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
984 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
985 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
986 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
987 else
988 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
989 msleep(10);
990 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
991 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
992 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
993 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
995 dib0700_ctrl_clock(adap->dev, 72, 1);
997 msleep(10);
998 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
999 msleep(10);
1000 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1002 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1003 &dib7770p_dib7000p_config) != 0) {
1004 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1005 __func__);
1006 return -ENODEV;
1009 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
1010 &dib7770p_dib7000p_config);
1011 return adap->fe == NULL ? -ENODEV : 0;
1014 /* DIB807x generic */
1015 static struct dibx000_agc_config dib807x_agc_config[2] = {
1017 BAND_VHF,
1018 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1019 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1020 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1021 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1022 * P_agc_write=0 */
1023 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1024 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1025 (0 << 0), /* setup*/
1027 600, /* inv_gain*/
1028 10, /* time_stabiliz*/
1030 0, /* alpha_level*/
1031 118, /* thlock*/
1033 0, /* wbd_inv*/
1034 3530, /* wbd_ref*/
1035 1, /* wbd_sel*/
1036 5, /* wbd_alpha*/
1038 65535, /* agc1_max*/
1039 0, /* agc1_min*/
1041 65535, /* agc2_max*/
1042 0, /* agc2_min*/
1044 0, /* agc1_pt1*/
1045 40, /* agc1_pt2*/
1046 183, /* agc1_pt3*/
1047 206, /* agc1_slope1*/
1048 255, /* agc1_slope2*/
1049 72, /* agc2_pt1*/
1050 152, /* agc2_pt2*/
1051 88, /* agc2_slope1*/
1052 90, /* agc2_slope2*/
1054 17, /* alpha_mant*/
1055 27, /* alpha_exp*/
1056 23, /* beta_mant*/
1057 51, /* beta_exp*/
1059 0, /* perform_agc_softsplit*/
1060 }, {
1061 BAND_UHF,
1062 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1063 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1064 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1065 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1066 * P_agc_write=0 */
1067 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1068 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1069 (0 << 0), /* setup */
1071 600, /* inv_gain*/
1072 10, /* time_stabiliz*/
1074 0, /* alpha_level*/
1075 118, /* thlock*/
1077 0, /* wbd_inv*/
1078 3530, /* wbd_ref*/
1079 1, /* wbd_sel*/
1080 5, /* wbd_alpha*/
1082 65535, /* agc1_max*/
1083 0, /* agc1_min*/
1085 65535, /* agc2_max*/
1086 0, /* agc2_min*/
1088 0, /* agc1_pt1*/
1089 40, /* agc1_pt2*/
1090 183, /* agc1_pt3*/
1091 206, /* agc1_slope1*/
1092 255, /* agc1_slope2*/
1093 72, /* agc2_pt1*/
1094 152, /* agc2_pt2*/
1095 88, /* agc2_slope1*/
1096 90, /* agc2_slope2*/
1098 17, /* alpha_mant*/
1099 27, /* alpha_exp*/
1100 23, /* beta_mant*/
1101 51, /* beta_exp*/
1103 0, /* perform_agc_softsplit*/
1107 static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
1108 60000, 15000, /* internal, sampling*/
1109 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/
1110 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
1111 ADClkSrc, modulo */
1112 (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1113 (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1114 18179755, /* timf*/
1115 12000000, /* xtal_hz*/
1118 static struct dib8000_config dib807x_dib8000_config[2] = {
1120 .output_mpeg2_in_188_bytes = 1,
1122 .agc_config_count = 2,
1123 .agc = dib807x_agc_config,
1124 .pll = &dib807x_bw_config_12_mhz,
1125 .tuner_is_baseband = 1,
1127 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1128 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1129 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1131 .hostbus_diversity = 1,
1132 .div_cfg = 1,
1133 .agc_control = &dib0070_ctrl_agc_filter,
1134 .output_mode = OUTMODE_MPEG2_FIFO,
1135 .drives = 0x2d98,
1136 }, {
1137 .output_mpeg2_in_188_bytes = 1,
1139 .agc_config_count = 2,
1140 .agc = dib807x_agc_config,
1141 .pll = &dib807x_bw_config_12_mhz,
1142 .tuner_is_baseband = 1,
1144 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1145 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1146 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1148 .hostbus_diversity = 1,
1149 .agc_control = &dib0070_ctrl_agc_filter,
1150 .output_mode = OUTMODE_MPEG2_FIFO,
1151 .drives = 0x2d98,
1155 static int dib80xx_tuner_reset(struct dvb_frontend *fe, int onoff)
1157 return dib8000_set_gpio(fe, 5, 0, !onoff);
1160 static int dib80xx_tuner_sleep(struct dvb_frontend *fe, int onoff)
1162 return dib8000_set_gpio(fe, 0, 0, onoff);
1165 static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
1166 { 240, 7},
1167 { 0xffff, 6},
1170 static struct dib0070_config dib807x_dib0070_config[2] = {
1172 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1173 .reset = dib80xx_tuner_reset,
1174 .sleep = dib80xx_tuner_sleep,
1175 .clock_khz = 12000,
1176 .clock_pad_drive = 4,
1177 .vga_filter = 1,
1178 .force_crystal_mode = 1,
1179 .enable_third_order_filter = 1,
1180 .charge_pump = 0,
1181 .wbd_gain = dib8070_wbd_gain_cfg,
1182 .osc_buffer_state = 0,
1183 .freq_offset_khz_uhf = -100,
1184 .freq_offset_khz_vhf = -100,
1185 }, {
1186 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1187 .reset = dib80xx_tuner_reset,
1188 .sleep = dib80xx_tuner_sleep,
1189 .clock_khz = 12000,
1190 .clock_pad_drive = 2,
1191 .vga_filter = 1,
1192 .force_crystal_mode = 1,
1193 .enable_third_order_filter = 1,
1194 .charge_pump = 0,
1195 .wbd_gain = dib8070_wbd_gain_cfg,
1196 .osc_buffer_state = 0,
1197 .freq_offset_khz_uhf = -25,
1198 .freq_offset_khz_vhf = -25,
1202 static int dib807x_set_param_override(struct dvb_frontend *fe,
1203 struct dvb_frontend_parameters *fep)
1205 struct dvb_usb_adapter *adap = fe->dvb->priv;
1206 struct dib0700_adapter_state *state = adap->priv;
1208 u16 offset = dib0070_wbd_offset(fe);
1209 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1210 switch (band) {
1211 case BAND_VHF:
1212 offset += 750;
1213 break;
1214 case BAND_UHF: /* fall-thru wanted */
1215 default:
1216 offset += 250; break;
1218 deb_info("WBD for DiB8000: %d\n", offset);
1219 dib8000_set_wbd_ref(fe, offset);
1221 return state->set_param_save(fe, fep);
1224 static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1226 struct dib0700_adapter_state *st = adap->priv;
1227 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe,
1228 DIBX000_I2C_INTERFACE_TUNER, 1);
1230 if (adap->id == 0) {
1231 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1232 &dib807x_dib0070_config[0]) == NULL)
1233 return -ENODEV;
1234 } else {
1235 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1236 &dib807x_dib0070_config[1]) == NULL)
1237 return -ENODEV;
1240 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1241 adap->fe->ops.tuner_ops.set_params = dib807x_set_param_override;
1242 return 0;
1245 static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index,
1246 u16 pid, int onoff)
1248 return dib8000_pid_filter(adapter->fe, index, pid, onoff);
1251 static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter,
1252 int onoff)
1254 return dib8000_pid_filter_ctrl(adapter->fe, onoff);
1257 /* STK807x */
1258 static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
1260 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1261 msleep(10);
1262 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1263 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1264 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1266 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1268 dib0700_ctrl_clock(adap->dev, 72, 1);
1270 msleep(10);
1271 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1272 msleep(10);
1273 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1275 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1276 0x80);
1278 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1279 &dib807x_dib8000_config[0]);
1281 return adap->fe == NULL ? -ENODEV : 0;
1284 /* STK807xPVR */
1285 static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
1287 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1288 msleep(30);
1289 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1290 msleep(500);
1291 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1292 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1293 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1295 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1297 dib0700_ctrl_clock(adap->dev, 72, 1);
1299 msleep(10);
1300 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1301 msleep(10);
1302 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1304 /* initialize IC 0 */
1305 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80);
1307 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1308 &dib807x_dib8000_config[0]);
1310 return adap->fe == NULL ? -ENODEV : 0;
1313 static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
1315 /* initialize IC 1 */
1316 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82);
1318 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82,
1319 &dib807x_dib8000_config[1]);
1321 return adap->fe == NULL ? -ENODEV : 0;
1324 /* STK8096GP */
1325 struct dibx000_agc_config dib8090_agc_config[2] = {
1327 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
1328 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1329 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1330 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1331 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1332 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1334 787,
1338 118,
1341 3530,
1345 65535,
1348 65535,
1353 114,
1354 143,
1355 144,
1356 114,
1357 227,
1358 116,
1359 117,
1369 BAND_CBAND,
1370 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1371 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1372 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1373 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1374 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1376 787,
1380 118,
1383 3530,
1390 65535,
1395 114,
1396 143,
1397 144,
1398 114,
1399 227,
1400 116,
1401 117,
1412 static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = {
1413 54000, 13500,
1414 1, 18, 3, 1, 0,
1415 0, 0, 1, 1, 2,
1416 (3 << 14) | (1 << 12) | (599 << 0),
1417 (0 << 25) | 0,
1418 20199727,
1419 12000000,
1422 static int dib8090_get_adc_power(struct dvb_frontend *fe)
1424 return dib8000_get_adc_power(fe, 1);
1427 static struct dib8000_config dib809x_dib8000_config[2] = {
1429 .output_mpeg2_in_188_bytes = 1,
1431 .agc_config_count = 2,
1432 .agc = dib8090_agc_config,
1433 .agc_control = dib0090_dcc_freq,
1434 .pll = &dib8090_pll_config_12mhz,
1435 .tuner_is_baseband = 1,
1437 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1438 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1439 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1441 .hostbus_diversity = 1,
1442 .div_cfg = 0x31,
1443 .output_mode = OUTMODE_MPEG2_FIFO,
1444 .drives = 0x2d98,
1445 .diversity_delay = 48,
1446 .refclksel = 3,
1447 }, {
1448 .output_mpeg2_in_188_bytes = 1,
1450 .agc_config_count = 2,
1451 .agc = dib8090_agc_config,
1452 .agc_control = dib0090_dcc_freq,
1453 .pll = &dib8090_pll_config_12mhz,
1454 .tuner_is_baseband = 1,
1456 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1457 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1458 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1460 .hostbus_diversity = 1,
1461 .div_cfg = 0x31,
1462 .output_mode = OUTMODE_DIVERSITY,
1463 .drives = 0x2d08,
1464 .diversity_delay = 1,
1465 .refclksel = 3,
1469 static struct dib0090_wbd_slope dib8090_wbd_table[] = {
1470 /* max freq ; cold slope ; cold offset ; warm slope ; warm offset ; wbd gain */
1471 { 120, 0, 500, 0, 500, 4 }, /* CBAND */
1472 { 170, 0, 450, 0, 450, 4 }, /* CBAND */
1473 { 380, 48, 373, 28, 259, 6 }, /* VHF */
1474 { 860, 34, 700, 36, 616, 6 }, /* high UHF */
1475 { 0xFFFF, 34, 700, 36, 616, 6 }, /* default */
1478 static struct dib0090_config dib809x_dib0090_config = {
1479 .io.pll_bypass = 1,
1480 .io.pll_range = 1,
1481 .io.pll_prediv = 1,
1482 .io.pll_loopdiv = 20,
1483 .io.adc_clock_ratio = 8,
1484 .io.pll_int_loop_filt = 0,
1485 .io.clock_khz = 12000,
1486 .reset = dib80xx_tuner_reset,
1487 .sleep = dib80xx_tuner_sleep,
1488 .clkouttobamse = 1,
1489 .analog_output = 1,
1490 .i2c_address = DEFAULT_DIB0090_I2C_ADDRESS,
1491 .use_pwm_agc = 1,
1492 .clkoutdrive = 1,
1493 .get_adc_power = dib8090_get_adc_power,
1494 .freq_offset_khz_uhf = -63,
1495 .freq_offset_khz_vhf = -143,
1496 .wbd = dib8090_wbd_table,
1497 .fref_clock_ratio = 6,
1500 static int dib8096_set_param_override(struct dvb_frontend *fe,
1501 struct dvb_frontend_parameters *fep)
1503 struct dvb_usb_adapter *adap = fe->dvb->priv;
1504 struct dib0700_adapter_state *state = adap->priv;
1505 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1506 u16 target;
1507 int ret = 0;
1508 enum frontend_tune_state tune_state = CT_SHUTDOWN;
1509 u16 ltgain, rf_gain_limit;
1511 ret = state->set_param_save(fe, fep);
1512 if (ret < 0)
1513 return ret;
1515 target = (dib0090_get_wbd_offset(fe) * 8 * 18 / 33 + 1) / 2;
1516 dib8000_set_wbd_ref(fe, target);
1519 if (band == BAND_CBAND) {
1520 deb_info("tuning in CBAND - soft-AGC startup\n");
1521 dib0090_set_tune_state(fe, CT_AGC_START);
1522 do {
1523 ret = dib0090_gain_control(fe);
1524 msleep(ret);
1525 tune_state = dib0090_get_tune_state(fe);
1526 if (tune_state == CT_AGC_STEP_0)
1527 dib8000_set_gpio(fe, 6, 0, 1);
1528 else if (tune_state == CT_AGC_STEP_1) {
1529 dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, &ltgain);
1530 if (rf_gain_limit == 0)
1531 dib8000_set_gpio(fe, 6, 0, 0);
1533 } while (tune_state < CT_AGC_STOP);
1534 dib0090_pwm_gain_reset(fe);
1535 dib8000_pwm_agc_reset(fe);
1536 dib8000_set_tune_state(fe, CT_DEMOD_START);
1537 } else {
1538 deb_info("not tuning in CBAND - standard AGC startup\n");
1539 dib0090_pwm_gain_reset(fe);
1542 return 0;
1545 static int dib809x_tuner_attach(struct dvb_usb_adapter *adap)
1547 struct dib0700_adapter_state *st = adap->priv;
1548 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1550 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1551 return -ENODEV;
1553 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1554 adap->fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1555 return 0;
1558 static int stk809x_frontend_attach(struct dvb_usb_adapter *adap)
1560 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1561 msleep(10);
1562 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1563 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1564 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1566 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1568 dib0700_ctrl_clock(adap->dev, 72, 1);
1570 msleep(10);
1571 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1572 msleep(10);
1573 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1575 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80);
1577 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
1579 return adap->fe == NULL ? -ENODEV : 0;
1582 static int nim8096md_tuner_attach(struct dvb_usb_adapter *adap)
1584 struct dib0700_adapter_state *st = adap->priv;
1585 struct i2c_adapter *tun_i2c;
1586 struct dvb_frontend *fe_slave = dib8000_get_slave_frontend(adap->fe, 1);
1588 if (fe_slave) {
1589 tun_i2c = dib8000_get_i2c_master(fe_slave, DIBX000_I2C_INTERFACE_TUNER, 1);
1590 if (dvb_attach(dib0090_register, fe_slave, tun_i2c, &dib809x_dib0090_config) == NULL)
1591 return -ENODEV;
1592 fe_slave->dvb = adap->fe->dvb;
1593 fe_slave->ops.tuner_ops.set_params = dib8096_set_param_override;
1595 tun_i2c = dib8000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1596 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1597 return -ENODEV;
1599 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1600 adap->fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1602 return 0;
1605 static int nim8096md_frontend_attach(struct dvb_usb_adapter *adap)
1607 struct dvb_frontend *fe_slave;
1609 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1610 msleep(20);
1611 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1612 msleep(1000);
1613 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1614 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1615 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1617 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1619 dib0700_ctrl_clock(adap->dev, 72, 1);
1621 msleep(20);
1622 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1623 msleep(20);
1624 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1626 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, 0x80);
1628 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
1629 if (adap->fe == NULL)
1630 return -ENODEV;
1632 fe_slave = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82, &dib809x_dib8000_config[1]);
1633 dib8000_set_slave_frontend(adap->fe, fe_slave);
1635 return fe_slave == NULL ? -ENODEV : 0;
1638 /* STK9090M */
1639 static int dib90x0_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
1641 return dib9000_fw_pid_filter(adapter->fe, index, pid, onoff);
1644 static int dib90x0_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
1646 return dib9000_fw_pid_filter_ctrl(adapter->fe, onoff);
1649 static int dib90x0_tuner_reset(struct dvb_frontend *fe, int onoff)
1651 return dib9000_set_gpio(fe, 5, 0, !onoff);
1654 static int dib90x0_tuner_sleep(struct dvb_frontend *fe, int onoff)
1656 return dib9000_set_gpio(fe, 0, 0, onoff);
1659 static int dib01x0_pmu_update(struct i2c_adapter *i2c, u16 *data, u8 len)
1661 u8 wb[4] = { 0xc >> 8, 0xc & 0xff, 0, 0 };
1662 u8 rb[2];
1663 struct i2c_msg msg[2] = {
1664 {.addr = 0x1e >> 1, .flags = 0, .buf = wb, .len = 2},
1665 {.addr = 0x1e >> 1, .flags = I2C_M_RD, .buf = rb, .len = 2},
1667 u8 index_data;
1669 dibx000_i2c_set_speed(i2c, 250);
1671 if (i2c_transfer(i2c, msg, 2) != 2)
1672 return -EIO;
1674 switch (rb[0] << 8 | rb[1]) {
1675 case 0:
1676 deb_info("Found DiB0170 rev1: This version of DiB0170 is not supported any longer.\n");
1677 return -EIO;
1678 case 1:
1679 deb_info("Found DiB0170 rev2");
1680 break;
1681 case 2:
1682 deb_info("Found DiB0190 rev2");
1683 break;
1684 default:
1685 deb_info("DiB01x0 not found");
1686 return -EIO;
1689 for (index_data = 0; index_data < len; index_data += 2) {
1690 wb[2] = (data[index_data + 1] >> 8) & 0xff;
1691 wb[3] = (data[index_data + 1]) & 0xff;
1693 if (data[index_data] == 0) {
1694 wb[0] = (data[index_data] >> 8) & 0xff;
1695 wb[1] = (data[index_data]) & 0xff;
1696 msg[0].len = 2;
1697 if (i2c_transfer(i2c, msg, 2) != 2)
1698 return -EIO;
1699 wb[2] |= rb[0];
1700 wb[3] |= rb[1] & ~(3 << 4);
1703 wb[0] = (data[index_data] >> 8)&0xff;
1704 wb[1] = (data[index_data])&0xff;
1705 msg[0].len = 4;
1706 if (i2c_transfer(i2c, &msg[0], 1) != 1)
1707 return -EIO;
1709 return 0;
1712 static struct dib9000_config stk9090m_config = {
1713 .output_mpeg2_in_188_bytes = 1,
1714 .output_mode = OUTMODE_MPEG2_FIFO,
1715 .vcxo_timer = 279620,
1716 .timing_frequency = 20452225,
1717 .demod_clock_khz = 60000,
1718 .xtal_clock_khz = 30000,
1719 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
1720 .subband = {
1723 { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0008 } }, /* GPIO 3 to 1 for VHF */
1724 { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0000 } }, /* GPIO 3 to 0 for UHF */
1725 { 0 },
1728 .gpio_function = {
1729 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
1730 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
1734 static struct dib9000_config nim9090md_config[2] = {
1736 .output_mpeg2_in_188_bytes = 1,
1737 .output_mode = OUTMODE_MPEG2_FIFO,
1738 .vcxo_timer = 279620,
1739 .timing_frequency = 20452225,
1740 .demod_clock_khz = 60000,
1741 .xtal_clock_khz = 30000,
1742 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
1743 }, {
1744 .output_mpeg2_in_188_bytes = 1,
1745 .output_mode = OUTMODE_DIVERSITY,
1746 .vcxo_timer = 279620,
1747 .timing_frequency = 20452225,
1748 .demod_clock_khz = 60000,
1749 .xtal_clock_khz = 30000,
1750 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
1751 .subband = {
1754 { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0006 } }, /* GPIO 1 and 2 to 1 for VHF */
1755 { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0000 } }, /* GPIO 1 and 2 to 0 for UHF */
1756 { 0 },
1759 .gpio_function = {
1760 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
1761 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
1766 static struct dib0090_config dib9090_dib0090_config = {
1767 .io.pll_bypass = 0,
1768 .io.pll_range = 1,
1769 .io.pll_prediv = 1,
1770 .io.pll_loopdiv = 8,
1771 .io.adc_clock_ratio = 8,
1772 .io.pll_int_loop_filt = 0,
1773 .io.clock_khz = 30000,
1774 .reset = dib90x0_tuner_reset,
1775 .sleep = dib90x0_tuner_sleep,
1776 .clkouttobamse = 0,
1777 .analog_output = 0,
1778 .use_pwm_agc = 0,
1779 .clkoutdrive = 0,
1780 .freq_offset_khz_uhf = 0,
1781 .freq_offset_khz_vhf = 0,
1784 static struct dib0090_config nim9090md_dib0090_config[2] = {
1786 .io.pll_bypass = 0,
1787 .io.pll_range = 1,
1788 .io.pll_prediv = 1,
1789 .io.pll_loopdiv = 8,
1790 .io.adc_clock_ratio = 8,
1791 .io.pll_int_loop_filt = 0,
1792 .io.clock_khz = 30000,
1793 .reset = dib90x0_tuner_reset,
1794 .sleep = dib90x0_tuner_sleep,
1795 .clkouttobamse = 1,
1796 .analog_output = 0,
1797 .use_pwm_agc = 0,
1798 .clkoutdrive = 0,
1799 .freq_offset_khz_uhf = 0,
1800 .freq_offset_khz_vhf = 0,
1801 }, {
1802 .io.pll_bypass = 0,
1803 .io.pll_range = 1,
1804 .io.pll_prediv = 1,
1805 .io.pll_loopdiv = 8,
1806 .io.adc_clock_ratio = 8,
1807 .io.pll_int_loop_filt = 0,
1808 .io.clock_khz = 30000,
1809 .reset = dib90x0_tuner_reset,
1810 .sleep = dib90x0_tuner_sleep,
1811 .clkouttobamse = 0,
1812 .analog_output = 0,
1813 .use_pwm_agc = 0,
1814 .clkoutdrive = 0,
1815 .freq_offset_khz_uhf = 0,
1816 .freq_offset_khz_vhf = 0,
1821 static int stk9090m_frontend_attach(struct dvb_usb_adapter *adap)
1823 struct dib0700_adapter_state *state = adap->priv;
1824 struct dib0700_state *st = adap->dev->priv;
1825 u32 fw_version;
1827 /* Make use of the new i2c functions from FW 1.20 */
1828 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
1829 if (fw_version >= 0x10200)
1830 st->fw_use_new_i2c_api = 1;
1831 dib0700_set_i2c_speed(adap->dev, 340);
1833 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1834 msleep(20);
1835 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1836 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1837 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1838 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1840 dib0700_ctrl_clock(adap->dev, 72, 1);
1842 msleep(20);
1843 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1844 msleep(20);
1845 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1847 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80);
1849 if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {
1850 deb_info("%s: Upload failed. (file not found?)\n", __func__);
1851 return -ENODEV;
1852 } else {
1853 deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
1855 stk9090m_config.microcode_B_fe_size = state->frontend_firmware->size;
1856 stk9090m_config.microcode_B_fe_buffer = state->frontend_firmware->data;
1858 adap->fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &stk9090m_config);
1860 return adap->fe == NULL ? -ENODEV : 0;
1863 static int dib9090_tuner_attach(struct dvb_usb_adapter *adap)
1865 struct dib0700_adapter_state *state = adap->priv;
1866 struct i2c_adapter *i2c = dib9000_get_tuner_interface(adap->fe);
1867 u16 data_dib190[10] = {
1868 1, 0x1374,
1869 2, 0x01a2,
1870 7, 0x0020,
1871 0, 0x00ef,
1872 8, 0x0486,
1875 if (dvb_attach(dib0090_fw_register, adap->fe, i2c, &dib9090_dib0090_config) == NULL)
1876 return -ENODEV;
1877 i2c = dib9000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
1878 if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0)
1879 return -ENODEV;
1880 dib0700_set_i2c_speed(adap->dev, 2000);
1881 if (dib9000_firmware_post_pll_init(adap->fe) < 0)
1882 return -ENODEV;
1883 release_firmware(state->frontend_firmware);
1884 return 0;
1887 static int nim9090md_frontend_attach(struct dvb_usb_adapter *adap)
1889 struct dib0700_adapter_state *state = adap->priv;
1890 struct dib0700_state *st = adap->dev->priv;
1891 struct i2c_adapter *i2c;
1892 struct dvb_frontend *fe_slave;
1893 u32 fw_version;
1895 /* Make use of the new i2c functions from FW 1.20 */
1896 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
1897 if (fw_version >= 0x10200)
1898 st->fw_use_new_i2c_api = 1;
1899 dib0700_set_i2c_speed(adap->dev, 340);
1901 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1902 msleep(20);
1903 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1904 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1905 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1906 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1908 dib0700_ctrl_clock(adap->dev, 72, 1);
1910 msleep(20);
1911 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1912 msleep(20);
1913 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1915 if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {
1916 deb_info("%s: Upload failed. (file not found?)\n", __func__);
1917 return -EIO;
1918 } else {
1919 deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
1921 nim9090md_config[0].microcode_B_fe_size = state->frontend_firmware->size;
1922 nim9090md_config[0].microcode_B_fe_buffer = state->frontend_firmware->data;
1923 nim9090md_config[1].microcode_B_fe_size = state->frontend_firmware->size;
1924 nim9090md_config[1].microcode_B_fe_buffer = state->frontend_firmware->data;
1926 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, 0x80);
1927 adap->fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &nim9090md_config[0]);
1929 if (adap->fe == NULL)
1930 return -ENODEV;
1932 i2c = dib9000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_GPIO_3_4, 0);
1933 dib9000_i2c_enumeration(i2c, 1, 0x12, 0x82);
1935 fe_slave = dvb_attach(dib9000_attach, i2c, 0x82, &nim9090md_config[1]);
1936 dib9000_set_slave_frontend(adap->fe, fe_slave);
1938 return fe_slave == NULL ? -ENODEV : 0;
1941 static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap)
1943 struct dib0700_adapter_state *state = adap->priv;
1944 struct i2c_adapter *i2c;
1945 struct dvb_frontend *fe_slave;
1946 u16 data_dib190[10] = {
1947 1, 0x5374,
1948 2, 0x01ae,
1949 7, 0x0020,
1950 0, 0x00ef,
1951 8, 0x0406,
1953 i2c = dib9000_get_tuner_interface(adap->fe);
1954 if (dvb_attach(dib0090_fw_register, adap->fe, i2c, &nim9090md_dib0090_config[0]) == NULL)
1955 return -ENODEV;
1956 i2c = dib9000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
1957 if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0)
1958 return -ENODEV;
1959 dib0700_set_i2c_speed(adap->dev, 2000);
1960 if (dib9000_firmware_post_pll_init(adap->fe) < 0)
1961 return -ENODEV;
1963 fe_slave = dib9000_get_slave_frontend(adap->fe, 1);
1964 if (fe_slave != NULL) {
1965 i2c = dib9000_get_component_bus_interface(adap->fe);
1966 dib9000_set_i2c_adapter(fe_slave, i2c);
1968 i2c = dib9000_get_tuner_interface(fe_slave);
1969 if (dvb_attach(dib0090_fw_register, fe_slave, i2c, &nim9090md_dib0090_config[1]) == NULL)
1970 return -ENODEV;
1971 fe_slave->dvb = adap->fe->dvb;
1972 dib9000_fw_set_component_bus_speed(adap->fe, 2000);
1973 if (dib9000_firmware_post_pll_init(fe_slave) < 0)
1974 return -ENODEV;
1976 release_firmware(state->frontend_firmware);
1978 return 0;
1981 /* NIM7090 */
1982 struct dib7090p_best_adc {
1983 u32 timf;
1984 u32 pll_loopdiv;
1985 u32 pll_prediv;
1988 static int dib7090p_get_best_sampling(struct dvb_frontend *fe , struct dib7090p_best_adc *adc)
1990 u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1;
1992 u16 xtal = 12000;
1993 u32 fcp_min = 1900; /* PLL Minimum Frequency comparator KHz */
1994 u32 fcp_max = 20000; /* PLL Maximum Frequency comparator KHz */
1995 u32 fdem_max = 76000;
1996 u32 fdem_min = 69500;
1997 u32 fcp = 0, fs = 0, fdem = 0;
1998 u32 harmonic_id = 0;
2000 adc->pll_loopdiv = loopdiv;
2001 adc->pll_prediv = prediv;
2002 adc->timf = 0;
2004 deb_info("bandwidth = %d fdem_min =%d", fe->dtv_property_cache.bandwidth_hz, fdem_min);
2006 /* Find Min and Max prediv */
2007 while ((xtal/max_prediv) >= fcp_min)
2008 max_prediv++;
2010 max_prediv--;
2011 min_prediv = max_prediv;
2012 while ((xtal/min_prediv) <= fcp_max) {
2013 min_prediv--;
2014 if (min_prediv == 1)
2015 break;
2017 deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv);
2019 min_prediv = 2;
2021 for (prediv = min_prediv ; prediv < max_prediv; prediv++) {
2022 fcp = xtal / prediv;
2023 if (fcp > fcp_min && fcp < fcp_max) {
2024 for (loopdiv = 1 ; loopdiv < 64 ; loopdiv++) {
2025 fdem = ((xtal/prediv) * loopdiv);
2026 fs = fdem / 4;
2027 /* test min/max system restrictions */
2029 if ((fdem >= fdem_min) && (fdem <= fdem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz/1000)) {
2030 spur = 0;
2031 /* test fs harmonics positions */
2032 for (harmonic_id = (fe->dtv_property_cache.frequency / (1000*fs)) ; harmonic_id <= ((fe->dtv_property_cache.frequency / (1000*fs))+1) ; harmonic_id++) {
2033 if (((fs*harmonic_id) >= ((fe->dtv_property_cache.frequency/1000) - (fe->dtv_property_cache.bandwidth_hz/2000))) && ((fs*harmonic_id) <= ((fe->dtv_property_cache.frequency/1000) + (fe->dtv_property_cache.bandwidth_hz/2000)))) {
2034 spur = 1;
2035 break;
2039 if (!spur) {
2040 adc->pll_loopdiv = loopdiv;
2041 adc->pll_prediv = prediv;
2042 adc->timf = 2396745143UL/fdem*(1 << 9);
2043 adc->timf += ((2396745143UL%fdem) << 9)/fdem;
2044 deb_info("loopdiv=%i prediv=%i timf=%i", loopdiv, prediv, adc->timf);
2045 break;
2050 if (!spur)
2051 break;
2055 if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0)
2056 return -EINVAL;
2057 else
2058 return 0;
2061 static int dib7090_agc_startup(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
2063 struct dvb_usb_adapter *adap = fe->dvb->priv;
2064 struct dib0700_adapter_state *state = adap->priv;
2065 struct dibx000_bandwidth_config pll;
2066 u16 target;
2067 struct dib7090p_best_adc adc;
2068 int ret;
2070 ret = state->set_param_save(fe, fep);
2071 if (ret < 0)
2072 return ret;
2074 memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));
2075 dib0090_pwm_gain_reset(fe);
2076 target = (dib0090_get_wbd_offset(fe) * 8 + 1) / 2;
2077 dib7000p_set_wbd_ref(fe, target);
2079 if (dib7090p_get_best_sampling(fe, &adc) == 0) {
2080 pll.pll_ratio = adc.pll_loopdiv;
2081 pll.pll_prediv = adc.pll_prediv;
2083 dib7000p_update_pll(fe, &pll);
2084 dib7000p_ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf);
2086 return 0;
2089 static struct dib0090_wbd_slope dib7090_wbd_table[] = {
2090 { 380, 81, 850, 64, 540, 4},
2091 { 860, 51, 866, 21, 375, 4},
2092 {1700, 0, 250, 0, 100, 6},
2093 {2600, 0, 250, 0, 100, 6},
2094 { 0xFFFF, 0, 0, 0, 0, 0},
2097 struct dibx000_agc_config dib7090_agc_config[2] = {
2099 .band_caps = BAND_UHF,
2100 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
2101 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
2102 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2104 .inv_gain = 687,
2105 .time_stabiliz = 10,
2107 .alpha_level = 0,
2108 .thlock = 118,
2110 .wbd_inv = 0,
2111 .wbd_ref = 1200,
2112 .wbd_sel = 3,
2113 .wbd_alpha = 5,
2115 .agc1_max = 65535,
2116 .agc1_min = 0,
2118 .agc2_max = 65535,
2119 .agc2_min = 0,
2121 .agc1_pt1 = 0,
2122 .agc1_pt2 = 32,
2123 .agc1_pt3 = 114,
2124 .agc1_slope1 = 143,
2125 .agc1_slope2 = 144,
2126 .agc2_pt1 = 114,
2127 .agc2_pt2 = 227,
2128 .agc2_slope1 = 116,
2129 .agc2_slope2 = 117,
2131 .alpha_mant = 18,
2132 .alpha_exp = 0,
2133 .beta_mant = 20,
2134 .beta_exp = 59,
2136 .perform_agc_softsplit = 0,
2137 } , {
2138 .band_caps = BAND_FM | BAND_VHF | BAND_CBAND,
2139 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
2140 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
2141 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
2143 .inv_gain = 732,
2144 .time_stabiliz = 10,
2146 .alpha_level = 0,
2147 .thlock = 118,
2149 .wbd_inv = 0,
2150 .wbd_ref = 1200,
2151 .wbd_sel = 3,
2152 .wbd_alpha = 5,
2154 .agc1_max = 65535,
2155 .agc1_min = 0,
2157 .agc2_max = 65535,
2158 .agc2_min = 0,
2160 .agc1_pt1 = 0,
2161 .agc1_pt2 = 0,
2162 .agc1_pt3 = 98,
2163 .agc1_slope1 = 0,
2164 .agc1_slope2 = 167,
2165 .agc1_pt1 = 98,
2166 .agc2_pt2 = 255,
2167 .agc2_slope1 = 104,
2168 .agc2_slope2 = 0,
2170 .alpha_mant = 18,
2171 .alpha_exp = 0,
2172 .beta_mant = 20,
2173 .beta_exp = 59,
2175 .perform_agc_softsplit = 0,
2179 static struct dibx000_bandwidth_config dib7090_clock_config_12_mhz = {
2180 60000, 15000,
2181 1, 5, 0, 0, 0,
2182 0, 0, 1, 1, 2,
2183 (3 << 14) | (1 << 12) | (524 << 0),
2184 (0 << 25) | 0,
2185 20452225,
2186 15000000,
2189 static struct dib7000p_config nim7090_dib7000p_config = {
2190 .output_mpeg2_in_188_bytes = 1,
2191 .hostbus_diversity = 1,
2192 .tuner_is_baseband = 1,
2193 .update_lna = NULL,
2195 .agc_config_count = 2,
2196 .agc = dib7090_agc_config,
2198 .bw = &dib7090_clock_config_12_mhz,
2200 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2201 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2202 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2204 .pwm_freq_div = 0,
2206 .agc_control = dib7090_agc_restart,
2208 .spur_protect = 0,
2209 .disable_sample_and_hold = 0,
2210 .enable_current_mirror = 0,
2211 .diversity_delay = 0,
2213 .output_mode = OUTMODE_MPEG2_FIFO,
2214 .enMpegOutput = 1,
2217 static struct dib7000p_config tfe7090pvr_dib7000p_config[2] = {
2219 .output_mpeg2_in_188_bytes = 1,
2220 .hostbus_diversity = 1,
2221 .tuner_is_baseband = 1,
2222 .update_lna = NULL,
2224 .agc_config_count = 2,
2225 .agc = dib7090_agc_config,
2227 .bw = &dib7090_clock_config_12_mhz,
2229 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2230 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2231 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2233 .pwm_freq_div = 0,
2235 .agc_control = dib7090_agc_restart,
2237 .spur_protect = 0,
2238 .disable_sample_and_hold = 0,
2239 .enable_current_mirror = 0,
2240 .diversity_delay = 0,
2242 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2243 .default_i2c_addr = 0x90,
2244 .enMpegOutput = 1,
2245 }, {
2246 .output_mpeg2_in_188_bytes = 1,
2247 .hostbus_diversity = 1,
2248 .tuner_is_baseband = 1,
2249 .update_lna = NULL,
2251 .agc_config_count = 2,
2252 .agc = dib7090_agc_config,
2254 .bw = &dib7090_clock_config_12_mhz,
2256 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2257 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2258 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2260 .pwm_freq_div = 0,
2262 .agc_control = dib7090_agc_restart,
2264 .spur_protect = 0,
2265 .disable_sample_and_hold = 0,
2266 .enable_current_mirror = 0,
2267 .diversity_delay = 0,
2269 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2270 .default_i2c_addr = 0x92,
2271 .enMpegOutput = 0,
2275 static const struct dib0090_config nim7090_dib0090_config = {
2276 .io.clock_khz = 12000,
2277 .io.pll_bypass = 0,
2278 .io.pll_range = 0,
2279 .io.pll_prediv = 3,
2280 .io.pll_loopdiv = 6,
2281 .io.adc_clock_ratio = 0,
2282 .io.pll_int_loop_filt = 0,
2283 .reset = dib7090_tuner_sleep,
2284 .sleep = dib7090_tuner_sleep,
2286 .freq_offset_khz_uhf = 0,
2287 .freq_offset_khz_vhf = 0,
2289 .get_adc_power = dib7090_get_adc_power,
2291 .clkouttobamse = 1,
2292 .analog_output = 0,
2294 .wbd_vhf_offset = 0,
2295 .wbd_cband_offset = 0,
2296 .use_pwm_agc = 1,
2297 .clkoutdrive = 0,
2299 .fref_clock_ratio = 0,
2301 .wbd = dib7090_wbd_table,
2303 .ls_cfg_pad_drv = 0,
2304 .data_tx_drv = 0,
2305 .low_if = NULL,
2306 .in_soc = 1,
2309 static const struct dib0090_config tfe7090pvr_dib0090_config[2] = {
2311 .io.clock_khz = 12000,
2312 .io.pll_bypass = 0,
2313 .io.pll_range = 0,
2314 .io.pll_prediv = 3,
2315 .io.pll_loopdiv = 6,
2316 .io.adc_clock_ratio = 0,
2317 .io.pll_int_loop_filt = 0,
2318 .reset = dib7090_tuner_sleep,
2319 .sleep = dib7090_tuner_sleep,
2321 .freq_offset_khz_uhf = 50,
2322 .freq_offset_khz_vhf = 70,
2324 .get_adc_power = dib7090_get_adc_power,
2326 .clkouttobamse = 1,
2327 .analog_output = 0,
2329 .wbd_vhf_offset = 0,
2330 .wbd_cband_offset = 0,
2331 .use_pwm_agc = 1,
2332 .clkoutdrive = 0,
2334 .fref_clock_ratio = 0,
2336 .wbd = dib7090_wbd_table,
2338 .ls_cfg_pad_drv = 0,
2339 .data_tx_drv = 0,
2340 .low_if = NULL,
2341 .in_soc = 1,
2342 }, {
2343 .io.clock_khz = 12000,
2344 .io.pll_bypass = 0,
2345 .io.pll_range = 0,
2346 .io.pll_prediv = 3,
2347 .io.pll_loopdiv = 6,
2348 .io.adc_clock_ratio = 0,
2349 .io.pll_int_loop_filt = 0,
2350 .reset = dib7090_tuner_sleep,
2351 .sleep = dib7090_tuner_sleep,
2353 .freq_offset_khz_uhf = -50,
2354 .freq_offset_khz_vhf = -70,
2356 .get_adc_power = dib7090_get_adc_power,
2358 .clkouttobamse = 1,
2359 .analog_output = 0,
2361 .wbd_vhf_offset = 0,
2362 .wbd_cband_offset = 0,
2363 .use_pwm_agc = 1,
2364 .clkoutdrive = 0,
2366 .fref_clock_ratio = 0,
2368 .wbd = dib7090_wbd_table,
2370 .ls_cfg_pad_drv = 0,
2371 .data_tx_drv = 0,
2372 .low_if = NULL,
2373 .in_soc = 1,
2377 static int nim7090_frontend_attach(struct dvb_usb_adapter *adap)
2379 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2380 msleep(20);
2381 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2382 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2383 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2384 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2386 msleep(20);
2387 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2388 msleep(20);
2389 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2391 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, &nim7090_dib7000p_config) != 0) {
2392 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
2393 return -ENODEV;
2395 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &nim7090_dib7000p_config);
2397 return adap->fe == NULL ? -ENODEV : 0;
2400 static int nim7090_tuner_attach(struct dvb_usb_adapter *adap)
2402 struct dib0700_adapter_state *st = adap->priv;
2403 struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe);
2405 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &nim7090_dib0090_config) == NULL)
2406 return -ENODEV;
2408 dib7000p_set_gpio(adap->fe, 8, 0, 1);
2410 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
2411 adap->fe->ops.tuner_ops.set_params = dib7090_agc_startup;
2412 return 0;
2415 static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter *adap)
2417 struct dib0700_state *st = adap->dev->priv;
2419 /* The TFE7090 requires the dib0700 to not be in master mode */
2420 st->disable_streaming_master_mode = 1;
2422 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2423 msleep(20);
2424 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2425 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2426 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2427 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2429 msleep(20);
2430 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2431 msleep(20);
2432 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2434 /* initialize IC 0 */
2435 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, &tfe7090pvr_dib7000p_config[0]) != 0) {
2436 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
2437 return -ENODEV;
2440 dib0700_set_i2c_speed(adap->dev, 340);
2441 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]);
2443 dib7090_slave_reset(adap->fe);
2445 if (adap->fe == NULL)
2446 return -ENODEV;
2448 return 0;
2451 static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter *adap)
2453 struct i2c_adapter *i2c;
2455 if (adap->dev->adapter[0].fe == NULL) {
2456 err("the master dib7090 has to be initialized first");
2457 return -ENODEV; /* the master device has not been initialized */
2460 i2c = dib7000p_get_i2c_master(adap->dev->adapter[0].fe, DIBX000_I2C_INTERFACE_GPIO_6_7, 1);
2461 if (dib7000p_i2c_enumeration(i2c, 1, 0x10, &tfe7090pvr_dib7000p_config[1]) != 0) {
2462 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
2463 return -ENODEV;
2466 adap->fe = dvb_attach(dib7000p_attach, i2c, 0x92, &tfe7090pvr_dib7000p_config[1]);
2467 dib0700_set_i2c_speed(adap->dev, 200);
2469 return adap->fe == NULL ? -ENODEV : 0;
2472 static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter *adap)
2474 struct dib0700_adapter_state *st = adap->priv;
2475 struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe);
2477 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &tfe7090pvr_dib0090_config[0]) == NULL)
2478 return -ENODEV;
2480 dib7000p_set_gpio(adap->fe, 8, 0, 1);
2482 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
2483 adap->fe->ops.tuner_ops.set_params = dib7090_agc_startup;
2484 return 0;
2487 static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter *adap)
2489 struct dib0700_adapter_state *st = adap->priv;
2490 struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe);
2492 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &tfe7090pvr_dib0090_config[1]) == NULL)
2493 return -ENODEV;
2495 dib7000p_set_gpio(adap->fe, 8, 0, 1);
2497 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
2498 adap->fe->ops.tuner_ops.set_params = dib7090_agc_startup;
2499 return 0;
2502 /* STK7070PD */
2503 static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
2505 .output_mpeg2_in_188_bytes = 1,
2507 .agc_config_count = 1,
2508 .agc = &dib7070_agc_config,
2509 .bw = &dib7070_bw_config_12_mhz,
2510 .tuner_is_baseband = 1,
2511 .spur_protect = 1,
2513 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2514 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2515 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2517 .hostbus_diversity = 1,
2518 }, {
2519 .output_mpeg2_in_188_bytes = 1,
2521 .agc_config_count = 1,
2522 .agc = &dib7070_agc_config,
2523 .bw = &dib7070_bw_config_12_mhz,
2524 .tuner_is_baseband = 1,
2525 .spur_protect = 1,
2527 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2528 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2529 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2531 .hostbus_diversity = 1,
2535 static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
2537 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2538 msleep(10);
2539 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2540 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2541 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2542 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2544 dib0700_ctrl_clock(adap->dev, 72, 1);
2546 msleep(10);
2547 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2548 msleep(10);
2549 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2551 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
2552 stk7070pd_dib7000p_config) != 0) {
2553 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
2554 __func__);
2555 return -ENODEV;
2558 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
2559 return adap->fe == NULL ? -ENODEV : 0;
2562 static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
2564 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
2565 return adap->fe == NULL ? -ENODEV : 0;
2568 /* S5H1411 */
2569 static struct s5h1411_config pinnacle_801e_config = {
2570 .output_mode = S5H1411_PARALLEL_OUTPUT,
2571 .gpio = S5H1411_GPIO_OFF,
2572 .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
2573 .qam_if = S5H1411_IF_44000,
2574 .vsb_if = S5H1411_IF_44000,
2575 .inversion = S5H1411_INVERSION_OFF,
2576 .status_mode = S5H1411_DEMODLOCKING
2579 /* Pinnacle PCTV HD Pro 801e GPIOs map:
2580 GPIO0 - currently unknown
2581 GPIO1 - xc5000 tuner reset
2582 GPIO2 - CX25843 sleep
2583 GPIO3 - currently unknown
2584 GPIO4 - currently unknown
2585 GPIO6 - currently unknown
2586 GPIO7 - currently unknown
2587 GPIO9 - currently unknown
2588 GPIO10 - CX25843 reset
2590 static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
2592 struct dib0700_state *st = adap->dev->priv;
2594 /* Make use of the new i2c functions from FW 1.20 */
2595 st->fw_use_new_i2c_api = 1;
2597 /* The s5h1411 requires the dib0700 to not be in master mode */
2598 st->disable_streaming_master_mode = 1;
2600 /* All msleep values taken from Windows USB trace */
2601 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
2602 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
2603 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2604 msleep(400);
2605 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2606 msleep(60);
2607 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2608 msleep(30);
2609 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2610 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2611 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2612 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2613 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
2614 msleep(30);
2616 /* Put the CX25843 to sleep for now since we're in digital mode */
2617 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
2619 /* GPIOs are initialized, do the attach */
2620 adap->fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
2621 &adap->dev->i2c_adap);
2622 return adap->fe == NULL ? -ENODEV : 0;
2625 static int dib0700_xc5000_tuner_callback(void *priv, int component,
2626 int command, int arg)
2628 struct dvb_usb_adapter *adap = priv;
2630 if (command == XC5000_TUNER_RESET) {
2631 /* Reset the tuner */
2632 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
2633 msleep(10);
2634 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
2635 msleep(10);
2636 } else {
2637 err("xc5000: unknown tuner callback command: %d\n", command);
2638 return -EINVAL;
2641 return 0;
2644 static struct xc5000_config s5h1411_xc5000_tunerconfig = {
2645 .i2c_address = 0x64,
2646 .if_khz = 5380,
2649 static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
2651 /* FIXME: generalize & move to common area */
2652 adap->fe->callback = dib0700_xc5000_tuner_callback;
2654 return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap,
2655 &s5h1411_xc5000_tunerconfig)
2656 == NULL ? -ENODEV : 0;
2659 static struct lgdt3305_config hcw_lgdt3305_config = {
2660 .i2c_addr = 0x0e,
2661 .mpeg_mode = LGDT3305_MPEG_PARALLEL,
2662 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
2663 .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
2664 .deny_i2c_rptr = 0,
2665 .spectral_inversion = 1,
2666 .qam_if_khz = 6000,
2667 .vsb_if_khz = 6000,
2668 .usref_8vsb = 0x0500,
2671 static struct mxl5007t_config hcw_mxl5007t_config = {
2672 .xtal_freq_hz = MxL_XTAL_25_MHZ,
2673 .if_freq_hz = MxL_IF_6_MHZ,
2674 .invert_if = 1,
2677 /* TIGER-ATSC map:
2678 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
2679 GPIO1 - ANT_SEL (H: VPA, L: MCX)
2680 GPIO4 - SCL2
2681 GPIO6 - EN_TUNER
2682 GPIO7 - SDA2
2683 GPIO10 - DEM_RST
2685 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
2687 static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
2689 struct dib0700_state *st = adap->dev->priv;
2691 /* Make use of the new i2c functions from FW 1.20 */
2692 st->fw_use_new_i2c_api = 1;
2694 st->disable_streaming_master_mode = 1;
2696 /* fe power enable */
2697 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
2698 msleep(30);
2699 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2700 msleep(30);
2702 /* demod reset */
2703 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2704 msleep(30);
2705 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2706 msleep(30);
2707 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2708 msleep(30);
2710 adap->fe = dvb_attach(lgdt3305_attach,
2711 &hcw_lgdt3305_config,
2712 &adap->dev->i2c_adap);
2714 return adap->fe == NULL ? -ENODEV : 0;
2717 static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
2719 return dvb_attach(mxl5007t_attach, adap->fe,
2720 &adap->dev->i2c_adap, 0x60,
2721 &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
2725 /* DVB-USB and USB stuff follows */
2726 struct usb_device_id dib0700_usb_id_table[] = {
2727 /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
2728 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
2729 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
2730 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
2731 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
2732 /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
2733 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
2734 { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
2735 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
2736 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
2737 /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
2738 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
2739 { USB_DEVICE(USB_VID_TERRATEC,
2740 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
2741 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
2742 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
2743 /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
2744 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
2745 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
2746 { USB_DEVICE(USB_VID_PINNACLE,
2747 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
2748 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
2749 /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
2750 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
2751 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
2752 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
2753 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
2754 /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
2755 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
2756 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
2757 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
2758 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
2759 /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
2760 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
2761 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
2762 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
2763 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
2764 /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
2765 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
2766 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
2767 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
2768 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
2769 /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
2770 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
2771 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
2772 { USB_DEVICE(USB_VID_TERRATEC,
2773 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
2774 { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
2775 /* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
2776 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
2777 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
2778 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
2779 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
2780 /* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
2781 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
2782 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
2783 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
2784 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
2785 /* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
2786 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
2787 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV73ESE) },
2788 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV282E) },
2789 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
2790 /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
2791 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
2792 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
2793 { USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x000, 0x3f00) },
2794 { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },
2795 /* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
2796 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
2797 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) },
2798 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) },
2799 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090M) },
2800 /* 70 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM8096MD) },
2801 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090MD) },
2802 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM7090) },
2803 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090PVR) },
2804 { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2) },
2805 { 0 } /* Terminating entry */
2807 MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
2809 #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
2810 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
2811 .usb_ctrl = DEVICE_SPECIFIC, \
2812 .firmware = "dvb-usb-dib0700-1.20.fw", \
2813 .download_firmware = dib0700_download_firmware, \
2814 .no_reconnect = 1, \
2815 .size_of_priv = sizeof(struct dib0700_state), \
2816 .i2c_algo = &dib0700_i2c_algo, \
2817 .identify_state = dib0700_identify_state
2819 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
2820 .streaming_ctrl = dib0700_streaming_ctrl, \
2821 .stream = { \
2822 .type = USB_BULK, \
2823 .count = 4, \
2824 .endpoint = ep, \
2825 .u = { \
2826 .bulk = { \
2827 .buffersize = 39480, \
2832 struct dvb_usb_device_properties dib0700_devices[] = {
2834 DIB0700_DEFAULT_DEVICE_PROPERTIES,
2836 .num_adapters = 1,
2837 .adapter = {
2839 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2840 .pid_filter_count = 32,
2841 .pid_filter = stk7700p_pid_filter,
2842 .pid_filter_ctrl = stk7700p_pid_filter_ctrl,
2843 .frontend_attach = stk7700p_frontend_attach,
2844 .tuner_attach = stk7700p_tuner_attach,
2846 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2850 .num_device_descs = 8,
2851 .devices = {
2852 { "DiBcom STK7700P reference design",
2853 { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
2854 { NULL },
2856 { "Hauppauge Nova-T Stick",
2857 { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
2858 { NULL },
2860 { "AVerMedia AVerTV DVB-T Volar",
2861 { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
2862 { NULL },
2864 { "Compro Videomate U500",
2865 { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
2866 { NULL },
2868 { "Uniwill STK7700P based (Hama and others)",
2869 { &dib0700_usb_id_table[7], NULL },
2870 { NULL },
2872 { "Leadtek Winfast DTV Dongle (STK7700P based)",
2873 { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
2874 { NULL },
2876 { "AVerMedia AVerTV DVB-T Express",
2877 { &dib0700_usb_id_table[20] },
2878 { NULL },
2880 { "Gigabyte U7000",
2881 { &dib0700_usb_id_table[21], NULL },
2882 { NULL },
2886 .rc.core = {
2887 .rc_interval = DEFAULT_RC_INTERVAL,
2888 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
2889 .rc_query = dib0700_rc_query_old_firmware,
2890 .allowed_protos = RC_TYPE_RC5 |
2891 RC_TYPE_RC6 |
2892 RC_TYPE_NEC,
2893 .change_protocol = dib0700_change_protocol,
2895 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2897 .num_adapters = 2,
2898 .adapter = {
2900 .frontend_attach = bristol_frontend_attach,
2901 .tuner_attach = bristol_tuner_attach,
2903 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2904 }, {
2905 .frontend_attach = bristol_frontend_attach,
2906 .tuner_attach = bristol_tuner_attach,
2908 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2912 .num_device_descs = 1,
2913 .devices = {
2914 { "Hauppauge Nova-T 500 Dual DVB-T",
2915 { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
2916 { NULL },
2920 .rc.core = {
2921 .rc_interval = DEFAULT_RC_INTERVAL,
2922 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
2923 .rc_query = dib0700_rc_query_old_firmware,
2924 .allowed_protos = RC_TYPE_RC5 |
2925 RC_TYPE_RC6 |
2926 RC_TYPE_NEC,
2927 .change_protocol = dib0700_change_protocol,
2929 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2931 .num_adapters = 2,
2932 .adapter = {
2934 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2935 .pid_filter_count = 32,
2936 .pid_filter = stk70x0p_pid_filter,
2937 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2938 .frontend_attach = stk7700d_frontend_attach,
2939 .tuner_attach = stk7700d_tuner_attach,
2941 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2942 }, {
2943 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2944 .pid_filter_count = 32,
2945 .pid_filter = stk70x0p_pid_filter,
2946 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2947 .frontend_attach = stk7700d_frontend_attach,
2948 .tuner_attach = stk7700d_tuner_attach,
2950 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2954 .num_device_descs = 5,
2955 .devices = {
2956 { "Pinnacle PCTV 2000e",
2957 { &dib0700_usb_id_table[11], NULL },
2958 { NULL },
2960 { "Terratec Cinergy DT XS Diversity",
2961 { &dib0700_usb_id_table[12], NULL },
2962 { NULL },
2964 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
2965 { &dib0700_usb_id_table[13], NULL },
2966 { NULL },
2968 { "DiBcom STK7700D reference design",
2969 { &dib0700_usb_id_table[14], NULL },
2970 { NULL },
2972 { "YUAN High-Tech DiBcom STK7700D",
2973 { &dib0700_usb_id_table[55], NULL },
2974 { NULL },
2979 .rc.core = {
2980 .rc_interval = DEFAULT_RC_INTERVAL,
2981 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
2982 .rc_query = dib0700_rc_query_old_firmware,
2983 .allowed_protos = RC_TYPE_RC5 |
2984 RC_TYPE_RC6 |
2985 RC_TYPE_NEC,
2986 .change_protocol = dib0700_change_protocol,
2988 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2990 .num_adapters = 1,
2991 .adapter = {
2993 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2994 .pid_filter_count = 32,
2995 .pid_filter = stk70x0p_pid_filter,
2996 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2997 .frontend_attach = stk7700P2_frontend_attach,
2998 .tuner_attach = stk7700d_tuner_attach,
3000 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3004 .num_device_descs = 3,
3005 .devices = {
3006 { "ASUS My Cinema U3000 Mini DVBT Tuner",
3007 { &dib0700_usb_id_table[23], NULL },
3008 { NULL },
3010 { "Yuan EC372S",
3011 { &dib0700_usb_id_table[31], NULL },
3012 { NULL },
3014 { "Terratec Cinergy T Express",
3015 { &dib0700_usb_id_table[42], NULL },
3016 { NULL },
3020 .rc.core = {
3021 .rc_interval = DEFAULT_RC_INTERVAL,
3022 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3023 .module_name = "dib0700",
3024 .rc_query = dib0700_rc_query_old_firmware,
3025 .allowed_protos = RC_TYPE_RC5 |
3026 RC_TYPE_RC6 |
3027 RC_TYPE_NEC,
3028 .change_protocol = dib0700_change_protocol,
3030 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3032 .num_adapters = 1,
3033 .adapter = {
3035 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3036 .pid_filter_count = 32,
3037 .pid_filter = stk70x0p_pid_filter,
3038 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3039 .frontend_attach = stk7070p_frontend_attach,
3040 .tuner_attach = dib7070p_tuner_attach,
3042 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3044 .size_of_priv = sizeof(struct dib0700_adapter_state),
3048 .num_device_descs = 11,
3049 .devices = {
3050 { "DiBcom STK7070P reference design",
3051 { &dib0700_usb_id_table[15], NULL },
3052 { NULL },
3054 { "Pinnacle PCTV DVB-T Flash Stick",
3055 { &dib0700_usb_id_table[16], NULL },
3056 { NULL },
3058 { "Artec T14BR DVB-T",
3059 { &dib0700_usb_id_table[22], NULL },
3060 { NULL },
3062 { "ASUS My Cinema U3100 Mini DVBT Tuner",
3063 { &dib0700_usb_id_table[24], NULL },
3064 { NULL },
3066 { "Hauppauge Nova-T Stick",
3067 { &dib0700_usb_id_table[25], NULL },
3068 { NULL },
3070 { "Hauppauge Nova-T MyTV.t",
3071 { &dib0700_usb_id_table[26], NULL },
3072 { NULL },
3074 { "Pinnacle PCTV 72e",
3075 { &dib0700_usb_id_table[29], NULL },
3076 { NULL },
3078 { "Pinnacle PCTV 73e",
3079 { &dib0700_usb_id_table[30], NULL },
3080 { NULL },
3082 { "Elgato EyeTV DTT",
3083 { &dib0700_usb_id_table[49], NULL },
3084 { NULL },
3086 { "Yuan PD378S",
3087 { &dib0700_usb_id_table[45], NULL },
3088 { NULL },
3090 { "Elgato EyeTV Dtt Dlx PD378S",
3091 { &dib0700_usb_id_table[50], NULL },
3092 { NULL },
3096 .rc.core = {
3097 .rc_interval = DEFAULT_RC_INTERVAL,
3098 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3099 .module_name = "dib0700",
3100 .rc_query = dib0700_rc_query_old_firmware,
3101 .allowed_protos = RC_TYPE_RC5 |
3102 RC_TYPE_RC6 |
3103 RC_TYPE_NEC,
3104 .change_protocol = dib0700_change_protocol,
3106 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3108 .num_adapters = 1,
3109 .adapter = {
3111 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3112 .pid_filter_count = 32,
3113 .pid_filter = stk70x0p_pid_filter,
3114 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3115 .frontend_attach = stk7070p_frontend_attach,
3116 .tuner_attach = dib7070p_tuner_attach,
3118 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3120 .size_of_priv = sizeof(struct dib0700_adapter_state),
3124 .num_device_descs = 3,
3125 .devices = {
3126 { "Pinnacle PCTV 73A",
3127 { &dib0700_usb_id_table[56], NULL },
3128 { NULL },
3130 { "Pinnacle PCTV 73e SE",
3131 { &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL },
3132 { NULL },
3134 { "Pinnacle PCTV 282e",
3135 { &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL },
3136 { NULL },
3140 .rc.core = {
3141 .rc_interval = DEFAULT_RC_INTERVAL,
3142 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3143 .module_name = "dib0700",
3144 .rc_query = dib0700_rc_query_old_firmware,
3145 .allowed_protos = RC_TYPE_RC5 |
3146 RC_TYPE_RC6 |
3147 RC_TYPE_NEC,
3148 .change_protocol = dib0700_change_protocol,
3150 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3152 .num_adapters = 2,
3153 .adapter = {
3155 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3156 .pid_filter_count = 32,
3157 .pid_filter = stk70x0p_pid_filter,
3158 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3159 .frontend_attach = stk7070pd_frontend_attach0,
3160 .tuner_attach = dib7070p_tuner_attach,
3162 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3164 .size_of_priv = sizeof(struct dib0700_adapter_state),
3165 }, {
3166 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3167 .pid_filter_count = 32,
3168 .pid_filter = stk70x0p_pid_filter,
3169 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3170 .frontend_attach = stk7070pd_frontend_attach1,
3171 .tuner_attach = dib7070p_tuner_attach,
3173 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3175 .size_of_priv = sizeof(struct dib0700_adapter_state),
3179 .num_device_descs = 6,
3180 .devices = {
3181 { "DiBcom STK7070PD reference design",
3182 { &dib0700_usb_id_table[17], NULL },
3183 { NULL },
3185 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
3186 { &dib0700_usb_id_table[18], NULL },
3187 { NULL },
3189 { "Hauppauge Nova-TD Stick (52009)",
3190 { &dib0700_usb_id_table[35], NULL },
3191 { NULL },
3193 { "Hauppauge Nova-TD-500 (84xxx)",
3194 { &dib0700_usb_id_table[36], NULL },
3195 { NULL },
3197 { "Terratec Cinergy DT USB XS Diversity/ T5",
3198 { &dib0700_usb_id_table[43],
3199 &dib0700_usb_id_table[53], NULL},
3200 { NULL },
3202 { "Sony PlayTV",
3203 { &dib0700_usb_id_table[44], NULL },
3204 { NULL },
3208 .rc.core = {
3209 .rc_interval = DEFAULT_RC_INTERVAL,
3210 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3211 .module_name = "dib0700",
3212 .rc_query = dib0700_rc_query_old_firmware,
3213 .allowed_protos = RC_TYPE_RC5 |
3214 RC_TYPE_RC6 |
3215 RC_TYPE_NEC,
3216 .change_protocol = dib0700_change_protocol,
3218 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3220 .num_adapters = 2,
3221 .adapter = {
3223 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3224 .pid_filter_count = 32,
3225 .pid_filter = stk70x0p_pid_filter,
3226 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3227 .frontend_attach = stk7070pd_frontend_attach0,
3228 .tuner_attach = dib7070p_tuner_attach,
3230 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3232 .size_of_priv = sizeof(struct dib0700_adapter_state),
3233 }, {
3234 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3235 .pid_filter_count = 32,
3236 .pid_filter = stk70x0p_pid_filter,
3237 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3238 .frontend_attach = stk7070pd_frontend_attach1,
3239 .tuner_attach = dib7070p_tuner_attach,
3241 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3243 .size_of_priv = sizeof(struct dib0700_adapter_state),
3247 .num_device_descs = 1,
3248 .devices = {
3249 { "Elgato EyeTV Diversity",
3250 { &dib0700_usb_id_table[68], NULL },
3251 { NULL },
3255 .rc.core = {
3256 .rc_interval = DEFAULT_RC_INTERVAL,
3257 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
3258 .module_name = "dib0700",
3259 .rc_query = dib0700_rc_query_old_firmware,
3260 .allowed_protos = RC_TYPE_RC5 |
3261 RC_TYPE_RC6 |
3262 RC_TYPE_NEC,
3263 .change_protocol = dib0700_change_protocol,
3265 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3267 .num_adapters = 1,
3268 .adapter = {
3270 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3271 .pid_filter_count = 32,
3272 .pid_filter = stk70x0p_pid_filter,
3273 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3274 .frontend_attach = stk7700ph_frontend_attach,
3275 .tuner_attach = stk7700ph_tuner_attach,
3277 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3279 .size_of_priv = sizeof(struct
3280 dib0700_adapter_state),
3284 .num_device_descs = 9,
3285 .devices = {
3286 { "Terratec Cinergy HT USB XE",
3287 { &dib0700_usb_id_table[27], NULL },
3288 { NULL },
3290 { "Pinnacle Expresscard 320cx",
3291 { &dib0700_usb_id_table[28], NULL },
3292 { NULL },
3294 { "Terratec Cinergy HT Express",
3295 { &dib0700_usb_id_table[32], NULL },
3296 { NULL },
3298 { "Gigabyte U8000-RH",
3299 { &dib0700_usb_id_table[37], NULL },
3300 { NULL },
3302 { "YUAN High-Tech STK7700PH",
3303 { &dib0700_usb_id_table[38], NULL },
3304 { NULL },
3306 { "Asus My Cinema-U3000Hybrid",
3307 { &dib0700_usb_id_table[39], NULL },
3308 { NULL },
3310 { "YUAN High-Tech MC770",
3311 { &dib0700_usb_id_table[48], NULL },
3312 { NULL },
3314 { "Leadtek WinFast DTV Dongle H",
3315 { &dib0700_usb_id_table[51], NULL },
3316 { NULL },
3318 { "YUAN High-Tech STK7700D",
3319 { &dib0700_usb_id_table[54], NULL },
3320 { NULL },
3324 .rc.core = {
3325 .rc_interval = DEFAULT_RC_INTERVAL,
3326 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3327 .module_name = "dib0700",
3328 .rc_query = dib0700_rc_query_old_firmware,
3329 .allowed_protos = RC_TYPE_RC5 |
3330 RC_TYPE_RC6 |
3331 RC_TYPE_NEC,
3332 .change_protocol = dib0700_change_protocol,
3334 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3335 .num_adapters = 1,
3336 .adapter = {
3338 .frontend_attach = s5h1411_frontend_attach,
3339 .tuner_attach = xc5000_tuner_attach,
3341 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3343 .size_of_priv = sizeof(struct
3344 dib0700_adapter_state),
3348 .num_device_descs = 2,
3349 .devices = {
3350 { "Pinnacle PCTV HD Pro USB Stick",
3351 { &dib0700_usb_id_table[40], NULL },
3352 { NULL },
3354 { "Pinnacle PCTV HD USB Stick",
3355 { &dib0700_usb_id_table[41], NULL },
3356 { NULL },
3360 .rc.core = {
3361 .rc_interval = DEFAULT_RC_INTERVAL,
3362 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3363 .module_name = "dib0700",
3364 .rc_query = dib0700_rc_query_old_firmware,
3365 .allowed_protos = RC_TYPE_RC5 |
3366 RC_TYPE_RC6 |
3367 RC_TYPE_NEC,
3368 .change_protocol = dib0700_change_protocol,
3370 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3371 .num_adapters = 1,
3372 .adapter = {
3374 .frontend_attach = lgdt3305_frontend_attach,
3375 .tuner_attach = mxl5007t_tuner_attach,
3377 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3379 .size_of_priv = sizeof(struct
3380 dib0700_adapter_state),
3384 .num_device_descs = 2,
3385 .devices = {
3386 { "Hauppauge ATSC MiniCard (B200)",
3387 { &dib0700_usb_id_table[46], NULL },
3388 { NULL },
3390 { "Hauppauge ATSC MiniCard (B210)",
3391 { &dib0700_usb_id_table[47], NULL },
3392 { NULL },
3395 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3397 .num_adapters = 1,
3398 .adapter = {
3400 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3401 .pid_filter_count = 32,
3402 .pid_filter = stk70x0p_pid_filter,
3403 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3404 .frontend_attach = stk7770p_frontend_attach,
3405 .tuner_attach = dib7770p_tuner_attach,
3407 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3409 .size_of_priv =
3410 sizeof(struct dib0700_adapter_state),
3414 .num_device_descs = 3,
3415 .devices = {
3416 { "DiBcom STK7770P reference design",
3417 { &dib0700_usb_id_table[59], NULL },
3418 { NULL },
3420 { "Terratec Cinergy T USB XXS (HD)/ T3",
3421 { &dib0700_usb_id_table[33],
3422 &dib0700_usb_id_table[52],
3423 &dib0700_usb_id_table[60], NULL},
3424 { NULL },
3426 { "TechniSat AirStar TeleStick 2",
3427 { &dib0700_usb_id_table[74], NULL },
3428 { NULL },
3432 .rc.core = {
3433 .rc_interval = DEFAULT_RC_INTERVAL,
3434 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3435 .module_name = "dib0700",
3436 .rc_query = dib0700_rc_query_old_firmware,
3437 .allowed_protos = RC_TYPE_RC5 |
3438 RC_TYPE_RC6 |
3439 RC_TYPE_NEC,
3440 .change_protocol = dib0700_change_protocol,
3442 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3443 .num_adapters = 1,
3444 .adapter = {
3446 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3447 .pid_filter_count = 32,
3448 .pid_filter = stk80xx_pid_filter,
3449 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
3450 .frontend_attach = stk807x_frontend_attach,
3451 .tuner_attach = dib807x_tuner_attach,
3453 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3455 .size_of_priv =
3456 sizeof(struct dib0700_adapter_state),
3460 .num_device_descs = 3,
3461 .devices = {
3462 { "DiBcom STK807xP reference design",
3463 { &dib0700_usb_id_table[62], NULL },
3464 { NULL },
3466 { "Prolink Pixelview SBTVD",
3467 { &dib0700_usb_id_table[63], NULL },
3468 { NULL },
3470 { "EvolutePC TVWay+",
3471 { &dib0700_usb_id_table[64], NULL },
3472 { NULL },
3476 .rc.core = {
3477 .rc_interval = DEFAULT_RC_INTERVAL,
3478 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
3479 .module_name = "dib0700",
3480 .rc_query = dib0700_rc_query_old_firmware,
3481 .allowed_protos = RC_TYPE_RC5 |
3482 RC_TYPE_RC6 |
3483 RC_TYPE_NEC,
3484 .change_protocol = dib0700_change_protocol,
3486 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3487 .num_adapters = 2,
3488 .adapter = {
3490 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3491 .pid_filter_count = 32,
3492 .pid_filter = stk80xx_pid_filter,
3493 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
3494 .frontend_attach = stk807xpvr_frontend_attach0,
3495 .tuner_attach = dib807x_tuner_attach,
3497 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3499 .size_of_priv =
3500 sizeof(struct dib0700_adapter_state),
3503 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3504 .pid_filter_count = 32,
3505 .pid_filter = stk80xx_pid_filter,
3506 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
3507 .frontend_attach = stk807xpvr_frontend_attach1,
3508 .tuner_attach = dib807x_tuner_attach,
3510 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3512 .size_of_priv =
3513 sizeof(struct dib0700_adapter_state),
3517 .num_device_descs = 1,
3518 .devices = {
3519 { "DiBcom STK807xPVR reference design",
3520 { &dib0700_usb_id_table[61], NULL },
3521 { NULL },
3525 .rc.core = {
3526 .rc_interval = DEFAULT_RC_INTERVAL,
3527 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3528 .module_name = "dib0700",
3529 .rc_query = dib0700_rc_query_old_firmware,
3530 .allowed_protos = RC_TYPE_RC5 |
3531 RC_TYPE_RC6 |
3532 RC_TYPE_NEC,
3533 .change_protocol = dib0700_change_protocol,
3535 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3536 .num_adapters = 1,
3537 .adapter = {
3539 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3540 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3541 .pid_filter_count = 32,
3542 .pid_filter = stk80xx_pid_filter,
3543 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
3544 .frontend_attach = stk809x_frontend_attach,
3545 .tuner_attach = dib809x_tuner_attach,
3547 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3549 .size_of_priv =
3550 sizeof(struct dib0700_adapter_state),
3554 .num_device_descs = 1,
3555 .devices = {
3556 { "DiBcom STK8096GP reference design",
3557 { &dib0700_usb_id_table[67], NULL },
3558 { NULL },
3562 .rc.core = {
3563 .rc_interval = DEFAULT_RC_INTERVAL,
3564 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3565 .module_name = "dib0700",
3566 .rc_query = dib0700_rc_query_old_firmware,
3567 .allowed_protos = RC_TYPE_RC5 |
3568 RC_TYPE_RC6 |
3569 RC_TYPE_NEC,
3570 .change_protocol = dib0700_change_protocol,
3572 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3573 .num_adapters = 1,
3574 .adapter = {
3576 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3577 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3578 .pid_filter_count = 32,
3579 .pid_filter = dib90x0_pid_filter,
3580 .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
3581 .frontend_attach = stk9090m_frontend_attach,
3582 .tuner_attach = dib9090_tuner_attach,
3584 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3586 .size_of_priv =
3587 sizeof(struct dib0700_adapter_state),
3591 .num_device_descs = 1,
3592 .devices = {
3593 { "DiBcom STK9090M reference design",
3594 { &dib0700_usb_id_table[69], NULL },
3595 { NULL },
3599 .rc.core = {
3600 .rc_interval = DEFAULT_RC_INTERVAL,
3601 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3602 .module_name = "dib0700",
3603 .rc_query = dib0700_rc_query_old_firmware,
3604 .allowed_protos = RC_TYPE_RC5 |
3605 RC_TYPE_RC6 |
3606 RC_TYPE_NEC,
3607 .change_protocol = dib0700_change_protocol,
3609 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3610 .num_adapters = 1,
3611 .adapter = {
3613 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3614 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3615 .pid_filter_count = 32,
3616 .pid_filter = stk80xx_pid_filter,
3617 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
3618 .frontend_attach = nim8096md_frontend_attach,
3619 .tuner_attach = nim8096md_tuner_attach,
3621 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3623 .size_of_priv =
3624 sizeof(struct dib0700_adapter_state),
3628 .num_device_descs = 1,
3629 .devices = {
3630 { "DiBcom NIM8096MD reference design",
3631 { &dib0700_usb_id_table[70], NULL },
3632 { NULL },
3636 .rc.core = {
3637 .rc_interval = DEFAULT_RC_INTERVAL,
3638 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3639 .module_name = "dib0700",
3640 .rc_query = dib0700_rc_query_old_firmware,
3641 .allowed_protos = RC_TYPE_RC5 |
3642 RC_TYPE_RC6 |
3643 RC_TYPE_NEC,
3644 .change_protocol = dib0700_change_protocol,
3646 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3647 .num_adapters = 1,
3648 .adapter = {
3650 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3651 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3652 .pid_filter_count = 32,
3653 .pid_filter = dib90x0_pid_filter,
3654 .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
3655 .frontend_attach = nim9090md_frontend_attach,
3656 .tuner_attach = nim9090md_tuner_attach,
3658 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3660 .size_of_priv =
3661 sizeof(struct dib0700_adapter_state),
3665 .num_device_descs = 1,
3666 .devices = {
3667 { "DiBcom NIM9090MD reference design",
3668 { &dib0700_usb_id_table[71], NULL },
3669 { NULL },
3673 .rc.core = {
3674 .rc_interval = DEFAULT_RC_INTERVAL,
3675 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3676 .module_name = "dib0700",
3677 .rc_query = dib0700_rc_query_old_firmware,
3678 .allowed_protos = RC_TYPE_RC5 |
3679 RC_TYPE_RC6 |
3680 RC_TYPE_NEC,
3681 .change_protocol = dib0700_change_protocol,
3683 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3684 .num_adapters = 1,
3685 .adapter = {
3687 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3688 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3689 .pid_filter_count = 32,
3690 .pid_filter = stk70x0p_pid_filter,
3691 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3692 .frontend_attach = nim7090_frontend_attach,
3693 .tuner_attach = nim7090_tuner_attach,
3695 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3697 .size_of_priv =
3698 sizeof(struct dib0700_adapter_state),
3702 .num_device_descs = 1,
3703 .devices = {
3704 { "DiBcom NIM7090 reference design",
3705 { &dib0700_usb_id_table[72], NULL },
3706 { NULL },
3710 .rc.core = {
3711 .rc_interval = DEFAULT_RC_INTERVAL,
3712 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3713 .module_name = "dib0700",
3714 .rc_query = dib0700_rc_query_old_firmware,
3715 .allowed_protos = RC_TYPE_RC5 |
3716 RC_TYPE_RC6 |
3717 RC_TYPE_NEC,
3718 .change_protocol = dib0700_change_protocol,
3720 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3721 .num_adapters = 2,
3722 .adapter = {
3724 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3725 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3726 .pid_filter_count = 32,
3727 .pid_filter = stk70x0p_pid_filter,
3728 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3729 .frontend_attach = tfe7090pvr_frontend0_attach,
3730 .tuner_attach = tfe7090pvr_tuner0_attach,
3732 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3734 .size_of_priv =
3735 sizeof(struct dib0700_adapter_state),
3738 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3739 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3740 .pid_filter_count = 32,
3741 .pid_filter = stk70x0p_pid_filter,
3742 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3743 .frontend_attach = tfe7090pvr_frontend1_attach,
3744 .tuner_attach = tfe7090pvr_tuner1_attach,
3746 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3748 .size_of_priv =
3749 sizeof(struct dib0700_adapter_state),
3753 .num_device_descs = 1,
3754 .devices = {
3755 { "DiBcom TFE7090PVR reference design",
3756 { &dib0700_usb_id_table[73], NULL },
3757 { NULL },
3761 .rc.core = {
3762 .rc_interval = DEFAULT_RC_INTERVAL,
3763 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3764 .module_name = "dib0700",
3765 .rc_query = dib0700_rc_query_old_firmware,
3766 .allowed_protos = RC_TYPE_RC5 |
3767 RC_TYPE_RC6 |
3768 RC_TYPE_NEC,
3769 .change_protocol = dib0700_change_protocol,
3774 int dib0700_device_count = ARRAY_SIZE(dib0700_devices);