blob: 34eab05afc6cd08d83d74468f7614b9a5f2a3468 [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"
Olivier Grenie03245a52009-12-04 13:27:57 -030021#include "dib0090.h"
Michael Krufkyce904bc2009-01-19 01:12:55 -030022#include "lgdt3305.h"
23#include "mxl5007t.h"
Patrick Boettcherb7f54912006-09-19 12:51:37 -030024
Patrick Boettcher7fb3fc02006-09-20 04:37:18 -030025static int force_lna_activation;
26module_param(force_lna_activation, int, 0644);
27MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), "
28 "if applicable for the device (default: 0=automatic/off).");
29
Patrick Boettcher01373a52007-07-30 12:49:04 -030030struct dib0700_adapter_state {
31 int (*set_param_save) (struct dvb_frontend *, struct dvb_frontend_parameters *);
32};
33
34/* Hauppauge Nova-T 500 (aka Bristol)
Patrick Boettcherb7f54912006-09-19 12:51:37 -030035 * has a LNA on GPIO0 which is enabled by setting 1 */
36static struct mt2060_config bristol_mt2060_config[2] = {
37 {
38 .i2c_address = 0x60,
Patrick Boettcher303cbea2006-09-19 12:51:56 -030039 .clock_out = 3,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030040 }, {
41 .i2c_address = 0x61,
42 }
43};
44
Devin Heitmueller99afb982008-11-15 07:13:07 -030045
Patrick Boettcherb7f54912006-09-19 12:51:37 -030046static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
47 .band_caps = BAND_VHF | BAND_UHF,
Patrick Boettcher01b4bf32006-09-19 12:51:53 -030048 .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
Patrick Boettcherb7f54912006-09-19 12:51:37 -030049
Patrick Boettcher6958eff2006-09-19 12:51:40 -030050 .agc1_max = 42598,
51 .agc1_min = 17694,
52 .agc2_max = 45875,
53 .agc2_min = 0,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030054
Patrick Boettcher6958eff2006-09-19 12:51:40 -030055 .agc1_pt1 = 0,
56 .agc1_pt2 = 59,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030057
Patrick Boettcher6958eff2006-09-19 12:51:40 -030058 .agc1_slope1 = 0,
59 .agc1_slope2 = 69,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030060
61 .agc2_pt1 = 0,
Patrick Boettcher6958eff2006-09-19 12:51:40 -030062 .agc2_pt2 = 59,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030063
Patrick Boettcher6958eff2006-09-19 12:51:40 -030064 .agc2_slope1 = 111,
65 .agc2_slope2 = 28,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030066};
67
68static struct dib3000mc_config bristol_dib3000mc_config[2] = {
69 { .agc = &bristol_dib3000p_mt2060_agc_config,
70 .max_time = 0x196,
71 .ln_adc_level = 0x1cc7,
72 .output_mpeg2_in_188_bytes = 1,
73 },
74 { .agc = &bristol_dib3000p_mt2060_agc_config,
75 .max_time = 0x196,
76 .ln_adc_level = 0x1cc7,
77 .output_mpeg2_in_188_bytes = 1,
78 }
79};
80
81static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
82{
Patrick Boettcher6958eff2006-09-19 12:51:40 -030083 struct dib0700_state *st = adap->dev->priv;
Patrick Boettcherb7f54912006-09-19 12:51:37 -030084 if (adap->id == 0) {
85 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
86 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
87 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
88 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
89
Patrick Boettcher7fb3fc02006-09-20 04:37:18 -030090 if (force_lna_activation)
91 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
92 else
93 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
Patrick Boettcher6958eff2006-09-19 12:51:40 -030094
Patrick Boettcherb7f54912006-09-19 12:51:37 -030095 if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {
96 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
97 return -ENODEV;
98 }
99 }
Patrick Boettcher6958eff2006-09-19 12:51:40 -0300100 st->mt2060_if1[adap->id] = 1220;
101 return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
102 (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300103}
104
Patrick Boettcher4a2b1082008-01-25 07:32:58 -0300105static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval)
Olivier DANETc52344f2008-01-25 06:50:07 -0300106{
107 struct i2c_msg msg[2] = {
108 { .addr = 0x50, .flags = 0, .buf = &adrs, .len = 1 },
109 { .addr = 0x50, .flags = I2C_M_RD, .buf = pval, .len = 1 },
110 };
111 if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO;
112 return 0;
113}
114
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300115static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
116{
Olivier DANETc52344f2008-01-25 06:50:07 -0300117 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300118 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
Olivier DANETc52344f2008-01-25 06:50:07 -0300119 s8 a;
120 int if1=1220;
Al Viroda5ee482008-05-21 00:31:21 -0300121 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
122 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) {
Olivier DANETc52344f2008-01-25 06:50:07 -0300123 if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;
124 }
125 return dvb_attach(mt2060_attach,adap->fe, tun_i2c,&bristol_mt2060_config[adap->id],
126 if1) == NULL ? -ENODEV : 0;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300127}
128
Patrick Boettcher01373a52007-07-30 12:49:04 -0300129/* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
Olivier DANET54d75eb2007-07-25 14:42:54 -0300130
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300131/* MT226x */
132static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = {
133 {
Olivier Grenie9c783032009-12-07 07:49:40 -0300134 BAND_UHF,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300135
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300136 /* 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,
137 * 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 */
Olivier Grenie9c783032009-12-07 07:49:40 -0300138 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
139 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
Olivier DANET54d75eb2007-07-25 14:42:54 -0300140
Olivier Grenie9c783032009-12-07 07:49:40 -0300141 1130,
142 21,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300143
Olivier Grenie9c783032009-12-07 07:49:40 -0300144 0,
145 118,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300146
Olivier Grenie9c783032009-12-07 07:49:40 -0300147 0,
148 3530,
149 1,
150 0,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300151
Olivier Grenie9c783032009-12-07 07:49:40 -0300152 65535,
153 33770,
154 65535,
155 23592,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300156
Olivier Grenie9c783032009-12-07 07:49:40 -0300157 0,
158 62,
159 255,
160 64,
161 64,
162 132,
163 192,
164 80,
165 80,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300166
Olivier Grenie9c783032009-12-07 07:49:40 -0300167 17,
168 27,
169 23,
170 51,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300171
Olivier Grenie9c783032009-12-07 07:49:40 -0300172 1,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300173 }, {
Olivier Grenie9c783032009-12-07 07:49:40 -0300174 BAND_VHF | BAND_LBAND,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300175
176 /* 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,
177 * 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 */
Olivier Grenie9c783032009-12-07 07:49:40 -0300178 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
179 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300180
Olivier Grenie9c783032009-12-07 07:49:40 -0300181 2372,
182 21,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300183
Olivier Grenie9c783032009-12-07 07:49:40 -0300184 0,
185 118,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300186
Olivier Grenie9c783032009-12-07 07:49:40 -0300187 0,
188 3530,
189 1,
190 0,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300191
Olivier Grenie9c783032009-12-07 07:49:40 -0300192 65535,
193 0,
194 65535,
195 23592,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300196
Olivier Grenie9c783032009-12-07 07:49:40 -0300197 0,
198 128,
199 128,
200 128,
201 0,
202 128,
203 253,
204 81,
205 0,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300206
Olivier Grenie9c783032009-12-07 07:49:40 -0300207 17,
208 27,
209 23,
210 51,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300211
Olivier Grenie9c783032009-12-07 07:49:40 -0300212 1,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300213 }
Olivier DANET54d75eb2007-07-25 14:42:54 -0300214};
215
216static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = {
Olivier Grenie9c783032009-12-07 07:49:40 -0300217 60000, 30000,
218 1, 8, 3, 1, 0,
219 0, 0, 1, 1, 2,
220 (3 << 14) | (1 << 12) | (524 << 0),
221 0,
222 20452225,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300223};
224
225static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {
226 { .output_mpeg2_in_188_bytes = 1,
227 .hostbus_diversity = 1,
228 .tuner_is_baseband = 1,
229
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300230 .agc_config_count = 2,
231 .agc = stk7700d_7000p_mt2266_agc_config,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300232 .bw = &stk7700d_mt2266_pll_config,
233
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300234 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
235 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
236 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300237 },
238 { .output_mpeg2_in_188_bytes = 1,
239 .hostbus_diversity = 1,
240 .tuner_is_baseband = 1,
241
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300242 .agc_config_count = 2,
243 .agc = stk7700d_7000p_mt2266_agc_config,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300244 .bw = &stk7700d_mt2266_pll_config,
245
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300246 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
247 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
248 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300249 }
250};
251
252static struct mt2266_config stk7700d_mt2266_config[2] = {
253 { .i2c_address = 0x60
254 },
255 { .i2c_address = 0x60
256 }
257};
258
Daniel Gimpelevich132c3182008-01-25 06:02:42 -0300259static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap)
260{
261 if (adap->id == 0) {
262 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
263 msleep(10);
264 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
265 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
266 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
267 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
268 msleep(10);
269 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
270 msleep(10);
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -0300271 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
272 stk7700d_dib7000p_mt2266_config)
273 != 0) {
274 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
275 return -ENODEV;
276 }
Daniel Gimpelevich132c3182008-01-25 06:02:42 -0300277 }
278
279 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
280 &stk7700d_dib7000p_mt2266_config[adap->id]);
281
282 return adap->fe == NULL ? -ENODEV : 0;
283}
284
Olivier DANET54d75eb2007-07-25 14:42:54 -0300285static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap)
286{
287 if (adap->id == 0) {
288 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
289 msleep(10);
290 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
291 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
292 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
293 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
294 msleep(10);
295 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
296 msleep(10);
297 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -0300298 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
299 stk7700d_dib7000p_mt2266_config)
300 != 0) {
301 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
302 return -ENODEV;
303 }
Olivier DANET54d75eb2007-07-25 14:42:54 -0300304 }
305
306 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
307 &stk7700d_dib7000p_mt2266_config[adap->id]);
308
309 return adap->fe == NULL ? -ENODEV : 0;
310}
311
312static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap)
313{
314 struct i2c_adapter *tun_i2c;
315 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
316 return dvb_attach(mt2266_attach, adap->fe, tun_i2c,
Joe Perches1ebcad72009-07-02 15:57:09 -0300317 &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300318}
319
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300320/* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
Harvey Harrisonb1721d02008-04-25 19:03:08 -0700321static struct dibx000_agc_config xc3028_agc_config = {
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300322 BAND_VHF | BAND_UHF, /* band_caps */
323
324 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
325 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
326 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
327 (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
328 (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */
329
330 712, /* inv_gain */
331 21, /* time_stabiliz */
332
333 0, /* alpha_level */
334 118, /* thlock */
335
336 0, /* wbd_inv */
337 2867, /* wbd_ref */
338 0, /* wbd_sel */
339 2, /* wbd_alpha */
340
341 0, /* agc1_max */
342 0, /* agc1_min */
343 39718, /* agc2_max */
344 9930, /* agc2_min */
345 0, /* agc1_pt1 */
346 0, /* agc1_pt2 */
347 0, /* agc1_pt3 */
348 0, /* agc1_slope1 */
349 0, /* agc1_slope2 */
350 0, /* agc2_pt1 */
351 128, /* agc2_pt2 */
352 29, /* agc2_slope1 */
353 29, /* agc2_slope2 */
354
355 17, /* alpha_mant */
356 27, /* alpha_exp */
357 23, /* beta_mant */
358 51, /* beta_exp */
359
360 1, /* perform_agc_softsplit */
361};
362
363/* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
Harvey Harrisonb1721d02008-04-25 19:03:08 -0700364static struct dibx000_bandwidth_config xc3028_bw_config = {
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300365 60000, 30000, /* internal, sampling */
366 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
367 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc,
368 modulo */
369 (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
370 (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
371 20452225, /* timf */
372 30000000, /* xtal_hz */
373};
374
375static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
376 .output_mpeg2_in_188_bytes = 1,
377 .tuner_is_baseband = 1,
378
379 .agc_config_count = 1,
380 .agc = &xc3028_agc_config,
381 .bw = &xc3028_bw_config,
382
383 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
384 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
385 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
386};
387
Michael Krufkyd7cba042008-09-12 13:31:45 -0300388static int stk7700ph_xc3028_callback(void *ptr, int component,
389 int command, int arg)
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300390{
391 struct dvb_usb_adapter *adap = ptr;
392
393 switch (command) {
394 case XC2028_TUNER_RESET:
395 /* Send the tuner in then out of reset */
396 dib7000p_set_gpio(adap->fe, 8, 0, 0); msleep(10);
397 dib7000p_set_gpio(adap->fe, 8, 0, 1);
398 break;
399 case XC2028_RESET_CLK:
400 break;
401 default:
402 err("%s: unknown command %d, arg %d\n", __func__,
403 command, arg);
404 return -EINVAL;
405 }
406 return 0;
407}
408
409static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
410 .fname = XC2028_DEFAULT_FIRMWARE,
411 .max_len = 64,
412 .demod = XC3028_FE_DIBCOM52,
413};
414
415static struct xc2028_config stk7700ph_xc3028_config = {
416 .i2c_addr = 0x61,
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300417 .ctrl = &stk7700ph_xc3028_ctrl,
418};
419
420static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
421{
422 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;
423
Al Viroda5ee482008-05-21 00:31:21 -0300424 if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
425 desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300426 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
427 else
428 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
429 msleep(20);
430 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
431 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
432 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
433 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
434 msleep(10);
435 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
436 msleep(20);
437 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
438 msleep(10);
439
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -0300440 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
441 &stk7700ph_dib7700_xc3028_config) != 0) {
442 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
443 __func__);
444 return -ENODEV;
445 }
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300446
447 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
448 &stk7700ph_dib7700_xc3028_config);
449
450 return adap->fe == NULL ? -ENODEV : 0;
451}
452
453static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
454{
455 struct i2c_adapter *tun_i2c;
456
457 tun_i2c = dib7000p_get_i2c_master(adap->fe,
458 DIBX000_I2C_INTERFACE_TUNER, 1);
459
460 stk7700ph_xc3028_config.i2c_adap = tun_i2c;
Michael Krufkyd7cba042008-09-12 13:31:45 -0300461
462 /* FIXME: generalize & move to common area */
463 adap->fe->callback = stk7700ph_xc3028_callback;
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300464
465 return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config)
466 == NULL ? -ENODEV : 0;
467}
468
Devin Heitmueller4b330be2008-12-01 06:51:14 -0300469#define DEFAULT_RC_INTERVAL 50
Olivier DANET54d75eb2007-07-25 14:42:54 -0300470
471static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
472
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300473/* Number of keypresses to ignore before start repeating */
Devin Heitmueller4b330be2008-12-01 06:51:14 -0300474#define RC_REPEAT_DELAY 6
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300475
Devin Heitmueller6a207102010-01-04 02:43:19 -0300476static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
Olivier DANET54d75eb2007-07-25 14:42:54 -0300477{
478 u8 key[4];
479 int i;
480 struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
481 struct dib0700_state *st = d->priv;
Devin Heitmueller6a207102010-01-04 02:43:19 -0300482
Olivier DANET54d75eb2007-07-25 14:42:54 -0300483 *event = 0;
484 *state = REMOTE_NO_KEY_PRESSED;
Devin Heitmueller6a207102010-01-04 02:43:19 -0300485
486 if (st->fw_version >= 0x10200) {
487 /* For 1.20 firmware , We need to keep the RC polling
488 callback so we can reuse the input device setup in
489 dvb-usb-remote.c. However, the actual work is being done
490 in the bulk URB completion handler. */
491 return 0;
492 }
493
Olivier DANET54d75eb2007-07-25 14:42:54 -0300494 i=dib0700_ctrl_rd(d,rc_request,2,key,4);
495 if (i<=0) {
Janne Grunau034d65e2007-07-31 08:48:40 -0300496 err("RC Query Failed");
Janne Grunau89f42672007-07-31 19:45:13 -0300497 return -1;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300498 }
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300499
500 /* losing half of KEY_0 events from Philipps rc5 remotes.. */
Olivier DANET54d75eb2007-07-25 14:42:54 -0300501 if (key[0]==0 && key[1]==0 && key[2]==0 && key[3]==0) return 0;
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300502
503 /* 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]); */
504
505 dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */
506
507 switch (dvb_usb_dib0700_ir_proto) {
508 case 0: {
509 /* NEC protocol sends repeat code as 0 0 0 FF */
510 if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&
511 (key[3] == 0xFF)) {
512 st->rc_counter++;
513 if (st->rc_counter > RC_REPEAT_DELAY) {
514 *event = d->last_event;
515 *state = REMOTE_KEY_PRESSED;
516 st->rc_counter = RC_REPEAT_DELAY;
517 }
518 return 0;
519 }
Olivier DANET54d75eb2007-07-25 14:42:54 -0300520 for (i=0;i<d->props.rc_key_map_size; i++) {
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -0300521 if (rc5_custom(&keymap[i]) == key[3-2] &&
522 rc5_data(&keymap[i]) == key[3-3]) {
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300523 st->rc_counter = 0;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300524 *event = keymap[i].event;
525 *state = REMOTE_KEY_PRESSED;
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300526 d->last_event = keymap[i].event;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300527 return 0;
528 }
529 }
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300530 break;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300531 }
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300532 default: {
533 /* RC-5 protocol changes toggle bit on new keypress */
534 for (i = 0; i < d->props.rc_key_map_size; i++) {
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -0300535 if (rc5_custom(&keymap[i]) == key[3-2] &&
536 rc5_data(&keymap[i]) == key[3-3]) {
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300537 if (d->last_event == keymap[i].event &&
538 key[3-1] == st->rc_toggle) {
539 st->rc_counter++;
540 /* prevents unwanted double hits */
541 if (st->rc_counter > RC_REPEAT_DELAY) {
542 *event = d->last_event;
543 *state = REMOTE_KEY_PRESSED;
544 st->rc_counter = RC_REPEAT_DELAY;
545 }
546
547 return 0;
548 }
549 st->rc_counter = 0;
550 *event = keymap[i].event;
551 *state = REMOTE_KEY_PRESSED;
552 st->rc_toggle = key[3-1];
553 d->last_event = keymap[i].event;
554 return 0;
555 }
556 }
557 break;
558 }
559 }
560 err("Unknown remote controller key: %2X %2X %2X %2X", (int) key[3-2], (int) key[3-3], (int) key[3-1], (int) key[3]);
561 d->last_event = 0;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300562 return 0;
563}
564
Janne Grunau82f3d552007-07-30 13:50:28 -0300565static struct dvb_usb_rc_key dib0700_rc_keys[] = {
Olivier DANET54d75eb2007-07-25 14:42:54 -0300566 /* Key codes for the tiny Pinnacle remote*/
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -0300567 { 0x0700, KEY_MUTE },
568 { 0x0701, KEY_MENU }, /* Pinnacle logo */
569 { 0x0739, KEY_POWER },
570 { 0x0703, KEY_VOLUMEUP },
571 { 0x0709, KEY_VOLUMEDOWN },
572 { 0x0706, KEY_CHANNELUP },
573 { 0x070c, KEY_CHANNELDOWN },
574 { 0x070f, KEY_1 },
575 { 0x0715, KEY_2 },
576 { 0x0710, KEY_3 },
577 { 0x0718, KEY_4 },
578 { 0x071b, KEY_5 },
579 { 0x071e, KEY_6 },
580 { 0x0711, KEY_7 },
581 { 0x0721, KEY_8 },
582 { 0x0712, KEY_9 },
583 { 0x0727, KEY_0 },
584 { 0x0724, KEY_SCREEN }, /* 'Square' key */
585 { 0x072a, KEY_TEXT }, /* 'T' key */
586 { 0x072d, KEY_REWIND },
587 { 0x0730, KEY_PLAY },
588 { 0x0733, KEY_FASTFORWARD },
589 { 0x0736, KEY_RECORD },
590 { 0x073c, KEY_STOP },
591 { 0x073f, KEY_CANCEL }, /* '?' key */
Olivier DANET54d75eb2007-07-25 14:42:54 -0300592 /* Key codes for the Terratec Cinergy DT XS Diversity, similar to cinergyT2.c */
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -0300593 { 0xeb01, KEY_POWER },
594 { 0xeb02, KEY_1 },
595 { 0xeb03, KEY_2 },
596 { 0xeb04, KEY_3 },
597 { 0xeb05, KEY_4 },
598 { 0xeb06, KEY_5 },
599 { 0xeb07, KEY_6 },
600 { 0xeb08, KEY_7 },
601 { 0xeb09, KEY_8 },
602 { 0xeb0a, KEY_9 },
603 { 0xeb0b, KEY_VIDEO },
604 { 0xeb0c, KEY_0 },
605 { 0xeb0d, KEY_REFRESH },
606 { 0xeb0f, KEY_EPG },
607 { 0xeb10, KEY_UP },
608 { 0xeb11, KEY_LEFT },
609 { 0xeb12, KEY_OK },
610 { 0xeb13, KEY_RIGHT },
611 { 0xeb14, KEY_DOWN },
612 { 0xeb16, KEY_INFO },
613 { 0xeb17, KEY_RED },
614 { 0xeb18, KEY_GREEN },
615 { 0xeb19, KEY_YELLOW },
616 { 0xeb1a, KEY_BLUE },
617 { 0xeb1b, KEY_CHANNELUP },
618 { 0xeb1c, KEY_VOLUMEUP },
619 { 0xeb1d, KEY_MUTE },
620 { 0xeb1e, KEY_VOLUMEDOWN },
621 { 0xeb1f, KEY_CHANNELDOWN },
622 { 0xeb40, KEY_PAUSE },
623 { 0xeb41, KEY_HOME },
624 { 0xeb42, KEY_MENU }, /* DVD Menu */
625 { 0xeb43, KEY_SUBTITLE },
626 { 0xeb44, KEY_TEXT }, /* Teletext */
627 { 0xeb45, KEY_DELETE },
628 { 0xeb46, KEY_TV },
629 { 0xeb47, KEY_DVD },
630 { 0xeb48, KEY_STOP },
631 { 0xeb49, KEY_VIDEO },
632 { 0xeb4a, KEY_AUDIO }, /* Music */
633 { 0xeb4b, KEY_SCREEN }, /* Pic */
634 { 0xeb4c, KEY_PLAY },
635 { 0xeb4d, KEY_BACK },
636 { 0xeb4e, KEY_REWIND },
637 { 0xeb4f, KEY_FASTFORWARD },
638 { 0xeb54, KEY_PREVIOUS },
639 { 0xeb58, KEY_RECORD },
640 { 0xeb5c, KEY_NEXT },
Janne Grunau7161f272007-07-30 13:54:55 -0300641
642 /* 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 -0300643 { 0x1e00, KEY_0 },
644 { 0x1e01, KEY_1 },
645 { 0x1e02, KEY_2 },
646 { 0x1e03, KEY_3 },
647 { 0x1e04, KEY_4 },
648 { 0x1e05, KEY_5 },
649 { 0x1e06, KEY_6 },
650 { 0x1e07, KEY_7 },
651 { 0x1e08, KEY_8 },
652 { 0x1e09, KEY_9 },
653 { 0x1e0a, KEY_KPASTERISK },
654 { 0x1e0b, KEY_RED },
655 { 0x1e0c, KEY_RADIO },
656 { 0x1e0d, KEY_MENU },
657 { 0x1e0e, KEY_GRAVE }, /* # */
658 { 0x1e0f, KEY_MUTE },
659 { 0x1e10, KEY_VOLUMEUP },
660 { 0x1e11, KEY_VOLUMEDOWN },
661 { 0x1e12, KEY_CHANNEL },
662 { 0x1e14, KEY_UP },
663 { 0x1e15, KEY_DOWN },
664 { 0x1e16, KEY_LEFT },
665 { 0x1e17, KEY_RIGHT },
666 { 0x1e18, KEY_VIDEO },
667 { 0x1e19, KEY_AUDIO },
668 { 0x1e1a, KEY_MEDIA },
669 { 0x1e1b, KEY_EPG },
670 { 0x1e1c, KEY_TV },
671 { 0x1e1e, KEY_NEXT },
672 { 0x1e1f, KEY_BACK },
673 { 0x1e20, KEY_CHANNELUP },
674 { 0x1e21, KEY_CHANNELDOWN },
675 { 0x1e24, KEY_LAST }, /* Skip backwards */
676 { 0x1e25, KEY_OK },
677 { 0x1e29, KEY_BLUE},
678 { 0x1e2e, KEY_GREEN },
679 { 0x1e30, KEY_PAUSE },
680 { 0x1e32, KEY_REWIND },
681 { 0x1e34, KEY_FASTFORWARD },
682 { 0x1e35, KEY_PLAY },
683 { 0x1e36, KEY_STOP },
684 { 0x1e37, KEY_RECORD },
685 { 0x1e38, KEY_YELLOW },
686 { 0x1e3b, KEY_GOTO },
687 { 0x1e3d, KEY_POWER },
Jaroslav Barton48e6a012007-11-10 19:17:45 -0300688
689 /* Key codes for the Leadtek Winfast DTV Dongle */
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -0300690 { 0x0042, KEY_POWER },
691 { 0x077c, KEY_TUNER },
692 { 0x0f4e, KEY_PRINT }, /* PREVIEW */
693 { 0x0840, KEY_SCREEN }, /* full screen toggle*/
694 { 0x0f71, KEY_DOT }, /* frequency */
695 { 0x0743, KEY_0 },
696 { 0x0c41, KEY_1 },
697 { 0x0443, KEY_2 },
698 { 0x0b7f, KEY_3 },
699 { 0x0e41, KEY_4 },
700 { 0x0643, KEY_5 },
701 { 0x097f, KEY_6 },
702 { 0x0d7e, KEY_7 },
703 { 0x057c, KEY_8 },
704 { 0x0a40, KEY_9 },
705 { 0x0e4e, KEY_CLEAR },
706 { 0x047c, KEY_CHANNEL }, /* show channel number */
707 { 0x0f41, KEY_LAST }, /* recall */
708 { 0x0342, KEY_MUTE },
709 { 0x064c, KEY_RESERVED }, /* PIP button*/
710 { 0x0172, KEY_SHUFFLE }, /* SNAPSHOT */
711 { 0x0c4e, KEY_PLAYPAUSE }, /* TIMESHIFT */
712 { 0x0b70, KEY_RECORD },
713 { 0x037d, KEY_VOLUMEUP },
714 { 0x017d, KEY_VOLUMEDOWN },
715 { 0x0242, KEY_CHANNELUP },
716 { 0x007d, KEY_CHANNELDOWN },
Chris Rankin48aa7392008-09-25 06:52:24 -0300717
718 /* Key codes for Nova-TD "credit card" remote control. */
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -0300719 { 0x1d00, KEY_0 },
720 { 0x1d01, KEY_1 },
721 { 0x1d02, KEY_2 },
722 { 0x1d03, KEY_3 },
723 { 0x1d04, KEY_4 },
724 { 0x1d05, KEY_5 },
725 { 0x1d06, KEY_6 },
726 { 0x1d07, KEY_7 },
727 { 0x1d08, KEY_8 },
728 { 0x1d09, KEY_9 },
729 { 0x1d0a, KEY_TEXT },
730 { 0x1d0d, KEY_MENU },
731 { 0x1d0f, KEY_MUTE },
732 { 0x1d10, KEY_VOLUMEUP },
733 { 0x1d11, KEY_VOLUMEDOWN },
734 { 0x1d12, KEY_CHANNEL },
735 { 0x1d14, KEY_UP },
736 { 0x1d15, KEY_DOWN },
737 { 0x1d16, KEY_LEFT },
738 { 0x1d17, KEY_RIGHT },
739 { 0x1d1c, KEY_TV },
740 { 0x1d1e, KEY_NEXT },
741 { 0x1d1f, KEY_BACK },
742 { 0x1d20, KEY_CHANNELUP },
743 { 0x1d21, KEY_CHANNELDOWN },
744 { 0x1d24, KEY_LAST },
745 { 0x1d25, KEY_OK },
746 { 0x1d30, KEY_PAUSE },
747 { 0x1d32, KEY_REWIND },
748 { 0x1d34, KEY_FASTFORWARD },
749 { 0x1d35, KEY_PLAY },
750 { 0x1d36, KEY_STOP },
751 { 0x1d37, KEY_RECORD },
752 { 0x1d3b, KEY_GOTO },
753 { 0x1d3d, KEY_POWER },
Mauro Carvalho Chehab4c5128b2009-09-26 13:31:31 -0300754
755 /* Key codes for the Pixelview SBTVD remote (proto NEC) */
756 { 0x8613, KEY_MUTE },
757 { 0x8612, KEY_POWER },
758 { 0x8601, KEY_1 },
759 { 0x8602, KEY_2 },
760 { 0x8603, KEY_3 },
761 { 0x8604, KEY_4 },
762 { 0x8605, KEY_5 },
763 { 0x8606, KEY_6 },
764 { 0x8607, KEY_7 },
765 { 0x8608, KEY_8 },
766 { 0x8609, KEY_9 },
767 { 0x8600, KEY_0 },
768 { 0x860d, KEY_CHANNELUP },
769 { 0x8619, KEY_CHANNELDOWN },
770 { 0x8610, KEY_VOLUMEUP },
771 { 0x860c, KEY_VOLUMEDOWN },
772
773 { 0x860a, KEY_CAMERA },
774 { 0x860b, KEY_ZOOM },
775 { 0x861b, KEY_BACKSPACE },
776 { 0x8615, KEY_ENTER },
777
778 { 0x861d, KEY_UP },
779 { 0x861e, KEY_DOWN },
780 { 0x860e, KEY_LEFT },
781 { 0x860f, KEY_RIGHT },
782
783 { 0x8618, KEY_RECORD },
784 { 0x861a, KEY_STOP },
Sergio C Fortierc86c82b2009-11-04 15:55:09 -0300785
786 /* Key codes for the EvolutePC TVWay+ remote (proto NEC) */
787 { 0x7a00, KEY_MENU },
788 { 0x7a01, KEY_RECORD },
789 { 0x7a02, KEY_PLAY },
790 { 0x7a03, KEY_STOP },
791 { 0x7a10, KEY_CHANNELUP },
792 { 0x7a11, KEY_CHANNELDOWN },
793 { 0x7a12, KEY_VOLUMEUP },
794 { 0x7a13, KEY_VOLUMEDOWN },
795 { 0x7a40, KEY_POWER },
796 { 0x7a41, KEY_MUTE },
Janne Grunau82f3d552007-07-30 13:50:28 -0300797};
Olivier DANET54d75eb2007-07-25 14:42:54 -0300798
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300799/* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
Patrick Boettchera75763f2006-10-18 08:34:16 -0300800static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
Olivier Grenie9c783032009-12-07 07:49:40 -0300801 BAND_UHF | BAND_VHF,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300802
803 /* 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,
804 * 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 */
Olivier Grenie9c783032009-12-07 07:49:40 -0300805 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
806 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300807
Olivier Grenie9c783032009-12-07 07:49:40 -0300808 712,
809 41,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300810
Olivier Grenie9c783032009-12-07 07:49:40 -0300811 0,
812 118,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300813
Olivier Grenie9c783032009-12-07 07:49:40 -0300814 0,
815 4095,
816 0,
817 0,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300818
Olivier Grenie9c783032009-12-07 07:49:40 -0300819 42598,
820 17694,
821 45875,
822 2621,
823 0,
824 76,
825 139,
826 52,
827 59,
828 107,
829 172,
830 57,
831 70,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300832
Olivier Grenie9c783032009-12-07 07:49:40 -0300833 21,
834 25,
835 28,
836 48,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300837
Olivier Grenie9c783032009-12-07 07:49:40 -0300838 1,
839 { 0,
840 107,
841 51800,
842 24700
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300843 },
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300844};
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300845
Patrick Boettchera75763f2006-10-18 08:34:16 -0300846static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
847 BAND_UHF | BAND_VHF,
848
849 /* 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,
850 * 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 */
Olivier Grenie9c783032009-12-07 07:49:40 -0300851 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
852 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
Patrick Boettchera75763f2006-10-18 08:34:16 -0300853
Olivier Grenie9c783032009-12-07 07:49:40 -0300854 712,
855 41,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300856
Olivier Grenie9c783032009-12-07 07:49:40 -0300857 0,
858 118,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300859
Olivier Grenie9c783032009-12-07 07:49:40 -0300860 0,
861 4095,
862 0,
863 0,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300864
Olivier Grenie9c783032009-12-07 07:49:40 -0300865 42598,
866 16384,
867 42598,
868 0,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300869
Olivier Grenie9c783032009-12-07 07:49:40 -0300870 0,
871 137,
872 255,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300873
Olivier Grenie9c783032009-12-07 07:49:40 -0300874 0,
875 255,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300876
Olivier Grenie9c783032009-12-07 07:49:40 -0300877 0,
878 0,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300879
Olivier Grenie9c783032009-12-07 07:49:40 -0300880 0,
881 41,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300882
Olivier Grenie9c783032009-12-07 07:49:40 -0300883 15,
884 25,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300885
Olivier Grenie9c783032009-12-07 07:49:40 -0300886 28,
887 48,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300888
Olivier Grenie9c783032009-12-07 07:49:40 -0300889 0,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300890};
891
892static struct dibx000_bandwidth_config stk7700p_pll_config = {
Olivier Grenie9c783032009-12-07 07:49:40 -0300893 60000, 30000,
894 1, 8, 3, 1, 0,
895 0, 0, 1, 1, 0,
896 (3 << 14) | (1 << 12) | (524 << 0),
897 60258167,
898 20452225,
899 30000000,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300900};
901
902static struct dib7000m_config stk7700p_dib7000m_config = {
903 .dvbt_mode = 1,
904 .output_mpeg2_in_188_bytes = 1,
905 .quartz_direct = 1,
906
907 .agc_config_count = 1,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300908 .agc = &stk7700p_7000m_mt2060_agc_config,
909 .bw = &stk7700p_pll_config,
910
911 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
912 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
913 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
914};
915
916static struct dib7000p_config stk7700p_dib7000p_config = {
917 .output_mpeg2_in_188_bytes = 1,
918
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300919 .agc_config_count = 1,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300920 .agc = &stk7700p_7000p_mt2060_agc_config,
921 .bw = &stk7700p_pll_config,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300922
923 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
924 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
925 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
926};
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300927
928static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
929{
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300930 struct dib0700_state *st = adap->dev->priv;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300931 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
Patrick Boettchera75763f2006-10-18 08:34:16 -0300932
933 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
934 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
935
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300936 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
Patrick Boettchera75763f2006-10-18 08:34:16 -0300937 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
938
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300939 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
Patrick Boettchera75763f2006-10-18 08:34:16 -0300940 dib0700_ctrl_clock(adap->dev, 72, 1);
941 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
942
943 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300944
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300945 st->mt2060_if1[0] = 1220;
Patrick Boettchera75763f2006-10-18 08:34:16 -0300946
947 if (dib7000pc_detection(&adap->dev->i2c_adap)) {
948 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
949 st->is_dib7000pc = 1;
950 } else
951 adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
952
953 return adap->fe == NULL ? -ENODEV : 0;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300954}
955
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300956static struct mt2060_config stk7700p_mt2060_config = {
957 0x60
958};
959
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300960static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
961{
Olivier DANETc52344f2008-01-25 06:50:07 -0300962 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300963 struct dib0700_state *st = adap->dev->priv;
Patrick Boettchera75763f2006-10-18 08:34:16 -0300964 struct i2c_adapter *tun_i2c;
Olivier DANETc52344f2008-01-25 06:50:07 -0300965 s8 a;
966 int if1=1220;
Al Viroda5ee482008-05-21 00:31:21 -0300967 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
968 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
Olivier DANETc52344f2008-01-25 06:50:07 -0300969 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
970 }
Patrick Boettchera75763f2006-10-18 08:34:16 -0300971 if (st->is_dib7000pc)
972 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
973 else
974 tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
975
976 return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config,
Olivier DANETc52344f2008-01-25 06:50:07 -0300977 if1) == NULL ? -ENODEV : 0;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300978}
979
Patrick Boettcher01373a52007-07-30 12:49:04 -0300980/* DIB7070 generic */
981static struct dibx000_agc_config dib7070_agc_config = {
982 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
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=5, P_agc_write=0 */
Olivier Grenie9c783032009-12-07 07:49:40 -0300985 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
986 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
Patrick Boettcher01373a52007-07-30 12:49:04 -0300987
Olivier Grenie9c783032009-12-07 07:49:40 -0300988 600,
989 10,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300990
Olivier Grenie9c783032009-12-07 07:49:40 -0300991 0,
992 118,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300993
Olivier Grenie9c783032009-12-07 07:49:40 -0300994 0,
995 3530,
996 1,
997 5,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300998
Olivier Grenie9c783032009-12-07 07:49:40 -0300999 65535,
1000 0,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001001
Olivier Grenie9c783032009-12-07 07:49:40 -03001002 65535,
1003 0,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001004
Olivier Grenie9c783032009-12-07 07:49:40 -03001005 0,
1006 40,
1007 183,
1008 206,
1009 255,
1010 72,
1011 152,
1012 88,
1013 90,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001014
Olivier Grenie9c783032009-12-07 07:49:40 -03001015 17,
1016 27,
1017 23,
1018 51,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001019
Olivier Grenie9c783032009-12-07 07:49:40 -03001020 0,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001021};
1022
1023static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
1024{
Patrick Boettcher7e5ce652009-08-03 13:43:40 -03001025 deb_info("reset: %d", onoff);
Patrick Boettcher01373a52007-07-30 12:49:04 -03001026 return dib7000p_set_gpio(fe, 8, 0, !onoff);
1027}
1028
1029static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
1030{
Patrick Boettcher7e5ce652009-08-03 13:43:40 -03001031 deb_info("sleep: %d", onoff);
Patrick Boettcher01373a52007-07-30 12:49:04 -03001032 return dib7000p_set_gpio(fe, 9, 0, onoff);
1033}
1034
1035static struct dib0070_config dib7070p_dib0070_config[2] = {
1036 {
1037 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1038 .reset = dib7070_tuner_reset,
1039 .sleep = dib7070_tuner_sleep,
1040 .clock_khz = 12000,
Patrick Boettcher7e5ce652009-08-03 13:43:40 -03001041 .clock_pad_drive = 4,
1042 .charge_pump = 2,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001043 }, {
1044 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1045 .reset = dib7070_tuner_reset,
1046 .sleep = dib7070_tuner_sleep,
1047 .clock_khz = 12000,
Patrick Boettcher7e5ce652009-08-03 13:43:40 -03001048 .charge_pump = 2,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001049 }
1050};
1051
Olivier Grenied300bd62009-09-15 06:55:35 -03001052static struct dib0070_config dib7770p_dib0070_config = {
1053 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1054 .reset = dib7070_tuner_reset,
1055 .sleep = dib7070_tuner_sleep,
1056 .clock_khz = 12000,
1057 .clock_pad_drive = 0,
1058 .flip_chip = 1,
Olivier Grenieeac1fe12009-09-23 13:41:27 -03001059 .charge_pump = 2,
Olivier Grenied300bd62009-09-15 06:55:35 -03001060};
1061
Patrick Boettcher01373a52007-07-30 12:49:04 -03001062static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
1063{
1064 struct dvb_usb_adapter *adap = fe->dvb->priv;
1065 struct dib0700_adapter_state *state = adap->priv;
1066
1067 u16 offset;
1068 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1069 switch (band) {
1070 case BAND_VHF: offset = 950; break;
1071 case BAND_UHF:
1072 default: offset = 550; break;
1073 }
1074 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
1075 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1076 return state->set_param_save(fe, fep);
1077}
1078
Olivier Grenied300bd62009-09-15 06:55:35 -03001079static int dib7770_set_param_override(struct dvb_frontend *fe,
1080 struct dvb_frontend_parameters *fep)
1081{
1082 struct dvb_usb_adapter *adap = fe->dvb->priv;
1083 struct dib0700_adapter_state *state = adap->priv;
1084
1085 u16 offset;
1086 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1087 switch (band) {
1088 case BAND_VHF:
1089 dib7000p_set_gpio(fe, 0, 0, 1);
1090 offset = 850;
1091 break;
1092 case BAND_UHF:
1093 default:
1094 dib7000p_set_gpio(fe, 0, 0, 0);
1095 offset = 250;
1096 break;
1097 }
1098 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
1099 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1100 return state->set_param_save(fe, fep);
1101}
1102
1103static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
1104{
1105 struct dib0700_adapter_state *st = adap->priv;
1106 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe,
1107 DIBX000_I2C_INTERFACE_TUNER, 1);
1108
1109 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1110 &dib7770p_dib0070_config) == NULL)
1111 return -ENODEV;
1112
1113 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1114 adap->fe->ops.tuner_ops.set_params = dib7770_set_param_override;
1115 return 0;
1116}
1117
Patrick Boettcher01373a52007-07-30 12:49:04 -03001118static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
1119{
1120 struct dib0700_adapter_state *st = adap->priv;
1121 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1122
1123 if (adap->id == 0) {
1124 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
1125 return -ENODEV;
1126 } else {
1127 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
1128 return -ENODEV;
1129 }
1130
1131 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1132 adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override;
1133 return 0;
1134}
1135
Olivier Grenief8731f42009-09-18 04:08:43 -03001136static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
1137{
1138 return dib7000p_pid_filter(adapter->fe, index, pid, onoff);
1139}
1140
1141static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
1142{
1143 return dib7000p_pid_filter_ctrl(adapter->fe, onoff);
1144}
1145
Patrick Boettcher01373a52007-07-30 12:49:04 -03001146static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
Olivier Grenie9c783032009-12-07 07:49:40 -03001147 60000, 15000,
1148 1, 20, 3, 1, 0,
1149 0, 0, 1, 1, 2,
1150 (3 << 14) | (1 << 12) | (524 << 0),
1151 (0 << 25) | 0,
1152 20452225,
1153 12000000,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001154};
1155
1156static struct dib7000p_config dib7070p_dib7000p_config = {
1157 .output_mpeg2_in_188_bytes = 1,
1158
1159 .agc_config_count = 1,
1160 .agc = &dib7070_agc_config,
1161 .bw = &dib7070_bw_config_12_mhz,
Patrick Boettcher3cb2c392008-01-25 07:25:20 -03001162 .tuner_is_baseband = 1,
1163 .spur_protect = 1,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001164
1165 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1166 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1167 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1168
1169 .hostbus_diversity = 1,
1170};
1171
1172/* STK7070P */
1173static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
1174{
Al Viroda5ee482008-05-21 00:31:21 -03001175 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
1176 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
1177 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
1178 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03001179 else
Al Viroda5ee482008-05-21 00:31:21 -03001180 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
Patrick Boettcher01373a52007-07-30 12:49:04 -03001181 msleep(10);
1182 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1183 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1184 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1185 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1186
1187 dib0700_ctrl_clock(adap->dev, 72, 1);
1188
1189 msleep(10);
1190 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1191 msleep(10);
1192 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1193
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -03001194 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1195 &dib7070p_dib7000p_config) != 0) {
1196 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1197 __func__);
1198 return -ENODEV;
1199 }
Patrick Boettcher01373a52007-07-30 12:49:04 -03001200
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03001201 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
1202 &dib7070p_dib7000p_config);
Patrick Boettcher01373a52007-07-30 12:49:04 -03001203 return adap->fe == NULL ? -ENODEV : 0;
1204}
1205
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001206/* DIB807x generic */
1207static struct dibx000_agc_config dib807x_agc_config[2] = {
1208 {
1209 BAND_VHF,
1210 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1211 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1212 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1213 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1214 * P_agc_write=0 */
1215 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1216 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1217 (0 << 0), /* setup*/
1218
1219 600, /* inv_gain*/
1220 10, /* time_stabiliz*/
1221
1222 0, /* alpha_level*/
1223 118, /* thlock*/
1224
1225 0, /* wbd_inv*/
1226 3530, /* wbd_ref*/
1227 1, /* wbd_sel*/
1228 5, /* wbd_alpha*/
1229
1230 65535, /* agc1_max*/
1231 0, /* agc1_min*/
1232
1233 65535, /* agc2_max*/
1234 0, /* agc2_min*/
1235
1236 0, /* agc1_pt1*/
1237 40, /* agc1_pt2*/
1238 183, /* agc1_pt3*/
1239 206, /* agc1_slope1*/
1240 255, /* agc1_slope2*/
1241 72, /* agc2_pt1*/
1242 152, /* agc2_pt2*/
1243 88, /* agc2_slope1*/
1244 90, /* agc2_slope2*/
1245
1246 17, /* alpha_mant*/
1247 27, /* alpha_exp*/
1248 23, /* beta_mant*/
1249 51, /* beta_exp*/
1250
1251 0, /* perform_agc_softsplit*/
1252 }, {
1253 BAND_UHF,
1254 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1255 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1256 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1257 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1258 * P_agc_write=0 */
1259 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1260 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1261 (0 << 0), /* setup */
1262
1263 600, /* inv_gain*/
1264 10, /* time_stabiliz*/
1265
1266 0, /* alpha_level*/
1267 118, /* thlock*/
1268
1269 0, /* wbd_inv*/
1270 3530, /* wbd_ref*/
1271 1, /* wbd_sel*/
1272 5, /* wbd_alpha*/
1273
1274 65535, /* agc1_max*/
1275 0, /* agc1_min*/
1276
1277 65535, /* agc2_max*/
1278 0, /* agc2_min*/
1279
1280 0, /* agc1_pt1*/
1281 40, /* agc1_pt2*/
1282 183, /* agc1_pt3*/
1283 206, /* agc1_slope1*/
1284 255, /* agc1_slope2*/
1285 72, /* agc2_pt1*/
1286 152, /* agc2_pt2*/
1287 88, /* agc2_slope1*/
1288 90, /* agc2_slope2*/
1289
1290 17, /* alpha_mant*/
1291 27, /* alpha_exp*/
1292 23, /* beta_mant*/
1293 51, /* beta_exp*/
1294
1295 0, /* perform_agc_softsplit*/
1296 }
1297};
1298
1299static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
1300 60000, 15000, /* internal, sampling*/
1301 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/
1302 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
1303 ADClkSrc, modulo */
1304 (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1305 (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1306 18179755, /* timf*/
1307 12000000, /* xtal_hz*/
1308};
1309
1310static struct dib8000_config dib807x_dib8000_config[2] = {
1311 {
1312 .output_mpeg2_in_188_bytes = 1,
1313
1314 .agc_config_count = 2,
1315 .agc = dib807x_agc_config,
1316 .pll = &dib807x_bw_config_12_mhz,
1317 .tuner_is_baseband = 1,
1318
1319 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1320 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1321 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1322
1323 .hostbus_diversity = 1,
1324 .div_cfg = 1,
1325 .agc_control = &dib0070_ctrl_agc_filter,
1326 .output_mode = OUTMODE_MPEG2_FIFO,
1327 .drives = 0x2d98,
1328 }, {
1329 .output_mpeg2_in_188_bytes = 1,
1330
1331 .agc_config_count = 2,
1332 .agc = dib807x_agc_config,
1333 .pll = &dib807x_bw_config_12_mhz,
1334 .tuner_is_baseband = 1,
1335
1336 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1337 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1338 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1339
1340 .hostbus_diversity = 1,
1341 .agc_control = &dib0070_ctrl_agc_filter,
1342 .output_mode = OUTMODE_MPEG2_FIFO,
1343 .drives = 0x2d98,
1344 }
1345};
1346
Olivier Grenie03245a52009-12-04 13:27:57 -03001347static int dib80xx_tuner_reset(struct dvb_frontend *fe, int onoff)
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001348{
1349 return dib8000_set_gpio(fe, 5, 0, !onoff);
1350}
1351
Olivier Grenie03245a52009-12-04 13:27:57 -03001352static int dib80xx_tuner_sleep(struct dvb_frontend *fe, int onoff)
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001353{
1354 return dib8000_set_gpio(fe, 0, 0, onoff);
1355}
1356
1357static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
1358 { 240, 7},
1359 { 0xffff, 6},
1360};
1361
1362static struct dib0070_config dib807x_dib0070_config[2] = {
1363 {
1364 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
Olivier Grenie03245a52009-12-04 13:27:57 -03001365 .reset = dib80xx_tuner_reset,
1366 .sleep = dib80xx_tuner_sleep,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001367 .clock_khz = 12000,
1368 .clock_pad_drive = 4,
1369 .vga_filter = 1,
1370 .force_crystal_mode = 1,
1371 .enable_third_order_filter = 1,
1372 .charge_pump = 0,
1373 .wbd_gain = dib8070_wbd_gain_cfg,
1374 .osc_buffer_state = 0,
1375 .freq_offset_khz_uhf = -100,
1376 .freq_offset_khz_vhf = -100,
1377 }, {
1378 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
Olivier Grenie03245a52009-12-04 13:27:57 -03001379 .reset = dib80xx_tuner_reset,
1380 .sleep = dib80xx_tuner_sleep,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001381 .clock_khz = 12000,
1382 .clock_pad_drive = 2,
1383 .vga_filter = 1,
1384 .force_crystal_mode = 1,
1385 .enable_third_order_filter = 1,
1386 .charge_pump = 0,
1387 .wbd_gain = dib8070_wbd_gain_cfg,
1388 .osc_buffer_state = 0,
1389 .freq_offset_khz_uhf = -25,
1390 .freq_offset_khz_vhf = -25,
1391 }
1392};
1393
1394static int dib807x_set_param_override(struct dvb_frontend *fe,
1395 struct dvb_frontend_parameters *fep)
1396{
1397 struct dvb_usb_adapter *adap = fe->dvb->priv;
1398 struct dib0700_adapter_state *state = adap->priv;
1399
1400 u16 offset = dib0070_wbd_offset(fe);
1401 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1402 switch (band) {
1403 case BAND_VHF:
1404 offset += 750;
1405 break;
1406 case BAND_UHF: /* fall-thru wanted */
1407 default:
1408 offset += 250; break;
1409 }
1410 deb_info("WBD for DiB8000: %d\n", offset);
1411 dib8000_set_wbd_ref(fe, offset);
1412
1413 return state->set_param_save(fe, fep);
1414}
1415
1416static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1417{
1418 struct dib0700_adapter_state *st = adap->priv;
1419 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe,
1420 DIBX000_I2C_INTERFACE_TUNER, 1);
1421
1422 if (adap->id == 0) {
1423 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1424 &dib807x_dib0070_config[0]) == NULL)
1425 return -ENODEV;
1426 } else {
1427 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1428 &dib807x_dib0070_config[1]) == NULL)
1429 return -ENODEV;
1430 }
1431
1432 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1433 adap->fe->ops.tuner_ops.set_params = dib807x_set_param_override;
1434 return 0;
1435}
1436
Olivier Grenie9c783032009-12-07 07:49:40 -03001437static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index,
1438 u16 pid, int onoff)
Olivier Grenief8731f42009-09-18 04:08:43 -03001439{
1440 return dib8000_pid_filter(adapter->fe, index, pid, onoff);
1441}
1442
Olivier Grenie9c783032009-12-07 07:49:40 -03001443static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter,
1444 int onoff)
Olivier Grenief8731f42009-09-18 04:08:43 -03001445{
1446 return dib8000_pid_filter_ctrl(adapter->fe, onoff);
1447}
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001448
1449/* STK807x */
1450static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
1451{
1452 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1453 msleep(10);
1454 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1455 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1456 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1457
1458 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1459
1460 dib0700_ctrl_clock(adap->dev, 72, 1);
1461
1462 msleep(10);
1463 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1464 msleep(10);
1465 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1466
1467 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1468 0x80);
1469
1470 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1471 &dib807x_dib8000_config[0]);
1472
1473 return adap->fe == NULL ? -ENODEV : 0;
1474}
1475
1476/* STK807xPVR */
1477static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
1478{
1479 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1480 msleep(30);
1481 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1482 msleep(500);
1483 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1484 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1485 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1486
1487 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1488
1489 dib0700_ctrl_clock(adap->dev, 72, 1);
1490
1491 msleep(10);
1492 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1493 msleep(10);
1494 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1495
1496 /* initialize IC 0 */
Olivier Grenie9542f502009-12-07 08:09:04 -03001497 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80);
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001498
1499 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1500 &dib807x_dib8000_config[0]);
1501
1502 return adap->fe == NULL ? -ENODEV : 0;
1503}
1504
1505static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
1506{
1507 /* initialize IC 1 */
Olivier Grenie9542f502009-12-07 08:09:04 -03001508 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82);
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001509
1510 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82,
1511 &dib807x_dib8000_config[1]);
1512
1513 return adap->fe == NULL ? -ENODEV : 0;
1514}
1515
Olivier Grenie03245a52009-12-04 13:27:57 -03001516/* STK8096GP */
1517struct dibx000_agc_config dib8090_agc_config[2] = {
1518 {
1519 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
Olivier Grenie9c783032009-12-07 07:49:40 -03001520 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1521 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1522 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1523 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1524 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
Olivier Grenie03245a52009-12-04 13:27:57 -03001525
Olivier Grenie9c783032009-12-07 07:49:40 -03001526 787,
1527 10,
Olivier Grenie03245a52009-12-04 13:27:57 -03001528
Olivier Grenie9c783032009-12-07 07:49:40 -03001529 0,
1530 118,
Olivier Grenie03245a52009-12-04 13:27:57 -03001531
Olivier Grenie9c783032009-12-07 07:49:40 -03001532 0,
1533 3530,
1534 1,
1535 5,
Olivier Grenie03245a52009-12-04 13:27:57 -03001536
Olivier Grenie9c783032009-12-07 07:49:40 -03001537 65535,
1538 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001539
Olivier Grenie9c783032009-12-07 07:49:40 -03001540 65535,
1541 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001542
Olivier Grenie9c783032009-12-07 07:49:40 -03001543 0,
1544 32,
1545 114,
1546 143,
1547 144,
1548 114,
1549 227,
1550 116,
1551 117,
Olivier Grenie03245a52009-12-04 13:27:57 -03001552
Olivier Grenie9c783032009-12-07 07:49:40 -03001553 28,
1554 26,
1555 31,
1556 51,
Olivier Grenie03245a52009-12-04 13:27:57 -03001557
Olivier Grenie9c783032009-12-07 07:49:40 -03001558 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001559 },
1560 {
1561 BAND_CBAND,
Olivier Grenie9c783032009-12-07 07:49:40 -03001562 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1563 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1564 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1565 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1566 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
Olivier Grenie03245a52009-12-04 13:27:57 -03001567
Olivier Grenie9c783032009-12-07 07:49:40 -03001568 787,
1569 10,
Olivier Grenie03245a52009-12-04 13:27:57 -03001570
Olivier Grenie9c783032009-12-07 07:49:40 -03001571 0,
1572 118,
Olivier Grenie03245a52009-12-04 13:27:57 -03001573
Olivier Grenie9c783032009-12-07 07:49:40 -03001574 0,
1575 3530,
1576 1,
1577 5,
Olivier Grenie03245a52009-12-04 13:27:57 -03001578
Olivier Grenie9c783032009-12-07 07:49:40 -03001579 0,
1580 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001581
Olivier Grenie9c783032009-12-07 07:49:40 -03001582 65535,
1583 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001584
Olivier Grenie9c783032009-12-07 07:49:40 -03001585 0,
1586 32,
1587 114,
1588 143,
1589 144,
1590 114,
1591 227,
1592 116,
1593 117,
Olivier Grenie03245a52009-12-04 13:27:57 -03001594
Olivier Grenie9c783032009-12-07 07:49:40 -03001595 28,
1596 26,
1597 31,
1598 51,
Olivier Grenie03245a52009-12-04 13:27:57 -03001599
Olivier Grenie9c783032009-12-07 07:49:40 -03001600 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001601 }
1602};
1603
1604static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = {
Olivier Grenie9c783032009-12-07 07:49:40 -03001605 54000, 13500,
1606 1, 18, 3, 1, 0,
1607 0, 0, 1, 1, 2,
1608 (3 << 14) | (1 << 12) | (599 << 0),
1609 (0 << 25) | 0,
1610 20199727,
1611 12000000,
Olivier Grenie03245a52009-12-04 13:27:57 -03001612};
1613
1614static int dib8090_get_adc_power(struct dvb_frontend *fe)
1615{
1616 return dib8000_get_adc_power(fe, 1);
1617}
1618
1619static struct dib8000_config dib809x_dib8000_config = {
1620 .output_mpeg2_in_188_bytes = 1,
1621
1622 .agc_config_count = 2,
1623 .agc = dib8090_agc_config,
1624 .agc_control = dib0090_dcc_freq,
1625 .pll = &dib8090_pll_config_12mhz,
1626 .tuner_is_baseband = 1,
1627
1628 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1629 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1630 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1631
1632 .hostbus_diversity = 1,
1633 .div_cfg = 0x31,
1634 .output_mode = OUTMODE_MPEG2_FIFO,
1635 .drives = 0x2d98,
1636 .diversity_delay = 144,
1637 .refclksel = 3,
1638};
1639
1640static struct dib0090_config dib809x_dib0090_config = {
1641 .io.pll_bypass = 1,
1642 .io.pll_range = 1,
1643 .io.pll_prediv = 1,
1644 .io.pll_loopdiv = 20,
1645 .io.adc_clock_ratio = 8,
1646 .io.pll_int_loop_filt = 0,
1647 .io.clock_khz = 12000,
1648 .reset = dib80xx_tuner_reset,
1649 .sleep = dib80xx_tuner_sleep,
1650 .clkouttobamse = 1,
1651 .analog_output = 1,
1652 .i2c_address = DEFAULT_DIB0090_I2C_ADDRESS,
1653 .wbd_vhf_offset = 100,
1654 .wbd_cband_offset = 450,
1655 .use_pwm_agc = 1,
1656 .clkoutdrive = 1,
1657 .get_adc_power = dib8090_get_adc_power,
1658 .freq_offset_khz_uhf = 0,
1659 .freq_offset_khz_vhf = -143,
1660};
1661
1662static int dib8096_set_param_override(struct dvb_frontend *fe,
1663 struct dvb_frontend_parameters *fep)
1664{
1665 struct dvb_usb_adapter *adap = fe->dvb->priv;
1666 struct dib0700_adapter_state *state = adap->priv;
1667 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1668 u16 offset;
1669 int ret = 0;
1670 enum frontend_tune_state tune_state = CT_SHUTDOWN;
1671 u16 ltgain, rf_gain_limit;
1672
1673 ret = state->set_param_save(fe, fep);
1674 if (ret < 0)
1675 return ret;
1676
1677 switch (band) {
Olivier Grenie9c783032009-12-07 07:49:40 -03001678 case BAND_VHF:
Olivier Grenie03245a52009-12-04 13:27:57 -03001679 offset = 100;
1680 break;
Olivier Grenie9c783032009-12-07 07:49:40 -03001681 case BAND_UHF:
Olivier Grenie03245a52009-12-04 13:27:57 -03001682 offset = 550;
1683 break;
Olivier Grenie9c783032009-12-07 07:49:40 -03001684 default:
Olivier Grenie03245a52009-12-04 13:27:57 -03001685 offset = 0;
1686 break;
1687 }
1688 offset += (dib0090_get_wbd_offset(fe) * 8 * 18 / 33 + 1) / 2;
1689 dib8000_set_wbd_ref(fe, offset);
1690
1691
Olivier Grenie9c783032009-12-07 07:49:40 -03001692 if (band == BAND_CBAND) {
Olivier Grenie03245a52009-12-04 13:27:57 -03001693 deb_info("tuning in CBAND - soft-AGC startup\n");
1694 /* TODO specific wbd target for dib0090 - needed for startup ? */
1695 dib0090_set_tune_state(fe, CT_AGC_START);
Olivier Grenie9c783032009-12-07 07:49:40 -03001696 do {
1697 ret = dib0090_gain_control(fe);
1698 msleep(ret);
1699 tune_state = dib0090_get_tune_state(fe);
1700 if (tune_state == CT_AGC_STEP_0)
1701 dib8000_set_gpio(fe, 6, 0, 1);
1702 else if (tune_state == CT_AGC_STEP_1) {
1703 dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, &ltgain);
1704 if (rf_gain_limit == 0)
1705 dib8000_set_gpio(fe, 6, 0, 0);
1706 }
1707 } while (tune_state < CT_AGC_STOP);
Olivier Grenie03245a52009-12-04 13:27:57 -03001708 dib0090_pwm_gain_reset(fe);
1709 dib8000_pwm_agc_reset(fe);
1710 dib8000_set_tune_state(fe, CT_DEMOD_START);
Olivier Grenie9c783032009-12-07 07:49:40 -03001711 } else {
Olivier Grenie03245a52009-12-04 13:27:57 -03001712 deb_info("not tuning in CBAND - standard AGC startup\n");
1713 dib0090_pwm_gain_reset(fe);
1714 }
1715
1716 return 0;
1717}
1718
1719static int dib809x_tuner_attach(struct dvb_usb_adapter *adap)
1720{
1721 struct dib0700_adapter_state *st = adap->priv;
1722 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1723
1724 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1725 return -ENODEV;
1726
1727 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1728 adap->fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1729 return 0;
1730}
1731
1732static int stk809x_frontend_attach(struct dvb_usb_adapter *adap)
1733{
1734 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1735 msleep(10);
1736 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1737 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1738 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1739
1740 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1741
1742 dib0700_ctrl_clock(adap->dev, 72, 1);
1743
1744 msleep(10);
1745 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1746 msleep(10);
1747 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1748
1749 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80);
1750
1751 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config);
1752
1753 return adap->fe == NULL ? -ENODEV : 0;
1754}
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001755
Patrick Boettcher01373a52007-07-30 12:49:04 -03001756/* STK7070PD */
1757static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
1758 {
1759 .output_mpeg2_in_188_bytes = 1,
1760
1761 .agc_config_count = 1,
1762 .agc = &dib7070_agc_config,
1763 .bw = &dib7070_bw_config_12_mhz,
Patrick Boettcher3cb2c392008-01-25 07:25:20 -03001764 .tuner_is_baseband = 1,
1765 .spur_protect = 1,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001766
1767 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1768 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1769 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1770
1771 .hostbus_diversity = 1,
1772 }, {
1773 .output_mpeg2_in_188_bytes = 1,
1774
1775 .agc_config_count = 1,
1776 .agc = &dib7070_agc_config,
1777 .bw = &dib7070_bw_config_12_mhz,
Patrick Boettcher3cb2c392008-01-25 07:25:20 -03001778 .tuner_is_baseband = 1,
1779 .spur_protect = 1,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001780
1781 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1782 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1783 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1784
1785 .hostbus_diversity = 1,
1786 }
1787};
1788
1789static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
1790{
1791 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1792 msleep(10);
1793 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1794 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1795 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1796 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1797
1798 dib0700_ctrl_clock(adap->dev, 72, 1);
1799
1800 msleep(10);
1801 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1802 msleep(10);
1803 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1804
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -03001805 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
1806 stk7070pd_dib7000p_config) != 0) {
1807 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1808 __func__);
1809 return -ENODEV;
1810 }
Patrick Boettcher01373a52007-07-30 12:49:04 -03001811
1812 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
1813 return adap->fe == NULL ? -ENODEV : 0;
1814}
1815
1816static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
1817{
1818 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
1819 return adap->fe == NULL ? -ENODEV : 0;
1820}
1821
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001822/* S5H1411 */
1823static struct s5h1411_config pinnacle_801e_config = {
1824 .output_mode = S5H1411_PARALLEL_OUTPUT,
1825 .gpio = S5H1411_GPIO_OFF,
1826 .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
1827 .qam_if = S5H1411_IF_44000,
1828 .vsb_if = S5H1411_IF_44000,
1829 .inversion = S5H1411_INVERSION_OFF,
1830 .status_mode = S5H1411_DEMODLOCKING
1831};
1832
1833/* Pinnacle PCTV HD Pro 801e GPIOs map:
1834 GPIO0 - currently unknown
1835 GPIO1 - xc5000 tuner reset
1836 GPIO2 - CX25843 sleep
1837 GPIO3 - currently unknown
1838 GPIO4 - currently unknown
1839 GPIO6 - currently unknown
1840 GPIO7 - currently unknown
1841 GPIO9 - currently unknown
1842 GPIO10 - CX25843 reset
1843 */
1844static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
1845{
1846 struct dib0700_state *st = adap->dev->priv;
1847
1848 /* Make use of the new i2c functions from FW 1.20 */
1849 st->fw_use_new_i2c_api = 1;
1850
1851 /* The s5h1411 requires the dib0700 to not be in master mode */
1852 st->disable_streaming_master_mode = 1;
1853
1854 /* All msleep values taken from Windows USB trace */
1855 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
1856 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
1857 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1858 msleep(400);
1859 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1860 msleep(60);
1861 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1862 msleep(30);
1863 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1864 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1865 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1866 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1867 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
1868 msleep(30);
1869
1870 /* Put the CX25843 to sleep for now since we're in digital mode */
1871 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
1872
1873 /* GPIOs are initialized, do the attach */
1874 adap->fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
1875 &adap->dev->i2c_adap);
1876 return adap->fe == NULL ? -ENODEV : 0;
1877}
1878
Michael Krufky767f3b32008-09-25 09:47:07 -03001879static int dib0700_xc5000_tuner_callback(void *priv, int component,
1880 int command, int arg)
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001881{
1882 struct dvb_usb_adapter *adap = priv;
1883
Devin Heitmueller79025a92008-10-06 12:07:48 -03001884 if (command == XC5000_TUNER_RESET) {
1885 /* Reset the tuner */
1886 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
Devin Heitmuellerf0f46332009-05-04 21:57:41 -03001887 msleep(10);
Devin Heitmueller79025a92008-10-06 12:07:48 -03001888 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
Devin Heitmuellerf0f46332009-05-04 21:57:41 -03001889 msleep(10);
Devin Heitmueller79025a92008-10-06 12:07:48 -03001890 } else {
1891 err("xc5000: unknown tuner callback command: %d\n", command);
1892 return -EINVAL;
1893 }
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001894
1895 return 0;
1896}
1897
1898static struct xc5000_config s5h1411_xc5000_tunerconfig = {
1899 .i2c_address = 0x64,
1900 .if_khz = 5380,
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001901};
1902
1903static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
1904{
Devin Heitmueller79025a92008-10-06 12:07:48 -03001905 /* FIXME: generalize & move to common area */
1906 adap->fe->callback = dib0700_xc5000_tuner_callback;
1907
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001908 return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap,
Michael Krufky767f3b32008-09-25 09:47:07 -03001909 &s5h1411_xc5000_tunerconfig)
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001910 == NULL ? -ENODEV : 0;
1911}
1912
Michael Krufkyce904bc2009-01-19 01:12:55 -03001913static struct lgdt3305_config hcw_lgdt3305_config = {
1914 .i2c_addr = 0x0e,
1915 .mpeg_mode = LGDT3305_MPEG_PARALLEL,
1916 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
1917 .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
1918 .deny_i2c_rptr = 0,
1919 .spectral_inversion = 1,
1920 .qam_if_khz = 6000,
1921 .vsb_if_khz = 6000,
1922 .usref_8vsb = 0x0500,
1923};
1924
1925static struct mxl5007t_config hcw_mxl5007t_config = {
1926 .xtal_freq_hz = MxL_XTAL_25_MHZ,
1927 .if_freq_hz = MxL_IF_6_MHZ,
1928 .invert_if = 1,
1929};
1930
1931/* TIGER-ATSC map:
1932 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
1933 GPIO1 - ANT_SEL (H: VPA, L: MCX)
1934 GPIO4 - SCL2
1935 GPIO6 - EN_TUNER
1936 GPIO7 - SDA2
1937 GPIO10 - DEM_RST
1938
1939 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
1940 */
1941static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
1942{
1943 struct dib0700_state *st = adap->dev->priv;
1944
1945 /* Make use of the new i2c functions from FW 1.20 */
1946 st->fw_use_new_i2c_api = 1;
1947
1948 st->disable_streaming_master_mode = 1;
1949
1950 /* fe power enable */
1951 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1952 msleep(30);
1953 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1954 msleep(30);
1955
1956 /* demod reset */
1957 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1958 msleep(30);
1959 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1960 msleep(30);
1961 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1962 msleep(30);
1963
1964 adap->fe = dvb_attach(lgdt3305_attach,
1965 &hcw_lgdt3305_config,
1966 &adap->dev->i2c_adap);
1967
1968 return adap->fe == NULL ? -ENODEV : 0;
1969}
1970
1971static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
1972{
1973 return dvb_attach(mxl5007t_attach, adap->fe,
1974 &adap->dev->i2c_adap, 0x60,
1975 &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
1976}
1977
1978
Patrick Boettcher01373a52007-07-30 12:49:04 -03001979/* DVB-USB and USB stuff follows */
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001980struct usb_device_id dib0700_usb_id_table[] = {
Patrick Boettcher01373a52007-07-30 12:49:04 -03001981/* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03001982 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
1983 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
1984 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
1985 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
Patrick Boettcher01373a52007-07-30 12:49:04 -03001986/* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03001987 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
1988 { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
1989 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
1990 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
Patrick Boettcher01373a52007-07-30 12:49:04 -03001991/* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03001992 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
1993 { USB_DEVICE(USB_VID_TERRATEC,
1994 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
1995 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
1996 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
Patrick Boettcher01373a52007-07-30 12:49:04 -03001997/* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03001998 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
1999 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
2000 { USB_DEVICE(USB_VID_PINNACLE,
2001 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
2002 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
Joachim Steigerfa3b8772007-10-08 20:08:46 -03002003/* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002004 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
2005 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
2006 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
2007 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
2008/* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
2009 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
2010 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
2011 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
2012 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
2013/* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
2014 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
2015 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
Alexander Simondc888072008-03-29 21:37:54 -03002016 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
Darryl Green5da4e2c2008-03-29 21:47:43 -03002017 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
Michael Krufkyaf2a8872008-09-03 17:12:24 -03002018/* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
Michael Krufky9a0c04a2008-09-03 17:12:24 -03002019 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
Finn Thain17a370b2008-09-06 13:42:47 -03002020 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
Daniel Oliveira Nascimento8751aaa2008-09-07 12:39:44 -03002021 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
Albert Comerma57697432008-09-07 12:43:33 -03002022 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002023/* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
Devin Heitmuellerd2fc3bf2008-09-25 06:22:23 -03002024 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03002025 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
Nicolas Fournierdb4b2d12009-01-13 07:15:25 -03002026 { USB_DEVICE(USB_VID_TERRATEC,
2027 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
sebastian.blanes@gmail.com0a6e1ed2009-02-24 14:51:43 -03002028 { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
Pascal Terjan9abb6e62009-02-26 10:31:41 -03002029/* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
Michael Krufkyce904bc2009-01-19 01:12:55 -03002030 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
2031 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
Xoan Loureiro16ba1ee2009-03-29 08:43:36 -03002032 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
Klaus Flittner919a5482009-03-29 09:12:06 -03002033 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
Armin Schenker513846e2009-04-20 11:57:49 -03002034/* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
tomas petrf0f4ae72009-05-20 05:28:05 -03002035 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
Patrick Boettchera9b8fe32009-05-20 05:35:02 -03002036 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
2037 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
Pete Hildebrandtc53d83c2009-08-05 11:46:38 -03002038 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
Olivier Grenie74b76f22009-09-02 08:19:19 -03002039/* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
2040 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
Patrick Boettchere4147532009-11-30 13:52:57 -03002041 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV73ESE) },
2042 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV282E) },
Olivier Grenied300bd62009-09-15 06:55:35 -03002043 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
Patrick Boettcherdb481382009-09-15 07:16:51 -03002044/* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002045 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
2046 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
Mauro Carvalho Chehabaaeab302009-09-16 09:18:26 -03002047 { USB_DEVICE(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD) },
S?rgio Fortier8a378e82009-09-28 04:19:21 -03002048 { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },
Patrick Boettcher20232c42009-12-01 12:08:56 -03002049/* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
Patrick Boettchere4147532009-11-30 13:52:57 -03002050 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
Olivier Grenie03245a52009-12-04 13:27:57 -03002051 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002052 { 0 } /* Terminating entry */
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002053};
2054MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
2055
2056#define DIB0700_DEFAULT_DEVICE_PROPERTIES \
2057 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
2058 .usb_ctrl = DEVICE_SPECIFIC, \
Devin Heitmuellerbdc203e2008-09-06 13:45:27 -03002059 .firmware = "dvb-usb-dib0700-1.20.fw", \
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002060 .download_firmware = dib0700_download_firmware, \
Patrick Boettcher6958eff2006-09-19 12:51:40 -03002061 .no_reconnect = 1, \
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002062 .size_of_priv = sizeof(struct dib0700_state), \
Patrick Boettcher6958eff2006-09-19 12:51:40 -03002063 .i2c_algo = &dib0700_i2c_algo, \
2064 .identify_state = dib0700_identify_state
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002065
2066#define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
2067 .streaming_ctrl = dib0700_streaming_ctrl, \
2068 .stream = { \
2069 .type = USB_BULK, \
2070 .count = 4, \
2071 .endpoint = ep, \
2072 .u = { \
2073 .bulk = { \
2074 .buffersize = 39480, \
2075 } \
2076 } \
2077 }
2078
2079struct dvb_usb_device_properties dib0700_devices[] = {
2080 {
2081 DIB0700_DEFAULT_DEVICE_PROPERTIES,
2082
2083 .num_adapters = 1,
2084 .adapter = {
2085 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002086 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2087 .pid_filter_count = 32,
2088 .pid_filter = stk70x0p_pid_filter,
2089 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002090 .frontend_attach = stk7700p_frontend_attach,
2091 .tuner_attach = stk7700p_tuner_attach,
2092
2093 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2094 },
2095 },
2096
dominik67053a42007-11-10 19:23:31 -03002097 .num_device_descs = 8,
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002098 .devices = {
2099 { "DiBcom STK7700P reference design",
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002100 { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002101 { NULL },
2102 },
2103 { "Hauppauge Nova-T Stick",
Stefan Trabyf9aeba42006-11-12 13:02:51 -03002104 { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002105 { NULL },
2106 },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002107 { "AVerMedia AVerTV DVB-T Volar",
Jose Carlos Garcia Sogoced8fec2006-11-14 05:01:47 -03002108 { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002109 { NULL },
2110 },
2111 { "Compro Videomate U500",
Patrick Boettcher1f8ca4b2007-07-30 14:24:37 -03002112 { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002113 { NULL },
Henning Schroeer0ce215e2006-10-19 07:58:22 -03002114 },
2115 { "Uniwill STK7700P based (Hama and others)",
2116 { &dib0700_usb_id_table[7], NULL },
2117 { NULL },
Michael Krufky8637a872006-11-08 16:47:32 -03002118 },
2119 { "Leadtek Winfast DTV Dongle (STK7700P based)",
Patrick Boettcher1e13c8f2009-09-19 05:24:40 -03002120 { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
Michael Krufky8637a872006-11-08 16:47:32 -03002121 { NULL },
Joachim Steigerfa3b8772007-10-08 20:08:46 -03002122 },
2123 { "AVerMedia AVerTV DVB-T Express",
2124 { &dib0700_usb_id_table[20] },
2125 { NULL },
dominik67053a42007-11-10 19:23:31 -03002126 },
dominik67053a42007-11-10 19:23:31 -03002127 { "Gigabyte U7000",
2128 { &dib0700_usb_id_table[21], NULL },
2129 { NULL },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002130 }
Darren Saltb1139e32007-08-18 18:05:31 -03002131 },
2132
2133 .rc_interval = DEFAULT_RC_INTERVAL,
2134 .rc_key_map = dib0700_rc_keys,
2135 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2136 .rc_query = dib0700_rc_query
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002137 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2138
2139 .num_adapters = 2,
2140 .adapter = {
2141 {
2142 .frontend_attach = bristol_frontend_attach,
2143 .tuner_attach = bristol_tuner_attach,
2144
2145 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2146 }, {
2147 .frontend_attach = bristol_frontend_attach,
2148 .tuner_attach = bristol_tuner_attach,
2149
2150 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2151 }
2152 },
2153
2154 .num_device_descs = 1,
2155 .devices = {
2156 { "Hauppauge Nova-T 500 Dual DVB-T",
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002157 { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002158 { NULL },
2159 },
Janne Grunau82f3d552007-07-30 13:50:28 -03002160 },
2161
2162 .rc_interval = DEFAULT_RC_INTERVAL,
2163 .rc_key_map = dib0700_rc_keys,
Patrick Boettcher87797372007-07-30 17:02:17 -03002164 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
Janne Grunau82f3d552007-07-30 13:50:28 -03002165 .rc_query = dib0700_rc_query
Olivier DANET54d75eb2007-07-25 14:42:54 -03002166 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2167
2168 .num_adapters = 2,
2169 .adapter = {
2170 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002171 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2172 .pid_filter_count = 32,
2173 .pid_filter = stk70x0p_pid_filter,
2174 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier DANET54d75eb2007-07-25 14:42:54 -03002175 .frontend_attach = stk7700d_frontend_attach,
2176 .tuner_attach = stk7700d_tuner_attach,
2177
2178 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2179 }, {
Olivier Grenief8731f42009-09-18 04:08:43 -03002180 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2181 .pid_filter_count = 32,
2182 .pid_filter = stk70x0p_pid_filter,
2183 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier DANET54d75eb2007-07-25 14:42:54 -03002184 .frontend_attach = stk7700d_frontend_attach,
2185 .tuner_attach = stk7700d_tuner_attach,
2186
2187 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2188 }
2189 },
2190
James A Webb200e8612009-08-04 02:38:05 -03002191 .num_device_descs = 5,
Olivier DANET54d75eb2007-07-25 14:42:54 -03002192 .devices = {
2193 { "Pinnacle PCTV 2000e",
2194 { &dib0700_usb_id_table[11], NULL },
2195 { NULL },
2196 },
2197 { "Terratec Cinergy DT XS Diversity",
2198 { &dib0700_usb_id_table[12], NULL },
2199 { NULL },
2200 },
Darren Saltfaebb912007-08-18 18:04:00 -03002201 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
Olivier DANET54d75eb2007-07-25 14:42:54 -03002202 { &dib0700_usb_id_table[13], NULL },
2203 { NULL },
2204 },
Patrick Boettcher01373a52007-07-30 12:49:04 -03002205 { "DiBcom STK7700D reference design",
Patrick Boettcherb6884a12007-07-27 10:08:51 -03002206 { &dib0700_usb_id_table[14], NULL },
2207 { NULL },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03002208 },
James A Webb200e8612009-08-04 02:38:05 -03002209 { "YUAN High-Tech DiBcom STK7700D",
2210 { &dib0700_usb_id_table[55], NULL },
2211 { NULL },
2212 },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03002213
Olivier DANET54d75eb2007-07-25 14:42:54 -03002214 },
Janne Grunau82f3d552007-07-30 13:50:28 -03002215
Olivier DANET54d75eb2007-07-25 14:42:54 -03002216 .rc_interval = DEFAULT_RC_INTERVAL,
Janne Grunau82f3d552007-07-30 13:50:28 -03002217 .rc_key_map = dib0700_rc_keys,
Patrick Boettcher87797372007-07-30 17:02:17 -03002218 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
Janne Grunau82f3d552007-07-30 13:50:28 -03002219 .rc_query = dib0700_rc_query
Patrick Boettcher01373a52007-07-30 12:49:04 -03002220
2221 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2222
2223 .num_adapters = 1,
2224 .adapter = {
2225 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002226 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2227 .pid_filter_count = 32,
2228 .pid_filter = stk70x0p_pid_filter,
2229 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03002230 .frontend_attach = stk7700P2_frontend_attach,
2231 .tuner_attach = stk7700d_tuner_attach,
2232
2233 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2234 },
2235 },
2236
Yusuf Altinbb1b0822009-01-08 07:58:45 -03002237 .num_device_descs = 3,
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03002238 .devices = {
2239 { "ASUS My Cinema U3000 Mini DVBT Tuner",
2240 { &dib0700_usb_id_table[23], NULL },
2241 { NULL },
2242 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002243 { "Yuan EC372S",
2244 { &dib0700_usb_id_table[31], NULL },
2245 { NULL },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03002246 },
2247 { "Terratec Cinergy T Express",
2248 { &dib0700_usb_id_table[42], NULL },
2249 { NULL },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002250 }
Chris Rankin48aa7392008-09-25 06:52:24 -03002251 },
2252
2253 .rc_interval = DEFAULT_RC_INTERVAL,
2254 .rc_key_map = dib0700_rc_keys,
2255 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2256 .rc_query = dib0700_rc_query
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03002257 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2258
2259 .num_adapters = 1,
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 = stk7070p_frontend_attach,
2267 .tuner_attach = dib7070p_tuner_attach,
2268
2269 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2270
2271 .size_of_priv = sizeof(struct dib0700_adapter_state),
2272 },
2273 },
2274
Patrick Boettcher1e13c8f2009-09-19 05:24:40 -03002275 .num_device_descs = 11,
Patrick Boettcher01373a52007-07-30 12:49:04 -03002276 .devices = {
2277 { "DiBcom STK7070P reference design",
2278 { &dib0700_usb_id_table[15], NULL },
2279 { NULL },
2280 },
2281 { "Pinnacle PCTV DVB-T Flash Stick",
2282 { &dib0700_usb_id_table[16], NULL },
2283 { NULL },
2284 },
Yousef Lamlum7999a812008-01-25 05:51:48 -03002285 { "Artec T14BR DVB-T",
2286 { &dib0700_usb_id_table[22], NULL },
2287 { NULL },
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03002288 },
2289 { "ASUS My Cinema U3100 Mini DVBT Tuner",
2290 { &dib0700_usb_id_table[24], NULL },
2291 { NULL },
2292 },
Tim Taubertc7637b12008-01-25 06:16:36 -03002293 { "Hauppauge Nova-T Stick",
2294 { &dib0700_usb_id_table[25], NULL },
2295 { NULL },
2296 },
Darren Salt13b83b52008-01-25 06:20:02 -03002297 { "Hauppauge Nova-T MyTV.t",
2298 { &dib0700_usb_id_table[26], NULL },
2299 { NULL },
2300 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002301 { "Pinnacle PCTV 72e",
2302 { &dib0700_usb_id_table[29], NULL },
2303 { NULL },
2304 },
2305 { "Pinnacle PCTV 73e",
2306 { &dib0700_usb_id_table[30], NULL },
2307 { NULL },
2308 },
Klaus Flittner919a5482009-03-29 09:12:06 -03002309 { "Elgato EyeTV DTT",
2310 { &dib0700_usb_id_table[49], NULL },
2311 { NULL },
2312 },
Pascal Terjan9abb6e62009-02-26 10:31:41 -03002313 { "Yuan PD378S",
2314 { &dib0700_usb_id_table[45], NULL },
2315 { NULL },
2316 },
Armin Schenker513846e2009-04-20 11:57:49 -03002317 { "Elgato EyeTV Dtt Dlx PD378S",
2318 { &dib0700_usb_id_table[50], NULL },
2319 { NULL },
2320 },
Tim Taubertc7637b12008-01-25 06:16:36 -03002321 },
2322
2323 .rc_interval = DEFAULT_RC_INTERVAL,
2324 .rc_key_map = dib0700_rc_keys,
2325 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2326 .rc_query = dib0700_rc_query
2327
Patrick Boettcher01373a52007-07-30 12:49:04 -03002328 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2329
Olivier Grenie74b76f22009-09-02 08:19:19 -03002330 .num_adapters = 1,
2331 .adapter = {
2332 {
Mauro Carvalho Chehab648732f2009-11-04 12:11:43 -02002333 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2334 .pid_filter_count = 32,
2335 .pid_filter = stk70x0p_pid_filter,
2336 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier Grenie74b76f22009-09-02 08:19:19 -03002337 .frontend_attach = stk7070p_frontend_attach,
2338 .tuner_attach = dib7070p_tuner_attach,
2339
2340 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2341
2342 .size_of_priv = sizeof(struct dib0700_adapter_state),
2343 },
2344 },
2345
Patrick Boettcher20232c42009-12-01 12:08:56 -03002346 .num_device_descs = 3,
Olivier Grenie74b76f22009-09-02 08:19:19 -03002347 .devices = {
2348 { "Pinnacle PCTV 73A",
2349 { &dib0700_usb_id_table[56], NULL },
2350 { NULL },
2351 },
2352 { "Pinnacle PCTV 73e SE",
Patrick Boettcher20232c42009-12-01 12:08:56 -03002353 { &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL },
Olivier Grenie74b76f22009-09-02 08:19:19 -03002354 { NULL },
2355 },
2356 { "Pinnacle PCTV 282e",
Patrick Boettcher20232c42009-12-01 12:08:56 -03002357 { &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL },
Olivier Grenie74b76f22009-09-02 08:19:19 -03002358 { NULL },
2359 },
2360 },
2361
2362 .rc_interval = DEFAULT_RC_INTERVAL,
2363 .rc_key_map = dib0700_rc_keys,
2364 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2365 .rc_query = dib0700_rc_query
2366
2367 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2368
Patrick Boettcher01373a52007-07-30 12:49:04 -03002369 .num_adapters = 2,
2370 .adapter = {
2371 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002372 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2373 .pid_filter_count = 32,
2374 .pid_filter = stk70x0p_pid_filter,
2375 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Patrick Boettcher01373a52007-07-30 12:49:04 -03002376 .frontend_attach = stk7070pd_frontend_attach0,
2377 .tuner_attach = dib7070p_tuner_attach,
2378
2379 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2380
2381 .size_of_priv = sizeof(struct dib0700_adapter_state),
2382 }, {
Olivier Grenief8731f42009-09-18 04:08:43 -03002383 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2384 .pid_filter_count = 32,
2385 .pid_filter = stk70x0p_pid_filter,
2386 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Patrick Boettcher01373a52007-07-30 12:49:04 -03002387 .frontend_attach = stk7070pd_frontend_attach1,
2388 .tuner_attach = dib7070p_tuner_attach,
2389
2390 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2391
2392 .size_of_priv = sizeof(struct dib0700_adapter_state),
2393 }
2394 },
2395
sebastian.blanes@gmail.com0a6e1ed2009-02-24 14:51:43 -03002396 .num_device_descs = 6,
Patrick Boettcher01373a52007-07-30 12:49:04 -03002397 .devices = {
2398 { "DiBcom STK7070PD reference design",
2399 { &dib0700_usb_id_table[17], NULL },
2400 { NULL },
2401 },
2402 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
2403 { &dib0700_usb_id_table[18], NULL },
2404 { NULL },
Michael Krufkyd01eb2d2008-07-03 23:43:36 -03002405 },
2406 { "Hauppauge Nova-TD Stick (52009)",
2407 { &dib0700_usb_id_table[35], NULL },
2408 { NULL },
Michael Krufky9a0c04a2008-09-03 17:12:24 -03002409 },
2410 { "Hauppauge Nova-TD-500 (84xxx)",
2411 { &dib0700_usb_id_table[36], NULL },
2412 { NULL },
Nicolas Fournierdb4b2d12009-01-13 07:15:25 -03002413 },
Patrick Boettchera9b8fe32009-05-20 05:35:02 -03002414 { "Terratec Cinergy DT USB XS Diversity/ T5",
2415 { &dib0700_usb_id_table[43],
2416 &dib0700_usb_id_table[53], NULL},
Nicolas Fournierdb4b2d12009-01-13 07:15:25 -03002417 { NULL },
sebastian.blanes@gmail.com0a6e1ed2009-02-24 14:51:43 -03002418 },
2419 { "Sony PlayTV",
2420 { &dib0700_usb_id_table[44], NULL },
2421 { NULL },
dominik67053a42007-11-10 19:23:31 -03002422 }
Arne Luehrsc985a8d2009-01-21 01:37:20 -03002423 },
2424 .rc_interval = DEFAULT_RC_INTERVAL,
2425 .rc_key_map = dib0700_rc_keys,
2426 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2427 .rc_query = dib0700_rc_query
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002428 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2429
2430 .num_adapters = 1,
2431 .adapter = {
2432 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002433 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2434 .pid_filter_count = 32,
2435 .pid_filter = stk70x0p_pid_filter,
2436 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002437 .frontend_attach = stk7700ph_frontend_attach,
2438 .tuner_attach = stk7700ph_tuner_attach,
2439
2440 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2441
2442 .size_of_priv = sizeof(struct
2443 dib0700_adapter_state),
2444 },
2445 },
2446
Pete Hildebrandtc53d83c2009-08-05 11:46:38 -03002447 .num_device_descs = 9,
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002448 .devices = {
2449 { "Terratec Cinergy HT USB XE",
2450 { &dib0700_usb_id_table[27], NULL },
2451 { NULL },
2452 },
2453 { "Pinnacle Expresscard 320cx",
2454 { &dib0700_usb_id_table[28], NULL },
2455 { NULL },
2456 },
2457 { "Terratec Cinergy HT Express",
2458 { &dib0700_usb_id_table[32], NULL },
2459 { NULL },
2460 },
Finn Thain17a370b2008-09-06 13:42:47 -03002461 { "Gigabyte U8000-RH",
2462 { &dib0700_usb_id_table[37], NULL },
2463 { NULL },
2464 },
Daniel Oliveira Nascimento8751aaa2008-09-07 12:39:44 -03002465 { "YUAN High-Tech STK7700PH",
2466 { &dib0700_usb_id_table[38], NULL },
2467 { NULL },
2468 },
Albert Comerma57697432008-09-07 12:43:33 -03002469 { "Asus My Cinema-U3000Hybrid",
2470 { &dib0700_usb_id_table[39], NULL },
2471 { NULL },
2472 },
Xoan Loureiro16ba1ee2009-03-29 08:43:36 -03002473 { "YUAN High-Tech MC770",
2474 { &dib0700_usb_id_table[48], NULL },
2475 { NULL },
2476 },
tomas petrf0f4ae72009-05-20 05:28:05 -03002477 { "Leadtek WinFast DTV Dongle H",
2478 { &dib0700_usb_id_table[51], NULL },
2479 { NULL },
2480 },
Pete Hildebrandtc53d83c2009-08-05 11:46:38 -03002481 { "YUAN High-Tech STK7700D",
2482 { &dib0700_usb_id_table[54], NULL },
2483 { NULL },
2484 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002485 },
2486 .rc_interval = DEFAULT_RC_INTERVAL,
2487 .rc_key_map = dib0700_rc_keys,
2488 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2489 .rc_query = dib0700_rc_query
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002490 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2491 .num_adapters = 1,
2492 .adapter = {
2493 {
2494 .frontend_attach = s5h1411_frontend_attach,
2495 .tuner_attach = xc5000_tuner_attach,
2496
2497 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2498
2499 .size_of_priv = sizeof(struct
2500 dib0700_adapter_state),
2501 },
2502 },
2503
Devin Heitmuellerd2fc3bf2008-09-25 06:22:23 -03002504 .num_device_descs = 2,
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002505 .devices = {
2506 { "Pinnacle PCTV HD Pro USB Stick",
2507 { &dib0700_usb_id_table[40], NULL },
2508 { NULL },
2509 },
Devin Heitmuellerd2fc3bf2008-09-25 06:22:23 -03002510 { "Pinnacle PCTV HD USB Stick",
2511 { &dib0700_usb_id_table[41], NULL },
2512 { NULL },
2513 },
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002514 },
2515 .rc_interval = DEFAULT_RC_INTERVAL,
2516 .rc_key_map = dib0700_rc_keys,
2517 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2518 .rc_query = dib0700_rc_query
Michael Krufkyce904bc2009-01-19 01:12:55 -03002519 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2520 .num_adapters = 1,
2521 .adapter = {
2522 {
2523 .frontend_attach = lgdt3305_frontend_attach,
2524 .tuner_attach = mxl5007t_tuner_attach,
2525
2526 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2527
2528 .size_of_priv = sizeof(struct
2529 dib0700_adapter_state),
2530 },
2531 },
2532
2533 .num_device_descs = 2,
2534 .devices = {
2535 { "Hauppauge ATSC MiniCard (B200)",
2536 { &dib0700_usb_id_table[46], NULL },
2537 { NULL },
2538 },
2539 { "Hauppauge ATSC MiniCard (B210)",
2540 { &dib0700_usb_id_table[47], NULL },
2541 { NULL },
2542 },
2543 },
Olivier Grenied300bd62009-09-15 06:55:35 -03002544 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2545
2546 .num_adapters = 1,
2547 .adapter = {
2548 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002549 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2550 .pid_filter_count = 32,
2551 .pid_filter = stk70x0p_pid_filter,
2552 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier Grenied300bd62009-09-15 06:55:35 -03002553 .frontend_attach = stk7070p_frontend_attach,
2554 .tuner_attach = dib7770p_tuner_attach,
2555
2556 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2557
2558 .size_of_priv =
Patrick Boettcherdb481382009-09-15 07:16:51 -03002559 sizeof(struct dib0700_adapter_state),
Olivier Grenied300bd62009-09-15 06:55:35 -03002560 },
2561 },
2562
Patrick Boettcherdb481382009-09-15 07:16:51 -03002563 .num_device_descs = 2,
Olivier Grenied300bd62009-09-15 06:55:35 -03002564 .devices = {
2565 { "DiBcom STK7770P reference design",
2566 { &dib0700_usb_id_table[59], NULL },
2567 { NULL },
2568 },
Patrick Boettcher1e13c8f2009-09-19 05:24:40 -03002569 { "Terratec Cinergy T USB XXS (HD)/ T3",
2570 { &dib0700_usb_id_table[33],
2571 &dib0700_usb_id_table[52],
2572 &dib0700_usb_id_table[60], NULL},
Patrick Boettcherdb481382009-09-15 07:16:51 -03002573 { NULL },
2574 },
Olivier Grenied300bd62009-09-15 06:55:35 -03002575 },
Olivier Grenied300bd62009-09-15 06:55:35 -03002576 .rc_interval = DEFAULT_RC_INTERVAL,
2577 .rc_key_map = dib0700_rc_keys,
2578 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2579 .rc_query = dib0700_rc_query
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002580 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2581 .num_adapters = 1,
2582 .adapter = {
2583 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002584 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2585 .pid_filter_count = 32,
Olivier Grenie03245a52009-12-04 13:27:57 -03002586 .pid_filter = stk80xx_pid_filter,
2587 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002588 .frontend_attach = stk807x_frontend_attach,
2589 .tuner_attach = dib807x_tuner_attach,
2590
2591 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2592
2593 .size_of_priv =
2594 sizeof(struct dib0700_adapter_state),
2595 },
2596 },
2597
S?rgio Fortier8a378e82009-09-28 04:19:21 -03002598 .num_device_descs = 3,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002599 .devices = {
2600 { "DiBcom STK807xP reference design",
2601 { &dib0700_usb_id_table[62], NULL },
2602 { NULL },
2603 },
Mauro Carvalho Chehabaaeab302009-09-16 09:18:26 -03002604 { "Prolink Pixelview SBTVD",
2605 { &dib0700_usb_id_table[63], NULL },
2606 { NULL },
2607 },
S?rgio Fortier8a378e82009-09-28 04:19:21 -03002608 { "EvolutePC TVWay+",
2609 { &dib0700_usb_id_table[64], NULL },
2610 { NULL },
2611 },
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002612 },
2613
2614 .rc_interval = DEFAULT_RC_INTERVAL,
2615 .rc_key_map = dib0700_rc_keys,
2616 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2617 .rc_query = dib0700_rc_query
2618
2619 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2620 .num_adapters = 2,
2621 .adapter = {
2622 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002623 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2624 .pid_filter_count = 32,
Olivier Grenie03245a52009-12-04 13:27:57 -03002625 .pid_filter = stk80xx_pid_filter,
2626 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002627 .frontend_attach = stk807xpvr_frontend_attach0,
2628 .tuner_attach = dib807x_tuner_attach,
2629
2630 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2631
2632 .size_of_priv =
2633 sizeof(struct dib0700_adapter_state),
2634 },
2635 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002636 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2637 .pid_filter_count = 32,
Olivier Grenie03245a52009-12-04 13:27:57 -03002638 .pid_filter = stk80xx_pid_filter,
2639 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002640 .frontend_attach = stk807xpvr_frontend_attach1,
2641 .tuner_attach = dib807x_tuner_attach,
2642
2643 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2644
2645 .size_of_priv =
2646 sizeof(struct dib0700_adapter_state),
2647 },
2648 },
2649
2650 .num_device_descs = 1,
2651 .devices = {
2652 { "DiBcom STK807xPVR reference design",
2653 { &dib0700_usb_id_table[61], NULL },
2654 { NULL },
2655 },
2656 },
2657
2658 .rc_interval = DEFAULT_RC_INTERVAL,
2659 .rc_key_map = dib0700_rc_keys,
2660 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2661 .rc_query = dib0700_rc_query
Olivier Grenie03245a52009-12-04 13:27:57 -03002662 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2663 .num_adapters = 1,
2664 .adapter = {
2665 {
2666 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
2667 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2668 .pid_filter_count = 32,
2669 .pid_filter = stk80xx_pid_filter,
2670 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
2671 .frontend_attach = stk809x_frontend_attach,
2672 .tuner_attach = dib809x_tuner_attach,
2673
2674 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2675
2676 .size_of_priv =
2677 sizeof(struct dib0700_adapter_state),
2678 },
2679 },
2680
2681 .num_device_descs = 1,
2682 .devices = {
2683 { "DiBcom STK8096GP reference design",
2684 { &dib0700_usb_id_table[67], NULL },
2685 { NULL },
2686 },
2687 },
2688
2689 .rc_interval = DEFAULT_RC_INTERVAL,
2690 .rc_key_map = dib0700_rc_keys,
2691 .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys),
2692 .rc_query = dib0700_rc_query
Patrick Boettcher01373a52007-07-30 12:49:04 -03002693 },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002694};
2695
2696int dib0700_device_count = ARRAY_SIZE(dib0700_devices);