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-7 DiBcom, SA
11 #include "dib3000mc.h"
16 #include "tuner-xc2028.h"
21 static int force_lna_activation;
22 module_param(force_lna_activation, int, 0644);
23 MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), "
24 "if applicable for the device (default: 0=automatic/off).");
26 struct dib0700_adapter_state {
27 int (*set_param_save) (struct dvb_frontend *, struct dvb_frontend_parameters *);
30 /* Hauppauge Nova-T 500 (aka Bristol)
31 * has a LNA on GPIO0 which is enabled by setting 1 */
32 static struct mt2060_config bristol_mt2060_config[2] = {
41 static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
42 .band_caps = BAND_VHF | BAND_UHF,
43 .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
63 static struct dib3000mc_config bristol_dib3000mc_config[2] = {
64 { .agc = &bristol_dib3000p_mt2060_agc_config,
66 .ln_adc_level = 0x1cc7,
67 .output_mpeg2_in_188_bytes = 1,
69 { .agc = &bristol_dib3000p_mt2060_agc_config,
71 .ln_adc_level = 0x1cc7,
72 .output_mpeg2_in_188_bytes = 1,
76 static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
78 struct dib0700_state *st = adap->dev->priv;
80 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
81 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
82 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
83 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
85 if (force_lna_activation)
86 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
88 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
90 if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {
91 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
95 st->mt2060_if1[adap->id] = 1220;
96 return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
97 (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
100 static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval)
102 struct i2c_msg msg[2] = {
103 { .addr = 0x50, .flags = 0, .buf = &adrs, .len = 1 },
104 { .addr = 0x50, .flags = I2C_M_RD, .buf = pval, .len = 1 },
106 if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO;
110 static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
112 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
113 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
116 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
117 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) {
118 if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;
120 return dvb_attach(mt2060_attach,adap->fe, tun_i2c,&bristol_mt2060_config[adap->id],
121 if1) == NULL ? -ENODEV : 0;
124 /* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
127 static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = {
129 BAND_UHF, // band_caps
131 /* 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,
132 * 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 */
133 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), // setup
166 1, // perform_agc_softsplit
168 BAND_VHF | BAND_LBAND, // band_caps
170 /* 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,
171 * 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 */
172 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
205 1, // perform_agc_softsplit
209 static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = {
210 60000, 30000, // internal, sampling
211 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
212 0, 0, 1, 1, 2, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
213 (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
218 static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {
219 { .output_mpeg2_in_188_bytes = 1,
220 .hostbus_diversity = 1,
221 .tuner_is_baseband = 1,
223 .agc_config_count = 2,
224 .agc = stk7700d_7000p_mt2266_agc_config,
225 .bw = &stk7700d_mt2266_pll_config,
227 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
228 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
229 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
231 { .output_mpeg2_in_188_bytes = 1,
232 .hostbus_diversity = 1,
233 .tuner_is_baseband = 1,
235 .agc_config_count = 2,
236 .agc = stk7700d_7000p_mt2266_agc_config,
237 .bw = &stk7700d_mt2266_pll_config,
239 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
240 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
241 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
245 static struct mt2266_config stk7700d_mt2266_config[2] = {
246 { .i2c_address = 0x60
248 { .i2c_address = 0x60
252 static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap)
255 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
257 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
258 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
259 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
260 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
262 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
264 dib7000p_i2c_enumeration(&adap->dev->i2c_adap,1,18,stk7700d_dib7000p_mt2266_config);
267 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
268 &stk7700d_dib7000p_mt2266_config[adap->id]);
270 return adap->fe == NULL ? -ENODEV : 0;
273 static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap)
276 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
278 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
279 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
280 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
281 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
283 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
285 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
286 dib7000p_i2c_enumeration(&adap->dev->i2c_adap,2,18,stk7700d_dib7000p_mt2266_config);
289 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
290 &stk7700d_dib7000p_mt2266_config[adap->id]);
292 return adap->fe == NULL ? -ENODEV : 0;
295 static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap)
297 struct i2c_adapter *tun_i2c;
298 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
299 return dvb_attach(mt2266_attach, adap->fe, tun_i2c,
300 &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;;
303 /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
304 static struct dibx000_agc_config xc3028_agc_config = {
305 BAND_VHF | BAND_UHF, /* band_caps */
307 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
308 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
309 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
310 (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
311 (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */
314 21, /* time_stabiliz */
326 39718, /* agc2_max */
335 29, /* agc2_slope1 */
336 29, /* agc2_slope2 */
343 1, /* perform_agc_softsplit */
346 /* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
347 static struct dibx000_bandwidth_config xc3028_bw_config = {
348 60000, 30000, /* internal, sampling */
349 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
350 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc,
352 (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
353 (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
355 30000000, /* xtal_hz */
358 static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
359 .output_mpeg2_in_188_bytes = 1,
360 .tuner_is_baseband = 1,
362 .agc_config_count = 1,
363 .agc = &xc3028_agc_config,
364 .bw = &xc3028_bw_config,
366 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
367 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
368 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
371 static int stk7700ph_xc3028_callback(void *ptr, int component,
372 int command, int arg)
374 struct dvb_usb_adapter *adap = ptr;
377 case XC2028_TUNER_RESET:
378 /* Send the tuner in then out of reset */
379 dib7000p_set_gpio(adap->fe, 8, 0, 0); msleep(10);
380 dib7000p_set_gpio(adap->fe, 8, 0, 1);
382 case XC2028_RESET_CLK:
385 err("%s: unknown command %d, arg %d\n", __func__,
392 static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
393 .fname = XC2028_DEFAULT_FIRMWARE,
395 .demod = XC3028_FE_DIBCOM52,
398 static struct xc2028_config stk7700ph_xc3028_config = {
400 .ctrl = &stk7700ph_xc3028_ctrl,
403 static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
405 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;
407 if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
408 desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))
409 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
411 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
413 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
414 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
415 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
416 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
418 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
420 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
423 dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
424 &stk7700ph_dib7700_xc3028_config);
426 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
427 &stk7700ph_dib7700_xc3028_config);
429 return adap->fe == NULL ? -ENODEV : 0;
432 static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
434 struct i2c_adapter *tun_i2c;
436 tun_i2c = dib7000p_get_i2c_master(adap->fe,
437 DIBX000_I2C_INTERFACE_TUNER, 1);
439 stk7700ph_xc3028_config.i2c_adap = tun_i2c;
441 /* FIXME: generalize & move to common area */
442 adap->fe->callback = stk7700ph_xc3028_callback;
444 return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config)
445 == NULL ? -ENODEV : 0;
448 #define DEFAULT_RC_INTERVAL 150
450 static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
452 /* Number of keypresses to ignore before start repeating */
453 #define RC_REPEAT_DELAY 2
455 static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
459 struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
460 struct dib0700_state *st = d->priv;
462 *state = REMOTE_NO_KEY_PRESSED;
463 i=dib0700_ctrl_rd(d,rc_request,2,key,4);
465 err("RC Query Failed");
469 /* losing half of KEY_0 events from Philipps rc5 remotes.. */
470 if (key[0]==0 && key[1]==0 && key[2]==0 && key[3]==0) return 0;
472 /* 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]); */
474 dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */
476 switch (dvb_usb_dib0700_ir_proto) {
478 /* NEC protocol sends repeat code as 0 0 0 FF */
479 if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&
482 if (st->rc_counter > RC_REPEAT_DELAY) {
483 *event = d->last_event;
484 *state = REMOTE_KEY_PRESSED;
485 st->rc_counter = RC_REPEAT_DELAY;
489 for (i=0;i<d->props.rc_key_map_size; i++) {
490 if (keymap[i].custom == key[3-2] && keymap[i].data == key[3-3]) {
492 *event = keymap[i].event;
493 *state = REMOTE_KEY_PRESSED;
494 d->last_event = keymap[i].event;
501 /* RC-5 protocol changes toggle bit on new keypress */
502 for (i = 0; i < d->props.rc_key_map_size; i++) {
503 if (keymap[i].custom == key[3-2] && keymap[i].data == key[3-3]) {
504 if (d->last_event == keymap[i].event &&
505 key[3-1] == st->rc_toggle) {
507 /* prevents unwanted double hits */
508 if (st->rc_counter > RC_REPEAT_DELAY) {
509 *event = d->last_event;
510 *state = REMOTE_KEY_PRESSED;
511 st->rc_counter = RC_REPEAT_DELAY;
517 *event = keymap[i].event;
518 *state = REMOTE_KEY_PRESSED;
519 st->rc_toggle = key[3-1];
520 d->last_event = keymap[i].event;
527 err("Unknown remote controller key: %2X %2X %2X %2X", (int) key[3-2], (int) key[3-3], (int) key[3-1], (int) key[3]);
532 static struct dvb_usb_rc_key dib0700_rc_keys[] = {
533 /* Key codes for the tiny Pinnacle remote*/
534 { 0x07, 0x00, KEY_MUTE },
535 { 0x07, 0x01, KEY_MENU }, // Pinnacle logo
536 { 0x07, 0x39, KEY_POWER },
537 { 0x07, 0x03, KEY_VOLUMEUP },
538 { 0x07, 0x09, KEY_VOLUMEDOWN },
539 { 0x07, 0x06, KEY_CHANNELUP },
540 { 0x07, 0x0c, KEY_CHANNELDOWN },
541 { 0x07, 0x0f, KEY_1 },
542 { 0x07, 0x15, KEY_2 },
543 { 0x07, 0x10, KEY_3 },
544 { 0x07, 0x18, KEY_4 },
545 { 0x07, 0x1b, KEY_5 },
546 { 0x07, 0x1e, KEY_6 },
547 { 0x07, 0x11, KEY_7 },
548 { 0x07, 0x21, KEY_8 },
549 { 0x07, 0x12, KEY_9 },
550 { 0x07, 0x27, KEY_0 },
551 { 0x07, 0x24, KEY_SCREEN }, // 'Square' key
552 { 0x07, 0x2a, KEY_TEXT }, // 'T' key
553 { 0x07, 0x2d, KEY_REWIND },
554 { 0x07, 0x30, KEY_PLAY },
555 { 0x07, 0x33, KEY_FASTFORWARD },
556 { 0x07, 0x36, KEY_RECORD },
557 { 0x07, 0x3c, KEY_STOP },
558 { 0x07, 0x3f, KEY_CANCEL }, // '?' key
559 /* Key codes for the Terratec Cinergy DT XS Diversity, similar to cinergyT2.c */
560 { 0xeb, 0x01, KEY_POWER },
561 { 0xeb, 0x02, KEY_1 },
562 { 0xeb, 0x03, KEY_2 },
563 { 0xeb, 0x04, KEY_3 },
564 { 0xeb, 0x05, KEY_4 },
565 { 0xeb, 0x06, KEY_5 },
566 { 0xeb, 0x07, KEY_6 },
567 { 0xeb, 0x08, KEY_7 },
568 { 0xeb, 0x09, KEY_8 },
569 { 0xeb, 0x0a, KEY_9 },
570 { 0xeb, 0x0b, KEY_VIDEO },
571 { 0xeb, 0x0c, KEY_0 },
572 { 0xeb, 0x0d, KEY_REFRESH },
573 { 0xeb, 0x0f, KEY_EPG },
574 { 0xeb, 0x10, KEY_UP },
575 { 0xeb, 0x11, KEY_LEFT },
576 { 0xeb, 0x12, KEY_OK },
577 { 0xeb, 0x13, KEY_RIGHT },
578 { 0xeb, 0x14, KEY_DOWN },
579 { 0xeb, 0x16, KEY_INFO },
580 { 0xeb, 0x17, KEY_RED },
581 { 0xeb, 0x18, KEY_GREEN },
582 { 0xeb, 0x19, KEY_YELLOW },
583 { 0xeb, 0x1a, KEY_BLUE },
584 { 0xeb, 0x1b, KEY_CHANNELUP },
585 { 0xeb, 0x1c, KEY_VOLUMEUP },
586 { 0xeb, 0x1d, KEY_MUTE },
587 { 0xeb, 0x1e, KEY_VOLUMEDOWN },
588 { 0xeb, 0x1f, KEY_CHANNELDOWN },
589 { 0xeb, 0x40, KEY_PAUSE },
590 { 0xeb, 0x41, KEY_HOME },
591 { 0xeb, 0x42, KEY_MENU }, /* DVD Menu */
592 { 0xeb, 0x43, KEY_SUBTITLE },
593 { 0xeb, 0x44, KEY_TEXT }, /* Teletext */
594 { 0xeb, 0x45, KEY_DELETE },
595 { 0xeb, 0x46, KEY_TV },
596 { 0xeb, 0x47, KEY_DVD },
597 { 0xeb, 0x48, KEY_STOP },
598 { 0xeb, 0x49, KEY_VIDEO },
599 { 0xeb, 0x4a, KEY_AUDIO }, /* Music */
600 { 0xeb, 0x4b, KEY_SCREEN }, /* Pic */
601 { 0xeb, 0x4c, KEY_PLAY },
602 { 0xeb, 0x4d, KEY_BACK },
603 { 0xeb, 0x4e, KEY_REWIND },
604 { 0xeb, 0x4f, KEY_FASTFORWARD },
605 { 0xeb, 0x54, KEY_PREVIOUS },
606 { 0xeb, 0x58, KEY_RECORD },
607 { 0xeb, 0x5c, KEY_NEXT },
609 /* Key codes for the Haupauge WinTV Nova-TD, copied from nova-t-usb2.c (Nova-T USB2) */
610 { 0x1e, 0x00, KEY_0 },
611 { 0x1e, 0x01, KEY_1 },
612 { 0x1e, 0x02, KEY_2 },
613 { 0x1e, 0x03, KEY_3 },
614 { 0x1e, 0x04, KEY_4 },
615 { 0x1e, 0x05, KEY_5 },
616 { 0x1e, 0x06, KEY_6 },
617 { 0x1e, 0x07, KEY_7 },
618 { 0x1e, 0x08, KEY_8 },
619 { 0x1e, 0x09, KEY_9 },
620 { 0x1e, 0x0a, KEY_KPASTERISK },
621 { 0x1e, 0x0b, KEY_RED },
622 { 0x1e, 0x0c, KEY_RADIO },
623 { 0x1e, 0x0d, KEY_MENU },
624 { 0x1e, 0x0e, KEY_GRAVE }, /* # */
625 { 0x1e, 0x0f, KEY_MUTE },
626 { 0x1e, 0x10, KEY_VOLUMEUP },
627 { 0x1e, 0x11, KEY_VOLUMEDOWN },
628 { 0x1e, 0x12, KEY_CHANNEL },
629 { 0x1e, 0x14, KEY_UP },
630 { 0x1e, 0x15, KEY_DOWN },
631 { 0x1e, 0x16, KEY_LEFT },
632 { 0x1e, 0x17, KEY_RIGHT },
633 { 0x1e, 0x18, KEY_VIDEO },
634 { 0x1e, 0x19, KEY_AUDIO },
635 { 0x1e, 0x1a, KEY_MEDIA },
636 { 0x1e, 0x1b, KEY_EPG },
637 { 0x1e, 0x1c, KEY_TV },
638 { 0x1e, 0x1e, KEY_NEXT },
639 { 0x1e, 0x1f, KEY_BACK },
640 { 0x1e, 0x20, KEY_CHANNELUP },
641 { 0x1e, 0x21, KEY_CHANNELDOWN },
642 { 0x1e, 0x24, KEY_LAST }, /* Skip backwards */
643 { 0x1e, 0x25, KEY_OK },
644 { 0x1e, 0x29, KEY_BLUE},
645 { 0x1e, 0x2e, KEY_GREEN },
646 { 0x1e, 0x30, KEY_PAUSE },
647 { 0x1e, 0x32, KEY_REWIND },
648 { 0x1e, 0x34, KEY_FASTFORWARD },
649 { 0x1e, 0x35, KEY_PLAY },
650 { 0x1e, 0x36, KEY_STOP },
651 { 0x1e, 0x37, KEY_RECORD },
652 { 0x1e, 0x38, KEY_YELLOW },
653 { 0x1e, 0x3b, KEY_GOTO },
654 { 0x1e, 0x3d, KEY_POWER },
656 /* Key codes for the Leadtek Winfast DTV Dongle */
657 { 0x00, 0x42, KEY_POWER },
658 { 0x07, 0x7c, KEY_TUNER },
659 { 0x0f, 0x4e, KEY_PRINT }, /* PREVIEW */
660 { 0x08, 0x40, KEY_SCREEN }, /* full screen toggle*/
661 { 0x0f, 0x71, KEY_DOT }, /* frequency */
662 { 0x07, 0x43, KEY_0 },
663 { 0x0c, 0x41, KEY_1 },
664 { 0x04, 0x43, KEY_2 },
665 { 0x0b, 0x7f, KEY_3 },
666 { 0x0e, 0x41, KEY_4 },
667 { 0x06, 0x43, KEY_5 },
668 { 0x09, 0x7f, KEY_6 },
669 { 0x0d, 0x7e, KEY_7 },
670 { 0x05, 0x7c, KEY_8 },
671 { 0x0a, 0x40, KEY_9 },
672 { 0x0e, 0x4e, KEY_CLEAR },
673 { 0x04, 0x7c, KEY_CHANNEL }, /* show channel number */
674 { 0x0f, 0x41, KEY_LAST }, /* recall */
675 { 0x03, 0x42, KEY_MUTE },
676 { 0x06, 0x4c, KEY_RESERVED }, /* PIP button*/
677 { 0x01, 0x72, KEY_SHUFFLE }, /* SNAPSHOT */
678 { 0x0c, 0x4e, KEY_PLAYPAUSE }, /* TIMESHIFT */
679 { 0x0b, 0x70, KEY_RECORD },
680 { 0x03, 0x7d, KEY_VOLUMEUP },
681 { 0x01, 0x7d, KEY_VOLUMEDOWN },
682 { 0x02, 0x42, KEY_CHANNELUP },
683 { 0x00, 0x7d, KEY_CHANNELDOWN },
685 /* Key codes for Nova-TD "credit card" remote control. */
686 { 0x1d, 0x00, KEY_0 },
687 { 0x1d, 0x01, KEY_1 },
688 { 0x1d, 0x02, KEY_2 },
689 { 0x1d, 0x03, KEY_3 },
690 { 0x1d, 0x04, KEY_4 },
691 { 0x1d, 0x05, KEY_5 },
692 { 0x1d, 0x06, KEY_6 },
693 { 0x1d, 0x07, KEY_7 },
694 { 0x1d, 0x08, KEY_8 },
695 { 0x1d, 0x09, KEY_9 },
696 { 0x1d, 0x0a, KEY_TEXT },
697 { 0x1d, 0x0d, KEY_MENU },
698 { 0x1d, 0x0f, KEY_MUTE },
699 { 0x1d, 0x10, KEY_VOLUMEUP },
700 { 0x1d, 0x11, KEY_VOLUMEDOWN },
701 { 0x1d, 0x12, KEY_CHANNEL },
702 { 0x1d, 0x14, KEY_UP },
703 { 0x1d, 0x15, KEY_DOWN },
704 { 0x1d, 0x16, KEY_LEFT },
705 { 0x1d, 0x17, KEY_RIGHT },
706 { 0x1d, 0x1c, KEY_TV },
707 { 0x1d, 0x1e, KEY_NEXT },
708 { 0x1d, 0x1f, KEY_BACK },
709 { 0x1d, 0x20, KEY_CHANNELUP },
710 { 0x1d, 0x21, KEY_CHANNELDOWN },
711 { 0x1d, 0x24, KEY_LAST },
712 { 0x1d, 0x25, KEY_OK },
713 { 0x1d, 0x30, KEY_PAUSE },
714 { 0x1d, 0x32, KEY_REWIND },
715 { 0x1d, 0x34, KEY_FASTFORWARD },
716 { 0x1d, 0x35, KEY_PLAY },
717 { 0x1d, 0x36, KEY_STOP },
718 { 0x1d, 0x37, KEY_RECORD },
719 { 0x1d, 0x3b, KEY_GOTO },
720 { 0x1d, 0x3d, KEY_POWER },
723 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
724 static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
725 BAND_UHF | BAND_VHF, // band_caps
727 /* 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,
728 * 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 */
729 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
761 1, // perform_agc_softsplit
764 51800, // global_split_min
765 24700 // global_split_max
769 static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
772 /* 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,
773 * 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 */
774 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
811 0, // perform_agc_softsplit
814 static struct dibx000_bandwidth_config stk7700p_pll_config = {
815 60000, 30000, // internal, sampling
816 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
817 0, 0, 1, 1, 0, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
818 (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
824 static struct dib7000m_config stk7700p_dib7000m_config = {
826 .output_mpeg2_in_188_bytes = 1,
829 .agc_config_count = 1,
830 .agc = &stk7700p_7000m_mt2060_agc_config,
831 .bw = &stk7700p_pll_config,
833 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
834 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
835 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
838 static struct dib7000p_config stk7700p_dib7000p_config = {
839 .output_mpeg2_in_188_bytes = 1,
841 .agc_config_count = 1,
842 .agc = &stk7700p_7000p_mt2060_agc_config,
843 .bw = &stk7700p_pll_config,
845 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
846 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
847 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
850 static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
852 struct dib0700_state *st = adap->dev->priv;
853 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
855 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
856 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
858 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
859 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
861 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
862 dib0700_ctrl_clock(adap->dev, 72, 1);
863 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
865 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
867 st->mt2060_if1[0] = 1220;
869 if (dib7000pc_detection(&adap->dev->i2c_adap)) {
870 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
871 st->is_dib7000pc = 1;
873 adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
875 return adap->fe == NULL ? -ENODEV : 0;
878 static struct mt2060_config stk7700p_mt2060_config = {
882 static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
884 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
885 struct dib0700_state *st = adap->dev->priv;
886 struct i2c_adapter *tun_i2c;
889 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
890 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
891 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
893 if (st->is_dib7000pc)
894 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
896 tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
898 return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config,
899 if1) == NULL ? -ENODEV : 0;
902 /* DIB7070 generic */
903 static struct dibx000_agc_config dib7070_agc_config = {
904 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
905 /* 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,
906 * 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 */
907 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), // setup
941 0, // perform_agc_softsplit
944 static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
946 return dib7000p_set_gpio(fe, 8, 0, !onoff);
949 static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
951 return dib7000p_set_gpio(fe, 9, 0, onoff);
954 static struct dib0070_config dib7070p_dib0070_config[2] = {
956 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
957 .reset = dib7070_tuner_reset,
958 .sleep = dib7070_tuner_sleep,
962 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
963 .reset = dib7070_tuner_reset,
964 .sleep = dib7070_tuner_sleep,
970 static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
972 struct dvb_usb_adapter *adap = fe->dvb->priv;
973 struct dib0700_adapter_state *state = adap->priv;
976 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
978 case BAND_VHF: offset = 950; break;
980 default: offset = 550; break;
982 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
983 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
984 return state->set_param_save(fe, fep);
987 static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
989 struct dib0700_adapter_state *st = adap->priv;
990 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
993 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
996 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
1000 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1001 adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override;
1005 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
1006 60000, 15000, // internal, sampling
1007 1, 20, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
1008 0, 0, 1, 1, 2, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
1009 (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
1010 (0 << 25) | 0, // ifreq = 0.000000 MHz
1012 12000000, // xtal_hz
1015 static struct dib7000p_config dib7070p_dib7000p_config = {
1016 .output_mpeg2_in_188_bytes = 1,
1018 .agc_config_count = 1,
1019 .agc = &dib7070_agc_config,
1020 .bw = &dib7070_bw_config_12_mhz,
1021 .tuner_is_baseband = 1,
1024 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1025 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1026 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1028 .hostbus_diversity = 1,
1032 static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
1034 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
1035 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
1036 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
1037 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1039 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1041 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1042 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1043 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1044 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1046 dib0700_ctrl_clock(adap->dev, 72, 1);
1049 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1051 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1053 dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1054 &dib7070p_dib7000p_config);
1056 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
1057 &dib7070p_dib7000p_config);
1058 return adap->fe == NULL ? -ENODEV : 0;
1062 static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
1064 .output_mpeg2_in_188_bytes = 1,
1066 .agc_config_count = 1,
1067 .agc = &dib7070_agc_config,
1068 .bw = &dib7070_bw_config_12_mhz,
1069 .tuner_is_baseband = 1,
1072 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1073 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1074 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1076 .hostbus_diversity = 1,
1078 .output_mpeg2_in_188_bytes = 1,
1080 .agc_config_count = 1,
1081 .agc = &dib7070_agc_config,
1082 .bw = &dib7070_bw_config_12_mhz,
1083 .tuner_is_baseband = 1,
1086 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1087 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1088 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1090 .hostbus_diversity = 1,
1094 static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
1096 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1098 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1099 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1100 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1101 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1103 dib0700_ctrl_clock(adap->dev, 72, 1);
1106 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1108 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1110 dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, stk7070pd_dib7000p_config);
1112 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
1113 return adap->fe == NULL ? -ENODEV : 0;
1116 static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
1118 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
1119 return adap->fe == NULL ? -ENODEV : 0;
1123 static struct s5h1411_config pinnacle_801e_config = {
1124 .output_mode = S5H1411_PARALLEL_OUTPUT,
1125 .gpio = S5H1411_GPIO_OFF,
1126 .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
1127 .qam_if = S5H1411_IF_44000,
1128 .vsb_if = S5H1411_IF_44000,
1129 .inversion = S5H1411_INVERSION_OFF,
1130 .status_mode = S5H1411_DEMODLOCKING
1133 /* Pinnacle PCTV HD Pro 801e GPIOs map:
1134 GPIO0 - currently unknown
1135 GPIO1 - xc5000 tuner reset
1136 GPIO2 - CX25843 sleep
1137 GPIO3 - currently unknown
1138 GPIO4 - currently unknown
1139 GPIO6 - currently unknown
1140 GPIO7 - currently unknown
1141 GPIO9 - currently unknown
1142 GPIO10 - CX25843 reset
1144 static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
1146 struct dib0700_state *st = adap->dev->priv;
1148 /* Make use of the new i2c functions from FW 1.20 */
1149 st->fw_use_new_i2c_api = 1;
1151 /* The s5h1411 requires the dib0700 to not be in master mode */
1152 st->disable_streaming_master_mode = 1;
1154 /* All msleep values taken from Windows USB trace */
1155 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
1156 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
1157 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1159 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1161 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1163 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1164 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1165 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1166 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1167 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
1170 /* Put the CX25843 to sleep for now since we're in digital mode */
1171 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
1173 /* GPIOs are initialized, do the attach */
1174 adap->fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
1175 &adap->dev->i2c_adap);
1176 return adap->fe == NULL ? -ENODEV : 0;
1179 static int dib0700_xc5000_tuner_callback(void *priv, int component,
1180 int command, int arg)
1182 struct dvb_usb_adapter *adap = priv;
1184 if (command == XC5000_TUNER_RESET) {
1185 /* Reset the tuner */
1186 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
1187 msleep(330); /* from Windows USB trace */
1188 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
1189 msleep(330); /* from Windows USB trace */
1191 err("xc5000: unknown tuner callback command: %d\n", command);
1198 static struct xc5000_config s5h1411_xc5000_tunerconfig = {
1199 .i2c_address = 0x64,
1203 static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
1205 /* FIXME: generalize & move to common area */
1206 adap->fe->callback = dib0700_xc5000_tuner_callback;
1208 return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap,
1209 &s5h1411_xc5000_tunerconfig)
1210 == NULL ? -ENODEV : 0;
1213 /* DVB-USB and USB stuff follows */
1214 struct usb_device_id dib0700_usb_id_table[] = {
1215 /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
1216 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
1217 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
1218 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
1219 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
1220 /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
1221 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
1222 { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
1223 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
1224 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
1225 /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
1226 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
1227 { USB_DEVICE(USB_VID_TERRATEC,
1228 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
1229 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
1230 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
1231 /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
1232 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
1233 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
1234 { USB_DEVICE(USB_VID_PINNACLE,
1235 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
1236 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
1237 /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
1238 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
1239 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
1240 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
1241 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
1242 /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
1243 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
1244 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
1245 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
1246 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
1247 /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
1248 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
1249 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
1250 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
1251 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
1252 /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
1253 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
1254 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
1255 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
1256 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
1257 /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
1258 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
1259 { 0 } /* Terminating entry */
1261 MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
1263 #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
1264 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
1265 .usb_ctrl = DEVICE_SPECIFIC, \
1266 .firmware = "dvb-usb-dib0700-1.20.fw", \
1267 .download_firmware = dib0700_download_firmware, \
1268 .no_reconnect = 1, \
1269 .size_of_priv = sizeof(struct dib0700_state), \
1270 .i2c_algo = &dib0700_i2c_algo, \
1271 .identify_state = dib0700_identify_state
1273 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
1274 .streaming_ctrl = dib0700_streaming_ctrl, \
1281 .buffersize = 39480, \
1286 struct dvb_usb_device_properties dib0700_devices[] = {
1288 DIB0700_DEFAULT_DEVICE_PROPERTIES,
1293 .frontend_attach = stk7700p_frontend_attach,
1294 .tuner_attach = stk7700p_tuner_attach,
1296 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
1300 .num_device_descs = 8,
1302 { "DiBcom STK7700P reference design",
1303 { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
1306 { "Hauppauge Nova-T Stick",
1307 { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
1310 { "AVerMedia AVerTV DVB-T Volar",
1311 { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
1314 { "Compro Videomate U500",
1315 { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
1318 { "Uniwill STK7700P based (Hama and others)",
1319 { &dib0700_usb_id_table[7], NULL },
1322 { "Leadtek Winfast DTV Dongle (STK7700P based)",
1323 { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
1326 { "AVerMedia AVerTV DVB-T Express",
1327 { &dib0700_usb_id_table[20] },
1331 { &dib0700_usb_id_table[21], NULL },
1336 .rc_interval = DEFAULT_RC_INTERVAL,
1337 .rc_key_map = dib0700_rc_keys,
1338 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
1339 .rc_query = dib0700_rc_query
1340 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
1345 .frontend_attach = bristol_frontend_attach,
1346 .tuner_attach = bristol_tuner_attach,
1348 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
1350 .frontend_attach = bristol_frontend_attach,
1351 .tuner_attach = bristol_tuner_attach,
1353 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
1357 .num_device_descs = 1,
1359 { "Hauppauge Nova-T 500 Dual DVB-T",
1360 { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
1365 .rc_interval = DEFAULT_RC_INTERVAL,
1366 .rc_key_map = dib0700_rc_keys,
1367 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
1368 .rc_query = dib0700_rc_query
1369 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
1374 .frontend_attach = stk7700d_frontend_attach,
1375 .tuner_attach = stk7700d_tuner_attach,
1377 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
1379 .frontend_attach = stk7700d_frontend_attach,
1380 .tuner_attach = stk7700d_tuner_attach,
1382 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
1386 .num_device_descs = 4,
1388 { "Pinnacle PCTV 2000e",
1389 { &dib0700_usb_id_table[11], NULL },
1392 { "Terratec Cinergy DT XS Diversity",
1393 { &dib0700_usb_id_table[12], NULL },
1396 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
1397 { &dib0700_usb_id_table[13], NULL },
1400 { "DiBcom STK7700D reference design",
1401 { &dib0700_usb_id_table[14], NULL },
1406 .rc_interval = DEFAULT_RC_INTERVAL,
1407 .rc_key_map = dib0700_rc_keys,
1408 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
1409 .rc_query = dib0700_rc_query
1411 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
1416 .frontend_attach = stk7700P2_frontend_attach,
1417 .tuner_attach = stk7700d_tuner_attach,
1419 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
1423 .num_device_descs = 2,
1425 { "ASUS My Cinema U3000 Mini DVBT Tuner",
1426 { &dib0700_usb_id_table[23], NULL },
1430 { &dib0700_usb_id_table[31], NULL },
1435 .rc_interval = DEFAULT_RC_INTERVAL,
1436 .rc_key_map = dib0700_rc_keys,
1437 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
1438 .rc_query = dib0700_rc_query
1439 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
1444 .frontend_attach = stk7070p_frontend_attach,
1445 .tuner_attach = dib7070p_tuner_attach,
1447 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
1449 .size_of_priv = sizeof(struct dib0700_adapter_state),
1453 .num_device_descs = 9,
1455 { "DiBcom STK7070P reference design",
1456 { &dib0700_usb_id_table[15], NULL },
1459 { "Pinnacle PCTV DVB-T Flash Stick",
1460 { &dib0700_usb_id_table[16], NULL },
1463 { "Artec T14BR DVB-T",
1464 { &dib0700_usb_id_table[22], NULL },
1467 { "ASUS My Cinema U3100 Mini DVBT Tuner",
1468 { &dib0700_usb_id_table[24], NULL },
1471 { "Hauppauge Nova-T Stick",
1472 { &dib0700_usb_id_table[25], NULL },
1475 { "Hauppauge Nova-T MyTV.t",
1476 { &dib0700_usb_id_table[26], NULL },
1479 { "Pinnacle PCTV 72e",
1480 { &dib0700_usb_id_table[29], NULL },
1483 { "Pinnacle PCTV 73e",
1484 { &dib0700_usb_id_table[30], NULL },
1487 { "Terratec Cinergy T USB XXS",
1488 { &dib0700_usb_id_table[33], NULL },
1493 .rc_interval = DEFAULT_RC_INTERVAL,
1494 .rc_key_map = dib0700_rc_keys,
1495 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
1496 .rc_query = dib0700_rc_query
1498 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
1503 .frontend_attach = stk7070pd_frontend_attach0,
1504 .tuner_attach = dib7070p_tuner_attach,
1506 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
1508 .size_of_priv = sizeof(struct dib0700_adapter_state),
1510 .frontend_attach = stk7070pd_frontend_attach1,
1511 .tuner_attach = dib7070p_tuner_attach,
1513 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
1515 .size_of_priv = sizeof(struct dib0700_adapter_state),
1519 .num_device_descs = 4,
1521 { "DiBcom STK7070PD reference design",
1522 { &dib0700_usb_id_table[17], NULL },
1525 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
1526 { &dib0700_usb_id_table[18], NULL },
1529 { "Hauppauge Nova-TD Stick (52009)",
1530 { &dib0700_usb_id_table[35], NULL },
1533 { "Hauppauge Nova-TD-500 (84xxx)",
1534 { &dib0700_usb_id_table[36], NULL },
1538 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
1543 .frontend_attach = stk7700ph_frontend_attach,
1544 .tuner_attach = stk7700ph_tuner_attach,
1546 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
1548 .size_of_priv = sizeof(struct
1549 dib0700_adapter_state),
1553 .num_device_descs = 5,
1555 { "Terratec Cinergy HT USB XE",
1556 { &dib0700_usb_id_table[27], NULL },
1559 { "Pinnacle Expresscard 320cx",
1560 { &dib0700_usb_id_table[28], NULL },
1563 { "Terratec Cinergy HT Express",
1564 { &dib0700_usb_id_table[32], NULL },
1567 { "Gigabyte U8000-RH",
1568 { &dib0700_usb_id_table[37], NULL },
1571 { "YUAN High-Tech STK7700PH",
1572 { &dib0700_usb_id_table[38], NULL },
1575 { "Asus My Cinema-U3000Hybrid",
1576 { &dib0700_usb_id_table[39], NULL },
1580 .rc_interval = DEFAULT_RC_INTERVAL,
1581 .rc_key_map = dib0700_rc_keys,
1582 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
1583 .rc_query = dib0700_rc_query
1584 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
1588 .frontend_attach = s5h1411_frontend_attach,
1589 .tuner_attach = xc5000_tuner_attach,
1591 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
1593 .size_of_priv = sizeof(struct
1594 dib0700_adapter_state),
1598 .num_device_descs = 2,
1600 { "Pinnacle PCTV HD Pro USB Stick",
1601 { &dib0700_usb_id_table[40], NULL },
1604 { "Pinnacle PCTV HD USB Stick",
1605 { &dib0700_usb_id_table[41], NULL },
1609 .rc_interval = DEFAULT_RC_INTERVAL,
1610 .rc_key_map = dib0700_rc_keys,
1611 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
1612 .rc_query = dib0700_rc_query
1616 int dib0700_device_count = ARRAY_SIZE(dib0700_devices);