1 /* Linux driver for devices based on the DiBcom DiB0700 USB bridge
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the Free
5 * Software Foundation, version 2.
7 * Copyright (C) 2005-9 DiBcom, SA et al
11 #include "dib3000mc.h"
17 #include "tuner-xc2028.h"
24 static int force_lna_activation;
25 module_param(force_lna_activation, int, 0644);
26 MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), "
27 "if applicable for the device (default: 0=automatic/off).");
29 struct dib0700_adapter_state {
30 int (*set_param_save) (struct dvb_frontend *, struct dvb_frontend_parameters *);
33 /* Hauppauge Nova-T 500 (aka Bristol)
34 * has a LNA on GPIO0 which is enabled by setting 1 */
35 static struct mt2060_config bristol_mt2060_config[2] = {
45 static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
46 .band_caps = BAND_VHF | BAND_UHF,
47 .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
67 static struct dib3000mc_config bristol_dib3000mc_config[2] = {
68 { .agc = &bristol_dib3000p_mt2060_agc_config,
70 .ln_adc_level = 0x1cc7,
71 .output_mpeg2_in_188_bytes = 1,
73 { .agc = &bristol_dib3000p_mt2060_agc_config,
75 .ln_adc_level = 0x1cc7,
76 .output_mpeg2_in_188_bytes = 1,
80 static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
82 struct dib0700_state *st = adap->dev->priv;
84 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
85 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
86 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
87 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
89 if (force_lna_activation)
90 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
92 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
94 if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {
95 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
99 st->mt2060_if1[adap->id] = 1220;
100 return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
101 (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
104 static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval)
106 struct i2c_msg msg[2] = {
107 { .addr = 0x50, .flags = 0, .buf = &adrs, .len = 1 },
108 { .addr = 0x50, .flags = I2C_M_RD, .buf = pval, .len = 1 },
110 if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO;
114 static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
116 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
117 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
120 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
121 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) {
122 if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;
124 return dvb_attach(mt2060_attach,adap->fe, tun_i2c,&bristol_mt2060_config[adap->id],
125 if1) == NULL ? -ENODEV : 0;
128 /* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
131 static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = {
133 BAND_UHF, // band_caps
135 /* 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,
136 * 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 */
137 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), // setup
170 1, // perform_agc_softsplit
172 BAND_VHF | BAND_LBAND, // band_caps
174 /* 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,
175 * 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 */
176 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
209 1, // perform_agc_softsplit
213 static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = {
214 60000, 30000, // internal, sampling
215 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
216 0, 0, 1, 1, 2, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
217 (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
222 static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {
223 { .output_mpeg2_in_188_bytes = 1,
224 .hostbus_diversity = 1,
225 .tuner_is_baseband = 1,
227 .agc_config_count = 2,
228 .agc = stk7700d_7000p_mt2266_agc_config,
229 .bw = &stk7700d_mt2266_pll_config,
231 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
232 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
233 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
235 { .output_mpeg2_in_188_bytes = 1,
236 .hostbus_diversity = 1,
237 .tuner_is_baseband = 1,
239 .agc_config_count = 2,
240 .agc = stk7700d_7000p_mt2266_agc_config,
241 .bw = &stk7700d_mt2266_pll_config,
243 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
244 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
245 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
249 static struct mt2266_config stk7700d_mt2266_config[2] = {
250 { .i2c_address = 0x60
252 { .i2c_address = 0x60
256 static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap)
259 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
261 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
262 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
263 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
264 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
266 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
268 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
269 stk7700d_dib7000p_mt2266_config)
271 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
276 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
277 &stk7700d_dib7000p_mt2266_config[adap->id]);
279 return adap->fe == NULL ? -ENODEV : 0;
282 static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap)
285 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
287 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
288 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
289 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
290 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
292 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
294 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
295 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
296 stk7700d_dib7000p_mt2266_config)
298 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
303 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
304 &stk7700d_dib7000p_mt2266_config[adap->id]);
306 return adap->fe == NULL ? -ENODEV : 0;
309 static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap)
311 struct i2c_adapter *tun_i2c;
312 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
313 return dvb_attach(mt2266_attach, adap->fe, tun_i2c,
314 &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;
317 /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
318 static struct dibx000_agc_config xc3028_agc_config = {
319 BAND_VHF | BAND_UHF, /* band_caps */
321 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
322 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
323 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
324 (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
325 (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */
328 21, /* time_stabiliz */
340 39718, /* agc2_max */
349 29, /* agc2_slope1 */
350 29, /* agc2_slope2 */
357 1, /* perform_agc_softsplit */
360 /* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
361 static struct dibx000_bandwidth_config xc3028_bw_config = {
362 60000, 30000, /* internal, sampling */
363 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
364 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc,
366 (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
367 (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
369 30000000, /* xtal_hz */
372 static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
373 .output_mpeg2_in_188_bytes = 1,
374 .tuner_is_baseband = 1,
376 .agc_config_count = 1,
377 .agc = &xc3028_agc_config,
378 .bw = &xc3028_bw_config,
380 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
381 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
382 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
385 static int stk7700ph_xc3028_callback(void *ptr, int component,
386 int command, int arg)
388 struct dvb_usb_adapter *adap = ptr;
391 case XC2028_TUNER_RESET:
392 /* Send the tuner in then out of reset */
393 dib7000p_set_gpio(adap->fe, 8, 0, 0); msleep(10);
394 dib7000p_set_gpio(adap->fe, 8, 0, 1);
396 case XC2028_RESET_CLK:
399 err("%s: unknown command %d, arg %d\n", __func__,
406 static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
407 .fname = XC2028_DEFAULT_FIRMWARE,
409 .demod = XC3028_FE_DIBCOM52,
412 static struct xc2028_config stk7700ph_xc3028_config = {
414 .ctrl = &stk7700ph_xc3028_ctrl,
417 static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
419 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;
421 if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
422 desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))
423 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
425 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
427 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
428 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
429 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
430 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
432 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
434 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
437 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
438 &stk7700ph_dib7700_xc3028_config) != 0) {
439 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
444 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
445 &stk7700ph_dib7700_xc3028_config);
447 return adap->fe == NULL ? -ENODEV : 0;
450 static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
452 struct i2c_adapter *tun_i2c;
454 tun_i2c = dib7000p_get_i2c_master(adap->fe,
455 DIBX000_I2C_INTERFACE_TUNER, 1);
457 stk7700ph_xc3028_config.i2c_adap = tun_i2c;
459 /* FIXME: generalize & move to common area */
460 adap->fe->callback = stk7700ph_xc3028_callback;
462 return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config)
463 == NULL ? -ENODEV : 0;
466 #define DEFAULT_RC_INTERVAL 50
468 static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
470 /* Number of keypresses to ignore before start repeating */
471 #define RC_REPEAT_DELAY 6
472 #define RC_REPEAT_DELAY_V1_20 10
476 /* Used by firmware versions < 1.20 (deprecated) */
477 static int dib0700_rc_query_legacy(struct dvb_usb_device *d, u32 *event,
482 struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
483 struct dib0700_state *st = d->priv;
485 *state = REMOTE_NO_KEY_PRESSED;
486 i=dib0700_ctrl_rd(d,rc_request,2,key,4);
488 err("RC Query Failed");
492 /* losing half of KEY_0 events from Philipps rc5 remotes.. */
493 if (key[0]==0 && key[1]==0 && key[2]==0 && key[3]==0) return 0;
495 /* 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]); */
497 dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */
499 switch (dvb_usb_dib0700_ir_proto) {
501 /* NEC protocol sends repeat code as 0 0 0 FF */
502 if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&
505 if (st->rc_counter > RC_REPEAT_DELAY) {
506 *event = d->last_event;
507 *state = REMOTE_KEY_PRESSED;
508 st->rc_counter = RC_REPEAT_DELAY;
512 for (i=0;i<d->props.rc_key_map_size; i++) {
513 if (rc5_custom(&keymap[i]) == key[3-2] &&
514 rc5_data(&keymap[i]) == key[3-3]) {
516 *event = keymap[i].event;
517 *state = REMOTE_KEY_PRESSED;
518 d->last_event = keymap[i].event;
525 /* RC-5 protocol changes toggle bit on new keypress */
526 for (i = 0; i < d->props.rc_key_map_size; i++) {
527 if (rc5_custom(&keymap[i]) == key[3-2] &&
528 rc5_data(&keymap[i]) == key[3-3]) {
529 if (d->last_event == keymap[i].event &&
530 key[3-1] == st->rc_toggle) {
532 /* prevents unwanted double hits */
533 if (st->rc_counter > RC_REPEAT_DELAY) {
534 *event = d->last_event;
535 *state = REMOTE_KEY_PRESSED;
536 st->rc_counter = RC_REPEAT_DELAY;
542 *event = keymap[i].event;
543 *state = REMOTE_KEY_PRESSED;
544 st->rc_toggle = key[3-1];
545 d->last_event = keymap[i].event;
552 err("Unknown remote controller key: %2X %2X %2X %2X", (int) key[3-2], (int) key[3-3], (int) key[3-1], (int) key[3]);
557 /* This is the structure of the RC response packet starting in firmware 1.20 */
558 struct dib0700_rc_response {
567 /* This supports the new IR response format for firmware v1.20 */
568 static int dib0700_rc_query_v1_20(struct dvb_usb_device *d, u32 *event,
571 struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
572 struct dib0700_state *st = d->priv;
573 struct dib0700_rc_response poll_reply;
580 /* Set initial results in case we exit the function early */
582 *state = REMOTE_NO_KEY_PRESSED;
584 /* Firmware v1.20 provides RC data via bulk endpoint 1 */
585 status = usb_bulk_msg(d->udev, usb_rcvbulkpipe(d->udev, 1), buf,
586 sizeof(buf), &actlen, 50);
588 /* No data available (meaning no key press) */
592 if (actlen != sizeof(buf)) {
593 /* We didn't get back the 6 byte message we expected */
594 err("Unexpected RC response size [%d]", actlen);
598 poll_reply.report_id = buf[0];
599 poll_reply.data_state = buf[1];
600 poll_reply.system_msb = buf[2];
601 poll_reply.system_lsb = buf[3];
602 poll_reply.data = buf[4];
603 poll_reply.not_data = buf[5];
606 info("rid=%02x ds=%02x sm=%02x sl=%02x d=%02x nd=%02x\n",
607 poll_reply.report_id, poll_reply.data_state,
608 poll_reply.system_msb, poll_reply.system_lsb,
609 poll_reply.data, poll_reply.not_data);
612 if ((poll_reply.data + poll_reply.not_data) != 0xff) {
613 /* Key failed integrity check */
614 err("key failed integrity check: %02x %02x %02x %02x",
615 poll_reply.system_msb, poll_reply.system_lsb,
616 poll_reply.data, poll_reply.not_data);
620 /* Find the key in the map */
621 for (i = 0; i < d->props.rc_key_map_size; i++) {
622 if (rc5_custom(&keymap[i]) == poll_reply.system_lsb &&
623 rc5_data(&keymap[i]) == poll_reply.data) {
624 *event = keymap[i].event;
631 err("Unknown remote controller key: %02x %02x %02x %02x",
632 poll_reply.system_msb, poll_reply.system_lsb,
633 poll_reply.data, poll_reply.not_data);
638 if (poll_reply.data_state == 1) {
641 *event = keymap[i].event;
642 *state = REMOTE_KEY_PRESSED;
643 d->last_event = keymap[i].event;
644 } else if (poll_reply.data_state == 2) {
648 /* prevents unwanted double hits */
649 if (st->rc_counter > RC_REPEAT_DELAY_V1_20) {
650 *event = d->last_event;
651 *state = REMOTE_KEY_PRESSED;
652 st->rc_counter = RC_REPEAT_DELAY_V1_20;
655 err("Unknown data state [%d]", poll_reply.data_state);
661 static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
663 struct dib0700_state *st = d->priv;
665 /* Because some people may have improperly named firmware files,
666 let's figure out whether to use the new firmware call or the legacy
667 call based on the firmware version embedded in the file */
668 if (st->rc_func_version == 0) {
669 u32 hwver, romver, ramver, fwtype;
670 int ret = dib0700_get_version(d, &hwver, &romver, &ramver,
673 err("Could not determine version info");
676 if (ramver < 0x10200)
677 st->rc_func_version = 1;
679 st->rc_func_version = 2;
682 if (st->rc_func_version == 2)
683 return dib0700_rc_query_v1_20(d, event, state);
685 return dib0700_rc_query_legacy(d, event, state);
688 static struct dvb_usb_rc_key dib0700_rc_keys[] = {
689 /* Key codes for the tiny Pinnacle remote*/
690 { 0x0700, KEY_MUTE },
691 { 0x0701, KEY_MENU }, /* Pinnacle logo */
692 { 0x0739, KEY_POWER },
693 { 0x0703, KEY_VOLUMEUP },
694 { 0x0709, KEY_VOLUMEDOWN },
695 { 0x0706, KEY_CHANNELUP },
696 { 0x070c, KEY_CHANNELDOWN },
707 { 0x0724, KEY_SCREEN }, /* 'Square' key */
708 { 0x072a, KEY_TEXT }, /* 'T' key */
709 { 0x072d, KEY_REWIND },
710 { 0x0730, KEY_PLAY },
711 { 0x0733, KEY_FASTFORWARD },
712 { 0x0736, KEY_RECORD },
713 { 0x073c, KEY_STOP },
714 { 0x073f, KEY_CANCEL }, /* '?' key */
715 /* Key codes for the Terratec Cinergy DT XS Diversity, similar to cinergyT2.c */
716 { 0xeb01, KEY_POWER },
726 { 0xeb0b, KEY_VIDEO },
728 { 0xeb0d, KEY_REFRESH },
731 { 0xeb11, KEY_LEFT },
733 { 0xeb13, KEY_RIGHT },
734 { 0xeb14, KEY_DOWN },
735 { 0xeb16, KEY_INFO },
737 { 0xeb18, KEY_GREEN },
738 { 0xeb19, KEY_YELLOW },
739 { 0xeb1a, KEY_BLUE },
740 { 0xeb1b, KEY_CHANNELUP },
741 { 0xeb1c, KEY_VOLUMEUP },
742 { 0xeb1d, KEY_MUTE },
743 { 0xeb1e, KEY_VOLUMEDOWN },
744 { 0xeb1f, KEY_CHANNELDOWN },
745 { 0xeb40, KEY_PAUSE },
746 { 0xeb41, KEY_HOME },
747 { 0xeb42, KEY_MENU }, /* DVD Menu */
748 { 0xeb43, KEY_SUBTITLE },
749 { 0xeb44, KEY_TEXT }, /* Teletext */
750 { 0xeb45, KEY_DELETE },
753 { 0xeb48, KEY_STOP },
754 { 0xeb49, KEY_VIDEO },
755 { 0xeb4a, KEY_AUDIO }, /* Music */
756 { 0xeb4b, KEY_SCREEN }, /* Pic */
757 { 0xeb4c, KEY_PLAY },
758 { 0xeb4d, KEY_BACK },
759 { 0xeb4e, KEY_REWIND },
760 { 0xeb4f, KEY_FASTFORWARD },
761 { 0xeb54, KEY_PREVIOUS },
762 { 0xeb58, KEY_RECORD },
763 { 0xeb5c, KEY_NEXT },
765 /* Key codes for the Haupauge WinTV Nova-TD, copied from nova-t-usb2.c (Nova-T USB2) */
776 { 0x1e0a, KEY_KPASTERISK },
778 { 0x1e0c, KEY_RADIO },
779 { 0x1e0d, KEY_MENU },
780 { 0x1e0e, KEY_GRAVE }, /* # */
781 { 0x1e0f, KEY_MUTE },
782 { 0x1e10, KEY_VOLUMEUP },
783 { 0x1e11, KEY_VOLUMEDOWN },
784 { 0x1e12, KEY_CHANNEL },
786 { 0x1e15, KEY_DOWN },
787 { 0x1e16, KEY_LEFT },
788 { 0x1e17, KEY_RIGHT },
789 { 0x1e18, KEY_VIDEO },
790 { 0x1e19, KEY_AUDIO },
791 { 0x1e1a, KEY_MEDIA },
794 { 0x1e1e, KEY_NEXT },
795 { 0x1e1f, KEY_BACK },
796 { 0x1e20, KEY_CHANNELUP },
797 { 0x1e21, KEY_CHANNELDOWN },
798 { 0x1e24, KEY_LAST }, /* Skip backwards */
801 { 0x1e2e, KEY_GREEN },
802 { 0x1e30, KEY_PAUSE },
803 { 0x1e32, KEY_REWIND },
804 { 0x1e34, KEY_FASTFORWARD },
805 { 0x1e35, KEY_PLAY },
806 { 0x1e36, KEY_STOP },
807 { 0x1e37, KEY_RECORD },
808 { 0x1e38, KEY_YELLOW },
809 { 0x1e3b, KEY_GOTO },
810 { 0x1e3d, KEY_POWER },
812 /* Key codes for the Leadtek Winfast DTV Dongle */
813 { 0x0042, KEY_POWER },
814 { 0x077c, KEY_TUNER },
815 { 0x0f4e, KEY_PRINT }, /* PREVIEW */
816 { 0x0840, KEY_SCREEN }, /* full screen toggle*/
817 { 0x0f71, KEY_DOT }, /* frequency */
828 { 0x0e4e, KEY_CLEAR },
829 { 0x047c, KEY_CHANNEL }, /* show channel number */
830 { 0x0f41, KEY_LAST }, /* recall */
831 { 0x0342, KEY_MUTE },
832 { 0x064c, KEY_RESERVED }, /* PIP button*/
833 { 0x0172, KEY_SHUFFLE }, /* SNAPSHOT */
834 { 0x0c4e, KEY_PLAYPAUSE }, /* TIMESHIFT */
835 { 0x0b70, KEY_RECORD },
836 { 0x037d, KEY_VOLUMEUP },
837 { 0x017d, KEY_VOLUMEDOWN },
838 { 0x0242, KEY_CHANNELUP },
839 { 0x007d, KEY_CHANNELDOWN },
841 /* Key codes for Nova-TD "credit card" remote control. */
852 { 0x1d0a, KEY_TEXT },
853 { 0x1d0d, KEY_MENU },
854 { 0x1d0f, KEY_MUTE },
855 { 0x1d10, KEY_VOLUMEUP },
856 { 0x1d11, KEY_VOLUMEDOWN },
857 { 0x1d12, KEY_CHANNEL },
859 { 0x1d15, KEY_DOWN },
860 { 0x1d16, KEY_LEFT },
861 { 0x1d17, KEY_RIGHT },
863 { 0x1d1e, KEY_NEXT },
864 { 0x1d1f, KEY_BACK },
865 { 0x1d20, KEY_CHANNELUP },
866 { 0x1d21, KEY_CHANNELDOWN },
867 { 0x1d24, KEY_LAST },
869 { 0x1d30, KEY_PAUSE },
870 { 0x1d32, KEY_REWIND },
871 { 0x1d34, KEY_FASTFORWARD },
872 { 0x1d35, KEY_PLAY },
873 { 0x1d36, KEY_STOP },
874 { 0x1d37, KEY_RECORD },
875 { 0x1d3b, KEY_GOTO },
876 { 0x1d3d, KEY_POWER },
879 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
880 static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
881 BAND_UHF | BAND_VHF, // band_caps
883 /* 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,
884 * 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 */
885 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
917 1, // perform_agc_softsplit
920 51800, // global_split_min
921 24700 // global_split_max
925 static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
928 /* 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,
929 * 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 */
930 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
967 0, // perform_agc_softsplit
970 static struct dibx000_bandwidth_config stk7700p_pll_config = {
971 60000, 30000, // internal, sampling
972 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
973 0, 0, 1, 1, 0, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
974 (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
980 static struct dib7000m_config stk7700p_dib7000m_config = {
982 .output_mpeg2_in_188_bytes = 1,
985 .agc_config_count = 1,
986 .agc = &stk7700p_7000m_mt2060_agc_config,
987 .bw = &stk7700p_pll_config,
989 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
990 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
991 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
994 static struct dib7000p_config stk7700p_dib7000p_config = {
995 .output_mpeg2_in_188_bytes = 1,
997 .agc_config_count = 1,
998 .agc = &stk7700p_7000p_mt2060_agc_config,
999 .bw = &stk7700p_pll_config,
1001 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
1002 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
1003 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
1006 static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
1008 struct dib0700_state *st = adap->dev->priv;
1009 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
1011 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1012 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
1014 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
1015 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1017 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
1018 dib0700_ctrl_clock(adap->dev, 72, 1);
1019 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
1021 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1023 st->mt2060_if1[0] = 1220;
1025 if (dib7000pc_detection(&adap->dev->i2c_adap)) {
1026 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
1027 st->is_dib7000pc = 1;
1029 adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
1031 return adap->fe == NULL ? -ENODEV : 0;
1034 static struct mt2060_config stk7700p_mt2060_config = {
1038 static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
1040 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
1041 struct dib0700_state *st = adap->dev->priv;
1042 struct i2c_adapter *tun_i2c;
1045 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
1046 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
1047 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
1049 if (st->is_dib7000pc)
1050 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1052 tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1054 return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config,
1055 if1) == NULL ? -ENODEV : 0;
1058 /* DIB7070 generic */
1059 static struct dibx000_agc_config dib7070_agc_config = {
1060 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
1061 /* 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,
1062 * 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 */
1063 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), // setup
1066 10, // time_stabiliz
1097 0, // perform_agc_softsplit
1100 static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
1102 deb_info("reset: %d", onoff);
1103 return dib7000p_set_gpio(fe, 8, 0, !onoff);
1106 static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
1108 deb_info("sleep: %d", onoff);
1109 return dib7000p_set_gpio(fe, 9, 0, onoff);
1112 static struct dib0070_config dib7070p_dib0070_config[2] = {
1114 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1115 .reset = dib7070_tuner_reset,
1116 .sleep = dib7070_tuner_sleep,
1118 .clock_pad_drive = 4,
1121 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1122 .reset = dib7070_tuner_reset,
1123 .sleep = dib7070_tuner_sleep,
1129 static struct dib0070_config dib7770p_dib0070_config = {
1130 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1131 .reset = dib7070_tuner_reset,
1132 .sleep = dib7070_tuner_sleep,
1134 .clock_pad_drive = 0,
1138 static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
1140 struct dvb_usb_adapter *adap = fe->dvb->priv;
1141 struct dib0700_adapter_state *state = adap->priv;
1144 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1146 case BAND_VHF: offset = 950; break;
1148 default: offset = 550; break;
1150 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
1151 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1152 return state->set_param_save(fe, fep);
1155 static int dib7770_set_param_override(struct dvb_frontend *fe,
1156 struct dvb_frontend_parameters *fep)
1158 struct dvb_usb_adapter *adap = fe->dvb->priv;
1159 struct dib0700_adapter_state *state = adap->priv;
1162 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1165 dib7000p_set_gpio(fe, 0, 0, 1);
1170 dib7000p_set_gpio(fe, 0, 0, 0);
1174 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
1175 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1176 return state->set_param_save(fe, fep);
1179 static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
1181 struct dib0700_adapter_state *st = adap->priv;
1182 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe,
1183 DIBX000_I2C_INTERFACE_TUNER, 1);
1185 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1186 &dib7770p_dib0070_config) == NULL)
1189 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1190 adap->fe->ops.tuner_ops.set_params = dib7770_set_param_override;
1194 static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
1196 struct dib0700_adapter_state *st = adap->priv;
1197 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1199 if (adap->id == 0) {
1200 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
1203 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
1207 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1208 adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override;
1212 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
1213 60000, 15000, // internal, sampling
1214 1, 20, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
1215 0, 0, 1, 1, 2, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
1216 (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
1217 (0 << 25) | 0, // ifreq = 0.000000 MHz
1219 12000000, // xtal_hz
1222 static struct dib7000p_config dib7070p_dib7000p_config = {
1223 .output_mpeg2_in_188_bytes = 1,
1225 .agc_config_count = 1,
1226 .agc = &dib7070_agc_config,
1227 .bw = &dib7070_bw_config_12_mhz,
1228 .tuner_is_baseband = 1,
1231 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1232 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1233 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1235 .hostbus_diversity = 1,
1239 static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
1241 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
1242 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
1243 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
1244 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1246 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1248 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1249 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1250 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1251 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1253 dib0700_ctrl_clock(adap->dev, 72, 1);
1256 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1258 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1260 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1261 &dib7070p_dib7000p_config) != 0) {
1262 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1267 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
1268 &dib7070p_dib7000p_config);
1269 return adap->fe == NULL ? -ENODEV : 0;
1272 /* DIB807x generic */
1273 static struct dibx000_agc_config dib807x_agc_config[2] = {
1276 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1277 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1278 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1279 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1281 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1282 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1283 (0 << 0), /* setup*/
1286 10, /* time_stabiliz*/
1296 65535, /* agc1_max*/
1299 65535, /* agc2_max*/
1305 206, /* agc1_slope1*/
1306 255, /* agc1_slope2*/
1309 88, /* agc2_slope1*/
1310 90, /* agc2_slope2*/
1317 0, /* perform_agc_softsplit*/
1320 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1321 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1322 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1323 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1325 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1326 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1327 (0 << 0), /* setup */
1330 10, /* time_stabiliz*/
1340 65535, /* agc1_max*/
1343 65535, /* agc2_max*/
1349 206, /* agc1_slope1*/
1350 255, /* agc1_slope2*/
1353 88, /* agc2_slope1*/
1354 90, /* agc2_slope2*/
1361 0, /* perform_agc_softsplit*/
1365 static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
1366 60000, 15000, /* internal, sampling*/
1367 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/
1368 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
1370 (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1371 (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1373 12000000, /* xtal_hz*/
1376 static struct dib8000_config dib807x_dib8000_config[2] = {
1378 .output_mpeg2_in_188_bytes = 1,
1380 .agc_config_count = 2,
1381 .agc = dib807x_agc_config,
1382 .pll = &dib807x_bw_config_12_mhz,
1383 .tuner_is_baseband = 1,
1385 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1386 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1387 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1389 .hostbus_diversity = 1,
1391 .agc_control = &dib0070_ctrl_agc_filter,
1392 .output_mode = OUTMODE_MPEG2_FIFO,
1395 .output_mpeg2_in_188_bytes = 1,
1397 .agc_config_count = 2,
1398 .agc = dib807x_agc_config,
1399 .pll = &dib807x_bw_config_12_mhz,
1400 .tuner_is_baseband = 1,
1402 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1403 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1404 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1406 .hostbus_diversity = 1,
1407 .agc_control = &dib0070_ctrl_agc_filter,
1408 .output_mode = OUTMODE_MPEG2_FIFO,
1413 static int dib807x_tuner_reset(struct dvb_frontend *fe, int onoff)
1415 return dib8000_set_gpio(fe, 5, 0, !onoff);
1418 static int dib807x_tuner_sleep(struct dvb_frontend *fe, int onoff)
1420 return dib8000_set_gpio(fe, 0, 0, onoff);
1423 static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
1428 static struct dib0070_config dib807x_dib0070_config[2] = {
1430 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1431 .reset = dib807x_tuner_reset,
1432 .sleep = dib807x_tuner_sleep,
1434 .clock_pad_drive = 4,
1436 .force_crystal_mode = 1,
1437 .enable_third_order_filter = 1,
1439 .wbd_gain = dib8070_wbd_gain_cfg,
1440 .osc_buffer_state = 0,
1441 .freq_offset_khz_uhf = -100,
1442 .freq_offset_khz_vhf = -100,
1444 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1445 .reset = dib807x_tuner_reset,
1446 .sleep = dib807x_tuner_sleep,
1448 .clock_pad_drive = 2,
1450 .force_crystal_mode = 1,
1451 .enable_third_order_filter = 1,
1453 .wbd_gain = dib8070_wbd_gain_cfg,
1454 .osc_buffer_state = 0,
1455 .freq_offset_khz_uhf = -25,
1456 .freq_offset_khz_vhf = -25,
1460 static int dib807x_set_param_override(struct dvb_frontend *fe,
1461 struct dvb_frontend_parameters *fep)
1463 struct dvb_usb_adapter *adap = fe->dvb->priv;
1464 struct dib0700_adapter_state *state = adap->priv;
1466 u16 offset = dib0070_wbd_offset(fe);
1467 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1472 case BAND_UHF: /* fall-thru wanted */
1474 offset += 250; break;
1476 deb_info("WBD for DiB8000: %d\n", offset);
1477 dib8000_set_wbd_ref(fe, offset);
1479 return state->set_param_save(fe, fep);
1482 static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1484 struct dib0700_adapter_state *st = adap->priv;
1485 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe,
1486 DIBX000_I2C_INTERFACE_TUNER, 1);
1488 if (adap->id == 0) {
1489 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1490 &dib807x_dib0070_config[0]) == NULL)
1493 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1494 &dib807x_dib0070_config[1]) == NULL)
1498 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1499 adap->fe->ops.tuner_ops.set_params = dib807x_set_param_override;
1505 static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
1507 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1509 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1510 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1511 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1513 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1515 dib0700_ctrl_clock(adap->dev, 72, 1);
1518 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1520 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1522 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1525 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1526 &dib807x_dib8000_config[0]);
1528 return adap->fe == NULL ? -ENODEV : 0;
1532 static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
1534 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1536 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1538 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1539 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1540 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1542 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1544 dib0700_ctrl_clock(adap->dev, 72, 1);
1547 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1549 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1551 /* initialize IC 0 */
1552 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x80);
1554 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1555 &dib807x_dib8000_config[0]);
1557 return adap->fe == NULL ? -ENODEV : 0;
1560 static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
1562 /* initialize IC 1 */
1563 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x82);
1565 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82,
1566 &dib807x_dib8000_config[1]);
1568 return adap->fe == NULL ? -ENODEV : 0;
1573 static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
1575 .output_mpeg2_in_188_bytes = 1,
1577 .agc_config_count = 1,
1578 .agc = &dib7070_agc_config,
1579 .bw = &dib7070_bw_config_12_mhz,
1580 .tuner_is_baseband = 1,
1583 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1584 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1585 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1587 .hostbus_diversity = 1,
1589 .output_mpeg2_in_188_bytes = 1,
1591 .agc_config_count = 1,
1592 .agc = &dib7070_agc_config,
1593 .bw = &dib7070_bw_config_12_mhz,
1594 .tuner_is_baseband = 1,
1597 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1598 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1599 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1601 .hostbus_diversity = 1,
1605 static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
1607 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1609 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1610 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1611 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1612 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1614 dib0700_ctrl_clock(adap->dev, 72, 1);
1617 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1619 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1621 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
1622 stk7070pd_dib7000p_config) != 0) {
1623 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1628 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
1629 return adap->fe == NULL ? -ENODEV : 0;
1632 static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
1634 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
1635 return adap->fe == NULL ? -ENODEV : 0;
1639 static struct s5h1411_config pinnacle_801e_config = {
1640 .output_mode = S5H1411_PARALLEL_OUTPUT,
1641 .gpio = S5H1411_GPIO_OFF,
1642 .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
1643 .qam_if = S5H1411_IF_44000,
1644 .vsb_if = S5H1411_IF_44000,
1645 .inversion = S5H1411_INVERSION_OFF,
1646 .status_mode = S5H1411_DEMODLOCKING
1649 /* Pinnacle PCTV HD Pro 801e GPIOs map:
1650 GPIO0 - currently unknown
1651 GPIO1 - xc5000 tuner reset
1652 GPIO2 - CX25843 sleep
1653 GPIO3 - currently unknown
1654 GPIO4 - currently unknown
1655 GPIO6 - currently unknown
1656 GPIO7 - currently unknown
1657 GPIO9 - currently unknown
1658 GPIO10 - CX25843 reset
1660 static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
1662 struct dib0700_state *st = adap->dev->priv;
1664 /* Make use of the new i2c functions from FW 1.20 */
1665 st->fw_use_new_i2c_api = 1;
1667 /* The s5h1411 requires the dib0700 to not be in master mode */
1668 st->disable_streaming_master_mode = 1;
1670 /* All msleep values taken from Windows USB trace */
1671 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
1672 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
1673 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1675 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1677 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1679 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1680 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1681 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1682 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1683 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
1686 /* Put the CX25843 to sleep for now since we're in digital mode */
1687 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
1689 /* GPIOs are initialized, do the attach */
1690 adap->fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
1691 &adap->dev->i2c_adap);
1692 return adap->fe == NULL ? -ENODEV : 0;
1695 static int dib0700_xc5000_tuner_callback(void *priv, int component,
1696 int command, int arg)
1698 struct dvb_usb_adapter *adap = priv;
1700 if (command == XC5000_TUNER_RESET) {
1701 /* Reset the tuner */
1702 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
1704 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
1707 err("xc5000: unknown tuner callback command: %d\n", command);
1714 static struct xc5000_config s5h1411_xc5000_tunerconfig = {
1715 .i2c_address = 0x64,
1719 static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
1721 /* FIXME: generalize & move to common area */
1722 adap->fe->callback = dib0700_xc5000_tuner_callback;
1724 return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap,
1725 &s5h1411_xc5000_tunerconfig)
1726 == NULL ? -ENODEV : 0;
1729 static struct lgdt3305_config hcw_lgdt3305_config = {
1731 .mpeg_mode = LGDT3305_MPEG_PARALLEL,
1732 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
1733 .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
1735 .spectral_inversion = 1,
1738 .usref_8vsb = 0x0500,
1741 static struct mxl5007t_config hcw_mxl5007t_config = {
1742 .xtal_freq_hz = MxL_XTAL_25_MHZ,
1743 .if_freq_hz = MxL_IF_6_MHZ,
1748 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
1749 GPIO1 - ANT_SEL (H: VPA, L: MCX)
1755 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
1757 static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
1759 struct dib0700_state *st = adap->dev->priv;
1761 /* Make use of the new i2c functions from FW 1.20 */
1762 st->fw_use_new_i2c_api = 1;
1764 st->disable_streaming_master_mode = 1;
1766 /* fe power enable */
1767 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1769 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1773 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1775 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1777 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1780 adap->fe = dvb_attach(lgdt3305_attach,
1781 &hcw_lgdt3305_config,
1782 &adap->dev->i2c_adap);
1784 return adap->fe == NULL ? -ENODEV : 0;
1787 static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
1789 return dvb_attach(mxl5007t_attach, adap->fe,
1790 &adap->dev->i2c_adap, 0x60,
1791 &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
1795 /* DVB-USB and USB stuff follows */
1796 struct usb_device_id dib0700_usb_id_table[] = {
1797 /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
1798 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
1799 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
1800 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
1801 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
1802 /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
1803 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
1804 { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
1805 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
1806 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
1807 /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
1808 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
1809 { USB_DEVICE(USB_VID_TERRATEC,
1810 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
1811 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
1812 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
1813 /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
1814 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
1815 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
1816 { USB_DEVICE(USB_VID_PINNACLE,
1817 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
1818 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
1819 /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
1820 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
1821 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
1822 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
1823 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
1824 /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
1825 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
1826 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
1827 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
1828 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
1829 /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
1830 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
1831 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
1832 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
1833 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
1834 /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
1835 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
1836 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
1837 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
1838 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
1839 /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
1840 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
1841 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
1842 { USB_DEVICE(USB_VID_TERRATEC,
1843 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
1844 { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
1845 /* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
1846 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
1847 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
1848 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
1849 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
1850 /* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
1851 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
1852 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
1853 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
1854 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
1855 /* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
1856 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
1857 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
1858 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
1859 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
1860 /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
1861 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
1862 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
1863 { USB_DEVICE(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD) },
1864 { 0 } /* Terminating entry */
1866 MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
1868 #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
1869 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
1870 .usb_ctrl = DEVICE_SPECIFIC, \
1871 .firmware = "dvb-usb-dib0700-1.20.fw", \
1872 .download_firmware = dib0700_download_firmware, \
1873 .no_reconnect = 1, \
1874 .size_of_priv = sizeof(struct dib0700_state), \
1875 .i2c_algo = &dib0700_i2c_algo, \
1876 .identify_state = dib0700_identify_state
1878 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
1879 .streaming_ctrl = dib0700_streaming_ctrl, \
1886 .buffersize = 39480, \
1891 struct dvb_usb_device_properties dib0700_devices[] = {
1893 DIB0700_DEFAULT_DEVICE_PROPERTIES,
1898 .frontend_attach = stk7700p_frontend_attach,
1899 .tuner_attach = stk7700p_tuner_attach,
1901 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
1905 .num_device_descs = 8,
1907 { "DiBcom STK7700P reference design",
1908 { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
1911 { "Hauppauge Nova-T Stick",
1912 { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
1915 { "AVerMedia AVerTV DVB-T Volar",
1916 { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
1919 { "Compro Videomate U500",
1920 { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
1923 { "Uniwill STK7700P based (Hama and others)",
1924 { &dib0700_usb_id_table[7], NULL },
1927 { "Leadtek Winfast DTV Dongle (STK7700P based)",
1928 { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
1931 { "AVerMedia AVerTV DVB-T Express",
1932 { &dib0700_usb_id_table[20] },
1936 { &dib0700_usb_id_table[21], NULL },
1941 .rc_interval = DEFAULT_RC_INTERVAL,
1942 .rc_key_map = dib0700_rc_keys,
1943 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
1944 .rc_query = dib0700_rc_query
1945 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
1950 .frontend_attach = bristol_frontend_attach,
1951 .tuner_attach = bristol_tuner_attach,
1953 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
1955 .frontend_attach = bristol_frontend_attach,
1956 .tuner_attach = bristol_tuner_attach,
1958 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
1962 .num_device_descs = 1,
1964 { "Hauppauge Nova-T 500 Dual DVB-T",
1965 { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
1970 .rc_interval = DEFAULT_RC_INTERVAL,
1971 .rc_key_map = dib0700_rc_keys,
1972 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
1973 .rc_query = dib0700_rc_query
1974 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
1979 .frontend_attach = stk7700d_frontend_attach,
1980 .tuner_attach = stk7700d_tuner_attach,
1982 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
1984 .frontend_attach = stk7700d_frontend_attach,
1985 .tuner_attach = stk7700d_tuner_attach,
1987 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
1991 .num_device_descs = 5,
1993 { "Pinnacle PCTV 2000e",
1994 { &dib0700_usb_id_table[11], NULL },
1997 { "Terratec Cinergy DT XS Diversity",
1998 { &dib0700_usb_id_table[12], NULL },
2001 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
2002 { &dib0700_usb_id_table[13], NULL },
2005 { "DiBcom STK7700D reference design",
2006 { &dib0700_usb_id_table[14], NULL },
2009 { "YUAN High-Tech DiBcom STK7700D",
2010 { &dib0700_usb_id_table[55], NULL },
2016 .rc_interval = DEFAULT_RC_INTERVAL,
2017 .rc_key_map = dib0700_rc_keys,
2018 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2019 .rc_query = dib0700_rc_query
2021 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2026 .frontend_attach = stk7700P2_frontend_attach,
2027 .tuner_attach = stk7700d_tuner_attach,
2029 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2033 .num_device_descs = 3,
2035 { "ASUS My Cinema U3000 Mini DVBT Tuner",
2036 { &dib0700_usb_id_table[23], NULL },
2040 { &dib0700_usb_id_table[31], NULL },
2043 { "Terratec Cinergy T Express",
2044 { &dib0700_usb_id_table[42], NULL },
2049 .rc_interval = DEFAULT_RC_INTERVAL,
2050 .rc_key_map = dib0700_rc_keys,
2051 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2052 .rc_query = dib0700_rc_query
2053 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2058 .frontend_attach = stk7070p_frontend_attach,
2059 .tuner_attach = dib7070p_tuner_attach,
2061 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2063 .size_of_priv = sizeof(struct dib0700_adapter_state),
2067 .num_device_descs = 11,
2069 { "DiBcom STK7070P reference design",
2070 { &dib0700_usb_id_table[15], NULL },
2073 { "Pinnacle PCTV DVB-T Flash Stick",
2074 { &dib0700_usb_id_table[16], NULL },
2077 { "Artec T14BR DVB-T",
2078 { &dib0700_usb_id_table[22], NULL },
2081 { "ASUS My Cinema U3100 Mini DVBT Tuner",
2082 { &dib0700_usb_id_table[24], NULL },
2085 { "Hauppauge Nova-T Stick",
2086 { &dib0700_usb_id_table[25], NULL },
2089 { "Hauppauge Nova-T MyTV.t",
2090 { &dib0700_usb_id_table[26], NULL },
2093 { "Pinnacle PCTV 72e",
2094 { &dib0700_usb_id_table[29], NULL },
2097 { "Pinnacle PCTV 73e",
2098 { &dib0700_usb_id_table[30], NULL },
2101 { "Elgato EyeTV DTT",
2102 { &dib0700_usb_id_table[49], NULL },
2106 { &dib0700_usb_id_table[45], NULL },
2109 { "Elgato EyeTV Dtt Dlx PD378S",
2110 { &dib0700_usb_id_table[50], NULL },
2115 .rc_interval = DEFAULT_RC_INTERVAL,
2116 .rc_key_map = dib0700_rc_keys,
2117 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2118 .rc_query = dib0700_rc_query
2120 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2125 .frontend_attach = stk7070p_frontend_attach,
2126 .tuner_attach = dib7070p_tuner_attach,
2128 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2130 .size_of_priv = sizeof(struct dib0700_adapter_state),
2134 .num_device_descs = 3,
2136 { "Pinnacle PCTV 73A",
2137 { &dib0700_usb_id_table[56], NULL },
2140 { "Pinnacle PCTV 73e SE",
2141 { &dib0700_usb_id_table[57], NULL },
2144 { "Pinnacle PCTV 282e",
2145 { &dib0700_usb_id_table[58], NULL },
2150 .rc_interval = DEFAULT_RC_INTERVAL,
2151 .rc_key_map = dib0700_rc_keys,
2152 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2153 .rc_query = dib0700_rc_query
2155 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2160 .frontend_attach = stk7070pd_frontend_attach0,
2161 .tuner_attach = dib7070p_tuner_attach,
2163 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2165 .size_of_priv = sizeof(struct dib0700_adapter_state),
2167 .frontend_attach = stk7070pd_frontend_attach1,
2168 .tuner_attach = dib7070p_tuner_attach,
2170 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2172 .size_of_priv = sizeof(struct dib0700_adapter_state),
2176 .num_device_descs = 6,
2178 { "DiBcom STK7070PD reference design",
2179 { &dib0700_usb_id_table[17], NULL },
2182 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
2183 { &dib0700_usb_id_table[18], NULL },
2186 { "Hauppauge Nova-TD Stick (52009)",
2187 { &dib0700_usb_id_table[35], NULL },
2190 { "Hauppauge Nova-TD-500 (84xxx)",
2191 { &dib0700_usb_id_table[36], NULL },
2194 { "Terratec Cinergy DT USB XS Diversity/ T5",
2195 { &dib0700_usb_id_table[43],
2196 &dib0700_usb_id_table[53], NULL},
2200 { &dib0700_usb_id_table[44], NULL },
2204 .rc_interval = DEFAULT_RC_INTERVAL,
2205 .rc_key_map = dib0700_rc_keys,
2206 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2207 .rc_query = dib0700_rc_query
2208 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2213 .frontend_attach = stk7700ph_frontend_attach,
2214 .tuner_attach = stk7700ph_tuner_attach,
2216 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2218 .size_of_priv = sizeof(struct
2219 dib0700_adapter_state),
2223 .num_device_descs = 9,
2225 { "Terratec Cinergy HT USB XE",
2226 { &dib0700_usb_id_table[27], NULL },
2229 { "Pinnacle Expresscard 320cx",
2230 { &dib0700_usb_id_table[28], NULL },
2233 { "Terratec Cinergy HT Express",
2234 { &dib0700_usb_id_table[32], NULL },
2237 { "Gigabyte U8000-RH",
2238 { &dib0700_usb_id_table[37], NULL },
2241 { "YUAN High-Tech STK7700PH",
2242 { &dib0700_usb_id_table[38], NULL },
2245 { "Asus My Cinema-U3000Hybrid",
2246 { &dib0700_usb_id_table[39], NULL },
2249 { "YUAN High-Tech MC770",
2250 { &dib0700_usb_id_table[48], NULL },
2253 { "Leadtek WinFast DTV Dongle H",
2254 { &dib0700_usb_id_table[51], NULL },
2257 { "YUAN High-Tech STK7700D",
2258 { &dib0700_usb_id_table[54], NULL },
2262 .rc_interval = DEFAULT_RC_INTERVAL,
2263 .rc_key_map = dib0700_rc_keys,
2264 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2265 .rc_query = dib0700_rc_query
2266 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2270 .frontend_attach = s5h1411_frontend_attach,
2271 .tuner_attach = xc5000_tuner_attach,
2273 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2275 .size_of_priv = sizeof(struct
2276 dib0700_adapter_state),
2280 .num_device_descs = 2,
2282 { "Pinnacle PCTV HD Pro USB Stick",
2283 { &dib0700_usb_id_table[40], NULL },
2286 { "Pinnacle PCTV HD USB Stick",
2287 { &dib0700_usb_id_table[41], NULL },
2291 .rc_interval = DEFAULT_RC_INTERVAL,
2292 .rc_key_map = dib0700_rc_keys,
2293 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2294 .rc_query = dib0700_rc_query
2295 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2299 .frontend_attach = lgdt3305_frontend_attach,
2300 .tuner_attach = mxl5007t_tuner_attach,
2302 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2304 .size_of_priv = sizeof(struct
2305 dib0700_adapter_state),
2309 .num_device_descs = 2,
2311 { "Hauppauge ATSC MiniCard (B200)",
2312 { &dib0700_usb_id_table[46], NULL },
2315 { "Hauppauge ATSC MiniCard (B210)",
2316 { &dib0700_usb_id_table[47], NULL },
2320 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2325 .frontend_attach = stk7070p_frontend_attach,
2326 .tuner_attach = dib7770p_tuner_attach,
2328 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2331 sizeof(struct dib0700_adapter_state),
2335 .num_device_descs = 2,
2337 { "DiBcom STK7770P reference design",
2338 { &dib0700_usb_id_table[59], NULL },
2341 { "Terratec Cinergy T USB XXS (HD)/ T3",
2342 { &dib0700_usb_id_table[33],
2343 &dib0700_usb_id_table[52],
2344 &dib0700_usb_id_table[60], NULL},
2348 .rc_interval = DEFAULT_RC_INTERVAL,
2349 .rc_key_map = dib0700_rc_keys,
2350 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2351 .rc_query = dib0700_rc_query
2352 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2356 .frontend_attach = stk807x_frontend_attach,
2357 .tuner_attach = dib807x_tuner_attach,
2359 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2362 sizeof(struct dib0700_adapter_state),
2366 .num_device_descs = 2,
2368 { "DiBcom STK807xP reference design",
2369 { &dib0700_usb_id_table[62], NULL },
2372 { "Prolink Pixelview SBTVD",
2373 { &dib0700_usb_id_table[63], NULL },
2378 .rc_interval = DEFAULT_RC_INTERVAL,
2379 .rc_key_map = dib0700_rc_keys,
2380 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2381 .rc_query = dib0700_rc_query
2383 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2387 .frontend_attach = stk807xpvr_frontend_attach0,
2388 .tuner_attach = dib807x_tuner_attach,
2390 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2393 sizeof(struct dib0700_adapter_state),
2396 .frontend_attach = stk807xpvr_frontend_attach1,
2397 .tuner_attach = dib807x_tuner_attach,
2399 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2402 sizeof(struct dib0700_adapter_state),
2406 .num_device_descs = 1,
2408 { "DiBcom STK807xPVR reference design",
2409 { &dib0700_usb_id_table[61], NULL },
2414 .rc_interval = DEFAULT_RC_INTERVAL,
2415 .rc_key_map = dib0700_rc_keys,
2416 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2417 .rc_query = dib0700_rc_query
2421 int dib0700_device_count = ARRAY_SIZE(dib0700_devices);