blob: 2ae74ba3acbba58b719f13191fa96dc8ba82046f [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;
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -0300480 struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300481 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 }
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -0300520 for (i=0;i<d->props.rc.legacy.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;
Mauro Carvalho Chehab34abf212010-07-31 11:24:57 -0300524 *event = keymap[i].keycode;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300525 *state = REMOTE_KEY_PRESSED;
Mauro Carvalho Chehab34abf212010-07-31 11:24:57 -0300526 d->last_event = keymap[i].keycode;
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 */
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -0300534 for (i = 0; i < d->props.rc.legacy.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]) {
Mauro Carvalho Chehab34abf212010-07-31 11:24:57 -0300537 if (d->last_event == keymap[i].keycode &&
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300538 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;
Mauro Carvalho Chehab34abf212010-07-31 11:24:57 -0300550 *event = keymap[i].keycode;
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300551 *state = REMOTE_KEY_PRESSED;
552 st->rc_toggle = key[3-1];
Mauro Carvalho Chehab34abf212010-07-31 11:24:57 -0300553 d->last_event = keymap[i].keycode;
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300554 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
Mauro Carvalho Chehab34abf212010-07-31 11:24:57 -0300565static struct ir_scancode ir_codes_dib0700_table[] = {
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 },
Michael Müller84e2f032010-04-26 22:18:57 -0300797
798 /* Key codes for the Elgato EyeTV Diversity silver remote,
799 set dvb_usb_dib0700_ir_proto=0 */
800 { 0x4501, KEY_POWER },
801 { 0x4502, KEY_MUTE },
802 { 0x4503, KEY_1 },
803 { 0x4504, KEY_2 },
804 { 0x4505, KEY_3 },
805 { 0x4506, KEY_4 },
806 { 0x4507, KEY_5 },
807 { 0x4508, KEY_6 },
808 { 0x4509, KEY_7 },
809 { 0x450a, KEY_8 },
810 { 0x450b, KEY_9 },
811 { 0x450c, KEY_LAST },
812 { 0x450d, KEY_0 },
813 { 0x450e, KEY_ENTER },
814 { 0x450f, KEY_RED },
815 { 0x4510, KEY_CHANNELUP },
816 { 0x4511, KEY_GREEN },
817 { 0x4512, KEY_VOLUMEDOWN },
818 { 0x4513, KEY_OK },
819 { 0x4514, KEY_VOLUMEUP },
820 { 0x4515, KEY_YELLOW },
821 { 0x4516, KEY_CHANNELDOWN },
822 { 0x4517, KEY_BLUE },
823 { 0x4518, KEY_LEFT }, /* Skip backwards */
824 { 0x4519, KEY_PLAYPAUSE },
825 { 0x451a, KEY_RIGHT }, /* Skip forward */
826 { 0x451b, KEY_REWIND },
827 { 0x451c, KEY_L }, /* Live */
828 { 0x451d, KEY_FASTFORWARD },
829 { 0x451e, KEY_STOP }, /* 'Reveal' for Teletext */
830 { 0x451f, KEY_MENU }, /* KEY_TEXT for Teletext */
831 { 0x4540, KEY_RECORD }, /* Font 'Size' for Teletext */
832 { 0x4541, KEY_SCREEN }, /* Full screen toggle, 'Hold' for Teletext */
833 { 0x4542, KEY_SELECT }, /* Select video input, 'Select' for Teletext */
Janne Grunau82f3d552007-07-30 13:50:28 -0300834};
Olivier DANET54d75eb2007-07-25 14:42:54 -0300835
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300836/* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
Patrick Boettchera75763f2006-10-18 08:34:16 -0300837static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
Olivier Grenie9c783032009-12-07 07:49:40 -0300838 BAND_UHF | BAND_VHF,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300839
840 /* 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,
841 * 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 -0300842 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
843 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300844
Olivier Grenie9c783032009-12-07 07:49:40 -0300845 712,
846 41,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300847
Olivier Grenie9c783032009-12-07 07:49:40 -0300848 0,
849 118,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300850
Olivier Grenie9c783032009-12-07 07:49:40 -0300851 0,
852 4095,
853 0,
854 0,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300855
Olivier Grenie9c783032009-12-07 07:49:40 -0300856 42598,
857 17694,
858 45875,
859 2621,
860 0,
861 76,
862 139,
863 52,
864 59,
865 107,
866 172,
867 57,
868 70,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300869
Olivier Grenie9c783032009-12-07 07:49:40 -0300870 21,
871 25,
872 28,
873 48,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300874
Olivier Grenie9c783032009-12-07 07:49:40 -0300875 1,
876 { 0,
877 107,
878 51800,
879 24700
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300880 },
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300881};
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300882
Patrick Boettchera75763f2006-10-18 08:34:16 -0300883static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
884 BAND_UHF | BAND_VHF,
885
886 /* 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,
887 * 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 -0300888 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
889 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
Patrick Boettchera75763f2006-10-18 08:34:16 -0300890
Olivier Grenie9c783032009-12-07 07:49:40 -0300891 712,
892 41,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300893
Olivier Grenie9c783032009-12-07 07:49:40 -0300894 0,
895 118,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300896
Olivier Grenie9c783032009-12-07 07:49:40 -0300897 0,
898 4095,
899 0,
900 0,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300901
Olivier Grenie9c783032009-12-07 07:49:40 -0300902 42598,
903 16384,
904 42598,
905 0,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300906
Olivier Grenie9c783032009-12-07 07:49:40 -0300907 0,
908 137,
909 255,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300910
Olivier Grenie9c783032009-12-07 07:49:40 -0300911 0,
912 255,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300913
Olivier Grenie9c783032009-12-07 07:49:40 -0300914 0,
915 0,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300916
Olivier Grenie9c783032009-12-07 07:49:40 -0300917 0,
918 41,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300919
Olivier Grenie9c783032009-12-07 07:49:40 -0300920 15,
921 25,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300922
Olivier Grenie9c783032009-12-07 07:49:40 -0300923 28,
924 48,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300925
Olivier Grenie9c783032009-12-07 07:49:40 -0300926 0,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300927};
928
929static struct dibx000_bandwidth_config stk7700p_pll_config = {
Olivier Grenie9c783032009-12-07 07:49:40 -0300930 60000, 30000,
931 1, 8, 3, 1, 0,
932 0, 0, 1, 1, 0,
933 (3 << 14) | (1 << 12) | (524 << 0),
934 60258167,
935 20452225,
936 30000000,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300937};
938
939static struct dib7000m_config stk7700p_dib7000m_config = {
940 .dvbt_mode = 1,
941 .output_mpeg2_in_188_bytes = 1,
942 .quartz_direct = 1,
943
944 .agc_config_count = 1,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300945 .agc = &stk7700p_7000m_mt2060_agc_config,
946 .bw = &stk7700p_pll_config,
947
948 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
949 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
950 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
951};
952
953static struct dib7000p_config stk7700p_dib7000p_config = {
954 .output_mpeg2_in_188_bytes = 1,
955
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300956 .agc_config_count = 1,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300957 .agc = &stk7700p_7000p_mt2060_agc_config,
958 .bw = &stk7700p_pll_config,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300959
960 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
961 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
962 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
963};
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300964
965static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
966{
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300967 struct dib0700_state *st = adap->dev->priv;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300968 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
Patrick Boettchera75763f2006-10-18 08:34:16 -0300969
970 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
971 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
972
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300973 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
Patrick Boettchera75763f2006-10-18 08:34:16 -0300974 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
975
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300976 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
Patrick Boettchera75763f2006-10-18 08:34:16 -0300977 dib0700_ctrl_clock(adap->dev, 72, 1);
978 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
979
980 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300981
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300982 st->mt2060_if1[0] = 1220;
Patrick Boettchera75763f2006-10-18 08:34:16 -0300983
984 if (dib7000pc_detection(&adap->dev->i2c_adap)) {
985 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
986 st->is_dib7000pc = 1;
987 } else
988 adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
989
990 return adap->fe == NULL ? -ENODEV : 0;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300991}
992
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300993static struct mt2060_config stk7700p_mt2060_config = {
994 0x60
995};
996
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300997static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
998{
Olivier DANETc52344f2008-01-25 06:50:07 -0300999 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
Patrick Boettcher69ea31e2006-10-17 18:28:14 -03001000 struct dib0700_state *st = adap->dev->priv;
Patrick Boettchera75763f2006-10-18 08:34:16 -03001001 struct i2c_adapter *tun_i2c;
Olivier DANETc52344f2008-01-25 06:50:07 -03001002 s8 a;
1003 int if1=1220;
Al Viroda5ee482008-05-21 00:31:21 -03001004 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
1005 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
Olivier DANETc52344f2008-01-25 06:50:07 -03001006 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
1007 }
Patrick Boettchera75763f2006-10-18 08:34:16 -03001008 if (st->is_dib7000pc)
1009 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1010 else
1011 tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1012
1013 return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config,
Olivier DANETc52344f2008-01-25 06:50:07 -03001014 if1) == NULL ? -ENODEV : 0;
Patrick Boettcherb7f54912006-09-19 12:51:37 -03001015}
1016
Patrick Boettcher01373a52007-07-30 12:49:04 -03001017/* DIB7070 generic */
1018static struct dibx000_agc_config dib7070_agc_config = {
1019 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
1020 /* 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,
1021 * 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 -03001022 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1023 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
Patrick Boettcher01373a52007-07-30 12:49:04 -03001024
Olivier Grenie9c783032009-12-07 07:49:40 -03001025 600,
1026 10,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001027
Olivier Grenie9c783032009-12-07 07:49:40 -03001028 0,
1029 118,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001030
Olivier Grenie9c783032009-12-07 07:49:40 -03001031 0,
1032 3530,
1033 1,
1034 5,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001035
Olivier Grenie9c783032009-12-07 07:49:40 -03001036 65535,
1037 0,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001038
Olivier Grenie9c783032009-12-07 07:49:40 -03001039 65535,
1040 0,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001041
Olivier Grenie9c783032009-12-07 07:49:40 -03001042 0,
1043 40,
1044 183,
1045 206,
1046 255,
1047 72,
1048 152,
1049 88,
1050 90,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001051
Olivier Grenie9c783032009-12-07 07:49:40 -03001052 17,
1053 27,
1054 23,
1055 51,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001056
Olivier Grenie9c783032009-12-07 07:49:40 -03001057 0,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001058};
1059
1060static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
1061{
Patrick Boettcher7e5ce652009-08-03 13:43:40 -03001062 deb_info("reset: %d", onoff);
Patrick Boettcher01373a52007-07-30 12:49:04 -03001063 return dib7000p_set_gpio(fe, 8, 0, !onoff);
1064}
1065
1066static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
1067{
Patrick Boettcher7e5ce652009-08-03 13:43:40 -03001068 deb_info("sleep: %d", onoff);
Patrick Boettcher01373a52007-07-30 12:49:04 -03001069 return dib7000p_set_gpio(fe, 9, 0, onoff);
1070}
1071
1072static struct dib0070_config dib7070p_dib0070_config[2] = {
1073 {
1074 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1075 .reset = dib7070_tuner_reset,
1076 .sleep = dib7070_tuner_sleep,
1077 .clock_khz = 12000,
Patrick Boettcher7e5ce652009-08-03 13:43:40 -03001078 .clock_pad_drive = 4,
1079 .charge_pump = 2,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001080 }, {
1081 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1082 .reset = dib7070_tuner_reset,
1083 .sleep = dib7070_tuner_sleep,
1084 .clock_khz = 12000,
Patrick Boettcher7e5ce652009-08-03 13:43:40 -03001085 .charge_pump = 2,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001086 }
1087};
1088
Olivier Grenied300bd62009-09-15 06:55:35 -03001089static struct dib0070_config dib7770p_dib0070_config = {
1090 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1091 .reset = dib7070_tuner_reset,
1092 .sleep = dib7070_tuner_sleep,
1093 .clock_khz = 12000,
1094 .clock_pad_drive = 0,
1095 .flip_chip = 1,
Olivier Grenieeac1fe12009-09-23 13:41:27 -03001096 .charge_pump = 2,
Olivier Grenied300bd62009-09-15 06:55:35 -03001097};
1098
Patrick Boettcher01373a52007-07-30 12:49:04 -03001099static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
1100{
1101 struct dvb_usb_adapter *adap = fe->dvb->priv;
1102 struct dib0700_adapter_state *state = adap->priv;
1103
1104 u16 offset;
1105 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1106 switch (band) {
1107 case BAND_VHF: offset = 950; break;
1108 case BAND_UHF:
1109 default: offset = 550; break;
1110 }
1111 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
1112 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1113 return state->set_param_save(fe, fep);
1114}
1115
Olivier Grenied300bd62009-09-15 06:55:35 -03001116static int dib7770_set_param_override(struct dvb_frontend *fe,
1117 struct dvb_frontend_parameters *fep)
1118{
1119 struct dvb_usb_adapter *adap = fe->dvb->priv;
1120 struct dib0700_adapter_state *state = adap->priv;
1121
1122 u16 offset;
1123 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1124 switch (band) {
1125 case BAND_VHF:
1126 dib7000p_set_gpio(fe, 0, 0, 1);
1127 offset = 850;
1128 break;
1129 case BAND_UHF:
1130 default:
1131 dib7000p_set_gpio(fe, 0, 0, 0);
1132 offset = 250;
1133 break;
1134 }
1135 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
1136 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1137 return state->set_param_save(fe, fep);
1138}
1139
1140static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
1141{
1142 struct dib0700_adapter_state *st = adap->priv;
1143 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe,
1144 DIBX000_I2C_INTERFACE_TUNER, 1);
1145
1146 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1147 &dib7770p_dib0070_config) == NULL)
1148 return -ENODEV;
1149
1150 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1151 adap->fe->ops.tuner_ops.set_params = dib7770_set_param_override;
1152 return 0;
1153}
1154
Patrick Boettcher01373a52007-07-30 12:49:04 -03001155static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
1156{
1157 struct dib0700_adapter_state *st = adap->priv;
1158 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1159
1160 if (adap->id == 0) {
1161 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
1162 return -ENODEV;
1163 } else {
1164 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
1165 return -ENODEV;
1166 }
1167
1168 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1169 adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override;
1170 return 0;
1171}
1172
Olivier Grenief8731f42009-09-18 04:08:43 -03001173static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
1174{
1175 return dib7000p_pid_filter(adapter->fe, index, pid, onoff);
1176}
1177
1178static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
1179{
1180 return dib7000p_pid_filter_ctrl(adapter->fe, onoff);
1181}
1182
Patrick Boettcher01373a52007-07-30 12:49:04 -03001183static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
Olivier Grenie9c783032009-12-07 07:49:40 -03001184 60000, 15000,
1185 1, 20, 3, 1, 0,
1186 0, 0, 1, 1, 2,
1187 (3 << 14) | (1 << 12) | (524 << 0),
1188 (0 << 25) | 0,
1189 20452225,
1190 12000000,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001191};
1192
1193static struct dib7000p_config dib7070p_dib7000p_config = {
1194 .output_mpeg2_in_188_bytes = 1,
1195
1196 .agc_config_count = 1,
1197 .agc = &dib7070_agc_config,
1198 .bw = &dib7070_bw_config_12_mhz,
Patrick Boettcher3cb2c392008-01-25 07:25:20 -03001199 .tuner_is_baseband = 1,
1200 .spur_protect = 1,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001201
1202 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1203 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1204 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1205
1206 .hostbus_diversity = 1,
1207};
1208
1209/* STK7070P */
1210static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
1211{
Al Viroda5ee482008-05-21 00:31:21 -03001212 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
1213 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
1214 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
1215 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03001216 else
Al Viroda5ee482008-05-21 00:31:21 -03001217 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
Patrick Boettcher01373a52007-07-30 12:49:04 -03001218 msleep(10);
1219 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1220 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1221 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1222 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1223
1224 dib0700_ctrl_clock(adap->dev, 72, 1);
1225
1226 msleep(10);
1227 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1228 msleep(10);
1229 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1230
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -03001231 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1232 &dib7070p_dib7000p_config) != 0) {
1233 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1234 __func__);
1235 return -ENODEV;
1236 }
Patrick Boettcher01373a52007-07-30 12:49:04 -03001237
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03001238 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
1239 &dib7070p_dib7000p_config);
Patrick Boettcher01373a52007-07-30 12:49:04 -03001240 return adap->fe == NULL ? -ENODEV : 0;
1241}
1242
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001243/* DIB807x generic */
1244static struct dibx000_agc_config dib807x_agc_config[2] = {
1245 {
1246 BAND_VHF,
1247 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1248 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1249 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1250 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1251 * P_agc_write=0 */
1252 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1253 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1254 (0 << 0), /* setup*/
1255
1256 600, /* inv_gain*/
1257 10, /* time_stabiliz*/
1258
1259 0, /* alpha_level*/
1260 118, /* thlock*/
1261
1262 0, /* wbd_inv*/
1263 3530, /* wbd_ref*/
1264 1, /* wbd_sel*/
1265 5, /* wbd_alpha*/
1266
1267 65535, /* agc1_max*/
1268 0, /* agc1_min*/
1269
1270 65535, /* agc2_max*/
1271 0, /* agc2_min*/
1272
1273 0, /* agc1_pt1*/
1274 40, /* agc1_pt2*/
1275 183, /* agc1_pt3*/
1276 206, /* agc1_slope1*/
1277 255, /* agc1_slope2*/
1278 72, /* agc2_pt1*/
1279 152, /* agc2_pt2*/
1280 88, /* agc2_slope1*/
1281 90, /* agc2_slope2*/
1282
1283 17, /* alpha_mant*/
1284 27, /* alpha_exp*/
1285 23, /* beta_mant*/
1286 51, /* beta_exp*/
1287
1288 0, /* perform_agc_softsplit*/
1289 }, {
1290 BAND_UHF,
1291 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1292 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1293 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1294 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1295 * P_agc_write=0 */
1296 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1297 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1298 (0 << 0), /* setup */
1299
1300 600, /* inv_gain*/
1301 10, /* time_stabiliz*/
1302
1303 0, /* alpha_level*/
1304 118, /* thlock*/
1305
1306 0, /* wbd_inv*/
1307 3530, /* wbd_ref*/
1308 1, /* wbd_sel*/
1309 5, /* wbd_alpha*/
1310
1311 65535, /* agc1_max*/
1312 0, /* agc1_min*/
1313
1314 65535, /* agc2_max*/
1315 0, /* agc2_min*/
1316
1317 0, /* agc1_pt1*/
1318 40, /* agc1_pt2*/
1319 183, /* agc1_pt3*/
1320 206, /* agc1_slope1*/
1321 255, /* agc1_slope2*/
1322 72, /* agc2_pt1*/
1323 152, /* agc2_pt2*/
1324 88, /* agc2_slope1*/
1325 90, /* agc2_slope2*/
1326
1327 17, /* alpha_mant*/
1328 27, /* alpha_exp*/
1329 23, /* beta_mant*/
1330 51, /* beta_exp*/
1331
1332 0, /* perform_agc_softsplit*/
1333 }
1334};
1335
1336static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
1337 60000, 15000, /* internal, sampling*/
1338 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/
1339 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
1340 ADClkSrc, modulo */
1341 (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1342 (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1343 18179755, /* timf*/
1344 12000000, /* xtal_hz*/
1345};
1346
1347static struct dib8000_config dib807x_dib8000_config[2] = {
1348 {
1349 .output_mpeg2_in_188_bytes = 1,
1350
1351 .agc_config_count = 2,
1352 .agc = dib807x_agc_config,
1353 .pll = &dib807x_bw_config_12_mhz,
1354 .tuner_is_baseband = 1,
1355
1356 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1357 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1358 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1359
1360 .hostbus_diversity = 1,
1361 .div_cfg = 1,
1362 .agc_control = &dib0070_ctrl_agc_filter,
1363 .output_mode = OUTMODE_MPEG2_FIFO,
1364 .drives = 0x2d98,
1365 }, {
1366 .output_mpeg2_in_188_bytes = 1,
1367
1368 .agc_config_count = 2,
1369 .agc = dib807x_agc_config,
1370 .pll = &dib807x_bw_config_12_mhz,
1371 .tuner_is_baseband = 1,
1372
1373 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1374 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1375 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1376
1377 .hostbus_diversity = 1,
1378 .agc_control = &dib0070_ctrl_agc_filter,
1379 .output_mode = OUTMODE_MPEG2_FIFO,
1380 .drives = 0x2d98,
1381 }
1382};
1383
Olivier Grenie03245a52009-12-04 13:27:57 -03001384static int dib80xx_tuner_reset(struct dvb_frontend *fe, int onoff)
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001385{
1386 return dib8000_set_gpio(fe, 5, 0, !onoff);
1387}
1388
Olivier Grenie03245a52009-12-04 13:27:57 -03001389static int dib80xx_tuner_sleep(struct dvb_frontend *fe, int onoff)
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001390{
1391 return dib8000_set_gpio(fe, 0, 0, onoff);
1392}
1393
1394static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
1395 { 240, 7},
1396 { 0xffff, 6},
1397};
1398
1399static struct dib0070_config dib807x_dib0070_config[2] = {
1400 {
1401 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
Olivier Grenie03245a52009-12-04 13:27:57 -03001402 .reset = dib80xx_tuner_reset,
1403 .sleep = dib80xx_tuner_sleep,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001404 .clock_khz = 12000,
1405 .clock_pad_drive = 4,
1406 .vga_filter = 1,
1407 .force_crystal_mode = 1,
1408 .enable_third_order_filter = 1,
1409 .charge_pump = 0,
1410 .wbd_gain = dib8070_wbd_gain_cfg,
1411 .osc_buffer_state = 0,
1412 .freq_offset_khz_uhf = -100,
1413 .freq_offset_khz_vhf = -100,
1414 }, {
1415 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
Olivier Grenie03245a52009-12-04 13:27:57 -03001416 .reset = dib80xx_tuner_reset,
1417 .sleep = dib80xx_tuner_sleep,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001418 .clock_khz = 12000,
1419 .clock_pad_drive = 2,
1420 .vga_filter = 1,
1421 .force_crystal_mode = 1,
1422 .enable_third_order_filter = 1,
1423 .charge_pump = 0,
1424 .wbd_gain = dib8070_wbd_gain_cfg,
1425 .osc_buffer_state = 0,
1426 .freq_offset_khz_uhf = -25,
1427 .freq_offset_khz_vhf = -25,
1428 }
1429};
1430
1431static int dib807x_set_param_override(struct dvb_frontend *fe,
1432 struct dvb_frontend_parameters *fep)
1433{
1434 struct dvb_usb_adapter *adap = fe->dvb->priv;
1435 struct dib0700_adapter_state *state = adap->priv;
1436
1437 u16 offset = dib0070_wbd_offset(fe);
1438 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1439 switch (band) {
1440 case BAND_VHF:
1441 offset += 750;
1442 break;
1443 case BAND_UHF: /* fall-thru wanted */
1444 default:
1445 offset += 250; break;
1446 }
1447 deb_info("WBD for DiB8000: %d\n", offset);
1448 dib8000_set_wbd_ref(fe, offset);
1449
1450 return state->set_param_save(fe, fep);
1451}
1452
1453static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1454{
1455 struct dib0700_adapter_state *st = adap->priv;
1456 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe,
1457 DIBX000_I2C_INTERFACE_TUNER, 1);
1458
1459 if (adap->id == 0) {
1460 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1461 &dib807x_dib0070_config[0]) == NULL)
1462 return -ENODEV;
1463 } else {
1464 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1465 &dib807x_dib0070_config[1]) == NULL)
1466 return -ENODEV;
1467 }
1468
1469 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1470 adap->fe->ops.tuner_ops.set_params = dib807x_set_param_override;
1471 return 0;
1472}
1473
Olivier Grenie9c783032009-12-07 07:49:40 -03001474static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index,
1475 u16 pid, int onoff)
Olivier Grenief8731f42009-09-18 04:08:43 -03001476{
1477 return dib8000_pid_filter(adapter->fe, index, pid, onoff);
1478}
1479
Olivier Grenie9c783032009-12-07 07:49:40 -03001480static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter,
1481 int onoff)
Olivier Grenief8731f42009-09-18 04:08:43 -03001482{
1483 return dib8000_pid_filter_ctrl(adapter->fe, onoff);
1484}
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001485
1486/* STK807x */
1487static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
1488{
1489 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1490 msleep(10);
1491 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1492 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1493 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1494
1495 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1496
1497 dib0700_ctrl_clock(adap->dev, 72, 1);
1498
1499 msleep(10);
1500 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1501 msleep(10);
1502 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1503
1504 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1505 0x80);
1506
1507 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1508 &dib807x_dib8000_config[0]);
1509
1510 return adap->fe == NULL ? -ENODEV : 0;
1511}
1512
1513/* STK807xPVR */
1514static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
1515{
1516 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1517 msleep(30);
1518 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1519 msleep(500);
1520 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1521 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1522 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1523
1524 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1525
1526 dib0700_ctrl_clock(adap->dev, 72, 1);
1527
1528 msleep(10);
1529 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1530 msleep(10);
1531 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1532
1533 /* initialize IC 0 */
Olivier Grenie9542f502009-12-07 08:09:04 -03001534 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80);
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001535
1536 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1537 &dib807x_dib8000_config[0]);
1538
1539 return adap->fe == NULL ? -ENODEV : 0;
1540}
1541
1542static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
1543{
1544 /* initialize IC 1 */
Olivier Grenie9542f502009-12-07 08:09:04 -03001545 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82);
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001546
1547 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82,
1548 &dib807x_dib8000_config[1]);
1549
1550 return adap->fe == NULL ? -ENODEV : 0;
1551}
1552
Olivier Grenie03245a52009-12-04 13:27:57 -03001553/* STK8096GP */
1554struct dibx000_agc_config dib8090_agc_config[2] = {
1555 {
1556 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
Olivier Grenie9c783032009-12-07 07:49:40 -03001557 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1558 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1559 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1560 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1561 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
Olivier Grenie03245a52009-12-04 13:27:57 -03001562
Olivier Grenie9c783032009-12-07 07:49:40 -03001563 787,
1564 10,
Olivier Grenie03245a52009-12-04 13:27:57 -03001565
Olivier Grenie9c783032009-12-07 07:49:40 -03001566 0,
1567 118,
Olivier Grenie03245a52009-12-04 13:27:57 -03001568
Olivier Grenie9c783032009-12-07 07:49:40 -03001569 0,
1570 3530,
1571 1,
1572 5,
Olivier Grenie03245a52009-12-04 13:27:57 -03001573
Olivier Grenie9c783032009-12-07 07:49:40 -03001574 65535,
1575 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001576
Olivier Grenie9c783032009-12-07 07:49:40 -03001577 65535,
1578 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001579
Olivier Grenie9c783032009-12-07 07:49:40 -03001580 0,
1581 32,
1582 114,
1583 143,
1584 144,
1585 114,
1586 227,
1587 116,
1588 117,
Olivier Grenie03245a52009-12-04 13:27:57 -03001589
Olivier Grenie9c783032009-12-07 07:49:40 -03001590 28,
1591 26,
1592 31,
1593 51,
Olivier Grenie03245a52009-12-04 13:27:57 -03001594
Olivier Grenie9c783032009-12-07 07:49:40 -03001595 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001596 },
1597 {
1598 BAND_CBAND,
Olivier Grenie9c783032009-12-07 07:49:40 -03001599 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
1600 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1601 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */
1602 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1603 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
Olivier Grenie03245a52009-12-04 13:27:57 -03001604
Olivier Grenie9c783032009-12-07 07:49:40 -03001605 787,
1606 10,
Olivier Grenie03245a52009-12-04 13:27:57 -03001607
Olivier Grenie9c783032009-12-07 07:49:40 -03001608 0,
1609 118,
Olivier Grenie03245a52009-12-04 13:27:57 -03001610
Olivier Grenie9c783032009-12-07 07:49:40 -03001611 0,
1612 3530,
1613 1,
1614 5,
Olivier Grenie03245a52009-12-04 13:27:57 -03001615
Olivier Grenie9c783032009-12-07 07:49:40 -03001616 0,
1617 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001618
Olivier Grenie9c783032009-12-07 07:49:40 -03001619 65535,
1620 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001621
Olivier Grenie9c783032009-12-07 07:49:40 -03001622 0,
1623 32,
1624 114,
1625 143,
1626 144,
1627 114,
1628 227,
1629 116,
1630 117,
Olivier Grenie03245a52009-12-04 13:27:57 -03001631
Olivier Grenie9c783032009-12-07 07:49:40 -03001632 28,
1633 26,
1634 31,
1635 51,
Olivier Grenie03245a52009-12-04 13:27:57 -03001636
Olivier Grenie9c783032009-12-07 07:49:40 -03001637 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001638 }
1639};
1640
1641static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = {
Olivier Grenie9c783032009-12-07 07:49:40 -03001642 54000, 13500,
1643 1, 18, 3, 1, 0,
1644 0, 0, 1, 1, 2,
1645 (3 << 14) | (1 << 12) | (599 << 0),
1646 (0 << 25) | 0,
1647 20199727,
1648 12000000,
Olivier Grenie03245a52009-12-04 13:27:57 -03001649};
1650
1651static int dib8090_get_adc_power(struct dvb_frontend *fe)
1652{
1653 return dib8000_get_adc_power(fe, 1);
1654}
1655
1656static struct dib8000_config dib809x_dib8000_config = {
1657 .output_mpeg2_in_188_bytes = 1,
1658
1659 .agc_config_count = 2,
1660 .agc = dib8090_agc_config,
1661 .agc_control = dib0090_dcc_freq,
1662 .pll = &dib8090_pll_config_12mhz,
1663 .tuner_is_baseband = 1,
1664
1665 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1666 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1667 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1668
1669 .hostbus_diversity = 1,
1670 .div_cfg = 0x31,
1671 .output_mode = OUTMODE_MPEG2_FIFO,
1672 .drives = 0x2d98,
1673 .diversity_delay = 144,
1674 .refclksel = 3,
1675};
1676
1677static struct dib0090_config dib809x_dib0090_config = {
1678 .io.pll_bypass = 1,
1679 .io.pll_range = 1,
1680 .io.pll_prediv = 1,
1681 .io.pll_loopdiv = 20,
1682 .io.adc_clock_ratio = 8,
1683 .io.pll_int_loop_filt = 0,
1684 .io.clock_khz = 12000,
1685 .reset = dib80xx_tuner_reset,
1686 .sleep = dib80xx_tuner_sleep,
1687 .clkouttobamse = 1,
1688 .analog_output = 1,
1689 .i2c_address = DEFAULT_DIB0090_I2C_ADDRESS,
1690 .wbd_vhf_offset = 100,
1691 .wbd_cband_offset = 450,
1692 .use_pwm_agc = 1,
1693 .clkoutdrive = 1,
1694 .get_adc_power = dib8090_get_adc_power,
1695 .freq_offset_khz_uhf = 0,
1696 .freq_offset_khz_vhf = -143,
1697};
1698
1699static int dib8096_set_param_override(struct dvb_frontend *fe,
1700 struct dvb_frontend_parameters *fep)
1701{
1702 struct dvb_usb_adapter *adap = fe->dvb->priv;
1703 struct dib0700_adapter_state *state = adap->priv;
1704 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1705 u16 offset;
1706 int ret = 0;
1707 enum frontend_tune_state tune_state = CT_SHUTDOWN;
1708 u16 ltgain, rf_gain_limit;
1709
1710 ret = state->set_param_save(fe, fep);
1711 if (ret < 0)
1712 return ret;
1713
1714 switch (band) {
Olivier Grenie9c783032009-12-07 07:49:40 -03001715 case BAND_VHF:
Olivier Grenie03245a52009-12-04 13:27:57 -03001716 offset = 100;
1717 break;
Olivier Grenie9c783032009-12-07 07:49:40 -03001718 case BAND_UHF:
Olivier Grenie03245a52009-12-04 13:27:57 -03001719 offset = 550;
1720 break;
Olivier Grenie9c783032009-12-07 07:49:40 -03001721 default:
Olivier Grenie03245a52009-12-04 13:27:57 -03001722 offset = 0;
1723 break;
1724 }
1725 offset += (dib0090_get_wbd_offset(fe) * 8 * 18 / 33 + 1) / 2;
1726 dib8000_set_wbd_ref(fe, offset);
1727
1728
Olivier Grenie9c783032009-12-07 07:49:40 -03001729 if (band == BAND_CBAND) {
Olivier Grenie03245a52009-12-04 13:27:57 -03001730 deb_info("tuning in CBAND - soft-AGC startup\n");
1731 /* TODO specific wbd target for dib0090 - needed for startup ? */
1732 dib0090_set_tune_state(fe, CT_AGC_START);
Olivier Grenie9c783032009-12-07 07:49:40 -03001733 do {
1734 ret = dib0090_gain_control(fe);
1735 msleep(ret);
1736 tune_state = dib0090_get_tune_state(fe);
1737 if (tune_state == CT_AGC_STEP_0)
1738 dib8000_set_gpio(fe, 6, 0, 1);
1739 else if (tune_state == CT_AGC_STEP_1) {
1740 dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, &ltgain);
1741 if (rf_gain_limit == 0)
1742 dib8000_set_gpio(fe, 6, 0, 0);
1743 }
1744 } while (tune_state < CT_AGC_STOP);
Olivier Grenie03245a52009-12-04 13:27:57 -03001745 dib0090_pwm_gain_reset(fe);
1746 dib8000_pwm_agc_reset(fe);
1747 dib8000_set_tune_state(fe, CT_DEMOD_START);
Olivier Grenie9c783032009-12-07 07:49:40 -03001748 } else {
Olivier Grenie03245a52009-12-04 13:27:57 -03001749 deb_info("not tuning in CBAND - standard AGC startup\n");
1750 dib0090_pwm_gain_reset(fe);
1751 }
1752
1753 return 0;
1754}
1755
1756static int dib809x_tuner_attach(struct dvb_usb_adapter *adap)
1757{
1758 struct dib0700_adapter_state *st = adap->priv;
1759 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1760
1761 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1762 return -ENODEV;
1763
1764 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1765 adap->fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1766 return 0;
1767}
1768
1769static int stk809x_frontend_attach(struct dvb_usb_adapter *adap)
1770{
1771 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1772 msleep(10);
1773 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1774 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1775 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1776
1777 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1778
1779 dib0700_ctrl_clock(adap->dev, 72, 1);
1780
1781 msleep(10);
1782 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1783 msleep(10);
1784 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1785
1786 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80);
1787
1788 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config);
1789
1790 return adap->fe == NULL ? -ENODEV : 0;
1791}
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001792
Patrick Boettcher01373a52007-07-30 12:49:04 -03001793/* STK7070PD */
1794static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
1795 {
1796 .output_mpeg2_in_188_bytes = 1,
1797
1798 .agc_config_count = 1,
1799 .agc = &dib7070_agc_config,
1800 .bw = &dib7070_bw_config_12_mhz,
Patrick Boettcher3cb2c392008-01-25 07:25:20 -03001801 .tuner_is_baseband = 1,
1802 .spur_protect = 1,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001803
1804 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1805 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1806 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1807
1808 .hostbus_diversity = 1,
1809 }, {
1810 .output_mpeg2_in_188_bytes = 1,
1811
1812 .agc_config_count = 1,
1813 .agc = &dib7070_agc_config,
1814 .bw = &dib7070_bw_config_12_mhz,
Patrick Boettcher3cb2c392008-01-25 07:25:20 -03001815 .tuner_is_baseband = 1,
1816 .spur_protect = 1,
Patrick Boettcher01373a52007-07-30 12:49:04 -03001817
1818 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
1819 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
1820 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1821
1822 .hostbus_diversity = 1,
1823 }
1824};
1825
1826static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
1827{
1828 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1829 msleep(10);
1830 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1831 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1832 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1833 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1834
1835 dib0700_ctrl_clock(adap->dev, 72, 1);
1836
1837 msleep(10);
1838 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1839 msleep(10);
1840 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1841
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -03001842 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
1843 stk7070pd_dib7000p_config) != 0) {
1844 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1845 __func__);
1846 return -ENODEV;
1847 }
Patrick Boettcher01373a52007-07-30 12:49:04 -03001848
1849 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
1850 return adap->fe == NULL ? -ENODEV : 0;
1851}
1852
1853static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
1854{
1855 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
1856 return adap->fe == NULL ? -ENODEV : 0;
1857}
1858
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001859/* S5H1411 */
1860static struct s5h1411_config pinnacle_801e_config = {
1861 .output_mode = S5H1411_PARALLEL_OUTPUT,
1862 .gpio = S5H1411_GPIO_OFF,
1863 .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
1864 .qam_if = S5H1411_IF_44000,
1865 .vsb_if = S5H1411_IF_44000,
1866 .inversion = S5H1411_INVERSION_OFF,
1867 .status_mode = S5H1411_DEMODLOCKING
1868};
1869
1870/* Pinnacle PCTV HD Pro 801e GPIOs map:
1871 GPIO0 - currently unknown
1872 GPIO1 - xc5000 tuner reset
1873 GPIO2 - CX25843 sleep
1874 GPIO3 - currently unknown
1875 GPIO4 - currently unknown
1876 GPIO6 - currently unknown
1877 GPIO7 - currently unknown
1878 GPIO9 - currently unknown
1879 GPIO10 - CX25843 reset
1880 */
1881static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
1882{
1883 struct dib0700_state *st = adap->dev->priv;
1884
1885 /* Make use of the new i2c functions from FW 1.20 */
1886 st->fw_use_new_i2c_api = 1;
1887
1888 /* The s5h1411 requires the dib0700 to not be in master mode */
1889 st->disable_streaming_master_mode = 1;
1890
1891 /* All msleep values taken from Windows USB trace */
1892 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
1893 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
1894 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1895 msleep(400);
1896 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1897 msleep(60);
1898 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1899 msleep(30);
1900 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1901 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1902 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1903 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1904 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
1905 msleep(30);
1906
1907 /* Put the CX25843 to sleep for now since we're in digital mode */
1908 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
1909
1910 /* GPIOs are initialized, do the attach */
1911 adap->fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
1912 &adap->dev->i2c_adap);
1913 return adap->fe == NULL ? -ENODEV : 0;
1914}
1915
Michael Krufky767f3b32008-09-25 09:47:07 -03001916static int dib0700_xc5000_tuner_callback(void *priv, int component,
1917 int command, int arg)
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001918{
1919 struct dvb_usb_adapter *adap = priv;
1920
Devin Heitmueller79025a92008-10-06 12:07:48 -03001921 if (command == XC5000_TUNER_RESET) {
1922 /* Reset the tuner */
1923 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
Devin Heitmuellerf0f46332009-05-04 21:57:41 -03001924 msleep(10);
Devin Heitmueller79025a92008-10-06 12:07:48 -03001925 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
Devin Heitmuellerf0f46332009-05-04 21:57:41 -03001926 msleep(10);
Devin Heitmueller79025a92008-10-06 12:07:48 -03001927 } else {
1928 err("xc5000: unknown tuner callback command: %d\n", command);
1929 return -EINVAL;
1930 }
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001931
1932 return 0;
1933}
1934
1935static struct xc5000_config s5h1411_xc5000_tunerconfig = {
1936 .i2c_address = 0x64,
1937 .if_khz = 5380,
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001938};
1939
1940static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
1941{
Devin Heitmueller79025a92008-10-06 12:07:48 -03001942 /* FIXME: generalize & move to common area */
1943 adap->fe->callback = dib0700_xc5000_tuner_callback;
1944
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001945 return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap,
Michael Krufky767f3b32008-09-25 09:47:07 -03001946 &s5h1411_xc5000_tunerconfig)
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03001947 == NULL ? -ENODEV : 0;
1948}
1949
Michael Krufkyce904bc2009-01-19 01:12:55 -03001950static struct lgdt3305_config hcw_lgdt3305_config = {
1951 .i2c_addr = 0x0e,
1952 .mpeg_mode = LGDT3305_MPEG_PARALLEL,
1953 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
1954 .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
1955 .deny_i2c_rptr = 0,
1956 .spectral_inversion = 1,
1957 .qam_if_khz = 6000,
1958 .vsb_if_khz = 6000,
1959 .usref_8vsb = 0x0500,
1960};
1961
1962static struct mxl5007t_config hcw_mxl5007t_config = {
1963 .xtal_freq_hz = MxL_XTAL_25_MHZ,
1964 .if_freq_hz = MxL_IF_6_MHZ,
1965 .invert_if = 1,
1966};
1967
1968/* TIGER-ATSC map:
1969 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
1970 GPIO1 - ANT_SEL (H: VPA, L: MCX)
1971 GPIO4 - SCL2
1972 GPIO6 - EN_TUNER
1973 GPIO7 - SDA2
1974 GPIO10 - DEM_RST
1975
1976 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
1977 */
1978static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
1979{
1980 struct dib0700_state *st = adap->dev->priv;
1981
1982 /* Make use of the new i2c functions from FW 1.20 */
1983 st->fw_use_new_i2c_api = 1;
1984
1985 st->disable_streaming_master_mode = 1;
1986
1987 /* fe power enable */
1988 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1989 msleep(30);
1990 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1991 msleep(30);
1992
1993 /* demod reset */
1994 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1995 msleep(30);
1996 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1997 msleep(30);
1998 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1999 msleep(30);
2000
2001 adap->fe = dvb_attach(lgdt3305_attach,
2002 &hcw_lgdt3305_config,
2003 &adap->dev->i2c_adap);
2004
2005 return adap->fe == NULL ? -ENODEV : 0;
2006}
2007
2008static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
2009{
2010 return dvb_attach(mxl5007t_attach, adap->fe,
2011 &adap->dev->i2c_adap, 0x60,
2012 &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
2013}
2014
2015
Patrick Boettcher01373a52007-07-30 12:49:04 -03002016/* DVB-USB and USB stuff follows */
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002017struct usb_device_id dib0700_usb_id_table[] = {
Patrick Boettcher01373a52007-07-30 12:49:04 -03002018/* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002019 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
2020 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
2021 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
2022 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
Patrick Boettcher01373a52007-07-30 12:49:04 -03002023/* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002024 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
2025 { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
2026 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
2027 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
Patrick Boettcher01373a52007-07-30 12:49:04 -03002028/* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002029 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
2030 { USB_DEVICE(USB_VID_TERRATEC,
2031 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
2032 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
2033 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
Patrick Boettcher01373a52007-07-30 12:49:04 -03002034/* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002035 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
2036 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
2037 { USB_DEVICE(USB_VID_PINNACLE,
2038 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
2039 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
Joachim Steigerfa3b8772007-10-08 20:08:46 -03002040/* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002041 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
2042 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
2043 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
2044 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
2045/* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
2046 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
2047 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
2048 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
2049 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
2050/* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
2051 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
2052 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
Alexander Simondc888072008-03-29 21:37:54 -03002053 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
Darryl Green5da4e2c2008-03-29 21:47:43 -03002054 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
Michael Krufkyaf2a8872008-09-03 17:12:24 -03002055/* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
Michael Krufky9a0c04a2008-09-03 17:12:24 -03002056 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
Finn Thain17a370b2008-09-06 13:42:47 -03002057 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
Daniel Oliveira Nascimento8751aaa2008-09-07 12:39:44 -03002058 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
Albert Comerma57697432008-09-07 12:43:33 -03002059 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002060/* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
Devin Heitmuellerd2fc3bf2008-09-25 06:22:23 -03002061 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03002062 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
Nicolas Fournierdb4b2d12009-01-13 07:15:25 -03002063 { USB_DEVICE(USB_VID_TERRATEC,
2064 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
sebastian.blanes@gmail.com0a6e1ed2009-02-24 14:51:43 -03002065 { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
Pascal Terjan9abb6e62009-02-26 10:31:41 -03002066/* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
Michael Krufkyce904bc2009-01-19 01:12:55 -03002067 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
2068 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
Xoan Loureiro16ba1ee2009-03-29 08:43:36 -03002069 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
Klaus Flittner919a5482009-03-29 09:12:06 -03002070 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
Armin Schenker513846e2009-04-20 11:57:49 -03002071/* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
tomas petrf0f4ae72009-05-20 05:28:05 -03002072 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
Patrick Boettchera9b8fe32009-05-20 05:35:02 -03002073 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
2074 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
Pete Hildebrandtc53d83c2009-08-05 11:46:38 -03002075 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
Olivier Grenie74b76f22009-09-02 08:19:19 -03002076/* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
2077 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
Patrick Boettchere4147532009-11-30 13:52:57 -03002078 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV73ESE) },
2079 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV282E) },
Olivier Grenied300bd62009-09-15 06:55:35 -03002080 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
Patrick Boettcherdb481382009-09-15 07:16:51 -03002081/* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002082 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
2083 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
Mauro Carvalho Chehabaaeab302009-09-16 09:18:26 -03002084 { USB_DEVICE(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD) },
S?rgio Fortier8a378e82009-09-28 04:19:21 -03002085 { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },
Patrick Boettcher20232c42009-12-01 12:08:56 -03002086/* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
Patrick Boettchere4147532009-11-30 13:52:57 -03002087 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
Olivier Grenie03245a52009-12-04 13:27:57 -03002088 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) },
Michael Müller84e2f032010-04-26 22:18:57 -03002089 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002090 { 0 } /* Terminating entry */
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002091};
2092MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
2093
2094#define DIB0700_DEFAULT_DEVICE_PROPERTIES \
2095 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
2096 .usb_ctrl = DEVICE_SPECIFIC, \
Devin Heitmuellerbdc203e2008-09-06 13:45:27 -03002097 .firmware = "dvb-usb-dib0700-1.20.fw", \
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002098 .download_firmware = dib0700_download_firmware, \
Patrick Boettcher6958eff2006-09-19 12:51:40 -03002099 .no_reconnect = 1, \
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002100 .size_of_priv = sizeof(struct dib0700_state), \
Patrick Boettcher6958eff2006-09-19 12:51:40 -03002101 .i2c_algo = &dib0700_i2c_algo, \
2102 .identify_state = dib0700_identify_state
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002103
2104#define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
2105 .streaming_ctrl = dib0700_streaming_ctrl, \
2106 .stream = { \
2107 .type = USB_BULK, \
2108 .count = 4, \
2109 .endpoint = ep, \
2110 .u = { \
2111 .bulk = { \
2112 .buffersize = 39480, \
2113 } \
2114 } \
2115 }
2116
2117struct dvb_usb_device_properties dib0700_devices[] = {
2118 {
2119 DIB0700_DEFAULT_DEVICE_PROPERTIES,
2120
2121 .num_adapters = 1,
2122 .adapter = {
2123 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002124 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2125 .pid_filter_count = 32,
2126 .pid_filter = stk70x0p_pid_filter,
2127 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002128 .frontend_attach = stk7700p_frontend_attach,
2129 .tuner_attach = stk7700p_tuner_attach,
2130
2131 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2132 },
2133 },
2134
dominik67053a42007-11-10 19:23:31 -03002135 .num_device_descs = 8,
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002136 .devices = {
2137 { "DiBcom STK7700P reference design",
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002138 { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002139 { NULL },
2140 },
2141 { "Hauppauge Nova-T Stick",
Stefan Trabyf9aeba42006-11-12 13:02:51 -03002142 { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002143 { NULL },
2144 },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002145 { "AVerMedia AVerTV DVB-T Volar",
Jose Carlos Garcia Sogoced8fec2006-11-14 05:01:47 -03002146 { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002147 { NULL },
2148 },
2149 { "Compro Videomate U500",
Patrick Boettcher1f8ca4b2007-07-30 14:24:37 -03002150 { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002151 { NULL },
Henning Schroeer0ce215e2006-10-19 07:58:22 -03002152 },
2153 { "Uniwill STK7700P based (Hama and others)",
2154 { &dib0700_usb_id_table[7], NULL },
2155 { NULL },
Michael Krufky8637a872006-11-08 16:47:32 -03002156 },
2157 { "Leadtek Winfast DTV Dongle (STK7700P based)",
Patrick Boettcher1e13c8f2009-09-19 05:24:40 -03002158 { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
Michael Krufky8637a872006-11-08 16:47:32 -03002159 { NULL },
Joachim Steigerfa3b8772007-10-08 20:08:46 -03002160 },
2161 { "AVerMedia AVerTV DVB-T Express",
2162 { &dib0700_usb_id_table[20] },
2163 { NULL },
dominik67053a42007-11-10 19:23:31 -03002164 },
dominik67053a42007-11-10 19:23:31 -03002165 { "Gigabyte U7000",
2166 { &dib0700_usb_id_table[21], NULL },
2167 { NULL },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002168 }
Darren Saltb1139e32007-08-18 18:05:31 -03002169 },
2170
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002171 .rc.legacy = {
2172 .rc_interval = DEFAULT_RC_INTERVAL,
2173 .rc_key_map = ir_codes_dib0700_table,
2174 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2175 .rc_query = dib0700_rc_query
2176 },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002177 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2178
2179 .num_adapters = 2,
2180 .adapter = {
2181 {
2182 .frontend_attach = bristol_frontend_attach,
2183 .tuner_attach = bristol_tuner_attach,
2184
2185 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2186 }, {
2187 .frontend_attach = bristol_frontend_attach,
2188 .tuner_attach = bristol_tuner_attach,
2189
2190 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2191 }
2192 },
2193
2194 .num_device_descs = 1,
2195 .devices = {
2196 { "Hauppauge Nova-T 500 Dual DVB-T",
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002197 { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002198 { NULL },
2199 },
Janne Grunau82f3d552007-07-30 13:50:28 -03002200 },
2201
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002202 .rc.legacy = {
2203 .rc_interval = DEFAULT_RC_INTERVAL,
2204 .rc_key_map = ir_codes_dib0700_table,
2205 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2206 .rc_query = dib0700_rc_query
2207 },
Olivier DANET54d75eb2007-07-25 14:42:54 -03002208 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2209
2210 .num_adapters = 2,
2211 .adapter = {
2212 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002213 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2214 .pid_filter_count = 32,
2215 .pid_filter = stk70x0p_pid_filter,
2216 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier DANET54d75eb2007-07-25 14:42:54 -03002217 .frontend_attach = stk7700d_frontend_attach,
2218 .tuner_attach = stk7700d_tuner_attach,
2219
2220 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2221 }, {
Olivier Grenief8731f42009-09-18 04:08:43 -03002222 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2223 .pid_filter_count = 32,
2224 .pid_filter = stk70x0p_pid_filter,
2225 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier DANET54d75eb2007-07-25 14:42:54 -03002226 .frontend_attach = stk7700d_frontend_attach,
2227 .tuner_attach = stk7700d_tuner_attach,
2228
2229 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2230 }
2231 },
2232
James A Webb200e8612009-08-04 02:38:05 -03002233 .num_device_descs = 5,
Olivier DANET54d75eb2007-07-25 14:42:54 -03002234 .devices = {
2235 { "Pinnacle PCTV 2000e",
2236 { &dib0700_usb_id_table[11], NULL },
2237 { NULL },
2238 },
2239 { "Terratec Cinergy DT XS Diversity",
2240 { &dib0700_usb_id_table[12], NULL },
2241 { NULL },
2242 },
Darren Saltfaebb912007-08-18 18:04:00 -03002243 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
Olivier DANET54d75eb2007-07-25 14:42:54 -03002244 { &dib0700_usb_id_table[13], NULL },
2245 { NULL },
2246 },
Patrick Boettcher01373a52007-07-30 12:49:04 -03002247 { "DiBcom STK7700D reference design",
Patrick Boettcherb6884a12007-07-27 10:08:51 -03002248 { &dib0700_usb_id_table[14], NULL },
2249 { NULL },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03002250 },
James A Webb200e8612009-08-04 02:38:05 -03002251 { "YUAN High-Tech DiBcom STK7700D",
2252 { &dib0700_usb_id_table[55], NULL },
2253 { NULL },
2254 },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03002255
Olivier DANET54d75eb2007-07-25 14:42:54 -03002256 },
Janne Grunau82f3d552007-07-30 13:50:28 -03002257
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002258 .rc.legacy = {
2259 .rc_interval = DEFAULT_RC_INTERVAL,
2260 .rc_key_map = ir_codes_dib0700_table,
2261 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2262 .rc_query = dib0700_rc_query
2263 },
Patrick Boettcher01373a52007-07-30 12:49:04 -03002264 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2265
2266 .num_adapters = 1,
2267 .adapter = {
2268 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002269 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2270 .pid_filter_count = 32,
2271 .pid_filter = stk70x0p_pid_filter,
2272 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03002273 .frontend_attach = stk7700P2_frontend_attach,
2274 .tuner_attach = stk7700d_tuner_attach,
2275
2276 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2277 },
2278 },
2279
Yusuf Altinbb1b0822009-01-08 07:58:45 -03002280 .num_device_descs = 3,
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03002281 .devices = {
2282 { "ASUS My Cinema U3000 Mini DVBT Tuner",
2283 { &dib0700_usb_id_table[23], NULL },
2284 { NULL },
2285 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002286 { "Yuan EC372S",
2287 { &dib0700_usb_id_table[31], NULL },
2288 { NULL },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03002289 },
2290 { "Terratec Cinergy T Express",
2291 { &dib0700_usb_id_table[42], NULL },
2292 { NULL },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002293 }
Chris Rankin48aa7392008-09-25 06:52:24 -03002294 },
2295
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002296 .rc.legacy = {
2297 .rc_interval = DEFAULT_RC_INTERVAL,
2298 .rc_key_map = ir_codes_dib0700_table,
2299 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2300 .rc_query = dib0700_rc_query
2301 },
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03002302 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2303
2304 .num_adapters = 1,
2305 .adapter = {
2306 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002307 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2308 .pid_filter_count = 32,
2309 .pid_filter = stk70x0p_pid_filter,
2310 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Patrick Boettcher01373a52007-07-30 12:49:04 -03002311 .frontend_attach = stk7070p_frontend_attach,
2312 .tuner_attach = dib7070p_tuner_attach,
2313
2314 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2315
2316 .size_of_priv = sizeof(struct dib0700_adapter_state),
2317 },
2318 },
2319
Patrick Boettcher1e13c8f2009-09-19 05:24:40 -03002320 .num_device_descs = 11,
Patrick Boettcher01373a52007-07-30 12:49:04 -03002321 .devices = {
2322 { "DiBcom STK7070P reference design",
2323 { &dib0700_usb_id_table[15], NULL },
2324 { NULL },
2325 },
2326 { "Pinnacle PCTV DVB-T Flash Stick",
2327 { &dib0700_usb_id_table[16], NULL },
2328 { NULL },
2329 },
Yousef Lamlum7999a812008-01-25 05:51:48 -03002330 { "Artec T14BR DVB-T",
2331 { &dib0700_usb_id_table[22], NULL },
2332 { NULL },
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03002333 },
2334 { "ASUS My Cinema U3100 Mini DVBT Tuner",
2335 { &dib0700_usb_id_table[24], NULL },
2336 { NULL },
2337 },
Tim Taubertc7637b12008-01-25 06:16:36 -03002338 { "Hauppauge Nova-T Stick",
2339 { &dib0700_usb_id_table[25], NULL },
2340 { NULL },
2341 },
Darren Salt13b83b52008-01-25 06:20:02 -03002342 { "Hauppauge Nova-T MyTV.t",
2343 { &dib0700_usb_id_table[26], NULL },
2344 { NULL },
2345 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002346 { "Pinnacle PCTV 72e",
2347 { &dib0700_usb_id_table[29], NULL },
2348 { NULL },
2349 },
2350 { "Pinnacle PCTV 73e",
2351 { &dib0700_usb_id_table[30], NULL },
2352 { NULL },
2353 },
Klaus Flittner919a5482009-03-29 09:12:06 -03002354 { "Elgato EyeTV DTT",
2355 { &dib0700_usb_id_table[49], NULL },
2356 { NULL },
2357 },
Pascal Terjan9abb6e62009-02-26 10:31:41 -03002358 { "Yuan PD378S",
2359 { &dib0700_usb_id_table[45], NULL },
2360 { NULL },
2361 },
Armin Schenker513846e2009-04-20 11:57:49 -03002362 { "Elgato EyeTV Dtt Dlx PD378S",
2363 { &dib0700_usb_id_table[50], NULL },
2364 { NULL },
2365 },
Tim Taubertc7637b12008-01-25 06:16:36 -03002366 },
2367
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002368 .rc.legacy = {
2369 .rc_interval = DEFAULT_RC_INTERVAL,
2370 .rc_key_map = ir_codes_dib0700_table,
2371 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2372 .rc_query = dib0700_rc_query
2373 },
Patrick Boettcher01373a52007-07-30 12:49:04 -03002374 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2375
Olivier Grenie74b76f22009-09-02 08:19:19 -03002376 .num_adapters = 1,
2377 .adapter = {
2378 {
Mauro Carvalho Chehab648732f2009-11-04 12:11:43 -02002379 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2380 .pid_filter_count = 32,
2381 .pid_filter = stk70x0p_pid_filter,
2382 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier Grenie74b76f22009-09-02 08:19:19 -03002383 .frontend_attach = stk7070p_frontend_attach,
2384 .tuner_attach = dib7070p_tuner_attach,
2385
2386 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2387
2388 .size_of_priv = sizeof(struct dib0700_adapter_state),
2389 },
2390 },
2391
Patrick Boettcher20232c42009-12-01 12:08:56 -03002392 .num_device_descs = 3,
Olivier Grenie74b76f22009-09-02 08:19:19 -03002393 .devices = {
2394 { "Pinnacle PCTV 73A",
2395 { &dib0700_usb_id_table[56], NULL },
2396 { NULL },
2397 },
2398 { "Pinnacle PCTV 73e SE",
Patrick Boettcher20232c42009-12-01 12:08:56 -03002399 { &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL },
Olivier Grenie74b76f22009-09-02 08:19:19 -03002400 { NULL },
2401 },
2402 { "Pinnacle PCTV 282e",
Patrick Boettcher20232c42009-12-01 12:08:56 -03002403 { &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL },
Olivier Grenie74b76f22009-09-02 08:19:19 -03002404 { NULL },
2405 },
2406 },
2407
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002408 .rc.legacy = {
2409 .rc_interval = DEFAULT_RC_INTERVAL,
2410 .rc_key_map = ir_codes_dib0700_table,
2411 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2412 .rc_query = dib0700_rc_query
2413 },
Olivier Grenie74b76f22009-09-02 08:19:19 -03002414 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2415
Patrick Boettcher01373a52007-07-30 12:49:04 -03002416 .num_adapters = 2,
2417 .adapter = {
2418 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002419 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2420 .pid_filter_count = 32,
2421 .pid_filter = stk70x0p_pid_filter,
2422 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Patrick Boettcher01373a52007-07-30 12:49:04 -03002423 .frontend_attach = stk7070pd_frontend_attach0,
2424 .tuner_attach = dib7070p_tuner_attach,
2425
2426 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2427
2428 .size_of_priv = sizeof(struct dib0700_adapter_state),
2429 }, {
Olivier Grenief8731f42009-09-18 04:08:43 -03002430 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2431 .pid_filter_count = 32,
2432 .pid_filter = stk70x0p_pid_filter,
2433 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Patrick Boettcher01373a52007-07-30 12:49:04 -03002434 .frontend_attach = stk7070pd_frontend_attach1,
2435 .tuner_attach = dib7070p_tuner_attach,
2436
2437 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2438
2439 .size_of_priv = sizeof(struct dib0700_adapter_state),
2440 }
2441 },
2442
Michael Müller84e2f032010-04-26 22:18:57 -03002443 .num_device_descs = 7,
Patrick Boettcher01373a52007-07-30 12:49:04 -03002444 .devices = {
2445 { "DiBcom STK7070PD reference design",
2446 { &dib0700_usb_id_table[17], NULL },
2447 { NULL },
2448 },
2449 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
2450 { &dib0700_usb_id_table[18], NULL },
2451 { NULL },
Michael Krufkyd01eb2d2008-07-03 23:43:36 -03002452 },
2453 { "Hauppauge Nova-TD Stick (52009)",
2454 { &dib0700_usb_id_table[35], NULL },
2455 { NULL },
Michael Krufky9a0c04a2008-09-03 17:12:24 -03002456 },
2457 { "Hauppauge Nova-TD-500 (84xxx)",
2458 { &dib0700_usb_id_table[36], NULL },
2459 { NULL },
Nicolas Fournierdb4b2d12009-01-13 07:15:25 -03002460 },
Patrick Boettchera9b8fe32009-05-20 05:35:02 -03002461 { "Terratec Cinergy DT USB XS Diversity/ T5",
2462 { &dib0700_usb_id_table[43],
2463 &dib0700_usb_id_table[53], NULL},
Nicolas Fournierdb4b2d12009-01-13 07:15:25 -03002464 { NULL },
sebastian.blanes@gmail.com0a6e1ed2009-02-24 14:51:43 -03002465 },
2466 { "Sony PlayTV",
2467 { &dib0700_usb_id_table[44], NULL },
2468 { NULL },
Michael Müller84e2f032010-04-26 22:18:57 -03002469 },
2470 { "Elgato EyeTV Diversity",
2471 { &dib0700_usb_id_table[68], NULL },
2472 { NULL },
2473 },
Arne Luehrsc985a8d2009-01-21 01:37:20 -03002474 },
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002475
2476 .rc.legacy = {
2477 .rc_interval = DEFAULT_RC_INTERVAL,
2478 .rc_key_map = ir_codes_dib0700_table,
2479 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2480 .rc_query = dib0700_rc_query
2481 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002482 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2483
2484 .num_adapters = 1,
2485 .adapter = {
2486 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002487 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2488 .pid_filter_count = 32,
2489 .pid_filter = stk70x0p_pid_filter,
2490 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002491 .frontend_attach = stk7700ph_frontend_attach,
2492 .tuner_attach = stk7700ph_tuner_attach,
2493
2494 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2495
2496 .size_of_priv = sizeof(struct
2497 dib0700_adapter_state),
2498 },
2499 },
2500
Pete Hildebrandtc53d83c2009-08-05 11:46:38 -03002501 .num_device_descs = 9,
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002502 .devices = {
2503 { "Terratec Cinergy HT USB XE",
2504 { &dib0700_usb_id_table[27], NULL },
2505 { NULL },
2506 },
2507 { "Pinnacle Expresscard 320cx",
2508 { &dib0700_usb_id_table[28], NULL },
2509 { NULL },
2510 },
2511 { "Terratec Cinergy HT Express",
2512 { &dib0700_usb_id_table[32], NULL },
2513 { NULL },
2514 },
Finn Thain17a370b2008-09-06 13:42:47 -03002515 { "Gigabyte U8000-RH",
2516 { &dib0700_usb_id_table[37], NULL },
2517 { NULL },
2518 },
Daniel Oliveira Nascimento8751aaa2008-09-07 12:39:44 -03002519 { "YUAN High-Tech STK7700PH",
2520 { &dib0700_usb_id_table[38], NULL },
2521 { NULL },
2522 },
Albert Comerma57697432008-09-07 12:43:33 -03002523 { "Asus My Cinema-U3000Hybrid",
2524 { &dib0700_usb_id_table[39], NULL },
2525 { NULL },
2526 },
Xoan Loureiro16ba1ee2009-03-29 08:43:36 -03002527 { "YUAN High-Tech MC770",
2528 { &dib0700_usb_id_table[48], NULL },
2529 { NULL },
2530 },
tomas petrf0f4ae72009-05-20 05:28:05 -03002531 { "Leadtek WinFast DTV Dongle H",
2532 { &dib0700_usb_id_table[51], NULL },
2533 { NULL },
2534 },
Pete Hildebrandtc53d83c2009-08-05 11:46:38 -03002535 { "YUAN High-Tech STK7700D",
2536 { &dib0700_usb_id_table[54], NULL },
2537 { NULL },
2538 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002539 },
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002540
2541 .rc.legacy = {
2542 .rc_interval = DEFAULT_RC_INTERVAL,
2543 .rc_key_map = ir_codes_dib0700_table,
2544 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2545 .rc_query = dib0700_rc_query
2546 },
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002547 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2548 .num_adapters = 1,
2549 .adapter = {
2550 {
2551 .frontend_attach = s5h1411_frontend_attach,
2552 .tuner_attach = xc5000_tuner_attach,
2553
2554 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2555
2556 .size_of_priv = sizeof(struct
2557 dib0700_adapter_state),
2558 },
2559 },
2560
Devin Heitmuellerd2fc3bf2008-09-25 06:22:23 -03002561 .num_device_descs = 2,
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002562 .devices = {
2563 { "Pinnacle PCTV HD Pro USB Stick",
2564 { &dib0700_usb_id_table[40], NULL },
2565 { NULL },
2566 },
Devin Heitmuellerd2fc3bf2008-09-25 06:22:23 -03002567 { "Pinnacle PCTV HD USB Stick",
2568 { &dib0700_usb_id_table[41], NULL },
2569 { NULL },
2570 },
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002571 },
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002572 .rc.legacy = {
2573 .rc_interval = DEFAULT_RC_INTERVAL,
2574 .rc_key_map = ir_codes_dib0700_table,
2575 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2576 .rc_query = dib0700_rc_query
2577 },
Michael Krufkyce904bc2009-01-19 01:12:55 -03002578 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2579 .num_adapters = 1,
2580 .adapter = {
2581 {
2582 .frontend_attach = lgdt3305_frontend_attach,
2583 .tuner_attach = mxl5007t_tuner_attach,
2584
2585 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2586
2587 .size_of_priv = sizeof(struct
2588 dib0700_adapter_state),
2589 },
2590 },
2591
2592 .num_device_descs = 2,
2593 .devices = {
2594 { "Hauppauge ATSC MiniCard (B200)",
2595 { &dib0700_usb_id_table[46], NULL },
2596 { NULL },
2597 },
2598 { "Hauppauge ATSC MiniCard (B210)",
2599 { &dib0700_usb_id_table[47], NULL },
2600 { NULL },
2601 },
2602 },
Olivier Grenied300bd62009-09-15 06:55:35 -03002603 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2604
2605 .num_adapters = 1,
2606 .adapter = {
2607 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002608 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2609 .pid_filter_count = 32,
2610 .pid_filter = stk70x0p_pid_filter,
2611 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier Grenied300bd62009-09-15 06:55:35 -03002612 .frontend_attach = stk7070p_frontend_attach,
2613 .tuner_attach = dib7770p_tuner_attach,
2614
2615 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2616
2617 .size_of_priv =
Patrick Boettcherdb481382009-09-15 07:16:51 -03002618 sizeof(struct dib0700_adapter_state),
Olivier Grenied300bd62009-09-15 06:55:35 -03002619 },
2620 },
2621
Patrick Boettcherdb481382009-09-15 07:16:51 -03002622 .num_device_descs = 2,
Olivier Grenied300bd62009-09-15 06:55:35 -03002623 .devices = {
2624 { "DiBcom STK7770P reference design",
2625 { &dib0700_usb_id_table[59], NULL },
2626 { NULL },
2627 },
Patrick Boettcher1e13c8f2009-09-19 05:24:40 -03002628 { "Terratec Cinergy T USB XXS (HD)/ T3",
2629 { &dib0700_usb_id_table[33],
2630 &dib0700_usb_id_table[52],
2631 &dib0700_usb_id_table[60], NULL},
Patrick Boettcherdb481382009-09-15 07:16:51 -03002632 { NULL },
2633 },
Olivier Grenied300bd62009-09-15 06:55:35 -03002634 },
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002635 .rc.legacy = {
2636 .rc_interval = DEFAULT_RC_INTERVAL,
2637 .rc_key_map = ir_codes_dib0700_table,
2638 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2639 .rc_query = dib0700_rc_query
2640 },
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002641 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2642 .num_adapters = 1,
2643 .adapter = {
2644 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002645 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2646 .pid_filter_count = 32,
Olivier Grenie03245a52009-12-04 13:27:57 -03002647 .pid_filter = stk80xx_pid_filter,
2648 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002649 .frontend_attach = stk807x_frontend_attach,
2650 .tuner_attach = dib807x_tuner_attach,
2651
2652 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2653
2654 .size_of_priv =
2655 sizeof(struct dib0700_adapter_state),
2656 },
2657 },
2658
S?rgio Fortier8a378e82009-09-28 04:19:21 -03002659 .num_device_descs = 3,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002660 .devices = {
2661 { "DiBcom STK807xP reference design",
2662 { &dib0700_usb_id_table[62], NULL },
2663 { NULL },
2664 },
Mauro Carvalho Chehabaaeab302009-09-16 09:18:26 -03002665 { "Prolink Pixelview SBTVD",
2666 { &dib0700_usb_id_table[63], NULL },
2667 { NULL },
2668 },
S?rgio Fortier8a378e82009-09-28 04:19:21 -03002669 { "EvolutePC TVWay+",
2670 { &dib0700_usb_id_table[64], NULL },
2671 { NULL },
2672 },
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002673 },
2674
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002675 .rc.legacy = {
2676 .rc_interval = DEFAULT_RC_INTERVAL,
2677 .rc_key_map = ir_codes_dib0700_table,
2678 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2679 .rc_query = dib0700_rc_query
2680 },
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002681 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2682 .num_adapters = 2,
2683 .adapter = {
2684 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002685 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2686 .pid_filter_count = 32,
Olivier Grenie03245a52009-12-04 13:27:57 -03002687 .pid_filter = stk80xx_pid_filter,
2688 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002689 .frontend_attach = stk807xpvr_frontend_attach0,
2690 .tuner_attach = dib807x_tuner_attach,
2691
2692 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2693
2694 .size_of_priv =
2695 sizeof(struct dib0700_adapter_state),
2696 },
2697 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002698 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2699 .pid_filter_count = 32,
Olivier Grenie03245a52009-12-04 13:27:57 -03002700 .pid_filter = stk80xx_pid_filter,
2701 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002702 .frontend_attach = stk807xpvr_frontend_attach1,
2703 .tuner_attach = dib807x_tuner_attach,
2704
2705 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2706
2707 .size_of_priv =
2708 sizeof(struct dib0700_adapter_state),
2709 },
2710 },
2711
2712 .num_device_descs = 1,
2713 .devices = {
2714 { "DiBcom STK807xPVR reference design",
2715 { &dib0700_usb_id_table[61], NULL },
2716 { NULL },
2717 },
2718 },
2719
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002720 .rc.legacy = {
2721 .rc_interval = DEFAULT_RC_INTERVAL,
2722 .rc_key_map = ir_codes_dib0700_table,
2723 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2724 .rc_query = dib0700_rc_query
2725 },
Olivier Grenie03245a52009-12-04 13:27:57 -03002726 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2727 .num_adapters = 1,
2728 .adapter = {
2729 {
2730 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
2731 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2732 .pid_filter_count = 32,
2733 .pid_filter = stk80xx_pid_filter,
2734 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
2735 .frontend_attach = stk809x_frontend_attach,
2736 .tuner_attach = dib809x_tuner_attach,
2737
2738 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2739
2740 .size_of_priv =
2741 sizeof(struct dib0700_adapter_state),
2742 },
2743 },
2744
2745 .num_device_descs = 1,
2746 .devices = {
2747 { "DiBcom STK8096GP reference design",
2748 { &dib0700_usb_id_table[67], NULL },
2749 { NULL },
2750 },
2751 },
2752
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002753 .rc.legacy = {
2754 .rc_interval = DEFAULT_RC_INTERVAL,
2755 .rc_key_map = ir_codes_dib0700_table,
2756 .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table),
2757 .rc_query = dib0700_rc_query
2758 },
Patrick Boettcher01373a52007-07-30 12:49:04 -03002759 },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002760};
2761
2762int dib0700_device_count = ARRAY_SIZE(dib0700_devices);