blob: c519ad5eb731f4672b7d4ff65ab9ea40777ecafc [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"
Olivier Greniebe9bae12011-01-04 05:42:19 -030015#include "dib9000.h"
Patrick Boettcherb7f54912006-09-19 12:51:37 -030016#include "mt2060.h"
Olivier DANET54d75eb2007-07-25 14:42:54 -030017#include "mt2266.h"
Albert Comerma6ca8f0b2008-03-29 21:35:57 -030018#include "tuner-xc2028.h"
Devin Heitmuellercb22cb52008-09-08 05:42:42 -030019#include "xc5000.h"
20#include "s5h1411.h"
Patrick Boettcher01373a52007-07-30 12:49:04 -030021#include "dib0070.h"
Olivier Grenie03245a52009-12-04 13:27:57 -030022#include "dib0090.h"
Michael Krufkyce904bc2009-01-19 01:12:55 -030023#include "lgdt3305.h"
24#include "mxl5007t.h"
Patrick Boettcherb7f54912006-09-19 12:51:37 -030025
Patrick Boettcher7fb3fc02006-09-20 04:37:18 -030026static int force_lna_activation;
27module_param(force_lna_activation, int, 0644);
28MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), "
29 "if applicable for the device (default: 0=automatic/off).");
30
Patrick Boettcher01373a52007-07-30 12:49:04 -030031struct dib0700_adapter_state {
32 int (*set_param_save) (struct dvb_frontend *, struct dvb_frontend_parameters *);
Olivier Greniebe9bae12011-01-04 05:42:19 -030033 const struct firmware *frontend_firmware;
Patrick Boettcher01373a52007-07-30 12:49:04 -030034};
35
36/* Hauppauge Nova-T 500 (aka Bristol)
Patrick Boettcherb7f54912006-09-19 12:51:37 -030037 * has a LNA on GPIO0 which is enabled by setting 1 */
38static struct mt2060_config bristol_mt2060_config[2] = {
39 {
40 .i2c_address = 0x60,
Patrick Boettcher303cbea2006-09-19 12:51:56 -030041 .clock_out = 3,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030042 }, {
43 .i2c_address = 0x61,
44 }
45};
46
Devin Heitmueller99afb982008-11-15 07:13:07 -030047
Patrick Boettcherb7f54912006-09-19 12:51:37 -030048static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
49 .band_caps = BAND_VHF | BAND_UHF,
Patrick Boettcher01b4bf32006-09-19 12:51:53 -030050 .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
Patrick Boettcherb7f54912006-09-19 12:51:37 -030051
Patrick Boettcher6958eff2006-09-19 12:51:40 -030052 .agc1_max = 42598,
53 .agc1_min = 17694,
54 .agc2_max = 45875,
55 .agc2_min = 0,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030056
Patrick Boettcher6958eff2006-09-19 12:51:40 -030057 .agc1_pt1 = 0,
58 .agc1_pt2 = 59,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030059
Patrick Boettcher6958eff2006-09-19 12:51:40 -030060 .agc1_slope1 = 0,
61 .agc1_slope2 = 69,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030062
63 .agc2_pt1 = 0,
Patrick Boettcher6958eff2006-09-19 12:51:40 -030064 .agc2_pt2 = 59,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030065
Patrick Boettcher6958eff2006-09-19 12:51:40 -030066 .agc2_slope1 = 111,
67 .agc2_slope2 = 28,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030068};
69
70static struct dib3000mc_config bristol_dib3000mc_config[2] = {
71 { .agc = &bristol_dib3000p_mt2060_agc_config,
72 .max_time = 0x196,
73 .ln_adc_level = 0x1cc7,
74 .output_mpeg2_in_188_bytes = 1,
75 },
76 { .agc = &bristol_dib3000p_mt2060_agc_config,
77 .max_time = 0x196,
78 .ln_adc_level = 0x1cc7,
79 .output_mpeg2_in_188_bytes = 1,
80 }
81};
82
83static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
84{
Patrick Boettcher6958eff2006-09-19 12:51:40 -030085 struct dib0700_state *st = adap->dev->priv;
Patrick Boettcherb7f54912006-09-19 12:51:37 -030086 if (adap->id == 0) {
87 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
88 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
89 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
90 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
91
Patrick Boettcher7fb3fc02006-09-20 04:37:18 -030092 if (force_lna_activation)
93 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
94 else
95 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
Patrick Boettcher6958eff2006-09-19 12:51:40 -030096
Patrick Boettcherb7f54912006-09-19 12:51:37 -030097 if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {
98 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
99 return -ENODEV;
100 }
101 }
Patrick Boettcher6958eff2006-09-19 12:51:40 -0300102 st->mt2060_if1[adap->id] = 1220;
103 return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
104 (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300105}
106
Patrick Boettcher4a2b1082008-01-25 07:32:58 -0300107static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval)
Olivier DANETc52344f2008-01-25 06:50:07 -0300108{
109 struct i2c_msg msg[2] = {
110 { .addr = 0x50, .flags = 0, .buf = &adrs, .len = 1 },
111 { .addr = 0x50, .flags = I2C_M_RD, .buf = pval, .len = 1 },
112 };
113 if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO;
114 return 0;
115}
116
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300117static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
118{
Olivier DANETc52344f2008-01-25 06:50:07 -0300119 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300120 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
Olivier DANETc52344f2008-01-25 06:50:07 -0300121 s8 a;
122 int if1=1220;
Al Viroda5ee482008-05-21 00:31:21 -0300123 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
124 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) {
Olivier DANETc52344f2008-01-25 06:50:07 -0300125 if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;
126 }
127 return dvb_attach(mt2060_attach,adap->fe, tun_i2c,&bristol_mt2060_config[adap->id],
128 if1) == NULL ? -ENODEV : 0;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300129}
130
Patrick Boettcher01373a52007-07-30 12:49:04 -0300131/* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
Olivier DANET54d75eb2007-07-25 14:42:54 -0300132
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300133/* MT226x */
134static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = {
135 {
Olivier Grenie9c783032009-12-07 07:49:40 -0300136 BAND_UHF,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300137
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300138 /* 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,
139 * 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 -0300140 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
141 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
Olivier DANET54d75eb2007-07-25 14:42:54 -0300142
Olivier Grenie9c783032009-12-07 07:49:40 -0300143 1130,
144 21,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300145
Olivier Grenie9c783032009-12-07 07:49:40 -0300146 0,
147 118,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300148
Olivier Grenie9c783032009-12-07 07:49:40 -0300149 0,
150 3530,
151 1,
152 0,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300153
Olivier Grenie9c783032009-12-07 07:49:40 -0300154 65535,
155 33770,
156 65535,
157 23592,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300158
Olivier Grenie9c783032009-12-07 07:49:40 -0300159 0,
160 62,
161 255,
162 64,
163 64,
164 132,
165 192,
166 80,
167 80,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300168
Olivier Grenie9c783032009-12-07 07:49:40 -0300169 17,
170 27,
171 23,
172 51,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300173
Olivier Grenie9c783032009-12-07 07:49:40 -0300174 1,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300175 }, {
Olivier Grenie9c783032009-12-07 07:49:40 -0300176 BAND_VHF | BAND_LBAND,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300177
178 /* 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,
179 * 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 -0300180 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
181 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300182
Olivier Grenie9c783032009-12-07 07:49:40 -0300183 2372,
184 21,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300185
Olivier Grenie9c783032009-12-07 07:49:40 -0300186 0,
187 118,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300188
Olivier Grenie9c783032009-12-07 07:49:40 -0300189 0,
190 3530,
191 1,
192 0,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300193
Olivier Grenie9c783032009-12-07 07:49:40 -0300194 65535,
195 0,
196 65535,
197 23592,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300198
Olivier Grenie9c783032009-12-07 07:49:40 -0300199 0,
200 128,
201 128,
202 128,
203 0,
204 128,
205 253,
206 81,
207 0,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300208
Olivier Grenie9c783032009-12-07 07:49:40 -0300209 17,
210 27,
211 23,
212 51,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300213
Olivier Grenie9c783032009-12-07 07:49:40 -0300214 1,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300215 }
Olivier DANET54d75eb2007-07-25 14:42:54 -0300216};
217
218static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = {
Olivier Grenie9c783032009-12-07 07:49:40 -0300219 60000, 30000,
220 1, 8, 3, 1, 0,
221 0, 0, 1, 1, 2,
222 (3 << 14) | (1 << 12) | (524 << 0),
223 0,
224 20452225,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300225};
226
227static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {
228 { .output_mpeg2_in_188_bytes = 1,
229 .hostbus_diversity = 1,
230 .tuner_is_baseband = 1,
231
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300232 .agc_config_count = 2,
233 .agc = stk7700d_7000p_mt2266_agc_config,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300234 .bw = &stk7700d_mt2266_pll_config,
235
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300236 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
237 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
238 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300239 },
240 { .output_mpeg2_in_188_bytes = 1,
241 .hostbus_diversity = 1,
242 .tuner_is_baseband = 1,
243
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300244 .agc_config_count = 2,
245 .agc = stk7700d_7000p_mt2266_agc_config,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300246 .bw = &stk7700d_mt2266_pll_config,
247
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300248 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
249 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
250 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300251 }
252};
253
254static struct mt2266_config stk7700d_mt2266_config[2] = {
255 { .i2c_address = 0x60
256 },
257 { .i2c_address = 0x60
258 }
259};
260
Daniel Gimpelevich132c3182008-01-25 06:02:42 -0300261static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap)
262{
263 if (adap->id == 0) {
264 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
265 msleep(10);
266 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
267 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
268 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
269 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
270 msleep(10);
271 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
272 msleep(10);
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -0300273 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
274 stk7700d_dib7000p_mt2266_config)
275 != 0) {
276 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
277 return -ENODEV;
278 }
Daniel Gimpelevich132c3182008-01-25 06:02:42 -0300279 }
280
281 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
282 &stk7700d_dib7000p_mt2266_config[adap->id]);
283
284 return adap->fe == NULL ? -ENODEV : 0;
285}
286
Olivier DANET54d75eb2007-07-25 14:42:54 -0300287static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap)
288{
289 if (adap->id == 0) {
290 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
291 msleep(10);
292 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
293 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
294 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
295 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
296 msleep(10);
297 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
298 msleep(10);
299 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -0300300 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
301 stk7700d_dib7000p_mt2266_config)
302 != 0) {
303 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
304 return -ENODEV;
305 }
Olivier DANET54d75eb2007-07-25 14:42:54 -0300306 }
307
308 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
309 &stk7700d_dib7000p_mt2266_config[adap->id]);
310
311 return adap->fe == NULL ? -ENODEV : 0;
312}
313
314static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap)
315{
316 struct i2c_adapter *tun_i2c;
317 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
318 return dvb_attach(mt2266_attach, adap->fe, tun_i2c,
Joe Perches1ebcad72009-07-02 15:57:09 -0300319 &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300320}
321
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300322/* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
Harvey Harrisonb1721d02008-04-25 19:03:08 -0700323static struct dibx000_agc_config xc3028_agc_config = {
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300324 BAND_VHF | BAND_UHF, /* band_caps */
325
326 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
327 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
328 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
329 (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
330 (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */
331
332 712, /* inv_gain */
333 21, /* time_stabiliz */
334
335 0, /* alpha_level */
336 118, /* thlock */
337
338 0, /* wbd_inv */
339 2867, /* wbd_ref */
340 0, /* wbd_sel */
341 2, /* wbd_alpha */
342
343 0, /* agc1_max */
344 0, /* agc1_min */
345 39718, /* agc2_max */
346 9930, /* agc2_min */
347 0, /* agc1_pt1 */
348 0, /* agc1_pt2 */
349 0, /* agc1_pt3 */
350 0, /* agc1_slope1 */
351 0, /* agc1_slope2 */
352 0, /* agc2_pt1 */
353 128, /* agc2_pt2 */
354 29, /* agc2_slope1 */
355 29, /* agc2_slope2 */
356
357 17, /* alpha_mant */
358 27, /* alpha_exp */
359 23, /* beta_mant */
360 51, /* beta_exp */
361
362 1, /* perform_agc_softsplit */
363};
364
365/* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
Harvey Harrisonb1721d02008-04-25 19:03:08 -0700366static struct dibx000_bandwidth_config xc3028_bw_config = {
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300367 60000, 30000, /* internal, sampling */
368 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
369 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc,
370 modulo */
371 (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
372 (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
373 20452225, /* timf */
374 30000000, /* xtal_hz */
375};
376
377static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
378 .output_mpeg2_in_188_bytes = 1,
379 .tuner_is_baseband = 1,
380
381 .agc_config_count = 1,
382 .agc = &xc3028_agc_config,
383 .bw = &xc3028_bw_config,
384
385 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
386 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
387 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
388};
389
Michael Krufkyd7cba042008-09-12 13:31:45 -0300390static int stk7700ph_xc3028_callback(void *ptr, int component,
391 int command, int arg)
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300392{
393 struct dvb_usb_adapter *adap = ptr;
394
395 switch (command) {
396 case XC2028_TUNER_RESET:
397 /* Send the tuner in then out of reset */
398 dib7000p_set_gpio(adap->fe, 8, 0, 0); msleep(10);
399 dib7000p_set_gpio(adap->fe, 8, 0, 1);
400 break;
401 case XC2028_RESET_CLK:
402 break;
403 default:
404 err("%s: unknown command %d, arg %d\n", __func__,
405 command, arg);
406 return -EINVAL;
407 }
408 return 0;
409}
410
411static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
412 .fname = XC2028_DEFAULT_FIRMWARE,
413 .max_len = 64,
414 .demod = XC3028_FE_DIBCOM52,
415};
416
417static struct xc2028_config stk7700ph_xc3028_config = {
418 .i2c_addr = 0x61,
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300419 .ctrl = &stk7700ph_xc3028_ctrl,
420};
421
422static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
423{
424 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;
425
Al Viroda5ee482008-05-21 00:31:21 -0300426 if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
427 desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300428 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
429 else
430 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
431 msleep(20);
432 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
433 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
434 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
435 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
436 msleep(10);
437 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
438 msleep(20);
439 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
440 msleep(10);
441
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -0300442 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
443 &stk7700ph_dib7700_xc3028_config) != 0) {
444 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
445 __func__);
446 return -ENODEV;
447 }
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300448
449 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
450 &stk7700ph_dib7700_xc3028_config);
451
452 return adap->fe == NULL ? -ENODEV : 0;
453}
454
455static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
456{
457 struct i2c_adapter *tun_i2c;
458
459 tun_i2c = dib7000p_get_i2c_master(adap->fe,
460 DIBX000_I2C_INTERFACE_TUNER, 1);
461
462 stk7700ph_xc3028_config.i2c_adap = tun_i2c;
Michael Krufkyd7cba042008-09-12 13:31:45 -0300463
464 /* FIXME: generalize & move to common area */
465 adap->fe->callback = stk7700ph_xc3028_callback;
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300466
467 return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config)
468 == NULL ? -ENODEV : 0;
469}
470
Devin Heitmueller4b330be2008-12-01 06:51:14 -0300471#define DEFAULT_RC_INTERVAL 50
Olivier DANET54d75eb2007-07-25 14:42:54 -0300472
473static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
474
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300475/* Number of keypresses to ignore before start repeating */
Devin Heitmueller4b330be2008-12-01 06:51:14 -0300476#define RC_REPEAT_DELAY 6
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300477
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -0300478/*
479 * This function is used only when firmware is < 1.20 version. Newer
480 * firmwares use bulk mode, with functions implemented at dib0700_core,
481 * at dib0700_rc_urb_completion()
482 */
483static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d)
Olivier DANET54d75eb2007-07-25 14:42:54 -0300484{
485 u8 key[4];
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -0300486 u32 keycode;
487 u8 toggle;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300488 int i;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300489 struct dib0700_state *st = d->priv;
Devin Heitmueller6a207102010-01-04 02:43:19 -0300490
Devin Heitmueller6a207102010-01-04 02:43:19 -0300491 if (st->fw_version >= 0x10200) {
492 /* For 1.20 firmware , We need to keep the RC polling
493 callback so we can reuse the input device setup in
494 dvb-usb-remote.c. However, the actual work is being done
495 in the bulk URB completion handler. */
496 return 0;
497 }
498
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -0300499 i = dib0700_ctrl_rd(d, rc_request, 2, key, 4);
500 if (i <= 0) {
Janne Grunau034d65e2007-07-31 08:48:40 -0300501 err("RC Query Failed");
Janne Grunau89f42672007-07-31 19:45:13 -0300502 return -1;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300503 }
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300504
505 /* losing half of KEY_0 events from Philipps rc5 remotes.. */
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -0300506 if (key[0] == 0 && key[1] == 0 && key[2] == 0 && key[3] == 0)
507 return 0;
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300508
509 /* 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]); */
510
511 dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */
512
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -0300513 d->last_event = 0;
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -0300514 switch (d->props.rc.core.protocol) {
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -0300515 case RC_TYPE_NEC:
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300516 /* NEC protocol sends repeat code as 0 0 0 FF */
517 if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -0300518 (key[3] == 0xff))
519 keycode = d->last_event;
520 else {
521 keycode = key[3-2] << 8 | key[3-3];
522 d->last_event = keycode;
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300523 }
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300524
Mauro Carvalho Chehabca866742010-11-17 13:53:11 -0300525 rc_keydown(d->rc_dev, keycode, 0);
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -0300526 break;
527 default:
528 /* RC-5 protocol changes toggle bit on new keypress */
529 keycode = key[3-2] << 8 | key[3-3];
530 toggle = key[3-1];
Mauro Carvalho Chehabca866742010-11-17 13:53:11 -0300531 rc_keydown(d->rc_dev, keycode, toggle);
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -0300532
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300533 break;
534 }
Olivier DANET54d75eb2007-07-25 14:42:54 -0300535 return 0;
536}
537
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300538/* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
Patrick Boettchera75763f2006-10-18 08:34:16 -0300539static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
Olivier Grenie9c783032009-12-07 07:49:40 -0300540 BAND_UHF | BAND_VHF,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300541
542 /* 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,
543 * 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 -0300544 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
545 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300546
Olivier Grenie9c783032009-12-07 07:49:40 -0300547 712,
548 41,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300549
Olivier Grenie9c783032009-12-07 07:49:40 -0300550 0,
551 118,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300552
Olivier Grenie9c783032009-12-07 07:49:40 -0300553 0,
554 4095,
555 0,
556 0,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300557
Olivier Grenie9c783032009-12-07 07:49:40 -0300558 42598,
559 17694,
560 45875,
561 2621,
562 0,
563 76,
564 139,
565 52,
566 59,
567 107,
568 172,
569 57,
570 70,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300571
Olivier Grenie9c783032009-12-07 07:49:40 -0300572 21,
573 25,
574 28,
575 48,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300576
Olivier Grenie9c783032009-12-07 07:49:40 -0300577 1,
578 { 0,
579 107,
580 51800,
581 24700
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300582 },
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300583};
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300584
Patrick Boettchera75763f2006-10-18 08:34:16 -0300585static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
586 BAND_UHF | BAND_VHF,
587
588 /* 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,
589 * 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 -0300590 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
591 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
Patrick Boettchera75763f2006-10-18 08:34:16 -0300592
Olivier Grenie9c783032009-12-07 07:49:40 -0300593 712,
594 41,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300595
Olivier Grenie9c783032009-12-07 07:49:40 -0300596 0,
597 118,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300598
Olivier Grenie9c783032009-12-07 07:49:40 -0300599 0,
600 4095,
601 0,
602 0,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300603
Olivier Grenie9c783032009-12-07 07:49:40 -0300604 42598,
605 16384,
606 42598,
607 0,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300608
Olivier Grenie9c783032009-12-07 07:49:40 -0300609 0,
610 137,
611 255,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300612
Olivier Grenie9c783032009-12-07 07:49:40 -0300613 0,
614 255,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300615
Olivier Grenie9c783032009-12-07 07:49:40 -0300616 0,
617 0,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300618
Olivier Grenie9c783032009-12-07 07:49:40 -0300619 0,
620 41,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300621
Olivier Grenie9c783032009-12-07 07:49:40 -0300622 15,
623 25,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300624
Olivier Grenie9c783032009-12-07 07:49:40 -0300625 28,
626 48,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300627
Olivier Grenie9c783032009-12-07 07:49:40 -0300628 0,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300629};
630
631static struct dibx000_bandwidth_config stk7700p_pll_config = {
Olivier Grenie9c783032009-12-07 07:49:40 -0300632 60000, 30000,
633 1, 8, 3, 1, 0,
634 0, 0, 1, 1, 0,
635 (3 << 14) | (1 << 12) | (524 << 0),
636 60258167,
637 20452225,
638 30000000,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300639};
640
641static struct dib7000m_config stk7700p_dib7000m_config = {
642 .dvbt_mode = 1,
643 .output_mpeg2_in_188_bytes = 1,
644 .quartz_direct = 1,
645
646 .agc_config_count = 1,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300647 .agc = &stk7700p_7000m_mt2060_agc_config,
648 .bw = &stk7700p_pll_config,
649
650 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
651 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
652 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
653};
654
655static struct dib7000p_config stk7700p_dib7000p_config = {
656 .output_mpeg2_in_188_bytes = 1,
657
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300658 .agc_config_count = 1,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300659 .agc = &stk7700p_7000p_mt2060_agc_config,
660 .bw = &stk7700p_pll_config,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300661
662 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
663 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
664 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
665};
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300666
667static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
668{
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300669 struct dib0700_state *st = adap->dev->priv;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300670 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
Patrick Boettchera75763f2006-10-18 08:34:16 -0300671
672 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
673 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
674
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300675 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
Patrick Boettchera75763f2006-10-18 08:34:16 -0300676 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
677
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300678 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
Patrick Boettchera75763f2006-10-18 08:34:16 -0300679 dib0700_ctrl_clock(adap->dev, 72, 1);
680 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
681
682 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300683
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300684 st->mt2060_if1[0] = 1220;
Patrick Boettchera75763f2006-10-18 08:34:16 -0300685
686 if (dib7000pc_detection(&adap->dev->i2c_adap)) {
687 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
688 st->is_dib7000pc = 1;
689 } else
690 adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
691
692 return adap->fe == NULL ? -ENODEV : 0;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300693}
694
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300695static struct mt2060_config stk7700p_mt2060_config = {
696 0x60
697};
698
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300699static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
700{
Olivier DANETc52344f2008-01-25 06:50:07 -0300701 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300702 struct dib0700_state *st = adap->dev->priv;
Patrick Boettchera75763f2006-10-18 08:34:16 -0300703 struct i2c_adapter *tun_i2c;
Olivier DANETc52344f2008-01-25 06:50:07 -0300704 s8 a;
705 int if1=1220;
Al Viroda5ee482008-05-21 00:31:21 -0300706 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
707 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
Olivier DANETc52344f2008-01-25 06:50:07 -0300708 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
709 }
Patrick Boettchera75763f2006-10-18 08:34:16 -0300710 if (st->is_dib7000pc)
711 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
712 else
713 tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
714
715 return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config,
Olivier DANETc52344f2008-01-25 06:50:07 -0300716 if1) == NULL ? -ENODEV : 0;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300717}
718
Patrick Boettcher01373a52007-07-30 12:49:04 -0300719/* DIB7070 generic */
720static struct dibx000_agc_config dib7070_agc_config = {
721 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
722 /* 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,
723 * 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 -0300724 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
725 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
Patrick Boettcher01373a52007-07-30 12:49:04 -0300726
Olivier Grenie9c783032009-12-07 07:49:40 -0300727 600,
728 10,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300729
Olivier Grenie9c783032009-12-07 07:49:40 -0300730 0,
731 118,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300732
Olivier Grenie9c783032009-12-07 07:49:40 -0300733 0,
734 3530,
735 1,
736 5,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300737
Olivier Grenie9c783032009-12-07 07:49:40 -0300738 65535,
739 0,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300740
Olivier Grenie9c783032009-12-07 07:49:40 -0300741 65535,
742 0,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300743
Olivier Grenie9c783032009-12-07 07:49:40 -0300744 0,
745 40,
746 183,
747 206,
748 255,
749 72,
750 152,
751 88,
752 90,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300753
Olivier Grenie9c783032009-12-07 07:49:40 -0300754 17,
755 27,
756 23,
757 51,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300758
Olivier Grenie9c783032009-12-07 07:49:40 -0300759 0,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300760};
761
762static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
763{
Patrick Boettcher7e5ce652009-08-03 13:43:40 -0300764 deb_info("reset: %d", onoff);
Patrick Boettcher01373a52007-07-30 12:49:04 -0300765 return dib7000p_set_gpio(fe, 8, 0, !onoff);
766}
767
768static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
769{
Patrick Boettcher7e5ce652009-08-03 13:43:40 -0300770 deb_info("sleep: %d", onoff);
Patrick Boettcher01373a52007-07-30 12:49:04 -0300771 return dib7000p_set_gpio(fe, 9, 0, onoff);
772}
773
774static struct dib0070_config dib7070p_dib0070_config[2] = {
775 {
776 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
777 .reset = dib7070_tuner_reset,
778 .sleep = dib7070_tuner_sleep,
779 .clock_khz = 12000,
Patrick Boettcher7e5ce652009-08-03 13:43:40 -0300780 .clock_pad_drive = 4,
781 .charge_pump = 2,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300782 }, {
783 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
784 .reset = dib7070_tuner_reset,
785 .sleep = dib7070_tuner_sleep,
786 .clock_khz = 12000,
Patrick Boettcher7e5ce652009-08-03 13:43:40 -0300787 .charge_pump = 2,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300788 }
789};
790
Olivier Grenied300bd62009-09-15 06:55:35 -0300791static struct dib0070_config dib7770p_dib0070_config = {
792 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
793 .reset = dib7070_tuner_reset,
794 .sleep = dib7070_tuner_sleep,
795 .clock_khz = 12000,
796 .clock_pad_drive = 0,
797 .flip_chip = 1,
Olivier Grenieeac1fe12009-09-23 13:41:27 -0300798 .charge_pump = 2,
Olivier Grenied300bd62009-09-15 06:55:35 -0300799};
800
Patrick Boettcher01373a52007-07-30 12:49:04 -0300801static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
802{
803 struct dvb_usb_adapter *adap = fe->dvb->priv;
804 struct dib0700_adapter_state *state = adap->priv;
805
806 u16 offset;
807 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
808 switch (band) {
809 case BAND_VHF: offset = 950; break;
810 case BAND_UHF:
811 default: offset = 550; break;
812 }
813 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
814 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
815 return state->set_param_save(fe, fep);
816}
817
Olivier Grenied300bd62009-09-15 06:55:35 -0300818static int dib7770_set_param_override(struct dvb_frontend *fe,
819 struct dvb_frontend_parameters *fep)
820{
821 struct dvb_usb_adapter *adap = fe->dvb->priv;
822 struct dib0700_adapter_state *state = adap->priv;
823
824 u16 offset;
825 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
826 switch (band) {
827 case BAND_VHF:
828 dib7000p_set_gpio(fe, 0, 0, 1);
829 offset = 850;
830 break;
831 case BAND_UHF:
832 default:
833 dib7000p_set_gpio(fe, 0, 0, 0);
834 offset = 250;
835 break;
836 }
837 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
838 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
839 return state->set_param_save(fe, fep);
840}
841
842static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
843{
844 struct dib0700_adapter_state *st = adap->priv;
845 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe,
846 DIBX000_I2C_INTERFACE_TUNER, 1);
847
848 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
849 &dib7770p_dib0070_config) == NULL)
850 return -ENODEV;
851
852 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
853 adap->fe->ops.tuner_ops.set_params = dib7770_set_param_override;
854 return 0;
855}
856
Patrick Boettcher01373a52007-07-30 12:49:04 -0300857static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
858{
859 struct dib0700_adapter_state *st = adap->priv;
860 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
861
862 if (adap->id == 0) {
863 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
864 return -ENODEV;
865 } else {
866 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
867 return -ENODEV;
868 }
869
870 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
871 adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override;
872 return 0;
873}
874
Olivier Greniee192a7c2011-01-14 13:58:59 -0300875static int stk7700p_pid_filter(struct dvb_usb_adapter *adapter, int index,
876 u16 pid, int onoff)
877{
878 struct dib0700_state *st = adapter->dev->priv;
879 if (st->is_dib7000pc)
880 return dib7000p_pid_filter(adapter->fe, index, pid, onoff);
881 return dib7000m_pid_filter(adapter->fe, index, pid, onoff);
882}
883
884static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
885{
886 struct dib0700_state *st = adapter->dev->priv;
887 if (st->is_dib7000pc)
888 return dib7000p_pid_filter_ctrl(adapter->fe, onoff);
889 return dib7000m_pid_filter_ctrl(adapter->fe, onoff);
890}
891
Olivier Grenief8731f42009-09-18 04:08:43 -0300892static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
893{
894 return dib7000p_pid_filter(adapter->fe, index, pid, onoff);
895}
896
897static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
898{
899 return dib7000p_pid_filter_ctrl(adapter->fe, onoff);
900}
901
Patrick Boettcher01373a52007-07-30 12:49:04 -0300902static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
Olivier Grenie9c783032009-12-07 07:49:40 -0300903 60000, 15000,
904 1, 20, 3, 1, 0,
905 0, 0, 1, 1, 2,
906 (3 << 14) | (1 << 12) | (524 << 0),
907 (0 << 25) | 0,
908 20452225,
909 12000000,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300910};
911
912static struct dib7000p_config dib7070p_dib7000p_config = {
913 .output_mpeg2_in_188_bytes = 1,
914
915 .agc_config_count = 1,
916 .agc = &dib7070_agc_config,
917 .bw = &dib7070_bw_config_12_mhz,
Patrick Boettcher3cb2c392008-01-25 07:25:20 -0300918 .tuner_is_baseband = 1,
919 .spur_protect = 1,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300920
921 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
922 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
923 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
924
925 .hostbus_diversity = 1,
926};
927
928/* STK7070P */
929static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
930{
Al Viroda5ee482008-05-21 00:31:21 -0300931 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
932 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
933 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
934 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300935 else
Al Viroda5ee482008-05-21 00:31:21 -0300936 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
Patrick Boettcher01373a52007-07-30 12:49:04 -0300937 msleep(10);
938 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
939 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
940 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
941 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
942
943 dib0700_ctrl_clock(adap->dev, 72, 1);
944
945 msleep(10);
946 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
947 msleep(10);
948 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
949
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -0300950 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
951 &dib7070p_dib7000p_config) != 0) {
952 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
953 __func__);
954 return -ENODEV;
955 }
Patrick Boettcher01373a52007-07-30 12:49:04 -0300956
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300957 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
958 &dib7070p_dib7000p_config);
Patrick Boettcher01373a52007-07-30 12:49:04 -0300959 return adap->fe == NULL ? -ENODEV : 0;
960}
961
Olivier Grenie90e12ce2010-09-07 12:50:45 -0300962/* STK7770P */
963static struct dib7000p_config dib7770p_dib7000p_config = {
964 .output_mpeg2_in_188_bytes = 1,
965
966 .agc_config_count = 1,
967 .agc = &dib7070_agc_config,
968 .bw = &dib7070_bw_config_12_mhz,
969 .tuner_is_baseband = 1,
970 .spur_protect = 1,
971
972 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
973 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
974 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
975
976 .hostbus_diversity = 1,
977 .enable_current_mirror = 1,
Olivier Grenie970d14c2010-09-07 12:50:46 -0300978 .disable_sample_and_hold = 0,
Olivier Grenie90e12ce2010-09-07 12:50:45 -0300979};
980
981static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap)
982{
983 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
984 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
985 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
986 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
987 else
988 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
989 msleep(10);
990 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
991 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
992 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
993 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
994
995 dib0700_ctrl_clock(adap->dev, 72, 1);
996
997 msleep(10);
998 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
999 msleep(10);
1000 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1001
1002 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1003 &dib7770p_dib7000p_config) != 0) {
1004 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1005 __func__);
1006 return -ENODEV;
1007 }
1008
1009 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
1010 &dib7770p_dib7000p_config);
1011 return adap->fe == NULL ? -ENODEV : 0;
1012}
1013
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001014/* DIB807x generic */
1015static struct dibx000_agc_config dib807x_agc_config[2] = {
1016 {
1017 BAND_VHF,
1018 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1019 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1020 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1021 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1022 * P_agc_write=0 */
1023 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1024 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1025 (0 << 0), /* setup*/
1026
1027 600, /* inv_gain*/
1028 10, /* time_stabiliz*/
1029
1030 0, /* alpha_level*/
1031 118, /* thlock*/
1032
1033 0, /* wbd_inv*/
1034 3530, /* wbd_ref*/
1035 1, /* wbd_sel*/
1036 5, /* wbd_alpha*/
1037
1038 65535, /* agc1_max*/
1039 0, /* agc1_min*/
1040
1041 65535, /* agc2_max*/
1042 0, /* agc2_min*/
1043
1044 0, /* agc1_pt1*/
1045 40, /* agc1_pt2*/
1046 183, /* agc1_pt3*/
1047 206, /* agc1_slope1*/
1048 255, /* agc1_slope2*/
1049 72, /* agc2_pt1*/
1050 152, /* agc2_pt2*/
1051 88, /* agc2_slope1*/
1052 90, /* agc2_slope2*/
1053
1054 17, /* alpha_mant*/
1055 27, /* alpha_exp*/
1056 23, /* beta_mant*/
1057 51, /* beta_exp*/
1058
1059 0, /* perform_agc_softsplit*/
1060 }, {
1061 BAND_UHF,
1062 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1063 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1064 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1065 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1066 * P_agc_write=0 */
1067 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1068 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1069 (0 << 0), /* setup */
1070
1071 600, /* inv_gain*/
1072 10, /* time_stabiliz*/
1073
1074 0, /* alpha_level*/
1075 118, /* thlock*/
1076
1077 0, /* wbd_inv*/
1078 3530, /* wbd_ref*/
1079 1, /* wbd_sel*/
1080 5, /* wbd_alpha*/
1081
1082 65535, /* agc1_max*/
1083 0, /* agc1_min*/
1084
1085 65535, /* agc2_max*/
1086 0, /* agc2_min*/
1087
1088 0, /* agc1_pt1*/
1089 40, /* agc1_pt2*/
1090 183, /* agc1_pt3*/
1091 206, /* agc1_slope1*/
1092 255, /* agc1_slope2*/
1093 72, /* agc2_pt1*/
1094 152, /* agc2_pt2*/
1095 88, /* agc2_slope1*/
1096 90, /* agc2_slope2*/
1097
1098 17, /* alpha_mant*/
1099 27, /* alpha_exp*/
1100 23, /* beta_mant*/
1101 51, /* beta_exp*/
1102
1103 0, /* perform_agc_softsplit*/
1104 }
1105};
1106
1107static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
1108 60000, 15000, /* internal, sampling*/
1109 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/
1110 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
1111 ADClkSrc, modulo */
1112 (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1113 (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1114 18179755, /* timf*/
1115 12000000, /* xtal_hz*/
1116};
1117
1118static struct dib8000_config dib807x_dib8000_config[2] = {
1119 {
1120 .output_mpeg2_in_188_bytes = 1,
1121
1122 .agc_config_count = 2,
1123 .agc = dib807x_agc_config,
1124 .pll = &dib807x_bw_config_12_mhz,
1125 .tuner_is_baseband = 1,
1126
1127 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1128 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1129 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1130
1131 .hostbus_diversity = 1,
1132 .div_cfg = 1,
1133 .agc_control = &dib0070_ctrl_agc_filter,
1134 .output_mode = OUTMODE_MPEG2_FIFO,
1135 .drives = 0x2d98,
1136 }, {
1137 .output_mpeg2_in_188_bytes = 1,
1138
1139 .agc_config_count = 2,
1140 .agc = dib807x_agc_config,
1141 .pll = &dib807x_bw_config_12_mhz,
1142 .tuner_is_baseband = 1,
1143
1144 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1145 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1146 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1147
1148 .hostbus_diversity = 1,
1149 .agc_control = &dib0070_ctrl_agc_filter,
1150 .output_mode = OUTMODE_MPEG2_FIFO,
1151 .drives = 0x2d98,
1152 }
1153};
1154
Olivier Grenie03245a52009-12-04 13:27:57 -03001155static int dib80xx_tuner_reset(struct dvb_frontend *fe, int onoff)
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001156{
1157 return dib8000_set_gpio(fe, 5, 0, !onoff);
1158}
1159
Olivier Grenie03245a52009-12-04 13:27:57 -03001160static int dib80xx_tuner_sleep(struct dvb_frontend *fe, int onoff)
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001161{
1162 return dib8000_set_gpio(fe, 0, 0, onoff);
1163}
1164
1165static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
1166 { 240, 7},
1167 { 0xffff, 6},
1168};
1169
1170static struct dib0070_config dib807x_dib0070_config[2] = {
1171 {
1172 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
Olivier Grenie03245a52009-12-04 13:27:57 -03001173 .reset = dib80xx_tuner_reset,
1174 .sleep = dib80xx_tuner_sleep,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001175 .clock_khz = 12000,
1176 .clock_pad_drive = 4,
1177 .vga_filter = 1,
1178 .force_crystal_mode = 1,
1179 .enable_third_order_filter = 1,
1180 .charge_pump = 0,
1181 .wbd_gain = dib8070_wbd_gain_cfg,
1182 .osc_buffer_state = 0,
1183 .freq_offset_khz_uhf = -100,
1184 .freq_offset_khz_vhf = -100,
1185 }, {
1186 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
Olivier Grenie03245a52009-12-04 13:27:57 -03001187 .reset = dib80xx_tuner_reset,
1188 .sleep = dib80xx_tuner_sleep,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001189 .clock_khz = 12000,
1190 .clock_pad_drive = 2,
1191 .vga_filter = 1,
1192 .force_crystal_mode = 1,
1193 .enable_third_order_filter = 1,
1194 .charge_pump = 0,
1195 .wbd_gain = dib8070_wbd_gain_cfg,
1196 .osc_buffer_state = 0,
1197 .freq_offset_khz_uhf = -25,
1198 .freq_offset_khz_vhf = -25,
1199 }
1200};
1201
1202static int dib807x_set_param_override(struct dvb_frontend *fe,
1203 struct dvb_frontend_parameters *fep)
1204{
1205 struct dvb_usb_adapter *adap = fe->dvb->priv;
1206 struct dib0700_adapter_state *state = adap->priv;
1207
1208 u16 offset = dib0070_wbd_offset(fe);
1209 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1210 switch (band) {
1211 case BAND_VHF:
1212 offset += 750;
1213 break;
1214 case BAND_UHF: /* fall-thru wanted */
1215 default:
1216 offset += 250; break;
1217 }
1218 deb_info("WBD for DiB8000: %d\n", offset);
1219 dib8000_set_wbd_ref(fe, offset);
1220
1221 return state->set_param_save(fe, fep);
1222}
1223
1224static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1225{
1226 struct dib0700_adapter_state *st = adap->priv;
1227 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe,
1228 DIBX000_I2C_INTERFACE_TUNER, 1);
1229
1230 if (adap->id == 0) {
1231 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1232 &dib807x_dib0070_config[0]) == NULL)
1233 return -ENODEV;
1234 } else {
1235 if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,
1236 &dib807x_dib0070_config[1]) == NULL)
1237 return -ENODEV;
1238 }
1239
1240 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1241 adap->fe->ops.tuner_ops.set_params = dib807x_set_param_override;
1242 return 0;
1243}
1244
Olivier Grenie9c783032009-12-07 07:49:40 -03001245static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index,
1246 u16 pid, int onoff)
Olivier Grenief8731f42009-09-18 04:08:43 -03001247{
Olivier Greniebe9bae12011-01-04 05:42:19 -03001248 return dib8000_pid_filter(adapter->fe, index, pid, onoff);
Olivier Grenief8731f42009-09-18 04:08:43 -03001249}
1250
Olivier Grenie9c783032009-12-07 07:49:40 -03001251static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter,
Olivier Greniebe9bae12011-01-04 05:42:19 -03001252 int onoff)
Olivier Grenief8731f42009-09-18 04:08:43 -03001253{
Olivier Greniebe9bae12011-01-04 05:42:19 -03001254 return dib8000_pid_filter_ctrl(adapter->fe, onoff);
Olivier Grenief8731f42009-09-18 04:08:43 -03001255}
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001256
1257/* STK807x */
1258static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
1259{
1260 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1261 msleep(10);
1262 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1263 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1264 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1265
1266 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1267
1268 dib0700_ctrl_clock(adap->dev, 72, 1);
1269
1270 msleep(10);
1271 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1272 msleep(10);
1273 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1274
1275 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1276 0x80);
1277
1278 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1279 &dib807x_dib8000_config[0]);
1280
1281 return adap->fe == NULL ? -ENODEV : 0;
1282}
1283
1284/* STK807xPVR */
1285static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
1286{
1287 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1288 msleep(30);
1289 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1290 msleep(500);
1291 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1292 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1293 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1294
1295 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1296
1297 dib0700_ctrl_clock(adap->dev, 72, 1);
1298
1299 msleep(10);
1300 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1301 msleep(10);
1302 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1303
1304 /* initialize IC 0 */
Olivier Grenie9542f502009-12-07 08:09:04 -03001305 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80);
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001306
1307 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
1308 &dib807x_dib8000_config[0]);
1309
1310 return adap->fe == NULL ? -ENODEV : 0;
1311}
1312
1313static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
1314{
1315 /* initialize IC 1 */
Olivier Grenie9542f502009-12-07 08:09:04 -03001316 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82);
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001317
1318 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82,
1319 &dib807x_dib8000_config[1]);
1320
1321 return adap->fe == NULL ? -ENODEV : 0;
1322}
1323
Olivier Grenie03245a52009-12-04 13:27:57 -03001324/* STK8096GP */
1325struct dibx000_agc_config dib8090_agc_config[2] = {
Olivier Greniebe9bae12011-01-04 05:42:19 -03001326 {
Olivier Grenie03245a52009-12-04 13:27:57 -03001327 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
Olivier Grenie9c783032009-12-07 07:49:40 -03001328 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
Olivier Greniebe9bae12011-01-04 05:42:19 -03001329 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1330 * 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 -03001331 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1332 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
Olivier Grenie03245a52009-12-04 13:27:57 -03001333
Olivier Grenie9c783032009-12-07 07:49:40 -03001334 787,
1335 10,
Olivier Grenie03245a52009-12-04 13:27:57 -03001336
Olivier Grenie9c783032009-12-07 07:49:40 -03001337 0,
1338 118,
Olivier Grenie03245a52009-12-04 13:27:57 -03001339
Olivier Grenie9c783032009-12-07 07:49:40 -03001340 0,
1341 3530,
1342 1,
1343 5,
Olivier Grenie03245a52009-12-04 13:27:57 -03001344
Olivier Grenie9c783032009-12-07 07:49:40 -03001345 65535,
1346 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001347
Olivier Grenie9c783032009-12-07 07:49:40 -03001348 65535,
1349 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001350
Olivier Grenie9c783032009-12-07 07:49:40 -03001351 0,
1352 32,
1353 114,
1354 143,
1355 144,
1356 114,
1357 227,
1358 116,
1359 117,
Olivier Grenie03245a52009-12-04 13:27:57 -03001360
Olivier Grenie9c783032009-12-07 07:49:40 -03001361 28,
1362 26,
1363 31,
1364 51,
Olivier Grenie03245a52009-12-04 13:27:57 -03001365
Olivier Grenie9c783032009-12-07 07:49:40 -03001366 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03001367 },
1368 {
Olivier Grenie03245a52009-12-04 13:27:57 -03001369 BAND_CBAND,
Olivier Grenie9c783032009-12-07 07:49:40 -03001370 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,
Olivier Greniebe9bae12011-01-04 05:42:19 -03001371 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1372 * 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 -03001373 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1374 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
Olivier Grenie03245a52009-12-04 13:27:57 -03001375
Olivier Grenie9c783032009-12-07 07:49:40 -03001376 787,
1377 10,
Olivier Grenie03245a52009-12-04 13:27:57 -03001378
Olivier Grenie9c783032009-12-07 07:49:40 -03001379 0,
1380 118,
Olivier Grenie03245a52009-12-04 13:27:57 -03001381
Olivier Grenie9c783032009-12-07 07:49:40 -03001382 0,
1383 3530,
1384 1,
1385 5,
Olivier Grenie03245a52009-12-04 13:27:57 -03001386
Olivier Grenie9c783032009-12-07 07:49:40 -03001387 0,
1388 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001389
Olivier Grenie9c783032009-12-07 07:49:40 -03001390 65535,
1391 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001392
Olivier Grenie9c783032009-12-07 07:49:40 -03001393 0,
1394 32,
1395 114,
1396 143,
1397 144,
1398 114,
1399 227,
1400 116,
1401 117,
Olivier Grenie03245a52009-12-04 13:27:57 -03001402
Olivier Grenie9c783032009-12-07 07:49:40 -03001403 28,
1404 26,
1405 31,
1406 51,
Olivier Grenie03245a52009-12-04 13:27:57 -03001407
Olivier Grenie9c783032009-12-07 07:49:40 -03001408 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03001409 }
Olivier Grenie03245a52009-12-04 13:27:57 -03001410};
1411
1412static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = {
Olivier Greniebe9bae12011-01-04 05:42:19 -03001413 54000, 13500,
1414 1, 18, 3, 1, 0,
1415 0, 0, 1, 1, 2,
1416 (3 << 14) | (1 << 12) | (599 << 0),
1417 (0 << 25) | 0,
1418 20199727,
1419 12000000,
Olivier Grenie03245a52009-12-04 13:27:57 -03001420};
1421
1422static int dib8090_get_adc_power(struct dvb_frontend *fe)
1423{
Olivier Greniebe9bae12011-01-04 05:42:19 -03001424 return dib8000_get_adc_power(fe, 1);
Olivier Grenie03245a52009-12-04 13:27:57 -03001425}
1426
Olivier Greniebe9bae12011-01-04 05:42:19 -03001427static struct dib8000_config dib809x_dib8000_config[2] = {
1428 {
1429 .output_mpeg2_in_188_bytes = 1,
Olivier Grenie03245a52009-12-04 13:27:57 -03001430
Olivier Greniebe9bae12011-01-04 05:42:19 -03001431 .agc_config_count = 2,
1432 .agc = dib8090_agc_config,
1433 .agc_control = dib0090_dcc_freq,
1434 .pll = &dib8090_pll_config_12mhz,
1435 .tuner_is_baseband = 1,
Olivier Grenie03245a52009-12-04 13:27:57 -03001436
Olivier Greniebe9bae12011-01-04 05:42:19 -03001437 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1438 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1439 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
Olivier Grenie03245a52009-12-04 13:27:57 -03001440
Olivier Greniebe9bae12011-01-04 05:42:19 -03001441 .hostbus_diversity = 1,
1442 .div_cfg = 0x31,
1443 .output_mode = OUTMODE_MPEG2_FIFO,
1444 .drives = 0x2d98,
1445 .diversity_delay = 48,
1446 .refclksel = 3,
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001447 }, {
Olivier Greniebe9bae12011-01-04 05:42:19 -03001448 .output_mpeg2_in_188_bytes = 1,
1449
1450 .agc_config_count = 2,
1451 .agc = dib8090_agc_config,
1452 .agc_control = dib0090_dcc_freq,
1453 .pll = &dib8090_pll_config_12mhz,
1454 .tuner_is_baseband = 1,
1455
1456 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1457 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1458 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1459
1460 .hostbus_diversity = 1,
1461 .div_cfg = 0x31,
1462 .output_mode = OUTMODE_DIVERSITY,
1463 .drives = 0x2d08,
1464 .diversity_delay = 1,
1465 .refclksel = 3,
1466 }
1467};
1468
1469static struct dib0090_wbd_slope dib8090_wbd_table[] = {
1470 /* max freq ; cold slope ; cold offset ; warm slope ; warm offset ; wbd gain */
1471 { 120, 0, 500, 0, 500, 4 }, /* CBAND */
1472 { 170, 0, 450, 0, 450, 4 }, /* CBAND */
1473 { 380, 48, 373, 28, 259, 6 }, /* VHF */
1474 { 860, 34, 700, 36, 616, 6 }, /* high UHF */
1475 { 0xFFFF, 34, 700, 36, 616, 6 }, /* default */
Olivier Grenie03245a52009-12-04 13:27:57 -03001476};
1477
1478static struct dib0090_config dib809x_dib0090_config = {
Olivier Greniebe9bae12011-01-04 05:42:19 -03001479 .io.pll_bypass = 1,
1480 .io.pll_range = 1,
1481 .io.pll_prediv = 1,
1482 .io.pll_loopdiv = 20,
1483 .io.adc_clock_ratio = 8,
1484 .io.pll_int_loop_filt = 0,
1485 .io.clock_khz = 12000,
1486 .reset = dib80xx_tuner_reset,
1487 .sleep = dib80xx_tuner_sleep,
1488 .clkouttobamse = 1,
1489 .analog_output = 1,
1490 .i2c_address = DEFAULT_DIB0090_I2C_ADDRESS,
1491 .use_pwm_agc = 1,
1492 .clkoutdrive = 1,
1493 .get_adc_power = dib8090_get_adc_power,
1494 .freq_offset_khz_uhf = -63,
Olivier Grenie03245a52009-12-04 13:27:57 -03001495 .freq_offset_khz_vhf = -143,
Olivier Greniebe9bae12011-01-04 05:42:19 -03001496 .wbd = dib8090_wbd_table,
1497 .fref_clock_ratio = 6,
Olivier Grenie03245a52009-12-04 13:27:57 -03001498};
1499
1500static int dib8096_set_param_override(struct dvb_frontend *fe,
1501 struct dvb_frontend_parameters *fep)
1502{
Olivier Greniebe9bae12011-01-04 05:42:19 -03001503 struct dvb_usb_adapter *adap = fe->dvb->priv;
1504 struct dib0700_adapter_state *state = adap->priv;
1505 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1506 u16 target;
1507 int ret = 0;
1508 enum frontend_tune_state tune_state = CT_SHUTDOWN;
1509 u16 ltgain, rf_gain_limit;
Olivier Grenie03245a52009-12-04 13:27:57 -03001510
Olivier Greniebe9bae12011-01-04 05:42:19 -03001511 ret = state->set_param_save(fe, fep);
1512 if (ret < 0)
1513 return ret;
Olivier Grenie03245a52009-12-04 13:27:57 -03001514
Olivier Greniebe9bae12011-01-04 05:42:19 -03001515 target = (dib0090_get_wbd_offset(fe) * 8 * 18 / 33 + 1) / 2;
1516 dib8000_set_wbd_ref(fe, target);
Olivier Grenie03245a52009-12-04 13:27:57 -03001517
1518
Olivier Greniebe9bae12011-01-04 05:42:19 -03001519 if (band == BAND_CBAND) {
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001520 deb_info("tuning in CBAND - soft-AGC startup\n");
1521 dib0090_set_tune_state(fe, CT_AGC_START);
1522 do {
1523 ret = dib0090_gain_control(fe);
1524 msleep(ret);
1525 tune_state = dib0090_get_tune_state(fe);
1526 if (tune_state == CT_AGC_STEP_0)
1527 dib8000_set_gpio(fe, 6, 0, 1);
1528 else if (tune_state == CT_AGC_STEP_1) {
1529 dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, &ltgain);
1530 if (rf_gain_limit == 0)
1531 dib8000_set_gpio(fe, 6, 0, 0);
1532 }
1533 } while (tune_state < CT_AGC_STOP);
1534 dib0090_pwm_gain_reset(fe);
1535 dib8000_pwm_agc_reset(fe);
1536 dib8000_set_tune_state(fe, CT_DEMOD_START);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001537 } else {
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001538 deb_info("not tuning in CBAND - standard AGC startup\n");
1539 dib0090_pwm_gain_reset(fe);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001540 }
Olivier Grenie03245a52009-12-04 13:27:57 -03001541
Olivier Greniebe9bae12011-01-04 05:42:19 -03001542 return 0;
Olivier Grenie03245a52009-12-04 13:27:57 -03001543}
1544
1545static int dib809x_tuner_attach(struct dvb_usb_adapter *adap)
1546{
Olivier Greniebe9bae12011-01-04 05:42:19 -03001547 struct dib0700_adapter_state *st = adap->priv;
1548 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
Olivier Grenie03245a52009-12-04 13:27:57 -03001549
Olivier Greniebe9bae12011-01-04 05:42:19 -03001550 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1551 return -ENODEV;
Olivier Grenie03245a52009-12-04 13:27:57 -03001552
Olivier Greniebe9bae12011-01-04 05:42:19 -03001553 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1554 adap->fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1555 return 0;
Olivier Grenie03245a52009-12-04 13:27:57 -03001556}
1557
1558static int stk809x_frontend_attach(struct dvb_usb_adapter *adap)
1559{
1560 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1561 msleep(10);
1562 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1563 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1564 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1565
1566 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1567
1568 dib0700_ctrl_clock(adap->dev, 72, 1);
1569
1570 msleep(10);
1571 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1572 msleep(10);
1573 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1574
1575 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80);
1576
Olivier Greniebe9bae12011-01-04 05:42:19 -03001577 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
Olivier Grenie03245a52009-12-04 13:27:57 -03001578
1579 return adap->fe == NULL ? -ENODEV : 0;
1580}
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001581
Olivier Greniebe9bae12011-01-04 05:42:19 -03001582static int nim8096md_tuner_attach(struct dvb_usb_adapter *adap)
1583{
1584 struct dib0700_adapter_state *st = adap->priv;
1585 struct i2c_adapter *tun_i2c;
1586 struct dvb_frontend *fe_slave = dib8000_get_slave_frontend(adap->fe, 1);
1587
1588 if (fe_slave) {
1589 tun_i2c = dib8000_get_i2c_master(fe_slave, DIBX000_I2C_INTERFACE_TUNER, 1);
1590 if (dvb_attach(dib0090_register, fe_slave, tun_i2c, &dib809x_dib0090_config) == NULL)
1591 return -ENODEV;
1592 fe_slave->dvb = adap->fe->dvb;
1593 fe_slave->ops.tuner_ops.set_params = dib8096_set_param_override;
1594 }
1595 tun_i2c = dib8000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1596 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &dib809x_dib0090_config) == NULL)
1597 return -ENODEV;
1598
1599 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
1600 adap->fe->ops.tuner_ops.set_params = dib8096_set_param_override;
1601
1602 return 0;
1603}
1604
1605static int nim8096md_frontend_attach(struct dvb_usb_adapter *adap)
1606{
1607 struct dvb_frontend *fe_slave;
1608
1609 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001610 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001611 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1612 msleep(1000);
1613 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1614 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1615 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1616
1617 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1618
1619 dib0700_ctrl_clock(adap->dev, 72, 1);
1620
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001621 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001622 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001623 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001624 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1625
1626 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, 0x80);
1627
1628 adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
1629 if (adap->fe == NULL)
1630 return -ENODEV;
1631
1632 fe_slave = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82, &dib809x_dib8000_config[1]);
1633 dib8000_set_slave_frontend(adap->fe, fe_slave);
1634
1635 return fe_slave == NULL ? -ENODEV : 0;
1636}
1637
1638/* STK9090M */
1639static int dib90x0_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
1640{
1641 return dib9000_fw_pid_filter(adapter->fe, index, pid, onoff);
1642}
1643
1644static int dib90x0_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
1645{
1646 return dib9000_fw_pid_filter_ctrl(adapter->fe, onoff);
1647}
1648
1649static int dib90x0_tuner_reset(struct dvb_frontend *fe, int onoff)
1650{
1651 return dib9000_set_gpio(fe, 5, 0, !onoff);
1652}
1653
1654static int dib90x0_tuner_sleep(struct dvb_frontend *fe, int onoff)
1655{
1656 return dib9000_set_gpio(fe, 0, 0, onoff);
1657}
1658
1659static int dib01x0_pmu_update(struct i2c_adapter *i2c, u16 *data, u8 len)
1660{
1661 u8 wb[4] = { 0xc >> 8, 0xc & 0xff, 0, 0 };
1662 u8 rb[2];
1663 struct i2c_msg msg[2] = {
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001664 {.addr = 0x1e >> 1, .flags = 0, .buf = wb, .len = 2},
1665 {.addr = 0x1e >> 1, .flags = I2C_M_RD, .buf = rb, .len = 2},
Olivier Greniebe9bae12011-01-04 05:42:19 -03001666 };
1667 u8 index_data;
1668
1669 dibx000_i2c_set_speed(i2c, 250);
1670
1671 if (i2c_transfer(i2c, msg, 2) != 2)
1672 return -EIO;
1673
1674 switch (rb[0] << 8 | rb[1]) {
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001675 case 0:
Olivier Greniebe9bae12011-01-04 05:42:19 -03001676 deb_info("Found DiB0170 rev1: This version of DiB0170 is not supported any longer.\n");
1677 return -EIO;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001678 case 1:
Olivier Greniebe9bae12011-01-04 05:42:19 -03001679 deb_info("Found DiB0170 rev2");
1680 break;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001681 case 2:
Olivier Greniebe9bae12011-01-04 05:42:19 -03001682 deb_info("Found DiB0190 rev2");
1683 break;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001684 default:
Olivier Greniebe9bae12011-01-04 05:42:19 -03001685 deb_info("DiB01x0 not found");
1686 return -EIO;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001687 }
Olivier Greniebe9bae12011-01-04 05:42:19 -03001688
1689 for (index_data = 0; index_data < len; index_data += 2) {
1690 wb[2] = (data[index_data + 1] >> 8) & 0xff;
1691 wb[3] = (data[index_data + 1]) & 0xff;
1692
1693 if (data[index_data] == 0) {
1694 wb[0] = (data[index_data] >> 8) & 0xff;
1695 wb[1] = (data[index_data]) & 0xff;
1696 msg[0].len = 2;
1697 if (i2c_transfer(i2c, msg, 2) != 2)
1698 return -EIO;
1699 wb[2] |= rb[0];
1700 wb[3] |= rb[1] & ~(3 << 4);
1701 }
1702
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001703 wb[0] = (data[index_data] >> 8)&0xff;
1704 wb[1] = (data[index_data])&0xff;
Olivier Greniebe9bae12011-01-04 05:42:19 -03001705 msg[0].len = 4;
1706 if (i2c_transfer(i2c, &msg[0], 1) != 1)
1707 return -EIO;
1708 }
1709 return 0;
1710}
1711
1712static struct dib9000_config stk9090m_config = {
1713 .output_mpeg2_in_188_bytes = 1,
1714 .output_mode = OUTMODE_MPEG2_FIFO,
1715 .vcxo_timer = 279620,
1716 .timing_frequency = 20452225,
1717 .demod_clock_khz = 60000,
1718 .xtal_clock_khz = 30000,
1719 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
1720 .subband = {
1721 2,
1722 {
1723 { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0008 } }, /* GPIO 3 to 1 for VHF */
1724 { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0000 } }, /* GPIO 3 to 0 for UHF */
1725 { 0 },
1726 },
1727 },
1728 .gpio_function = {
1729 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
1730 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
1731 },
1732};
1733
1734static struct dib9000_config nim9090md_config[2] = {
1735 {
1736 .output_mpeg2_in_188_bytes = 1,
1737 .output_mode = OUTMODE_MPEG2_FIFO,
1738 .vcxo_timer = 279620,
1739 .timing_frequency = 20452225,
1740 .demod_clock_khz = 60000,
1741 .xtal_clock_khz = 30000,
1742 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
1743 }, {
1744 .output_mpeg2_in_188_bytes = 1,
1745 .output_mode = OUTMODE_DIVERSITY,
1746 .vcxo_timer = 279620,
1747 .timing_frequency = 20452225,
1748 .demod_clock_khz = 60000,
1749 .xtal_clock_khz = 30000,
1750 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
1751 .subband = {
1752 2,
1753 {
1754 { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0006 } }, /* GPIO 1 and 2 to 1 for VHF */
1755 { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0000 } }, /* GPIO 1 and 2 to 0 for UHF */
1756 { 0 },
1757 },
1758 },
1759 .gpio_function = {
1760 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
1761 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
1762 },
1763 }
1764};
1765
1766static struct dib0090_config dib9090_dib0090_config = {
1767 .io.pll_bypass = 0,
1768 .io.pll_range = 1,
1769 .io.pll_prediv = 1,
1770 .io.pll_loopdiv = 8,
1771 .io.adc_clock_ratio = 8,
1772 .io.pll_int_loop_filt = 0,
1773 .io.clock_khz = 30000,
1774 .reset = dib90x0_tuner_reset,
1775 .sleep = dib90x0_tuner_sleep,
1776 .clkouttobamse = 0,
1777 .analog_output = 0,
1778 .use_pwm_agc = 0,
1779 .clkoutdrive = 0,
1780 .freq_offset_khz_uhf = 0,
1781 .freq_offset_khz_vhf = 0,
1782};
1783
1784static struct dib0090_config nim9090md_dib0090_config[2] = {
1785 {
1786 .io.pll_bypass = 0,
1787 .io.pll_range = 1,
1788 .io.pll_prediv = 1,
1789 .io.pll_loopdiv = 8,
1790 .io.adc_clock_ratio = 8,
1791 .io.pll_int_loop_filt = 0,
1792 .io.clock_khz = 30000,
1793 .reset = dib90x0_tuner_reset,
1794 .sleep = dib90x0_tuner_sleep,
1795 .clkouttobamse = 1,
1796 .analog_output = 0,
1797 .use_pwm_agc = 0,
1798 .clkoutdrive = 0,
1799 .freq_offset_khz_uhf = 0,
1800 .freq_offset_khz_vhf = 0,
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001801 }, {
Olivier Greniebe9bae12011-01-04 05:42:19 -03001802 .io.pll_bypass = 0,
1803 .io.pll_range = 1,
1804 .io.pll_prediv = 1,
1805 .io.pll_loopdiv = 8,
1806 .io.adc_clock_ratio = 8,
1807 .io.pll_int_loop_filt = 0,
1808 .io.clock_khz = 30000,
1809 .reset = dib90x0_tuner_reset,
1810 .sleep = dib90x0_tuner_sleep,
1811 .clkouttobamse = 0,
1812 .analog_output = 0,
1813 .use_pwm_agc = 0,
1814 .clkoutdrive = 0,
1815 .freq_offset_khz_uhf = 0,
1816 .freq_offset_khz_vhf = 0,
1817 }
1818};
1819
1820
1821static int stk9090m_frontend_attach(struct dvb_usb_adapter *adap)
1822{
1823 struct dib0700_adapter_state *state = adap->priv;
1824 struct dib0700_state *st = adap->dev->priv;
1825 u32 fw_version;
1826
1827 /* Make use of the new i2c functions from FW 1.20 */
1828 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
1829 if (fw_version >= 0x10200)
1830 st->fw_use_new_i2c_api = 1;
1831 dib0700_set_i2c_speed(adap->dev, 340);
1832
1833 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001834 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001835 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1836 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1837 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1838 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1839
1840 dib0700_ctrl_clock(adap->dev, 72, 1);
1841
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001842 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001843 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001844 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001845 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1846
1847 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80);
1848
1849 if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {
1850 deb_info("%s: Upload failed. (file not found?)\n", __func__);
1851 return -ENODEV;
1852 } else {
1853 deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
1854 }
1855 stk9090m_config.microcode_B_fe_size = state->frontend_firmware->size;
1856 stk9090m_config.microcode_B_fe_buffer = state->frontend_firmware->data;
1857
1858 adap->fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &stk9090m_config);
1859
1860 return adap->fe == NULL ? -ENODEV : 0;
1861}
1862
1863static int dib9090_tuner_attach(struct dvb_usb_adapter *adap)
1864{
1865 struct dib0700_adapter_state *state = adap->priv;
1866 struct i2c_adapter *i2c = dib9000_get_tuner_interface(adap->fe);
1867 u16 data_dib190[10] = {
1868 1, 0x1374,
1869 2, 0x01a2,
1870 7, 0x0020,
1871 0, 0x00ef,
1872 8, 0x0486,
1873 };
1874
1875 if (dvb_attach(dib0090_fw_register, adap->fe, i2c, &dib9090_dib0090_config) == NULL)
1876 return -ENODEV;
1877 i2c = dib9000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
1878 if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0)
1879 return -ENODEV;
1880 dib0700_set_i2c_speed(adap->dev, 2000);
1881 if (dib9000_firmware_post_pll_init(adap->fe) < 0)
1882 return -ENODEV;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001883 release_firmware(state->frontend_firmware);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001884 return 0;
1885}
1886
1887static int nim9090md_frontend_attach(struct dvb_usb_adapter *adap)
1888{
1889 struct dib0700_adapter_state *state = adap->priv;
1890 struct dib0700_state *st = adap->dev->priv;
1891 struct i2c_adapter *i2c;
1892 struct dvb_frontend *fe_slave;
1893 u32 fw_version;
1894
1895 /* Make use of the new i2c functions from FW 1.20 */
1896 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
1897 if (fw_version >= 0x10200)
1898 st->fw_use_new_i2c_api = 1;
1899 dib0700_set_i2c_speed(adap->dev, 340);
1900
1901 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001902 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001903 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1904 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1905 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1906 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1907
1908 dib0700_ctrl_clock(adap->dev, 72, 1);
1909
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001910 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001911 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001912 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001913 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1914
1915 if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {
1916 deb_info("%s: Upload failed. (file not found?)\n", __func__);
1917 return -EIO;
1918 } else {
1919 deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
1920 }
1921 nim9090md_config[0].microcode_B_fe_size = state->frontend_firmware->size;
1922 nim9090md_config[0].microcode_B_fe_buffer = state->frontend_firmware->data;
1923 nim9090md_config[1].microcode_B_fe_size = state->frontend_firmware->size;
1924 nim9090md_config[1].microcode_B_fe_buffer = state->frontend_firmware->data;
1925
1926 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, 0x80);
1927 adap->fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &nim9090md_config[0]);
1928
1929 if (adap->fe == NULL)
1930 return -ENODEV;
1931
1932 i2c = dib9000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_GPIO_3_4, 0);
1933 dib9000_i2c_enumeration(i2c, 1, 0x12, 0x82);
1934
1935 fe_slave = dvb_attach(dib9000_attach, i2c, 0x82, &nim9090md_config[1]);
1936 dib9000_set_slave_frontend(adap->fe, fe_slave);
1937
1938 return fe_slave == NULL ? -ENODEV : 0;
1939}
1940
1941static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap)
1942{
1943 struct dib0700_adapter_state *state = adap->priv;
1944 struct i2c_adapter *i2c;
1945 struct dvb_frontend *fe_slave;
1946 u16 data_dib190[10] = {
1947 1, 0x5374,
1948 2, 0x01ae,
1949 7, 0x0020,
1950 0, 0x00ef,
1951 8, 0x0406,
1952 };
1953 i2c = dib9000_get_tuner_interface(adap->fe);
1954 if (dvb_attach(dib0090_fw_register, adap->fe, i2c, &nim9090md_dib0090_config[0]) == NULL)
1955 return -ENODEV;
1956 i2c = dib9000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
1957 if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0)
1958 return -ENODEV;
1959 dib0700_set_i2c_speed(adap->dev, 2000);
1960 if (dib9000_firmware_post_pll_init(adap->fe) < 0)
1961 return -ENODEV;
1962
1963 fe_slave = dib9000_get_slave_frontend(adap->fe, 1);
1964 if (fe_slave != NULL) {
1965 i2c = dib9000_get_component_bus_interface(adap->fe);
1966 dib9000_set_i2c_adapter(fe_slave, i2c);
1967
1968 i2c = dib9000_get_tuner_interface(fe_slave);
1969 if (dvb_attach(dib0090_fw_register, fe_slave, i2c, &nim9090md_dib0090_config[1]) == NULL)
1970 return -ENODEV;
1971 fe_slave->dvb = adap->fe->dvb;
1972 dib9000_fw_set_component_bus_speed(adap->fe, 2000);
1973 if (dib9000_firmware_post_pll_init(fe_slave) < 0)
1974 return -ENODEV;
1975 }
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001976 release_firmware(state->frontend_firmware);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001977
1978 return 0;
1979}
1980
1981/* NIM7090 */
1982struct dib7090p_best_adc {
1983 u32 timf;
1984 u32 pll_loopdiv;
1985 u32 pll_prediv;
1986};
1987
1988static int dib7090p_get_best_sampling(struct dvb_frontend *fe , struct dib7090p_best_adc *adc)
1989{
1990 u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1;
1991
1992 u16 xtal = 12000;
1993 u32 fcp_min = 1900; /* PLL Minimum Frequency comparator KHz */
1994 u32 fcp_max = 20000; /* PLL Maximum Frequency comparator KHz */
1995 u32 fdem_max = 76000;
1996 u32 fdem_min = 69500;
1997 u32 fcp = 0, fs = 0, fdem = 0;
1998 u32 harmonic_id = 0;
1999
2000 adc->pll_loopdiv = loopdiv;
2001 adc->pll_prediv = prediv;
2002 adc->timf = 0;
2003
2004 deb_info("bandwidth = %d fdem_min =%d", fe->dtv_property_cache.bandwidth_hz, fdem_min);
2005
2006 /* Find Min and Max prediv */
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002007 while ((xtal/max_prediv) >= fcp_min)
Olivier Greniebe9bae12011-01-04 05:42:19 -03002008 max_prediv++;
2009
2010 max_prediv--;
2011 min_prediv = max_prediv;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002012 while ((xtal/min_prediv) <= fcp_max) {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002013 min_prediv--;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002014 if (min_prediv == 1)
Olivier Greniebe9bae12011-01-04 05:42:19 -03002015 break;
2016 }
2017 deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv);
2018
2019 min_prediv = 2;
2020
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002021 for (prediv = min_prediv ; prediv < max_prediv; prediv++) {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002022 fcp = xtal / prediv;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002023 if (fcp > fcp_min && fcp < fcp_max) {
2024 for (loopdiv = 1 ; loopdiv < 64 ; loopdiv++) {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002025 fdem = ((xtal/prediv) * loopdiv);
2026 fs = fdem / 4;
2027 /* test min/max system restrictions */
2028
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002029 if ((fdem >= fdem_min) && (fdem <= fdem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz/1000)) {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002030 spur = 0;
2031 /* test fs harmonics positions */
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002032 for (harmonic_id = (fe->dtv_property_cache.frequency / (1000*fs)) ; harmonic_id <= ((fe->dtv_property_cache.frequency / (1000*fs))+1) ; harmonic_id++) {
2033 if (((fs*harmonic_id) >= ((fe->dtv_property_cache.frequency/1000) - (fe->dtv_property_cache.bandwidth_hz/2000))) && ((fs*harmonic_id) <= ((fe->dtv_property_cache.frequency/1000) + (fe->dtv_property_cache.bandwidth_hz/2000)))) {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002034 spur = 1;
2035 break;
2036 }
2037 }
2038
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002039 if (!spur) {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002040 adc->pll_loopdiv = loopdiv;
2041 adc->pll_prediv = prediv;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002042 adc->timf = 2396745143UL/fdem*(1 << 9);
2043 adc->timf += ((2396745143UL%fdem) << 9)/fdem;
Olivier Greniebe9bae12011-01-04 05:42:19 -03002044 deb_info("loopdiv=%i prediv=%i timf=%i", loopdiv, prediv, adc->timf);
2045 break;
2046 }
2047 }
2048 }
2049 }
2050 if (!spur)
2051 break;
2052 }
2053
2054
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002055 if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0)
Olivier Greniebe9bae12011-01-04 05:42:19 -03002056 return -EINVAL;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002057 else
Olivier Greniebe9bae12011-01-04 05:42:19 -03002058 return 0;
2059}
2060
2061static int dib7090_agc_startup(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
2062{
2063 struct dvb_usb_adapter *adap = fe->dvb->priv;
2064 struct dib0700_adapter_state *state = adap->priv;
2065 struct dibx000_bandwidth_config pll;
2066 u16 target;
2067 struct dib7090p_best_adc adc;
2068 int ret;
2069
2070 ret = state->set_param_save(fe, fep);
2071 if (ret < 0)
2072 return ret;
2073
2074 memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));
2075 dib0090_pwm_gain_reset(fe);
2076 target = (dib0090_get_wbd_offset(fe) * 8 + 1) / 2;
2077 dib7000p_set_wbd_ref(fe, target);
2078
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002079 if (dib7090p_get_best_sampling(fe, &adc) == 0) {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002080 pll.pll_ratio = adc.pll_loopdiv;
2081 pll.pll_prediv = adc.pll_prediv;
2082
2083 dib7000p_update_pll(fe, &pll);
2084 dib7000p_ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf);
2085 }
2086 return 0;
2087}
2088
2089static struct dib0090_wbd_slope dib7090_wbd_table[] = {
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002090 { 380, 81, 850, 64, 540, 4},
2091 { 860, 51, 866, 21, 375, 4},
2092 {1700, 0, 250, 0, 100, 6},
2093 {2600, 0, 250, 0, 100, 6},
2094 { 0xFFFF, 0, 0, 0, 0, 0},
Olivier Greniebe9bae12011-01-04 05:42:19 -03002095};
2096
2097struct dibx000_agc_config dib7090_agc_config[2] = {
2098 {
2099 .band_caps = BAND_UHF,
2100 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
2101 * 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 Grenieb4d6046e2011-01-04 13:08:14 -03002102 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
Olivier Greniebe9bae12011-01-04 05:42:19 -03002103
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002104 .inv_gain = 687,
2105 .time_stabiliz = 10,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002106
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002107 .alpha_level = 0,
2108 .thlock = 118,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002109
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002110 .wbd_inv = 0,
2111 .wbd_ref = 1200,
2112 .wbd_sel = 3,
2113 .wbd_alpha = 5,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002114
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002115 .agc1_max = 65535,
2116 .agc1_min = 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002117
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002118 .agc2_max = 65535,
2119 .agc2_min = 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002120
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002121 .agc1_pt1 = 0,
2122 .agc1_pt2 = 32,
2123 .agc1_pt3 = 114,
2124 .agc1_slope1 = 143,
2125 .agc1_slope2 = 144,
2126 .agc2_pt1 = 114,
2127 .agc2_pt2 = 227,
2128 .agc2_slope1 = 116,
2129 .agc2_slope2 = 117,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002130
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002131 .alpha_mant = 18,
2132 .alpha_exp = 0,
2133 .beta_mant = 20,
2134 .beta_exp = 59,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002135
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002136 .perform_agc_softsplit = 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002137 } , {
2138 .band_caps = BAND_FM | BAND_VHF | BAND_CBAND,
2139 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,
2140 * 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 Grenieb4d6046e2011-01-04 13:08:14 -03002141 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
Olivier Greniebe9bae12011-01-04 05:42:19 -03002142
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002143 .inv_gain = 732,
2144 .time_stabiliz = 10,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002145
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002146 .alpha_level = 0,
2147 .thlock = 118,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002148
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002149 .wbd_inv = 0,
2150 .wbd_ref = 1200,
2151 .wbd_sel = 3,
2152 .wbd_alpha = 5,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002153
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002154 .agc1_max = 65535,
2155 .agc1_min = 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002156
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002157 .agc2_max = 65535,
2158 .agc2_min = 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002159
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002160 .agc1_pt1 = 0,
2161 .agc1_pt2 = 0,
2162 .agc1_pt3 = 98,
2163 .agc1_slope1 = 0,
2164 .agc1_slope2 = 167,
Patrick Boettcher7f4d5272011-04-03 12:28:08 -03002165 .agc2_pt1 = 98,
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002166 .agc2_pt2 = 255,
2167 .agc2_slope1 = 104,
2168 .agc2_slope2 = 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002169
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002170 .alpha_mant = 18,
2171 .alpha_exp = 0,
2172 .beta_mant = 20,
2173 .beta_exp = 59,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002174
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002175 .perform_agc_softsplit = 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002176 }
2177};
2178
2179static struct dibx000_bandwidth_config dib7090_clock_config_12_mhz = {
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002180 60000, 15000,
2181 1, 5, 0, 0, 0,
2182 0, 0, 1, 1, 2,
2183 (3 << 14) | (1 << 12) | (524 << 0),
2184 (0 << 25) | 0,
2185 20452225,
2186 15000000,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002187};
2188
2189static struct dib7000p_config nim7090_dib7000p_config = {
2190 .output_mpeg2_in_188_bytes = 1,
2191 .hostbus_diversity = 1,
2192 .tuner_is_baseband = 1,
2193 .update_lna = NULL,
2194
2195 .agc_config_count = 2,
2196 .agc = dib7090_agc_config,
2197
2198 .bw = &dib7090_clock_config_12_mhz,
2199
2200 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2201 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2202 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2203
2204 .pwm_freq_div = 0,
2205
2206 .agc_control = dib7090_agc_restart,
2207
2208 .spur_protect = 0,
2209 .disable_sample_and_hold = 0,
2210 .enable_current_mirror = 0,
2211 .diversity_delay = 0,
2212
2213 .output_mode = OUTMODE_MPEG2_FIFO,
2214 .enMpegOutput = 1,
2215};
2216
2217static struct dib7000p_config tfe7090pvr_dib7000p_config[2] = {
2218 {
2219 .output_mpeg2_in_188_bytes = 1,
2220 .hostbus_diversity = 1,
2221 .tuner_is_baseband = 1,
2222 .update_lna = NULL,
2223
2224 .agc_config_count = 2,
2225 .agc = dib7090_agc_config,
2226
2227 .bw = &dib7090_clock_config_12_mhz,
2228
2229 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2230 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2231 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2232
2233 .pwm_freq_div = 0,
2234
2235 .agc_control = dib7090_agc_restart,
2236
2237 .spur_protect = 0,
2238 .disable_sample_and_hold = 0,
2239 .enable_current_mirror = 0,
2240 .diversity_delay = 0,
2241
2242 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2243 .default_i2c_addr = 0x90,
2244 .enMpegOutput = 1,
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002245 }, {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002246 .output_mpeg2_in_188_bytes = 1,
2247 .hostbus_diversity = 1,
2248 .tuner_is_baseband = 1,
2249 .update_lna = NULL,
2250
2251 .agc_config_count = 2,
2252 .agc = dib7090_agc_config,
2253
2254 .bw = &dib7090_clock_config_12_mhz,
2255
2256 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2257 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2258 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2259
2260 .pwm_freq_div = 0,
2261
2262 .agc_control = dib7090_agc_restart,
2263
2264 .spur_protect = 0,
2265 .disable_sample_and_hold = 0,
2266 .enable_current_mirror = 0,
2267 .diversity_delay = 0,
2268
2269 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2270 .default_i2c_addr = 0x92,
2271 .enMpegOutput = 0,
2272 }
2273};
2274
2275static const struct dib0090_config nim7090_dib0090_config = {
2276 .io.clock_khz = 12000,
2277 .io.pll_bypass = 0,
2278 .io.pll_range = 0,
2279 .io.pll_prediv = 3,
2280 .io.pll_loopdiv = 6,
2281 .io.adc_clock_ratio = 0,
2282 .io.pll_int_loop_filt = 0,
2283 .reset = dib7090_tuner_sleep,
2284 .sleep = dib7090_tuner_sleep,
2285
2286 .freq_offset_khz_uhf = 0,
2287 .freq_offset_khz_vhf = 0,
2288
2289 .get_adc_power = dib7090_get_adc_power,
2290
2291 .clkouttobamse = 1,
2292 .analog_output = 0,
2293
2294 .wbd_vhf_offset = 0,
2295 .wbd_cband_offset = 0,
2296 .use_pwm_agc = 1,
2297 .clkoutdrive = 0,
2298
2299 .fref_clock_ratio = 0,
2300
2301 .wbd = dib7090_wbd_table,
2302
2303 .ls_cfg_pad_drv = 0,
2304 .data_tx_drv = 0,
2305 .low_if = NULL,
2306 .in_soc = 1,
2307};
2308
2309static const struct dib0090_config tfe7090pvr_dib0090_config[2] = {
2310 {
2311 .io.clock_khz = 12000,
2312 .io.pll_bypass = 0,
2313 .io.pll_range = 0,
2314 .io.pll_prediv = 3,
2315 .io.pll_loopdiv = 6,
2316 .io.adc_clock_ratio = 0,
2317 .io.pll_int_loop_filt = 0,
2318 .reset = dib7090_tuner_sleep,
2319 .sleep = dib7090_tuner_sleep,
2320
2321 .freq_offset_khz_uhf = 50,
2322 .freq_offset_khz_vhf = 70,
2323
2324 .get_adc_power = dib7090_get_adc_power,
2325
2326 .clkouttobamse = 1,
2327 .analog_output = 0,
2328
2329 .wbd_vhf_offset = 0,
2330 .wbd_cband_offset = 0,
2331 .use_pwm_agc = 1,
2332 .clkoutdrive = 0,
2333
2334 .fref_clock_ratio = 0,
2335
2336 .wbd = dib7090_wbd_table,
2337
2338 .ls_cfg_pad_drv = 0,
2339 .data_tx_drv = 0,
2340 .low_if = NULL,
2341 .in_soc = 1,
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002342 }, {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002343 .io.clock_khz = 12000,
2344 .io.pll_bypass = 0,
2345 .io.pll_range = 0,
2346 .io.pll_prediv = 3,
2347 .io.pll_loopdiv = 6,
2348 .io.adc_clock_ratio = 0,
2349 .io.pll_int_loop_filt = 0,
2350 .reset = dib7090_tuner_sleep,
2351 .sleep = dib7090_tuner_sleep,
2352
2353 .freq_offset_khz_uhf = -50,
2354 .freq_offset_khz_vhf = -70,
2355
2356 .get_adc_power = dib7090_get_adc_power,
2357
2358 .clkouttobamse = 1,
2359 .analog_output = 0,
2360
2361 .wbd_vhf_offset = 0,
2362 .wbd_cband_offset = 0,
2363 .use_pwm_agc = 1,
2364 .clkoutdrive = 0,
2365
2366 .fref_clock_ratio = 0,
2367
2368 .wbd = dib7090_wbd_table,
2369
2370 .ls_cfg_pad_drv = 0,
2371 .data_tx_drv = 0,
2372 .low_if = NULL,
2373 .in_soc = 1,
2374 }
2375};
2376
2377static int nim7090_frontend_attach(struct dvb_usb_adapter *adap)
2378{
2379 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002380 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002381 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2382 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2383 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2384 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2385
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002386 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002387 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002388 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002389 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2390
2391 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, &nim7090_dib7000p_config) != 0) {
2392 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
2393 return -ENODEV;
2394 }
2395 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &nim7090_dib7000p_config);
2396
2397 return adap->fe == NULL ? -ENODEV : 0;
2398}
2399
2400static int nim7090_tuner_attach(struct dvb_usb_adapter *adap)
2401{
2402 struct dib0700_adapter_state *st = adap->priv;
2403 struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe);
2404
2405 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &nim7090_dib0090_config) == NULL)
2406 return -ENODEV;
2407
2408 dib7000p_set_gpio(adap->fe, 8, 0, 1);
2409
2410 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
2411 adap->fe->ops.tuner_ops.set_params = dib7090_agc_startup;
2412 return 0;
2413}
2414
2415static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter *adap)
2416{
2417 struct dib0700_state *st = adap->dev->priv;
2418
2419 /* The TFE7090 requires the dib0700 to not be in master mode */
2420 st->disable_streaming_master_mode = 1;
2421
2422 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002423 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002424 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2425 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2426 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2427 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2428
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002429 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002430 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002431 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002432 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2433
2434 /* initialize IC 0 */
2435 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, &tfe7090pvr_dib7000p_config[0]) != 0) {
2436 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
2437 return -ENODEV;
2438 }
2439
2440 dib0700_set_i2c_speed(adap->dev, 340);
2441 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002442 if (adap->fe == NULL)
2443 return -ENODEV;
2444
Patrick Boettcher71682522011-04-03 12:44:25 -03002445 dib7090_slave_reset(adap->fe);
2446
Olivier Greniebe9bae12011-01-04 05:42:19 -03002447 return 0;
2448}
2449
2450static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter *adap)
2451{
2452 struct i2c_adapter *i2c;
2453
2454 if (adap->dev->adapter[0].fe == NULL) {
2455 err("the master dib7090 has to be initialized first");
2456 return -ENODEV; /* the master device has not been initialized */
2457 }
2458
2459 i2c = dib7000p_get_i2c_master(adap->dev->adapter[0].fe, DIBX000_I2C_INTERFACE_GPIO_6_7, 1);
2460 if (dib7000p_i2c_enumeration(i2c, 1, 0x10, &tfe7090pvr_dib7000p_config[1]) != 0) {
2461 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
2462 return -ENODEV;
2463 }
2464
2465 adap->fe = dvb_attach(dib7000p_attach, i2c, 0x92, &tfe7090pvr_dib7000p_config[1]);
2466 dib0700_set_i2c_speed(adap->dev, 200);
2467
2468 return adap->fe == NULL ? -ENODEV : 0;
2469}
2470
2471static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter *adap)
2472{
2473 struct dib0700_adapter_state *st = adap->priv;
2474 struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe);
2475
2476 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &tfe7090pvr_dib0090_config[0]) == NULL)
2477 return -ENODEV;
2478
2479 dib7000p_set_gpio(adap->fe, 8, 0, 1);
2480
2481 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
2482 adap->fe->ops.tuner_ops.set_params = dib7090_agc_startup;
2483 return 0;
2484}
2485
2486static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter *adap)
2487{
2488 struct dib0700_adapter_state *st = adap->priv;
2489 struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe);
2490
2491 if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &tfe7090pvr_dib0090_config[1]) == NULL)
2492 return -ENODEV;
2493
2494 dib7000p_set_gpio(adap->fe, 8, 0, 1);
2495
2496 st->set_param_save = adap->fe->ops.tuner_ops.set_params;
2497 adap->fe->ops.tuner_ops.set_params = dib7090_agc_startup;
2498 return 0;
2499}
2500
Patrick Boettcher01373a52007-07-30 12:49:04 -03002501/* STK7070PD */
2502static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
2503 {
2504 .output_mpeg2_in_188_bytes = 1,
2505
2506 .agc_config_count = 1,
2507 .agc = &dib7070_agc_config,
2508 .bw = &dib7070_bw_config_12_mhz,
Patrick Boettcher3cb2c392008-01-25 07:25:20 -03002509 .tuner_is_baseband = 1,
2510 .spur_protect = 1,
Patrick Boettcher01373a52007-07-30 12:49:04 -03002511
2512 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2513 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2514 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2515
2516 .hostbus_diversity = 1,
2517 }, {
2518 .output_mpeg2_in_188_bytes = 1,
2519
2520 .agc_config_count = 1,
2521 .agc = &dib7070_agc_config,
2522 .bw = &dib7070_bw_config_12_mhz,
Patrick Boettcher3cb2c392008-01-25 07:25:20 -03002523 .tuner_is_baseband = 1,
2524 .spur_protect = 1,
Patrick Boettcher01373a52007-07-30 12:49:04 -03002525
2526 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2527 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2528 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2529
2530 .hostbus_diversity = 1,
2531 }
2532};
2533
2534static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
2535{
2536 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2537 msleep(10);
2538 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2539 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2540 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2541 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2542
2543 dib0700_ctrl_clock(adap->dev, 72, 1);
2544
2545 msleep(10);
2546 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2547 msleep(10);
2548 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2549
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -03002550 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
2551 stk7070pd_dib7000p_config) != 0) {
2552 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
2553 __func__);
2554 return -ENODEV;
2555 }
Patrick Boettcher01373a52007-07-30 12:49:04 -03002556
2557 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
2558 return adap->fe == NULL ? -ENODEV : 0;
2559}
2560
2561static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
2562{
2563 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
2564 return adap->fe == NULL ? -ENODEV : 0;
2565}
2566
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002567/* S5H1411 */
2568static struct s5h1411_config pinnacle_801e_config = {
2569 .output_mode = S5H1411_PARALLEL_OUTPUT,
2570 .gpio = S5H1411_GPIO_OFF,
2571 .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
2572 .qam_if = S5H1411_IF_44000,
2573 .vsb_if = S5H1411_IF_44000,
2574 .inversion = S5H1411_INVERSION_OFF,
2575 .status_mode = S5H1411_DEMODLOCKING
2576};
2577
2578/* Pinnacle PCTV HD Pro 801e GPIOs map:
2579 GPIO0 - currently unknown
2580 GPIO1 - xc5000 tuner reset
2581 GPIO2 - CX25843 sleep
2582 GPIO3 - currently unknown
2583 GPIO4 - currently unknown
2584 GPIO6 - currently unknown
2585 GPIO7 - currently unknown
2586 GPIO9 - currently unknown
2587 GPIO10 - CX25843 reset
2588 */
2589static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
2590{
2591 struct dib0700_state *st = adap->dev->priv;
2592
2593 /* Make use of the new i2c functions from FW 1.20 */
2594 st->fw_use_new_i2c_api = 1;
2595
2596 /* The s5h1411 requires the dib0700 to not be in master mode */
2597 st->disable_streaming_master_mode = 1;
2598
2599 /* All msleep values taken from Windows USB trace */
2600 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
2601 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
2602 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2603 msleep(400);
2604 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2605 msleep(60);
2606 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2607 msleep(30);
2608 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2609 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2610 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2611 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2612 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
2613 msleep(30);
2614
2615 /* Put the CX25843 to sleep for now since we're in digital mode */
2616 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
2617
2618 /* GPIOs are initialized, do the attach */
2619 adap->fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
2620 &adap->dev->i2c_adap);
2621 return adap->fe == NULL ? -ENODEV : 0;
2622}
2623
Michael Krufky767f3b32008-09-25 09:47:07 -03002624static int dib0700_xc5000_tuner_callback(void *priv, int component,
2625 int command, int arg)
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002626{
2627 struct dvb_usb_adapter *adap = priv;
2628
Devin Heitmueller79025a92008-10-06 12:07:48 -03002629 if (command == XC5000_TUNER_RESET) {
2630 /* Reset the tuner */
2631 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
Devin Heitmuellerf0f46332009-05-04 21:57:41 -03002632 msleep(10);
Devin Heitmueller79025a92008-10-06 12:07:48 -03002633 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
Devin Heitmuellerf0f46332009-05-04 21:57:41 -03002634 msleep(10);
Devin Heitmueller79025a92008-10-06 12:07:48 -03002635 } else {
2636 err("xc5000: unknown tuner callback command: %d\n", command);
2637 return -EINVAL;
2638 }
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002639
2640 return 0;
2641}
2642
2643static struct xc5000_config s5h1411_xc5000_tunerconfig = {
2644 .i2c_address = 0x64,
2645 .if_khz = 5380,
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002646};
2647
2648static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
2649{
Devin Heitmueller79025a92008-10-06 12:07:48 -03002650 /* FIXME: generalize & move to common area */
2651 adap->fe->callback = dib0700_xc5000_tuner_callback;
2652
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002653 return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap,
Michael Krufky767f3b32008-09-25 09:47:07 -03002654 &s5h1411_xc5000_tunerconfig)
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002655 == NULL ? -ENODEV : 0;
2656}
2657
Michael Krufkyce904bc2009-01-19 01:12:55 -03002658static struct lgdt3305_config hcw_lgdt3305_config = {
2659 .i2c_addr = 0x0e,
2660 .mpeg_mode = LGDT3305_MPEG_PARALLEL,
2661 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
2662 .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
2663 .deny_i2c_rptr = 0,
2664 .spectral_inversion = 1,
2665 .qam_if_khz = 6000,
2666 .vsb_if_khz = 6000,
2667 .usref_8vsb = 0x0500,
2668};
2669
2670static struct mxl5007t_config hcw_mxl5007t_config = {
2671 .xtal_freq_hz = MxL_XTAL_25_MHZ,
2672 .if_freq_hz = MxL_IF_6_MHZ,
2673 .invert_if = 1,
2674};
2675
2676/* TIGER-ATSC map:
2677 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
2678 GPIO1 - ANT_SEL (H: VPA, L: MCX)
2679 GPIO4 - SCL2
2680 GPIO6 - EN_TUNER
2681 GPIO7 - SDA2
2682 GPIO10 - DEM_RST
2683
2684 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
2685 */
2686static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
2687{
2688 struct dib0700_state *st = adap->dev->priv;
2689
2690 /* Make use of the new i2c functions from FW 1.20 */
2691 st->fw_use_new_i2c_api = 1;
2692
2693 st->disable_streaming_master_mode = 1;
2694
2695 /* fe power enable */
2696 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
2697 msleep(30);
2698 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2699 msleep(30);
2700
2701 /* demod reset */
2702 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2703 msleep(30);
2704 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2705 msleep(30);
2706 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2707 msleep(30);
2708
2709 adap->fe = dvb_attach(lgdt3305_attach,
2710 &hcw_lgdt3305_config,
2711 &adap->dev->i2c_adap);
2712
2713 return adap->fe == NULL ? -ENODEV : 0;
2714}
2715
2716static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
2717{
2718 return dvb_attach(mxl5007t_attach, adap->fe,
2719 &adap->dev->i2c_adap, 0x60,
2720 &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
2721}
2722
2723
Patrick Boettcher01373a52007-07-30 12:49:04 -03002724/* DVB-USB and USB stuff follows */
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002725struct usb_device_id dib0700_usb_id_table[] = {
Patrick Boettcher01373a52007-07-30 12:49:04 -03002726/* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002727 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
2728 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
2729 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
2730 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
Patrick Boettcher01373a52007-07-30 12:49:04 -03002731/* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002732 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
2733 { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
2734 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
2735 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
Patrick Boettcher01373a52007-07-30 12:49:04 -03002736/* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002737 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
2738 { USB_DEVICE(USB_VID_TERRATEC,
2739 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
2740 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
2741 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
Patrick Boettcher01373a52007-07-30 12:49:04 -03002742/* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002743 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
2744 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
2745 { USB_DEVICE(USB_VID_PINNACLE,
2746 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
2747 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
Joachim Steigerfa3b8772007-10-08 20:08:46 -03002748/* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002749 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
2750 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
2751 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
2752 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
2753/* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
2754 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
2755 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
2756 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
2757 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
2758/* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
2759 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
2760 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
Alexander Simondc888072008-03-29 21:37:54 -03002761 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
Darryl Green5da4e2c2008-03-29 21:47:43 -03002762 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
Michael Krufkyaf2a8872008-09-03 17:12:24 -03002763/* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
Michael Krufky9a0c04a2008-09-03 17:12:24 -03002764 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
Finn Thain17a370b2008-09-06 13:42:47 -03002765 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
Daniel Oliveira Nascimento8751aaa2008-09-07 12:39:44 -03002766 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
Albert Comerma57697432008-09-07 12:43:33 -03002767 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03002768/* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
Devin Heitmuellerd2fc3bf2008-09-25 06:22:23 -03002769 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03002770 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
Nicolas Fournierdb4b2d12009-01-13 07:15:25 -03002771 { USB_DEVICE(USB_VID_TERRATEC,
2772 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
sebastian.blanes@gmail.com0a6e1ed2009-02-24 14:51:43 -03002773 { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
Pascal Terjan9abb6e62009-02-26 10:31:41 -03002774/* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
Michael Krufkyce904bc2009-01-19 01:12:55 -03002775 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
2776 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
Xoan Loureiro16ba1ee2009-03-29 08:43:36 -03002777 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
Klaus Flittner919a5482009-03-29 09:12:06 -03002778 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
Armin Schenker513846e2009-04-20 11:57:49 -03002779/* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
tomas petrf0f4ae72009-05-20 05:28:05 -03002780 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
Patrick Boettchera9b8fe32009-05-20 05:35:02 -03002781 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
2782 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
Pete Hildebrandtc53d83c2009-08-05 11:46:38 -03002783 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
Olivier Grenie74b76f22009-09-02 08:19:19 -03002784/* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
2785 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
Patrick Boettchere4147532009-11-30 13:52:57 -03002786 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV73ESE) },
2787 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV282E) },
Olivier Grenied300bd62009-09-15 06:55:35 -03002788 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
Patrick Boettcherdb481382009-09-15 07:16:51 -03002789/* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03002790 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
2791 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
Mauro Carvalho Chehab3bfb3172010-09-03 10:50:24 -03002792 { USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x000, 0x3f00) },
S?rgio Fortier8a378e82009-09-28 04:19:21 -03002793 { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },
Patrick Boettcher20232c42009-12-01 12:08:56 -03002794/* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
Patrick Boettchere4147532009-11-30 13:52:57 -03002795 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
Olivier Grenie03245a52009-12-04 13:27:57 -03002796 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) },
Michael Müller84e2f032010-04-26 22:18:57 -03002797 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) },
Olivier Greniebe9bae12011-01-04 05:42:19 -03002798 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090M) },
2799/* 70 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM8096MD) },
2800 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090MD) },
2801 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM7090) },
2802 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090PVR) },
Lukas Max Fisch498e6772011-02-08 16:51:45 -03002803 { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2) },
Stéphane Elmalehd1402302011-05-21 07:33:38 -03002804/* 75 */{ USB_DEVICE(USB_VID_MEDION, USB_PID_CREATIX_CTX1921) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03002805 { 0 } /* Terminating entry */
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002806};
2807MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
2808
2809#define DIB0700_DEFAULT_DEVICE_PROPERTIES \
2810 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
2811 .usb_ctrl = DEVICE_SPECIFIC, \
Devin Heitmuellerbdc203e2008-09-06 13:45:27 -03002812 .firmware = "dvb-usb-dib0700-1.20.fw", \
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002813 .download_firmware = dib0700_download_firmware, \
Patrick Boettcher6958eff2006-09-19 12:51:40 -03002814 .no_reconnect = 1, \
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002815 .size_of_priv = sizeof(struct dib0700_state), \
Patrick Boettcher6958eff2006-09-19 12:51:40 -03002816 .i2c_algo = &dib0700_i2c_algo, \
2817 .identify_state = dib0700_identify_state
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002818
2819#define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
2820 .streaming_ctrl = dib0700_streaming_ctrl, \
2821 .stream = { \
2822 .type = USB_BULK, \
2823 .count = 4, \
2824 .endpoint = ep, \
2825 .u = { \
2826 .bulk = { \
2827 .buffersize = 39480, \
2828 } \
2829 } \
2830 }
2831
2832struct dvb_usb_device_properties dib0700_devices[] = {
2833 {
2834 DIB0700_DEFAULT_DEVICE_PROPERTIES,
2835
2836 .num_adapters = 1,
2837 .adapter = {
2838 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002839 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2840 .pid_filter_count = 32,
Olivier Greniee192a7c2011-01-14 13:58:59 -03002841 .pid_filter = stk7700p_pid_filter,
2842 .pid_filter_ctrl = stk7700p_pid_filter_ctrl,
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002843 .frontend_attach = stk7700p_frontend_attach,
2844 .tuner_attach = stk7700p_tuner_attach,
2845
2846 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2847 },
2848 },
2849
dominik67053a42007-11-10 19:23:31 -03002850 .num_device_descs = 8,
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002851 .devices = {
2852 { "DiBcom STK7700P reference design",
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002853 { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002854 { NULL },
2855 },
2856 { "Hauppauge Nova-T Stick",
Stefan Trabyf9aeba42006-11-12 13:02:51 -03002857 { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002858 { NULL },
2859 },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002860 { "AVerMedia AVerTV DVB-T Volar",
Jose Carlos Garcia Sogoced8fec2006-11-14 05:01:47 -03002861 { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002862 { NULL },
2863 },
2864 { "Compro Videomate U500",
Patrick Boettcher1f8ca4b2007-07-30 14:24:37 -03002865 { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002866 { NULL },
Henning Schroeer0ce215e2006-10-19 07:58:22 -03002867 },
2868 { "Uniwill STK7700P based (Hama and others)",
2869 { &dib0700_usb_id_table[7], NULL },
2870 { NULL },
Michael Krufky8637a872006-11-08 16:47:32 -03002871 },
2872 { "Leadtek Winfast DTV Dongle (STK7700P based)",
Patrick Boettcher1e13c8f2009-09-19 05:24:40 -03002873 { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
Michael Krufky8637a872006-11-08 16:47:32 -03002874 { NULL },
Joachim Steigerfa3b8772007-10-08 20:08:46 -03002875 },
2876 { "AVerMedia AVerTV DVB-T Express",
2877 { &dib0700_usb_id_table[20] },
2878 { NULL },
dominik67053a42007-11-10 19:23:31 -03002879 },
dominik67053a42007-11-10 19:23:31 -03002880 { "Gigabyte U7000",
2881 { &dib0700_usb_id_table[21], NULL },
2882 { NULL },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002883 }
Darren Saltb1139e32007-08-18 18:05:31 -03002884 },
2885
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03002886 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002887 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03002888 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03002889 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03002890 .allowed_protos = RC_TYPE_RC5 |
2891 RC_TYPE_RC6 |
2892 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03002893 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002894 },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002895 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2896
2897 .num_adapters = 2,
2898 .adapter = {
2899 {
2900 .frontend_attach = bristol_frontend_attach,
2901 .tuner_attach = bristol_tuner_attach,
2902
2903 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2904 }, {
2905 .frontend_attach = bristol_frontend_attach,
2906 .tuner_attach = bristol_tuner_attach,
2907
2908 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2909 }
2910 },
2911
2912 .num_device_descs = 1,
2913 .devices = {
2914 { "Hauppauge Nova-T 500 Dual DVB-T",
Tomi Koivulahti49a13762006-10-19 07:27:19 -03002915 { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03002916 { NULL },
2917 },
Janne Grunau82f3d552007-07-30 13:50:28 -03002918 },
2919
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03002920 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002921 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03002922 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03002923 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03002924 .allowed_protos = RC_TYPE_RC5 |
2925 RC_TYPE_RC6 |
2926 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03002927 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002928 },
Olivier DANET54d75eb2007-07-25 14:42:54 -03002929 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2930
2931 .num_adapters = 2,
2932 .adapter = {
2933 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002934 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2935 .pid_filter_count = 32,
2936 .pid_filter = stk70x0p_pid_filter,
2937 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier DANET54d75eb2007-07-25 14:42:54 -03002938 .frontend_attach = stk7700d_frontend_attach,
2939 .tuner_attach = stk7700d_tuner_attach,
2940
2941 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
2942 }, {
Olivier Grenief8731f42009-09-18 04:08:43 -03002943 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2944 .pid_filter_count = 32,
2945 .pid_filter = stk70x0p_pid_filter,
2946 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier DANET54d75eb2007-07-25 14:42:54 -03002947 .frontend_attach = stk7700d_frontend_attach,
2948 .tuner_attach = stk7700d_tuner_attach,
2949
2950 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
2951 }
2952 },
2953
James A Webb200e8612009-08-04 02:38:05 -03002954 .num_device_descs = 5,
Olivier DANET54d75eb2007-07-25 14:42:54 -03002955 .devices = {
2956 { "Pinnacle PCTV 2000e",
2957 { &dib0700_usb_id_table[11], NULL },
2958 { NULL },
2959 },
2960 { "Terratec Cinergy DT XS Diversity",
2961 { &dib0700_usb_id_table[12], NULL },
2962 { NULL },
2963 },
Darren Saltfaebb912007-08-18 18:04:00 -03002964 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
Olivier DANET54d75eb2007-07-25 14:42:54 -03002965 { &dib0700_usb_id_table[13], NULL },
2966 { NULL },
2967 },
Patrick Boettcher01373a52007-07-30 12:49:04 -03002968 { "DiBcom STK7700D reference design",
Patrick Boettcherb6884a12007-07-27 10:08:51 -03002969 { &dib0700_usb_id_table[14], NULL },
2970 { NULL },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03002971 },
James A Webb200e8612009-08-04 02:38:05 -03002972 { "YUAN High-Tech DiBcom STK7700D",
2973 { &dib0700_usb_id_table[55], NULL },
2974 { NULL },
2975 },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03002976
Olivier DANET54d75eb2007-07-25 14:42:54 -03002977 },
Janne Grunau82f3d552007-07-30 13:50:28 -03002978
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03002979 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002980 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03002981 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03002982 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03002983 .allowed_protos = RC_TYPE_RC5 |
2984 RC_TYPE_RC6 |
2985 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03002986 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03002987 },
Patrick Boettcher01373a52007-07-30 12:49:04 -03002988 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
2989
2990 .num_adapters = 1,
2991 .adapter = {
2992 {
Olivier Grenief8731f42009-09-18 04:08:43 -03002993 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
2994 .pid_filter_count = 32,
2995 .pid_filter = stk70x0p_pid_filter,
2996 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03002997 .frontend_attach = stk7700P2_frontend_attach,
2998 .tuner_attach = stk7700d_tuner_attach,
2999
3000 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3001 },
3002 },
3003
Yusuf Altinbb1b0822009-01-08 07:58:45 -03003004 .num_device_descs = 3,
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03003005 .devices = {
3006 { "ASUS My Cinema U3000 Mini DVBT Tuner",
3007 { &dib0700_usb_id_table[23], NULL },
3008 { NULL },
3009 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003010 { "Yuan EC372S",
3011 { &dib0700_usb_id_table[31], NULL },
3012 { NULL },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03003013 },
3014 { "Terratec Cinergy T Express",
3015 { &dib0700_usb_id_table[42], NULL },
3016 { NULL },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003017 }
Chris Rankin48aa7392008-09-25 06:52:24 -03003018 },
3019
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003020 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003021 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003022 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003023 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003024 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003025 .allowed_protos = RC_TYPE_RC5 |
3026 RC_TYPE_RC6 |
3027 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003028 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003029 },
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03003030 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3031
3032 .num_adapters = 1,
3033 .adapter = {
3034 {
Olivier Grenief8731f42009-09-18 04:08:43 -03003035 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3036 .pid_filter_count = 32,
3037 .pid_filter = stk70x0p_pid_filter,
3038 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Patrick Boettcher01373a52007-07-30 12:49:04 -03003039 .frontend_attach = stk7070p_frontend_attach,
3040 .tuner_attach = dib7070p_tuner_attach,
3041
3042 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3043
3044 .size_of_priv = sizeof(struct dib0700_adapter_state),
3045 },
3046 },
3047
Patrick Boettcher1e13c8f2009-09-19 05:24:40 -03003048 .num_device_descs = 11,
Patrick Boettcher01373a52007-07-30 12:49:04 -03003049 .devices = {
3050 { "DiBcom STK7070P reference design",
3051 { &dib0700_usb_id_table[15], NULL },
3052 { NULL },
3053 },
3054 { "Pinnacle PCTV DVB-T Flash Stick",
3055 { &dib0700_usb_id_table[16], NULL },
3056 { NULL },
3057 },
Yousef Lamlum7999a812008-01-25 05:51:48 -03003058 { "Artec T14BR DVB-T",
3059 { &dib0700_usb_id_table[22], NULL },
3060 { NULL },
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03003061 },
3062 { "ASUS My Cinema U3100 Mini DVBT Tuner",
3063 { &dib0700_usb_id_table[24], NULL },
3064 { NULL },
3065 },
Tim Taubertc7637b12008-01-25 06:16:36 -03003066 { "Hauppauge Nova-T Stick",
3067 { &dib0700_usb_id_table[25], NULL },
3068 { NULL },
3069 },
Darren Salt13b83b52008-01-25 06:20:02 -03003070 { "Hauppauge Nova-T MyTV.t",
3071 { &dib0700_usb_id_table[26], NULL },
3072 { NULL },
3073 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003074 { "Pinnacle PCTV 72e",
3075 { &dib0700_usb_id_table[29], NULL },
3076 { NULL },
3077 },
3078 { "Pinnacle PCTV 73e",
3079 { &dib0700_usb_id_table[30], NULL },
3080 { NULL },
3081 },
Klaus Flittner919a5482009-03-29 09:12:06 -03003082 { "Elgato EyeTV DTT",
3083 { &dib0700_usb_id_table[49], NULL },
3084 { NULL },
3085 },
Pascal Terjan9abb6e62009-02-26 10:31:41 -03003086 { "Yuan PD378S",
3087 { &dib0700_usb_id_table[45], NULL },
3088 { NULL },
3089 },
Armin Schenker513846e2009-04-20 11:57:49 -03003090 { "Elgato EyeTV Dtt Dlx PD378S",
3091 { &dib0700_usb_id_table[50], NULL },
3092 { NULL },
3093 },
Tim Taubertc7637b12008-01-25 06:16:36 -03003094 },
3095
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003096 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003097 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003098 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003099 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003100 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003101 .allowed_protos = RC_TYPE_RC5 |
3102 RC_TYPE_RC6 |
3103 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003104 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003105 },
Patrick Boettcher01373a52007-07-30 12:49:04 -03003106 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3107
Olivier Grenie74b76f22009-09-02 08:19:19 -03003108 .num_adapters = 1,
3109 .adapter = {
3110 {
Mauro Carvalho Chehab648732f2009-11-04 12:11:43 -02003111 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3112 .pid_filter_count = 32,
3113 .pid_filter = stk70x0p_pid_filter,
3114 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier Grenie74b76f22009-09-02 08:19:19 -03003115 .frontend_attach = stk7070p_frontend_attach,
3116 .tuner_attach = dib7070p_tuner_attach,
3117
3118 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3119
3120 .size_of_priv = sizeof(struct dib0700_adapter_state),
3121 },
3122 },
3123
Patrick Boettcher20232c42009-12-01 12:08:56 -03003124 .num_device_descs = 3,
Olivier Grenie74b76f22009-09-02 08:19:19 -03003125 .devices = {
3126 { "Pinnacle PCTV 73A",
3127 { &dib0700_usb_id_table[56], NULL },
3128 { NULL },
3129 },
3130 { "Pinnacle PCTV 73e SE",
Patrick Boettcher20232c42009-12-01 12:08:56 -03003131 { &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL },
Olivier Grenie74b76f22009-09-02 08:19:19 -03003132 { NULL },
3133 },
3134 { "Pinnacle PCTV 282e",
Patrick Boettcher20232c42009-12-01 12:08:56 -03003135 { &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL },
Olivier Grenie74b76f22009-09-02 08:19:19 -03003136 { NULL },
3137 },
3138 },
3139
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003140 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003141 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003142 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003143 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003144 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003145 .allowed_protos = RC_TYPE_RC5 |
3146 RC_TYPE_RC6 |
3147 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003148 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003149 },
Olivier Grenie74b76f22009-09-02 08:19:19 -03003150 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3151
Patrick Boettcher01373a52007-07-30 12:49:04 -03003152 .num_adapters = 2,
3153 .adapter = {
3154 {
Olivier Grenief8731f42009-09-18 04:08:43 -03003155 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3156 .pid_filter_count = 32,
3157 .pid_filter = stk70x0p_pid_filter,
3158 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Patrick Boettcher01373a52007-07-30 12:49:04 -03003159 .frontend_attach = stk7070pd_frontend_attach0,
3160 .tuner_attach = dib7070p_tuner_attach,
3161
3162 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3163
3164 .size_of_priv = sizeof(struct dib0700_adapter_state),
3165 }, {
Olivier Grenief8731f42009-09-18 04:08:43 -03003166 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3167 .pid_filter_count = 32,
3168 .pid_filter = stk70x0p_pid_filter,
3169 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Patrick Boettcher01373a52007-07-30 12:49:04 -03003170 .frontend_attach = stk7070pd_frontend_attach1,
3171 .tuner_attach = dib7070p_tuner_attach,
3172
3173 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3174
3175 .size_of_priv = sizeof(struct dib0700_adapter_state),
3176 }
3177 },
3178
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003179 .num_device_descs = 6,
Patrick Boettcher01373a52007-07-30 12:49:04 -03003180 .devices = {
3181 { "DiBcom STK7070PD reference design",
3182 { &dib0700_usb_id_table[17], NULL },
3183 { NULL },
3184 },
3185 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
3186 { &dib0700_usb_id_table[18], NULL },
3187 { NULL },
Michael Krufkyd01eb2d2008-07-03 23:43:36 -03003188 },
3189 { "Hauppauge Nova-TD Stick (52009)",
3190 { &dib0700_usb_id_table[35], NULL },
3191 { NULL },
Michael Krufky9a0c04a2008-09-03 17:12:24 -03003192 },
3193 { "Hauppauge Nova-TD-500 (84xxx)",
3194 { &dib0700_usb_id_table[36], NULL },
3195 { NULL },
Nicolas Fournierdb4b2d12009-01-13 07:15:25 -03003196 },
Patrick Boettchera9b8fe32009-05-20 05:35:02 -03003197 { "Terratec Cinergy DT USB XS Diversity/ T5",
3198 { &dib0700_usb_id_table[43],
3199 &dib0700_usb_id_table[53], NULL},
Nicolas Fournierdb4b2d12009-01-13 07:15:25 -03003200 { NULL },
sebastian.blanes@gmail.com0a6e1ed2009-02-24 14:51:43 -03003201 },
3202 { "Sony PlayTV",
3203 { &dib0700_usb_id_table[44], NULL },
3204 { NULL },
Michael Müller84e2f032010-04-26 22:18:57 -03003205 },
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003206 },
3207
3208 .rc.core = {
3209 .rc_interval = DEFAULT_RC_INTERVAL,
3210 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3211 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003212 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003213 .allowed_protos = RC_TYPE_RC5 |
3214 RC_TYPE_RC6 |
3215 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003216 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003217 },
3218 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3219
3220 .num_adapters = 2,
3221 .adapter = {
3222 {
3223 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3224 .pid_filter_count = 32,
3225 .pid_filter = stk70x0p_pid_filter,
3226 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3227 .frontend_attach = stk7070pd_frontend_attach0,
3228 .tuner_attach = dib7070p_tuner_attach,
3229
3230 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3231
3232 .size_of_priv = sizeof(struct dib0700_adapter_state),
3233 }, {
3234 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3235 .pid_filter_count = 32,
3236 .pid_filter = stk70x0p_pid_filter,
3237 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3238 .frontend_attach = stk7070pd_frontend_attach1,
3239 .tuner_attach = dib7070p_tuner_attach,
3240
3241 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3242
3243 .size_of_priv = sizeof(struct dib0700_adapter_state),
3244 }
3245 },
3246
3247 .num_device_descs = 1,
3248 .devices = {
Michael Müller84e2f032010-04-26 22:18:57 -03003249 { "Elgato EyeTV Diversity",
3250 { &dib0700_usb_id_table[68], NULL },
3251 { NULL },
3252 },
Arne Luehrsc985a8d2009-01-21 01:37:20 -03003253 },
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003254
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003255 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003256 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003257 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003258 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003259 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003260 .allowed_protos = RC_TYPE_RC5 |
3261 RC_TYPE_RC6 |
3262 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003263 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003264 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003265 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3266
3267 .num_adapters = 1,
3268 .adapter = {
3269 {
Olivier Grenief8731f42009-09-18 04:08:43 -03003270 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3271 .pid_filter_count = 32,
3272 .pid_filter = stk70x0p_pid_filter,
3273 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003274 .frontend_attach = stk7700ph_frontend_attach,
3275 .tuner_attach = stk7700ph_tuner_attach,
3276
3277 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3278
3279 .size_of_priv = sizeof(struct
3280 dib0700_adapter_state),
3281 },
3282 },
3283
Pete Hildebrandtc53d83c2009-08-05 11:46:38 -03003284 .num_device_descs = 9,
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003285 .devices = {
3286 { "Terratec Cinergy HT USB XE",
3287 { &dib0700_usb_id_table[27], NULL },
3288 { NULL },
3289 },
3290 { "Pinnacle Expresscard 320cx",
3291 { &dib0700_usb_id_table[28], NULL },
3292 { NULL },
3293 },
3294 { "Terratec Cinergy HT Express",
3295 { &dib0700_usb_id_table[32], NULL },
3296 { NULL },
3297 },
Finn Thain17a370b2008-09-06 13:42:47 -03003298 { "Gigabyte U8000-RH",
3299 { &dib0700_usb_id_table[37], NULL },
3300 { NULL },
3301 },
Daniel Oliveira Nascimento8751aaa2008-09-07 12:39:44 -03003302 { "YUAN High-Tech STK7700PH",
3303 { &dib0700_usb_id_table[38], NULL },
3304 { NULL },
3305 },
Albert Comerma57697432008-09-07 12:43:33 -03003306 { "Asus My Cinema-U3000Hybrid",
3307 { &dib0700_usb_id_table[39], NULL },
3308 { NULL },
3309 },
Xoan Loureiro16ba1ee2009-03-29 08:43:36 -03003310 { "YUAN High-Tech MC770",
3311 { &dib0700_usb_id_table[48], NULL },
3312 { NULL },
3313 },
tomas petrf0f4ae72009-05-20 05:28:05 -03003314 { "Leadtek WinFast DTV Dongle H",
3315 { &dib0700_usb_id_table[51], NULL },
3316 { NULL },
3317 },
Pete Hildebrandtc53d83c2009-08-05 11:46:38 -03003318 { "YUAN High-Tech STK7700D",
3319 { &dib0700_usb_id_table[54], NULL },
3320 { NULL },
3321 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003322 },
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003323
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003324 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003325 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003326 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003327 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003328 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003329 .allowed_protos = RC_TYPE_RC5 |
3330 RC_TYPE_RC6 |
3331 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003332 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003333 },
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03003334 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3335 .num_adapters = 1,
3336 .adapter = {
3337 {
3338 .frontend_attach = s5h1411_frontend_attach,
3339 .tuner_attach = xc5000_tuner_attach,
3340
3341 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3342
3343 .size_of_priv = sizeof(struct
3344 dib0700_adapter_state),
3345 },
3346 },
3347
Devin Heitmuellerd2fc3bf2008-09-25 06:22:23 -03003348 .num_device_descs = 2,
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03003349 .devices = {
3350 { "Pinnacle PCTV HD Pro USB Stick",
3351 { &dib0700_usb_id_table[40], NULL },
3352 { NULL },
3353 },
Devin Heitmuellerd2fc3bf2008-09-25 06:22:23 -03003354 { "Pinnacle PCTV HD USB Stick",
3355 { &dib0700_usb_id_table[41], NULL },
3356 { NULL },
3357 },
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03003358 },
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003359
3360 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003361 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003362 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003363 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003364 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003365 .allowed_protos = RC_TYPE_RC5 |
3366 RC_TYPE_RC6 |
3367 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003368 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003369 },
Michael Krufkyce904bc2009-01-19 01:12:55 -03003370 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3371 .num_adapters = 1,
3372 .adapter = {
3373 {
3374 .frontend_attach = lgdt3305_frontend_attach,
3375 .tuner_attach = mxl5007t_tuner_attach,
3376
3377 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3378
3379 .size_of_priv = sizeof(struct
3380 dib0700_adapter_state),
3381 },
3382 },
3383
3384 .num_device_descs = 2,
3385 .devices = {
3386 { "Hauppauge ATSC MiniCard (B200)",
3387 { &dib0700_usb_id_table[46], NULL },
3388 { NULL },
3389 },
3390 { "Hauppauge ATSC MiniCard (B210)",
3391 { &dib0700_usb_id_table[47], NULL },
3392 { NULL },
3393 },
3394 },
Olivier Grenied300bd62009-09-15 06:55:35 -03003395 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3396
3397 .num_adapters = 1,
3398 .adapter = {
3399 {
Olivier Grenief8731f42009-09-18 04:08:43 -03003400 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3401 .pid_filter_count = 32,
3402 .pid_filter = stk70x0p_pid_filter,
3403 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier Grenie90e12ce2010-09-07 12:50:45 -03003404 .frontend_attach = stk7770p_frontend_attach,
Olivier Grenied300bd62009-09-15 06:55:35 -03003405 .tuner_attach = dib7770p_tuner_attach,
3406
3407 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3408
3409 .size_of_priv =
Patrick Boettcherdb481382009-09-15 07:16:51 -03003410 sizeof(struct dib0700_adapter_state),
Olivier Grenied300bd62009-09-15 06:55:35 -03003411 },
3412 },
3413
Stéphane Elmalehd1402302011-05-21 07:33:38 -03003414 .num_device_descs = 4,
Olivier Grenied300bd62009-09-15 06:55:35 -03003415 .devices = {
3416 { "DiBcom STK7770P reference design",
3417 { &dib0700_usb_id_table[59], NULL },
3418 { NULL },
3419 },
Patrick Boettcher1e13c8f2009-09-19 05:24:40 -03003420 { "Terratec Cinergy T USB XXS (HD)/ T3",
3421 { &dib0700_usb_id_table[33],
3422 &dib0700_usb_id_table[52],
3423 &dib0700_usb_id_table[60], NULL},
Patrick Boettcherdb481382009-09-15 07:16:51 -03003424 { NULL },
3425 },
Lukas Max Fisch498e6772011-02-08 16:51:45 -03003426 { "TechniSat AirStar TeleStick 2",
3427 { &dib0700_usb_id_table[74], NULL },
3428 { NULL },
3429 },
Stéphane Elmalehd1402302011-05-21 07:33:38 -03003430 { "Medion CTX1921 DVB-T USB",
3431 { &dib0700_usb_id_table[75], NULL },
3432 { NULL },
3433 },
Olivier Grenied300bd62009-09-15 06:55:35 -03003434 },
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003435
3436 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003437 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003438 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003439 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003440 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003441 .allowed_protos = RC_TYPE_RC5 |
3442 RC_TYPE_RC6 |
3443 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003444 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003445 },
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03003446 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3447 .num_adapters = 1,
3448 .adapter = {
3449 {
Olivier Grenief8731f42009-09-18 04:08:43 -03003450 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3451 .pid_filter_count = 32,
Olivier Grenie03245a52009-12-04 13:27:57 -03003452 .pid_filter = stk80xx_pid_filter,
3453 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03003454 .frontend_attach = stk807x_frontend_attach,
3455 .tuner_attach = dib807x_tuner_attach,
3456
3457 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3458
3459 .size_of_priv =
3460 sizeof(struct dib0700_adapter_state),
3461 },
3462 },
3463
S?rgio Fortier8a378e82009-09-28 04:19:21 -03003464 .num_device_descs = 3,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03003465 .devices = {
3466 { "DiBcom STK807xP reference design",
3467 { &dib0700_usb_id_table[62], NULL },
3468 { NULL },
3469 },
Mauro Carvalho Chehabaaeab302009-09-16 09:18:26 -03003470 { "Prolink Pixelview SBTVD",
3471 { &dib0700_usb_id_table[63], NULL },
3472 { NULL },
3473 },
S?rgio Fortier8a378e82009-09-28 04:19:21 -03003474 { "EvolutePC TVWay+",
3475 { &dib0700_usb_id_table[64], NULL },
3476 { NULL },
3477 },
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03003478 },
3479
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003480 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003481 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003482 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003483 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003484 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003485 .allowed_protos = RC_TYPE_RC5 |
3486 RC_TYPE_RC6 |
3487 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003488 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003489 },
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03003490 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3491 .num_adapters = 2,
3492 .adapter = {
3493 {
Olivier Grenief8731f42009-09-18 04:08:43 -03003494 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3495 .pid_filter_count = 32,
Olivier Grenie03245a52009-12-04 13:27:57 -03003496 .pid_filter = stk80xx_pid_filter,
3497 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03003498 .frontend_attach = stk807xpvr_frontend_attach0,
3499 .tuner_attach = dib807x_tuner_attach,
3500
3501 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3502
3503 .size_of_priv =
3504 sizeof(struct dib0700_adapter_state),
3505 },
3506 {
Olivier Grenief8731f42009-09-18 04:08:43 -03003507 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3508 .pid_filter_count = 32,
Olivier Grenie03245a52009-12-04 13:27:57 -03003509 .pid_filter = stk80xx_pid_filter,
3510 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03003511 .frontend_attach = stk807xpvr_frontend_attach1,
3512 .tuner_attach = dib807x_tuner_attach,
3513
3514 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3515
3516 .size_of_priv =
3517 sizeof(struct dib0700_adapter_state),
3518 },
3519 },
3520
3521 .num_device_descs = 1,
3522 .devices = {
3523 { "DiBcom STK807xPVR reference design",
3524 { &dib0700_usb_id_table[61], NULL },
3525 { NULL },
3526 },
3527 },
3528
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003529 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003530 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003531 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003532 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003533 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003534 .allowed_protos = RC_TYPE_RC5 |
3535 RC_TYPE_RC6 |
3536 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003537 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003538 },
Olivier Grenie03245a52009-12-04 13:27:57 -03003539 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3540 .num_adapters = 1,
3541 .adapter = {
3542 {
3543 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3544 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3545 .pid_filter_count = 32,
3546 .pid_filter = stk80xx_pid_filter,
3547 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
3548 .frontend_attach = stk809x_frontend_attach,
3549 .tuner_attach = dib809x_tuner_attach,
3550
3551 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3552
3553 .size_of_priv =
3554 sizeof(struct dib0700_adapter_state),
3555 },
3556 },
3557
3558 .num_device_descs = 1,
3559 .devices = {
3560 { "DiBcom STK8096GP reference design",
3561 { &dib0700_usb_id_table[67], NULL },
3562 { NULL },
3563 },
3564 },
3565
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003566 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003567 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003568 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003569 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003570 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003571 .allowed_protos = RC_TYPE_RC5 |
3572 RC_TYPE_RC6 |
3573 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003574 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003575 },
Olivier Greniebe9bae12011-01-04 05:42:19 -03003576 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3577 .num_adapters = 1,
3578 .adapter = {
3579 {
3580 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3581 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3582 .pid_filter_count = 32,
3583 .pid_filter = dib90x0_pid_filter,
3584 .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
3585 .frontend_attach = stk9090m_frontend_attach,
3586 .tuner_attach = dib9090_tuner_attach,
3587
3588 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3589
3590 .size_of_priv =
3591 sizeof(struct dib0700_adapter_state),
3592 },
3593 },
3594
3595 .num_device_descs = 1,
3596 .devices = {
3597 { "DiBcom STK9090M reference design",
3598 { &dib0700_usb_id_table[69], NULL },
3599 { NULL },
3600 },
3601 },
3602
3603 .rc.core = {
3604 .rc_interval = DEFAULT_RC_INTERVAL,
3605 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3606 .module_name = "dib0700",
3607 .rc_query = dib0700_rc_query_old_firmware,
3608 .allowed_protos = RC_TYPE_RC5 |
3609 RC_TYPE_RC6 |
3610 RC_TYPE_NEC,
3611 .change_protocol = dib0700_change_protocol,
3612 },
3613 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3614 .num_adapters = 1,
3615 .adapter = {
3616 {
3617 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3618 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3619 .pid_filter_count = 32,
3620 .pid_filter = stk80xx_pid_filter,
3621 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
3622 .frontend_attach = nim8096md_frontend_attach,
3623 .tuner_attach = nim8096md_tuner_attach,
3624
3625 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3626
3627 .size_of_priv =
3628 sizeof(struct dib0700_adapter_state),
3629 },
3630 },
3631
3632 .num_device_descs = 1,
3633 .devices = {
3634 { "DiBcom NIM8096MD reference design",
3635 { &dib0700_usb_id_table[70], NULL },
3636 { NULL },
3637 },
3638 },
3639
3640 .rc.core = {
3641 .rc_interval = DEFAULT_RC_INTERVAL,
3642 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3643 .module_name = "dib0700",
3644 .rc_query = dib0700_rc_query_old_firmware,
3645 .allowed_protos = RC_TYPE_RC5 |
3646 RC_TYPE_RC6 |
3647 RC_TYPE_NEC,
3648 .change_protocol = dib0700_change_protocol,
3649 },
3650 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3651 .num_adapters = 1,
3652 .adapter = {
3653 {
3654 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3655 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3656 .pid_filter_count = 32,
3657 .pid_filter = dib90x0_pid_filter,
3658 .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
3659 .frontend_attach = nim9090md_frontend_attach,
3660 .tuner_attach = nim9090md_tuner_attach,
3661
3662 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3663
3664 .size_of_priv =
3665 sizeof(struct dib0700_adapter_state),
3666 },
3667 },
3668
3669 .num_device_descs = 1,
3670 .devices = {
3671 { "DiBcom NIM9090MD reference design",
3672 { &dib0700_usb_id_table[71], NULL },
3673 { NULL },
3674 },
3675 },
3676
3677 .rc.core = {
3678 .rc_interval = DEFAULT_RC_INTERVAL,
3679 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3680 .module_name = "dib0700",
3681 .rc_query = dib0700_rc_query_old_firmware,
3682 .allowed_protos = RC_TYPE_RC5 |
3683 RC_TYPE_RC6 |
3684 RC_TYPE_NEC,
3685 .change_protocol = dib0700_change_protocol,
3686 },
3687 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3688 .num_adapters = 1,
3689 .adapter = {
3690 {
3691 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3692 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3693 .pid_filter_count = 32,
3694 .pid_filter = stk70x0p_pid_filter,
3695 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3696 .frontend_attach = nim7090_frontend_attach,
3697 .tuner_attach = nim7090_tuner_attach,
3698
3699 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3700
3701 .size_of_priv =
3702 sizeof(struct dib0700_adapter_state),
3703 },
3704 },
3705
3706 .num_device_descs = 1,
3707 .devices = {
3708 { "DiBcom NIM7090 reference design",
3709 { &dib0700_usb_id_table[72], NULL },
3710 { NULL },
3711 },
3712 },
3713
3714 .rc.core = {
3715 .rc_interval = DEFAULT_RC_INTERVAL,
3716 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3717 .module_name = "dib0700",
3718 .rc_query = dib0700_rc_query_old_firmware,
3719 .allowed_protos = RC_TYPE_RC5 |
3720 RC_TYPE_RC6 |
3721 RC_TYPE_NEC,
3722 .change_protocol = dib0700_change_protocol,
3723 },
3724 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3725 .num_adapters = 2,
3726 .adapter = {
3727 {
3728 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3729 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3730 .pid_filter_count = 32,
3731 .pid_filter = stk70x0p_pid_filter,
3732 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3733 .frontend_attach = tfe7090pvr_frontend0_attach,
3734 .tuner_attach = tfe7090pvr_tuner0_attach,
3735
3736 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
3737
3738 .size_of_priv =
3739 sizeof(struct dib0700_adapter_state),
3740 },
3741 {
3742 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
3743 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3744 .pid_filter_count = 32,
3745 .pid_filter = stk70x0p_pid_filter,
3746 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3747 .frontend_attach = tfe7090pvr_frontend1_attach,
3748 .tuner_attach = tfe7090pvr_tuner1_attach,
3749
3750 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
3751
3752 .size_of_priv =
3753 sizeof(struct dib0700_adapter_state),
3754 },
3755 },
3756
3757 .num_device_descs = 1,
3758 .devices = {
3759 { "DiBcom TFE7090PVR reference design",
3760 { &dib0700_usb_id_table[73], NULL },
3761 { NULL },
3762 },
3763 },
3764
3765 .rc.core = {
3766 .rc_interval = DEFAULT_RC_INTERVAL,
3767 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3768 .module_name = "dib0700",
3769 .rc_query = dib0700_rc_query_old_firmware,
3770 .allowed_protos = RC_TYPE_RC5 |
3771 RC_TYPE_RC6 |
3772 RC_TYPE_NEC,
3773 .change_protocol = dib0700_change_protocol,
3774 },
Patrick Boettcher01373a52007-07-30 12:49:04 -03003775 },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03003776};
3777
3778int dib0700_device_count = ARRAY_SIZE(dib0700_devices);