First Support on Ginger and OMAP TI
[linux-ginger.git] / drivers / media / dvb / dvb-usb / dib0700_devices.c
blob0b2812aa30a4a726964af3ad0b95378c48c6d2ca
1 /* Linux driver for devices based on the DiBcom DiB0700 USB bridge
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the Free
5 * Software Foundation, version 2.
7 * Copyright (C) 2005-9 DiBcom, SA et al
8 */
9 #include "dib0700.h"
11 #include "dib3000mc.h"
12 #include "dib7000m.h"
13 #include "dib7000p.h"
14 #include "dib8000.h"
15 #include "mt2060.h"
16 #include "mt2266.h"
17 #include "tuner-xc2028.h"
18 #include "xc5000.h"
19 #include "s5h1411.h"
20 #include "dib0070.h"
21 #include "lgdt3305.h"
22 #include "mxl5007t.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] = {
37 .i2c_address = 0x60,
38 .clock_out = 3,
39 }, {
40 .i2c_address = 0x61,
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),
49 .agc1_max = 42598,
50 .agc1_min = 17694,
51 .agc2_max = 45875,
52 .agc2_min = 0,
54 .agc1_pt1 = 0,
55 .agc1_pt2 = 59,
57 .agc1_slope1 = 0,
58 .agc1_slope2 = 69,
60 .agc2_pt1 = 0,
61 .agc2_pt2 = 59,
63 .agc2_slope1 = 111,
64 .agc2_slope2 = 28,
67 static struct dib3000mc_config bristol_dib3000mc_config[2] = {
68 { .agc = &bristol_dib3000p_mt2060_agc_config,
69 .max_time = 0x196,
70 .ln_adc_level = 0x1cc7,
71 .output_mpeg2_in_188_bytes = 1,
73 { .agc = &bristol_dib3000p_mt2060_agc_config,
74 .max_time = 0x196,
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;
83 if (adap->id == 0) {
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);
91 else
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);
96 return -ENODEV;
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;
111 return 0;
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);
118 s8 a;
119 int if1=1220;
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 */
130 /* MT226x */
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
139 1130, // inv_gain
140 21, // time_stabiliz
142 0, // alpha_level
143 118, // thlock
145 0, // wbd_inv
146 3530, // wbd_ref
147 1, // wbd_sel
148 0, // wbd_alpha
150 65535, // agc1_max
151 33770, // agc1_min
152 65535, // agc2_max
153 23592, // agc2_min
155 0, // agc1_pt1
156 62, // agc1_pt2
157 255, // agc1_pt3
158 64, // agc1_slope1
159 64, // agc1_slope2
160 132, // agc2_pt1
161 192, // agc2_pt2
162 80, // agc2_slope1
163 80, // agc2_slope2
165 17, // alpha_mant
166 27, // alpha_exp
167 23, // beta_mant
168 51, // beta_exp
170 1, // perform_agc_softsplit
171 }, {
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
178 2372, // inv_gain
179 21, // time_stabiliz
181 0, // alpha_level
182 118, // thlock
184 0, // wbd_inv
185 3530, // wbd_ref
186 1, // wbd_sel
187 0, // wbd_alpha
189 65535, // agc1_max
190 0, // agc1_min
191 65535, // agc2_max
192 23592, // agc2_min
194 0, // agc1_pt1
195 128, // agc1_pt2
196 128, // agc1_pt3
197 128, // agc1_slope1
198 0, // agc1_slope2
199 128, // agc2_pt1
200 253, // agc2_pt2
201 81, // agc2_slope1
202 0, // agc2_slope2
204 17, // alpha_mant
205 27, // alpha_exp
206 23, // beta_mant
207 51, // beta_exp
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
218 0, // ifreq
219 20452225, // timf
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)
258 if (adap->id == 0) {
259 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
260 msleep(10);
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);
265 msleep(10);
266 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
267 msleep(10);
268 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
269 stk7700d_dib7000p_mt2266_config)
270 != 0) {
271 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
272 return -ENODEV;
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)
284 if (adap->id == 0) {
285 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
286 msleep(10);
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);
291 msleep(10);
292 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
293 msleep(10);
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)
297 != 0) {
298 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
299 return -ENODEV;
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 */
327 712, /* inv_gain */
328 21, /* time_stabiliz */
330 0, /* alpha_level */
331 118, /* thlock */
333 0, /* wbd_inv */
334 2867, /* wbd_ref */
335 0, /* wbd_sel */
336 2, /* wbd_alpha */
338 0, /* agc1_max */
339 0, /* agc1_min */
340 39718, /* agc2_max */
341 9930, /* agc2_min */
342 0, /* agc1_pt1 */
343 0, /* agc1_pt2 */
344 0, /* agc1_pt3 */
345 0, /* agc1_slope1 */
346 0, /* agc1_slope2 */
347 0, /* agc2_pt1 */
348 128, /* agc2_pt2 */
349 29, /* agc2_slope1 */
350 29, /* agc2_slope2 */
352 17, /* alpha_mant */
353 27, /* alpha_exp */
354 23, /* beta_mant */
355 51, /* beta_exp */
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,
365 modulo */
366 (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
367 (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
368 20452225, /* timf */
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;
390 switch (command) {
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);
395 break;
396 case XC2028_RESET_CLK:
397 break;
398 default:
399 err("%s: unknown command %d, arg %d\n", __func__,
400 command, arg);
401 return -EINVAL;
403 return 0;
406 static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
407 .fname = XC2028_DEFAULT_FIRMWARE,
408 .max_len = 64,
409 .demod = XC3028_FE_DIBCOM52,
412 static struct xc2028_config stk7700ph_xc3028_config = {
413 .i2c_addr = 0x61,
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);
424 else
425 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
426 msleep(20);
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);
431 msleep(10);
432 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
433 msleep(20);
434 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
435 msleep(10);
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",
440 __func__);
441 return -ENODEV;
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,
478 int *state)
480 u8 key[4];
481 int i;
482 struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
483 struct dib0700_state *st = d->priv;
484 *event = 0;
485 *state = REMOTE_NO_KEY_PRESSED;
486 i=dib0700_ctrl_rd(d,rc_request,2,key,4);
487 if (i<=0) {
488 err("RC Query Failed");
489 return -1;
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) {
500 case 0: {
501 /* NEC protocol sends repeat code as 0 0 0 FF */
502 if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&
503 (key[3] == 0xFF)) {
504 st->rc_counter++;
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;
510 return 0;
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]) {
515 st->rc_counter = 0;
516 *event = keymap[i].event;
517 *state = REMOTE_KEY_PRESSED;
518 d->last_event = keymap[i].event;
519 return 0;
522 break;
524 default: {
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) {
531 st->rc_counter++;
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;
539 return 0;
541 st->rc_counter = 0;
542 *event = keymap[i].event;
543 *state = REMOTE_KEY_PRESSED;
544 st->rc_toggle = key[3-1];
545 d->last_event = keymap[i].event;
546 return 0;
549 break;
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]);
553 d->last_event = 0;
554 return 0;
557 /* This is the structure of the RC response packet starting in firmware 1.20 */
558 struct dib0700_rc_response {
559 u8 report_id;
560 u8 data_state;
561 u8 system_msb;
562 u8 system_lsb;
563 u8 data;
564 u8 not_data;
567 /* This supports the new IR response format for firmware v1.20 */
568 static int dib0700_rc_query_v1_20(struct dvb_usb_device *d, u32 *event,
569 int *state)
571 struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
572 struct dib0700_state *st = d->priv;
573 struct dib0700_rc_response poll_reply;
574 u8 buf[6];
575 int i;
576 int status;
577 int actlen;
578 int found = 0;
580 /* Set initial results in case we exit the function early */
581 *event = 0;
582 *state = REMOTE_NO_KEY_PRESSED;
584 /* Firmware v1.20 provides RC data via bulk endpoint 1 */
585 status = usb_bulk_msg(d->udev, usb_rcvbulkpipe(d->udev, 1), buf,
586 sizeof(buf), &actlen, 50);
587 if (status < 0) {
588 /* No data available (meaning no key press) */
589 return 0;
592 if (actlen != sizeof(buf)) {
593 /* We didn't get back the 6 byte message we expected */
594 err("Unexpected RC response size [%d]", actlen);
595 return -1;
598 poll_reply.report_id = buf[0];
599 poll_reply.data_state = buf[1];
600 poll_reply.system_msb = buf[2];
601 poll_reply.system_lsb = buf[3];
602 poll_reply.data = buf[4];
603 poll_reply.not_data = buf[5];
606 info("rid=%02x ds=%02x sm=%02x sl=%02x d=%02x nd=%02x\n",
607 poll_reply.report_id, poll_reply.data_state,
608 poll_reply.system_msb, poll_reply.system_lsb,
609 poll_reply.data, poll_reply.not_data);
612 if ((poll_reply.data + poll_reply.not_data) != 0xff) {
613 /* Key failed integrity check */
614 err("key failed integrity check: %02x %02x %02x %02x",
615 poll_reply.system_msb, poll_reply.system_lsb,
616 poll_reply.data, poll_reply.not_data);
617 return -1;
620 /* Find the key in the map */
621 for (i = 0; i < d->props.rc_key_map_size; i++) {
622 if (rc5_custom(&keymap[i]) == poll_reply.system_lsb &&
623 rc5_data(&keymap[i]) == poll_reply.data) {
624 *event = keymap[i].event;
625 found = 1;
626 break;
630 if (found == 0) {
631 err("Unknown remote controller key: %02x %02x %02x %02x",
632 poll_reply.system_msb, poll_reply.system_lsb,
633 poll_reply.data, poll_reply.not_data);
634 d->last_event = 0;
635 return 0;
638 if (poll_reply.data_state == 1) {
639 /* New key hit */
640 st->rc_counter = 0;
641 *event = keymap[i].event;
642 *state = REMOTE_KEY_PRESSED;
643 d->last_event = keymap[i].event;
644 } else if (poll_reply.data_state == 2) {
645 /* Key repeated */
646 st->rc_counter++;
648 /* prevents unwanted double hits */
649 if (st->rc_counter > RC_REPEAT_DELAY_V1_20) {
650 *event = d->last_event;
651 *state = REMOTE_KEY_PRESSED;
652 st->rc_counter = RC_REPEAT_DELAY_V1_20;
654 } else {
655 err("Unknown data state [%d]", poll_reply.data_state);
658 return 0;
661 static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
663 struct dib0700_state *st = d->priv;
665 /* Because some people may have improperly named firmware files,
666 let's figure out whether to use the new firmware call or the legacy
667 call based on the firmware version embedded in the file */
668 if (st->rc_func_version == 0) {
669 u32 hwver, romver, ramver, fwtype;
670 int ret = dib0700_get_version(d, &hwver, &romver, &ramver,
671 &fwtype);
672 if (ret < 0) {
673 err("Could not determine version info");
674 return -1;
676 if (ramver < 0x10200)
677 st->rc_func_version = 1;
678 else
679 st->rc_func_version = 2;
682 if (st->rc_func_version == 2)
683 return dib0700_rc_query_v1_20(d, event, state);
684 else
685 return dib0700_rc_query_legacy(d, event, state);
688 static struct dvb_usb_rc_key dib0700_rc_keys[] = {
689 /* Key codes for the tiny Pinnacle remote*/
690 { 0x0700, KEY_MUTE },
691 { 0x0701, KEY_MENU }, /* Pinnacle logo */
692 { 0x0739, KEY_POWER },
693 { 0x0703, KEY_VOLUMEUP },
694 { 0x0709, KEY_VOLUMEDOWN },
695 { 0x0706, KEY_CHANNELUP },
696 { 0x070c, KEY_CHANNELDOWN },
697 { 0x070f, KEY_1 },
698 { 0x0715, KEY_2 },
699 { 0x0710, KEY_3 },
700 { 0x0718, KEY_4 },
701 { 0x071b, KEY_5 },
702 { 0x071e, KEY_6 },
703 { 0x0711, KEY_7 },
704 { 0x0721, KEY_8 },
705 { 0x0712, KEY_9 },
706 { 0x0727, KEY_0 },
707 { 0x0724, KEY_SCREEN }, /* 'Square' key */
708 { 0x072a, KEY_TEXT }, /* 'T' key */
709 { 0x072d, KEY_REWIND },
710 { 0x0730, KEY_PLAY },
711 { 0x0733, KEY_FASTFORWARD },
712 { 0x0736, KEY_RECORD },
713 { 0x073c, KEY_STOP },
714 { 0x073f, KEY_CANCEL }, /* '?' key */
715 /* Key codes for the Terratec Cinergy DT XS Diversity, similar to cinergyT2.c */
716 { 0xeb01, KEY_POWER },
717 { 0xeb02, KEY_1 },
718 { 0xeb03, KEY_2 },
719 { 0xeb04, KEY_3 },
720 { 0xeb05, KEY_4 },
721 { 0xeb06, KEY_5 },
722 { 0xeb07, KEY_6 },
723 { 0xeb08, KEY_7 },
724 { 0xeb09, KEY_8 },
725 { 0xeb0a, KEY_9 },
726 { 0xeb0b, KEY_VIDEO },
727 { 0xeb0c, KEY_0 },
728 { 0xeb0d, KEY_REFRESH },
729 { 0xeb0f, KEY_EPG },
730 { 0xeb10, KEY_UP },
731 { 0xeb11, KEY_LEFT },
732 { 0xeb12, KEY_OK },
733 { 0xeb13, KEY_RIGHT },
734 { 0xeb14, KEY_DOWN },
735 { 0xeb16, KEY_INFO },
736 { 0xeb17, KEY_RED },
737 { 0xeb18, KEY_GREEN },
738 { 0xeb19, KEY_YELLOW },
739 { 0xeb1a, KEY_BLUE },
740 { 0xeb1b, KEY_CHANNELUP },
741 { 0xeb1c, KEY_VOLUMEUP },
742 { 0xeb1d, KEY_MUTE },
743 { 0xeb1e, KEY_VOLUMEDOWN },
744 { 0xeb1f, KEY_CHANNELDOWN },
745 { 0xeb40, KEY_PAUSE },
746 { 0xeb41, KEY_HOME },
747 { 0xeb42, KEY_MENU }, /* DVD Menu */
748 { 0xeb43, KEY_SUBTITLE },
749 { 0xeb44, KEY_TEXT }, /* Teletext */
750 { 0xeb45, KEY_DELETE },
751 { 0xeb46, KEY_TV },
752 { 0xeb47, KEY_DVD },
753 { 0xeb48, KEY_STOP },
754 { 0xeb49, KEY_VIDEO },
755 { 0xeb4a, KEY_AUDIO }, /* Music */
756 { 0xeb4b, KEY_SCREEN }, /* Pic */
757 { 0xeb4c, KEY_PLAY },
758 { 0xeb4d, KEY_BACK },
759 { 0xeb4e, KEY_REWIND },
760 { 0xeb4f, KEY_FASTFORWARD },
761 { 0xeb54, KEY_PREVIOUS },
762 { 0xeb58, KEY_RECORD },
763 { 0xeb5c, KEY_NEXT },
765 /* Key codes for the Haupauge WinTV Nova-TD, copied from nova-t-usb2.c (Nova-T USB2) */
766 { 0x1e00, KEY_0 },
767 { 0x1e01, KEY_1 },
768 { 0x1e02, KEY_2 },
769 { 0x1e03, KEY_3 },
770 { 0x1e04, KEY_4 },
771 { 0x1e05, KEY_5 },
772 { 0x1e06, KEY_6 },
773 { 0x1e07, KEY_7 },
774 { 0x1e08, KEY_8 },
775 { 0x1e09, KEY_9 },
776 { 0x1e0a, KEY_KPASTERISK },
777 { 0x1e0b, KEY_RED },
778 { 0x1e0c, KEY_RADIO },
779 { 0x1e0d, KEY_MENU },
780 { 0x1e0e, KEY_GRAVE }, /* # */
781 { 0x1e0f, KEY_MUTE },
782 { 0x1e10, KEY_VOLUMEUP },
783 { 0x1e11, KEY_VOLUMEDOWN },
784 { 0x1e12, KEY_CHANNEL },
785 { 0x1e14, KEY_UP },
786 { 0x1e15, KEY_DOWN },
787 { 0x1e16, KEY_LEFT },
788 { 0x1e17, KEY_RIGHT },
789 { 0x1e18, KEY_VIDEO },
790 { 0x1e19, KEY_AUDIO },
791 { 0x1e1a, KEY_MEDIA },
792 { 0x1e1b, KEY_EPG },
793 { 0x1e1c, KEY_TV },
794 { 0x1e1e, KEY_NEXT },
795 { 0x1e1f, KEY_BACK },
796 { 0x1e20, KEY_CHANNELUP },
797 { 0x1e21, KEY_CHANNELDOWN },
798 { 0x1e24, KEY_LAST }, /* Skip backwards */
799 { 0x1e25, KEY_OK },
800 { 0x1e29, KEY_BLUE},
801 { 0x1e2e, KEY_GREEN },
802 { 0x1e30, KEY_PAUSE },
803 { 0x1e32, KEY_REWIND },
804 { 0x1e34, KEY_FASTFORWARD },
805 { 0x1e35, KEY_PLAY },
806 { 0x1e36, KEY_STOP },
807 { 0x1e37, KEY_RECORD },
808 { 0x1e38, KEY_YELLOW },
809 { 0x1e3b, KEY_GOTO },
810 { 0x1e3d, KEY_POWER },
812 /* Key codes for the Leadtek Winfast DTV Dongle */
813 { 0x0042, KEY_POWER },
814 { 0x077c, KEY_TUNER },
815 { 0x0f4e, KEY_PRINT }, /* PREVIEW */
816 { 0x0840, KEY_SCREEN }, /* full screen toggle*/
817 { 0x0f71, KEY_DOT }, /* frequency */
818 { 0x0743, KEY_0 },
819 { 0x0c41, KEY_1 },
820 { 0x0443, KEY_2 },
821 { 0x0b7f, KEY_3 },
822 { 0x0e41, KEY_4 },
823 { 0x0643, KEY_5 },
824 { 0x097f, KEY_6 },
825 { 0x0d7e, KEY_7 },
826 { 0x057c, KEY_8 },
827 { 0x0a40, KEY_9 },
828 { 0x0e4e, KEY_CLEAR },
829 { 0x047c, KEY_CHANNEL }, /* show channel number */
830 { 0x0f41, KEY_LAST }, /* recall */
831 { 0x0342, KEY_MUTE },
832 { 0x064c, KEY_RESERVED }, /* PIP button*/
833 { 0x0172, KEY_SHUFFLE }, /* SNAPSHOT */
834 { 0x0c4e, KEY_PLAYPAUSE }, /* TIMESHIFT */
835 { 0x0b70, KEY_RECORD },
836 { 0x037d, KEY_VOLUMEUP },
837 { 0x017d, KEY_VOLUMEDOWN },
838 { 0x0242, KEY_CHANNELUP },
839 { 0x007d, KEY_CHANNELDOWN },
841 /* Key codes for Nova-TD "credit card" remote control. */
842 { 0x1d00, KEY_0 },
843 { 0x1d01, KEY_1 },
844 { 0x1d02, KEY_2 },
845 { 0x1d03, KEY_3 },
846 { 0x1d04, KEY_4 },
847 { 0x1d05, KEY_5 },
848 { 0x1d06, KEY_6 },
849 { 0x1d07, KEY_7 },
850 { 0x1d08, KEY_8 },
851 { 0x1d09, KEY_9 },
852 { 0x1d0a, KEY_TEXT },
853 { 0x1d0d, KEY_MENU },
854 { 0x1d0f, KEY_MUTE },
855 { 0x1d10, KEY_VOLUMEUP },
856 { 0x1d11, KEY_VOLUMEDOWN },
857 { 0x1d12, KEY_CHANNEL },
858 { 0x1d14, KEY_UP },
859 { 0x1d15, KEY_DOWN },
860 { 0x1d16, KEY_LEFT },
861 { 0x1d17, KEY_RIGHT },
862 { 0x1d1c, KEY_TV },
863 { 0x1d1e, KEY_NEXT },
864 { 0x1d1f, KEY_BACK },
865 { 0x1d20, KEY_CHANNELUP },
866 { 0x1d21, KEY_CHANNELDOWN },
867 { 0x1d24, KEY_LAST },
868 { 0x1d25, KEY_OK },
869 { 0x1d30, KEY_PAUSE },
870 { 0x1d32, KEY_REWIND },
871 { 0x1d34, KEY_FASTFORWARD },
872 { 0x1d35, KEY_PLAY },
873 { 0x1d36, KEY_STOP },
874 { 0x1d37, KEY_RECORD },
875 { 0x1d3b, KEY_GOTO },
876 { 0x1d3d, KEY_POWER },
879 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
880 static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
881 BAND_UHF | BAND_VHF, // band_caps
883 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
884 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
885 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
887 712, // inv_gain
888 41, // time_stabiliz
890 0, // alpha_level
891 118, // thlock
893 0, // wbd_inv
894 4095, // wbd_ref
895 0, // wbd_sel
896 0, // wbd_alpha
898 42598, // agc1_max
899 17694, // agc1_min
900 45875, // agc2_max
901 2621, // agc2_min
902 0, // agc1_pt1
903 76, // agc1_pt2
904 139, // agc1_pt3
905 52, // agc1_slope1
906 59, // agc1_slope2
907 107, // agc2_pt1
908 172, // agc2_pt2
909 57, // agc2_slope1
910 70, // agc2_slope2
912 21, // alpha_mant
913 25, // alpha_exp
914 28, // beta_mant
915 48, // beta_exp
917 1, // perform_agc_softsplit
918 { 0, // split_min
919 107, // split_max
920 51800, // global_split_min
921 24700 // global_split_max
925 static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
926 BAND_UHF | BAND_VHF,
928 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
929 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
930 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
932 712, // inv_gain
933 41, // time_stabiliz
935 0, // alpha_level
936 118, // thlock
938 0, // wbd_inv
939 4095, // wbd_ref
940 0, // wbd_sel
941 0, // wbd_alpha
943 42598, // agc1_max
944 16384, // agc1_min
945 42598, // agc2_max
946 0, // agc2_min
948 0, // agc1_pt1
949 137, // agc1_pt2
950 255, // agc1_pt3
952 0, // agc1_slope1
953 255, // agc1_slope2
955 0, // agc2_pt1
956 0, // agc2_pt2
958 0, // agc2_slope1
959 41, // agc2_slope2
961 15, // alpha_mant
962 25, // alpha_exp
964 28, // beta_mant
965 48, // beta_exp
967 0, // perform_agc_softsplit
970 static struct dibx000_bandwidth_config stk7700p_pll_config = {
971 60000, 30000, // internal, sampling
972 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
973 0, 0, 1, 1, 0, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
974 (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
975 60258167, // ifreq
976 20452225, // timf
977 30000000, // xtal
980 static struct dib7000m_config stk7700p_dib7000m_config = {
981 .dvbt_mode = 1,
982 .output_mpeg2_in_188_bytes = 1,
983 .quartz_direct = 1,
985 .agc_config_count = 1,
986 .agc = &stk7700p_7000m_mt2060_agc_config,
987 .bw = &stk7700p_pll_config,
989 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
990 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
991 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
994 static struct dib7000p_config stk7700p_dib7000p_config = {
995 .output_mpeg2_in_188_bytes = 1,
997 .agc_config_count = 1,
998 .agc = &stk7700p_7000p_mt2060_agc_config,
999 .bw = &stk7700p_pll_config,
1001 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
1002 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
1003 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
1006 static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
1008 struct dib0700_state *st = adap->dev->priv;
1009 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
1011 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1012 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
1014 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
1015 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1017 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
1018 dib0700_ctrl_clock(adap->dev, 72, 1);
1019 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
1021 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1023 st->mt2060_if1[0] = 1220;
1025 if (dib7000pc_detection(&adap->dev->i2c_adap)) {
1026 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
1027 st->is_dib7000pc = 1;
1028 } else
1029 adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
1031 return adap->fe == NULL ? -ENODEV : 0;
1034 static struct mt2060_config stk7700p_mt2060_config = {
1035 0x60
1038 static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
1040 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
1041 struct dib0700_state *st = adap->dev->priv;
1042 struct i2c_adapter *tun_i2c;
1043 s8 a;
1044 int if1=1220;
1045 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
1046 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
1047 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
1049 if (st->is_dib7000pc)
1050 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1051 else
1052 tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1054 return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config,
1055 if1) == NULL ? -ENODEV : 0;
1058 /* DIB7070 generic */
1059 static struct dibx000_agc_config dib7070_agc_config = {
1060 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
1061 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
1062 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1063 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), // setup
1065 600, // inv_gain
1066 10, // time_stabiliz
1068 0, // alpha_level
1069 118, // thlock
1071 0, // wbd_inv
1072 3530, // wbd_ref
1073 1, // wbd_sel
1074 5, // wbd_alpha
1076 65535, // agc1_max
1077 0, // agc1_min
1079 65535, // agc2_max
1080 0, // agc2_min
1082 0, // agc1_pt1
1083 40, // agc1_pt2
1084 183, // agc1_pt3
1085 206, // agc1_slope1
1086 255, // agc1_slope2
1087 72, // agc2_pt1
1088 152, // agc2_pt2
1089 88, // agc2_slope1
1090 90, // agc2_slope2
1092 17, // alpha_mant
1093 27, // alpha_exp
1094 23, // beta_mant
1095 51, // beta_exp
1097 0, // perform_agc_softsplit
1100 static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
1102 deb_info("reset: %d", onoff);
1103 return dib7000p_set_gpio(fe, 8, 0, !onoff);
1106 static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
1108 deb_info("sleep: %d", onoff);
1109 return dib7000p_set_gpio(fe, 9, 0, onoff);
1112 static struct dib0070_config dib7070p_dib0070_config[2] = {
1114 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1115 .reset = dib7070_tuner_reset,
1116 .sleep = dib7070_tuner_sleep,
1117 .clock_khz = 12000,
1118 .clock_pad_drive = 4,
1119 .charge_pump = 2,
1120 }, {
1121 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1122 .reset = dib7070_tuner_reset,
1123 .sleep = dib7070_tuner_sleep,
1124 .clock_khz = 12000,
1125 .charge_pump = 2,
1129 static struct dib0070_config dib7770p_dib0070_config = {
1130 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1131 .reset = dib7070_tuner_reset,
1132 .sleep = dib7070_tuner_sleep,
1133 .clock_khz = 12000,
1134 .clock_pad_drive = 0,
1135 .flip_chip = 1,
1138 static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
1140 struct dvb_usb_adapter *adap = fe->dvb->priv;
1141 struct dib0700_adapter_state *state = adap->priv;
1143 u16 offset;
1144 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1145 switch (band) {
1146 case BAND_VHF: offset = 950; break;
1147 case BAND_UHF:
1148 default: offset = 550; break;
1150 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
1151 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1152 return state->set_param_save(fe, fep);
1155 static int dib7770_set_param_override(struct dvb_frontend *fe,
1156 struct dvb_frontend_parameters *fep)
1158 struct dvb_usb_adapter *adap = fe->dvb->priv;
1159 struct dib0700_adapter_state *state = adap->priv;
1161 u16 offset;
1162 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1163 switch (band) {
1164 case BAND_VHF:
1165 dib7000p_set_gpio(fe, 0, 0, 1);
1166 offset = 850;
1167 break;
1168 case BAND_UHF:
1169 default:
1170 dib7000p_set_gpio(fe, 0, 0, 0);
1171 offset = 250;
1172 break;
1174 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
1175 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1176 return state->set_param_save(fe, fep);
1179 static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
1181 struct dib0700_adapter_state *st = adap->priv;
1182 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe,
1183 DIBX000_I2C_INTERFACE_TUNER, 1);
1185 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1186 &dib7770p_dib0070_config) == NULL)
1187 return -ENODEV;
1189 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1190 adap->fe->ops.tuner_ops.set_params = dib7770_set_param_override;
1191 return 0;
1194 static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
1196 struct dib0700_adapter_state *st = adap->priv;
1197 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1199 if (adap->id == 0) {
1200 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
1201 return -ENODEV;
1202 } else {
1203 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
1204 return -ENODEV;
1207 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1208 adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override;
1209 return 0;
1212 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
1213 60000, 15000, // internal, sampling
1214 1, 20, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
1215 0, 0, 1, 1, 2, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
1216 (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
1217 (0 << 25) | 0, // ifreq = 0.000000 MHz
1218 20452225, // timf
1219 12000000, // xtal_hz
1222 static struct dib7000p_config dib7070p_dib7000p_config = {
1223 .output_mpeg2_in_188_bytes = 1,
1225 .agc_config_count = 1,
1226 .agc = &dib7070_agc_config,
1227 .bw = &dib7070_bw_config_12_mhz,
1228 .tuner_is_baseband = 1,
1229 .spur_protect = 1,
1231 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1232 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1233 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1235 .hostbus_diversity = 1,
1238 /* STK7070P */
1239 static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
1241 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
1242 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
1243 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
1244 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1245 else
1246 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1247 msleep(10);
1248 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1249 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1250 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1251 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1253 dib0700_ctrl_clock(adap->dev, 72, 1);
1255 msleep(10);
1256 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1257 msleep(10);
1258 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1260 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1261 &dib7070p_dib7000p_config) != 0) {
1262 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1263 __func__);
1264 return -ENODEV;
1267 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
1268 &dib7070p_dib7000p_config);
1269 return adap->fe == NULL ? -ENODEV : 0;
1272 /* DIB807x generic */
1273 static struct dibx000_agc_config dib807x_agc_config[2] = {
1275 BAND_VHF,
1276 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1277 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1278 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1279 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1280 * P_agc_write=0 */
1281 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1282 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1283 (0 << 0), /* setup*/
1285 600, /* inv_gain*/
1286 10, /* time_stabiliz*/
1288 0, /* alpha_level*/
1289 118, /* thlock*/
1291 0, /* wbd_inv*/
1292 3530, /* wbd_ref*/
1293 1, /* wbd_sel*/
1294 5, /* wbd_alpha*/
1296 65535, /* agc1_max*/
1297 0, /* agc1_min*/
1299 65535, /* agc2_max*/
1300 0, /* agc2_min*/
1302 0, /* agc1_pt1*/
1303 40, /* agc1_pt2*/
1304 183, /* agc1_pt3*/
1305 206, /* agc1_slope1*/
1306 255, /* agc1_slope2*/
1307 72, /* agc2_pt1*/
1308 152, /* agc2_pt2*/
1309 88, /* agc2_slope1*/
1310 90, /* agc2_slope2*/
1312 17, /* alpha_mant*/
1313 27, /* alpha_exp*/
1314 23, /* beta_mant*/
1315 51, /* beta_exp*/
1317 0, /* perform_agc_softsplit*/
1318 }, {
1319 BAND_UHF,
1320 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1321 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1322 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1323 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1324 * P_agc_write=0 */
1325 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1326 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1327 (0 << 0), /* setup */
1329 600, /* inv_gain*/
1330 10, /* time_stabiliz*/
1332 0, /* alpha_level*/
1333 118, /* thlock*/
1335 0, /* wbd_inv*/
1336 3530, /* wbd_ref*/
1337 1, /* wbd_sel*/
1338 5, /* wbd_alpha*/
1340 65535, /* agc1_max*/
1341 0, /* agc1_min*/
1343 65535, /* agc2_max*/
1344 0, /* agc2_min*/
1346 0, /* agc1_pt1*/
1347 40, /* agc1_pt2*/
1348 183, /* agc1_pt3*/
1349 206, /* agc1_slope1*/
1350 255, /* agc1_slope2*/
1351 72, /* agc2_pt1*/
1352 152, /* agc2_pt2*/
1353 88, /* agc2_slope1*/
1354 90, /* agc2_slope2*/
1356 17, /* alpha_mant*/
1357 27, /* alpha_exp*/
1358 23, /* beta_mant*/
1359 51, /* beta_exp*/
1361 0, /* perform_agc_softsplit*/
1365 static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
1366 60000, 15000, /* internal, sampling*/
1367 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/
1368 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
1369 ADClkSrc, modulo */
1370 (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1371 (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1372 18179755, /* timf*/
1373 12000000, /* xtal_hz*/
1376 static struct dib8000_config dib807x_dib8000_config[2] = {
1378 .output_mpeg2_in_188_bytes = 1,
1380 .agc_config_count = 2,
1381 .agc = dib807x_agc_config,
1382 .pll = &dib807x_bw_config_12_mhz,
1383 .tuner_is_baseband = 1,
1385 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1386 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1387 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1389 .hostbus_diversity = 1,
1390 .div_cfg = 1,
1391 .agc_control = &dib0070_ctrl_agc_filter,
1392 .output_mode = OUTMODE_MPEG2_FIFO,
1393 .drives = 0x2d98,
1394 }, {
1395 .output_mpeg2_in_188_bytes = 1,
1397 .agc_config_count = 2,
1398 .agc = dib807x_agc_config,
1399 .pll = &dib807x_bw_config_12_mhz,
1400 .tuner_is_baseband = 1,
1402 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1403 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1404 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1406 .hostbus_diversity = 1,
1407 .agc_control = &dib0070_ctrl_agc_filter,
1408 .output_mode = OUTMODE_MPEG2_FIFO,
1409 .drives = 0x2d98,
1413 static int dib807x_tuner_reset(struct dvb_frontend *fe, int onoff)
1415 return dib8000_set_gpio(fe, 5, 0, !onoff);
1418 static int dib807x_tuner_sleep(struct dvb_frontend *fe, int onoff)
1420 return dib8000_set_gpio(fe, 0, 0, onoff);
1423 static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
1424 { 240, 7},
1425 { 0xffff, 6},
1428 static struct dib0070_config dib807x_dib0070_config[2] = {
1430 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1431 .reset = dib807x_tuner_reset,
1432 .sleep = dib807x_tuner_sleep,
1433 .clock_khz = 12000,
1434 .clock_pad_drive = 4,
1435 .vga_filter = 1,
1436 .force_crystal_mode = 1,
1437 .enable_third_order_filter = 1,
1438 .charge_pump = 0,
1439 .wbd_gain = dib8070_wbd_gain_cfg,
1440 .osc_buffer_state = 0,
1441 .freq_offset_khz_uhf = -100,
1442 .freq_offset_khz_vhf = -100,
1443 }, {
1444 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1445 .reset = dib807x_tuner_reset,
1446 .sleep = dib807x_tuner_sleep,
1447 .clock_khz = 12000,
1448 .clock_pad_drive = 2,
1449 .vga_filter = 1,
1450 .force_crystal_mode = 1,
1451 .enable_third_order_filter = 1,
1452 .charge_pump = 0,
1453 .wbd_gain = dib8070_wbd_gain_cfg,
1454 .osc_buffer_state = 0,
1455 .freq_offset_khz_uhf = -25,
1456 .freq_offset_khz_vhf = -25,
1460 static int dib807x_set_param_override(struct dvb_frontend *fe,
1461 struct dvb_frontend_parameters *fep)
1463 struct dvb_usb_adapter *adap = fe->dvb->priv;
1464 struct dib0700_adapter_state *state = adap->priv;
1466 u16 offset = dib0070_wbd_offset(fe);
1467 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1468 switch (band) {
1469 case BAND_VHF:
1470 offset += 750;
1471 break;
1472 case BAND_UHF: /* fall-thru wanted */
1473 default:
1474 offset += 250; break;
1476 deb_info("WBD for DiB8000: %d\n", offset);
1477 dib8000_set_wbd_ref(fe, offset);
1479 return state->set_param_save(fe, fep);
1482 static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1484 struct dib0700_adapter_state *st = adap->priv;
1485 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe,
1486 DIBX000_I2C_INTERFACE_TUNER, 1);
1488 if (adap->id == 0) {
1489 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1490 &dib807x_dib0070_config[0]) == NULL)
1491 return -ENODEV;
1492 } else {
1493 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1494 &dib807x_dib0070_config[1]) == NULL)
1495 return -ENODEV;
1498 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1499 adap->fe->ops.tuner_ops.set_params = dib807x_set_param_override;
1500 return 0;
1504 /* STK807x */
1505 static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
1507 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1508 msleep(10);
1509 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1510 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1511 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1513 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1515 dib0700_ctrl_clock(adap->dev, 72, 1);
1517 msleep(10);
1518 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1519 msleep(10);
1520 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1522 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1523 0x80);
1525 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1526 &dib807x_dib8000_config[0]);
1528 return adap->fe == NULL ? -ENODEV : 0;
1531 /* STK807xPVR */
1532 static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
1534 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1535 msleep(30);
1536 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1537 msleep(500);
1538 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1539 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1540 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1542 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1544 dib0700_ctrl_clock(adap->dev, 72, 1);
1546 msleep(10);
1547 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1548 msleep(10);
1549 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1551 /* initialize IC 0 */
1552 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x80);
1554 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1555 &dib807x_dib8000_config[0]);
1557 return adap->fe == NULL ? -ENODEV : 0;
1560 static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
1562 /* initialize IC 1 */
1563 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x82);
1565 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82,
1566 &dib807x_dib8000_config[1]);
1568 return adap->fe == NULL ? -ENODEV : 0;
1572 /* STK7070PD */
1573 static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
1575 .output_mpeg2_in_188_bytes = 1,
1577 .agc_config_count = 1,
1578 .agc = &dib7070_agc_config,
1579 .bw = &dib7070_bw_config_12_mhz,
1580 .tuner_is_baseband = 1,
1581 .spur_protect = 1,
1583 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1584 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1585 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1587 .hostbus_diversity = 1,
1588 }, {
1589 .output_mpeg2_in_188_bytes = 1,
1591 .agc_config_count = 1,
1592 .agc = &dib7070_agc_config,
1593 .bw = &dib7070_bw_config_12_mhz,
1594 .tuner_is_baseband = 1,
1595 .spur_protect = 1,
1597 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1598 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1599 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1601 .hostbus_diversity = 1,
1605 static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
1607 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1608 msleep(10);
1609 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1610 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1611 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1612 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1614 dib0700_ctrl_clock(adap->dev, 72, 1);
1616 msleep(10);
1617 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1618 msleep(10);
1619 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1621 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
1622 stk7070pd_dib7000p_config) != 0) {
1623 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1624 __func__);
1625 return -ENODEV;
1628 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
1629 return adap->fe == NULL ? -ENODEV : 0;
1632 static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
1634 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
1635 return adap->fe == NULL ? -ENODEV : 0;
1638 /* S5H1411 */
1639 static struct s5h1411_config pinnacle_801e_config = {
1640 .output_mode = S5H1411_PARALLEL_OUTPUT,
1641 .gpio = S5H1411_GPIO_OFF,
1642 .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
1643 .qam_if = S5H1411_IF_44000,
1644 .vsb_if = S5H1411_IF_44000,
1645 .inversion = S5H1411_INVERSION_OFF,
1646 .status_mode = S5H1411_DEMODLOCKING
1649 /* Pinnacle PCTV HD Pro 801e GPIOs map:
1650 GPIO0 - currently unknown
1651 GPIO1 - xc5000 tuner reset
1652 GPIO2 - CX25843 sleep
1653 GPIO3 - currently unknown
1654 GPIO4 - currently unknown
1655 GPIO6 - currently unknown
1656 GPIO7 - currently unknown
1657 GPIO9 - currently unknown
1658 GPIO10 - CX25843 reset
1660 static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
1662 struct dib0700_state *st = adap->dev->priv;
1664 /* Make use of the new i2c functions from FW 1.20 */
1665 st->fw_use_new_i2c_api = 1;
1667 /* The s5h1411 requires the dib0700 to not be in master mode */
1668 st->disable_streaming_master_mode = 1;
1670 /* All msleep values taken from Windows USB trace */
1671 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
1672 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
1673 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1674 msleep(400);
1675 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1676 msleep(60);
1677 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1678 msleep(30);
1679 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1680 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1681 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1682 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1683 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
1684 msleep(30);
1686 /* Put the CX25843 to sleep for now since we're in digital mode */
1687 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
1689 /* GPIOs are initialized, do the attach */
1690 adap->fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
1691 &adap->dev->i2c_adap);
1692 return adap->fe == NULL ? -ENODEV : 0;
1695 static int dib0700_xc5000_tuner_callback(void *priv, int component,
1696 int command, int arg)
1698 struct dvb_usb_adapter *adap = priv;
1700 if (command == XC5000_TUNER_RESET) {
1701 /* Reset the tuner */
1702 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
1703 msleep(10);
1704 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
1705 msleep(10);
1706 } else {
1707 err("xc5000: unknown tuner callback command: %d\n", command);
1708 return -EINVAL;
1711 return 0;
1714 static struct xc5000_config s5h1411_xc5000_tunerconfig = {
1715 .i2c_address = 0x64,
1716 .if_khz = 5380,
1719 static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
1721 /* FIXME: generalize & move to common area */
1722 adap->fe->callback = dib0700_xc5000_tuner_callback;
1724 return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap,
1725 &s5h1411_xc5000_tunerconfig)
1726 == NULL ? -ENODEV : 0;
1729 static struct lgdt3305_config hcw_lgdt3305_config = {
1730 .i2c_addr = 0x0e,
1731 .mpeg_mode = LGDT3305_MPEG_PARALLEL,
1732 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
1733 .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
1734 .deny_i2c_rptr = 0,
1735 .spectral_inversion = 1,
1736 .qam_if_khz = 6000,
1737 .vsb_if_khz = 6000,
1738 .usref_8vsb = 0x0500,
1741 static struct mxl5007t_config hcw_mxl5007t_config = {
1742 .xtal_freq_hz = MxL_XTAL_25_MHZ,
1743 .if_freq_hz = MxL_IF_6_MHZ,
1744 .invert_if = 1,
1747 /* TIGER-ATSC map:
1748 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
1749 GPIO1 - ANT_SEL (H: VPA, L: MCX)
1750 GPIO4 - SCL2
1751 GPIO6 - EN_TUNER
1752 GPIO7 - SDA2
1753 GPIO10 - DEM_RST
1755 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
1757 static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
1759 struct dib0700_state *st = adap->dev->priv;
1761 /* Make use of the new i2c functions from FW 1.20 */
1762 st->fw_use_new_i2c_api = 1;
1764 st->disable_streaming_master_mode = 1;
1766 /* fe power enable */
1767 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1768 msleep(30);
1769 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1770 msleep(30);
1772 /* demod reset */
1773 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1774 msleep(30);
1775 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1776 msleep(30);
1777 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1778 msleep(30);
1780 adap->fe = dvb_attach(lgdt3305_attach,
1781 &hcw_lgdt3305_config,
1782 &adap->dev->i2c_adap);
1784 return adap->fe == NULL ? -ENODEV : 0;
1787 static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
1789 return dvb_attach(mxl5007t_attach, adap->fe,
1790 &adap->dev->i2c_adap, 0x60,
1791 &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
1795 /* DVB-USB and USB stuff follows */
1796 struct usb_device_id dib0700_usb_id_table[] = {
1797 /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
1798 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
1799 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
1800 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
1801 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
1802 /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
1803 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
1804 { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
1805 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
1806 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
1807 /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
1808 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
1809 { USB_DEVICE(USB_VID_TERRATEC,
1810 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
1811 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
1812 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
1813 /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
1814 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
1815 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
1816 { USB_DEVICE(USB_VID_PINNACLE,
1817 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
1818 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
1819 /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
1820 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
1821 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
1822 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
1823 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
1824 /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
1825 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
1826 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
1827 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
1828 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
1829 /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
1830 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
1831 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
1832 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
1833 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
1834 /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
1835 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
1836 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
1837 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
1838 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
1839 /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
1840 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
1841 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
1842 { USB_DEVICE(USB_VID_TERRATEC,
1843 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
1844 { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
1845 /* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
1846 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
1847 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
1848 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
1849 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
1850 /* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
1851 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
1852 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
1853 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
1854 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
1855 /* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
1856 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
1857 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
1858 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
1859 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
1860 /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
1861 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
1862 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
1863 { USB_DEVICE(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD) },
1864 { 0 } /* Terminating entry */
1866 MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
1868 #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
1869 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
1870 .usb_ctrl = DEVICE_SPECIFIC, \
1871 .firmware = "dvb-usb-dib0700-1.20.fw", \
1872 .download_firmware = dib0700_download_firmware, \
1873 .no_reconnect = 1, \
1874 .size_of_priv = sizeof(struct dib0700_state), \
1875 .i2c_algo = &dib0700_i2c_algo, \
1876 .identify_state = dib0700_identify_state
1878 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
1879 .streaming_ctrl = dib0700_streaming_ctrl, \
1880 .stream = { \
1881 .type = USB_BULK, \
1882 .count = 4, \
1883 .endpoint = ep, \
1884 .u = { \
1885 .bulk = { \
1886 .buffersize = 39480, \
1891 struct dvb_usb_device_properties dib0700_devices[] = {
1893 DIB0700_DEFAULT_DEVICE_PROPERTIES,
1895 .num_adapters = 1,
1896 .adapter = {
1898 .frontend_attach = stk7700p_frontend_attach,
1899 .tuner_attach = stk7700p_tuner_attach,
1901 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
1905 .num_device_descs = 8,
1906 .devices = {
1907 { "DiBcom STK7700P reference design",
1908 { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
1909 { NULL },
1911 { "Hauppauge Nova-T Stick",
1912 { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
1913 { NULL },
1915 { "AVerMedia AVerTV DVB-T Volar",
1916 { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
1917 { NULL },
1919 { "Compro Videomate U500",
1920 { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
1921 { NULL },
1923 { "Uniwill STK7700P based (Hama and others)",
1924 { &dib0700_usb_id_table[7], NULL },
1925 { NULL },
1927 { "Leadtek Winfast DTV Dongle (STK7700P based)",
1928 { &dib0700_usb_id_table[8] },
1929 { NULL },
1931 { "AVerMedia AVerTV DVB-T Express",
1932 { &dib0700_usb_id_table[20] },
1933 { NULL },
1935 { "Gigabyte U7000",
1936 { &dib0700_usb_id_table[21], NULL },
1937 { NULL },
1941 .rc_interval = DEFAULT_RC_INTERVAL,
1942 .rc_key_map = dib0700_rc_keys,
1943 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
1944 .rc_query = dib0700_rc_query
1945 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
1947 .num_adapters = 2,
1948 .adapter = {
1950 .frontend_attach = bristol_frontend_attach,
1951 .tuner_attach = bristol_tuner_attach,
1953 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
1954 }, {
1955 .frontend_attach = bristol_frontend_attach,
1956 .tuner_attach = bristol_tuner_attach,
1958 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
1962 .num_device_descs = 1,
1963 .devices = {
1964 { "Hauppauge Nova-T 500 Dual DVB-T",
1965 { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
1966 { NULL },
1970 .rc_interval = DEFAULT_RC_INTERVAL,
1971 .rc_key_map = dib0700_rc_keys,
1972 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
1973 .rc_query = dib0700_rc_query
1974 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
1976 .num_adapters = 2,
1977 .adapter = {
1979 .frontend_attach = stk7700d_frontend_attach,
1980 .tuner_attach = stk7700d_tuner_attach,
1982 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
1983 }, {
1984 .frontend_attach = stk7700d_frontend_attach,
1985 .tuner_attach = stk7700d_tuner_attach,
1987 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
1991 .num_device_descs = 5,
1992 .devices = {
1993 { "Pinnacle PCTV 2000e",
1994 { &dib0700_usb_id_table[11], NULL },
1995 { NULL },
1997 { "Terratec Cinergy DT XS Diversity",
1998 { &dib0700_usb_id_table[12], NULL },
1999 { NULL },
2001 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
2002 { &dib0700_usb_id_table[13], NULL },
2003 { NULL },
2005 { "DiBcom STK7700D reference design",
2006 { &dib0700_usb_id_table[14], NULL },
2007 { NULL },
2009 { "YUAN High-Tech DiBcom STK7700D",
2010 { &dib0700_usb_id_table[55], NULL },
2011 { NULL },
2016 .rc_interval = DEFAULT_RC_INTERVAL,
2017 .rc_key_map = dib0700_rc_keys,
2018 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2019 .rc_query = dib0700_rc_query
2021 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2023 .num_adapters = 1,
2024 .adapter = {
2026 .frontend_attach = stk7700P2_frontend_attach,
2027 .tuner_attach = stk7700d_tuner_attach,
2029 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2033 .num_device_descs = 3,
2034 .devices = {
2035 { "ASUS My Cinema U3000 Mini DVBT Tuner",
2036 { &dib0700_usb_id_table[23], NULL },
2037 { NULL },
2039 { "Yuan EC372S",
2040 { &dib0700_usb_id_table[31], NULL },
2041 { NULL },
2043 { "Terratec Cinergy T Express",
2044 { &dib0700_usb_id_table[42], NULL },
2045 { NULL },
2049 .rc_interval = DEFAULT_RC_INTERVAL,
2050 .rc_key_map = dib0700_rc_keys,
2051 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2052 .rc_query = dib0700_rc_query
2053 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2055 .num_adapters = 1,
2056 .adapter = {
2058 .frontend_attach = stk7070p_frontend_attach,
2059 .tuner_attach = dib7070p_tuner_attach,
2061 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2063 .size_of_priv = sizeof(struct dib0700_adapter_state),
2067 .num_device_descs = 12,
2068 .devices = {
2069 { "DiBcom STK7070P reference design",
2070 { &dib0700_usb_id_table[15], NULL },
2071 { NULL },
2073 { "Pinnacle PCTV DVB-T Flash Stick",
2074 { &dib0700_usb_id_table[16], NULL },
2075 { NULL },
2077 { "Artec T14BR DVB-T",
2078 { &dib0700_usb_id_table[22], NULL },
2079 { NULL },
2081 { "ASUS My Cinema U3100 Mini DVBT Tuner",
2082 { &dib0700_usb_id_table[24], NULL },
2083 { NULL },
2085 { "Hauppauge Nova-T Stick",
2086 { &dib0700_usb_id_table[25], NULL },
2087 { NULL },
2089 { "Hauppauge Nova-T MyTV.t",
2090 { &dib0700_usb_id_table[26], NULL },
2091 { NULL },
2093 { "Pinnacle PCTV 72e",
2094 { &dib0700_usb_id_table[29], NULL },
2095 { NULL },
2097 { "Pinnacle PCTV 73e",
2098 { &dib0700_usb_id_table[30], NULL },
2099 { NULL },
2101 { "Terratec Cinergy T USB XXS/ T3",
2102 { &dib0700_usb_id_table[33],
2103 &dib0700_usb_id_table[52], NULL },
2104 { NULL },
2106 { "Elgato EyeTV DTT",
2107 { &dib0700_usb_id_table[49], NULL },
2108 { NULL },
2110 { "Yuan PD378S",
2111 { &dib0700_usb_id_table[45], NULL },
2112 { NULL },
2114 { "Elgato EyeTV Dtt Dlx PD378S",
2115 { &dib0700_usb_id_table[50], NULL },
2116 { NULL },
2120 .rc_interval = DEFAULT_RC_INTERVAL,
2121 .rc_key_map = dib0700_rc_keys,
2122 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2123 .rc_query = dib0700_rc_query
2125 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2127 .num_adapters = 1,
2128 .adapter = {
2130 .frontend_attach = stk7070p_frontend_attach,
2131 .tuner_attach = dib7070p_tuner_attach,
2133 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2135 .size_of_priv = sizeof(struct dib0700_adapter_state),
2139 .num_device_descs = 3,
2140 .devices = {
2141 { "Pinnacle PCTV 73A",
2142 { &dib0700_usb_id_table[56], NULL },
2143 { NULL },
2145 { "Pinnacle PCTV 73e SE",
2146 { &dib0700_usb_id_table[57], NULL },
2147 { NULL },
2149 { "Pinnacle PCTV 282e",
2150 { &dib0700_usb_id_table[58], NULL },
2151 { NULL },
2155 .rc_interval = DEFAULT_RC_INTERVAL,
2156 .rc_key_map = dib0700_rc_keys,
2157 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2158 .rc_query = dib0700_rc_query
2160 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2162 .num_adapters = 2,
2163 .adapter = {
2165 .frontend_attach = stk7070pd_frontend_attach0,
2166 .tuner_attach = dib7070p_tuner_attach,
2168 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2170 .size_of_priv = sizeof(struct dib0700_adapter_state),
2171 }, {
2172 .frontend_attach = stk7070pd_frontend_attach1,
2173 .tuner_attach = dib7070p_tuner_attach,
2175 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2177 .size_of_priv = sizeof(struct dib0700_adapter_state),
2181 .num_device_descs = 6,
2182 .devices = {
2183 { "DiBcom STK7070PD reference design",
2184 { &dib0700_usb_id_table[17], NULL },
2185 { NULL },
2187 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
2188 { &dib0700_usb_id_table[18], NULL },
2189 { NULL },
2191 { "Hauppauge Nova-TD Stick (52009)",
2192 { &dib0700_usb_id_table[35], NULL },
2193 { NULL },
2195 { "Hauppauge Nova-TD-500 (84xxx)",
2196 { &dib0700_usb_id_table[36], NULL },
2197 { NULL },
2199 { "Terratec Cinergy DT USB XS Diversity/ T5",
2200 { &dib0700_usb_id_table[43],
2201 &dib0700_usb_id_table[53], NULL},
2202 { NULL },
2204 { "Sony PlayTV",
2205 { &dib0700_usb_id_table[44], NULL },
2206 { NULL },
2209 .rc_interval = DEFAULT_RC_INTERVAL,
2210 .rc_key_map = dib0700_rc_keys,
2211 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2212 .rc_query = dib0700_rc_query
2213 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2215 .num_adapters = 1,
2216 .adapter = {
2218 .frontend_attach = stk7700ph_frontend_attach,
2219 .tuner_attach = stk7700ph_tuner_attach,
2221 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2223 .size_of_priv = sizeof(struct
2224 dib0700_adapter_state),
2228 .num_device_descs = 9,
2229 .devices = {
2230 { "Terratec Cinergy HT USB XE",
2231 { &dib0700_usb_id_table[27], NULL },
2232 { NULL },
2234 { "Pinnacle Expresscard 320cx",
2235 { &dib0700_usb_id_table[28], NULL },
2236 { NULL },
2238 { "Terratec Cinergy HT Express",
2239 { &dib0700_usb_id_table[32], NULL },
2240 { NULL },
2242 { "Gigabyte U8000-RH",
2243 { &dib0700_usb_id_table[37], NULL },
2244 { NULL },
2246 { "YUAN High-Tech STK7700PH",
2247 { &dib0700_usb_id_table[38], NULL },
2248 { NULL },
2250 { "Asus My Cinema-U3000Hybrid",
2251 { &dib0700_usb_id_table[39], NULL },
2252 { NULL },
2254 { "YUAN High-Tech MC770",
2255 { &dib0700_usb_id_table[48], NULL },
2256 { NULL },
2258 { "Leadtek WinFast DTV Dongle H",
2259 { &dib0700_usb_id_table[51], NULL },
2260 { NULL },
2262 { "YUAN High-Tech STK7700D",
2263 { &dib0700_usb_id_table[54], NULL },
2264 { NULL },
2267 .rc_interval = DEFAULT_RC_INTERVAL,
2268 .rc_key_map = dib0700_rc_keys,
2269 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2270 .rc_query = dib0700_rc_query
2271 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2272 .num_adapters = 1,
2273 .adapter = {
2275 .frontend_attach = s5h1411_frontend_attach,
2276 .tuner_attach = xc5000_tuner_attach,
2278 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2280 .size_of_priv = sizeof(struct
2281 dib0700_adapter_state),
2285 .num_device_descs = 2,
2286 .devices = {
2287 { "Pinnacle PCTV HD Pro USB Stick",
2288 { &dib0700_usb_id_table[40], NULL },
2289 { NULL },
2291 { "Pinnacle PCTV HD USB Stick",
2292 { &dib0700_usb_id_table[41], NULL },
2293 { NULL },
2296 .rc_interval = DEFAULT_RC_INTERVAL,
2297 .rc_key_map = dib0700_rc_keys,
2298 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2299 .rc_query = dib0700_rc_query
2300 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2301 .num_adapters = 1,
2302 .adapter = {
2304 .frontend_attach = lgdt3305_frontend_attach,
2305 .tuner_attach = mxl5007t_tuner_attach,
2307 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2309 .size_of_priv = sizeof(struct
2310 dib0700_adapter_state),
2314 .num_device_descs = 2,
2315 .devices = {
2316 { "Hauppauge ATSC MiniCard (B200)",
2317 { &dib0700_usb_id_table[46], NULL },
2318 { NULL },
2320 { "Hauppauge ATSC MiniCard (B210)",
2321 { &dib0700_usb_id_table[47], NULL },
2322 { NULL },
2325 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2327 .num_adapters = 1,
2328 .adapter = {
2330 .frontend_attach = stk7070p_frontend_attach,
2331 .tuner_attach = dib7770p_tuner_attach,
2333 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2335 .size_of_priv =
2336 sizeof(struct dib0700_adapter_state),
2340 .num_device_descs = 2,
2341 .devices = {
2342 { "DiBcom STK7770P reference design",
2343 { &dib0700_usb_id_table[59], NULL },
2344 { NULL },
2346 { "Terratec Cinergy T USB XXS (HD)",
2347 { &dib0700_usb_id_table[34], &dib0700_usb_id_table[60] },
2348 { NULL },
2351 .rc_interval = DEFAULT_RC_INTERVAL,
2352 .rc_key_map = dib0700_rc_keys,
2353 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2354 .rc_query = dib0700_rc_query
2355 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2356 .num_adapters = 1,
2357 .adapter = {
2359 .frontend_attach = stk807x_frontend_attach,
2360 .tuner_attach = dib807x_tuner_attach,
2362 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2364 .size_of_priv =
2365 sizeof(struct dib0700_adapter_state),
2369 .num_device_descs = 2,
2370 .devices = {
2371 { "DiBcom STK807xP reference design",
2372 { &dib0700_usb_id_table[62], NULL },
2373 { NULL },
2375 { "Prolink Pixelview SBTVD",
2376 { &dib0700_usb_id_table[63], NULL },
2377 { NULL },
2381 .rc_interval = DEFAULT_RC_INTERVAL,
2382 .rc_key_map = dib0700_rc_keys,
2383 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2384 .rc_query = dib0700_rc_query
2386 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2387 .num_adapters = 2,
2388 .adapter = {
2390 .frontend_attach = stk807xpvr_frontend_attach0,
2391 .tuner_attach = dib807x_tuner_attach,
2393 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2395 .size_of_priv =
2396 sizeof(struct dib0700_adapter_state),
2399 .frontend_attach = stk807xpvr_frontend_attach1,
2400 .tuner_attach = dib807x_tuner_attach,
2402 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2404 .size_of_priv =
2405 sizeof(struct dib0700_adapter_state),
2409 .num_device_descs = 1,
2410 .devices = {
2411 { "DiBcom STK807xPVR reference design",
2412 { &dib0700_usb_id_table[61], NULL },
2413 { NULL },
2417 .rc_interval = DEFAULT_RC_INTERVAL,
2418 .rc_key_map = dib0700_rc_keys,
2419 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2420 .rc_query = dib0700_rc_query
2424 int dib0700_device_count = ARRAY_SIZE(dib0700_devices);