blob: 923fa157aa51096a72bf6651b77d4b5740b0dcd5 [file] [log] [blame]
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001/* Linux driver for devices based on the DiBcom DiB0700 USB bridge
2 *
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.
6 *
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03007 * Copyright (C) 2005-9 DiBcom, SA et al
Patrick Boettcherb7f54912006-09-19 12:51:37 -03008 */
9#include "dib0700.h"
10
11#include "dib3000mc.h"
Patrick Boettcher91bb9be2006-12-02 21:15:51 -020012#include "dib7000m.h"
Patrick Boettchera75763f2006-10-18 08:34:16 -030013#include "dib7000p.h"
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -030014#include "dib8000.h"
Patrick Boettcherb7f54912006-09-19 12:51:37 -030015#include "mt2060.h"
Olivier DANET54d75eb2007-07-25 14:42:54 -030016#include "mt2266.h"
Albert Comerma6ca8f0b2008-03-29 21:35:57 -030017#include "tuner-xc2028.h"
Devin Heitmuellercb22cb52008-09-08 05:42:42 -030018#include "xc5000.h"
19#include "s5h1411.h"
Patrick Boettcher01373a52007-07-30 12:49:04 -030020#include "dib0070.h"
Michael Krufkyce904bc2009-01-19 01:12:55 -030021#include "lgdt3305.h"
22#include "mxl5007t.h"
Patrick Boettcherb7f54912006-09-19 12:51:37 -030023
Patrick Boettcher7fb3fc02006-09-20 04:37:18 -030024static int force_lna_activation;
25module_param(force_lna_activation, int, 0644);
26MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), "
27 "if applicable for the device (default: 0=automatic/off).");
28
Patrick Boettcher01373a52007-07-30 12:49:04 -030029struct dib0700_adapter_state {
30 int (*set_param_save) (struct dvb_frontend *, struct dvb_frontend_parameters *);
31};
32
33/* Hauppauge Nova-T 500 (aka Bristol)
Patrick Boettcherb7f54912006-09-19 12:51:37 -030034 * has a LNA on GPIO0 which is enabled by setting 1 */
35static struct mt2060_config bristol_mt2060_config[2] = {
36 {
37 .i2c_address = 0x60,
Patrick Boettcher303cbea2006-09-19 12:51:56 -030038 .clock_out = 3,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030039 }, {
40 .i2c_address = 0x61,
41 }
42};
43
Devin Heitmueller99afb982008-11-15 07:13:07 -030044
Patrick Boettcherb7f54912006-09-19 12:51:37 -030045static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
46 .band_caps = BAND_VHF | BAND_UHF,
Patrick Boettcher01b4bf32006-09-19 12:51:53 -030047 .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
Patrick Boettcherb7f54912006-09-19 12:51:37 -030048
Patrick Boettcher6958eff2006-09-19 12:51:40 -030049 .agc1_max = 42598,
50 .agc1_min = 17694,
51 .agc2_max = 45875,
52 .agc2_min = 0,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030053
Patrick Boettcher6958eff2006-09-19 12:51:40 -030054 .agc1_pt1 = 0,
55 .agc1_pt2 = 59,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030056
Patrick Boettcher6958eff2006-09-19 12:51:40 -030057 .agc1_slope1 = 0,
58 .agc1_slope2 = 69,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030059
60 .agc2_pt1 = 0,
Patrick Boettcher6958eff2006-09-19 12:51:40 -030061 .agc2_pt2 = 59,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030062
Patrick Boettcher6958eff2006-09-19 12:51:40 -030063 .agc2_slope1 = 111,
64 .agc2_slope2 = 28,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030065};
66
67static 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,
72 },
73 { .agc = &bristol_dib3000p_mt2060_agc_config,
74 .max_time = 0x196,
75 .ln_adc_level = 0x1cc7,
76 .output_mpeg2_in_188_bytes = 1,
77 }
78};
79
80static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
81{
Patrick Boettcher6958eff2006-09-19 12:51:40 -030082 struct dib0700_state *st = adap->dev->priv;
Patrick Boettcherb7f54912006-09-19 12:51:37 -030083 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);
88
Patrick Boettcher7fb3fc02006-09-20 04:37:18 -030089 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);
Patrick Boettcher6958eff2006-09-19 12:51:40 -030093
Patrick Boettcherb7f54912006-09-19 12:51:37 -030094 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;
97 }
98 }
Patrick Boettcher6958eff2006-09-19 12:51:40 -030099 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;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300102}
103
Patrick Boettcher4a2b1082008-01-25 07:32:58 -0300104static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval)
Olivier DANETc52344f2008-01-25 06:50:07 -0300105{
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 },
109 };
110 if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO;
111 return 0;
112}
113
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300114static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
115{
Olivier DANETc52344f2008-01-25 06:50:07 -0300116 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300117 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
Olivier DANETc52344f2008-01-25 06:50:07 -0300118 s8 a;
119 int if1=1220;
Al Viroda5ee482008-05-21 00:31:21 -0300120 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)) {
Olivier DANETc52344f2008-01-25 06:50:07 -0300122 if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;
123 }
124 return dvb_attach(mt2060_attach,adap->fe, tun_i2c,&bristol_mt2060_config[adap->id],
125 if1) == NULL ? -ENODEV : 0;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300126}
127
Patrick Boettcher01373a52007-07-30 12:49:04 -0300128/* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
Olivier DANET54d75eb2007-07-25 14:42:54 -0300129
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300130/* MT226x */
131static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = {
132 {
133 BAND_UHF, // band_caps
Olivier DANET54d75eb2007-07-25 14:42:54 -0300134
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300135 /* 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
Olivier DANET54d75eb2007-07-25 14:42:54 -0300138
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300139 1130, // inv_gain
140 21, // time_stabiliz
Olivier DANET54d75eb2007-07-25 14:42:54 -0300141
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300142 0, // alpha_level
143 118, // thlock
Olivier DANET54d75eb2007-07-25 14:42:54 -0300144
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300145 0, // wbd_inv
146 3530, // wbd_ref
147 1, // wbd_sel
148 0, // wbd_alpha
Olivier DANET54d75eb2007-07-25 14:42:54 -0300149
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300150 65535, // agc1_max
151 33770, // agc1_min
152 65535, // agc2_max
153 23592, // agc2_min
Olivier DANET54d75eb2007-07-25 14:42:54 -0300154
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300155 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
164
165 17, // alpha_mant
166 27, // alpha_exp
167 23, // beta_mant
168 51, // beta_exp
169
170 1, // perform_agc_softsplit
171 }, {
172 BAND_VHF | BAND_LBAND, // band_caps
173
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
177
178 2372, // inv_gain
179 21, // time_stabiliz
180
181 0, // alpha_level
182 118, // thlock
183
184 0, // wbd_inv
185 3530, // wbd_ref
186 1, // wbd_sel
187 0, // wbd_alpha
188
189 65535, // agc1_max
190 0, // agc1_min
191 65535, // agc2_max
192 23592, // agc2_min
193
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
203
204 17, // alpha_mant
205 27, // alpha_exp
206 23, // beta_mant
207 51, // beta_exp
208
209 1, // perform_agc_softsplit
210 }
Olivier DANET54d75eb2007-07-25 14:42:54 -0300211};
212
213static 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
220};
221
222static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {
223 { .output_mpeg2_in_188_bytes = 1,
224 .hostbus_diversity = 1,
225 .tuner_is_baseband = 1,
226
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300227 .agc_config_count = 2,
228 .agc = stk7700d_7000p_mt2266_agc_config,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300229 .bw = &stk7700d_mt2266_pll_config,
230
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300231 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
232 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
233 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300234 },
235 { .output_mpeg2_in_188_bytes = 1,
236 .hostbus_diversity = 1,
237 .tuner_is_baseband = 1,
238
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300239 .agc_config_count = 2,
240 .agc = stk7700d_7000p_mt2266_agc_config,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300241 .bw = &stk7700d_mt2266_pll_config,
242
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300243 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
244 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
245 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300246 }
247};
248
249static struct mt2266_config stk7700d_mt2266_config[2] = {
250 { .i2c_address = 0x60
251 },
252 { .i2c_address = 0x60
253 }
254};
255
Daniel Gimpelevich132c3182008-01-25 06:02:42 -0300256static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap)
257{
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);
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -0300268 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;
273 }
Daniel Gimpelevich132c3182008-01-25 06:02:42 -0300274 }
275
276 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
277 &stk7700d_dib7000p_mt2266_config[adap->id]);
278
279 return adap->fe == NULL ? -ENODEV : 0;
280}
281
Olivier DANET54d75eb2007-07-25 14:42:54 -0300282static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap)
283{
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);
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -0300295 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;
300 }
Olivier DANET54d75eb2007-07-25 14:42:54 -0300301 }
302
303 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
304 &stk7700d_dib7000p_mt2266_config[adap->id]);
305
306 return adap->fe == NULL ? -ENODEV : 0;
307}
308
309static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap)
310{
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,
Joe Perches1ebcad72009-07-02 15:57:09 -0300314 &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300315}
316
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300317/* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
Harvey Harrisonb1721d02008-04-25 19:03:08 -0700318static struct dibx000_agc_config xc3028_agc_config = {
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300319 BAND_VHF | BAND_UHF, /* band_caps */
320
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 */
326
327 712, /* inv_gain */
328 21, /* time_stabiliz */
329
330 0, /* alpha_level */
331 118, /* thlock */
332
333 0, /* wbd_inv */
334 2867, /* wbd_ref */
335 0, /* wbd_sel */
336 2, /* wbd_alpha */
337
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 */
351
352 17, /* alpha_mant */
353 27, /* alpha_exp */
354 23, /* beta_mant */
355 51, /* beta_exp */
356
357 1, /* perform_agc_softsplit */
358};
359
360/* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
Harvey Harrisonb1721d02008-04-25 19:03:08 -0700361static struct dibx000_bandwidth_config xc3028_bw_config = {
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300362 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 */
370};
371
372static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
373 .output_mpeg2_in_188_bytes = 1,
374 .tuner_is_baseband = 1,
375
376 .agc_config_count = 1,
377 .agc = &xc3028_agc_config,
378 .bw = &xc3028_bw_config,
379
380 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
381 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
382 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
383};
384
Michael Krufkyd7cba042008-09-12 13:31:45 -0300385static int stk7700ph_xc3028_callback(void *ptr, int component,
386 int command, int arg)
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300387{
388 struct dvb_usb_adapter *adap = ptr;
389
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;
402 }
403 return 0;
404}
405
406static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
407 .fname = XC2028_DEFAULT_FIRMWARE,
408 .max_len = 64,
409 .demod = XC3028_FE_DIBCOM52,
410};
411
412static struct xc2028_config stk7700ph_xc3028_config = {
413 .i2c_addr = 0x61,
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300414 .ctrl = &stk7700ph_xc3028_ctrl,
415};
416
417static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
418{
419 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;
420
Al Viroda5ee482008-05-21 00:31:21 -0300421 if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
422 desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300423 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);
436
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -0300437 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;
442 }
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300443
444 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
445 &stk7700ph_dib7700_xc3028_config);
446
447 return adap->fe == NULL ? -ENODEV : 0;
448}
449
450static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
451{
452 struct i2c_adapter *tun_i2c;
453
454 tun_i2c = dib7000p_get_i2c_master(adap->fe,
455 DIBX000_I2C_INTERFACE_TUNER, 1);
456
457 stk7700ph_xc3028_config.i2c_adap = tun_i2c;
Michael Krufkyd7cba042008-09-12 13:31:45 -0300458
459 /* FIXME: generalize & move to common area */
460 adap->fe->callback = stk7700ph_xc3028_callback;
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300461
462 return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config)
463 == NULL ? -ENODEV : 0;
464}
465
Devin Heitmueller4b330be2008-12-01 06:51:14 -0300466#define DEFAULT_RC_INTERVAL 50
Olivier DANET54d75eb2007-07-25 14:42:54 -0300467
468static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
469
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300470/* Number of keypresses to ignore before start repeating */
Devin Heitmueller4b330be2008-12-01 06:51:14 -0300471#define RC_REPEAT_DELAY 6
472#define RC_REPEAT_DELAY_V1_20 10
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300473
Devin Heitmueller99afb982008-11-15 07:13:07 -0300474
475
476/* Used by firmware versions < 1.20 (deprecated) */
477static int dib0700_rc_query_legacy(struct dvb_usb_device *d, u32 *event,
478 int *state)
Olivier DANET54d75eb2007-07-25 14:42:54 -0300479{
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) {
Janne Grunau034d65e2007-07-31 08:48:40 -0300488 err("RC Query Failed");
Janne Grunau89f42672007-07-31 19:45:13 -0300489 return -1;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300490 }
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300491
492 /* losing half of KEY_0 events from Philipps rc5 remotes.. */
Olivier DANET54d75eb2007-07-25 14:42:54 -0300493 if (key[0]==0 && key[1]==0 && key[2]==0 && key[3]==0) return 0;
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300494
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]); */
496
497 dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */
498
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;
509 }
510 return 0;
511 }
Olivier DANET54d75eb2007-07-25 14:42:54 -0300512 for (i=0;i<d->props.rc_key_map_size; i++) {
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -0300513 if (rc5_custom(&keymap[i]) == key[3-2] &&
514 rc5_data(&keymap[i]) == key[3-3]) {
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300515 st->rc_counter = 0;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300516 *event = keymap[i].event;
517 *state = REMOTE_KEY_PRESSED;
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300518 d->last_event = keymap[i].event;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300519 return 0;
520 }
521 }
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300522 break;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300523 }
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300524 default: {
525 /* RC-5 protocol changes toggle bit on new keypress */
526 for (i = 0; i < d->props.rc_key_map_size; i++) {
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -0300527 if (rc5_custom(&keymap[i]) == key[3-2] &&
528 rc5_data(&keymap[i]) == key[3-3]) {
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300529 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;
537 }
538
539 return 0;
540 }
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;
547 }
548 }
549 break;
550 }
551 }
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;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300554 return 0;
555}
556
Devin Heitmueller99afb982008-11-15 07:13:07 -0300557/* This is the structure of the RC response packet starting in firmware 1.20 */
558struct dib0700_rc_response {
559 u8 report_id;
560 u8 data_state;
Mauro Carvalho Chehabaa15c0a2009-09-26 13:29:35 -0300561 u16 system;
Devin Heitmueller99afb982008-11-15 07:13:07 -0300562 u8 data;
563 u8 not_data;
564};
565
566/* This supports the new IR response format for firmware v1.20 */
567static int dib0700_rc_query_v1_20(struct dvb_usb_device *d, u32 *event,
568 int *state)
569{
570 struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
571 struct dib0700_state *st = d->priv;
572 struct dib0700_rc_response poll_reply;
573 u8 buf[6];
574 int i;
575 int status;
576 int actlen;
577 int found = 0;
578
579 /* Set initial results in case we exit the function early */
580 *event = 0;
581 *state = REMOTE_NO_KEY_PRESSED;
582
583 /* Firmware v1.20 provides RC data via bulk endpoint 1 */
584 status = usb_bulk_msg(d->udev, usb_rcvbulkpipe(d->udev, 1), buf,
585 sizeof(buf), &actlen, 50);
586 if (status < 0) {
587 /* No data available (meaning no key press) */
588 return 0;
589 }
590
Mauro Carvalho Chehabaa15c0a2009-09-26 13:29:35 -0300591
592 switch (dvb_usb_dib0700_ir_proto) {
593 case 0:
594 poll_reply.report_id = 0;
595 poll_reply.data_state = 1;
596 poll_reply.system = buf[2];
597 poll_reply.data = buf[4];
598 poll_reply.not_data = buf[5];
599
600 /* NEC protocol sends repeat code as 0 0 0 FF */
601 if ((poll_reply.system == 0x00) && (poll_reply.data == 0x00)
602 && (poll_reply.not_data == 0xff)) {
603 poll_reply.data_state = 2;
604 break;
605 }
606 break;
607 default:
608 if (actlen != sizeof(buf)) {
609 /* We didn't get back the 6 byte message we expected */
610 err("Unexpected RC response size [%d]", actlen);
611 return -1;
612 }
613
614 poll_reply.report_id = buf[0];
615 poll_reply.data_state = buf[1];
616 poll_reply.system = (buf[2] << 8) | buf[3];
617 poll_reply.data = buf[4];
618 poll_reply.not_data = buf[5];
619
620 break;
Devin Heitmueller99afb982008-11-15 07:13:07 -0300621 }
622
Devin Heitmueller99afb982008-11-15 07:13:07 -0300623 if ((poll_reply.data + poll_reply.not_data) != 0xff) {
624 /* Key failed integrity check */
Mauro Carvalho Chehabaa15c0a2009-09-26 13:29:35 -0300625 err("key failed integrity check: %04x %02x %02x",
626 poll_reply.system,
Devin Heitmueller99afb982008-11-15 07:13:07 -0300627 poll_reply.data, poll_reply.not_data);
628 return -1;
629 }
630
Mauro Carvalho Chehabaa15c0a2009-09-26 13:29:35 -0300631
Devin Heitmueller99afb982008-11-15 07:13:07 -0300632 /* Find the key in the map */
633 for (i = 0; i < d->props.rc_key_map_size; i++) {
Mauro Carvalho Chehabaa15c0a2009-09-26 13:29:35 -0300634 if (rc5_custom(&keymap[i]) == (poll_reply.system & 0xff) &&
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -0300635 rc5_data(&keymap[i]) == poll_reply.data) {
Devin Heitmueller99afb982008-11-15 07:13:07 -0300636 *event = keymap[i].event;
637 found = 1;
638 break;
639 }
640 }
641
642 if (found == 0) {
Mauro Carvalho Chehabaa15c0a2009-09-26 13:29:35 -0300643 err("Unknown remote controller key: %04x %02x %02x",
644 poll_reply.system,
Devin Heitmueller99afb982008-11-15 07:13:07 -0300645 poll_reply.data, poll_reply.not_data);
646 d->last_event = 0;
647 return 0;
648 }
649
650 if (poll_reply.data_state == 1) {
651 /* New key hit */
652 st->rc_counter = 0;
653 *event = keymap[i].event;
654 *state = REMOTE_KEY_PRESSED;
655 d->last_event = keymap[i].event;
656 } else if (poll_reply.data_state == 2) {
657 /* Key repeated */
658 st->rc_counter++;
659
660 /* prevents unwanted double hits */
661 if (st->rc_counter > RC_REPEAT_DELAY_V1_20) {
662 *event = d->last_event;
663 *state = REMOTE_KEY_PRESSED;
664 st->rc_counter = RC_REPEAT_DELAY_V1_20;
665 }
666 } else {
667 err("Unknown data state [%d]", poll_reply.data_state);
668 }
669
670 return 0;
671}
672
673static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
674{
675 struct dib0700_state *st = d->priv;
676
677 /* Because some people may have improperly named firmware files,
678 let's figure out whether to use the new firmware call or the legacy
679 call based on the firmware version embedded in the file */
680 if (st->rc_func_version == 0) {
681 u32 hwver, romver, ramver, fwtype;
682 int ret = dib0700_get_version(d, &hwver, &romver, &ramver,
683 &fwtype);
684 if (ret < 0) {
685 err("Could not determine version info");
686 return -1;
687 }
688 if (ramver < 0x10200)
689 st->rc_func_version = 1;
690 else
691 st->rc_func_version = 2;
692 }
693
694 if (st->rc_func_version == 2)
695 return dib0700_rc_query_v1_20(d, event, state);
696 else
697 return dib0700_rc_query_legacy(d, event, state);
698}
699
Janne Grunau82f3d552007-07-30 13:50:28 -0300700static struct dvb_usb_rc_key dib0700_rc_keys[] = {
Olivier DANET54d75eb2007-07-25 14:42:54 -0300701 /* Key codes for the tiny Pinnacle remote*/
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -0300702 { 0x0700, KEY_MUTE },
703 { 0x0701, KEY_MENU }, /* Pinnacle logo */
704 { 0x0739, KEY_POWER },
705 { 0x0703, KEY_VOLUMEUP },
706 { 0x0709, KEY_VOLUMEDOWN },
707 { 0x0706, KEY_CHANNELUP },
708 { 0x070c, KEY_CHANNELDOWN },
709 { 0x070f, KEY_1 },
710 { 0x0715, KEY_2 },
711 { 0x0710, KEY_3 },
712 { 0x0718, KEY_4 },
713 { 0x071b, KEY_5 },
714 { 0x071e, KEY_6 },
715 { 0x0711, KEY_7 },
716 { 0x0721, KEY_8 },
717 { 0x0712, KEY_9 },
718 { 0x0727, KEY_0 },
719 { 0x0724, KEY_SCREEN }, /* 'Square' key */
720 { 0x072a, KEY_TEXT }, /* 'T' key */
721 { 0x072d, KEY_REWIND },
722 { 0x0730, KEY_PLAY },
723 { 0x0733, KEY_FASTFORWARD },
724 { 0x0736, KEY_RECORD },
725 { 0x073c, KEY_STOP },
726 { 0x073f, KEY_CANCEL }, /* '?' key */
Olivier DANET54d75eb2007-07-25 14:42:54 -0300727 /* Key codes for the Terratec Cinergy DT XS Diversity, similar to cinergyT2.c */
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -0300728 { 0xeb01, KEY_POWER },
729 { 0xeb02, KEY_1 },
730 { 0xeb03, KEY_2 },
731 { 0xeb04, KEY_3 },
732 { 0xeb05, KEY_4 },
733 { 0xeb06, KEY_5 },
734 { 0xeb07, KEY_6 },
735 { 0xeb08, KEY_7 },
736 { 0xeb09, KEY_8 },
737 { 0xeb0a, KEY_9 },
738 { 0xeb0b, KEY_VIDEO },
739 { 0xeb0c, KEY_0 },
740 { 0xeb0d, KEY_REFRESH },
741 { 0xeb0f, KEY_EPG },
742 { 0xeb10, KEY_UP },
743 { 0xeb11, KEY_LEFT },
744 { 0xeb12, KEY_OK },
745 { 0xeb13, KEY_RIGHT },
746 { 0xeb14, KEY_DOWN },
747 { 0xeb16, KEY_INFO },
748 { 0xeb17, KEY_RED },
749 { 0xeb18, KEY_GREEN },
750 { 0xeb19, KEY_YELLOW },
751 { 0xeb1a, KEY_BLUE },
752 { 0xeb1b, KEY_CHANNELUP },
753 { 0xeb1c, KEY_VOLUMEUP },
754 { 0xeb1d, KEY_MUTE },
755 { 0xeb1e, KEY_VOLUMEDOWN },
756 { 0xeb1f, KEY_CHANNELDOWN },
757 { 0xeb40, KEY_PAUSE },
758 { 0xeb41, KEY_HOME },
759 { 0xeb42, KEY_MENU }, /* DVD Menu */
760 { 0xeb43, KEY_SUBTITLE },
761 { 0xeb44, KEY_TEXT }, /* Teletext */
762 { 0xeb45, KEY_DELETE },
763 { 0xeb46, KEY_TV },
764 { 0xeb47, KEY_DVD },
765 { 0xeb48, KEY_STOP },
766 { 0xeb49, KEY_VIDEO },
767 { 0xeb4a, KEY_AUDIO }, /* Music */
768 { 0xeb4b, KEY_SCREEN }, /* Pic */
769 { 0xeb4c, KEY_PLAY },
770 { 0xeb4d, KEY_BACK },
771 { 0xeb4e, KEY_REWIND },
772 { 0xeb4f, KEY_FASTFORWARD },
773 { 0xeb54, KEY_PREVIOUS },
774 { 0xeb58, KEY_RECORD },
775 { 0xeb5c, KEY_NEXT },
Janne Grunau7161f272007-07-30 13:54:55 -0300776
777 /* Key codes for the Haupauge WinTV Nova-TD, copied from nova-t-usb2.c (Nova-T USB2) */
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -0300778 { 0x1e00, KEY_0 },
779 { 0x1e01, KEY_1 },
780 { 0x1e02, KEY_2 },
781 { 0x1e03, KEY_3 },
782 { 0x1e04, KEY_4 },
783 { 0x1e05, KEY_5 },
784 { 0x1e06, KEY_6 },
785 { 0x1e07, KEY_7 },
786 { 0x1e08, KEY_8 },
787 { 0x1e09, KEY_9 },
788 { 0x1e0a, KEY_KPASTERISK },
789 { 0x1e0b, KEY_RED },
790 { 0x1e0c, KEY_RADIO },
791 { 0x1e0d, KEY_MENU },
792 { 0x1e0e, KEY_GRAVE }, /* # */
793 { 0x1e0f, KEY_MUTE },
794 { 0x1e10, KEY_VOLUMEUP },
795 { 0x1e11, KEY_VOLUMEDOWN },
796 { 0x1e12, KEY_CHANNEL },
797 { 0x1e14, KEY_UP },
798 { 0x1e15, KEY_DOWN },
799 { 0x1e16, KEY_LEFT },
800 { 0x1e17, KEY_RIGHT },
801 { 0x1e18, KEY_VIDEO },
802 { 0x1e19, KEY_AUDIO },
803 { 0x1e1a, KEY_MEDIA },
804 { 0x1e1b, KEY_EPG },
805 { 0x1e1c, KEY_TV },
806 { 0x1e1e, KEY_NEXT },
807 { 0x1e1f, KEY_BACK },
808 { 0x1e20, KEY_CHANNELUP },
809 { 0x1e21, KEY_CHANNELDOWN },
810 { 0x1e24, KEY_LAST }, /* Skip backwards */
811 { 0x1e25, KEY_OK },
812 { 0x1e29, KEY_BLUE},
813 { 0x1e2e, KEY_GREEN },
814 { 0x1e30, KEY_PAUSE },
815 { 0x1e32, KEY_REWIND },
816 { 0x1e34, KEY_FASTFORWARD },
817 { 0x1e35, KEY_PLAY },
818 { 0x1e36, KEY_STOP },
819 { 0x1e37, KEY_RECORD },
820 { 0x1e38, KEY_YELLOW },
821 { 0x1e3b, KEY_GOTO },
822 { 0x1e3d, KEY_POWER },
Jaroslav Barton48e6a012007-11-10 19:17:45 -0300823
824 /* Key codes for the Leadtek Winfast DTV Dongle */
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -0300825 { 0x0042, KEY_POWER },
826 { 0x077c, KEY_TUNER },
827 { 0x0f4e, KEY_PRINT }, /* PREVIEW */
828 { 0x0840, KEY_SCREEN }, /* full screen toggle*/
829 { 0x0f71, KEY_DOT }, /* frequency */
830 { 0x0743, KEY_0 },
831 { 0x0c41, KEY_1 },
832 { 0x0443, KEY_2 },
833 { 0x0b7f, KEY_3 },
834 { 0x0e41, KEY_4 },
835 { 0x0643, KEY_5 },
836 { 0x097f, KEY_6 },
837 { 0x0d7e, KEY_7 },
838 { 0x057c, KEY_8 },
839 { 0x0a40, KEY_9 },
840 { 0x0e4e, KEY_CLEAR },
841 { 0x047c, KEY_CHANNEL }, /* show channel number */
842 { 0x0f41, KEY_LAST }, /* recall */
843 { 0x0342, KEY_MUTE },
844 { 0x064c, KEY_RESERVED }, /* PIP button*/
845 { 0x0172, KEY_SHUFFLE }, /* SNAPSHOT */
846 { 0x0c4e, KEY_PLAYPAUSE }, /* TIMESHIFT */
847 { 0x0b70, KEY_RECORD },
848 { 0x037d, KEY_VOLUMEUP },
849 { 0x017d, KEY_VOLUMEDOWN },
850 { 0x0242, KEY_CHANNELUP },
851 { 0x007d, KEY_CHANNELDOWN },
Chris Rankin48aa7392008-09-25 06:52:24 -0300852
853 /* Key codes for Nova-TD "credit card" remote control. */
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -0300854 { 0x1d00, KEY_0 },
855 { 0x1d01, KEY_1 },
856 { 0x1d02, KEY_2 },
857 { 0x1d03, KEY_3 },
858 { 0x1d04, KEY_4 },
859 { 0x1d05, KEY_5 },
860 { 0x1d06, KEY_6 },
861 { 0x1d07, KEY_7 },
862 { 0x1d08, KEY_8 },
863 { 0x1d09, KEY_9 },
864 { 0x1d0a, KEY_TEXT },
865 { 0x1d0d, KEY_MENU },
866 { 0x1d0f, KEY_MUTE },
867 { 0x1d10, KEY_VOLUMEUP },
868 { 0x1d11, KEY_VOLUMEDOWN },
869 { 0x1d12, KEY_CHANNEL },
870 { 0x1d14, KEY_UP },
871 { 0x1d15, KEY_DOWN },
872 { 0x1d16, KEY_LEFT },
873 { 0x1d17, KEY_RIGHT },
874 { 0x1d1c, KEY_TV },
875 { 0x1d1e, KEY_NEXT },
876 { 0x1d1f, KEY_BACK },
877 { 0x1d20, KEY_CHANNELUP },
878 { 0x1d21, KEY_CHANNELDOWN },
879 { 0x1d24, KEY_LAST },
880 { 0x1d25, KEY_OK },
881 { 0x1d30, KEY_PAUSE },
882 { 0x1d32, KEY_REWIND },
883 { 0x1d34, KEY_FASTFORWARD },
884 { 0x1d35, KEY_PLAY },
885 { 0x1d36, KEY_STOP },
886 { 0x1d37, KEY_RECORD },
887 { 0x1d3b, KEY_GOTO },
888 { 0x1d3d, KEY_POWER },
Mauro Carvalho Chehab4c5128b2009-09-26 13:31:31 -0300889
890 /* Key codes for the Pixelview SBTVD remote (proto NEC) */
891 { 0x8613, KEY_MUTE },
892 { 0x8612, KEY_POWER },
893 { 0x8601, KEY_1 },
894 { 0x8602, KEY_2 },
895 { 0x8603, KEY_3 },
896 { 0x8604, KEY_4 },
897 { 0x8605, KEY_5 },
898 { 0x8606, KEY_6 },
899 { 0x8607, KEY_7 },
900 { 0x8608, KEY_8 },
901 { 0x8609, KEY_9 },
902 { 0x8600, KEY_0 },
903 { 0x860d, KEY_CHANNELUP },
904 { 0x8619, KEY_CHANNELDOWN },
905 { 0x8610, KEY_VOLUMEUP },
906 { 0x860c, KEY_VOLUMEDOWN },
907
908 { 0x860a, KEY_CAMERA },
909 { 0x860b, KEY_ZOOM },
910 { 0x861b, KEY_BACKSPACE },
911 { 0x8615, KEY_ENTER },
912
913 { 0x861d, KEY_UP },
914 { 0x861e, KEY_DOWN },
915 { 0x860e, KEY_LEFT },
916 { 0x860f, KEY_RIGHT },
917
918 { 0x8618, KEY_RECORD },
919 { 0x861a, KEY_STOP },
Sergio C Fortierc86c82b2009-11-04 15:55:09 -0300920
921 /* Key codes for the EvolutePC TVWay+ remote (proto NEC) */
922 { 0x7a00, KEY_MENU },
923 { 0x7a01, KEY_RECORD },
924 { 0x7a02, KEY_PLAY },
925 { 0x7a03, KEY_STOP },
926 { 0x7a10, KEY_CHANNELUP },
927 { 0x7a11, KEY_CHANNELDOWN },
928 { 0x7a12, KEY_VOLUMEUP },
929 { 0x7a13, KEY_VOLUMEDOWN },
930 { 0x7a40, KEY_POWER },
931 { 0x7a41, KEY_MUTE },
Janne Grunau82f3d552007-07-30 13:50:28 -0300932};
Olivier DANET54d75eb2007-07-25 14:42:54 -0300933
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300934/* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
Patrick Boettchera75763f2006-10-18 08:34:16 -0300935static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300936 BAND_UHF | BAND_VHF, // band_caps
937
938 /* 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,
939 * 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 */
940 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
941
942 712, // inv_gain
943 41, // time_stabiliz
944
945 0, // alpha_level
946 118, // thlock
947
948 0, // wbd_inv
949 4095, // wbd_ref
950 0, // wbd_sel
951 0, // wbd_alpha
952
953 42598, // agc1_max
954 17694, // agc1_min
955 45875, // agc2_max
956 2621, // agc2_min
957 0, // agc1_pt1
958 76, // agc1_pt2
959 139, // agc1_pt3
960 52, // agc1_slope1
961 59, // agc1_slope2
962 107, // agc2_pt1
963 172, // agc2_pt2
964 57, // agc2_slope1
965 70, // agc2_slope2
966
967 21, // alpha_mant
968 25, // alpha_exp
969 28, // beta_mant
970 48, // beta_exp
971
972 1, // perform_agc_softsplit
973 { 0, // split_min
974 107, // split_max
975 51800, // global_split_min
976 24700 // global_split_max
977 },
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300978};
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300979
Patrick Boettchera75763f2006-10-18 08:34:16 -0300980static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
981 BAND_UHF | BAND_VHF,
982
983 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
984 * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
985 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
986
987 712, // inv_gain
988 41, // time_stabiliz
989
990 0, // alpha_level
991 118, // thlock
992
993 0, // wbd_inv
994 4095, // wbd_ref
995 0, // wbd_sel
996 0, // wbd_alpha
997
998 42598, // agc1_max
999 16384, // agc1_min
1000 42598, // agc2_max
1001 0, // agc2_min
1002
1003 0, // agc1_pt1
1004 137, // agc1_pt2
1005 255, // agc1_pt3
1006
1007 0, // agc1_slope1
1008 255, // agc1_slope2
1009
1010 0, // agc2_pt1
1011 0, // agc2_pt2
1012
1013 0, // agc2_slope1
1014 41, // agc2_slope2
1015
1016 15, // alpha_mant
1017 25, // alpha_exp
1018
1019 28, // beta_mant
1020 48, // beta_exp
1021
1022 0, // perform_agc_softsplit
1023};
1024
1025static struct dibx000_bandwidth_config stk7700p_pll_config = {
Patrick Boettcher69ea31e2006-10-17 18:28:14 -03001026 60000, 30000, // internal, sampling
1027 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
1028 0, 0, 1, 1, 0, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
1029 (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
1030 60258167, // ifreq
1031 20452225, // timf
Patrick Boettcher3db78e52007-07-31 08:19:28 -03001032 30000000, // xtal
Patrick Boettcher69ea31e2006-10-17 18:28:14 -03001033};
1034
1035static struct dib7000m_config stk7700p_dib7000m_config = {
1036 .dvbt_mode = 1,
1037 .output_mpeg2_in_188_bytes = 1,
1038 .quartz_direct = 1,
1039
1040 .agc_config_count = 1,
Patrick Boettchera75763f2006-10-18 08:34:16 -03001041 .agc = &stk7700p_7000m_mt2060_agc_config,
1042 .bw = &stk7700p_pll_config,
1043
1044 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
1045 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
1046 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
1047};
1048
1049static struct dib7000p_config stk7700p_dib7000p_config = {
1050 .output_mpeg2_in_188_bytes = 1,
1051
Patrick Boettcherb6884a12007-07-27 10:08:51 -03001052 .agc_config_count = 1,
Patrick Boettchera75763f2006-10-18 08:34:16 -03001053 .agc = &stk7700p_7000p_mt2060_agc_config,
1054 .bw = &stk7700p_pll_config,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -03001055
1056 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
1057 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
1058 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
1059};
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001060
1061static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
1062{
Patrick Boettcher69ea31e2006-10-17 18:28:14 -03001063 struct dib0700_state *st = adap->dev->priv;
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001064 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
Patrick Boettchera75763f2006-10-18 08:34:16 -03001065
1066 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1067 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
1068
Patrick Boettcher69ea31e2006-10-17 18:28:14 -03001069 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
Patrick Boettchera75763f2006-10-18 08:34:16 -03001070 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1071
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001072 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
Patrick Boettchera75763f2006-10-18 08:34:16 -03001073 dib0700_ctrl_clock(adap->dev, 72, 1);
1074 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
1075
1076 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001077
Patrick Boettcher69ea31e2006-10-17 18:28:14 -03001078 st->mt2060_if1[0] = 1220;
Patrick Boettchera75763f2006-10-18 08:34:16 -03001079
1080 if (dib7000pc_detection(&adap->dev->i2c_adap)) {
1081 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
1082 st->is_dib7000pc = 1;
1083 } else
1084 adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
1085
1086 return adap->fe == NULL ? -ENODEV : 0;
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001087}
1088
Patrick Boettcher69ea31e2006-10-17 18:28:14 -03001089static struct mt2060_config stk7700p_mt2060_config = {
1090 0x60
1091};
1092
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001093static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
1094{
Olivier DANETc52344f2008-01-25 06:50:07 -03001095 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
Patrick Boettcher69ea31e2006-10-17 18:28:14 -03001096 struct dib0700_state *st = adap->dev->priv;
Patrick Boettchera75763f2006-10-18 08:34:16 -03001097 struct i2c_adapter *tun_i2c;
Olivier DANETc52344f2008-01-25 06:50:07 -03001098 s8 a;
1099 int if1=1220;
Al Viroda5ee482008-05-21 00:31:21 -03001100 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
1101 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
Olivier DANETc52344f2008-01-25 06:50:07 -03001102 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
1103 }
Patrick Boettchera75763f2006-10-18 08:34:16 -03001104 if (st->is_dib7000pc)
1105 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1106 else
1107 tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1108
1109 return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config,
Olivier DANETc52344f2008-01-25 06:50:07 -03001110 if1) == NULL ? -ENODEV : 0;
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001111}
1112
Patrick Boettcher01373a52007-07-30 12:49:04 -03001113/* DIB7070 generic */
1114static struct dibx000_agc_config dib7070_agc_config = {
1115 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
1116 /* 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,
1117 * 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 */
1118 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), // setup
1119
1120 600, // inv_gain
1121 10, // time_stabiliz
1122
1123 0, // alpha_level
1124 118, // thlock
1125
1126 0, // wbd_inv
1127 3530, // wbd_ref
1128 1, // wbd_sel
1129 5, // wbd_alpha
1130
1131 65535, // agc1_max
1132 0, // agc1_min
1133
1134 65535, // agc2_max
1135 0, // agc2_min
1136
1137 0, // agc1_pt1
1138 40, // agc1_pt2
1139 183, // agc1_pt3
1140 206, // agc1_slope1
1141 255, // agc1_slope2
1142 72, // agc2_pt1
1143 152, // agc2_pt2
1144 88, // agc2_slope1
1145 90, // agc2_slope2
1146
1147 17, // alpha_mant
1148 27, // alpha_exp
1149 23, // beta_mant
1150 51, // beta_exp
1151
1152 0, // perform_agc_softsplit
1153};
1154
1155static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
1156{
Patrick Boettcher7e5ce652009-08-03 13:43:40 -03001157 deb_info("reset: %d", onoff);
Patrick Boettcher01373a52007-07-30 12:49:04 -03001158 return dib7000p_set_gpio(fe, 8, 0, !onoff);
1159}
1160
1161static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
1162{
Patrick Boettcher7e5ce652009-08-03 13:43:40 -03001163 deb_info("sleep: %d", onoff);
Patrick Boettcher01373a52007-07-30 12:49:04 -03001164 return dib7000p_set_gpio(fe, 9, 0, onoff);
1165}
1166
1167static struct dib0070_config dib7070p_dib0070_config[2] = {
1168 {
1169 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1170 .reset = dib7070_tuner_reset,
1171 .sleep = dib7070_tuner_sleep,
1172 .clock_khz = 12000,
Patrick Boettcher7e5ce652009-08-03 13:43:40 -03001173 .clock_pad_drive = 4,
1174 .charge_pump = 2,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001175 }, {
1176 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1177 .reset = dib7070_tuner_reset,
1178 .sleep = dib7070_tuner_sleep,
1179 .clock_khz = 12000,
Patrick Boettcher7e5ce652009-08-03 13:43:40 -03001180 .charge_pump = 2,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001181 }
1182};
1183
Olivier Grenied300bd62009-09-15 06:55:35 -03001184static struct dib0070_config dib7770p_dib0070_config = {
1185 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1186 .reset = dib7070_tuner_reset,
1187 .sleep = dib7070_tuner_sleep,
1188 .clock_khz = 12000,
1189 .clock_pad_drive = 0,
1190 .flip_chip = 1,
Olivier Grenieeac1fe12009-09-23 13:41:27 -03001191 .charge_pump = 2,
Olivier Grenied300bd62009-09-15 06:55:35 -03001192};
1193
Patrick Boettcher01373a52007-07-30 12:49:04 -03001194static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
1195{
1196 struct dvb_usb_adapter *adap = fe->dvb->priv;
1197 struct dib0700_adapter_state *state = adap->priv;
1198
1199 u16 offset;
1200 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1201 switch (band) {
1202 case BAND_VHF: offset = 950; break;
1203 case BAND_UHF:
1204 default: offset = 550; break;
1205 }
1206 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
1207 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1208 return state->set_param_save(fe, fep);
1209}
1210
Olivier Grenied300bd62009-09-15 06:55:35 -03001211static int dib7770_set_param_override(struct dvb_frontend *fe,
1212 struct dvb_frontend_parameters *fep)
1213{
1214 struct dvb_usb_adapter *adap = fe->dvb->priv;
1215 struct dib0700_adapter_state *state = adap->priv;
1216
1217 u16 offset;
1218 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1219 switch (band) {
1220 case BAND_VHF:
1221 dib7000p_set_gpio(fe, 0, 0, 1);
1222 offset = 850;
1223 break;
1224 case BAND_UHF:
1225 default:
1226 dib7000p_set_gpio(fe, 0, 0, 0);
1227 offset = 250;
1228 break;
1229 }
1230 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
1231 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1232 return state->set_param_save(fe, fep);
1233}
1234
1235static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
1236{
1237 struct dib0700_adapter_state *st = adap->priv;
1238 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe,
1239 DIBX000_I2C_INTERFACE_TUNER, 1);
1240
1241 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1242 &dib7770p_dib0070_config) == NULL)
1243 return -ENODEV;
1244
1245 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1246 adap->fe->ops.tuner_ops.set_params = dib7770_set_param_override;
1247 return 0;
1248}
1249
Patrick Boettcher01373a52007-07-30 12:49:04 -03001250static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
1251{
1252 struct dib0700_adapter_state *st = adap->priv;
1253 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1254
1255 if (adap->id == 0) {
1256 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
1257 return -ENODEV;
1258 } else {
1259 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
1260 return -ENODEV;
1261 }
1262
1263 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1264 adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override;
1265 return 0;
1266}
1267
Olivier Grenief8731f42009-09-18 04:08:43 -03001268static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
1269{
1270 return dib7000p_pid_filter(adapter->fe, index, pid, onoff);
1271}
1272
1273static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
1274{
1275 return dib7000p_pid_filter_ctrl(adapter->fe, onoff);
1276}
1277
Patrick Boettcher01373a52007-07-30 12:49:04 -03001278static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
1279 60000, 15000, // internal, sampling
1280 1, 20, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
1281 0, 0, 1, 1, 2, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
1282 (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k
1283 (0 << 25) | 0, // ifreq = 0.000000 MHz
1284 20452225, // timf
1285 12000000, // xtal_hz
1286};
1287
1288static struct dib7000p_config dib7070p_dib7000p_config = {
1289 .output_mpeg2_in_188_bytes = 1,
1290
1291 .agc_config_count = 1,
1292 .agc = &dib7070_agc_config,
1293 .bw = &dib7070_bw_config_12_mhz,
Patrick Boettcher3cb2c392008-01-25 07:25:20 -03001294 .tuner_is_baseband = 1,
1295 .spur_protect = 1,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001296
1297 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1298 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1299 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1300
1301 .hostbus_diversity = 1,
1302};
1303
1304/* STK7070P */
1305static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
1306{
Al Viroda5ee482008-05-21 00:31:21 -03001307 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
1308 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
1309 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
1310 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03001311 else
Al Viroda5ee482008-05-21 00:31:21 -03001312 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
Patrick Boettcher01373a52007-07-30 12:49:04 -03001313 msleep(10);
1314 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1315 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1316 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1317 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1318
1319 dib0700_ctrl_clock(adap->dev, 72, 1);
1320
1321 msleep(10);
1322 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1323 msleep(10);
1324 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1325
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -03001326 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1327 &dib7070p_dib7000p_config) != 0) {
1328 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1329 __func__);
1330 return -ENODEV;
1331 }
Patrick Boettcher01373a52007-07-30 12:49:04 -03001332
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03001333 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
1334 &dib7070p_dib7000p_config);
Patrick Boettcher01373a52007-07-30 12:49:04 -03001335 return adap->fe == NULL ? -ENODEV : 0;
1336}
1337
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001338/* DIB807x generic */
1339static struct dibx000_agc_config dib807x_agc_config[2] = {
1340 {
1341 BAND_VHF,
1342 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1343 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1344 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1345 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1346 * P_agc_write=0 */
1347 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1348 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1349 (0 << 0), /* setup*/
1350
1351 600, /* inv_gain*/
1352 10, /* time_stabiliz*/
1353
1354 0, /* alpha_level*/
1355 118, /* thlock*/
1356
1357 0, /* wbd_inv*/
1358 3530, /* wbd_ref*/
1359 1, /* wbd_sel*/
1360 5, /* wbd_alpha*/
1361
1362 65535, /* agc1_max*/
1363 0, /* agc1_min*/
1364
1365 65535, /* agc2_max*/
1366 0, /* agc2_min*/
1367
1368 0, /* agc1_pt1*/
1369 40, /* agc1_pt2*/
1370 183, /* agc1_pt3*/
1371 206, /* agc1_slope1*/
1372 255, /* agc1_slope2*/
1373 72, /* agc2_pt1*/
1374 152, /* agc2_pt2*/
1375 88, /* agc2_slope1*/
1376 90, /* agc2_slope2*/
1377
1378 17, /* alpha_mant*/
1379 27, /* alpha_exp*/
1380 23, /* beta_mant*/
1381 51, /* beta_exp*/
1382
1383 0, /* perform_agc_softsplit*/
1384 }, {
1385 BAND_UHF,
1386 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1387 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1388 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1389 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1390 * P_agc_write=0 */
1391 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1392 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1393 (0 << 0), /* setup */
1394
1395 600, /* inv_gain*/
1396 10, /* time_stabiliz*/
1397
1398 0, /* alpha_level*/
1399 118, /* thlock*/
1400
1401 0, /* wbd_inv*/
1402 3530, /* wbd_ref*/
1403 1, /* wbd_sel*/
1404 5, /* wbd_alpha*/
1405
1406 65535, /* agc1_max*/
1407 0, /* agc1_min*/
1408
1409 65535, /* agc2_max*/
1410 0, /* agc2_min*/
1411
1412 0, /* agc1_pt1*/
1413 40, /* agc1_pt2*/
1414 183, /* agc1_pt3*/
1415 206, /* agc1_slope1*/
1416 255, /* agc1_slope2*/
1417 72, /* agc2_pt1*/
1418 152, /* agc2_pt2*/
1419 88, /* agc2_slope1*/
1420 90, /* agc2_slope2*/
1421
1422 17, /* alpha_mant*/
1423 27, /* alpha_exp*/
1424 23, /* beta_mant*/
1425 51, /* beta_exp*/
1426
1427 0, /* perform_agc_softsplit*/
1428 }
1429};
1430
1431static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
1432 60000, 15000, /* internal, sampling*/
1433 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/
1434 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
1435 ADClkSrc, modulo */
1436 (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1437 (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1438 18179755, /* timf*/
1439 12000000, /* xtal_hz*/
1440};
1441
1442static struct dib8000_config dib807x_dib8000_config[2] = {
1443 {
1444 .output_mpeg2_in_188_bytes = 1,
1445
1446 .agc_config_count = 2,
1447 .agc = dib807x_agc_config,
1448 .pll = &dib807x_bw_config_12_mhz,
1449 .tuner_is_baseband = 1,
1450
1451 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1452 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1453 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1454
1455 .hostbus_diversity = 1,
1456 .div_cfg = 1,
1457 .agc_control = &dib0070_ctrl_agc_filter,
1458 .output_mode = OUTMODE_MPEG2_FIFO,
1459 .drives = 0x2d98,
1460 }, {
1461 .output_mpeg2_in_188_bytes = 1,
1462
1463 .agc_config_count = 2,
1464 .agc = dib807x_agc_config,
1465 .pll = &dib807x_bw_config_12_mhz,
1466 .tuner_is_baseband = 1,
1467
1468 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1469 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1470 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1471
1472 .hostbus_diversity = 1,
1473 .agc_control = &dib0070_ctrl_agc_filter,
1474 .output_mode = OUTMODE_MPEG2_FIFO,
1475 .drives = 0x2d98,
1476 }
1477};
1478
1479static int dib807x_tuner_reset(struct dvb_frontend *fe, int onoff)
1480{
1481 return dib8000_set_gpio(fe, 5, 0, !onoff);
1482}
1483
1484static int dib807x_tuner_sleep(struct dvb_frontend *fe, int onoff)
1485{
1486 return dib8000_set_gpio(fe, 0, 0, onoff);
1487}
1488
1489static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
1490 { 240, 7},
1491 { 0xffff, 6},
1492};
1493
1494static struct dib0070_config dib807x_dib0070_config[2] = {
1495 {
1496 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1497 .reset = dib807x_tuner_reset,
1498 .sleep = dib807x_tuner_sleep,
1499 .clock_khz = 12000,
1500 .clock_pad_drive = 4,
1501 .vga_filter = 1,
1502 .force_crystal_mode = 1,
1503 .enable_third_order_filter = 1,
1504 .charge_pump = 0,
1505 .wbd_gain = dib8070_wbd_gain_cfg,
1506 .osc_buffer_state = 0,
1507 .freq_offset_khz_uhf = -100,
1508 .freq_offset_khz_vhf = -100,
1509 }, {
1510 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1511 .reset = dib807x_tuner_reset,
1512 .sleep = dib807x_tuner_sleep,
1513 .clock_khz = 12000,
1514 .clock_pad_drive = 2,
1515 .vga_filter = 1,
1516 .force_crystal_mode = 1,
1517 .enable_third_order_filter = 1,
1518 .charge_pump = 0,
1519 .wbd_gain = dib8070_wbd_gain_cfg,
1520 .osc_buffer_state = 0,
1521 .freq_offset_khz_uhf = -25,
1522 .freq_offset_khz_vhf = -25,
1523 }
1524};
1525
1526static int dib807x_set_param_override(struct dvb_frontend *fe,
1527 struct dvb_frontend_parameters *fep)
1528{
1529 struct dvb_usb_adapter *adap = fe->dvb->priv;
1530 struct dib0700_adapter_state *state = adap->priv;
1531
1532 u16 offset = dib0070_wbd_offset(fe);
1533 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1534 switch (band) {
1535 case BAND_VHF:
1536 offset += 750;
1537 break;
1538 case BAND_UHF: /* fall-thru wanted */
1539 default:
1540 offset += 250; break;
1541 }
1542 deb_info("WBD for DiB8000: %d\n", offset);
1543 dib8000_set_wbd_ref(fe, offset);
1544
1545 return state->set_param_save(fe, fep);
1546}
1547
1548static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1549{
1550 struct dib0700_adapter_state *st = adap->priv;
1551 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe,
1552 DIBX000_I2C_INTERFACE_TUNER, 1);
1553
1554 if (adap->id == 0) {
1555 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1556 &dib807x_dib0070_config[0]) == NULL)
1557 return -ENODEV;
1558 } else {
1559 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1560 &dib807x_dib0070_config[1]) == NULL)
1561 return -ENODEV;
1562 }
1563
1564 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1565 adap->fe->ops.tuner_ops.set_params = dib807x_set_param_override;
1566 return 0;
1567}
1568
Olivier Grenief8731f42009-09-18 04:08:43 -03001569static int stk807x_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
1570{
1571 return dib8000_pid_filter(adapter->fe, index, pid, onoff);
1572}
1573
1574static int stk807x_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
1575{
1576 return dib8000_pid_filter_ctrl(adapter->fe, onoff);
1577}
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001578
1579/* STK807x */
1580static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
1581{
1582 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1583 msleep(10);
1584 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1585 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1586 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1587
1588 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1589
1590 dib0700_ctrl_clock(adap->dev, 72, 1);
1591
1592 msleep(10);
1593 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1594 msleep(10);
1595 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1596
1597 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1598 0x80);
1599
1600 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1601 &dib807x_dib8000_config[0]);
1602
1603 return adap->fe == NULL ? -ENODEV : 0;
1604}
1605
1606/* STK807xPVR */
1607static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
1608{
1609 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1610 msleep(30);
1611 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1612 msleep(500);
1613 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1614 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1615 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1616
1617 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1618
1619 dib0700_ctrl_clock(adap->dev, 72, 1);
1620
1621 msleep(10);
1622 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1623 msleep(10);
1624 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1625
1626 /* initialize IC 0 */
1627 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x80);
1628
1629 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1630 &dib807x_dib8000_config[0]);
1631
1632 return adap->fe == NULL ? -ENODEV : 0;
1633}
1634
1635static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
1636{
1637 /* initialize IC 1 */
1638 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x82);
1639
1640 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82,
1641 &dib807x_dib8000_config[1]);
1642
1643 return adap->fe == NULL ? -ENODEV : 0;
1644}
1645
1646
Patrick Boettcher01373a52007-07-30 12:49:04 -03001647/* STK7070PD */
1648static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
1649 {
1650 .output_mpeg2_in_188_bytes = 1,
1651
1652 .agc_config_count = 1,
1653 .agc = &dib7070_agc_config,
1654 .bw = &dib7070_bw_config_12_mhz,
Patrick Boettcher3cb2c392008-01-25 07:25:20 -03001655 .tuner_is_baseband = 1,
1656 .spur_protect = 1,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001657
1658 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1659 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1660 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1661
1662 .hostbus_diversity = 1,
1663 }, {
1664 .output_mpeg2_in_188_bytes = 1,
1665
1666 .agc_config_count = 1,
1667 .agc = &dib7070_agc_config,
1668 .bw = &dib7070_bw_config_12_mhz,
Patrick Boettcher3cb2c392008-01-25 07:25:20 -03001669 .tuner_is_baseband = 1,
1670 .spur_protect = 1,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001671
1672 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1673 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1674 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1675
1676 .hostbus_diversity = 1,
1677 }
1678};
1679
1680static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
1681{
1682 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1683 msleep(10);
1684 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1685 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1686 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1687 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1688
1689 dib0700_ctrl_clock(adap->dev, 72, 1);
1690
1691 msleep(10);
1692 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1693 msleep(10);
1694 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1695
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -03001696 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
1697 stk7070pd_dib7000p_config) != 0) {
1698 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1699 __func__);
1700 return -ENODEV;
1701 }
Patrick Boettcher01373a52007-07-30 12:49:04 -03001702
1703 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
1704 return adap->fe == NULL ? -ENODEV : 0;
1705}
1706
1707static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
1708{
1709 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
1710 return adap->fe == NULL ? -ENODEV : 0;
1711}
1712
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001713/* S5H1411 */
1714static struct s5h1411_config pinnacle_801e_config = {
1715 .output_mode = S5H1411_PARALLEL_OUTPUT,
1716 .gpio = S5H1411_GPIO_OFF,
1717 .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
1718 .qam_if = S5H1411_IF_44000,
1719 .vsb_if = S5H1411_IF_44000,
1720 .inversion = S5H1411_INVERSION_OFF,
1721 .status_mode = S5H1411_DEMODLOCKING
1722};
1723
1724/* Pinnacle PCTV HD Pro 801e GPIOs map:
1725 GPIO0 - currently unknown
1726 GPIO1 - xc5000 tuner reset
1727 GPIO2 - CX25843 sleep
1728 GPIO3 - currently unknown
1729 GPIO4 - currently unknown
1730 GPIO6 - currently unknown
1731 GPIO7 - currently unknown
1732 GPIO9 - currently unknown
1733 GPIO10 - CX25843 reset
1734 */
1735static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
1736{
1737 struct dib0700_state *st = adap->dev->priv;
1738
1739 /* Make use of the new i2c functions from FW 1.20 */
1740 st->fw_use_new_i2c_api = 1;
1741
1742 /* The s5h1411 requires the dib0700 to not be in master mode */
1743 st->disable_streaming_master_mode = 1;
1744
1745 /* All msleep values taken from Windows USB trace */
1746 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
1747 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
1748 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1749 msleep(400);
1750 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1751 msleep(60);
1752 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1753 msleep(30);
1754 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1755 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1756 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1757 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1758 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
1759 msleep(30);
1760
1761 /* Put the CX25843 to sleep for now since we're in digital mode */
1762 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
1763
1764 /* GPIOs are initialized, do the attach */
1765 adap->fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
1766 &adap->dev->i2c_adap);
1767 return adap->fe == NULL ? -ENODEV : 0;
1768}
1769
Michael Krufky767f3b32008-09-25 09:47:07 -03001770static int dib0700_xc5000_tuner_callback(void *priv, int component,
1771 int command, int arg)
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001772{
1773 struct dvb_usb_adapter *adap = priv;
1774
Devin Heitmueller79025a92008-10-06 12:07:48 -03001775 if (command == XC5000_TUNER_RESET) {
1776 /* Reset the tuner */
1777 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
Devin Heitmuellerf0f46332009-05-04 21:57:41 -03001778 msleep(10);
Devin Heitmueller79025a92008-10-06 12:07:48 -03001779 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
Devin Heitmuellerf0f46332009-05-04 21:57:41 -03001780 msleep(10);
Devin Heitmueller79025a92008-10-06 12:07:48 -03001781 } else {
1782 err("xc5000: unknown tuner callback command: %d\n", command);
1783 return -EINVAL;
1784 }
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001785
1786 return 0;
1787}
1788
1789static struct xc5000_config s5h1411_xc5000_tunerconfig = {
1790 .i2c_address = 0x64,
1791 .if_khz = 5380,
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001792};
1793
1794static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
1795{
Devin Heitmueller79025a92008-10-06 12:07:48 -03001796 /* FIXME: generalize & move to common area */
1797 adap->fe->callback = dib0700_xc5000_tuner_callback;
1798
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001799 return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap,
Michael Krufky767f3b32008-09-25 09:47:07 -03001800 &s5h1411_xc5000_tunerconfig)
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001801 == NULL ? -ENODEV : 0;
1802}
1803
Michael Krufkyce904bc2009-01-19 01:12:55 -03001804static struct lgdt3305_config hcw_lgdt3305_config = {
1805 .i2c_addr = 0x0e,
1806 .mpeg_mode = LGDT3305_MPEG_PARALLEL,
1807 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
1808 .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
1809 .deny_i2c_rptr = 0,
1810 .spectral_inversion = 1,
1811 .qam_if_khz = 6000,
1812 .vsb_if_khz = 6000,
1813 .usref_8vsb = 0x0500,
1814};
1815
1816static struct mxl5007t_config hcw_mxl5007t_config = {
1817 .xtal_freq_hz = MxL_XTAL_25_MHZ,
1818 .if_freq_hz = MxL_IF_6_MHZ,
1819 .invert_if = 1,
1820};
1821
1822/* TIGER-ATSC map:
1823 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
1824 GPIO1 - ANT_SEL (H: VPA, L: MCX)
1825 GPIO4 - SCL2
1826 GPIO6 - EN_TUNER
1827 GPIO7 - SDA2
1828 GPIO10 - DEM_RST
1829
1830 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
1831 */
1832static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
1833{
1834 struct dib0700_state *st = adap->dev->priv;
1835
1836 /* Make use of the new i2c functions from FW 1.20 */
1837 st->fw_use_new_i2c_api = 1;
1838
1839 st->disable_streaming_master_mode = 1;
1840
1841 /* fe power enable */
1842 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1843 msleep(30);
1844 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1845 msleep(30);
1846
1847 /* demod reset */
1848 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1849 msleep(30);
1850 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1851 msleep(30);
1852 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1853 msleep(30);
1854
1855 adap->fe = dvb_attach(lgdt3305_attach,
1856 &hcw_lgdt3305_config,
1857 &adap->dev->i2c_adap);
1858
1859 return adap->fe == NULL ? -ENODEV : 0;
1860}
1861
1862static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
1863{
1864 return dvb_attach(mxl5007t_attach, adap->fe,
1865 &adap->dev->i2c_adap, 0x60,
1866 &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
1867}
1868
1869
Patrick Boettcher01373a52007-07-30 12:49:04 -03001870/* DVB-USB and USB stuff follows */
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001871struct usb_device_id dib0700_usb_id_table[] = {
Patrick Boettcher01373a52007-07-30 12:49:04 -03001872/* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03001873 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
1874 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
1875 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
1876 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
Patrick Boettcher01373a52007-07-30 12:49:04 -03001877/* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03001878 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
1879 { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
1880 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
1881 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
Patrick Boettcher01373a52007-07-30 12:49:04 -03001882/* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03001883 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
1884 { USB_DEVICE(USB_VID_TERRATEC,
1885 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
1886 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
1887 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
Patrick Boettcher01373a52007-07-30 12:49:04 -03001888/* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03001889 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
1890 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
1891 { USB_DEVICE(USB_VID_PINNACLE,
1892 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
1893 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
Joachim Steigerfa3b8772007-10-08 20:08:46 -03001894/* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03001895 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
1896 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
1897 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
1898 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
1899/* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
1900 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
1901 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
1902 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
1903 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
1904/* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
1905 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
1906 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
Alexander Simondc888072008-03-29 21:37:54 -03001907 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
Darryl Green5da4e2c2008-03-29 21:47:43 -03001908 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
Michael Krufkyaf2a8872008-09-03 17:12:24 -03001909/* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
Michael Krufky9a0c04a2008-09-03 17:12:24 -03001910 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
Finn Thain17a370b2008-09-06 13:42:47 -03001911 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
Daniel Oliveira Nascimento8751aaa2008-09-07 12:39:44 -03001912 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
Albert Comerma57697432008-09-07 12:43:33 -03001913 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001914/* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
Devin Heitmuellerd2fc3bf2008-09-25 06:22:23 -03001915 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03001916 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
Nicolas Fournierdb4b2d12009-01-13 07:15:25 -03001917 { USB_DEVICE(USB_VID_TERRATEC,
1918 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
sebastian.blanes@gmail.com0a6e1ed2009-02-24 14:51:43 -03001919 { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
Pascal Terjan9abb6e62009-02-26 10:31:41 -03001920/* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
Michael Krufkyce904bc2009-01-19 01:12:55 -03001921 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
1922 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
Xoan Loureiro16ba1ee2009-03-29 08:43:36 -03001923 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
Klaus Flittner919a5482009-03-29 09:12:06 -03001924 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
Armin Schenker513846e2009-04-20 11:57:49 -03001925/* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
tomas petrf0f4ae72009-05-20 05:28:05 -03001926 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
Patrick Boettchera9b8fe32009-05-20 05:35:02 -03001927 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
1928 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
Pete Hildebrandtc53d83c2009-08-05 11:46:38 -03001929 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
Olivier Grenie74b76f22009-09-02 08:19:19 -03001930/* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
1931 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
Patrick Boettchere4147532009-11-30 13:52:57 -03001932 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV73ESE) },
1933 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV282E) },
Olivier Grenied300bd62009-09-15 06:55:35 -03001934 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
Patrick Boettcherdb481382009-09-15 07:16:51 -03001935/* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001936 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
1937 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
Mauro Carvalho Chehabaaeab302009-09-16 09:18:26 -03001938 { USB_DEVICE(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD) },
S?rgio Fortier8a378e82009-09-28 04:19:21 -03001939 { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },
Patrick Boettcher20232c42009-12-01 12:08:56 -03001940/* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
Patrick Boettchere4147532009-11-30 13:52:57 -03001941 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03001942 { 0 } /* Terminating entry */
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001943};
1944MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
1945
1946#define DIB0700_DEFAULT_DEVICE_PROPERTIES \
1947 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
1948 .usb_ctrl = DEVICE_SPECIFIC, \
Devin Heitmuellerbdc203e2008-09-06 13:45:27 -03001949 .firmware = "dvb-usb-dib0700-1.20.fw", \
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001950 .download_firmware = dib0700_download_firmware, \
Patrick Boettcher6958eff2006-09-19 12:51:40 -03001951 .no_reconnect = 1, \
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001952 .size_of_priv = sizeof(struct dib0700_state), \
Patrick Boettcher6958eff2006-09-19 12:51:40 -03001953 .i2c_algo = &dib0700_i2c_algo, \
1954 .identify_state = dib0700_identify_state
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001955
1956#define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
1957 .streaming_ctrl = dib0700_streaming_ctrl, \
1958 .stream = { \
1959 .type = USB_BULK, \
1960 .count = 4, \
1961 .endpoint = ep, \
1962 .u = { \
1963 .bulk = { \
1964 .buffersize = 39480, \
1965 } \
1966 } \
1967 }
1968
1969struct dvb_usb_device_properties dib0700_devices[] = {
1970 {
1971 DIB0700_DEFAULT_DEVICE_PROPERTIES,
1972
1973 .num_adapters = 1,
1974 .adapter = {
1975 {
Olivier Grenief8731f42009-09-18 04:08:43 -03001976 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1977 .pid_filter_count = 32,
1978 .pid_filter = stk70x0p_pid_filter,
1979 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001980 .frontend_attach = stk7700p_frontend_attach,
1981 .tuner_attach = stk7700p_tuner_attach,
1982
1983 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
1984 },
1985 },
1986
dominik67053a42007-11-10 19:23:31 -03001987 .num_device_descs = 8,
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001988 .devices = {
1989 { "DiBcom STK7700P reference design",
Tomi Koivulahti49a13762006-10-19 07:27:19 -03001990 { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001991 { NULL },
1992 },
1993 { "Hauppauge Nova-T Stick",
Stefan Trabyf9aeba42006-11-12 13:02:51 -03001994 { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001995 { NULL },
1996 },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03001997 { "AVerMedia AVerTV DVB-T Volar",
Jose Carlos Garcia Sogoced8fec2006-11-14 05:01:47 -03001998 { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03001999 { NULL },
2000 },
2001 { "Compro Videomate U500",
Patrick Boettcher1f8ca4b2007-07-30 14:24:37 -03002002 { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002003 { NULL },
Henning Schroeer0ce215e2006-10-19 07:58:22 -03002004 },
2005 { "Uniwill STK7700P based (Hama and others)",
2006 { &dib0700_usb_id_table[7], NULL },
2007 { NULL },
Michael Krufky8637a872006-11-08 16:47:32 -03002008 },
2009 { "Leadtek Winfast DTV Dongle (STK7700P based)",
Patrick Boettcher1e13c8f2009-09-19 05:24:40 -03002010 { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
Michael Krufky8637a872006-11-08 16:47:32 -03002011 { NULL },
Joachim Steigerfa3b8772007-10-08 20:08:46 -03002012 },
2013 { "AVerMedia AVerTV DVB-T Express",
2014 { &dib0700_usb_id_table[20] },
2015 { NULL },
dominik67053a42007-11-10 19:23:31 -03002016 },
dominik67053a42007-11-10 19:23:31 -03002017 { "Gigabyte U7000",
2018 { &dib0700_usb_id_table[21], NULL },
2019 { NULL },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002020 }
Darren Saltb1139e32007-08-18 18:05:31 -03002021 },
2022
2023 .rc_interval = DEFAULT_RC_INTERVAL,
2024 .rc_key_map = dib0700_rc_keys,
2025 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2026 .rc_query = dib0700_rc_query
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002027 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2028
2029 .num_adapters = 2,
2030 .adapter = {
2031 {
2032 .frontend_attach = bristol_frontend_attach,
2033 .tuner_attach = bristol_tuner_attach,
2034
2035 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2036 }, {
2037 .frontend_attach = bristol_frontend_attach,
2038 .tuner_attach = bristol_tuner_attach,
2039
2040 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2041 }
2042 },
2043
2044 .num_device_descs = 1,
2045 .devices = {
2046 { "Hauppauge Nova-T 500 Dual DVB-T",
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002047 { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002048 { NULL },
2049 },
Janne Grunau82f3d552007-07-30 13:50:28 -03002050 },
2051
2052 .rc_interval = DEFAULT_RC_INTERVAL,
2053 .rc_key_map = dib0700_rc_keys,
Patrick Boettcher87797372007-07-30 17:02:17 -03002054 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
Janne Grunau82f3d552007-07-30 13:50:28 -03002055 .rc_query = dib0700_rc_query
Olivier DANET54d75eb2007-07-25 14:42:54 -03002056 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2057
2058 .num_adapters = 2,
2059 .adapter = {
2060 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002061 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2062 .pid_filter_count = 32,
2063 .pid_filter = stk70x0p_pid_filter,
2064 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier DANET54d75eb2007-07-25 14:42:54 -03002065 .frontend_attach = stk7700d_frontend_attach,
2066 .tuner_attach = stk7700d_tuner_attach,
2067
2068 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2069 }, {
Olivier Grenief8731f42009-09-18 04:08:43 -03002070 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2071 .pid_filter_count = 32,
2072 .pid_filter = stk70x0p_pid_filter,
2073 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier DANET54d75eb2007-07-25 14:42:54 -03002074 .frontend_attach = stk7700d_frontend_attach,
2075 .tuner_attach = stk7700d_tuner_attach,
2076
2077 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2078 }
2079 },
2080
James A Webb200e8612009-08-04 02:38:05 -03002081 .num_device_descs = 5,
Olivier DANET54d75eb2007-07-25 14:42:54 -03002082 .devices = {
2083 { "Pinnacle PCTV 2000e",
2084 { &dib0700_usb_id_table[11], NULL },
2085 { NULL },
2086 },
2087 { "Terratec Cinergy DT XS Diversity",
2088 { &dib0700_usb_id_table[12], NULL },
2089 { NULL },
2090 },
Darren Saltfaebb912007-08-18 18:04:00 -03002091 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
Olivier DANET54d75eb2007-07-25 14:42:54 -03002092 { &dib0700_usb_id_table[13], NULL },
2093 { NULL },
2094 },
Patrick Boettcher01373a52007-07-30 12:49:04 -03002095 { "DiBcom STK7700D reference design",
Patrick Boettcherb6884a12007-07-27 10:08:51 -03002096 { &dib0700_usb_id_table[14], NULL },
2097 { NULL },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03002098 },
James A Webb200e8612009-08-04 02:38:05 -03002099 { "YUAN High-Tech DiBcom STK7700D",
2100 { &dib0700_usb_id_table[55], NULL },
2101 { NULL },
2102 },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03002103
Olivier DANET54d75eb2007-07-25 14:42:54 -03002104 },
Janne Grunau82f3d552007-07-30 13:50:28 -03002105
Olivier DANET54d75eb2007-07-25 14:42:54 -03002106 .rc_interval = DEFAULT_RC_INTERVAL,
Janne Grunau82f3d552007-07-30 13:50:28 -03002107 .rc_key_map = dib0700_rc_keys,
Patrick Boettcher87797372007-07-30 17:02:17 -03002108 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
Janne Grunau82f3d552007-07-30 13:50:28 -03002109 .rc_query = dib0700_rc_query
Patrick Boettcher01373a52007-07-30 12:49:04 -03002110
2111 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2112
2113 .num_adapters = 1,
2114 .adapter = {
2115 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002116 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2117 .pid_filter_count = 32,
2118 .pid_filter = stk70x0p_pid_filter,
2119 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03002120 .frontend_attach = stk7700P2_frontend_attach,
2121 .tuner_attach = stk7700d_tuner_attach,
2122
2123 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2124 },
2125 },
2126
Yusuf Altinbb1b0822009-01-08 07:58:45 -03002127 .num_device_descs = 3,
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03002128 .devices = {
2129 { "ASUS My Cinema U3000 Mini DVBT Tuner",
2130 { &dib0700_usb_id_table[23], NULL },
2131 { NULL },
2132 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002133 { "Yuan EC372S",
2134 { &dib0700_usb_id_table[31], NULL },
2135 { NULL },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03002136 },
2137 { "Terratec Cinergy T Express",
2138 { &dib0700_usb_id_table[42], NULL },
2139 { NULL },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002140 }
Chris Rankin48aa7392008-09-25 06:52:24 -03002141 },
2142
2143 .rc_interval = DEFAULT_RC_INTERVAL,
2144 .rc_key_map = dib0700_rc_keys,
2145 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2146 .rc_query = dib0700_rc_query
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03002147 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2148
2149 .num_adapters = 1,
2150 .adapter = {
2151 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002152 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2153 .pid_filter_count = 32,
2154 .pid_filter = stk70x0p_pid_filter,
2155 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Patrick Boettcher01373a52007-07-30 12:49:04 -03002156 .frontend_attach = stk7070p_frontend_attach,
2157 .tuner_attach = dib7070p_tuner_attach,
2158
2159 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2160
2161 .size_of_priv = sizeof(struct dib0700_adapter_state),
2162 },
2163 },
2164
Patrick Boettcher1e13c8f2009-09-19 05:24:40 -03002165 .num_device_descs = 11,
Patrick Boettcher01373a52007-07-30 12:49:04 -03002166 .devices = {
2167 { "DiBcom STK7070P reference design",
2168 { &dib0700_usb_id_table[15], NULL },
2169 { NULL },
2170 },
2171 { "Pinnacle PCTV DVB-T Flash Stick",
2172 { &dib0700_usb_id_table[16], NULL },
2173 { NULL },
2174 },
Yousef Lamlum7999a812008-01-25 05:51:48 -03002175 { "Artec T14BR DVB-T",
2176 { &dib0700_usb_id_table[22], NULL },
2177 { NULL },
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03002178 },
2179 { "ASUS My Cinema U3100 Mini DVBT Tuner",
2180 { &dib0700_usb_id_table[24], NULL },
2181 { NULL },
2182 },
Tim Taubertc7637b12008-01-25 06:16:36 -03002183 { "Hauppauge Nova-T Stick",
2184 { &dib0700_usb_id_table[25], NULL },
2185 { NULL },
2186 },
Darren Salt13b83b52008-01-25 06:20:02 -03002187 { "Hauppauge Nova-T MyTV.t",
2188 { &dib0700_usb_id_table[26], NULL },
2189 { NULL },
2190 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002191 { "Pinnacle PCTV 72e",
2192 { &dib0700_usb_id_table[29], NULL },
2193 { NULL },
2194 },
2195 { "Pinnacle PCTV 73e",
2196 { &dib0700_usb_id_table[30], NULL },
2197 { NULL },
2198 },
Klaus Flittner919a5482009-03-29 09:12:06 -03002199 { "Elgato EyeTV DTT",
2200 { &dib0700_usb_id_table[49], NULL },
2201 { NULL },
2202 },
Pascal Terjan9abb6e62009-02-26 10:31:41 -03002203 { "Yuan PD378S",
2204 { &dib0700_usb_id_table[45], NULL },
2205 { NULL },
2206 },
Armin Schenker513846e2009-04-20 11:57:49 -03002207 { "Elgato EyeTV Dtt Dlx PD378S",
2208 { &dib0700_usb_id_table[50], NULL },
2209 { NULL },
2210 },
Tim Taubertc7637b12008-01-25 06:16:36 -03002211 },
2212
2213 .rc_interval = DEFAULT_RC_INTERVAL,
2214 .rc_key_map = dib0700_rc_keys,
2215 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2216 .rc_query = dib0700_rc_query
2217
Patrick Boettcher01373a52007-07-30 12:49:04 -03002218 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2219
Olivier Grenie74b76f22009-09-02 08:19:19 -03002220 .num_adapters = 1,
2221 .adapter = {
2222 {
Mauro Carvalho Chehab648732f2009-11-04 12:11:43 -02002223 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2224 .pid_filter_count = 32,
2225 .pid_filter = stk70x0p_pid_filter,
2226 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier Grenie74b76f22009-09-02 08:19:19 -03002227 .frontend_attach = stk7070p_frontend_attach,
2228 .tuner_attach = dib7070p_tuner_attach,
2229
2230 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2231
2232 .size_of_priv = sizeof(struct dib0700_adapter_state),
2233 },
2234 },
2235
Patrick Boettcher20232c42009-12-01 12:08:56 -03002236 .num_device_descs = 3,
Olivier Grenie74b76f22009-09-02 08:19:19 -03002237 .devices = {
2238 { "Pinnacle PCTV 73A",
2239 { &dib0700_usb_id_table[56], NULL },
2240 { NULL },
2241 },
2242 { "Pinnacle PCTV 73e SE",
Patrick Boettcher20232c42009-12-01 12:08:56 -03002243 { &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL },
Olivier Grenie74b76f22009-09-02 08:19:19 -03002244 { NULL },
2245 },
2246 { "Pinnacle PCTV 282e",
Patrick Boettcher20232c42009-12-01 12:08:56 -03002247 { &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL },
Olivier Grenie74b76f22009-09-02 08:19:19 -03002248 { NULL },
2249 },
2250 },
2251
2252 .rc_interval = DEFAULT_RC_INTERVAL,
2253 .rc_key_map = dib0700_rc_keys,
2254 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2255 .rc_query = dib0700_rc_query
2256
2257 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2258
Patrick Boettcher01373a52007-07-30 12:49:04 -03002259 .num_adapters = 2,
2260 .adapter = {
2261 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002262 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2263 .pid_filter_count = 32,
2264 .pid_filter = stk70x0p_pid_filter,
2265 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Patrick Boettcher01373a52007-07-30 12:49:04 -03002266 .frontend_attach = stk7070pd_frontend_attach0,
2267 .tuner_attach = dib7070p_tuner_attach,
2268
2269 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2270
2271 .size_of_priv = sizeof(struct dib0700_adapter_state),
2272 }, {
Olivier Grenief8731f42009-09-18 04:08:43 -03002273 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2274 .pid_filter_count = 32,
2275 .pid_filter = stk70x0p_pid_filter,
2276 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Patrick Boettcher01373a52007-07-30 12:49:04 -03002277 .frontend_attach = stk7070pd_frontend_attach1,
2278 .tuner_attach = dib7070p_tuner_attach,
2279
2280 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2281
2282 .size_of_priv = sizeof(struct dib0700_adapter_state),
2283 }
2284 },
2285
sebastian.blanes@gmail.com0a6e1ed2009-02-24 14:51:43 -03002286 .num_device_descs = 6,
Patrick Boettcher01373a52007-07-30 12:49:04 -03002287 .devices = {
2288 { "DiBcom STK7070PD reference design",
2289 { &dib0700_usb_id_table[17], NULL },
2290 { NULL },
2291 },
2292 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
2293 { &dib0700_usb_id_table[18], NULL },
2294 { NULL },
Michael Krufkyd01eb2d2008-07-03 23:43:36 -03002295 },
2296 { "Hauppauge Nova-TD Stick (52009)",
2297 { &dib0700_usb_id_table[35], NULL },
2298 { NULL },
Michael Krufky9a0c04a2008-09-03 17:12:24 -03002299 },
2300 { "Hauppauge Nova-TD-500 (84xxx)",
2301 { &dib0700_usb_id_table[36], NULL },
2302 { NULL },
Nicolas Fournierdb4b2d12009-01-13 07:15:25 -03002303 },
Patrick Boettchera9b8fe32009-05-20 05:35:02 -03002304 { "Terratec Cinergy DT USB XS Diversity/ T5",
2305 { &dib0700_usb_id_table[43],
2306 &dib0700_usb_id_table[53], NULL},
Nicolas Fournierdb4b2d12009-01-13 07:15:25 -03002307 { NULL },
sebastian.blanes@gmail.com0a6e1ed2009-02-24 14:51:43 -03002308 },
2309 { "Sony PlayTV",
2310 { &dib0700_usb_id_table[44], NULL },
2311 { NULL },
dominik67053a42007-11-10 19:23:31 -03002312 }
Arne Luehrsc985a8d2009-01-21 01:37:20 -03002313 },
2314 .rc_interval = DEFAULT_RC_INTERVAL,
2315 .rc_key_map = dib0700_rc_keys,
2316 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2317 .rc_query = dib0700_rc_query
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002318 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2319
2320 .num_adapters = 1,
2321 .adapter = {
2322 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002323 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2324 .pid_filter_count = 32,
2325 .pid_filter = stk70x0p_pid_filter,
2326 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002327 .frontend_attach = stk7700ph_frontend_attach,
2328 .tuner_attach = stk7700ph_tuner_attach,
2329
2330 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2331
2332 .size_of_priv = sizeof(struct
2333 dib0700_adapter_state),
2334 },
2335 },
2336
Pete Hildebrandtc53d83c2009-08-05 11:46:38 -03002337 .num_device_descs = 9,
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002338 .devices = {
2339 { "Terratec Cinergy HT USB XE",
2340 { &dib0700_usb_id_table[27], NULL },
2341 { NULL },
2342 },
2343 { "Pinnacle Expresscard 320cx",
2344 { &dib0700_usb_id_table[28], NULL },
2345 { NULL },
2346 },
2347 { "Terratec Cinergy HT Express",
2348 { &dib0700_usb_id_table[32], NULL },
2349 { NULL },
2350 },
Finn Thain17a370b2008-09-06 13:42:47 -03002351 { "Gigabyte U8000-RH",
2352 { &dib0700_usb_id_table[37], NULL },
2353 { NULL },
2354 },
Daniel Oliveira Nascimento8751aaa2008-09-07 12:39:44 -03002355 { "YUAN High-Tech STK7700PH",
2356 { &dib0700_usb_id_table[38], NULL },
2357 { NULL },
2358 },
Albert Comerma57697432008-09-07 12:43:33 -03002359 { "Asus My Cinema-U3000Hybrid",
2360 { &dib0700_usb_id_table[39], NULL },
2361 { NULL },
2362 },
Xoan Loureiro16ba1ee2009-03-29 08:43:36 -03002363 { "YUAN High-Tech MC770",
2364 { &dib0700_usb_id_table[48], NULL },
2365 { NULL },
2366 },
tomas petrf0f4ae72009-05-20 05:28:05 -03002367 { "Leadtek WinFast DTV Dongle H",
2368 { &dib0700_usb_id_table[51], NULL },
2369 { NULL },
2370 },
Pete Hildebrandtc53d83c2009-08-05 11:46:38 -03002371 { "YUAN High-Tech STK7700D",
2372 { &dib0700_usb_id_table[54], NULL },
2373 { NULL },
2374 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002375 },
2376 .rc_interval = DEFAULT_RC_INTERVAL,
2377 .rc_key_map = dib0700_rc_keys,
2378 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2379 .rc_query = dib0700_rc_query
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002380 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2381 .num_adapters = 1,
2382 .adapter = {
2383 {
2384 .frontend_attach = s5h1411_frontend_attach,
2385 .tuner_attach = xc5000_tuner_attach,
2386
2387 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2388
2389 .size_of_priv = sizeof(struct
2390 dib0700_adapter_state),
2391 },
2392 },
2393
Devin Heitmuellerd2fc3bf2008-09-25 06:22:23 -03002394 .num_device_descs = 2,
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002395 .devices = {
2396 { "Pinnacle PCTV HD Pro USB Stick",
2397 { &dib0700_usb_id_table[40], NULL },
2398 { NULL },
2399 },
Devin Heitmuellerd2fc3bf2008-09-25 06:22:23 -03002400 { "Pinnacle PCTV HD USB Stick",
2401 { &dib0700_usb_id_table[41], NULL },
2402 { NULL },
2403 },
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002404 },
2405 .rc_interval = DEFAULT_RC_INTERVAL,
2406 .rc_key_map = dib0700_rc_keys,
2407 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2408 .rc_query = dib0700_rc_query
Michael Krufkyce904bc2009-01-19 01:12:55 -03002409 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2410 .num_adapters = 1,
2411 .adapter = {
2412 {
2413 .frontend_attach = lgdt3305_frontend_attach,
2414 .tuner_attach = mxl5007t_tuner_attach,
2415
2416 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2417
2418 .size_of_priv = sizeof(struct
2419 dib0700_adapter_state),
2420 },
2421 },
2422
2423 .num_device_descs = 2,
2424 .devices = {
2425 { "Hauppauge ATSC MiniCard (B200)",
2426 { &dib0700_usb_id_table[46], NULL },
2427 { NULL },
2428 },
2429 { "Hauppauge ATSC MiniCard (B210)",
2430 { &dib0700_usb_id_table[47], NULL },
2431 { NULL },
2432 },
2433 },
Olivier Grenied300bd62009-09-15 06:55:35 -03002434 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2435
2436 .num_adapters = 1,
2437 .adapter = {
2438 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002439 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2440 .pid_filter_count = 32,
2441 .pid_filter = stk70x0p_pid_filter,
2442 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier Grenied300bd62009-09-15 06:55:35 -03002443 .frontend_attach = stk7070p_frontend_attach,
2444 .tuner_attach = dib7770p_tuner_attach,
2445
2446 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2447
2448 .size_of_priv =
Patrick Boettcherdb481382009-09-15 07:16:51 -03002449 sizeof(struct dib0700_adapter_state),
Olivier Grenied300bd62009-09-15 06:55:35 -03002450 },
2451 },
2452
Patrick Boettcherdb481382009-09-15 07:16:51 -03002453 .num_device_descs = 2,
Olivier Grenied300bd62009-09-15 06:55:35 -03002454 .devices = {
2455 { "DiBcom STK7770P reference design",
2456 { &dib0700_usb_id_table[59], NULL },
2457 { NULL },
2458 },
Patrick Boettcher1e13c8f2009-09-19 05:24:40 -03002459 { "Terratec Cinergy T USB XXS (HD)/ T3",
2460 { &dib0700_usb_id_table[33],
2461 &dib0700_usb_id_table[52],
2462 &dib0700_usb_id_table[60], NULL},
Patrick Boettcherdb481382009-09-15 07:16:51 -03002463 { NULL },
2464 },
Olivier Grenied300bd62009-09-15 06:55:35 -03002465 },
Olivier Grenied300bd62009-09-15 06:55:35 -03002466 .rc_interval = DEFAULT_RC_INTERVAL,
2467 .rc_key_map = dib0700_rc_keys,
2468 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2469 .rc_query = dib0700_rc_query
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002470 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2471 .num_adapters = 1,
2472 .adapter = {
2473 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002474 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2475 .pid_filter_count = 32,
2476 .pid_filter = stk807x_pid_filter,
2477 .pid_filter_ctrl = stk807x_pid_filter_ctrl,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002478 .frontend_attach = stk807x_frontend_attach,
2479 .tuner_attach = dib807x_tuner_attach,
2480
2481 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2482
2483 .size_of_priv =
2484 sizeof(struct dib0700_adapter_state),
2485 },
2486 },
2487
S?rgio Fortier8a378e82009-09-28 04:19:21 -03002488 .num_device_descs = 3,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002489 .devices = {
2490 { "DiBcom STK807xP reference design",
2491 { &dib0700_usb_id_table[62], NULL },
2492 { NULL },
2493 },
Mauro Carvalho Chehabaaeab302009-09-16 09:18:26 -03002494 { "Prolink Pixelview SBTVD",
2495 { &dib0700_usb_id_table[63], NULL },
2496 { NULL },
2497 },
S?rgio Fortier8a378e82009-09-28 04:19:21 -03002498 { "EvolutePC TVWay+",
2499 { &dib0700_usb_id_table[64], NULL },
2500 { NULL },
2501 },
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002502 },
2503
2504 .rc_interval = DEFAULT_RC_INTERVAL,
2505 .rc_key_map = dib0700_rc_keys,
2506 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2507 .rc_query = dib0700_rc_query
2508
2509 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2510 .num_adapters = 2,
2511 .adapter = {
2512 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002513 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2514 .pid_filter_count = 32,
2515 .pid_filter = stk807x_pid_filter,
2516 .pid_filter_ctrl = stk807x_pid_filter_ctrl,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002517 .frontend_attach = stk807xpvr_frontend_attach0,
2518 .tuner_attach = dib807x_tuner_attach,
2519
2520 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2521
2522 .size_of_priv =
2523 sizeof(struct dib0700_adapter_state),
2524 },
2525 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002526 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2527 .pid_filter_count = 32,
2528 .pid_filter = stk807x_pid_filter,
2529 .pid_filter_ctrl = stk807x_pid_filter_ctrl,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002530 .frontend_attach = stk807xpvr_frontend_attach1,
2531 .tuner_attach = dib807x_tuner_attach,
2532
2533 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2534
2535 .size_of_priv =
2536 sizeof(struct dib0700_adapter_state),
2537 },
2538 },
2539
2540 .num_device_descs = 1,
2541 .devices = {
2542 { "DiBcom STK807xPVR reference design",
2543 { &dib0700_usb_id_table[61], NULL },
2544 { NULL },
2545 },
2546 },
2547
2548 .rc_interval = DEFAULT_RC_INTERVAL,
2549 .rc_key_map = dib0700_rc_keys,
2550 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2551 .rc_query = dib0700_rc_query
Patrick Boettcher01373a52007-07-30 12:49:04 -03002552 },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002553};
2554
2555int dib0700_device_count = ARRAY_SIZE(dib0700_devices);