V4L/DVB: dib7770: enable the current mirror
[linux/fpc-iii.git] / drivers / media / dvb / dvb-usb / dib0700_devices.c
blob33af683aea5d07ae3996f58b8e2dde070025543e
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 "mt2060.h"
16 #include "mt2266.h"
17 #include "tuner-xc2028.h"
18 #include "xc5000.h"
19 #include "s5h1411.h"
20 #include "dib0070.h"
21 #include "dib0090.h"
22 #include "lgdt3305.h"
23 #include "mxl5007t.h"
25 static int force_lna_activation;
26 module_param(force_lna_activation, int, 0644);
27 MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), "
28 "if applicable for the device (default: 0=automatic/off).");
30 struct dib0700_adapter_state {
31 int (*set_param_save) (struct dvb_frontend *, struct dvb_frontend_parameters *);
34 /* Hauppauge Nova-T 500 (aka Bristol)
35 * has a LNA on GPIO0 which is enabled by setting 1 */
36 static struct mt2060_config bristol_mt2060_config[2] = {
38 .i2c_address = 0x60,
39 .clock_out = 3,
40 }, {
41 .i2c_address = 0x61,
46 static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
47 .band_caps = BAND_VHF | BAND_UHF,
48 .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
50 .agc1_max = 42598,
51 .agc1_min = 17694,
52 .agc2_max = 45875,
53 .agc2_min = 0,
55 .agc1_pt1 = 0,
56 .agc1_pt2 = 59,
58 .agc1_slope1 = 0,
59 .agc1_slope2 = 69,
61 .agc2_pt1 = 0,
62 .agc2_pt2 = 59,
64 .agc2_slope1 = 111,
65 .agc2_slope2 = 28,
68 static struct dib3000mc_config bristol_dib3000mc_config[2] = {
69 { .agc = &bristol_dib3000p_mt2060_agc_config,
70 .max_time = 0x196,
71 .ln_adc_level = 0x1cc7,
72 .output_mpeg2_in_188_bytes = 1,
74 { .agc = &bristol_dib3000p_mt2060_agc_config,
75 .max_time = 0x196,
76 .ln_adc_level = 0x1cc7,
77 .output_mpeg2_in_188_bytes = 1,
81 static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
83 struct dib0700_state *st = adap->dev->priv;
84 if (adap->id == 0) {
85 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
86 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
87 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
88 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
90 if (force_lna_activation)
91 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
92 else
93 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
95 if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {
96 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
97 return -ENODEV;
100 st->mt2060_if1[adap->id] = 1220;
101 return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
102 (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
105 static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval)
107 struct i2c_msg msg[2] = {
108 { .addr = 0x50, .flags = 0, .buf = &adrs, .len = 1 },
109 { .addr = 0x50, .flags = I2C_M_RD, .buf = pval, .len = 1 },
111 if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO;
112 return 0;
115 static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
117 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
118 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
119 s8 a;
120 int if1=1220;
121 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
122 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) {
123 if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;
125 return dvb_attach(mt2060_attach,adap->fe, tun_i2c,&bristol_mt2060_config[adap->id],
126 if1) == NULL ? -ENODEV : 0;
129 /* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
131 /* MT226x */
132 static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = {
134 BAND_UHF,
136 /* 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,
137 * 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 */
138 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
139 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
141 1130,
145 118,
148 3530,
152 65535,
153 33770,
154 65535,
155 23592,
159 255,
162 132,
163 192,
173 }, {
174 BAND_VHF | BAND_LBAND,
176 /* 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,
177 * 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 */
178 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
179 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
181 2372,
185 118,
188 3530,
192 65535,
194 65535,
195 23592,
198 128,
199 128,
200 128,
202 128,
203 253,
216 static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = {
217 60000, 30000,
218 1, 8, 3, 1, 0,
219 0, 0, 1, 1, 2,
220 (3 << 14) | (1 << 12) | (524 << 0),
222 20452225,
225 static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {
226 { .output_mpeg2_in_188_bytes = 1,
227 .hostbus_diversity = 1,
228 .tuner_is_baseband = 1,
230 .agc_config_count = 2,
231 .agc = stk7700d_7000p_mt2266_agc_config,
232 .bw = &stk7700d_mt2266_pll_config,
234 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
235 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
236 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
238 { .output_mpeg2_in_188_bytes = 1,
239 .hostbus_diversity = 1,
240 .tuner_is_baseband = 1,
242 .agc_config_count = 2,
243 .agc = stk7700d_7000p_mt2266_agc_config,
244 .bw = &stk7700d_mt2266_pll_config,
246 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
247 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
248 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
252 static struct mt2266_config stk7700d_mt2266_config[2] = {
253 { .i2c_address = 0x60
255 { .i2c_address = 0x60
259 static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap)
261 if (adap->id == 0) {
262 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
263 msleep(10);
264 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
265 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
266 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
267 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
268 msleep(10);
269 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
270 msleep(10);
271 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
272 stk7700d_dib7000p_mt2266_config)
273 != 0) {
274 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
275 return -ENODEV;
279 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
280 &stk7700d_dib7000p_mt2266_config[adap->id]);
282 return adap->fe == NULL ? -ENODEV : 0;
285 static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap)
287 if (adap->id == 0) {
288 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
289 msleep(10);
290 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
291 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
292 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
293 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
294 msleep(10);
295 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
296 msleep(10);
297 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
298 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
299 stk7700d_dib7000p_mt2266_config)
300 != 0) {
301 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
302 return -ENODEV;
306 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
307 &stk7700d_dib7000p_mt2266_config[adap->id]);
309 return adap->fe == NULL ? -ENODEV : 0;
312 static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap)
314 struct i2c_adapter *tun_i2c;
315 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
316 return dvb_attach(mt2266_attach, adap->fe, tun_i2c,
317 &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;
320 /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
321 static struct dibx000_agc_config xc3028_agc_config = {
322 BAND_VHF | BAND_UHF, /* band_caps */
324 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
325 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
326 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
327 (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
328 (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */
330 712, /* inv_gain */
331 21, /* time_stabiliz */
333 0, /* alpha_level */
334 118, /* thlock */
336 0, /* wbd_inv */
337 2867, /* wbd_ref */
338 0, /* wbd_sel */
339 2, /* wbd_alpha */
341 0, /* agc1_max */
342 0, /* agc1_min */
343 39718, /* agc2_max */
344 9930, /* agc2_min */
345 0, /* agc1_pt1 */
346 0, /* agc1_pt2 */
347 0, /* agc1_pt3 */
348 0, /* agc1_slope1 */
349 0, /* agc1_slope2 */
350 0, /* agc2_pt1 */
351 128, /* agc2_pt2 */
352 29, /* agc2_slope1 */
353 29, /* agc2_slope2 */
355 17, /* alpha_mant */
356 27, /* alpha_exp */
357 23, /* beta_mant */
358 51, /* beta_exp */
360 1, /* perform_agc_softsplit */
363 /* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
364 static struct dibx000_bandwidth_config xc3028_bw_config = {
365 60000, 30000, /* internal, sampling */
366 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
367 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc,
368 modulo */
369 (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
370 (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
371 20452225, /* timf */
372 30000000, /* xtal_hz */
375 static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
376 .output_mpeg2_in_188_bytes = 1,
377 .tuner_is_baseband = 1,
379 .agc_config_count = 1,
380 .agc = &xc3028_agc_config,
381 .bw = &xc3028_bw_config,
383 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
384 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
385 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
388 static int stk7700ph_xc3028_callback(void *ptr, int component,
389 int command, int arg)
391 struct dvb_usb_adapter *adap = ptr;
393 switch (command) {
394 case XC2028_TUNER_RESET:
395 /* Send the tuner in then out of reset */
396 dib7000p_set_gpio(adap->fe, 8, 0, 0); msleep(10);
397 dib7000p_set_gpio(adap->fe, 8, 0, 1);
398 break;
399 case XC2028_RESET_CLK:
400 break;
401 default:
402 err("%s: unknown command %d, arg %d\n", __func__,
403 command, arg);
404 return -EINVAL;
406 return 0;
409 static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
410 .fname = XC2028_DEFAULT_FIRMWARE,
411 .max_len = 64,
412 .demod = XC3028_FE_DIBCOM52,
415 static struct xc2028_config stk7700ph_xc3028_config = {
416 .i2c_addr = 0x61,
417 .ctrl = &stk7700ph_xc3028_ctrl,
420 static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
422 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;
424 if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
425 desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))
426 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
427 else
428 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
429 msleep(20);
430 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
431 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
432 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
433 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
434 msleep(10);
435 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
436 msleep(20);
437 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
438 msleep(10);
440 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
441 &stk7700ph_dib7700_xc3028_config) != 0) {
442 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
443 __func__);
444 return -ENODEV;
447 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
448 &stk7700ph_dib7700_xc3028_config);
450 return adap->fe == NULL ? -ENODEV : 0;
453 static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
455 struct i2c_adapter *tun_i2c;
457 tun_i2c = dib7000p_get_i2c_master(adap->fe,
458 DIBX000_I2C_INTERFACE_TUNER, 1);
460 stk7700ph_xc3028_config.i2c_adap = tun_i2c;
462 /* FIXME: generalize & move to common area */
463 adap->fe->callback = stk7700ph_xc3028_callback;
465 return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config)
466 == NULL ? -ENODEV : 0;
469 #define DEFAULT_RC_INTERVAL 50
471 static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
473 /* Number of keypresses to ignore before start repeating */
474 #define RC_REPEAT_DELAY 6
476 static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
478 u8 key[4];
479 int i;
480 struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
481 struct dib0700_state *st = d->priv;
483 *event = 0;
484 *state = REMOTE_NO_KEY_PRESSED;
486 if (st->fw_version >= 0x10200) {
487 /* For 1.20 firmware , We need to keep the RC polling
488 callback so we can reuse the input device setup in
489 dvb-usb-remote.c. However, the actual work is being done
490 in the bulk URB completion handler. */
491 return 0;
494 i=dib0700_ctrl_rd(d,rc_request,2,key,4);
495 if (i<=0) {
496 err("RC Query Failed");
497 return -1;
500 /* losing half of KEY_0 events from Philipps rc5 remotes.. */
501 if (key[0]==0 && key[1]==0 && key[2]==0 && key[3]==0) return 0;
503 /* 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]); */
505 dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */
507 switch (dvb_usb_dib0700_ir_proto) {
508 case 0: {
509 /* NEC protocol sends repeat code as 0 0 0 FF */
510 if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&
511 (key[3] == 0xFF)) {
512 st->rc_counter++;
513 if (st->rc_counter > RC_REPEAT_DELAY) {
514 *event = d->last_event;
515 *state = REMOTE_KEY_PRESSED;
516 st->rc_counter = RC_REPEAT_DELAY;
518 return 0;
520 for (i=0;i<d->props.rc_key_map_size; i++) {
521 if (rc5_custom(&keymap[i]) == key[3-2] &&
522 rc5_data(&keymap[i]) == key[3-3]) {
523 st->rc_counter = 0;
524 *event = keymap[i].event;
525 *state = REMOTE_KEY_PRESSED;
526 d->last_event = keymap[i].event;
527 return 0;
530 break;
532 default: {
533 /* RC-5 protocol changes toggle bit on new keypress */
534 for (i = 0; i < d->props.rc_key_map_size; i++) {
535 if (rc5_custom(&keymap[i]) == key[3-2] &&
536 rc5_data(&keymap[i]) == key[3-3]) {
537 if (d->last_event == keymap[i].event &&
538 key[3-1] == st->rc_toggle) {
539 st->rc_counter++;
540 /* prevents unwanted double hits */
541 if (st->rc_counter > RC_REPEAT_DELAY) {
542 *event = d->last_event;
543 *state = REMOTE_KEY_PRESSED;
544 st->rc_counter = RC_REPEAT_DELAY;
547 return 0;
549 st->rc_counter = 0;
550 *event = keymap[i].event;
551 *state = REMOTE_KEY_PRESSED;
552 st->rc_toggle = key[3-1];
553 d->last_event = keymap[i].event;
554 return 0;
557 break;
560 err("Unknown remote controller key: %2X %2X %2X %2X", (int) key[3-2], (int) key[3-3], (int) key[3-1], (int) key[3]);
561 d->last_event = 0;
562 return 0;
565 static struct dvb_usb_rc_key ir_codes_dib0700_table[] = {
566 /* Key codes for the tiny Pinnacle remote*/
567 { 0x0700, KEY_MUTE },
568 { 0x0701, KEY_MENU }, /* Pinnacle logo */
569 { 0x0739, KEY_POWER },
570 { 0x0703, KEY_VOLUMEUP },
571 { 0x0709, KEY_VOLUMEDOWN },
572 { 0x0706, KEY_CHANNELUP },
573 { 0x070c, KEY_CHANNELDOWN },
574 { 0x070f, KEY_1 },
575 { 0x0715, KEY_2 },
576 { 0x0710, KEY_3 },
577 { 0x0718, KEY_4 },
578 { 0x071b, KEY_5 },
579 { 0x071e, KEY_6 },
580 { 0x0711, KEY_7 },
581 { 0x0721, KEY_8 },
582 { 0x0712, KEY_9 },
583 { 0x0727, KEY_0 },
584 { 0x0724, KEY_SCREEN }, /* 'Square' key */
585 { 0x072a, KEY_TEXT }, /* 'T' key */
586 { 0x072d, KEY_REWIND },
587 { 0x0730, KEY_PLAY },
588 { 0x0733, KEY_FASTFORWARD },
589 { 0x0736, KEY_RECORD },
590 { 0x073c, KEY_STOP },
591 { 0x073f, KEY_CANCEL }, /* '?' key */
592 /* Key codes for the Terratec Cinergy DT XS Diversity, similar to cinergyT2.c */
593 { 0xeb01, KEY_POWER },
594 { 0xeb02, KEY_1 },
595 { 0xeb03, KEY_2 },
596 { 0xeb04, KEY_3 },
597 { 0xeb05, KEY_4 },
598 { 0xeb06, KEY_5 },
599 { 0xeb07, KEY_6 },
600 { 0xeb08, KEY_7 },
601 { 0xeb09, KEY_8 },
602 { 0xeb0a, KEY_9 },
603 { 0xeb0b, KEY_VIDEO },
604 { 0xeb0c, KEY_0 },
605 { 0xeb0d, KEY_REFRESH },
606 { 0xeb0f, KEY_EPG },
607 { 0xeb10, KEY_UP },
608 { 0xeb11, KEY_LEFT },
609 { 0xeb12, KEY_OK },
610 { 0xeb13, KEY_RIGHT },
611 { 0xeb14, KEY_DOWN },
612 { 0xeb16, KEY_INFO },
613 { 0xeb17, KEY_RED },
614 { 0xeb18, KEY_GREEN },
615 { 0xeb19, KEY_YELLOW },
616 { 0xeb1a, KEY_BLUE },
617 { 0xeb1b, KEY_CHANNELUP },
618 { 0xeb1c, KEY_VOLUMEUP },
619 { 0xeb1d, KEY_MUTE },
620 { 0xeb1e, KEY_VOLUMEDOWN },
621 { 0xeb1f, KEY_CHANNELDOWN },
622 { 0xeb40, KEY_PAUSE },
623 { 0xeb41, KEY_HOME },
624 { 0xeb42, KEY_MENU }, /* DVD Menu */
625 { 0xeb43, KEY_SUBTITLE },
626 { 0xeb44, KEY_TEXT }, /* Teletext */
627 { 0xeb45, KEY_DELETE },
628 { 0xeb46, KEY_TV },
629 { 0xeb47, KEY_DVD },
630 { 0xeb48, KEY_STOP },
631 { 0xeb49, KEY_VIDEO },
632 { 0xeb4a, KEY_AUDIO }, /* Music */
633 { 0xeb4b, KEY_SCREEN }, /* Pic */
634 { 0xeb4c, KEY_PLAY },
635 { 0xeb4d, KEY_BACK },
636 { 0xeb4e, KEY_REWIND },
637 { 0xeb4f, KEY_FASTFORWARD },
638 { 0xeb54, KEY_PREVIOUS },
639 { 0xeb58, KEY_RECORD },
640 { 0xeb5c, KEY_NEXT },
642 /* Key codes for the Haupauge WinTV Nova-TD, copied from nova-t-usb2.c (Nova-T USB2) */
643 { 0x1e00, KEY_0 },
644 { 0x1e01, KEY_1 },
645 { 0x1e02, KEY_2 },
646 { 0x1e03, KEY_3 },
647 { 0x1e04, KEY_4 },
648 { 0x1e05, KEY_5 },
649 { 0x1e06, KEY_6 },
650 { 0x1e07, KEY_7 },
651 { 0x1e08, KEY_8 },
652 { 0x1e09, KEY_9 },
653 { 0x1e0a, KEY_KPASTERISK },
654 { 0x1e0b, KEY_RED },
655 { 0x1e0c, KEY_RADIO },
656 { 0x1e0d, KEY_MENU },
657 { 0x1e0e, KEY_GRAVE }, /* # */
658 { 0x1e0f, KEY_MUTE },
659 { 0x1e10, KEY_VOLUMEUP },
660 { 0x1e11, KEY_VOLUMEDOWN },
661 { 0x1e12, KEY_CHANNEL },
662 { 0x1e14, KEY_UP },
663 { 0x1e15, KEY_DOWN },
664 { 0x1e16, KEY_LEFT },
665 { 0x1e17, KEY_RIGHT },
666 { 0x1e18, KEY_VIDEO },
667 { 0x1e19, KEY_AUDIO },
668 { 0x1e1a, KEY_MEDIA },
669 { 0x1e1b, KEY_EPG },
670 { 0x1e1c, KEY_TV },
671 { 0x1e1e, KEY_NEXT },
672 { 0x1e1f, KEY_BACK },
673 { 0x1e20, KEY_CHANNELUP },
674 { 0x1e21, KEY_CHANNELDOWN },
675 { 0x1e24, KEY_LAST }, /* Skip backwards */
676 { 0x1e25, KEY_OK },
677 { 0x1e29, KEY_BLUE},
678 { 0x1e2e, KEY_GREEN },
679 { 0x1e30, KEY_PAUSE },
680 { 0x1e32, KEY_REWIND },
681 { 0x1e34, KEY_FASTFORWARD },
682 { 0x1e35, KEY_PLAY },
683 { 0x1e36, KEY_STOP },
684 { 0x1e37, KEY_RECORD },
685 { 0x1e38, KEY_YELLOW },
686 { 0x1e3b, KEY_GOTO },
687 { 0x1e3d, KEY_POWER },
689 /* Key codes for the Leadtek Winfast DTV Dongle */
690 { 0x0042, KEY_POWER },
691 { 0x077c, KEY_TUNER },
692 { 0x0f4e, KEY_PRINT }, /* PREVIEW */
693 { 0x0840, KEY_SCREEN }, /* full screen toggle*/
694 { 0x0f71, KEY_DOT }, /* frequency */
695 { 0x0743, KEY_0 },
696 { 0x0c41, KEY_1 },
697 { 0x0443, KEY_2 },
698 { 0x0b7f, KEY_3 },
699 { 0x0e41, KEY_4 },
700 { 0x0643, KEY_5 },
701 { 0x097f, KEY_6 },
702 { 0x0d7e, KEY_7 },
703 { 0x057c, KEY_8 },
704 { 0x0a40, KEY_9 },
705 { 0x0e4e, KEY_CLEAR },
706 { 0x047c, KEY_CHANNEL }, /* show channel number */
707 { 0x0f41, KEY_LAST }, /* recall */
708 { 0x0342, KEY_MUTE },
709 { 0x064c, KEY_RESERVED }, /* PIP button*/
710 { 0x0172, KEY_SHUFFLE }, /* SNAPSHOT */
711 { 0x0c4e, KEY_PLAYPAUSE }, /* TIMESHIFT */
712 { 0x0b70, KEY_RECORD },
713 { 0x037d, KEY_VOLUMEUP },
714 { 0x017d, KEY_VOLUMEDOWN },
715 { 0x0242, KEY_CHANNELUP },
716 { 0x007d, KEY_CHANNELDOWN },
718 /* Key codes for Nova-TD "credit card" remote control. */
719 { 0x1d00, KEY_0 },
720 { 0x1d01, KEY_1 },
721 { 0x1d02, KEY_2 },
722 { 0x1d03, KEY_3 },
723 { 0x1d04, KEY_4 },
724 { 0x1d05, KEY_5 },
725 { 0x1d06, KEY_6 },
726 { 0x1d07, KEY_7 },
727 { 0x1d08, KEY_8 },
728 { 0x1d09, KEY_9 },
729 { 0x1d0a, KEY_TEXT },
730 { 0x1d0d, KEY_MENU },
731 { 0x1d0f, KEY_MUTE },
732 { 0x1d10, KEY_VOLUMEUP },
733 { 0x1d11, KEY_VOLUMEDOWN },
734 { 0x1d12, KEY_CHANNEL },
735 { 0x1d14, KEY_UP },
736 { 0x1d15, KEY_DOWN },
737 { 0x1d16, KEY_LEFT },
738 { 0x1d17, KEY_RIGHT },
739 { 0x1d1c, KEY_TV },
740 { 0x1d1e, KEY_NEXT },
741 { 0x1d1f, KEY_BACK },
742 { 0x1d20, KEY_CHANNELUP },
743 { 0x1d21, KEY_CHANNELDOWN },
744 { 0x1d24, KEY_LAST },
745 { 0x1d25, KEY_OK },
746 { 0x1d30, KEY_PAUSE },
747 { 0x1d32, KEY_REWIND },
748 { 0x1d34, KEY_FASTFORWARD },
749 { 0x1d35, KEY_PLAY },
750 { 0x1d36, KEY_STOP },
751 { 0x1d37, KEY_RECORD },
752 { 0x1d3b, KEY_GOTO },
753 { 0x1d3d, KEY_POWER },
755 /* Key codes for the Pixelview SBTVD remote (proto NEC) */
756 { 0x8613, KEY_MUTE },
757 { 0x8612, KEY_POWER },
758 { 0x8601, KEY_1 },
759 { 0x8602, KEY_2 },
760 { 0x8603, KEY_3 },
761 { 0x8604, KEY_4 },
762 { 0x8605, KEY_5 },
763 { 0x8606, KEY_6 },
764 { 0x8607, KEY_7 },
765 { 0x8608, KEY_8 },
766 { 0x8609, KEY_9 },
767 { 0x8600, KEY_0 },
768 { 0x860d, KEY_CHANNELUP },
769 { 0x8619, KEY_CHANNELDOWN },
770 { 0x8610, KEY_VOLUMEUP },
771 { 0x860c, KEY_VOLUMEDOWN },
773 { 0x860a, KEY_CAMERA },
774 { 0x860b, KEY_ZOOM },
775 { 0x861b, KEY_BACKSPACE },
776 { 0x8615, KEY_ENTER },
778 { 0x861d, KEY_UP },
779 { 0x861e, KEY_DOWN },
780 { 0x860e, KEY_LEFT },
781 { 0x860f, KEY_RIGHT },
783 { 0x8618, KEY_RECORD },
784 { 0x861a, KEY_STOP },
786 /* Key codes for the EvolutePC TVWay+ remote (proto NEC) */
787 { 0x7a00, KEY_MENU },
788 { 0x7a01, KEY_RECORD },
789 { 0x7a02, KEY_PLAY },
790 { 0x7a03, KEY_STOP },
791 { 0x7a10, KEY_CHANNELUP },
792 { 0x7a11, KEY_CHANNELDOWN },
793 { 0x7a12, KEY_VOLUMEUP },
794 { 0x7a13, KEY_VOLUMEDOWN },
795 { 0x7a40, KEY_POWER },
796 { 0x7a41, KEY_MUTE },
798 /* Key codes for the Elgato EyeTV Diversity silver remote,
799 set dvb_usb_dib0700_ir_proto=0 */
800 { 0x4501, KEY_POWER },
801 { 0x4502, KEY_MUTE },
802 { 0x4503, KEY_1 },
803 { 0x4504, KEY_2 },
804 { 0x4505, KEY_3 },
805 { 0x4506, KEY_4 },
806 { 0x4507, KEY_5 },
807 { 0x4508, KEY_6 },
808 { 0x4509, KEY_7 },
809 { 0x450a, KEY_8 },
810 { 0x450b, KEY_9 },
811 { 0x450c, KEY_LAST },
812 { 0x450d, KEY_0 },
813 { 0x450e, KEY_ENTER },
814 { 0x450f, KEY_RED },
815 { 0x4510, KEY_CHANNELUP },
816 { 0x4511, KEY_GREEN },
817 { 0x4512, KEY_VOLUMEDOWN },
818 { 0x4513, KEY_OK },
819 { 0x4514, KEY_VOLUMEUP },
820 { 0x4515, KEY_YELLOW },
821 { 0x4516, KEY_CHANNELDOWN },
822 { 0x4517, KEY_BLUE },
823 { 0x4518, KEY_LEFT }, /* Skip backwards */
824 { 0x4519, KEY_PLAYPAUSE },
825 { 0x451a, KEY_RIGHT }, /* Skip forward */
826 { 0x451b, KEY_REWIND },
827 { 0x451c, KEY_L }, /* Live */
828 { 0x451d, KEY_FASTFORWARD },
829 { 0x451e, KEY_STOP }, /* 'Reveal' for Teletext */
830 { 0x451f, KEY_MENU }, /* KEY_TEXT for Teletext */
831 { 0x4540, KEY_RECORD }, /* Font 'Size' for Teletext */
832 { 0x4541, KEY_SCREEN }, /* Full screen toggle, 'Hold' for Teletext */
833 { 0x4542, KEY_SELECT }, /* Select video input, 'Select' for Teletext */
836 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
837 static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
838 BAND_UHF | BAND_VHF,
840 /* 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,
841 * 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 */
842 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
843 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
845 712,
849 118,
852 4095,
856 42598,
857 17694,
858 45875,
859 2621,
862 139,
865 107,
866 172,
876 { 0,
877 107,
878 51800,
879 24700
883 static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
884 BAND_UHF | BAND_VHF,
886 /* 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,
887 * 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 */
888 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
889 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
891 712,
895 118,
898 4095,
902 42598,
903 16384,
904 42598,
908 137,
909 255,
912 255,
929 static struct dibx000_bandwidth_config stk7700p_pll_config = {
930 60000, 30000,
931 1, 8, 3, 1, 0,
932 0, 0, 1, 1, 0,
933 (3 << 14) | (1 << 12) | (524 << 0),
934 60258167,
935 20452225,
936 30000000,
939 static struct dib7000m_config stk7700p_dib7000m_config = {
940 .dvbt_mode = 1,
941 .output_mpeg2_in_188_bytes = 1,
942 .quartz_direct = 1,
944 .agc_config_count = 1,
945 .agc = &stk7700p_7000m_mt2060_agc_config,
946 .bw = &stk7700p_pll_config,
948 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
949 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
950 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
953 static struct dib7000p_config stk7700p_dib7000p_config = {
954 .output_mpeg2_in_188_bytes = 1,
956 .agc_config_count = 1,
957 .agc = &stk7700p_7000p_mt2060_agc_config,
958 .bw = &stk7700p_pll_config,
960 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
961 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
962 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
965 static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
967 struct dib0700_state *st = adap->dev->priv;
968 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
970 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
971 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
973 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
974 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
976 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
977 dib0700_ctrl_clock(adap->dev, 72, 1);
978 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
980 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
982 st->mt2060_if1[0] = 1220;
984 if (dib7000pc_detection(&adap->dev->i2c_adap)) {
985 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
986 st->is_dib7000pc = 1;
987 } else
988 adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
990 return adap->fe == NULL ? -ENODEV : 0;
993 static struct mt2060_config stk7700p_mt2060_config = {
994 0x60
997 static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
999 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
1000 struct dib0700_state *st = adap->dev->priv;
1001 struct i2c_adapter *tun_i2c;
1002 s8 a;
1003 int if1=1220;
1004 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
1005 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
1006 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
1008 if (st->is_dib7000pc)
1009 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1010 else
1011 tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1013 return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config,
1014 if1) == NULL ? -ENODEV : 0;
1017 /* DIB7070 generic */
1018 static struct dibx000_agc_config dib7070_agc_config = {
1019 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
1020 /* 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,
1021 * 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 */
1022 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1023 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1025 600,
1029 118,
1032 3530,
1036 65535,
1039 65535,
1044 183,
1045 206,
1046 255,
1048 152,
1060 static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
1062 deb_info("reset: %d", onoff);
1063 return dib7000p_set_gpio(fe, 8, 0, !onoff);
1066 static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
1068 deb_info("sleep: %d", onoff);
1069 return dib7000p_set_gpio(fe, 9, 0, onoff);
1072 static struct dib0070_config dib7070p_dib0070_config[2] = {
1074 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1075 .reset = dib7070_tuner_reset,
1076 .sleep = dib7070_tuner_sleep,
1077 .clock_khz = 12000,
1078 .clock_pad_drive = 4,
1079 .charge_pump = 2,
1080 }, {
1081 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1082 .reset = dib7070_tuner_reset,
1083 .sleep = dib7070_tuner_sleep,
1084 .clock_khz = 12000,
1085 .charge_pump = 2,
1089 static struct dib0070_config dib7770p_dib0070_config = {
1090 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1091 .reset = dib7070_tuner_reset,
1092 .sleep = dib7070_tuner_sleep,
1093 .clock_khz = 12000,
1094 .clock_pad_drive = 0,
1095 .flip_chip = 1,
1096 .charge_pump = 2,
1099 static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
1101 struct dvb_usb_adapter *adap = fe->dvb->priv;
1102 struct dib0700_adapter_state *state = adap->priv;
1104 u16 offset;
1105 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1106 switch (band) {
1107 case BAND_VHF: offset = 950; break;
1108 case BAND_UHF:
1109 default: offset = 550; break;
1111 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
1112 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1113 return state->set_param_save(fe, fep);
1116 static int dib7770_set_param_override(struct dvb_frontend *fe,
1117 struct dvb_frontend_parameters *fep)
1119 struct dvb_usb_adapter *adap = fe->dvb->priv;
1120 struct dib0700_adapter_state *state = adap->priv;
1122 u16 offset;
1123 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1124 switch (band) {
1125 case BAND_VHF:
1126 dib7000p_set_gpio(fe, 0, 0, 1);
1127 offset = 850;
1128 break;
1129 case BAND_UHF:
1130 default:
1131 dib7000p_set_gpio(fe, 0, 0, 0);
1132 offset = 250;
1133 break;
1135 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
1136 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1137 return state->set_param_save(fe, fep);
1140 static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
1142 struct dib0700_adapter_state *st = adap->priv;
1143 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe,
1144 DIBX000_I2C_INTERFACE_TUNER, 1);
1146 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1147 &dib7770p_dib0070_config) == NULL)
1148 return -ENODEV;
1150 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1151 adap->fe->ops.tuner_ops.set_params = dib7770_set_param_override;
1152 return 0;
1155 static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
1157 struct dib0700_adapter_state *st = adap->priv;
1158 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1160 if (adap->id == 0) {
1161 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
1162 return -ENODEV;
1163 } else {
1164 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
1165 return -ENODEV;
1168 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1169 adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override;
1170 return 0;
1173 static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
1175 return dib7000p_pid_filter(adapter->fe, index, pid, onoff);
1178 static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
1180 return dib7000p_pid_filter_ctrl(adapter->fe, onoff);
1183 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
1184 60000, 15000,
1185 1, 20, 3, 1, 0,
1186 0, 0, 1, 1, 2,
1187 (3 << 14) | (1 << 12) | (524 << 0),
1188 (0 << 25) | 0,
1189 20452225,
1190 12000000,
1193 static struct dib7000p_config dib7070p_dib7000p_config = {
1194 .output_mpeg2_in_188_bytes = 1,
1196 .agc_config_count = 1,
1197 .agc = &dib7070_agc_config,
1198 .bw = &dib7070_bw_config_12_mhz,
1199 .tuner_is_baseband = 1,
1200 .spur_protect = 1,
1202 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1203 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1204 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1206 .hostbus_diversity = 1,
1209 /* STK7070P */
1210 static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
1212 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
1213 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
1214 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
1215 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1216 else
1217 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1218 msleep(10);
1219 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1220 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1221 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1222 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1224 dib0700_ctrl_clock(adap->dev, 72, 1);
1226 msleep(10);
1227 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1228 msleep(10);
1229 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1231 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1232 &dib7070p_dib7000p_config) != 0) {
1233 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1234 __func__);
1235 return -ENODEV;
1238 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
1239 &dib7070p_dib7000p_config);
1240 return adap->fe == NULL ? -ENODEV : 0;
1243 /* STK7770P */
1244 static struct dib7000p_config dib7770p_dib7000p_config = {
1245 .output_mpeg2_in_188_bytes = 1,
1247 .agc_config_count = 1,
1248 .agc = &dib7070_agc_config,
1249 .bw = &dib7070_bw_config_12_mhz,
1250 .tuner_is_baseband = 1,
1251 .spur_protect = 1,
1253 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1254 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1255 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1257 .hostbus_diversity = 1,
1258 .enable_current_mirror = 1,
1261 static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap)
1263 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
1264 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
1265 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
1266 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1267 else
1268 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1269 msleep(10);
1270 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1271 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1272 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1273 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1275 dib0700_ctrl_clock(adap->dev, 72, 1);
1277 msleep(10);
1278 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1279 msleep(10);
1280 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1282 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1283 &dib7770p_dib7000p_config) != 0) {
1284 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1285 __func__);
1286 return -ENODEV;
1289 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
1290 &dib7770p_dib7000p_config);
1291 return adap->fe == NULL ? -ENODEV : 0;
1294 /* DIB807x generic */
1295 static struct dibx000_agc_config dib807x_agc_config[2] = {
1297 BAND_VHF,
1298 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1299 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1300 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1301 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1302 * P_agc_write=0 */
1303 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1304 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1305 (0 << 0), /* setup*/
1307 600, /* inv_gain*/
1308 10, /* time_stabiliz*/
1310 0, /* alpha_level*/
1311 118, /* thlock*/
1313 0, /* wbd_inv*/
1314 3530, /* wbd_ref*/
1315 1, /* wbd_sel*/
1316 5, /* wbd_alpha*/
1318 65535, /* agc1_max*/
1319 0, /* agc1_min*/
1321 65535, /* agc2_max*/
1322 0, /* agc2_min*/
1324 0, /* agc1_pt1*/
1325 40, /* agc1_pt2*/
1326 183, /* agc1_pt3*/
1327 206, /* agc1_slope1*/
1328 255, /* agc1_slope2*/
1329 72, /* agc2_pt1*/
1330 152, /* agc2_pt2*/
1331 88, /* agc2_slope1*/
1332 90, /* agc2_slope2*/
1334 17, /* alpha_mant*/
1335 27, /* alpha_exp*/
1336 23, /* beta_mant*/
1337 51, /* beta_exp*/
1339 0, /* perform_agc_softsplit*/
1340 }, {
1341 BAND_UHF,
1342 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1343 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1344 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1345 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1346 * P_agc_write=0 */
1347 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1348 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1349 (0 << 0), /* setup */
1351 600, /* inv_gain*/
1352 10, /* time_stabiliz*/
1354 0, /* alpha_level*/
1355 118, /* thlock*/
1357 0, /* wbd_inv*/
1358 3530, /* wbd_ref*/
1359 1, /* wbd_sel*/
1360 5, /* wbd_alpha*/
1362 65535, /* agc1_max*/
1363 0, /* agc1_min*/
1365 65535, /* agc2_max*/
1366 0, /* agc2_min*/
1368 0, /* agc1_pt1*/
1369 40, /* agc1_pt2*/
1370 183, /* agc1_pt3*/
1371 206, /* agc1_slope1*/
1372 255, /* agc1_slope2*/
1373 72, /* agc2_pt1*/
1374 152, /* agc2_pt2*/
1375 88, /* agc2_slope1*/
1376 90, /* agc2_slope2*/
1378 17, /* alpha_mant*/
1379 27, /* alpha_exp*/
1380 23, /* beta_mant*/
1381 51, /* beta_exp*/
1383 0, /* perform_agc_softsplit*/
1387 static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
1388 60000, 15000, /* internal, sampling*/
1389 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/
1390 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
1391 ADClkSrc, modulo */
1392 (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1393 (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1394 18179755, /* timf*/
1395 12000000, /* xtal_hz*/
1398 static struct dib8000_config dib807x_dib8000_config[2] = {
1400 .output_mpeg2_in_188_bytes = 1,
1402 .agc_config_count = 2,
1403 .agc = dib807x_agc_config,
1404 .pll = &dib807x_bw_config_12_mhz,
1405 .tuner_is_baseband = 1,
1407 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1408 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1409 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1411 .hostbus_diversity = 1,
1412 .div_cfg = 1,
1413 .agc_control = &dib0070_ctrl_agc_filter,
1414 .output_mode = OUTMODE_MPEG2_FIFO,
1415 .drives = 0x2d98,
1416 }, {
1417 .output_mpeg2_in_188_bytes = 1,
1419 .agc_config_count = 2,
1420 .agc = dib807x_agc_config,
1421 .pll = &dib807x_bw_config_12_mhz,
1422 .tuner_is_baseband = 1,
1424 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1425 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1426 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1428 .hostbus_diversity = 1,
1429 .agc_control = &dib0070_ctrl_agc_filter,
1430 .output_mode = OUTMODE_MPEG2_FIFO,
1431 .drives = 0x2d98,
1435 static int dib80xx_tuner_reset(struct dvb_frontend *fe, int onoff)
1437 return dib8000_set_gpio(fe, 5, 0, !onoff);
1440 static int dib80xx_tuner_sleep(struct dvb_frontend *fe, int onoff)
1442 return dib8000_set_gpio(fe, 0, 0, onoff);
1445 static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
1446 { 240, 7},
1447 { 0xffff, 6},
1450 static struct dib0070_config dib807x_dib0070_config[2] = {
1452 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1453 .reset = dib80xx_tuner_reset,
1454 .sleep = dib80xx_tuner_sleep,
1455 .clock_khz = 12000,
1456 .clock_pad_drive = 4,
1457 .vga_filter = 1,
1458 .force_crystal_mode = 1,
1459 .enable_third_order_filter = 1,
1460 .charge_pump = 0,
1461 .wbd_gain = dib8070_wbd_gain_cfg,
1462 .osc_buffer_state = 0,
1463 .freq_offset_khz_uhf = -100,
1464 .freq_offset_khz_vhf = -100,
1465 }, {
1466 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1467 .reset = dib80xx_tuner_reset,
1468 .sleep = dib80xx_tuner_sleep,
1469 .clock_khz = 12000,
1470 .clock_pad_drive = 2,
1471 .vga_filter = 1,
1472 .force_crystal_mode = 1,
1473 .enable_third_order_filter = 1,
1474 .charge_pump = 0,
1475 .wbd_gain = dib8070_wbd_gain_cfg,
1476 .osc_buffer_state = 0,
1477 .freq_offset_khz_uhf = -25,
1478 .freq_offset_khz_vhf = -25,
1482 static int dib807x_set_param_override(struct dvb_frontend *fe,
1483 struct dvb_frontend_parameters *fep)
1485 struct dvb_usb_adapter *adap = fe->dvb->priv;
1486 struct dib0700_adapter_state *state = adap->priv;
1488 u16 offset = dib0070_wbd_offset(fe);
1489 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1490 switch (band) {
1491 case BAND_VHF:
1492 offset += 750;
1493 break;
1494 case BAND_UHF: /* fall-thru wanted */
1495 default:
1496 offset += 250; break;
1498 deb_info("WBD for DiB8000: %d\n", offset);
1499 dib8000_set_wbd_ref(fe, offset);
1501 return state->set_param_save(fe, fep);
1504 static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1506 struct dib0700_adapter_state *st = adap->priv;
1507 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe,
1508 DIBX000_I2C_INTERFACE_TUNER, 1);
1510 if (adap->id == 0) {
1511 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1512 &dib807x_dib0070_config[0]) == NULL)
1513 return -ENODEV;
1514 } else {
1515 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1516 &dib807x_dib0070_config[1]) == NULL)
1517 return -ENODEV;
1520 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1521 adap->fe->ops.tuner_ops.set_params = dib807x_set_param_override;
1522 return 0;
1525 static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index,
1526 u16 pid, int onoff)
1528 return dib8000_pid_filter(adapter->fe, index, pid, onoff);
1531 static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter,
1532 int onoff)
1534 return dib8000_pid_filter_ctrl(adapter->fe, onoff);
1537 /* STK807x */
1538 static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
1540 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1541 msleep(10);
1542 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1543 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1544 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1546 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1548 dib0700_ctrl_clock(adap->dev, 72, 1);
1550 msleep(10);
1551 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1552 msleep(10);
1553 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1555 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1556 0x80);
1558 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1559 &dib807x_dib8000_config[0]);
1561 return adap->fe == NULL ? -ENODEV : 0;
1564 /* STK807xPVR */
1565 static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
1567 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1568 msleep(30);
1569 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1570 msleep(500);
1571 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1572 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1573 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1575 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1577 dib0700_ctrl_clock(adap->dev, 72, 1);
1579 msleep(10);
1580 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1581 msleep(10);
1582 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1584 /* initialize IC 0 */
1585 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80);
1587 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1588 &dib807x_dib8000_config[0]);
1590 return adap->fe == NULL ? -ENODEV : 0;
1593 static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
1595 /* initialize IC 1 */
1596 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82);
1598 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82,
1599 &dib807x_dib8000_config[1]);
1601 return adap->fe == NULL ? -ENODEV : 0;
1604 /* STK8096GP */
1605 struct dibx000_agc_config dib8090_agc_config[2] = {
1607 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
1608 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1609 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1610 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1611 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1612 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1614 787,
1618 118,
1621 3530,
1625 65535,
1628 65535,
1633 114,
1634 143,
1635 144,
1636 114,
1637 227,
1638 116,
1639 117,
1649 BAND_CBAND,
1650 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1651 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1652 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1653 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1654 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1656 787,
1660 118,
1663 3530,
1670 65535,
1675 114,
1676 143,
1677 144,
1678 114,
1679 227,
1680 116,
1681 117,
1692 static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = {
1693 54000, 13500,
1694 1, 18, 3, 1, 0,
1695 0, 0, 1, 1, 2,
1696 (3 << 14) | (1 << 12) | (599 << 0),
1697 (0 << 25) | 0,
1698 20199727,
1699 12000000,
1702 static int dib8090_get_adc_power(struct dvb_frontend *fe)
1704 return dib8000_get_adc_power(fe, 1);
1707 static struct dib8000_config dib809x_dib8000_config = {
1708 .output_mpeg2_in_188_bytes = 1,
1710 .agc_config_count = 2,
1711 .agc = dib8090_agc_config,
1712 .agc_control = dib0090_dcc_freq,
1713 .pll = &dib8090_pll_config_12mhz,
1714 .tuner_is_baseband = 1,
1716 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1717 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1718 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1720 .hostbus_diversity = 1,
1721 .div_cfg = 0x31,
1722 .output_mode = OUTMODE_MPEG2_FIFO,
1723 .drives = 0x2d98,
1724 .diversity_delay = 144,
1725 .refclksel = 3,
1728 static struct dib0090_config dib809x_dib0090_config = {
1729 .io.pll_bypass = 1,
1730 .io.pll_range = 1,
1731 .io.pll_prediv = 1,
1732 .io.pll_loopdiv = 20,
1733 .io.adc_clock_ratio = 8,
1734 .io.pll_int_loop_filt = 0,
1735 .io.clock_khz = 12000,
1736 .reset = dib80xx_tuner_reset,
1737 .sleep = dib80xx_tuner_sleep,
1738 .clkouttobamse = 1,
1739 .analog_output = 1,
1740 .i2c_address = DEFAULT_DIB0090_I2C_ADDRESS,
1741 .wbd_vhf_offset = 100,
1742 .wbd_cband_offset = 450,
1743 .use_pwm_agc = 1,
1744 .clkoutdrive = 1,
1745 .get_adc_power = dib8090_get_adc_power,
1746 .freq_offset_khz_uhf = 0,
1747 .freq_offset_khz_vhf = -143,
1750 static int dib8096_set_param_override(struct dvb_frontend *fe,
1751 struct dvb_frontend_parameters *fep)
1753 struct dvb_usb_adapter *adap = fe->dvb->priv;
1754 struct dib0700_adapter_state *state = adap->priv;
1755 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1756 u16 offset;
1757 int ret = 0;
1758 enum frontend_tune_state tune_state = CT_SHUTDOWN;
1759 u16 ltgain, rf_gain_limit;
1761 ret = state->set_param_save(fe, fep);
1762 if (ret < 0)
1763 return ret;
1765 switch (band) {
1766 case BAND_VHF:
1767 offset = 100;
1768 break;
1769 case BAND_UHF:
1770 offset = 550;
1771 break;
1772 default:
1773 offset = 0;
1774 break;
1776 offset += (dib0090_get_wbd_offset(fe) * 8 * 18 / 33 + 1) / 2;
1777 dib8000_set_wbd_ref(fe, offset);
1780 if (band == BAND_CBAND) {
1781 deb_info("tuning in CBAND - soft-AGC startup\n");
1782 /* TODO specific wbd target for dib0090 - needed for startup ? */
1783 dib0090_set_tune_state(fe, CT_AGC_START);
1784 do {
1785 ret = dib0090_gain_control(fe);
1786 msleep(ret);
1787 tune_state = dib0090_get_tune_state(fe);
1788 if (tune_state == CT_AGC_STEP_0)
1789 dib8000_set_gpio(fe, 6, 0, 1);
1790 else if (tune_state == CT_AGC_STEP_1) {
1791 dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, &ltgain);
1792 if (rf_gain_limit == 0)
1793 dib8000_set_gpio(fe, 6, 0, 0);
1795 } while (tune_state < CT_AGC_STOP);
1796 dib0090_pwm_gain_reset(fe);
1797 dib8000_pwm_agc_reset(fe);
1798 dib8000_set_tune_state(fe, CT_DEMOD_START);
1799 } else {
1800 deb_info("not tuning in CBAND - standard AGC startup\n");
1801 dib0090_pwm_gain_reset(fe);
1804 return 0;
1807 static int dib809x_tuner_attach(struct dvb_usb_adapter *adap)
1809 struct dib0700_adapter_state *st = adap->priv;
1810 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1812 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1813 return -ENODEV;
1815 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1816 adap->fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1817 return 0;
1820 static int stk809x_frontend_attach(struct dvb_usb_adapter *adap)
1822 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1823 msleep(10);
1824 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1825 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1826 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1828 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1830 dib0700_ctrl_clock(adap->dev, 72, 1);
1832 msleep(10);
1833 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1834 msleep(10);
1835 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1837 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80);
1839 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config);
1841 return adap->fe == NULL ? -ENODEV : 0;
1844 /* STK7070PD */
1845 static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
1847 .output_mpeg2_in_188_bytes = 1,
1849 .agc_config_count = 1,
1850 .agc = &dib7070_agc_config,
1851 .bw = &dib7070_bw_config_12_mhz,
1852 .tuner_is_baseband = 1,
1853 .spur_protect = 1,
1855 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1856 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1857 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1859 .hostbus_diversity = 1,
1860 }, {
1861 .output_mpeg2_in_188_bytes = 1,
1863 .agc_config_count = 1,
1864 .agc = &dib7070_agc_config,
1865 .bw = &dib7070_bw_config_12_mhz,
1866 .tuner_is_baseband = 1,
1867 .spur_protect = 1,
1869 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1870 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1871 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1873 .hostbus_diversity = 1,
1877 static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
1879 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1880 msleep(10);
1881 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1882 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1883 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1884 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1886 dib0700_ctrl_clock(adap->dev, 72, 1);
1888 msleep(10);
1889 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1890 msleep(10);
1891 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1893 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
1894 stk7070pd_dib7000p_config) != 0) {
1895 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1896 __func__);
1897 return -ENODEV;
1900 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
1901 return adap->fe == NULL ? -ENODEV : 0;
1904 static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
1906 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
1907 return adap->fe == NULL ? -ENODEV : 0;
1910 /* S5H1411 */
1911 static struct s5h1411_config pinnacle_801e_config = {
1912 .output_mode = S5H1411_PARALLEL_OUTPUT,
1913 .gpio = S5H1411_GPIO_OFF,
1914 .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
1915 .qam_if = S5H1411_IF_44000,
1916 .vsb_if = S5H1411_IF_44000,
1917 .inversion = S5H1411_INVERSION_OFF,
1918 .status_mode = S5H1411_DEMODLOCKING
1921 /* Pinnacle PCTV HD Pro 801e GPIOs map:
1922 GPIO0 - currently unknown
1923 GPIO1 - xc5000 tuner reset
1924 GPIO2 - CX25843 sleep
1925 GPIO3 - currently unknown
1926 GPIO4 - currently unknown
1927 GPIO6 - currently unknown
1928 GPIO7 - currently unknown
1929 GPIO9 - currently unknown
1930 GPIO10 - CX25843 reset
1932 static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
1934 struct dib0700_state *st = adap->dev->priv;
1936 /* Make use of the new i2c functions from FW 1.20 */
1937 st->fw_use_new_i2c_api = 1;
1939 /* The s5h1411 requires the dib0700 to not be in master mode */
1940 st->disable_streaming_master_mode = 1;
1942 /* All msleep values taken from Windows USB trace */
1943 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
1944 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
1945 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1946 msleep(400);
1947 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1948 msleep(60);
1949 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1950 msleep(30);
1951 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1952 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1953 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1954 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1955 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
1956 msleep(30);
1958 /* Put the CX25843 to sleep for now since we're in digital mode */
1959 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
1961 /* GPIOs are initialized, do the attach */
1962 adap->fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
1963 &adap->dev->i2c_adap);
1964 return adap->fe == NULL ? -ENODEV : 0;
1967 static int dib0700_xc5000_tuner_callback(void *priv, int component,
1968 int command, int arg)
1970 struct dvb_usb_adapter *adap = priv;
1972 if (command == XC5000_TUNER_RESET) {
1973 /* Reset the tuner */
1974 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
1975 msleep(10);
1976 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
1977 msleep(10);
1978 } else {
1979 err("xc5000: unknown tuner callback command: %d\n", command);
1980 return -EINVAL;
1983 return 0;
1986 static struct xc5000_config s5h1411_xc5000_tunerconfig = {
1987 .i2c_address = 0x64,
1988 .if_khz = 5380,
1991 static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
1993 /* FIXME: generalize & move to common area */
1994 adap->fe->callback = dib0700_xc5000_tuner_callback;
1996 return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap,
1997 &s5h1411_xc5000_tunerconfig)
1998 == NULL ? -ENODEV : 0;
2001 static struct lgdt3305_config hcw_lgdt3305_config = {
2002 .i2c_addr = 0x0e,
2003 .mpeg_mode = LGDT3305_MPEG_PARALLEL,
2004 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
2005 .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
2006 .deny_i2c_rptr = 0,
2007 .spectral_inversion = 1,
2008 .qam_if_khz = 6000,
2009 .vsb_if_khz = 6000,
2010 .usref_8vsb = 0x0500,
2013 static struct mxl5007t_config hcw_mxl5007t_config = {
2014 .xtal_freq_hz = MxL_XTAL_25_MHZ,
2015 .if_freq_hz = MxL_IF_6_MHZ,
2016 .invert_if = 1,
2019 /* TIGER-ATSC map:
2020 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
2021 GPIO1 - ANT_SEL (H: VPA, L: MCX)
2022 GPIO4 - SCL2
2023 GPIO6 - EN_TUNER
2024 GPIO7 - SDA2
2025 GPIO10 - DEM_RST
2027 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
2029 static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
2031 struct dib0700_state *st = adap->dev->priv;
2033 /* Make use of the new i2c functions from FW 1.20 */
2034 st->fw_use_new_i2c_api = 1;
2036 st->disable_streaming_master_mode = 1;
2038 /* fe power enable */
2039 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
2040 msleep(30);
2041 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2042 msleep(30);
2044 /* demod reset */
2045 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2046 msleep(30);
2047 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2048 msleep(30);
2049 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2050 msleep(30);
2052 adap->fe = dvb_attach(lgdt3305_attach,
2053 &hcw_lgdt3305_config,
2054 &adap->dev->i2c_adap);
2056 return adap->fe == NULL ? -ENODEV : 0;
2059 static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
2061 return dvb_attach(mxl5007t_attach, adap->fe,
2062 &adap->dev->i2c_adap, 0x60,
2063 &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
2067 /* DVB-USB and USB stuff follows */
2068 struct usb_device_id dib0700_usb_id_table[] = {
2069 /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
2070 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
2071 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
2072 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
2073 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
2074 /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
2075 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
2076 { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
2077 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
2078 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
2079 /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
2080 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
2081 { USB_DEVICE(USB_VID_TERRATEC,
2082 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
2083 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
2084 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
2085 /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
2086 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
2087 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
2088 { USB_DEVICE(USB_VID_PINNACLE,
2089 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
2090 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
2091 /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
2092 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
2093 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
2094 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
2095 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
2096 /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
2097 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
2098 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
2099 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
2100 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
2101 /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
2102 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
2103 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
2104 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
2105 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
2106 /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
2107 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
2108 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
2109 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
2110 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
2111 /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
2112 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
2113 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
2114 { USB_DEVICE(USB_VID_TERRATEC,
2115 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
2116 { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
2117 /* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
2118 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
2119 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
2120 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
2121 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
2122 /* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
2123 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
2124 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
2125 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
2126 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
2127 /* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
2128 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
2129 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV73ESE) },
2130 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV282E) },
2131 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
2132 /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
2133 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
2134 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
2135 { USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x000, 0x3f00) },
2136 { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },
2137 /* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
2138 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
2139 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) },
2140 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) },
2141 { 0 } /* Terminating entry */
2143 MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
2145 #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
2146 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
2147 .usb_ctrl = DEVICE_SPECIFIC, \
2148 .firmware = "dvb-usb-dib0700-1.20.fw", \
2149 .download_firmware = dib0700_download_firmware, \
2150 .no_reconnect = 1, \
2151 .size_of_priv = sizeof(struct dib0700_state), \
2152 .i2c_algo = &dib0700_i2c_algo, \
2153 .identify_state = dib0700_identify_state
2155 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
2156 .streaming_ctrl = dib0700_streaming_ctrl, \
2157 .stream = { \
2158 .type = USB_BULK, \
2159 .count = 4, \
2160 .endpoint = ep, \
2161 .u = { \
2162 .bulk = { \
2163 .buffersize = 39480, \
2168 struct dvb_usb_device_properties dib0700_devices[] = {
2170 DIB0700_DEFAULT_DEVICE_PROPERTIES,
2172 .num_adapters = 1,
2173 .adapter = {
2175 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2176 .pid_filter_count = 32,
2177 .pid_filter = stk70x0p_pid_filter,
2178 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2179 .frontend_attach = stk7700p_frontend_attach,
2180 .tuner_attach = stk7700p_tuner_attach,
2182 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2186 .num_device_descs = 8,
2187 .devices = {
2188 { "DiBcom STK7700P reference design",
2189 { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
2190 { NULL },
2192 { "Hauppauge Nova-T Stick",
2193 { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
2194 { NULL },
2196 { "AVerMedia AVerTV DVB-T Volar",
2197 { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
2198 { NULL },
2200 { "Compro Videomate U500",
2201 { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
2202 { NULL },
2204 { "Uniwill STK7700P based (Hama and others)",
2205 { &dib0700_usb_id_table[7], NULL },
2206 { NULL },
2208 { "Leadtek Winfast DTV Dongle (STK7700P based)",
2209 { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
2210 { NULL },
2212 { "AVerMedia AVerTV DVB-T Express",
2213 { &dib0700_usb_id_table[20] },
2214 { NULL },
2216 { "Gigabyte U7000",
2217 { &dib0700_usb_id_table[21], NULL },
2218 { NULL },
2222 .rc_interval = DEFAULT_RC_INTERVAL,
2223 .rc_key_map = ir_codes_dib0700_table,
2224 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2225 .rc_query = dib0700_rc_query
2226 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2228 .num_adapters = 2,
2229 .adapter = {
2231 .frontend_attach = bristol_frontend_attach,
2232 .tuner_attach = bristol_tuner_attach,
2234 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2235 }, {
2236 .frontend_attach = bristol_frontend_attach,
2237 .tuner_attach = bristol_tuner_attach,
2239 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2243 .num_device_descs = 1,
2244 .devices = {
2245 { "Hauppauge Nova-T 500 Dual DVB-T",
2246 { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
2247 { NULL },
2251 .rc_interval = DEFAULT_RC_INTERVAL,
2252 .rc_key_map = ir_codes_dib0700_table,
2253 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2254 .rc_query = dib0700_rc_query
2255 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2257 .num_adapters = 2,
2258 .adapter = {
2260 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2261 .pid_filter_count = 32,
2262 .pid_filter = stk70x0p_pid_filter,
2263 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2264 .frontend_attach = stk7700d_frontend_attach,
2265 .tuner_attach = stk7700d_tuner_attach,
2267 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2268 }, {
2269 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2270 .pid_filter_count = 32,
2271 .pid_filter = stk70x0p_pid_filter,
2272 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2273 .frontend_attach = stk7700d_frontend_attach,
2274 .tuner_attach = stk7700d_tuner_attach,
2276 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2280 .num_device_descs = 5,
2281 .devices = {
2282 { "Pinnacle PCTV 2000e",
2283 { &dib0700_usb_id_table[11], NULL },
2284 { NULL },
2286 { "Terratec Cinergy DT XS Diversity",
2287 { &dib0700_usb_id_table[12], NULL },
2288 { NULL },
2290 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
2291 { &dib0700_usb_id_table[13], NULL },
2292 { NULL },
2294 { "DiBcom STK7700D reference design",
2295 { &dib0700_usb_id_table[14], NULL },
2296 { NULL },
2298 { "YUAN High-Tech DiBcom STK7700D",
2299 { &dib0700_usb_id_table[55], NULL },
2300 { NULL },
2305 .rc_interval = DEFAULT_RC_INTERVAL,
2306 .rc_key_map = ir_codes_dib0700_table,
2307 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2308 .rc_query = dib0700_rc_query
2310 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2312 .num_adapters = 1,
2313 .adapter = {
2315 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2316 .pid_filter_count = 32,
2317 .pid_filter = stk70x0p_pid_filter,
2318 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2319 .frontend_attach = stk7700P2_frontend_attach,
2320 .tuner_attach = stk7700d_tuner_attach,
2322 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2326 .num_device_descs = 3,
2327 .devices = {
2328 { "ASUS My Cinema U3000 Mini DVBT Tuner",
2329 { &dib0700_usb_id_table[23], NULL },
2330 { NULL },
2332 { "Yuan EC372S",
2333 { &dib0700_usb_id_table[31], NULL },
2334 { NULL },
2336 { "Terratec Cinergy T Express",
2337 { &dib0700_usb_id_table[42], NULL },
2338 { NULL },
2342 .rc_interval = DEFAULT_RC_INTERVAL,
2343 .rc_key_map = ir_codes_dib0700_table,
2344 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2345 .rc_query = dib0700_rc_query
2346 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2348 .num_adapters = 1,
2349 .adapter = {
2351 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2352 .pid_filter_count = 32,
2353 .pid_filter = stk70x0p_pid_filter,
2354 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2355 .frontend_attach = stk7070p_frontend_attach,
2356 .tuner_attach = dib7070p_tuner_attach,
2358 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2360 .size_of_priv = sizeof(struct dib0700_adapter_state),
2364 .num_device_descs = 11,
2365 .devices = {
2366 { "DiBcom STK7070P reference design",
2367 { &dib0700_usb_id_table[15], NULL },
2368 { NULL },
2370 { "Pinnacle PCTV DVB-T Flash Stick",
2371 { &dib0700_usb_id_table[16], NULL },
2372 { NULL },
2374 { "Artec T14BR DVB-T",
2375 { &dib0700_usb_id_table[22], NULL },
2376 { NULL },
2378 { "ASUS My Cinema U3100 Mini DVBT Tuner",
2379 { &dib0700_usb_id_table[24], NULL },
2380 { NULL },
2382 { "Hauppauge Nova-T Stick",
2383 { &dib0700_usb_id_table[25], NULL },
2384 { NULL },
2386 { "Hauppauge Nova-T MyTV.t",
2387 { &dib0700_usb_id_table[26], NULL },
2388 { NULL },
2390 { "Pinnacle PCTV 72e",
2391 { &dib0700_usb_id_table[29], NULL },
2392 { NULL },
2394 { "Pinnacle PCTV 73e",
2395 { &dib0700_usb_id_table[30], NULL },
2396 { NULL },
2398 { "Elgato EyeTV DTT",
2399 { &dib0700_usb_id_table[49], NULL },
2400 { NULL },
2402 { "Yuan PD378S",
2403 { &dib0700_usb_id_table[45], NULL },
2404 { NULL },
2406 { "Elgato EyeTV Dtt Dlx PD378S",
2407 { &dib0700_usb_id_table[50], NULL },
2408 { NULL },
2412 .rc_interval = DEFAULT_RC_INTERVAL,
2413 .rc_key_map = ir_codes_dib0700_table,
2414 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2415 .rc_query = dib0700_rc_query
2417 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2419 .num_adapters = 1,
2420 .adapter = {
2422 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2423 .pid_filter_count = 32,
2424 .pid_filter = stk70x0p_pid_filter,
2425 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2426 .frontend_attach = stk7070p_frontend_attach,
2427 .tuner_attach = dib7070p_tuner_attach,
2429 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2431 .size_of_priv = sizeof(struct dib0700_adapter_state),
2435 .num_device_descs = 3,
2436 .devices = {
2437 { "Pinnacle PCTV 73A",
2438 { &dib0700_usb_id_table[56], NULL },
2439 { NULL },
2441 { "Pinnacle PCTV 73e SE",
2442 { &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL },
2443 { NULL },
2445 { "Pinnacle PCTV 282e",
2446 { &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL },
2447 { NULL },
2451 .rc_interval = DEFAULT_RC_INTERVAL,
2452 .rc_key_map = ir_codes_dib0700_table,
2453 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2454 .rc_query = dib0700_rc_query
2456 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2458 .num_adapters = 2,
2459 .adapter = {
2461 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2462 .pid_filter_count = 32,
2463 .pid_filter = stk70x0p_pid_filter,
2464 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2465 .frontend_attach = stk7070pd_frontend_attach0,
2466 .tuner_attach = dib7070p_tuner_attach,
2468 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2470 .size_of_priv = sizeof(struct dib0700_adapter_state),
2471 }, {
2472 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2473 .pid_filter_count = 32,
2474 .pid_filter = stk70x0p_pid_filter,
2475 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2476 .frontend_attach = stk7070pd_frontend_attach1,
2477 .tuner_attach = dib7070p_tuner_attach,
2479 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2481 .size_of_priv = sizeof(struct dib0700_adapter_state),
2485 .num_device_descs = 7,
2486 .devices = {
2487 { "DiBcom STK7070PD reference design",
2488 { &dib0700_usb_id_table[17], NULL },
2489 { NULL },
2491 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
2492 { &dib0700_usb_id_table[18], NULL },
2493 { NULL },
2495 { "Hauppauge Nova-TD Stick (52009)",
2496 { &dib0700_usb_id_table[35], NULL },
2497 { NULL },
2499 { "Hauppauge Nova-TD-500 (84xxx)",
2500 { &dib0700_usb_id_table[36], NULL },
2501 { NULL },
2503 { "Terratec Cinergy DT USB XS Diversity/ T5",
2504 { &dib0700_usb_id_table[43],
2505 &dib0700_usb_id_table[53], NULL},
2506 { NULL },
2508 { "Sony PlayTV",
2509 { &dib0700_usb_id_table[44], NULL },
2510 { NULL },
2512 { "Elgato EyeTV Diversity",
2513 { &dib0700_usb_id_table[68], NULL },
2514 { NULL },
2517 .rc_interval = DEFAULT_RC_INTERVAL,
2518 .rc_key_map = ir_codes_dib0700_table,
2519 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2520 .rc_query = dib0700_rc_query
2521 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2523 .num_adapters = 1,
2524 .adapter = {
2526 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2527 .pid_filter_count = 32,
2528 .pid_filter = stk70x0p_pid_filter,
2529 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2530 .frontend_attach = stk7700ph_frontend_attach,
2531 .tuner_attach = stk7700ph_tuner_attach,
2533 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2535 .size_of_priv = sizeof(struct
2536 dib0700_adapter_state),
2540 .num_device_descs = 9,
2541 .devices = {
2542 { "Terratec Cinergy HT USB XE",
2543 { &dib0700_usb_id_table[27], NULL },
2544 { NULL },
2546 { "Pinnacle Expresscard 320cx",
2547 { &dib0700_usb_id_table[28], NULL },
2548 { NULL },
2550 { "Terratec Cinergy HT Express",
2551 { &dib0700_usb_id_table[32], NULL },
2552 { NULL },
2554 { "Gigabyte U8000-RH",
2555 { &dib0700_usb_id_table[37], NULL },
2556 { NULL },
2558 { "YUAN High-Tech STK7700PH",
2559 { &dib0700_usb_id_table[38], NULL },
2560 { NULL },
2562 { "Asus My Cinema-U3000Hybrid",
2563 { &dib0700_usb_id_table[39], NULL },
2564 { NULL },
2566 { "YUAN High-Tech MC770",
2567 { &dib0700_usb_id_table[48], NULL },
2568 { NULL },
2570 { "Leadtek WinFast DTV Dongle H",
2571 { &dib0700_usb_id_table[51], NULL },
2572 { NULL },
2574 { "YUAN High-Tech STK7700D",
2575 { &dib0700_usb_id_table[54], NULL },
2576 { NULL },
2579 .rc_interval = DEFAULT_RC_INTERVAL,
2580 .rc_key_map = ir_codes_dib0700_table,
2581 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2582 .rc_query = dib0700_rc_query
2583 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2584 .num_adapters = 1,
2585 .adapter = {
2587 .frontend_attach = s5h1411_frontend_attach,
2588 .tuner_attach = xc5000_tuner_attach,
2590 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2592 .size_of_priv = sizeof(struct
2593 dib0700_adapter_state),
2597 .num_device_descs = 2,
2598 .devices = {
2599 { "Pinnacle PCTV HD Pro USB Stick",
2600 { &dib0700_usb_id_table[40], NULL },
2601 { NULL },
2603 { "Pinnacle PCTV HD USB Stick",
2604 { &dib0700_usb_id_table[41], NULL },
2605 { NULL },
2608 .rc_interval = DEFAULT_RC_INTERVAL,
2609 .rc_key_map = ir_codes_dib0700_table,
2610 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2611 .rc_query = dib0700_rc_query
2612 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2613 .num_adapters = 1,
2614 .adapter = {
2616 .frontend_attach = lgdt3305_frontend_attach,
2617 .tuner_attach = mxl5007t_tuner_attach,
2619 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2621 .size_of_priv = sizeof(struct
2622 dib0700_adapter_state),
2626 .num_device_descs = 2,
2627 .devices = {
2628 { "Hauppauge ATSC MiniCard (B200)",
2629 { &dib0700_usb_id_table[46], NULL },
2630 { NULL },
2632 { "Hauppauge ATSC MiniCard (B210)",
2633 { &dib0700_usb_id_table[47], NULL },
2634 { NULL },
2637 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2639 .num_adapters = 1,
2640 .adapter = {
2642 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2643 .pid_filter_count = 32,
2644 .pid_filter = stk70x0p_pid_filter,
2645 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2646 .frontend_attach = stk7770p_frontend_attach,
2647 .tuner_attach = dib7770p_tuner_attach,
2649 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2651 .size_of_priv =
2652 sizeof(struct dib0700_adapter_state),
2656 .num_device_descs = 2,
2657 .devices = {
2658 { "DiBcom STK7770P reference design",
2659 { &dib0700_usb_id_table[59], NULL },
2660 { NULL },
2662 { "Terratec Cinergy T USB XXS (HD)/ T3",
2663 { &dib0700_usb_id_table[33],
2664 &dib0700_usb_id_table[52],
2665 &dib0700_usb_id_table[60], NULL},
2666 { NULL },
2669 .rc_interval = DEFAULT_RC_INTERVAL,
2670 .rc_key_map = ir_codes_dib0700_table,
2671 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2672 .rc_query = dib0700_rc_query
2673 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2674 .num_adapters = 1,
2675 .adapter = {
2677 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2678 .pid_filter_count = 32,
2679 .pid_filter = stk80xx_pid_filter,
2680 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
2681 .frontend_attach = stk807x_frontend_attach,
2682 .tuner_attach = dib807x_tuner_attach,
2684 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2686 .size_of_priv =
2687 sizeof(struct dib0700_adapter_state),
2691 .num_device_descs = 3,
2692 .devices = {
2693 { "DiBcom STK807xP reference design",
2694 { &dib0700_usb_id_table[62], NULL },
2695 { NULL },
2697 { "Prolink Pixelview SBTVD",
2698 { &dib0700_usb_id_table[63], NULL },
2699 { NULL },
2701 { "EvolutePC TVWay+",
2702 { &dib0700_usb_id_table[64], NULL },
2703 { NULL },
2707 .rc_interval = DEFAULT_RC_INTERVAL,
2708 .rc_key_map = ir_codes_dib0700_table,
2709 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2710 .rc_query = dib0700_rc_query
2712 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2713 .num_adapters = 2,
2714 .adapter = {
2716 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2717 .pid_filter_count = 32,
2718 .pid_filter = stk80xx_pid_filter,
2719 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
2720 .frontend_attach = stk807xpvr_frontend_attach0,
2721 .tuner_attach = dib807x_tuner_attach,
2723 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2725 .size_of_priv =
2726 sizeof(struct dib0700_adapter_state),
2729 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2730 .pid_filter_count = 32,
2731 .pid_filter = stk80xx_pid_filter,
2732 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
2733 .frontend_attach = stk807xpvr_frontend_attach1,
2734 .tuner_attach = dib807x_tuner_attach,
2736 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2738 .size_of_priv =
2739 sizeof(struct dib0700_adapter_state),
2743 .num_device_descs = 1,
2744 .devices = {
2745 { "DiBcom STK807xPVR reference design",
2746 { &dib0700_usb_id_table[61], NULL },
2747 { NULL },
2751 .rc_interval = DEFAULT_RC_INTERVAL,
2752 .rc_key_map = ir_codes_dib0700_table,
2753 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2754 .rc_query = dib0700_rc_query
2755 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2756 .num_adapters = 1,
2757 .adapter = {
2759 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
2760 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2761 .pid_filter_count = 32,
2762 .pid_filter = stk80xx_pid_filter,
2763 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
2764 .frontend_attach = stk809x_frontend_attach,
2765 .tuner_attach = dib809x_tuner_attach,
2767 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2769 .size_of_priv =
2770 sizeof(struct dib0700_adapter_state),
2774 .num_device_descs = 1,
2775 .devices = {
2776 { "DiBcom STK8096GP reference design",
2777 { &dib0700_usb_id_table[67], NULL },
2778 { NULL },
2782 .rc_interval = DEFAULT_RC_INTERVAL,
2783 .rc_key_map = ir_codes_dib0700_table,
2784 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2785 .rc_query = dib0700_rc_query
2789 int dib0700_device_count = ARRAY_SIZE(dib0700_devices);