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 {
566 /* This supports the new IR response format for firmware v1.20 */
567 static int dib0700_rc_query_v1_20(struct dvb_usb_device *d, u32 *event,
570 struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
571 struct dib0700_state *st = d->priv;
572 struct dib0700_rc_response poll_reply;
579 /* Set initial results in case we exit the function early */
581 *state = REMOTE_NO_KEY_PRESSED;
583 /* Firmware v1.20 provides RC data via bulk endpoint 1 */
584 status = usb_bulk_msg(d->udev, usb_rcvbulkpipe(d->udev, 1), buf,
585 sizeof(buf), &actlen, 50);
587 /* No data available (meaning no key press) */
592 switch (dvb_usb_dib0700_ir_proto) {
594 poll_reply.report_id = 0;
595 poll_reply.data_state = 1;
596 poll_reply.system = buf[2];
597 poll_reply.data = buf[4];
598 poll_reply.not_data = buf[5];
600 /* NEC protocol sends repeat code as 0 0 0 FF */
601 if ((poll_reply.system == 0x00) && (poll_reply.data == 0x00)
602 && (poll_reply.not_data == 0xff)) {
603 poll_reply.data_state = 2;
608 if (actlen != sizeof(buf)) {
609 /* We didn't get back the 6 byte message we expected */
610 err("Unexpected RC response size [%d]", actlen);
614 poll_reply.report_id = buf[0];
615 poll_reply.data_state = buf[1];
616 poll_reply.system = (buf[2] << 8) | buf[3];
617 poll_reply.data = buf[4];
618 poll_reply.not_data = buf[5];
623 if ((poll_reply.data + poll_reply.not_data) != 0xff) {
624 /* Key failed integrity check */
625 err("key failed integrity check: %04x %02x %02x",
627 poll_reply.data, poll_reply.not_data);
632 /* Find the key in the map */
633 for (i = 0; i < d->props.rc_key_map_size; i++) {
634 if (rc5_custom(&keymap[i]) == (poll_reply.system & 0xff) &&
635 rc5_data(&keymap[i]) == poll_reply.data) {
636 *event = keymap[i].event;
643 err("Unknown remote controller key: %04x %02x %02x",
645 poll_reply.data, poll_reply.not_data);
650 if (poll_reply.data_state == 1) {
653 *event = keymap[i].event;
654 *state = REMOTE_KEY_PRESSED;
655 d->last_event = keymap[i].event;
656 } else if (poll_reply.data_state == 2) {
660 /* prevents unwanted double hits */
661 if (st->rc_counter > RC_REPEAT_DELAY_V1_20) {
662 *event = d->last_event;
663 *state = REMOTE_KEY_PRESSED;
664 st->rc_counter = RC_REPEAT_DELAY_V1_20;
667 err("Unknown data state [%d]", poll_reply.data_state);
673 static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
675 struct dib0700_state *st = d->priv;
677 /* Because some people may have improperly named firmware files,
678 let's figure out whether to use the new firmware call or the legacy
679 call based on the firmware version embedded in the file */
680 if (st->rc_func_version == 0) {
681 u32 hwver, romver, ramver, fwtype;
682 int ret = dib0700_get_version(d, &hwver, &romver, &ramver,
685 err("Could not determine version info");
688 if (ramver < 0x10200)
689 st->rc_func_version = 1;
691 st->rc_func_version = 2;
694 if (st->rc_func_version == 2)
695 return dib0700_rc_query_v1_20(d, event, state);
697 return dib0700_rc_query_legacy(d, event, state);
700 static struct dvb_usb_rc_key dib0700_rc_keys[] = {
701 /* Key codes for the tiny Pinnacle remote*/
702 { 0x0700, KEY_MUTE },
703 { 0x0701, KEY_MENU }, /* Pinnacle logo */
704 { 0x0739, KEY_POWER },
705 { 0x0703, KEY_VOLUMEUP },
706 { 0x0709, KEY_VOLUMEDOWN },
707 { 0x0706, KEY_CHANNELUP },
708 { 0x070c, KEY_CHANNELDOWN },
719 { 0x0724, KEY_SCREEN }, /* 'Square' key */
720 { 0x072a, KEY_TEXT }, /* 'T' key */
721 { 0x072d, KEY_REWIND },
722 { 0x0730, KEY_PLAY },
723 { 0x0733, KEY_FASTFORWARD },
724 { 0x0736, KEY_RECORD },
725 { 0x073c, KEY_STOP },
726 { 0x073f, KEY_CANCEL }, /* '?' key */
727 /* Key codes for the Terratec Cinergy DT XS Diversity, similar to cinergyT2.c */
728 { 0xeb01, KEY_POWER },
738 { 0xeb0b, KEY_VIDEO },
740 { 0xeb0d, KEY_REFRESH },
743 { 0xeb11, KEY_LEFT },
745 { 0xeb13, KEY_RIGHT },
746 { 0xeb14, KEY_DOWN },
747 { 0xeb16, KEY_INFO },
749 { 0xeb18, KEY_GREEN },
750 { 0xeb19, KEY_YELLOW },
751 { 0xeb1a, KEY_BLUE },
752 { 0xeb1b, KEY_CHANNELUP },
753 { 0xeb1c, KEY_VOLUMEUP },
754 { 0xeb1d, KEY_MUTE },
755 { 0xeb1e, KEY_VOLUMEDOWN },
756 { 0xeb1f, KEY_CHANNELDOWN },
757 { 0xeb40, KEY_PAUSE },
758 { 0xeb41, KEY_HOME },
759 { 0xeb42, KEY_MENU }, /* DVD Menu */
760 { 0xeb43, KEY_SUBTITLE },
761 { 0xeb44, KEY_TEXT }, /* Teletext */
762 { 0xeb45, KEY_DELETE },
765 { 0xeb48, KEY_STOP },
766 { 0xeb49, KEY_VIDEO },
767 { 0xeb4a, KEY_AUDIO }, /* Music */
768 { 0xeb4b, KEY_SCREEN }, /* Pic */
769 { 0xeb4c, KEY_PLAY },
770 { 0xeb4d, KEY_BACK },
771 { 0xeb4e, KEY_REWIND },
772 { 0xeb4f, KEY_FASTFORWARD },
773 { 0xeb54, KEY_PREVIOUS },
774 { 0xeb58, KEY_RECORD },
775 { 0xeb5c, KEY_NEXT },
777 /* Key codes for the Haupauge WinTV Nova-TD, copied from nova-t-usb2.c (Nova-T USB2) */
788 { 0x1e0a, KEY_KPASTERISK },
790 { 0x1e0c, KEY_RADIO },
791 { 0x1e0d, KEY_MENU },
792 { 0x1e0e, KEY_GRAVE }, /* # */
793 { 0x1e0f, KEY_MUTE },
794 { 0x1e10, KEY_VOLUMEUP },
795 { 0x1e11, KEY_VOLUMEDOWN },
796 { 0x1e12, KEY_CHANNEL },
798 { 0x1e15, KEY_DOWN },
799 { 0x1e16, KEY_LEFT },
800 { 0x1e17, KEY_RIGHT },
801 { 0x1e18, KEY_VIDEO },
802 { 0x1e19, KEY_AUDIO },
803 { 0x1e1a, KEY_MEDIA },
806 { 0x1e1e, KEY_NEXT },
807 { 0x1e1f, KEY_BACK },
808 { 0x1e20, KEY_CHANNELUP },
809 { 0x1e21, KEY_CHANNELDOWN },
810 { 0x1e24, KEY_LAST }, /* Skip backwards */
813 { 0x1e2e, KEY_GREEN },
814 { 0x1e30, KEY_PAUSE },
815 { 0x1e32, KEY_REWIND },
816 { 0x1e34, KEY_FASTFORWARD },
817 { 0x1e35, KEY_PLAY },
818 { 0x1e36, KEY_STOP },
819 { 0x1e37, KEY_RECORD },
820 { 0x1e38, KEY_YELLOW },
821 { 0x1e3b, KEY_GOTO },
822 { 0x1e3d, KEY_POWER },
824 /* Key codes for the Leadtek Winfast DTV Dongle */
825 { 0x0042, KEY_POWER },
826 { 0x077c, KEY_TUNER },
827 { 0x0f4e, KEY_PRINT }, /* PREVIEW */
828 { 0x0840, KEY_SCREEN }, /* full screen toggle*/
829 { 0x0f71, KEY_DOT }, /* frequency */
840 { 0x0e4e, KEY_CLEAR },
841 { 0x047c, KEY_CHANNEL }, /* show channel number */
842 { 0x0f41, KEY_LAST }, /* recall */
843 { 0x0342, KEY_MUTE },
844 { 0x064c, KEY_RESERVED }, /* PIP button*/
845 { 0x0172, KEY_SHUFFLE }, /* SNAPSHOT */
846 { 0x0c4e, KEY_PLAYPAUSE }, /* TIMESHIFT */
847 { 0x0b70, KEY_RECORD },
848 { 0x037d, KEY_VOLUMEUP },
849 { 0x017d, KEY_VOLUMEDOWN },
850 { 0x0242, KEY_CHANNELUP },
851 { 0x007d, KEY_CHANNELDOWN },
853 /* Key codes for Nova-TD "credit card" remote control. */
864 { 0x1d0a, KEY_TEXT },
865 { 0x1d0d, KEY_MENU },
866 { 0x1d0f, KEY_MUTE },
867 { 0x1d10, KEY_VOLUMEUP },
868 { 0x1d11, KEY_VOLUMEDOWN },
869 { 0x1d12, KEY_CHANNEL },
871 { 0x1d15, KEY_DOWN },
872 { 0x1d16, KEY_LEFT },
873 { 0x1d17, KEY_RIGHT },
875 { 0x1d1e, KEY_NEXT },
876 { 0x1d1f, KEY_BACK },
877 { 0x1d20, KEY_CHANNELUP },
878 { 0x1d21, KEY_CHANNELDOWN },
879 { 0x1d24, KEY_LAST },
881 { 0x1d30, KEY_PAUSE },
882 { 0x1d32, KEY_REWIND },
883 { 0x1d34, KEY_FASTFORWARD },
884 { 0x1d35, KEY_PLAY },
885 { 0x1d36, KEY_STOP },
886 { 0x1d37, KEY_RECORD },
887 { 0x1d3b, KEY_GOTO },
888 { 0x1d3d, KEY_POWER },
890 /* Key codes for the Pixelview SBTVD remote (proto NEC) */
891 { 0x8613, KEY_MUTE },
892 { 0x8612, KEY_POWER },
903 { 0x860d, KEY_CHANNELUP },
904 { 0x8619, KEY_CHANNELDOWN },
905 { 0x8610, KEY_VOLUMEUP },
906 { 0x860c, KEY_VOLUMEDOWN },
908 { 0x860a, KEY_CAMERA },
909 { 0x860b, KEY_ZOOM },
910 { 0x861b, KEY_BACKSPACE },
911 { 0x8615, KEY_ENTER },
914 { 0x861e, KEY_DOWN },
915 { 0x860e, KEY_LEFT },
916 { 0x860f, KEY_RIGHT },
918 { 0x8618, KEY_RECORD },
919 { 0x861a, KEY_STOP },
922 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
923 static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
924 BAND_UHF | BAND_VHF, // band_caps
926 /* 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,
927 * 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 */
928 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
960 1, // perform_agc_softsplit
963 51800, // global_split_min
964 24700 // global_split_max
968 static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
971 /* 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,
972 * 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 */
973 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
1010 0, // perform_agc_softsplit
1013 static struct dibx000_bandwidth_config stk7700p_pll_config = {
1014 60000, 30000, // internal, sampling
1015 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
1016 0, 0, 1, 1, 0, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
1017 (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
1023 static struct dib7000m_config stk7700p_dib7000m_config = {
1025 .output_mpeg2_in_188_bytes = 1,
1028 .agc_config_count = 1,
1029 .agc = &stk7700p_7000m_mt2060_agc_config,
1030 .bw = &stk7700p_pll_config,
1032 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
1033 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
1034 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
1037 static struct dib7000p_config stk7700p_dib7000p_config = {
1038 .output_mpeg2_in_188_bytes = 1,
1040 .agc_config_count = 1,
1041 .agc = &stk7700p_7000p_mt2060_agc_config,
1042 .bw = &stk7700p_pll_config,
1044 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
1045 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
1046 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
1049 static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
1051 struct dib0700_state *st = adap->dev->priv;
1052 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
1054 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1055 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
1057 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
1058 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1060 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
1061 dib0700_ctrl_clock(adap->dev, 72, 1);
1062 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
1064 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1066 st->mt2060_if1[0] = 1220;
1068 if (dib7000pc_detection(&adap->dev->i2c_adap)) {
1069 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
1070 st->is_dib7000pc = 1;
1072 adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
1074 return adap->fe == NULL ? -ENODEV : 0;
1077 static struct mt2060_config stk7700p_mt2060_config = {
1081 static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
1083 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
1084 struct dib0700_state *st = adap->dev->priv;
1085 struct i2c_adapter *tun_i2c;
1088 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
1089 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
1090 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
1092 if (st->is_dib7000pc)
1093 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1095 tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1097 return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config,
1098 if1) == NULL ? -ENODEV : 0;
1101 /* DIB7070 generic */
1102 static struct dibx000_agc_config dib7070_agc_config = {
1103 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
1104 /* 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,
1105 * 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 */
1106 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), // setup
1109 10, // time_stabiliz
1140 0, // perform_agc_softsplit
1143 static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
1145 deb_info("reset: %d", onoff);
1146 return dib7000p_set_gpio(fe, 8, 0, !onoff);
1149 static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
1151 deb_info("sleep: %d", onoff);
1152 return dib7000p_set_gpio(fe, 9, 0, onoff);
1155 static struct dib0070_config dib7070p_dib0070_config[2] = {
1157 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1158 .reset = dib7070_tuner_reset,
1159 .sleep = dib7070_tuner_sleep,
1161 .clock_pad_drive = 4,
1164 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1165 .reset = dib7070_tuner_reset,
1166 .sleep = dib7070_tuner_sleep,
1172 static struct dib0070_config dib7770p_dib0070_config = {
1173 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1174 .reset = dib7070_tuner_reset,
1175 .sleep = dib7070_tuner_sleep,
1177 .clock_pad_drive = 0,
1182 static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
1184 struct dvb_usb_adapter *adap = fe->dvb->priv;
1185 struct dib0700_adapter_state *state = adap->priv;
1188 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1190 case BAND_VHF: offset = 950; break;
1192 default: offset = 550; break;
1194 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
1195 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1196 return state->set_param_save(fe, fep);
1199 static int dib7770_set_param_override(struct dvb_frontend *fe,
1200 struct dvb_frontend_parameters *fep)
1202 struct dvb_usb_adapter *adap = fe->dvb->priv;
1203 struct dib0700_adapter_state *state = adap->priv;
1206 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1209 dib7000p_set_gpio(fe, 0, 0, 1);
1214 dib7000p_set_gpio(fe, 0, 0, 0);
1218 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
1219 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1220 return state->set_param_save(fe, fep);
1223 static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
1225 struct dib0700_adapter_state *st = adap->priv;
1226 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe,
1227 DIBX000_I2C_INTERFACE_TUNER, 1);
1229 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1230 &dib7770p_dib0070_config) == NULL)
1233 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1234 adap->fe->ops.tuner_ops.set_params = dib7770_set_param_override;
1238 static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
1240 struct dib0700_adapter_state *st = adap->priv;
1241 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1243 if (adap->id == 0) {
1244 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
1247 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
1251 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1252 adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override;
1256 static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
1258 return dib7000p_pid_filter(adapter->fe, index, pid, onoff);
1261 static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
1263 return dib7000p_pid_filter_ctrl(adapter->fe, onoff);
1266 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
1267 60000, 15000, // internal, sampling
1268 1, 20, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
1269 0, 0, 1, 1, 2, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
1270 (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
1271 (0 << 25) | 0, // ifreq = 0.000000 MHz
1273 12000000, // xtal_hz
1276 static struct dib7000p_config dib7070p_dib7000p_config = {
1277 .output_mpeg2_in_188_bytes = 1,
1279 .agc_config_count = 1,
1280 .agc = &dib7070_agc_config,
1281 .bw = &dib7070_bw_config_12_mhz,
1282 .tuner_is_baseband = 1,
1285 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1286 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1287 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1289 .hostbus_diversity = 1,
1293 static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
1295 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
1296 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
1297 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
1298 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1300 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1302 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1303 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1304 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1305 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1307 dib0700_ctrl_clock(adap->dev, 72, 1);
1310 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1312 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1314 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1315 &dib7070p_dib7000p_config) != 0) {
1316 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1321 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
1322 &dib7070p_dib7000p_config);
1323 return adap->fe == NULL ? -ENODEV : 0;
1326 /* DIB807x generic */
1327 static struct dibx000_agc_config dib807x_agc_config[2] = {
1330 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1331 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1332 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1333 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1335 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1336 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1337 (0 << 0), /* setup*/
1340 10, /* time_stabiliz*/
1350 65535, /* agc1_max*/
1353 65535, /* agc2_max*/
1359 206, /* agc1_slope1*/
1360 255, /* agc1_slope2*/
1363 88, /* agc2_slope1*/
1364 90, /* agc2_slope2*/
1371 0, /* perform_agc_softsplit*/
1374 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1375 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1376 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1377 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1379 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1380 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1381 (0 << 0), /* setup */
1384 10, /* time_stabiliz*/
1394 65535, /* agc1_max*/
1397 65535, /* agc2_max*/
1403 206, /* agc1_slope1*/
1404 255, /* agc1_slope2*/
1407 88, /* agc2_slope1*/
1408 90, /* agc2_slope2*/
1415 0, /* perform_agc_softsplit*/
1419 static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
1420 60000, 15000, /* internal, sampling*/
1421 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/
1422 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
1424 (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1425 (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1427 12000000, /* xtal_hz*/
1430 static struct dib8000_config dib807x_dib8000_config[2] = {
1432 .output_mpeg2_in_188_bytes = 1,
1434 .agc_config_count = 2,
1435 .agc = dib807x_agc_config,
1436 .pll = &dib807x_bw_config_12_mhz,
1437 .tuner_is_baseband = 1,
1439 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1440 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1441 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1443 .hostbus_diversity = 1,
1445 .agc_control = &dib0070_ctrl_agc_filter,
1446 .output_mode = OUTMODE_MPEG2_FIFO,
1449 .output_mpeg2_in_188_bytes = 1,
1451 .agc_config_count = 2,
1452 .agc = dib807x_agc_config,
1453 .pll = &dib807x_bw_config_12_mhz,
1454 .tuner_is_baseband = 1,
1456 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1457 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1458 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1460 .hostbus_diversity = 1,
1461 .agc_control = &dib0070_ctrl_agc_filter,
1462 .output_mode = OUTMODE_MPEG2_FIFO,
1467 static int dib807x_tuner_reset(struct dvb_frontend *fe, int onoff)
1469 return dib8000_set_gpio(fe, 5, 0, !onoff);
1472 static int dib807x_tuner_sleep(struct dvb_frontend *fe, int onoff)
1474 return dib8000_set_gpio(fe, 0, 0, onoff);
1477 static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
1482 static struct dib0070_config dib807x_dib0070_config[2] = {
1484 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1485 .reset = dib807x_tuner_reset,
1486 .sleep = dib807x_tuner_sleep,
1488 .clock_pad_drive = 4,
1490 .force_crystal_mode = 1,
1491 .enable_third_order_filter = 1,
1493 .wbd_gain = dib8070_wbd_gain_cfg,
1494 .osc_buffer_state = 0,
1495 .freq_offset_khz_uhf = -100,
1496 .freq_offset_khz_vhf = -100,
1498 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1499 .reset = dib807x_tuner_reset,
1500 .sleep = dib807x_tuner_sleep,
1502 .clock_pad_drive = 2,
1504 .force_crystal_mode = 1,
1505 .enable_third_order_filter = 1,
1507 .wbd_gain = dib8070_wbd_gain_cfg,
1508 .osc_buffer_state = 0,
1509 .freq_offset_khz_uhf = -25,
1510 .freq_offset_khz_vhf = -25,
1514 static int dib807x_set_param_override(struct dvb_frontend *fe,
1515 struct dvb_frontend_parameters *fep)
1517 struct dvb_usb_adapter *adap = fe->dvb->priv;
1518 struct dib0700_adapter_state *state = adap->priv;
1520 u16 offset = dib0070_wbd_offset(fe);
1521 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1526 case BAND_UHF: /* fall-thru wanted */
1528 offset += 250; break;
1530 deb_info("WBD for DiB8000: %d\n", offset);
1531 dib8000_set_wbd_ref(fe, offset);
1533 return state->set_param_save(fe, fep);
1536 static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1538 struct dib0700_adapter_state *st = adap->priv;
1539 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe,
1540 DIBX000_I2C_INTERFACE_TUNER, 1);
1542 if (adap->id == 0) {
1543 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1544 &dib807x_dib0070_config[0]) == NULL)
1547 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1548 &dib807x_dib0070_config[1]) == NULL)
1552 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1553 adap->fe->ops.tuner_ops.set_params = dib807x_set_param_override;
1557 static int stk807x_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
1559 return dib8000_pid_filter(adapter->fe, index, pid, onoff);
1562 static int stk807x_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
1564 return dib8000_pid_filter_ctrl(adapter->fe, onoff);
1568 static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
1570 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1572 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1573 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1574 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1576 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1578 dib0700_ctrl_clock(adap->dev, 72, 1);
1581 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1583 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1585 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1588 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1589 &dib807x_dib8000_config[0]);
1591 return adap->fe == NULL ? -ENODEV : 0;
1595 static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
1597 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1599 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1601 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1602 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1603 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1605 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1607 dib0700_ctrl_clock(adap->dev, 72, 1);
1610 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1612 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1614 /* initialize IC 0 */
1615 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x80);
1617 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1618 &dib807x_dib8000_config[0]);
1620 return adap->fe == NULL ? -ENODEV : 0;
1623 static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
1625 /* initialize IC 1 */
1626 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x82);
1628 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82,
1629 &dib807x_dib8000_config[1]);
1631 return adap->fe == NULL ? -ENODEV : 0;
1636 static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
1638 .output_mpeg2_in_188_bytes = 1,
1640 .agc_config_count = 1,
1641 .agc = &dib7070_agc_config,
1642 .bw = &dib7070_bw_config_12_mhz,
1643 .tuner_is_baseband = 1,
1646 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1647 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1648 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1650 .hostbus_diversity = 1,
1652 .output_mpeg2_in_188_bytes = 1,
1654 .agc_config_count = 1,
1655 .agc = &dib7070_agc_config,
1656 .bw = &dib7070_bw_config_12_mhz,
1657 .tuner_is_baseband = 1,
1660 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1661 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1662 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1664 .hostbus_diversity = 1,
1668 static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
1670 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1672 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1673 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1674 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1675 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1677 dib0700_ctrl_clock(adap->dev, 72, 1);
1680 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1682 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1684 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
1685 stk7070pd_dib7000p_config) != 0) {
1686 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1691 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
1692 return adap->fe == NULL ? -ENODEV : 0;
1695 static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
1697 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
1698 return adap->fe == NULL ? -ENODEV : 0;
1702 static struct s5h1411_config pinnacle_801e_config = {
1703 .output_mode = S5H1411_PARALLEL_OUTPUT,
1704 .gpio = S5H1411_GPIO_OFF,
1705 .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
1706 .qam_if = S5H1411_IF_44000,
1707 .vsb_if = S5H1411_IF_44000,
1708 .inversion = S5H1411_INVERSION_OFF,
1709 .status_mode = S5H1411_DEMODLOCKING
1712 /* Pinnacle PCTV HD Pro 801e GPIOs map:
1713 GPIO0 - currently unknown
1714 GPIO1 - xc5000 tuner reset
1715 GPIO2 - CX25843 sleep
1716 GPIO3 - currently unknown
1717 GPIO4 - currently unknown
1718 GPIO6 - currently unknown
1719 GPIO7 - currently unknown
1720 GPIO9 - currently unknown
1721 GPIO10 - CX25843 reset
1723 static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
1725 struct dib0700_state *st = adap->dev->priv;
1727 /* Make use of the new i2c functions from FW 1.20 */
1728 st->fw_use_new_i2c_api = 1;
1730 /* The s5h1411 requires the dib0700 to not be in master mode */
1731 st->disable_streaming_master_mode = 1;
1733 /* All msleep values taken from Windows USB trace */
1734 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
1735 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
1736 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1738 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1740 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1742 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1743 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1744 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1745 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1746 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
1749 /* Put the CX25843 to sleep for now since we're in digital mode */
1750 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
1752 /* GPIOs are initialized, do the attach */
1753 adap->fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
1754 &adap->dev->i2c_adap);
1755 return adap->fe == NULL ? -ENODEV : 0;
1758 static int dib0700_xc5000_tuner_callback(void *priv, int component,
1759 int command, int arg)
1761 struct dvb_usb_adapter *adap = priv;
1763 if (command == XC5000_TUNER_RESET) {
1764 /* Reset the tuner */
1765 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
1767 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
1770 err("xc5000: unknown tuner callback command: %d\n", command);
1777 static struct xc5000_config s5h1411_xc5000_tunerconfig = {
1778 .i2c_address = 0x64,
1782 static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
1784 /* FIXME: generalize & move to common area */
1785 adap->fe->callback = dib0700_xc5000_tuner_callback;
1787 return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap,
1788 &s5h1411_xc5000_tunerconfig)
1789 == NULL ? -ENODEV : 0;
1792 static struct lgdt3305_config hcw_lgdt3305_config = {
1794 .mpeg_mode = LGDT3305_MPEG_PARALLEL,
1795 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
1796 .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
1798 .spectral_inversion = 1,
1801 .usref_8vsb = 0x0500,
1804 static struct mxl5007t_config hcw_mxl5007t_config = {
1805 .xtal_freq_hz = MxL_XTAL_25_MHZ,
1806 .if_freq_hz = MxL_IF_6_MHZ,
1811 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
1812 GPIO1 - ANT_SEL (H: VPA, L: MCX)
1818 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
1820 static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
1822 struct dib0700_state *st = adap->dev->priv;
1824 /* Make use of the new i2c functions from FW 1.20 */
1825 st->fw_use_new_i2c_api = 1;
1827 st->disable_streaming_master_mode = 1;
1829 /* fe power enable */
1830 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1832 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1836 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1838 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1840 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1843 adap->fe = dvb_attach(lgdt3305_attach,
1844 &hcw_lgdt3305_config,
1845 &adap->dev->i2c_adap);
1847 return adap->fe == NULL ? -ENODEV : 0;
1850 static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
1852 return dvb_attach(mxl5007t_attach, adap->fe,
1853 &adap->dev->i2c_adap, 0x60,
1854 &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
1858 /* DVB-USB and USB stuff follows */
1859 struct usb_device_id dib0700_usb_id_table[] = {
1860 /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
1861 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
1862 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
1863 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
1864 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
1865 /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
1866 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
1867 { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
1868 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
1869 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
1870 /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
1871 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
1872 { USB_DEVICE(USB_VID_TERRATEC,
1873 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
1874 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
1875 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
1876 /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
1877 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
1878 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
1879 { USB_DEVICE(USB_VID_PINNACLE,
1880 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
1881 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
1882 /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
1883 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
1884 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
1885 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
1886 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
1887 /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
1888 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
1889 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
1890 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
1891 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
1892 /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
1893 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
1894 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
1895 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
1896 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
1897 /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
1898 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
1899 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
1900 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
1901 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
1902 /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
1903 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
1904 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
1905 { USB_DEVICE(USB_VID_TERRATEC,
1906 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
1907 { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
1908 /* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
1909 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
1910 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
1911 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
1912 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
1913 /* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
1914 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
1915 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
1916 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
1917 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
1918 /* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
1919 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
1920 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
1921 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
1922 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
1923 /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
1924 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
1925 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
1926 { USB_DEVICE(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD) },
1927 { 0 } /* Terminating entry */
1929 MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
1931 #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
1932 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
1933 .usb_ctrl = DEVICE_SPECIFIC, \
1934 .firmware = "dvb-usb-dib0700-1.20.fw", \
1935 .download_firmware = dib0700_download_firmware, \
1936 .no_reconnect = 1, \
1937 .size_of_priv = sizeof(struct dib0700_state), \
1938 .i2c_algo = &dib0700_i2c_algo, \
1939 .identify_state = dib0700_identify_state
1941 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
1942 .streaming_ctrl = dib0700_streaming_ctrl, \
1949 .buffersize = 39480, \
1954 struct dvb_usb_device_properties dib0700_devices[] = {
1956 DIB0700_DEFAULT_DEVICE_PROPERTIES,
1961 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1962 .pid_filter_count = 32,
1963 .pid_filter = stk70x0p_pid_filter,
1964 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
1965 .frontend_attach = stk7700p_frontend_attach,
1966 .tuner_attach = stk7700p_tuner_attach,
1968 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
1972 .num_device_descs = 8,
1974 { "DiBcom STK7700P reference design",
1975 { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
1978 { "Hauppauge Nova-T Stick",
1979 { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
1982 { "AVerMedia AVerTV DVB-T Volar",
1983 { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
1986 { "Compro Videomate U500",
1987 { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
1990 { "Uniwill STK7700P based (Hama and others)",
1991 { &dib0700_usb_id_table[7], NULL },
1994 { "Leadtek Winfast DTV Dongle (STK7700P based)",
1995 { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
1998 { "AVerMedia AVerTV DVB-T Express",
1999 { &dib0700_usb_id_table[20] },
2003 { &dib0700_usb_id_table[21], NULL },
2008 .rc_interval = DEFAULT_RC_INTERVAL,
2009 .rc_key_map = dib0700_rc_keys,
2010 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2011 .rc_query = dib0700_rc_query
2012 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2017 .frontend_attach = bristol_frontend_attach,
2018 .tuner_attach = bristol_tuner_attach,
2020 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2022 .frontend_attach = bristol_frontend_attach,
2023 .tuner_attach = bristol_tuner_attach,
2025 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2029 .num_device_descs = 1,
2031 { "Hauppauge Nova-T 500 Dual DVB-T",
2032 { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
2037 .rc_interval = DEFAULT_RC_INTERVAL,
2038 .rc_key_map = dib0700_rc_keys,
2039 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2040 .rc_query = dib0700_rc_query
2041 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2046 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2047 .pid_filter_count = 32,
2048 .pid_filter = stk70x0p_pid_filter,
2049 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2050 .frontend_attach = stk7700d_frontend_attach,
2051 .tuner_attach = stk7700d_tuner_attach,
2053 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2055 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2056 .pid_filter_count = 32,
2057 .pid_filter = stk70x0p_pid_filter,
2058 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2059 .frontend_attach = stk7700d_frontend_attach,
2060 .tuner_attach = stk7700d_tuner_attach,
2062 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2066 .num_device_descs = 5,
2068 { "Pinnacle PCTV 2000e",
2069 { &dib0700_usb_id_table[11], NULL },
2072 { "Terratec Cinergy DT XS Diversity",
2073 { &dib0700_usb_id_table[12], NULL },
2076 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
2077 { &dib0700_usb_id_table[13], NULL },
2080 { "DiBcom STK7700D reference design",
2081 { &dib0700_usb_id_table[14], NULL },
2084 { "YUAN High-Tech DiBcom STK7700D",
2085 { &dib0700_usb_id_table[55], NULL },
2091 .rc_interval = DEFAULT_RC_INTERVAL,
2092 .rc_key_map = dib0700_rc_keys,
2093 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2094 .rc_query = dib0700_rc_query
2096 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2101 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2102 .pid_filter_count = 32,
2103 .pid_filter = stk70x0p_pid_filter,
2104 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2105 .frontend_attach = stk7700P2_frontend_attach,
2106 .tuner_attach = stk7700d_tuner_attach,
2108 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2112 .num_device_descs = 3,
2114 { "ASUS My Cinema U3000 Mini DVBT Tuner",
2115 { &dib0700_usb_id_table[23], NULL },
2119 { &dib0700_usb_id_table[31], NULL },
2122 { "Terratec Cinergy T Express",
2123 { &dib0700_usb_id_table[42], NULL },
2128 .rc_interval = DEFAULT_RC_INTERVAL,
2129 .rc_key_map = dib0700_rc_keys,
2130 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2131 .rc_query = dib0700_rc_query
2132 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2137 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2138 .pid_filter_count = 32,
2139 .pid_filter = stk70x0p_pid_filter,
2140 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2141 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2142 .pid_filter_count = 32,
2143 .pid_filter = stk70x0p_pid_filter,
2144 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2145 .frontend_attach = stk7070p_frontend_attach,
2146 .tuner_attach = dib7070p_tuner_attach,
2148 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2150 .size_of_priv = sizeof(struct dib0700_adapter_state),
2154 .num_device_descs = 11,
2156 { "DiBcom STK7070P reference design",
2157 { &dib0700_usb_id_table[15], NULL },
2160 { "Pinnacle PCTV DVB-T Flash Stick",
2161 { &dib0700_usb_id_table[16], NULL },
2164 { "Artec T14BR DVB-T",
2165 { &dib0700_usb_id_table[22], NULL },
2168 { "ASUS My Cinema U3100 Mini DVBT Tuner",
2169 { &dib0700_usb_id_table[24], NULL },
2172 { "Hauppauge Nova-T Stick",
2173 { &dib0700_usb_id_table[25], NULL },
2176 { "Hauppauge Nova-T MyTV.t",
2177 { &dib0700_usb_id_table[26], NULL },
2180 { "Pinnacle PCTV 72e",
2181 { &dib0700_usb_id_table[29], NULL },
2184 { "Pinnacle PCTV 73e",
2185 { &dib0700_usb_id_table[30], NULL },
2188 { "Elgato EyeTV DTT",
2189 { &dib0700_usb_id_table[49], NULL },
2193 { &dib0700_usb_id_table[45], NULL },
2196 { "Elgato EyeTV Dtt Dlx PD378S",
2197 { &dib0700_usb_id_table[50], NULL },
2202 .rc_interval = DEFAULT_RC_INTERVAL,
2203 .rc_key_map = dib0700_rc_keys,
2204 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2205 .rc_query = dib0700_rc_query
2207 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2212 .frontend_attach = stk7070p_frontend_attach,
2213 .tuner_attach = dib7070p_tuner_attach,
2215 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2217 .size_of_priv = sizeof(struct dib0700_adapter_state),
2221 .num_device_descs = 3,
2223 { "Pinnacle PCTV 73A",
2224 { &dib0700_usb_id_table[56], NULL },
2227 { "Pinnacle PCTV 73e SE",
2228 { &dib0700_usb_id_table[57], NULL },
2231 { "Pinnacle PCTV 282e",
2232 { &dib0700_usb_id_table[58], NULL },
2237 .rc_interval = DEFAULT_RC_INTERVAL,
2238 .rc_key_map = dib0700_rc_keys,
2239 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2240 .rc_query = dib0700_rc_query
2242 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2247 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2248 .pid_filter_count = 32,
2249 .pid_filter = stk70x0p_pid_filter,
2250 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2251 .frontend_attach = stk7070pd_frontend_attach0,
2252 .tuner_attach = dib7070p_tuner_attach,
2254 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2256 .size_of_priv = sizeof(struct dib0700_adapter_state),
2258 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2259 .pid_filter_count = 32,
2260 .pid_filter = stk70x0p_pid_filter,
2261 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2262 .frontend_attach = stk7070pd_frontend_attach1,
2263 .tuner_attach = dib7070p_tuner_attach,
2265 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2267 .size_of_priv = sizeof(struct dib0700_adapter_state),
2271 .num_device_descs = 6,
2273 { "DiBcom STK7070PD reference design",
2274 { &dib0700_usb_id_table[17], NULL },
2277 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
2278 { &dib0700_usb_id_table[18], NULL },
2281 { "Hauppauge Nova-TD Stick (52009)",
2282 { &dib0700_usb_id_table[35], NULL },
2285 { "Hauppauge Nova-TD-500 (84xxx)",
2286 { &dib0700_usb_id_table[36], NULL },
2289 { "Terratec Cinergy DT USB XS Diversity/ T5",
2290 { &dib0700_usb_id_table[43],
2291 &dib0700_usb_id_table[53], NULL},
2295 { &dib0700_usb_id_table[44], NULL },
2299 .rc_interval = DEFAULT_RC_INTERVAL,
2300 .rc_key_map = dib0700_rc_keys,
2301 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2302 .rc_query = dib0700_rc_query
2303 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2308 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2309 .pid_filter_count = 32,
2310 .pid_filter = stk70x0p_pid_filter,
2311 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2312 .frontend_attach = stk7700ph_frontend_attach,
2313 .tuner_attach = stk7700ph_tuner_attach,
2315 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2317 .size_of_priv = sizeof(struct
2318 dib0700_adapter_state),
2322 .num_device_descs = 9,
2324 { "Terratec Cinergy HT USB XE",
2325 { &dib0700_usb_id_table[27], NULL },
2328 { "Pinnacle Expresscard 320cx",
2329 { &dib0700_usb_id_table[28], NULL },
2332 { "Terratec Cinergy HT Express",
2333 { &dib0700_usb_id_table[32], NULL },
2336 { "Gigabyte U8000-RH",
2337 { &dib0700_usb_id_table[37], NULL },
2340 { "YUAN High-Tech STK7700PH",
2341 { &dib0700_usb_id_table[38], NULL },
2344 { "Asus My Cinema-U3000Hybrid",
2345 { &dib0700_usb_id_table[39], NULL },
2348 { "YUAN High-Tech MC770",
2349 { &dib0700_usb_id_table[48], NULL },
2352 { "Leadtek WinFast DTV Dongle H",
2353 { &dib0700_usb_id_table[51], NULL },
2356 { "YUAN High-Tech STK7700D",
2357 { &dib0700_usb_id_table[54], NULL },
2361 .rc_interval = DEFAULT_RC_INTERVAL,
2362 .rc_key_map = dib0700_rc_keys,
2363 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2364 .rc_query = dib0700_rc_query
2365 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2369 .frontend_attach = s5h1411_frontend_attach,
2370 .tuner_attach = xc5000_tuner_attach,
2372 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2374 .size_of_priv = sizeof(struct
2375 dib0700_adapter_state),
2379 .num_device_descs = 2,
2381 { "Pinnacle PCTV HD Pro USB Stick",
2382 { &dib0700_usb_id_table[40], NULL },
2385 { "Pinnacle PCTV HD USB Stick",
2386 { &dib0700_usb_id_table[41], NULL },
2390 .rc_interval = DEFAULT_RC_INTERVAL,
2391 .rc_key_map = dib0700_rc_keys,
2392 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2393 .rc_query = dib0700_rc_query
2394 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2398 .frontend_attach = lgdt3305_frontend_attach,
2399 .tuner_attach = mxl5007t_tuner_attach,
2401 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2403 .size_of_priv = sizeof(struct
2404 dib0700_adapter_state),
2408 .num_device_descs = 2,
2410 { "Hauppauge ATSC MiniCard (B200)",
2411 { &dib0700_usb_id_table[46], NULL },
2414 { "Hauppauge ATSC MiniCard (B210)",
2415 { &dib0700_usb_id_table[47], NULL },
2419 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2424 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2425 .pid_filter_count = 32,
2426 .pid_filter = stk70x0p_pid_filter,
2427 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
2428 .frontend_attach = stk7070p_frontend_attach,
2429 .tuner_attach = dib7770p_tuner_attach,
2431 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2434 sizeof(struct dib0700_adapter_state),
2438 .num_device_descs = 2,
2440 { "DiBcom STK7770P reference design",
2441 { &dib0700_usb_id_table[59], NULL },
2444 { "Terratec Cinergy T USB XXS (HD)/ T3",
2445 { &dib0700_usb_id_table[33],
2446 &dib0700_usb_id_table[52],
2447 &dib0700_usb_id_table[60], NULL},
2451 .rc_interval = DEFAULT_RC_INTERVAL,
2452 .rc_key_map = dib0700_rc_keys,
2453 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2454 .rc_query = dib0700_rc_query
2455 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2459 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2460 .pid_filter_count = 32,
2461 .pid_filter = stk807x_pid_filter,
2462 .pid_filter_ctrl = stk807x_pid_filter_ctrl,
2463 .frontend_attach = stk807x_frontend_attach,
2464 .tuner_attach = dib807x_tuner_attach,
2466 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2469 sizeof(struct dib0700_adapter_state),
2473 .num_device_descs = 2,
2475 { "DiBcom STK807xP reference design",
2476 { &dib0700_usb_id_table[62], NULL },
2479 { "Prolink Pixelview SBTVD",
2480 { &dib0700_usb_id_table[63], NULL },
2485 .rc_interval = DEFAULT_RC_INTERVAL,
2486 .rc_key_map = dib0700_rc_keys,
2487 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2488 .rc_query = dib0700_rc_query
2490 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2494 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2495 .pid_filter_count = 32,
2496 .pid_filter = stk807x_pid_filter,
2497 .pid_filter_ctrl = stk807x_pid_filter_ctrl,
2498 .frontend_attach = stk807xpvr_frontend_attach0,
2499 .tuner_attach = dib807x_tuner_attach,
2501 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2504 sizeof(struct dib0700_adapter_state),
2507 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2508 .pid_filter_count = 32,
2509 .pid_filter = stk807x_pid_filter,
2510 .pid_filter_ctrl = stk807x_pid_filter_ctrl,
2511 .frontend_attach = stk807xpvr_frontend_attach1,
2512 .tuner_attach = dib807x_tuner_attach,
2514 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2517 sizeof(struct dib0700_adapter_state),
2521 .num_device_descs = 1,
2523 { "DiBcom STK807xPVR reference design",
2524 { &dib0700_usb_id_table[61], NULL },
2529 .rc_interval = DEFAULT_RC_INTERVAL,
2530 .rc_key_map = dib0700_rc_keys,
2531 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2532 .rc_query = dib0700_rc_query
2536 int dib0700_device_count = ARRAY_SIZE(dib0700_devices);