Linux 2.6.34-rc3
[pohmelfs.git] / drivers / media / dvb / dvb-usb / dib0700_devices.c
blob34eab05afc6cd08d83d74468f7614b9a5f2a3468
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 dib0700_rc_keys[] = {
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 },
799 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
800 static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
801 BAND_UHF | BAND_VHF,
803 /* 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,
804 * 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 */
805 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
806 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
808 712,
812 118,
815 4095,
819 42598,
820 17694,
821 45875,
822 2621,
825 139,
828 107,
829 172,
839 { 0,
840 107,
841 51800,
842 24700
846 static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
847 BAND_UHF | BAND_VHF,
849 /* 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,
850 * 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 */
851 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
852 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
854 712,
858 118,
861 4095,
865 42598,
866 16384,
867 42598,
871 137,
872 255,
875 255,
892 static struct dibx000_bandwidth_config stk7700p_pll_config = {
893 60000, 30000,
894 1, 8, 3, 1, 0,
895 0, 0, 1, 1, 0,
896 (3 << 14) | (1 << 12) | (524 << 0),
897 60258167,
898 20452225,
899 30000000,
902 static struct dib7000m_config stk7700p_dib7000m_config = {
903 .dvbt_mode = 1,
904 .output_mpeg2_in_188_bytes = 1,
905 .quartz_direct = 1,
907 .agc_config_count = 1,
908 .agc = &stk7700p_7000m_mt2060_agc_config,
909 .bw = &stk7700p_pll_config,
911 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
912 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
913 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
916 static struct dib7000p_config stk7700p_dib7000p_config = {
917 .output_mpeg2_in_188_bytes = 1,
919 .agc_config_count = 1,
920 .agc = &stk7700p_7000p_mt2060_agc_config,
921 .bw = &stk7700p_pll_config,
923 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
924 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
925 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
928 static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
930 struct dib0700_state *st = adap->dev->priv;
931 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
933 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
934 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
936 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
937 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
939 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
940 dib0700_ctrl_clock(adap->dev, 72, 1);
941 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
943 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
945 st->mt2060_if1[0] = 1220;
947 if (dib7000pc_detection(&adap->dev->i2c_adap)) {
948 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
949 st->is_dib7000pc = 1;
950 } else
951 adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
953 return adap->fe == NULL ? -ENODEV : 0;
956 static struct mt2060_config stk7700p_mt2060_config = {
957 0x60
960 static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
962 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
963 struct dib0700_state *st = adap->dev->priv;
964 struct i2c_adapter *tun_i2c;
965 s8 a;
966 int if1=1220;
967 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
968 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
969 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
971 if (st->is_dib7000pc)
972 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
973 else
974 tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
976 return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config,
977 if1) == NULL ? -ENODEV : 0;
980 /* DIB7070 generic */
981 static struct dibx000_agc_config dib7070_agc_config = {
982 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
983 /* 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,
984 * 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 */
985 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
986 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
988 600,
992 118,
995 3530,
999 65535,
1002 65535,
1007 183,
1008 206,
1009 255,
1011 152,
1023 static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
1025 deb_info("reset: %d", onoff);
1026 return dib7000p_set_gpio(fe, 8, 0, !onoff);
1029 static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
1031 deb_info("sleep: %d", onoff);
1032 return dib7000p_set_gpio(fe, 9, 0, onoff);
1035 static struct dib0070_config dib7070p_dib0070_config[2] = {
1037 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1038 .reset = dib7070_tuner_reset,
1039 .sleep = dib7070_tuner_sleep,
1040 .clock_khz = 12000,
1041 .clock_pad_drive = 4,
1042 .charge_pump = 2,
1043 }, {
1044 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1045 .reset = dib7070_tuner_reset,
1046 .sleep = dib7070_tuner_sleep,
1047 .clock_khz = 12000,
1048 .charge_pump = 2,
1052 static struct dib0070_config dib7770p_dib0070_config = {
1053 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1054 .reset = dib7070_tuner_reset,
1055 .sleep = dib7070_tuner_sleep,
1056 .clock_khz = 12000,
1057 .clock_pad_drive = 0,
1058 .flip_chip = 1,
1059 .charge_pump = 2,
1062 static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
1064 struct dvb_usb_adapter *adap = fe->dvb->priv;
1065 struct dib0700_adapter_state *state = adap->priv;
1067 u16 offset;
1068 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1069 switch (band) {
1070 case BAND_VHF: offset = 950; break;
1071 case BAND_UHF:
1072 default: offset = 550; break;
1074 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
1075 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1076 return state->set_param_save(fe, fep);
1079 static int dib7770_set_param_override(struct dvb_frontend *fe,
1080 struct dvb_frontend_parameters *fep)
1082 struct dvb_usb_adapter *adap = fe->dvb->priv;
1083 struct dib0700_adapter_state *state = adap->priv;
1085 u16 offset;
1086 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1087 switch (band) {
1088 case BAND_VHF:
1089 dib7000p_set_gpio(fe, 0, 0, 1);
1090 offset = 850;
1091 break;
1092 case BAND_UHF:
1093 default:
1094 dib7000p_set_gpio(fe, 0, 0, 0);
1095 offset = 250;
1096 break;
1098 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
1099 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1100 return state->set_param_save(fe, fep);
1103 static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
1105 struct dib0700_adapter_state *st = adap->priv;
1106 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe,
1107 DIBX000_I2C_INTERFACE_TUNER, 1);
1109 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1110 &dib7770p_dib0070_config) == NULL)
1111 return -ENODEV;
1113 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1114 adap->fe->ops.tuner_ops.set_params = dib7770_set_param_override;
1115 return 0;
1118 static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
1120 struct dib0700_adapter_state *st = adap->priv;
1121 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1123 if (adap->id == 0) {
1124 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
1125 return -ENODEV;
1126 } else {
1127 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
1128 return -ENODEV;
1131 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1132 adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override;
1133 return 0;
1136 static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
1138 return dib7000p_pid_filter(adapter->fe, index, pid, onoff);
1141 static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
1143 return dib7000p_pid_filter_ctrl(adapter->fe, onoff);
1146 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
1147 60000, 15000,
1148 1, 20, 3, 1, 0,
1149 0, 0, 1, 1, 2,
1150 (3 << 14) | (1 << 12) | (524 << 0),
1151 (0 << 25) | 0,
1152 20452225,
1153 12000000,
1156 static struct dib7000p_config dib7070p_dib7000p_config = {
1157 .output_mpeg2_in_188_bytes = 1,
1159 .agc_config_count = 1,
1160 .agc = &dib7070_agc_config,
1161 .bw = &dib7070_bw_config_12_mhz,
1162 .tuner_is_baseband = 1,
1163 .spur_protect = 1,
1165 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1166 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1167 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1169 .hostbus_diversity = 1,
1172 /* STK7070P */
1173 static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
1175 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
1176 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
1177 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
1178 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1179 else
1180 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1181 msleep(10);
1182 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1183 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1184 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1185 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1187 dib0700_ctrl_clock(adap->dev, 72, 1);
1189 msleep(10);
1190 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1191 msleep(10);
1192 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1194 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1195 &dib7070p_dib7000p_config) != 0) {
1196 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1197 __func__);
1198 return -ENODEV;
1201 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
1202 &dib7070p_dib7000p_config);
1203 return adap->fe == NULL ? -ENODEV : 0;
1206 /* DIB807x generic */
1207 static struct dibx000_agc_config dib807x_agc_config[2] = {
1209 BAND_VHF,
1210 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1211 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1212 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1213 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1214 * P_agc_write=0 */
1215 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1216 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1217 (0 << 0), /* setup*/
1219 600, /* inv_gain*/
1220 10, /* time_stabiliz*/
1222 0, /* alpha_level*/
1223 118, /* thlock*/
1225 0, /* wbd_inv*/
1226 3530, /* wbd_ref*/
1227 1, /* wbd_sel*/
1228 5, /* wbd_alpha*/
1230 65535, /* agc1_max*/
1231 0, /* agc1_min*/
1233 65535, /* agc2_max*/
1234 0, /* agc2_min*/
1236 0, /* agc1_pt1*/
1237 40, /* agc1_pt2*/
1238 183, /* agc1_pt3*/
1239 206, /* agc1_slope1*/
1240 255, /* agc1_slope2*/
1241 72, /* agc2_pt1*/
1242 152, /* agc2_pt2*/
1243 88, /* agc2_slope1*/
1244 90, /* agc2_slope2*/
1246 17, /* alpha_mant*/
1247 27, /* alpha_exp*/
1248 23, /* beta_mant*/
1249 51, /* beta_exp*/
1251 0, /* perform_agc_softsplit*/
1252 }, {
1253 BAND_UHF,
1254 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1255 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1256 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1257 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1258 * P_agc_write=0 */
1259 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1260 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1261 (0 << 0), /* setup */
1263 600, /* inv_gain*/
1264 10, /* time_stabiliz*/
1266 0, /* alpha_level*/
1267 118, /* thlock*/
1269 0, /* wbd_inv*/
1270 3530, /* wbd_ref*/
1271 1, /* wbd_sel*/
1272 5, /* wbd_alpha*/
1274 65535, /* agc1_max*/
1275 0, /* agc1_min*/
1277 65535, /* agc2_max*/
1278 0, /* agc2_min*/
1280 0, /* agc1_pt1*/
1281 40, /* agc1_pt2*/
1282 183, /* agc1_pt3*/
1283 206, /* agc1_slope1*/
1284 255, /* agc1_slope2*/
1285 72, /* agc2_pt1*/
1286 152, /* agc2_pt2*/
1287 88, /* agc2_slope1*/
1288 90, /* agc2_slope2*/
1290 17, /* alpha_mant*/
1291 27, /* alpha_exp*/
1292 23, /* beta_mant*/
1293 51, /* beta_exp*/
1295 0, /* perform_agc_softsplit*/
1299 static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
1300 60000, 15000, /* internal, sampling*/
1301 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/
1302 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
1303 ADClkSrc, modulo */
1304 (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1305 (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1306 18179755, /* timf*/
1307 12000000, /* xtal_hz*/
1310 static struct dib8000_config dib807x_dib8000_config[2] = {
1312 .output_mpeg2_in_188_bytes = 1,
1314 .agc_config_count = 2,
1315 .agc = dib807x_agc_config,
1316 .pll = &dib807x_bw_config_12_mhz,
1317 .tuner_is_baseband = 1,
1319 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1320 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1321 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1323 .hostbus_diversity = 1,
1324 .div_cfg = 1,
1325 .agc_control = &dib0070_ctrl_agc_filter,
1326 .output_mode = OUTMODE_MPEG2_FIFO,
1327 .drives = 0x2d98,
1328 }, {
1329 .output_mpeg2_in_188_bytes = 1,
1331 .agc_config_count = 2,
1332 .agc = dib807x_agc_config,
1333 .pll = &dib807x_bw_config_12_mhz,
1334 .tuner_is_baseband = 1,
1336 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1337 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1338 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1340 .hostbus_diversity = 1,
1341 .agc_control = &dib0070_ctrl_agc_filter,
1342 .output_mode = OUTMODE_MPEG2_FIFO,
1343 .drives = 0x2d98,
1347 static int dib80xx_tuner_reset(struct dvb_frontend *fe, int onoff)
1349 return dib8000_set_gpio(fe, 5, 0, !onoff);
1352 static int dib80xx_tuner_sleep(struct dvb_frontend *fe, int onoff)
1354 return dib8000_set_gpio(fe, 0, 0, onoff);
1357 static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
1358 { 240, 7},
1359 { 0xffff, 6},
1362 static struct dib0070_config dib807x_dib0070_config[2] = {
1364 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1365 .reset = dib80xx_tuner_reset,
1366 .sleep = dib80xx_tuner_sleep,
1367 .clock_khz = 12000,
1368 .clock_pad_drive = 4,
1369 .vga_filter = 1,
1370 .force_crystal_mode = 1,
1371 .enable_third_order_filter = 1,
1372 .charge_pump = 0,
1373 .wbd_gain = dib8070_wbd_gain_cfg,
1374 .osc_buffer_state = 0,
1375 .freq_offset_khz_uhf = -100,
1376 .freq_offset_khz_vhf = -100,
1377 }, {
1378 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1379 .reset = dib80xx_tuner_reset,
1380 .sleep = dib80xx_tuner_sleep,
1381 .clock_khz = 12000,
1382 .clock_pad_drive = 2,
1383 .vga_filter = 1,
1384 .force_crystal_mode = 1,
1385 .enable_third_order_filter = 1,
1386 .charge_pump = 0,
1387 .wbd_gain = dib8070_wbd_gain_cfg,
1388 .osc_buffer_state = 0,
1389 .freq_offset_khz_uhf = -25,
1390 .freq_offset_khz_vhf = -25,
1394 static int dib807x_set_param_override(struct dvb_frontend *fe,
1395 struct dvb_frontend_parameters *fep)
1397 struct dvb_usb_adapter *adap = fe->dvb->priv;
1398 struct dib0700_adapter_state *state = adap->priv;
1400 u16 offset = dib0070_wbd_offset(fe);
1401 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1402 switch (band) {
1403 case BAND_VHF:
1404 offset += 750;
1405 break;
1406 case BAND_UHF: /* fall-thru wanted */
1407 default:
1408 offset += 250; break;
1410 deb_info("WBD for DiB8000: %d\n", offset);
1411 dib8000_set_wbd_ref(fe, offset);
1413 return state->set_param_save(fe, fep);
1416 static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1418 struct dib0700_adapter_state *st = adap->priv;
1419 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe,
1420 DIBX000_I2C_INTERFACE_TUNER, 1);
1422 if (adap->id == 0) {
1423 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1424 &dib807x_dib0070_config[0]) == NULL)
1425 return -ENODEV;
1426 } else {
1427 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1428 &dib807x_dib0070_config[1]) == NULL)
1429 return -ENODEV;
1432 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1433 adap->fe->ops.tuner_ops.set_params = dib807x_set_param_override;
1434 return 0;
1437 static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index,
1438 u16 pid, int onoff)
1440 return dib8000_pid_filter(adapter->fe, index, pid, onoff);
1443 static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter,
1444 int onoff)
1446 return dib8000_pid_filter_ctrl(adapter->fe, onoff);
1449 /* STK807x */
1450 static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
1452 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1453 msleep(10);
1454 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1455 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1456 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1458 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1460 dib0700_ctrl_clock(adap->dev, 72, 1);
1462 msleep(10);
1463 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1464 msleep(10);
1465 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1467 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1468 0x80);
1470 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1471 &dib807x_dib8000_config[0]);
1473 return adap->fe == NULL ? -ENODEV : 0;
1476 /* STK807xPVR */
1477 static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
1479 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1480 msleep(30);
1481 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1482 msleep(500);
1483 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1484 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1485 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1487 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1489 dib0700_ctrl_clock(adap->dev, 72, 1);
1491 msleep(10);
1492 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1493 msleep(10);
1494 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1496 /* initialize IC 0 */
1497 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80);
1499 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1500 &dib807x_dib8000_config[0]);
1502 return adap->fe == NULL ? -ENODEV : 0;
1505 static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
1507 /* initialize IC 1 */
1508 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82);
1510 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82,
1511 &dib807x_dib8000_config[1]);
1513 return adap->fe == NULL ? -ENODEV : 0;
1516 /* STK8096GP */
1517 struct dibx000_agc_config dib8090_agc_config[2] = {
1519 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
1520 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1521 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1522 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1523 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1524 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1526 787,
1530 118,
1533 3530,
1537 65535,
1540 65535,
1545 114,
1546 143,
1547 144,
1548 114,
1549 227,
1550 116,
1551 117,
1561 BAND_CBAND,
1562 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1563 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1564 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1565 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1566 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1568 787,
1572 118,
1575 3530,
1582 65535,
1587 114,
1588 143,
1589 144,
1590 114,
1591 227,
1592 116,
1593 117,
1604 static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = {
1605 54000, 13500,
1606 1, 18, 3, 1, 0,
1607 0, 0, 1, 1, 2,
1608 (3 << 14) | (1 << 12) | (599 << 0),
1609 (0 << 25) | 0,
1610 20199727,
1611 12000000,
1614 static int dib8090_get_adc_power(struct dvb_frontend *fe)
1616 return dib8000_get_adc_power(fe, 1);
1619 static struct dib8000_config dib809x_dib8000_config = {
1620 .output_mpeg2_in_188_bytes = 1,
1622 .agc_config_count = 2,
1623 .agc = dib8090_agc_config,
1624 .agc_control = dib0090_dcc_freq,
1625 .pll = &dib8090_pll_config_12mhz,
1626 .tuner_is_baseband = 1,
1628 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1629 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1630 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1632 .hostbus_diversity = 1,
1633 .div_cfg = 0x31,
1634 .output_mode = OUTMODE_MPEG2_FIFO,
1635 .drives = 0x2d98,
1636 .diversity_delay = 144,
1637 .refclksel = 3,
1640 static struct dib0090_config dib809x_dib0090_config = {
1641 .io.pll_bypass = 1,
1642 .io.pll_range = 1,
1643 .io.pll_prediv = 1,
1644 .io.pll_loopdiv = 20,
1645 .io.adc_clock_ratio = 8,
1646 .io.pll_int_loop_filt = 0,
1647 .io.clock_khz = 12000,
1648 .reset = dib80xx_tuner_reset,
1649 .sleep = dib80xx_tuner_sleep,
1650 .clkouttobamse = 1,
1651 .analog_output = 1,
1652 .i2c_address = DEFAULT_DIB0090_I2C_ADDRESS,
1653 .wbd_vhf_offset = 100,
1654 .wbd_cband_offset = 450,
1655 .use_pwm_agc = 1,
1656 .clkoutdrive = 1,
1657 .get_adc_power = dib8090_get_adc_power,
1658 .freq_offset_khz_uhf = 0,
1659 .freq_offset_khz_vhf = -143,
1662 static int dib8096_set_param_override(struct dvb_frontend *fe,
1663 struct dvb_frontend_parameters *fep)
1665 struct dvb_usb_adapter *adap = fe->dvb->priv;
1666 struct dib0700_adapter_state *state = adap->priv;
1667 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1668 u16 offset;
1669 int ret = 0;
1670 enum frontend_tune_state tune_state = CT_SHUTDOWN;
1671 u16 ltgain, rf_gain_limit;
1673 ret = state->set_param_save(fe, fep);
1674 if (ret < 0)
1675 return ret;
1677 switch (band) {
1678 case BAND_VHF:
1679 offset = 100;
1680 break;
1681 case BAND_UHF:
1682 offset = 550;
1683 break;
1684 default:
1685 offset = 0;
1686 break;
1688 offset += (dib0090_get_wbd_offset(fe) * 8 * 18 / 33 + 1) / 2;
1689 dib8000_set_wbd_ref(fe, offset);
1692 if (band == BAND_CBAND) {
1693 deb_info("tuning in CBAND - soft-AGC startup\n");
1694 /* TODO specific wbd target for dib0090 - needed for startup ? */
1695 dib0090_set_tune_state(fe, CT_AGC_START);
1696 do {
1697 ret = dib0090_gain_control(fe);
1698 msleep(ret);
1699 tune_state = dib0090_get_tune_state(fe);
1700 if (tune_state == CT_AGC_STEP_0)
1701 dib8000_set_gpio(fe, 6, 0, 1);
1702 else if (tune_state == CT_AGC_STEP_1) {
1703 dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, &ltgain);
1704 if (rf_gain_limit == 0)
1705 dib8000_set_gpio(fe, 6, 0, 0);
1707 } while (tune_state < CT_AGC_STOP);
1708 dib0090_pwm_gain_reset(fe);
1709 dib8000_pwm_agc_reset(fe);
1710 dib8000_set_tune_state(fe, CT_DEMOD_START);
1711 } else {
1712 deb_info("not tuning in CBAND - standard AGC startup\n");
1713 dib0090_pwm_gain_reset(fe);
1716 return 0;
1719 static int dib809x_tuner_attach(struct dvb_usb_adapter *adap)
1721 struct dib0700_adapter_state *st = adap->priv;
1722 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1724 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1725 return -ENODEV;
1727 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1728 adap->fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1729 return 0;
1732 static int stk809x_frontend_attach(struct dvb_usb_adapter *adap)
1734 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1735 msleep(10);
1736 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1737 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1738 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1740 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1742 dib0700_ctrl_clock(adap->dev, 72, 1);
1744 msleep(10);
1745 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1746 msleep(10);
1747 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1749 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80);
1751 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config);
1753 return adap->fe == NULL ? -ENODEV : 0;
1756 /* STK7070PD */
1757 static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
1759 .output_mpeg2_in_188_bytes = 1,
1761 .agc_config_count = 1,
1762 .agc = &dib7070_agc_config,
1763 .bw = &dib7070_bw_config_12_mhz,
1764 .tuner_is_baseband = 1,
1765 .spur_protect = 1,
1767 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1768 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1769 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1771 .hostbus_diversity = 1,
1772 }, {
1773 .output_mpeg2_in_188_bytes = 1,
1775 .agc_config_count = 1,
1776 .agc = &dib7070_agc_config,
1777 .bw = &dib7070_bw_config_12_mhz,
1778 .tuner_is_baseband = 1,
1779 .spur_protect = 1,
1781 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1782 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1783 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1785 .hostbus_diversity = 1,
1789 static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
1791 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1792 msleep(10);
1793 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1794 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1795 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1796 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1798 dib0700_ctrl_clock(adap->dev, 72, 1);
1800 msleep(10);
1801 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1802 msleep(10);
1803 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1805 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
1806 stk7070pd_dib7000p_config) != 0) {
1807 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1808 __func__);
1809 return -ENODEV;
1812 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
1813 return adap->fe == NULL ? -ENODEV : 0;
1816 static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
1818 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
1819 return adap->fe == NULL ? -ENODEV : 0;
1822 /* S5H1411 */
1823 static struct s5h1411_config pinnacle_801e_config = {
1824 .output_mode = S5H1411_PARALLEL_OUTPUT,
1825 .gpio = S5H1411_GPIO_OFF,
1826 .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
1827 .qam_if = S5H1411_IF_44000,
1828 .vsb_if = S5H1411_IF_44000,
1829 .inversion = S5H1411_INVERSION_OFF,
1830 .status_mode = S5H1411_DEMODLOCKING
1833 /* Pinnacle PCTV HD Pro 801e GPIOs map:
1834 GPIO0 - currently unknown
1835 GPIO1 - xc5000 tuner reset
1836 GPIO2 - CX25843 sleep
1837 GPIO3 - currently unknown
1838 GPIO4 - currently unknown
1839 GPIO6 - currently unknown
1840 GPIO7 - currently unknown
1841 GPIO9 - currently unknown
1842 GPIO10 - CX25843 reset
1844 static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
1846 struct dib0700_state *st = adap->dev->priv;
1848 /* Make use of the new i2c functions from FW 1.20 */
1849 st->fw_use_new_i2c_api = 1;
1851 /* The s5h1411 requires the dib0700 to not be in master mode */
1852 st->disable_streaming_master_mode = 1;
1854 /* All msleep values taken from Windows USB trace */
1855 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
1856 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
1857 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1858 msleep(400);
1859 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1860 msleep(60);
1861 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1862 msleep(30);
1863 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1864 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1865 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1866 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1867 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
1868 msleep(30);
1870 /* Put the CX25843 to sleep for now since we're in digital mode */
1871 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
1873 /* GPIOs are initialized, do the attach */
1874 adap->fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
1875 &adap->dev->i2c_adap);
1876 return adap->fe == NULL ? -ENODEV : 0;
1879 static int dib0700_xc5000_tuner_callback(void *priv, int component,
1880 int command, int arg)
1882 struct dvb_usb_adapter *adap = priv;
1884 if (command == XC5000_TUNER_RESET) {
1885 /* Reset the tuner */
1886 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
1887 msleep(10);
1888 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
1889 msleep(10);
1890 } else {
1891 err("xc5000: unknown tuner callback command: %d\n", command);
1892 return -EINVAL;
1895 return 0;
1898 static struct xc5000_config s5h1411_xc5000_tunerconfig = {
1899 .i2c_address = 0x64,
1900 .if_khz = 5380,
1903 static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
1905 /* FIXME: generalize & move to common area */
1906 adap->fe->callback = dib0700_xc5000_tuner_callback;
1908 return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap,
1909 &s5h1411_xc5000_tunerconfig)
1910 == NULL ? -ENODEV : 0;
1913 static struct lgdt3305_config hcw_lgdt3305_config = {
1914 .i2c_addr = 0x0e,
1915 .mpeg_mode = LGDT3305_MPEG_PARALLEL,
1916 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
1917 .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
1918 .deny_i2c_rptr = 0,
1919 .spectral_inversion = 1,
1920 .qam_if_khz = 6000,
1921 .vsb_if_khz = 6000,
1922 .usref_8vsb = 0x0500,
1925 static struct mxl5007t_config hcw_mxl5007t_config = {
1926 .xtal_freq_hz = MxL_XTAL_25_MHZ,
1927 .if_freq_hz = MxL_IF_6_MHZ,
1928 .invert_if = 1,
1931 /* TIGER-ATSC map:
1932 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
1933 GPIO1 - ANT_SEL (H: VPA, L: MCX)
1934 GPIO4 - SCL2
1935 GPIO6 - EN_TUNER
1936 GPIO7 - SDA2
1937 GPIO10 - DEM_RST
1939 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
1941 static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
1943 struct dib0700_state *st = adap->dev->priv;
1945 /* Make use of the new i2c functions from FW 1.20 */
1946 st->fw_use_new_i2c_api = 1;
1948 st->disable_streaming_master_mode = 1;
1950 /* fe power enable */
1951 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1952 msleep(30);
1953 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1954 msleep(30);
1956 /* demod reset */
1957 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1958 msleep(30);
1959 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1960 msleep(30);
1961 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1962 msleep(30);
1964 adap->fe = dvb_attach(lgdt3305_attach,
1965 &hcw_lgdt3305_config,
1966 &adap->dev->i2c_adap);
1968 return adap->fe == NULL ? -ENODEV : 0;
1971 static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
1973 return dvb_attach(mxl5007t_attach, adap->fe,
1974 &adap->dev->i2c_adap, 0x60,
1975 &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
1979 /* DVB-USB and USB stuff follows */
1980 struct usb_device_id dib0700_usb_id_table[] = {
1981 /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
1982 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
1983 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
1984 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
1985 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
1986 /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
1987 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
1988 { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
1989 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
1990 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
1991 /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
1992 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
1993 { USB_DEVICE(USB_VID_TERRATEC,
1994 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
1995 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
1996 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
1997 /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
1998 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
1999 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
2000 { USB_DEVICE(USB_VID_PINNACLE,
2001 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
2002 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
2003 /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
2004 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
2005 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
2006 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
2007 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
2008 /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
2009 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
2010 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
2011 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
2012 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
2013 /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
2014 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
2015 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
2016 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
2017 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
2018 /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
2019 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
2020 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
2021 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
2022 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
2023 /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
2024 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
2025 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
2026 { USB_DEVICE(USB_VID_TERRATEC,
2027 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
2028 { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
2029 /* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
2030 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
2031 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
2032 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
2033 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
2034 /* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
2035 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
2036 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
2037 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
2038 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
2039 /* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
2040 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
2041 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV73ESE) },
2042 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV282E) },
2043 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
2044 /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
2045 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
2046 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
2047 { USB_DEVICE(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD) },
2048 { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },
2049 /* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
2050 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
2051 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) },
2052 { 0 } /* Terminating entry */
2054 MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
2056 #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
2057 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
2058 .usb_ctrl = DEVICE_SPECIFIC, \
2059 .firmware = "dvb-usb-dib0700-1.20.fw", \
2060 .download_firmware = dib0700_download_firmware, \
2061 .no_reconnect = 1, \
2062 .size_of_priv = sizeof(struct dib0700_state), \
2063 .i2c_algo = &dib0700_i2c_algo, \
2064 .identify_state = dib0700_identify_state
2066 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
2067 .streaming_ctrl = dib0700_streaming_ctrl, \
2068 .stream = { \
2069 .type = USB_BULK, \
2070 .count = 4, \
2071 .endpoint = ep, \
2072 .u = { \
2073 .bulk = { \
2074 .buffersize = 39480, \
2079 struct dvb_usb_device_properties dib0700_devices[] = {
2081 DIB0700_DEFAULT_DEVICE_PROPERTIES,
2083 .num_adapters = 1,
2084 .adapter = {
2086 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2087 .pid_filter_count = 32,
2088 .pid_filter = stk70x0p_pid_filter,
2089 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2090 .frontend_attach = stk7700p_frontend_attach,
2091 .tuner_attach = stk7700p_tuner_attach,
2093 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2097 .num_device_descs = 8,
2098 .devices = {
2099 { "DiBcom STK7700P reference design",
2100 { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
2101 { NULL },
2103 { "Hauppauge Nova-T Stick",
2104 { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
2105 { NULL },
2107 { "AVerMedia AVerTV DVB-T Volar",
2108 { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
2109 { NULL },
2111 { "Compro Videomate U500",
2112 { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
2113 { NULL },
2115 { "Uniwill STK7700P based (Hama and others)",
2116 { &dib0700_usb_id_table[7], NULL },
2117 { NULL },
2119 { "Leadtek Winfast DTV Dongle (STK7700P based)",
2120 { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
2121 { NULL },
2123 { "AVerMedia AVerTV DVB-T Express",
2124 { &dib0700_usb_id_table[20] },
2125 { NULL },
2127 { "Gigabyte U7000",
2128 { &dib0700_usb_id_table[21], NULL },
2129 { NULL },
2133 .rc_interval = DEFAULT_RC_INTERVAL,
2134 .rc_key_map = dib0700_rc_keys,
2135 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2136 .rc_query = dib0700_rc_query
2137 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2139 .num_adapters = 2,
2140 .adapter = {
2142 .frontend_attach = bristol_frontend_attach,
2143 .tuner_attach = bristol_tuner_attach,
2145 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2146 }, {
2147 .frontend_attach = bristol_frontend_attach,
2148 .tuner_attach = bristol_tuner_attach,
2150 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2154 .num_device_descs = 1,
2155 .devices = {
2156 { "Hauppauge Nova-T 500 Dual DVB-T",
2157 { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
2158 { NULL },
2162 .rc_interval = DEFAULT_RC_INTERVAL,
2163 .rc_key_map = dib0700_rc_keys,
2164 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2165 .rc_query = dib0700_rc_query
2166 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2168 .num_adapters = 2,
2169 .adapter = {
2171 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2172 .pid_filter_count = 32,
2173 .pid_filter = stk70x0p_pid_filter,
2174 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2175 .frontend_attach = stk7700d_frontend_attach,
2176 .tuner_attach = stk7700d_tuner_attach,
2178 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2179 }, {
2180 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2181 .pid_filter_count = 32,
2182 .pid_filter = stk70x0p_pid_filter,
2183 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2184 .frontend_attach = stk7700d_frontend_attach,
2185 .tuner_attach = stk7700d_tuner_attach,
2187 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2191 .num_device_descs = 5,
2192 .devices = {
2193 { "Pinnacle PCTV 2000e",
2194 { &dib0700_usb_id_table[11], NULL },
2195 { NULL },
2197 { "Terratec Cinergy DT XS Diversity",
2198 { &dib0700_usb_id_table[12], NULL },
2199 { NULL },
2201 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
2202 { &dib0700_usb_id_table[13], NULL },
2203 { NULL },
2205 { "DiBcom STK7700D reference design",
2206 { &dib0700_usb_id_table[14], NULL },
2207 { NULL },
2209 { "YUAN High-Tech DiBcom STK7700D",
2210 { &dib0700_usb_id_table[55], NULL },
2211 { NULL },
2216 .rc_interval = DEFAULT_RC_INTERVAL,
2217 .rc_key_map = dib0700_rc_keys,
2218 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2219 .rc_query = dib0700_rc_query
2221 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2223 .num_adapters = 1,
2224 .adapter = {
2226 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2227 .pid_filter_count = 32,
2228 .pid_filter = stk70x0p_pid_filter,
2229 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2230 .frontend_attach = stk7700P2_frontend_attach,
2231 .tuner_attach = stk7700d_tuner_attach,
2233 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2237 .num_device_descs = 3,
2238 .devices = {
2239 { "ASUS My Cinema U3000 Mini DVBT Tuner",
2240 { &dib0700_usb_id_table[23], NULL },
2241 { NULL },
2243 { "Yuan EC372S",
2244 { &dib0700_usb_id_table[31], NULL },
2245 { NULL },
2247 { "Terratec Cinergy T Express",
2248 { &dib0700_usb_id_table[42], NULL },
2249 { NULL },
2253 .rc_interval = DEFAULT_RC_INTERVAL,
2254 .rc_key_map = dib0700_rc_keys,
2255 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2256 .rc_query = dib0700_rc_query
2257 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2259 .num_adapters = 1,
2260 .adapter = {
2262 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2263 .pid_filter_count = 32,
2264 .pid_filter = stk70x0p_pid_filter,
2265 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2266 .frontend_attach = stk7070p_frontend_attach,
2267 .tuner_attach = dib7070p_tuner_attach,
2269 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2271 .size_of_priv = sizeof(struct dib0700_adapter_state),
2275 .num_device_descs = 11,
2276 .devices = {
2277 { "DiBcom STK7070P reference design",
2278 { &dib0700_usb_id_table[15], NULL },
2279 { NULL },
2281 { "Pinnacle PCTV DVB-T Flash Stick",
2282 { &dib0700_usb_id_table[16], NULL },
2283 { NULL },
2285 { "Artec T14BR DVB-T",
2286 { &dib0700_usb_id_table[22], NULL },
2287 { NULL },
2289 { "ASUS My Cinema U3100 Mini DVBT Tuner",
2290 { &dib0700_usb_id_table[24], NULL },
2291 { NULL },
2293 { "Hauppauge Nova-T Stick",
2294 { &dib0700_usb_id_table[25], NULL },
2295 { NULL },
2297 { "Hauppauge Nova-T MyTV.t",
2298 { &dib0700_usb_id_table[26], NULL },
2299 { NULL },
2301 { "Pinnacle PCTV 72e",
2302 { &dib0700_usb_id_table[29], NULL },
2303 { NULL },
2305 { "Pinnacle PCTV 73e",
2306 { &dib0700_usb_id_table[30], NULL },
2307 { NULL },
2309 { "Elgato EyeTV DTT",
2310 { &dib0700_usb_id_table[49], NULL },
2311 { NULL },
2313 { "Yuan PD378S",
2314 { &dib0700_usb_id_table[45], NULL },
2315 { NULL },
2317 { "Elgato EyeTV Dtt Dlx PD378S",
2318 { &dib0700_usb_id_table[50], NULL },
2319 { NULL },
2323 .rc_interval = DEFAULT_RC_INTERVAL,
2324 .rc_key_map = dib0700_rc_keys,
2325 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2326 .rc_query = dib0700_rc_query
2328 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2330 .num_adapters = 1,
2331 .adapter = {
2333 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2334 .pid_filter_count = 32,
2335 .pid_filter = stk70x0p_pid_filter,
2336 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2337 .frontend_attach = stk7070p_frontend_attach,
2338 .tuner_attach = dib7070p_tuner_attach,
2340 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2342 .size_of_priv = sizeof(struct dib0700_adapter_state),
2346 .num_device_descs = 3,
2347 .devices = {
2348 { "Pinnacle PCTV 73A",
2349 { &dib0700_usb_id_table[56], NULL },
2350 { NULL },
2352 { "Pinnacle PCTV 73e SE",
2353 { &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL },
2354 { NULL },
2356 { "Pinnacle PCTV 282e",
2357 { &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL },
2358 { NULL },
2362 .rc_interval = DEFAULT_RC_INTERVAL,
2363 .rc_key_map = dib0700_rc_keys,
2364 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2365 .rc_query = dib0700_rc_query
2367 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2369 .num_adapters = 2,
2370 .adapter = {
2372 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2373 .pid_filter_count = 32,
2374 .pid_filter = stk70x0p_pid_filter,
2375 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2376 .frontend_attach = stk7070pd_frontend_attach0,
2377 .tuner_attach = dib7070p_tuner_attach,
2379 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2381 .size_of_priv = sizeof(struct dib0700_adapter_state),
2382 }, {
2383 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2384 .pid_filter_count = 32,
2385 .pid_filter = stk70x0p_pid_filter,
2386 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2387 .frontend_attach = stk7070pd_frontend_attach1,
2388 .tuner_attach = dib7070p_tuner_attach,
2390 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2392 .size_of_priv = sizeof(struct dib0700_adapter_state),
2396 .num_device_descs = 6,
2397 .devices = {
2398 { "DiBcom STK7070PD reference design",
2399 { &dib0700_usb_id_table[17], NULL },
2400 { NULL },
2402 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
2403 { &dib0700_usb_id_table[18], NULL },
2404 { NULL },
2406 { "Hauppauge Nova-TD Stick (52009)",
2407 { &dib0700_usb_id_table[35], NULL },
2408 { NULL },
2410 { "Hauppauge Nova-TD-500 (84xxx)",
2411 { &dib0700_usb_id_table[36], NULL },
2412 { NULL },
2414 { "Terratec Cinergy DT USB XS Diversity/ T5",
2415 { &dib0700_usb_id_table[43],
2416 &dib0700_usb_id_table[53], NULL},
2417 { NULL },
2419 { "Sony PlayTV",
2420 { &dib0700_usb_id_table[44], NULL },
2421 { NULL },
2424 .rc_interval = DEFAULT_RC_INTERVAL,
2425 .rc_key_map = dib0700_rc_keys,
2426 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2427 .rc_query = dib0700_rc_query
2428 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2430 .num_adapters = 1,
2431 .adapter = {
2433 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2434 .pid_filter_count = 32,
2435 .pid_filter = stk70x0p_pid_filter,
2436 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2437 .frontend_attach = stk7700ph_frontend_attach,
2438 .tuner_attach = stk7700ph_tuner_attach,
2440 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2442 .size_of_priv = sizeof(struct
2443 dib0700_adapter_state),
2447 .num_device_descs = 9,
2448 .devices = {
2449 { "Terratec Cinergy HT USB XE",
2450 { &dib0700_usb_id_table[27], NULL },
2451 { NULL },
2453 { "Pinnacle Expresscard 320cx",
2454 { &dib0700_usb_id_table[28], NULL },
2455 { NULL },
2457 { "Terratec Cinergy HT Express",
2458 { &dib0700_usb_id_table[32], NULL },
2459 { NULL },
2461 { "Gigabyte U8000-RH",
2462 { &dib0700_usb_id_table[37], NULL },
2463 { NULL },
2465 { "YUAN High-Tech STK7700PH",
2466 { &dib0700_usb_id_table[38], NULL },
2467 { NULL },
2469 { "Asus My Cinema-U3000Hybrid",
2470 { &dib0700_usb_id_table[39], NULL },
2471 { NULL },
2473 { "YUAN High-Tech MC770",
2474 { &dib0700_usb_id_table[48], NULL },
2475 { NULL },
2477 { "Leadtek WinFast DTV Dongle H",
2478 { &dib0700_usb_id_table[51], NULL },
2479 { NULL },
2481 { "YUAN High-Tech STK7700D",
2482 { &dib0700_usb_id_table[54], NULL },
2483 { NULL },
2486 .rc_interval = DEFAULT_RC_INTERVAL,
2487 .rc_key_map = dib0700_rc_keys,
2488 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2489 .rc_query = dib0700_rc_query
2490 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2491 .num_adapters = 1,
2492 .adapter = {
2494 .frontend_attach = s5h1411_frontend_attach,
2495 .tuner_attach = xc5000_tuner_attach,
2497 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2499 .size_of_priv = sizeof(struct
2500 dib0700_adapter_state),
2504 .num_device_descs = 2,
2505 .devices = {
2506 { "Pinnacle PCTV HD Pro USB Stick",
2507 { &dib0700_usb_id_table[40], NULL },
2508 { NULL },
2510 { "Pinnacle PCTV HD USB Stick",
2511 { &dib0700_usb_id_table[41], NULL },
2512 { NULL },
2515 .rc_interval = DEFAULT_RC_INTERVAL,
2516 .rc_key_map = dib0700_rc_keys,
2517 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2518 .rc_query = dib0700_rc_query
2519 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2520 .num_adapters = 1,
2521 .adapter = {
2523 .frontend_attach = lgdt3305_frontend_attach,
2524 .tuner_attach = mxl5007t_tuner_attach,
2526 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2528 .size_of_priv = sizeof(struct
2529 dib0700_adapter_state),
2533 .num_device_descs = 2,
2534 .devices = {
2535 { "Hauppauge ATSC MiniCard (B200)",
2536 { &dib0700_usb_id_table[46], NULL },
2537 { NULL },
2539 { "Hauppauge ATSC MiniCard (B210)",
2540 { &dib0700_usb_id_table[47], NULL },
2541 { NULL },
2544 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2546 .num_adapters = 1,
2547 .adapter = {
2549 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2550 .pid_filter_count = 32,
2551 .pid_filter = stk70x0p_pid_filter,
2552 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2553 .frontend_attach = stk7070p_frontend_attach,
2554 .tuner_attach = dib7770p_tuner_attach,
2556 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2558 .size_of_priv =
2559 sizeof(struct dib0700_adapter_state),
2563 .num_device_descs = 2,
2564 .devices = {
2565 { "DiBcom STK7770P reference design",
2566 { &dib0700_usb_id_table[59], NULL },
2567 { NULL },
2569 { "Terratec Cinergy T USB XXS (HD)/ T3",
2570 { &dib0700_usb_id_table[33],
2571 &dib0700_usb_id_table[52],
2572 &dib0700_usb_id_table[60], NULL},
2573 { NULL },
2576 .rc_interval = DEFAULT_RC_INTERVAL,
2577 .rc_key_map = dib0700_rc_keys,
2578 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2579 .rc_query = dib0700_rc_query
2580 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2581 .num_adapters = 1,
2582 .adapter = {
2584 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2585 .pid_filter_count = 32,
2586 .pid_filter = stk80xx_pid_filter,
2587 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
2588 .frontend_attach = stk807x_frontend_attach,
2589 .tuner_attach = dib807x_tuner_attach,
2591 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2593 .size_of_priv =
2594 sizeof(struct dib0700_adapter_state),
2598 .num_device_descs = 3,
2599 .devices = {
2600 { "DiBcom STK807xP reference design",
2601 { &dib0700_usb_id_table[62], NULL },
2602 { NULL },
2604 { "Prolink Pixelview SBTVD",
2605 { &dib0700_usb_id_table[63], NULL },
2606 { NULL },
2608 { "EvolutePC TVWay+",
2609 { &dib0700_usb_id_table[64], NULL },
2610 { NULL },
2614 .rc_interval = DEFAULT_RC_INTERVAL,
2615 .rc_key_map = dib0700_rc_keys,
2616 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2617 .rc_query = dib0700_rc_query
2619 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2620 .num_adapters = 2,
2621 .adapter = {
2623 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2624 .pid_filter_count = 32,
2625 .pid_filter = stk80xx_pid_filter,
2626 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
2627 .frontend_attach = stk807xpvr_frontend_attach0,
2628 .tuner_attach = dib807x_tuner_attach,
2630 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2632 .size_of_priv =
2633 sizeof(struct dib0700_adapter_state),
2636 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2637 .pid_filter_count = 32,
2638 .pid_filter = stk80xx_pid_filter,
2639 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
2640 .frontend_attach = stk807xpvr_frontend_attach1,
2641 .tuner_attach = dib807x_tuner_attach,
2643 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2645 .size_of_priv =
2646 sizeof(struct dib0700_adapter_state),
2650 .num_device_descs = 1,
2651 .devices = {
2652 { "DiBcom STK807xPVR reference design",
2653 { &dib0700_usb_id_table[61], NULL },
2654 { NULL },
2658 .rc_interval = DEFAULT_RC_INTERVAL,
2659 .rc_key_map = dib0700_rc_keys,
2660 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2661 .rc_query = dib0700_rc_query
2662 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2663 .num_adapters = 1,
2664 .adapter = {
2666 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
2667 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2668 .pid_filter_count = 32,
2669 .pid_filter = stk80xx_pid_filter,
2670 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
2671 .frontend_attach = stk809x_frontend_attach,
2672 .tuner_attach = dib809x_tuner_attach,
2674 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2676 .size_of_priv =
2677 sizeof(struct dib0700_adapter_state),
2681 .num_device_descs = 1,
2682 .devices = {
2683 { "DiBcom STK8096GP reference design",
2684 { &dib0700_usb_id_table[67], NULL },
2685 { NULL },
2689 .rc_interval = DEFAULT_RC_INTERVAL,
2690 .rc_key_map = dib0700_rc_keys,
2691 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2692 .rc_query = dib0700_rc_query
2696 int dib0700_device_count = ARRAY_SIZE(dib0700_devices);