blob: 823c3562b84e59fbde2223251f6cf44f849ab3cd [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"
Davide Ferri8d009a02009-06-23 22:34:06 -030020#include "xc4000.h"
Devin Heitmuellercb22cb52008-09-08 05:42:42 -030021#include "s5h1411.h"
Patrick Boettcher01373a52007-07-30 12:49:04 -030022#include "dib0070.h"
Olivier Grenie03245a52009-12-04 13:27:57 -030023#include "dib0090.h"
Michael Krufkyce904bc2009-01-19 01:12:55 -030024#include "lgdt3305.h"
25#include "mxl5007t.h"
Patrick Boettcherb7f54912006-09-19 12:51:37 -030026
Patrick Boettcher7fb3fc02006-09-20 04:37:18 -030027static int force_lna_activation;
28module_param(force_lna_activation, int, 0644);
29MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), "
30 "if applicable for the device (default: 0=automatic/off).");
31
Patrick Boettcher01373a52007-07-30 12:49:04 -030032struct dib0700_adapter_state {
33 int (*set_param_save) (struct dvb_frontend *, struct dvb_frontend_parameters *);
Olivier Greniebe9bae12011-01-04 05:42:19 -030034 const struct firmware *frontend_firmware;
Patrick Boettcher01373a52007-07-30 12:49:04 -030035};
36
37/* Hauppauge Nova-T 500 (aka Bristol)
Patrick Boettcherb7f54912006-09-19 12:51:37 -030038 * has a LNA on GPIO0 which is enabled by setting 1 */
39static struct mt2060_config bristol_mt2060_config[2] = {
40 {
41 .i2c_address = 0x60,
Patrick Boettcher303cbea2006-09-19 12:51:56 -030042 .clock_out = 3,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030043 }, {
44 .i2c_address = 0x61,
45 }
46};
47
Devin Heitmueller99afb982008-11-15 07:13:07 -030048
Patrick Boettcherb7f54912006-09-19 12:51:37 -030049static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
50 .band_caps = BAND_VHF | BAND_UHF,
Patrick Boettcher01b4bf32006-09-19 12:51:53 -030051 .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
Patrick Boettcherb7f54912006-09-19 12:51:37 -030052
Patrick Boettcher6958eff2006-09-19 12:51:40 -030053 .agc1_max = 42598,
54 .agc1_min = 17694,
55 .agc2_max = 45875,
56 .agc2_min = 0,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030057
Patrick Boettcher6958eff2006-09-19 12:51:40 -030058 .agc1_pt1 = 0,
59 .agc1_pt2 = 59,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030060
Patrick Boettcher6958eff2006-09-19 12:51:40 -030061 .agc1_slope1 = 0,
62 .agc1_slope2 = 69,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030063
64 .agc2_pt1 = 0,
Patrick Boettcher6958eff2006-09-19 12:51:40 -030065 .agc2_pt2 = 59,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030066
Patrick Boettcher6958eff2006-09-19 12:51:40 -030067 .agc2_slope1 = 111,
68 .agc2_slope2 = 28,
Patrick Boettcherb7f54912006-09-19 12:51:37 -030069};
70
71static struct dib3000mc_config bristol_dib3000mc_config[2] = {
72 { .agc = &bristol_dib3000p_mt2060_agc_config,
73 .max_time = 0x196,
74 .ln_adc_level = 0x1cc7,
75 .output_mpeg2_in_188_bytes = 1,
76 },
77 { .agc = &bristol_dib3000p_mt2060_agc_config,
78 .max_time = 0x196,
79 .ln_adc_level = 0x1cc7,
80 .output_mpeg2_in_188_bytes = 1,
81 }
82};
83
84static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
85{
Patrick Boettcher6958eff2006-09-19 12:51:40 -030086 struct dib0700_state *st = adap->dev->priv;
Patrick Boettcherb7f54912006-09-19 12:51:37 -030087 if (adap->id == 0) {
88 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
89 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
90 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
91 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
92
Patrick Boettcher7fb3fc02006-09-20 04:37:18 -030093 if (force_lna_activation)
94 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
95 else
96 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
Patrick Boettcher6958eff2006-09-19 12:51:40 -030097
Patrick Boettcherb7f54912006-09-19 12:51:37 -030098 if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {
99 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
100 return -ENODEV;
101 }
102 }
Patrick Boettcher6958eff2006-09-19 12:51:40 -0300103 st->mt2060_if1[adap->id] = 1220;
Michael Krufky77eed212011-09-06 09:31:57 -0300104 return (adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
Patrick Boettcher6958eff2006-09-19 12:51:40 -0300105 (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300106}
107
Patrick Boettcher4a2b1082008-01-25 07:32:58 -0300108static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval)
Olivier DANETc52344f2008-01-25 06:50:07 -0300109{
110 struct i2c_msg msg[2] = {
111 { .addr = 0x50, .flags = 0, .buf = &adrs, .len = 1 },
112 { .addr = 0x50, .flags = I2C_M_RD, .buf = pval, .len = 1 },
113 };
114 if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO;
115 return 0;
116}
117
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300118static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
119{
Olivier DANETc52344f2008-01-25 06:50:07 -0300120 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
Michael Krufky77eed212011-09-06 09:31:57 -0300121 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe_adap[0].fe, 1);
Olivier DANETc52344f2008-01-25 06:50:07 -0300122 s8 a;
123 int if1=1220;
Al Viroda5ee482008-05-21 00:31:21 -0300124 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
125 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) {
Olivier DANETc52344f2008-01-25 06:50:07 -0300126 if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;
127 }
Michael Krufky9a9677a2011-09-13 01:32:11 -0300128 return dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c,
129 &bristol_mt2060_config[adap->id], if1) == NULL ?
130 -ENODEV : 0;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300131}
132
Patrick Boettcher01373a52007-07-30 12:49:04 -0300133/* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
Olivier DANET54d75eb2007-07-25 14:42:54 -0300134
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300135/* MT226x */
136static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = {
137 {
Olivier Grenie9c783032009-12-07 07:49:40 -0300138 BAND_UHF,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300139
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300140 /* 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,
141 * 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 -0300142 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
143 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
Olivier DANET54d75eb2007-07-25 14:42:54 -0300144
Olivier Grenie9c783032009-12-07 07:49:40 -0300145 1130,
146 21,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300147
Olivier Grenie9c783032009-12-07 07:49:40 -0300148 0,
149 118,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300150
Olivier Grenie9c783032009-12-07 07:49:40 -0300151 0,
152 3530,
153 1,
154 0,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300155
Olivier Grenie9c783032009-12-07 07:49:40 -0300156 65535,
157 33770,
158 65535,
159 23592,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300160
Olivier Grenie9c783032009-12-07 07:49:40 -0300161 0,
162 62,
163 255,
164 64,
165 64,
166 132,
167 192,
168 80,
169 80,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300170
Olivier Grenie9c783032009-12-07 07:49:40 -0300171 17,
172 27,
173 23,
174 51,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300175
Olivier Grenie9c783032009-12-07 07:49:40 -0300176 1,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300177 }, {
Olivier Grenie9c783032009-12-07 07:49:40 -0300178 BAND_VHF | BAND_LBAND,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300179
180 /* 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,
181 * 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 -0300182 (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)
183 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300184
Olivier Grenie9c783032009-12-07 07:49:40 -0300185 2372,
186 21,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300187
Olivier Grenie9c783032009-12-07 07:49:40 -0300188 0,
189 118,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300190
Olivier Grenie9c783032009-12-07 07:49:40 -0300191 0,
192 3530,
193 1,
194 0,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300195
Olivier Grenie9c783032009-12-07 07:49:40 -0300196 65535,
197 0,
198 65535,
199 23592,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300200
Olivier Grenie9c783032009-12-07 07:49:40 -0300201 0,
202 128,
203 128,
204 128,
205 0,
206 128,
207 253,
208 81,
209 0,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300210
Olivier Grenie9c783032009-12-07 07:49:40 -0300211 17,
212 27,
213 23,
214 51,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300215
Olivier Grenie9c783032009-12-07 07:49:40 -0300216 1,
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300217 }
Olivier DANET54d75eb2007-07-25 14:42:54 -0300218};
219
220static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = {
Olivier Grenie9c783032009-12-07 07:49:40 -0300221 60000, 30000,
222 1, 8, 3, 1, 0,
223 0, 0, 1, 1, 2,
224 (3 << 14) | (1 << 12) | (524 << 0),
225 0,
226 20452225,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300227};
228
229static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {
230 { .output_mpeg2_in_188_bytes = 1,
231 .hostbus_diversity = 1,
232 .tuner_is_baseband = 1,
233
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300234 .agc_config_count = 2,
235 .agc = stk7700d_7000p_mt2266_agc_config,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300236 .bw = &stk7700d_mt2266_pll_config,
237
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300238 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
239 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
240 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300241 },
242 { .output_mpeg2_in_188_bytes = 1,
243 .hostbus_diversity = 1,
244 .tuner_is_baseband = 1,
245
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300246 .agc_config_count = 2,
247 .agc = stk7700d_7000p_mt2266_agc_config,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300248 .bw = &stk7700d_mt2266_pll_config,
249
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300250 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
251 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
252 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
Olivier DANET54d75eb2007-07-25 14:42:54 -0300253 }
254};
255
256static struct mt2266_config stk7700d_mt2266_config[2] = {
257 { .i2c_address = 0x60
258 },
259 { .i2c_address = 0x60
260 }
261};
262
Daniel Gimpelevich132c3182008-01-25 06:02:42 -0300263static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap)
264{
265 if (adap->id == 0) {
266 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
267 msleep(10);
268 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
269 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
270 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
271 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
272 msleep(10);
273 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
274 msleep(10);
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -0300275 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
276 stk7700d_dib7000p_mt2266_config)
277 != 0) {
278 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
279 return -ENODEV;
280 }
Daniel Gimpelevich132c3182008-01-25 06:02:42 -0300281 }
282
Michael Krufky2a776312011-09-16 09:26:59 -0300283 adap->fe_adap[0].fe =
284 dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,
285 0x80 + (adap->id << 1),
286 &stk7700d_dib7000p_mt2266_config[adap->id]);
Daniel Gimpelevich132c3182008-01-25 06:02:42 -0300287
Michael Krufky77eed212011-09-06 09:31:57 -0300288 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Daniel Gimpelevich132c3182008-01-25 06:02:42 -0300289}
290
Olivier DANET54d75eb2007-07-25 14:42:54 -0300291static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap)
292{
293 if (adap->id == 0) {
294 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
295 msleep(10);
296 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
297 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
298 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
299 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
300 msleep(10);
301 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
302 msleep(10);
303 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -0300304 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
305 stk7700d_dib7000p_mt2266_config)
306 != 0) {
307 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
308 return -ENODEV;
309 }
Olivier DANET54d75eb2007-07-25 14:42:54 -0300310 }
311
Michael Krufky2a776312011-09-16 09:26:59 -0300312 adap->fe_adap[0].fe =
313 dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,
314 0x80 + (adap->id << 1),
315 &stk7700d_dib7000p_mt2266_config[adap->id]);
Olivier DANET54d75eb2007-07-25 14:42:54 -0300316
Michael Krufky77eed212011-09-06 09:31:57 -0300317 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300318}
319
320static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap)
321{
322 struct i2c_adapter *tun_i2c;
Michael Krufky77eed212011-09-06 09:31:57 -0300323 tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
324 return dvb_attach(mt2266_attach, adap->fe_adap[0].fe, tun_i2c,
Joe Perches1ebcad72009-07-02 15:57:09 -0300325 &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300326}
327
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300328/* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
Harvey Harrisonb1721d02008-04-25 19:03:08 -0700329static struct dibx000_agc_config xc3028_agc_config = {
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300330 BAND_VHF | BAND_UHF, /* band_caps */
331
332 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
333 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
334 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
335 (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
336 (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */
337
338 712, /* inv_gain */
339 21, /* time_stabiliz */
340
341 0, /* alpha_level */
342 118, /* thlock */
343
344 0, /* wbd_inv */
345 2867, /* wbd_ref */
346 0, /* wbd_sel */
347 2, /* wbd_alpha */
348
349 0, /* agc1_max */
350 0, /* agc1_min */
351 39718, /* agc2_max */
352 9930, /* agc2_min */
353 0, /* agc1_pt1 */
354 0, /* agc1_pt2 */
355 0, /* agc1_pt3 */
356 0, /* agc1_slope1 */
357 0, /* agc1_slope2 */
358 0, /* agc2_pt1 */
359 128, /* agc2_pt2 */
360 29, /* agc2_slope1 */
361 29, /* agc2_slope2 */
362
363 17, /* alpha_mant */
364 27, /* alpha_exp */
365 23, /* beta_mant */
366 51, /* beta_exp */
367
368 1, /* perform_agc_softsplit */
369};
370
371/* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
Harvey Harrisonb1721d02008-04-25 19:03:08 -0700372static struct dibx000_bandwidth_config xc3028_bw_config = {
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300373 60000, 30000, /* internal, sampling */
374 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
375 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc,
376 modulo */
377 (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
378 (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */
379 20452225, /* timf */
380 30000000, /* xtal_hz */
381};
382
383static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
384 .output_mpeg2_in_188_bytes = 1,
385 .tuner_is_baseband = 1,
386
387 .agc_config_count = 1,
388 .agc = &xc3028_agc_config,
389 .bw = &xc3028_bw_config,
390
391 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
392 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
393 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
394};
395
Michael Krufkyd7cba042008-09-12 13:31:45 -0300396static int stk7700ph_xc3028_callback(void *ptr, int component,
397 int command, int arg)
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300398{
399 struct dvb_usb_adapter *adap = ptr;
400
401 switch (command) {
402 case XC2028_TUNER_RESET:
403 /* Send the tuner in then out of reset */
Michael Krufky77eed212011-09-06 09:31:57 -0300404 dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 0); msleep(10);
405 dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300406 break;
407 case XC2028_RESET_CLK:
408 break;
409 default:
410 err("%s: unknown command %d, arg %d\n", __func__,
411 command, arg);
412 return -EINVAL;
413 }
414 return 0;
415}
416
417static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
418 .fname = XC2028_DEFAULT_FIRMWARE,
419 .max_len = 64,
420 .demod = XC3028_FE_DIBCOM52,
421};
422
423static struct xc2028_config stk7700ph_xc3028_config = {
424 .i2c_addr = 0x61,
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300425 .ctrl = &stk7700ph_xc3028_ctrl,
426};
427
428static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
429{
430 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;
431
Al Viroda5ee482008-05-21 00:31:21 -0300432 if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
433 desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300434 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
435 else
436 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
437 msleep(20);
438 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
439 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
440 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
441 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
442 msleep(10);
443 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
444 msleep(20);
445 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
446 msleep(10);
447
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -0300448 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
449 &stk7700ph_dib7700_xc3028_config) != 0) {
450 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
451 __func__);
452 return -ENODEV;
453 }
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300454
Michael Krufky77eed212011-09-06 09:31:57 -0300455 adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300456 &stk7700ph_dib7700_xc3028_config);
457
Michael Krufky77eed212011-09-06 09:31:57 -0300458 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300459}
460
461static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
462{
463 struct i2c_adapter *tun_i2c;
464
Michael Krufky77eed212011-09-06 09:31:57 -0300465 tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe,
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300466 DIBX000_I2C_INTERFACE_TUNER, 1);
467
468 stk7700ph_xc3028_config.i2c_adap = tun_i2c;
Michael Krufkyd7cba042008-09-12 13:31:45 -0300469
470 /* FIXME: generalize & move to common area */
Michael Krufky77eed212011-09-06 09:31:57 -0300471 adap->fe_adap[0].fe->callback = stk7700ph_xc3028_callback;
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300472
Michael Krufky77eed212011-09-06 09:31:57 -0300473 return dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &stk7700ph_xc3028_config)
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300474 == NULL ? -ENODEV : 0;
475}
476
Devin Heitmueller4b330be2008-12-01 06:51:14 -0300477#define DEFAULT_RC_INTERVAL 50
Olivier DANET54d75eb2007-07-25 14:42:54 -0300478
479static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
480
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300481/* Number of keypresses to ignore before start repeating */
Devin Heitmueller4b330be2008-12-01 06:51:14 -0300482#define RC_REPEAT_DELAY 6
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300483
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -0300484/*
485 * This function is used only when firmware is < 1.20 version. Newer
486 * firmwares use bulk mode, with functions implemented at dib0700_core,
487 * at dib0700_rc_urb_completion()
488 */
489static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d)
Olivier DANET54d75eb2007-07-25 14:42:54 -0300490{
491 u8 key[4];
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -0300492 u32 keycode;
493 u8 toggle;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300494 int i;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300495 struct dib0700_state *st = d->priv;
Devin Heitmueller6a207102010-01-04 02:43:19 -0300496
Devin Heitmueller6a207102010-01-04 02:43:19 -0300497 if (st->fw_version >= 0x10200) {
498 /* For 1.20 firmware , We need to keep the RC polling
499 callback so we can reuse the input device setup in
500 dvb-usb-remote.c. However, the actual work is being done
501 in the bulk URB completion handler. */
502 return 0;
503 }
504
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -0300505 i = dib0700_ctrl_rd(d, rc_request, 2, key, 4);
506 if (i <= 0) {
Janne Grunau034d65e2007-07-31 08:48:40 -0300507 err("RC Query Failed");
Janne Grunau89f42672007-07-31 19:45:13 -0300508 return -1;
Olivier DANET54d75eb2007-07-25 14:42:54 -0300509 }
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300510
511 /* losing half of KEY_0 events from Philipps rc5 remotes.. */
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -0300512 if (key[0] == 0 && key[1] == 0 && key[2] == 0 && key[3] == 0)
513 return 0;
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300514
515 /* 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]); */
516
517 dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */
518
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -0300519 d->last_event = 0;
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -0300520 switch (d->props.rc.core.protocol) {
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -0300521 case RC_TYPE_NEC:
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300522 /* NEC protocol sends repeat code as 0 0 0 FF */
523 if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -0300524 (key[3] == 0xff))
525 keycode = d->last_event;
526 else {
527 keycode = key[3-2] << 8 | key[3-3];
528 d->last_event = keycode;
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300529 }
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300530
Mauro Carvalho Chehabca866742010-11-17 13:53:11 -0300531 rc_keydown(d->rc_dev, keycode, 0);
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -0300532 break;
533 default:
534 /* RC-5 protocol changes toggle bit on new keypress */
535 keycode = key[3-2] << 8 | key[3-3];
536 toggle = key[3-1];
Mauro Carvalho Chehabca866742010-11-17 13:53:11 -0300537 rc_keydown(d->rc_dev, keycode, toggle);
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -0300538
Patrick Boettcher58e6f952008-03-29 21:37:01 -0300539 break;
540 }
Olivier DANET54d75eb2007-07-25 14:42:54 -0300541 return 0;
542}
543
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300544/* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
Patrick Boettchera75763f2006-10-18 08:34:16 -0300545static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
Olivier Grenie9c783032009-12-07 07:49:40 -0300546 BAND_UHF | BAND_VHF,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300547
548 /* 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,
549 * 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 -0300550 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
551 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300552
Olivier Grenie9c783032009-12-07 07:49:40 -0300553 712,
554 41,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300555
Olivier Grenie9c783032009-12-07 07:49:40 -0300556 0,
557 118,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300558
Olivier Grenie9c783032009-12-07 07:49:40 -0300559 0,
560 4095,
561 0,
562 0,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300563
Olivier Grenie9c783032009-12-07 07:49:40 -0300564 42598,
565 17694,
566 45875,
567 2621,
568 0,
569 76,
570 139,
571 52,
572 59,
573 107,
574 172,
575 57,
576 70,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300577
Olivier Grenie9c783032009-12-07 07:49:40 -0300578 21,
579 25,
580 28,
581 48,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300582
Olivier Grenie9c783032009-12-07 07:49:40 -0300583 1,
584 { 0,
585 107,
586 51800,
587 24700
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300588 },
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300589};
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300590
Patrick Boettchera75763f2006-10-18 08:34:16 -0300591static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
592 BAND_UHF | BAND_VHF,
593
594 /* 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,
595 * 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 -0300596 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
597 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
Patrick Boettchera75763f2006-10-18 08:34:16 -0300598
Olivier Grenie9c783032009-12-07 07:49:40 -0300599 712,
600 41,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300601
Olivier Grenie9c783032009-12-07 07:49:40 -0300602 0,
603 118,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300604
Olivier Grenie9c783032009-12-07 07:49:40 -0300605 0,
606 4095,
607 0,
608 0,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300609
Olivier Grenie9c783032009-12-07 07:49:40 -0300610 42598,
611 16384,
612 42598,
613 0,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300614
Olivier Grenie9c783032009-12-07 07:49:40 -0300615 0,
616 137,
617 255,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300618
Olivier Grenie9c783032009-12-07 07:49:40 -0300619 0,
620 255,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300621
Olivier Grenie9c783032009-12-07 07:49:40 -0300622 0,
623 0,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300624
Olivier Grenie9c783032009-12-07 07:49:40 -0300625 0,
626 41,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300627
Olivier Grenie9c783032009-12-07 07:49:40 -0300628 15,
629 25,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300630
Olivier Grenie9c783032009-12-07 07:49:40 -0300631 28,
632 48,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300633
Olivier Grenie9c783032009-12-07 07:49:40 -0300634 0,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300635};
636
637static struct dibx000_bandwidth_config stk7700p_pll_config = {
Olivier Grenie9c783032009-12-07 07:49:40 -0300638 60000, 30000,
639 1, 8, 3, 1, 0,
640 0, 0, 1, 1, 0,
641 (3 << 14) | (1 << 12) | (524 << 0),
642 60258167,
643 20452225,
644 30000000,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300645};
646
647static struct dib7000m_config stk7700p_dib7000m_config = {
648 .dvbt_mode = 1,
649 .output_mpeg2_in_188_bytes = 1,
650 .quartz_direct = 1,
651
652 .agc_config_count = 1,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300653 .agc = &stk7700p_7000m_mt2060_agc_config,
654 .bw = &stk7700p_pll_config,
655
656 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
657 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
658 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
659};
660
661static struct dib7000p_config stk7700p_dib7000p_config = {
662 .output_mpeg2_in_188_bytes = 1,
663
Patrick Boettcherb6884a12007-07-27 10:08:51 -0300664 .agc_config_count = 1,
Patrick Boettchera75763f2006-10-18 08:34:16 -0300665 .agc = &stk7700p_7000p_mt2060_agc_config,
666 .bw = &stk7700p_pll_config,
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300667
668 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
669 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
670 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
671};
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300672
673static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
674{
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300675 struct dib0700_state *st = adap->dev->priv;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300676 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
Patrick Boettchera75763f2006-10-18 08:34:16 -0300677
678 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
679 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
680
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300681 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
Patrick Boettchera75763f2006-10-18 08:34:16 -0300682 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
683
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300684 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
Patrick Boettchera75763f2006-10-18 08:34:16 -0300685 dib0700_ctrl_clock(adap->dev, 72, 1);
686 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
687
688 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300689
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300690 st->mt2060_if1[0] = 1220;
Patrick Boettchera75763f2006-10-18 08:34:16 -0300691
692 if (dib7000pc_detection(&adap->dev->i2c_adap)) {
Michael Krufky77eed212011-09-06 09:31:57 -0300693 adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
Patrick Boettchera75763f2006-10-18 08:34:16 -0300694 st->is_dib7000pc = 1;
695 } else
Michael Krufky77eed212011-09-06 09:31:57 -0300696 adap->fe_adap[0].fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
Patrick Boettchera75763f2006-10-18 08:34:16 -0300697
Michael Krufky77eed212011-09-06 09:31:57 -0300698 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300699}
700
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300701static struct mt2060_config stk7700p_mt2060_config = {
702 0x60
703};
704
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300705static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
706{
Olivier DANETc52344f2008-01-25 06:50:07 -0300707 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
Patrick Boettcher69ea31e2006-10-17 18:28:14 -0300708 struct dib0700_state *st = adap->dev->priv;
Patrick Boettchera75763f2006-10-18 08:34:16 -0300709 struct i2c_adapter *tun_i2c;
Olivier DANETc52344f2008-01-25 06:50:07 -0300710 s8 a;
711 int if1=1220;
Al Viroda5ee482008-05-21 00:31:21 -0300712 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
713 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
Olivier DANETc52344f2008-01-25 06:50:07 -0300714 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
715 }
Patrick Boettchera75763f2006-10-18 08:34:16 -0300716 if (st->is_dib7000pc)
Michael Krufky77eed212011-09-06 09:31:57 -0300717 tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
Patrick Boettchera75763f2006-10-18 08:34:16 -0300718 else
Michael Krufky77eed212011-09-06 09:31:57 -0300719 tun_i2c = dib7000m_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
Patrick Boettchera75763f2006-10-18 08:34:16 -0300720
Michael Krufky77eed212011-09-06 09:31:57 -0300721 return dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, &stk7700p_mt2060_config,
Olivier DANETc52344f2008-01-25 06:50:07 -0300722 if1) == NULL ? -ENODEV : 0;
Patrick Boettcherb7f54912006-09-19 12:51:37 -0300723}
724
Patrick Boettcher01373a52007-07-30 12:49:04 -0300725/* DIB7070 generic */
726static struct dibx000_agc_config dib7070_agc_config = {
727 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
728 /* 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,
729 * 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 -0300730 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
731 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
Patrick Boettcher01373a52007-07-30 12:49:04 -0300732
Olivier Grenie9c783032009-12-07 07:49:40 -0300733 600,
734 10,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300735
Olivier Grenie9c783032009-12-07 07:49:40 -0300736 0,
737 118,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300738
Olivier Grenie9c783032009-12-07 07:49:40 -0300739 0,
740 3530,
741 1,
742 5,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300743
Olivier Grenie9c783032009-12-07 07:49:40 -0300744 65535,
745 0,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300746
Olivier Grenie9c783032009-12-07 07:49:40 -0300747 65535,
748 0,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300749
Olivier Grenie9c783032009-12-07 07:49:40 -0300750 0,
751 40,
752 183,
753 206,
754 255,
755 72,
756 152,
757 88,
758 90,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300759
Olivier Grenie9c783032009-12-07 07:49:40 -0300760 17,
761 27,
762 23,
763 51,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300764
Olivier Grenie9c783032009-12-07 07:49:40 -0300765 0,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300766};
767
768static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
769{
Patrick Boettcher7e5ce652009-08-03 13:43:40 -0300770 deb_info("reset: %d", onoff);
Patrick Boettcher01373a52007-07-30 12:49:04 -0300771 return dib7000p_set_gpio(fe, 8, 0, !onoff);
772}
773
774static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
775{
Patrick Boettcher7e5ce652009-08-03 13:43:40 -0300776 deb_info("sleep: %d", onoff);
Patrick Boettcher01373a52007-07-30 12:49:04 -0300777 return dib7000p_set_gpio(fe, 9, 0, onoff);
778}
779
780static struct dib0070_config dib7070p_dib0070_config[2] = {
781 {
782 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
783 .reset = dib7070_tuner_reset,
784 .sleep = dib7070_tuner_sleep,
785 .clock_khz = 12000,
Patrick Boettcher7e5ce652009-08-03 13:43:40 -0300786 .clock_pad_drive = 4,
787 .charge_pump = 2,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300788 }, {
789 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
790 .reset = dib7070_tuner_reset,
791 .sleep = dib7070_tuner_sleep,
792 .clock_khz = 12000,
Patrick Boettcher7e5ce652009-08-03 13:43:40 -0300793 .charge_pump = 2,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300794 }
795};
796
Olivier Grenied300bd62009-09-15 06:55:35 -0300797static struct dib0070_config dib7770p_dib0070_config = {
798 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
799 .reset = dib7070_tuner_reset,
800 .sleep = dib7070_tuner_sleep,
801 .clock_khz = 12000,
802 .clock_pad_drive = 0,
803 .flip_chip = 1,
Olivier Grenieeac1fe12009-09-23 13:41:27 -0300804 .charge_pump = 2,
Olivier Grenied300bd62009-09-15 06:55:35 -0300805};
806
Patrick Boettcher01373a52007-07-30 12:49:04 -0300807static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
808{
809 struct dvb_usb_adapter *adap = fe->dvb->priv;
810 struct dib0700_adapter_state *state = adap->priv;
811
812 u16 offset;
813 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
814 switch (band) {
815 case BAND_VHF: offset = 950; break;
816 case BAND_UHF:
817 default: offset = 550; break;
818 }
819 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
820 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
821 return state->set_param_save(fe, fep);
822}
823
Olivier Grenied300bd62009-09-15 06:55:35 -0300824static int dib7770_set_param_override(struct dvb_frontend *fe,
825 struct dvb_frontend_parameters *fep)
826{
827 struct dvb_usb_adapter *adap = fe->dvb->priv;
828 struct dib0700_adapter_state *state = adap->priv;
829
830 u16 offset;
831 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
832 switch (band) {
833 case BAND_VHF:
834 dib7000p_set_gpio(fe, 0, 0, 1);
835 offset = 850;
836 break;
837 case BAND_UHF:
838 default:
839 dib7000p_set_gpio(fe, 0, 0, 0);
840 offset = 250;
841 break;
842 }
843 deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));
844 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
845 return state->set_param_save(fe, fep);
846}
847
848static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)
849{
850 struct dib0700_adapter_state *st = adap->priv;
Michael Krufky77eed212011-09-06 09:31:57 -0300851 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe,
Olivier Grenied300bd62009-09-15 06:55:35 -0300852 DIBX000_I2C_INTERFACE_TUNER, 1);
853
Michael Krufky77eed212011-09-06 09:31:57 -0300854 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
Michael Krufky6e1ce98d2011-09-13 01:08:44 -0300855 &dib7770p_dib0070_config) == NULL)
Olivier Grenied300bd62009-09-15 06:55:35 -0300856 return -ENODEV;
857
Michael Krufky77eed212011-09-06 09:31:57 -0300858 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
859 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7770_set_param_override;
Olivier Grenied300bd62009-09-15 06:55:35 -0300860 return 0;
861}
862
Patrick Boettcher01373a52007-07-30 12:49:04 -0300863static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)
864{
865 struct dib0700_adapter_state *st = adap->priv;
Michael Krufky77eed212011-09-06 09:31:57 -0300866 struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
Patrick Boettcher01373a52007-07-30 12:49:04 -0300867
868 if (adap->id == 0) {
Michael Krufky77eed212011-09-06 09:31:57 -0300869 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)
Patrick Boettcher01373a52007-07-30 12:49:04 -0300870 return -ENODEV;
871 } else {
Michael Krufky77eed212011-09-06 09:31:57 -0300872 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)
Patrick Boettcher01373a52007-07-30 12:49:04 -0300873 return -ENODEV;
874 }
875
Michael Krufky77eed212011-09-06 09:31:57 -0300876 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
877 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override;
Patrick Boettcher01373a52007-07-30 12:49:04 -0300878 return 0;
879}
880
Olivier Greniee192a7c2011-01-14 13:58:59 -0300881static int stk7700p_pid_filter(struct dvb_usb_adapter *adapter, int index,
882 u16 pid, int onoff)
883{
884 struct dib0700_state *st = adapter->dev->priv;
885 if (st->is_dib7000pc)
Michael Krufky77eed212011-09-06 09:31:57 -0300886 return dib7000p_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
887 return dib7000m_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
Olivier Greniee192a7c2011-01-14 13:58:59 -0300888}
889
890static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
891{
892 struct dib0700_state *st = adapter->dev->priv;
893 if (st->is_dib7000pc)
Michael Krufky77eed212011-09-06 09:31:57 -0300894 return dib7000p_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
895 return dib7000m_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
Olivier Greniee192a7c2011-01-14 13:58:59 -0300896}
897
Olivier Grenief8731f42009-09-18 04:08:43 -0300898static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
899{
Michael Krufkye3e59b02011-09-11 19:47:49 -0300900 return dib7000p_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
Olivier Grenief8731f42009-09-18 04:08:43 -0300901}
902
903static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
904{
Michael Krufkye3e59b02011-09-11 19:47:49 -0300905 return dib7000p_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
Olivier Grenief8731f42009-09-18 04:08:43 -0300906}
907
Patrick Boettcher01373a52007-07-30 12:49:04 -0300908static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
Olivier Grenie9c783032009-12-07 07:49:40 -0300909 60000, 15000,
910 1, 20, 3, 1, 0,
911 0, 0, 1, 1, 2,
912 (3 << 14) | (1 << 12) | (524 << 0),
913 (0 << 25) | 0,
914 20452225,
915 12000000,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300916};
917
918static struct dib7000p_config dib7070p_dib7000p_config = {
919 .output_mpeg2_in_188_bytes = 1,
920
921 .agc_config_count = 1,
922 .agc = &dib7070_agc_config,
923 .bw = &dib7070_bw_config_12_mhz,
Patrick Boettcher3cb2c392008-01-25 07:25:20 -0300924 .tuner_is_baseband = 1,
925 .spur_protect = 1,
Patrick Boettcher01373a52007-07-30 12:49:04 -0300926
927 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
928 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
929 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
930
931 .hostbus_diversity = 1,
932};
933
934/* STK7070P */
935static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
936{
Al Viroda5ee482008-05-21 00:31:21 -0300937 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
938 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
939 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
940 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300941 else
Al Viroda5ee482008-05-21 00:31:21 -0300942 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
Patrick Boettcher01373a52007-07-30 12:49:04 -0300943 msleep(10);
944 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
945 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
946 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
947 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
948
949 dib0700_ctrl_clock(adap->dev, 72, 1);
950
951 msleep(10);
952 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
953 msleep(10);
954 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
955
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -0300956 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
957 &dib7070p_dib7000p_config) != 0) {
958 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
959 __func__);
960 return -ENODEV;
961 }
Patrick Boettcher01373a52007-07-30 12:49:04 -0300962
Michael Krufky77eed212011-09-06 09:31:57 -0300963 adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
Albert Comerma6ca8f0b2008-03-29 21:35:57 -0300964 &dib7070p_dib7000p_config);
Michael Krufky77eed212011-09-06 09:31:57 -0300965 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Patrick Boettcher01373a52007-07-30 12:49:04 -0300966}
967
Olivier Grenie90e12ce2010-09-07 12:50:45 -0300968/* STK7770P */
969static struct dib7000p_config dib7770p_dib7000p_config = {
970 .output_mpeg2_in_188_bytes = 1,
971
972 .agc_config_count = 1,
973 .agc = &dib7070_agc_config,
974 .bw = &dib7070_bw_config_12_mhz,
975 .tuner_is_baseband = 1,
976 .spur_protect = 1,
977
978 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
979 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
980 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
981
982 .hostbus_diversity = 1,
983 .enable_current_mirror = 1,
Olivier Grenie970d14c2010-09-07 12:50:46 -0300984 .disable_sample_and_hold = 0,
Olivier Grenie90e12ce2010-09-07 12:50:45 -0300985};
986
987static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap)
988{
989 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
990 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
991 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
992 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
993 else
994 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
995 msleep(10);
996 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
997 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
998 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
999 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1000
1001 dib0700_ctrl_clock(adap->dev, 72, 1);
1002
1003 msleep(10);
1004 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1005 msleep(10);
1006 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1007
1008 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1009 &dib7770p_dib7000p_config) != 0) {
1010 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
1011 __func__);
1012 return -ENODEV;
1013 }
1014
Michael Krufky77eed212011-09-06 09:31:57 -03001015 adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
Olivier Grenie90e12ce2010-09-07 12:50:45 -03001016 &dib7770p_dib7000p_config);
Michael Krufky77eed212011-09-06 09:31:57 -03001017 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Olivier Grenie90e12ce2010-09-07 12:50:45 -03001018}
1019
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001020/* DIB807x generic */
1021static struct dibx000_agc_config dib807x_agc_config[2] = {
1022 {
1023 BAND_VHF,
1024 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1025 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1026 * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,
1027 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1028 * P_agc_write=0 */
1029 (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |
1030 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1031 (0 << 0), /* setup*/
1032
1033 600, /* inv_gain*/
1034 10, /* time_stabiliz*/
1035
1036 0, /* alpha_level*/
1037 118, /* thlock*/
1038
1039 0, /* wbd_inv*/
1040 3530, /* wbd_ref*/
1041 1, /* wbd_sel*/
1042 5, /* wbd_alpha*/
1043
1044 65535, /* agc1_max*/
1045 0, /* agc1_min*/
1046
1047 65535, /* agc2_max*/
1048 0, /* agc2_min*/
1049
1050 0, /* agc1_pt1*/
1051 40, /* agc1_pt2*/
1052 183, /* agc1_pt3*/
1053 206, /* agc1_slope1*/
1054 255, /* agc1_slope2*/
1055 72, /* agc2_pt1*/
1056 152, /* agc2_pt2*/
1057 88, /* agc2_slope1*/
1058 90, /* agc2_slope2*/
1059
1060 17, /* alpha_mant*/
1061 27, /* alpha_exp*/
1062 23, /* beta_mant*/
1063 51, /* beta_exp*/
1064
1065 0, /* perform_agc_softsplit*/
1066 }, {
1067 BAND_UHF,
1068 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1069 * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1070 * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1071 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1072 * P_agc_write=0 */
1073 (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |
1074 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |
1075 (0 << 0), /* setup */
1076
1077 600, /* inv_gain*/
1078 10, /* time_stabiliz*/
1079
1080 0, /* alpha_level*/
1081 118, /* thlock*/
1082
1083 0, /* wbd_inv*/
1084 3530, /* wbd_ref*/
1085 1, /* wbd_sel*/
1086 5, /* wbd_alpha*/
1087
1088 65535, /* agc1_max*/
1089 0, /* agc1_min*/
1090
1091 65535, /* agc2_max*/
1092 0, /* agc2_min*/
1093
1094 0, /* agc1_pt1*/
1095 40, /* agc1_pt2*/
1096 183, /* agc1_pt3*/
1097 206, /* agc1_slope1*/
1098 255, /* agc1_slope2*/
1099 72, /* agc2_pt1*/
1100 152, /* agc2_pt2*/
1101 88, /* agc2_slope1*/
1102 90, /* agc2_slope2*/
1103
1104 17, /* alpha_mant*/
1105 27, /* alpha_exp*/
1106 23, /* beta_mant*/
1107 51, /* beta_exp*/
1108
1109 0, /* perform_agc_softsplit*/
1110 }
1111};
1112
1113static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {
1114 60000, 15000, /* internal, sampling*/
1115 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/
1116 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,
1117 ADClkSrc, modulo */
1118 (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/
1119 (0 << 25) | 0, /* ifreq = 0.000000 MHz*/
1120 18179755, /* timf*/
1121 12000000, /* xtal_hz*/
1122};
1123
1124static struct dib8000_config dib807x_dib8000_config[2] = {
1125 {
1126 .output_mpeg2_in_188_bytes = 1,
1127
1128 .agc_config_count = 2,
1129 .agc = dib807x_agc_config,
1130 .pll = &dib807x_bw_config_12_mhz,
1131 .tuner_is_baseband = 1,
1132
1133 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1134 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1135 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1136
1137 .hostbus_diversity = 1,
1138 .div_cfg = 1,
1139 .agc_control = &dib0070_ctrl_agc_filter,
1140 .output_mode = OUTMODE_MPEG2_FIFO,
1141 .drives = 0x2d98,
1142 }, {
1143 .output_mpeg2_in_188_bytes = 1,
1144
1145 .agc_config_count = 2,
1146 .agc = dib807x_agc_config,
1147 .pll = &dib807x_bw_config_12_mhz,
1148 .tuner_is_baseband = 1,
1149
1150 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1151 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1152 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1153
1154 .hostbus_diversity = 1,
1155 .agc_control = &dib0070_ctrl_agc_filter,
1156 .output_mode = OUTMODE_MPEG2_FIFO,
1157 .drives = 0x2d98,
1158 }
1159};
1160
Olivier Grenie03245a52009-12-04 13:27:57 -03001161static int dib80xx_tuner_reset(struct dvb_frontend *fe, int onoff)
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001162{
1163 return dib8000_set_gpio(fe, 5, 0, !onoff);
1164}
1165
Olivier Grenie03245a52009-12-04 13:27:57 -03001166static int dib80xx_tuner_sleep(struct dvb_frontend *fe, int onoff)
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001167{
1168 return dib8000_set_gpio(fe, 0, 0, onoff);
1169}
1170
1171static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {
1172 { 240, 7},
1173 { 0xffff, 6},
1174};
1175
1176static struct dib0070_config dib807x_dib0070_config[2] = {
1177 {
1178 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
Olivier Grenie03245a52009-12-04 13:27:57 -03001179 .reset = dib80xx_tuner_reset,
1180 .sleep = dib80xx_tuner_sleep,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001181 .clock_khz = 12000,
1182 .clock_pad_drive = 4,
1183 .vga_filter = 1,
1184 .force_crystal_mode = 1,
1185 .enable_third_order_filter = 1,
1186 .charge_pump = 0,
1187 .wbd_gain = dib8070_wbd_gain_cfg,
1188 .osc_buffer_state = 0,
1189 .freq_offset_khz_uhf = -100,
1190 .freq_offset_khz_vhf = -100,
1191 }, {
1192 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
Olivier Grenie03245a52009-12-04 13:27:57 -03001193 .reset = dib80xx_tuner_reset,
1194 .sleep = dib80xx_tuner_sleep,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001195 .clock_khz = 12000,
1196 .clock_pad_drive = 2,
1197 .vga_filter = 1,
1198 .force_crystal_mode = 1,
1199 .enable_third_order_filter = 1,
1200 .charge_pump = 0,
1201 .wbd_gain = dib8070_wbd_gain_cfg,
1202 .osc_buffer_state = 0,
1203 .freq_offset_khz_uhf = -25,
1204 .freq_offset_khz_vhf = -25,
1205 }
1206};
1207
1208static int dib807x_set_param_override(struct dvb_frontend *fe,
1209 struct dvb_frontend_parameters *fep)
1210{
1211 struct dvb_usb_adapter *adap = fe->dvb->priv;
1212 struct dib0700_adapter_state *state = adap->priv;
1213
1214 u16 offset = dib0070_wbd_offset(fe);
1215 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1216 switch (band) {
1217 case BAND_VHF:
1218 offset += 750;
1219 break;
1220 case BAND_UHF: /* fall-thru wanted */
1221 default:
1222 offset += 250; break;
1223 }
1224 deb_info("WBD for DiB8000: %d\n", offset);
1225 dib8000_set_wbd_ref(fe, offset);
1226
1227 return state->set_param_save(fe, fep);
1228}
1229
1230static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)
1231{
1232 struct dib0700_adapter_state *st = adap->priv;
Michael Krufky77eed212011-09-06 09:31:57 -03001233 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe_adap[0].fe,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001234 DIBX000_I2C_INTERFACE_TUNER, 1);
1235
1236 if (adap->id == 0) {
Michael Krufky77eed212011-09-06 09:31:57 -03001237 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001238 &dib807x_dib0070_config[0]) == NULL)
1239 return -ENODEV;
1240 } else {
Michael Krufky77eed212011-09-06 09:31:57 -03001241 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001242 &dib807x_dib0070_config[1]) == NULL)
1243 return -ENODEV;
1244 }
1245
Michael Krufky77eed212011-09-06 09:31:57 -03001246 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1247 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib807x_set_param_override;
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001248 return 0;
1249}
1250
Olivier Grenie9c783032009-12-07 07:49:40 -03001251static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index,
1252 u16 pid, int onoff)
Olivier Grenief8731f42009-09-18 04:08:43 -03001253{
Michael Krufky77eed212011-09-06 09:31:57 -03001254 return dib8000_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
Olivier Grenief8731f42009-09-18 04:08:43 -03001255}
1256
Olivier Grenie9c783032009-12-07 07:49:40 -03001257static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter,
Olivier Greniebe9bae12011-01-04 05:42:19 -03001258 int onoff)
Olivier Grenief8731f42009-09-18 04:08:43 -03001259{
Michael Krufky77eed212011-09-06 09:31:57 -03001260 return dib8000_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
Olivier Grenief8731f42009-09-18 04:08:43 -03001261}
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001262
1263/* STK807x */
1264static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)
1265{
1266 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1267 msleep(10);
1268 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1269 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1270 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1271
1272 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1273
1274 dib0700_ctrl_clock(adap->dev, 72, 1);
1275
1276 msleep(10);
1277 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1278 msleep(10);
1279 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1280
1281 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
Olivier Grenie0c32dbd2011-08-10 05:17:18 -03001282 0x80, 0);
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001283
Michael Krufky77eed212011-09-06 09:31:57 -03001284 adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001285 &dib807x_dib8000_config[0]);
1286
Michael Krufky77eed212011-09-06 09:31:57 -03001287 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001288}
1289
1290/* STK807xPVR */
1291static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)
1292{
1293 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
1294 msleep(30);
1295 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1296 msleep(500);
1297 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1298 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1299 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1300
1301 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1302
1303 dib0700_ctrl_clock(adap->dev, 72, 1);
1304
1305 msleep(10);
1306 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1307 msleep(10);
1308 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1309
1310 /* initialize IC 0 */
Olivier Grenie0c32dbd2011-08-10 05:17:18 -03001311 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80, 0);
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001312
Michael Krufky77eed212011-09-06 09:31:57 -03001313 adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001314 &dib807x_dib8000_config[0]);
1315
Michael Krufky77eed212011-09-06 09:31:57 -03001316 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001317}
1318
1319static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)
1320{
1321 /* initialize IC 1 */
Olivier Grenie0c32dbd2011-08-10 05:17:18 -03001322 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82, 0);
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001323
Michael Krufky77eed212011-09-06 09:31:57 -03001324 adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001325 &dib807x_dib8000_config[1]);
1326
Michael Krufky77eed212011-09-06 09:31:57 -03001327 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001328}
1329
Olivier Grenie03245a52009-12-04 13:27:57 -03001330/* STK8096GP */
Olivier Greniea685dbb2011-08-05 14:10:40 -03001331static struct dibx000_agc_config dib8090_agc_config[2] = {
Olivier Greniebe9bae12011-01-04 05:42:19 -03001332 {
Olivier Grenie03245a52009-12-04 13:27:57 -03001333 BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
Olivier Grenie9c783032009-12-07 07:49:40 -03001334 /* 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 -03001335 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1336 * 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 -03001337 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1338 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
Olivier Grenie03245a52009-12-04 13:27:57 -03001339
Olivier Grenie9c783032009-12-07 07:49:40 -03001340 787,
1341 10,
Olivier Grenie03245a52009-12-04 13:27:57 -03001342
Olivier Grenie9c783032009-12-07 07:49:40 -03001343 0,
1344 118,
Olivier Grenie03245a52009-12-04 13:27:57 -03001345
Olivier Grenie9c783032009-12-07 07:49:40 -03001346 0,
1347 3530,
1348 1,
1349 5,
Olivier Grenie03245a52009-12-04 13:27:57 -03001350
Olivier Grenie9c783032009-12-07 07:49:40 -03001351 65535,
1352 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001353
Olivier Grenie9c783032009-12-07 07:49:40 -03001354 65535,
1355 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001356
Olivier Grenie9c783032009-12-07 07:49:40 -03001357 0,
1358 32,
1359 114,
1360 143,
1361 144,
1362 114,
1363 227,
1364 116,
1365 117,
Olivier Grenie03245a52009-12-04 13:27:57 -03001366
Olivier Grenie9c783032009-12-07 07:49:40 -03001367 28,
1368 26,
1369 31,
1370 51,
Olivier Grenie03245a52009-12-04 13:27:57 -03001371
Olivier Grenie9c783032009-12-07 07:49:40 -03001372 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03001373 },
1374 {
Olivier Grenie03245a52009-12-04 13:27:57 -03001375 BAND_CBAND,
Olivier Grenie9c783032009-12-07 07:49:40 -03001376 /* 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 -03001377 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1378 * 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 -03001379 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)
1380 | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
Olivier Grenie03245a52009-12-04 13:27:57 -03001381
Olivier Grenie9c783032009-12-07 07:49:40 -03001382 787,
1383 10,
Olivier Grenie03245a52009-12-04 13:27:57 -03001384
Olivier Grenie9c783032009-12-07 07:49:40 -03001385 0,
1386 118,
Olivier Grenie03245a52009-12-04 13:27:57 -03001387
Olivier Grenie9c783032009-12-07 07:49:40 -03001388 0,
1389 3530,
1390 1,
1391 5,
Olivier Grenie03245a52009-12-04 13:27:57 -03001392
Olivier Grenie9c783032009-12-07 07:49:40 -03001393 0,
1394 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001395
Olivier Grenie9c783032009-12-07 07:49:40 -03001396 65535,
1397 0,
Olivier Grenie03245a52009-12-04 13:27:57 -03001398
Olivier Grenie9c783032009-12-07 07:49:40 -03001399 0,
1400 32,
1401 114,
1402 143,
1403 144,
1404 114,
1405 227,
1406 116,
1407 117,
Olivier Grenie03245a52009-12-04 13:27:57 -03001408
Olivier Grenie9c783032009-12-07 07:49:40 -03001409 28,
1410 26,
1411 31,
1412 51,
Olivier Grenie03245a52009-12-04 13:27:57 -03001413
Olivier Grenie9c783032009-12-07 07:49:40 -03001414 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03001415 }
Olivier Grenie03245a52009-12-04 13:27:57 -03001416};
1417
1418static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = {
Olivier Greniebe9bae12011-01-04 05:42:19 -03001419 54000, 13500,
1420 1, 18, 3, 1, 0,
1421 0, 0, 1, 1, 2,
1422 (3 << 14) | (1 << 12) | (599 << 0),
1423 (0 << 25) | 0,
1424 20199727,
1425 12000000,
Olivier Grenie03245a52009-12-04 13:27:57 -03001426};
1427
1428static int dib8090_get_adc_power(struct dvb_frontend *fe)
1429{
Olivier Greniebe9bae12011-01-04 05:42:19 -03001430 return dib8000_get_adc_power(fe, 1);
Olivier Grenie03245a52009-12-04 13:27:57 -03001431}
1432
Olivier Greniebe9bae12011-01-04 05:42:19 -03001433static struct dib8000_config dib809x_dib8000_config[2] = {
1434 {
1435 .output_mpeg2_in_188_bytes = 1,
Olivier Grenie03245a52009-12-04 13:27:57 -03001436
Olivier Greniebe9bae12011-01-04 05:42:19 -03001437 .agc_config_count = 2,
1438 .agc = dib8090_agc_config,
1439 .agc_control = dib0090_dcc_freq,
1440 .pll = &dib8090_pll_config_12mhz,
1441 .tuner_is_baseband = 1,
Olivier Grenie03245a52009-12-04 13:27:57 -03001442
Olivier Greniebe9bae12011-01-04 05:42:19 -03001443 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1444 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1445 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
Olivier Grenie03245a52009-12-04 13:27:57 -03001446
Olivier Greniebe9bae12011-01-04 05:42:19 -03001447 .hostbus_diversity = 1,
1448 .div_cfg = 0x31,
1449 .output_mode = OUTMODE_MPEG2_FIFO,
1450 .drives = 0x2d98,
1451 .diversity_delay = 48,
1452 .refclksel = 3,
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001453 }, {
Olivier Greniebe9bae12011-01-04 05:42:19 -03001454 .output_mpeg2_in_188_bytes = 1,
1455
1456 .agc_config_count = 2,
1457 .agc = dib8090_agc_config,
1458 .agc_control = dib0090_dcc_freq,
1459 .pll = &dib8090_pll_config_12mhz,
1460 .tuner_is_baseband = 1,
1461
1462 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1463 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1464 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1465
1466 .hostbus_diversity = 1,
1467 .div_cfg = 0x31,
1468 .output_mode = OUTMODE_DIVERSITY,
1469 .drives = 0x2d08,
1470 .diversity_delay = 1,
1471 .refclksel = 3,
1472 }
1473};
1474
1475static struct dib0090_wbd_slope dib8090_wbd_table[] = {
1476 /* max freq ; cold slope ; cold offset ; warm slope ; warm offset ; wbd gain */
1477 { 120, 0, 500, 0, 500, 4 }, /* CBAND */
1478 { 170, 0, 450, 0, 450, 4 }, /* CBAND */
1479 { 380, 48, 373, 28, 259, 6 }, /* VHF */
1480 { 860, 34, 700, 36, 616, 6 }, /* high UHF */
1481 { 0xFFFF, 34, 700, 36, 616, 6 }, /* default */
Olivier Grenie03245a52009-12-04 13:27:57 -03001482};
1483
1484static struct dib0090_config dib809x_dib0090_config = {
Olivier Greniebe9bae12011-01-04 05:42:19 -03001485 .io.pll_bypass = 1,
1486 .io.pll_range = 1,
1487 .io.pll_prediv = 1,
1488 .io.pll_loopdiv = 20,
1489 .io.adc_clock_ratio = 8,
1490 .io.pll_int_loop_filt = 0,
1491 .io.clock_khz = 12000,
1492 .reset = dib80xx_tuner_reset,
1493 .sleep = dib80xx_tuner_sleep,
1494 .clkouttobamse = 1,
1495 .analog_output = 1,
1496 .i2c_address = DEFAULT_DIB0090_I2C_ADDRESS,
1497 .use_pwm_agc = 1,
1498 .clkoutdrive = 1,
1499 .get_adc_power = dib8090_get_adc_power,
1500 .freq_offset_khz_uhf = -63,
Olivier Grenie03245a52009-12-04 13:27:57 -03001501 .freq_offset_khz_vhf = -143,
Olivier Greniebe9bae12011-01-04 05:42:19 -03001502 .wbd = dib8090_wbd_table,
1503 .fref_clock_ratio = 6,
Olivier Grenie03245a52009-12-04 13:27:57 -03001504};
1505
1506static int dib8096_set_param_override(struct dvb_frontend *fe,
1507 struct dvb_frontend_parameters *fep)
1508{
Olivier Greniebe9bae12011-01-04 05:42:19 -03001509 struct dvb_usb_adapter *adap = fe->dvb->priv;
1510 struct dib0700_adapter_state *state = adap->priv;
1511 u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);
1512 u16 target;
1513 int ret = 0;
1514 enum frontend_tune_state tune_state = CT_SHUTDOWN;
1515 u16 ltgain, rf_gain_limit;
Olivier Grenie03245a52009-12-04 13:27:57 -03001516
Olivier Greniebe9bae12011-01-04 05:42:19 -03001517 ret = state->set_param_save(fe, fep);
1518 if (ret < 0)
1519 return ret;
Olivier Grenie03245a52009-12-04 13:27:57 -03001520
Olivier Grenie6724a2f2011-08-05 13:49:33 -03001521 target = (dib0090_get_wbd_target(fe) * 8 * 18 / 33 + 1) / 2;
Olivier Greniebe9bae12011-01-04 05:42:19 -03001522 dib8000_set_wbd_ref(fe, target);
Olivier Grenie03245a52009-12-04 13:27:57 -03001523
1524
Olivier Greniebe9bae12011-01-04 05:42:19 -03001525 if (band == BAND_CBAND) {
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001526 deb_info("tuning in CBAND - soft-AGC startup\n");
1527 dib0090_set_tune_state(fe, CT_AGC_START);
1528 do {
1529 ret = dib0090_gain_control(fe);
1530 msleep(ret);
1531 tune_state = dib0090_get_tune_state(fe);
1532 if (tune_state == CT_AGC_STEP_0)
1533 dib8000_set_gpio(fe, 6, 0, 1);
1534 else if (tune_state == CT_AGC_STEP_1) {
1535 dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, &ltgain);
1536 if (rf_gain_limit == 0)
1537 dib8000_set_gpio(fe, 6, 0, 0);
1538 }
1539 } while (tune_state < CT_AGC_STOP);
1540 dib0090_pwm_gain_reset(fe);
1541 dib8000_pwm_agc_reset(fe);
1542 dib8000_set_tune_state(fe, CT_DEMOD_START);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001543 } else {
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001544 deb_info("not tuning in CBAND - standard AGC startup\n");
1545 dib0090_pwm_gain_reset(fe);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001546 }
Olivier Grenie03245a52009-12-04 13:27:57 -03001547
Olivier Greniebe9bae12011-01-04 05:42:19 -03001548 return 0;
Olivier Grenie03245a52009-12-04 13:27:57 -03001549}
1550
1551static int dib809x_tuner_attach(struct dvb_usb_adapter *adap)
1552{
Olivier Greniebe9bae12011-01-04 05:42:19 -03001553 struct dib0700_adapter_state *st = adap->priv;
Michael Krufky77eed212011-09-06 09:31:57 -03001554 struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
Olivier Grenie03245a52009-12-04 13:27:57 -03001555
Michael Krufky77eed212011-09-06 09:31:57 -03001556 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL)
Olivier Greniebe9bae12011-01-04 05:42:19 -03001557 return -ENODEV;
Olivier Grenie03245a52009-12-04 13:27:57 -03001558
Michael Krufky77eed212011-09-06 09:31:57 -03001559 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1560 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override;
Olivier Greniebe9bae12011-01-04 05:42:19 -03001561 return 0;
Olivier Grenie03245a52009-12-04 13:27:57 -03001562}
1563
1564static int stk809x_frontend_attach(struct dvb_usb_adapter *adap)
1565{
1566 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1567 msleep(10);
1568 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1569 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1570 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1571
1572 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1573
1574 dib0700_ctrl_clock(adap->dev, 72, 1);
1575
1576 msleep(10);
1577 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1578 msleep(10);
1579 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1580
Olivier Grenie0c32dbd2011-08-10 05:17:18 -03001581 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80, 0);
Olivier Grenie03245a52009-12-04 13:27:57 -03001582
Michael Krufky77eed212011-09-06 09:31:57 -03001583 adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
Olivier Grenie03245a52009-12-04 13:27:57 -03001584
Michael Krufky77eed212011-09-06 09:31:57 -03001585 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Olivier Grenie03245a52009-12-04 13:27:57 -03001586}
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03001587
Olivier Greniebe9bae12011-01-04 05:42:19 -03001588static int nim8096md_tuner_attach(struct dvb_usb_adapter *adap)
1589{
1590 struct dib0700_adapter_state *st = adap->priv;
1591 struct i2c_adapter *tun_i2c;
Michael Krufky77eed212011-09-06 09:31:57 -03001592 struct dvb_frontend *fe_slave = dib8000_get_slave_frontend(adap->fe_adap[0].fe, 1);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001593
1594 if (fe_slave) {
1595 tun_i2c = dib8000_get_i2c_master(fe_slave, DIBX000_I2C_INTERFACE_TUNER, 1);
1596 if (dvb_attach(dib0090_register, fe_slave, tun_i2c, &dib809x_dib0090_config) == NULL)
1597 return -ENODEV;
Michael Krufky77eed212011-09-06 09:31:57 -03001598 fe_slave->dvb = adap->fe_adap[0].fe->dvb;
Olivier Greniebe9bae12011-01-04 05:42:19 -03001599 fe_slave->ops.tuner_ops.set_params = dib8096_set_param_override;
1600 }
Michael Krufky77eed212011-09-06 09:31:57 -03001601 tun_i2c = dib8000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1);
1602 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL)
Olivier Greniebe9bae12011-01-04 05:42:19 -03001603 return -ENODEV;
1604
Michael Krufky77eed212011-09-06 09:31:57 -03001605 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1606 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override;
Olivier Greniebe9bae12011-01-04 05:42:19 -03001607
1608 return 0;
1609}
1610
1611static int nim8096md_frontend_attach(struct dvb_usb_adapter *adap)
1612{
1613 struct dvb_frontend *fe_slave;
1614
1615 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001616 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001617 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1618 msleep(1000);
1619 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1620 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1621 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1622
1623 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1624
1625 dib0700_ctrl_clock(adap->dev, 72, 1);
1626
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001627 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001628 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001629 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001630 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1631
Olivier Grenie0c32dbd2011-08-10 05:17:18 -03001632 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, 0x80, 0);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001633
Michael Krufky77eed212011-09-06 09:31:57 -03001634 adap->fe_adap[0].fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);
1635 if (adap->fe_adap[0].fe == NULL)
Olivier Greniebe9bae12011-01-04 05:42:19 -03001636 return -ENODEV;
1637
1638 fe_slave = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82, &dib809x_dib8000_config[1]);
Michael Krufky77eed212011-09-06 09:31:57 -03001639 dib8000_set_slave_frontend(adap->fe_adap[0].fe, fe_slave);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001640
1641 return fe_slave == NULL ? -ENODEV : 0;
1642}
1643
Olivier Grenie88f3a352011-08-10 05:28:38 -03001644/* TFE8096P */
1645static struct dibx000_agc_config dib8096p_agc_config[2] = {
1646 {
1647 .band_caps = BAND_UHF,
1648 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1649 P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1650 P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1651 P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1652 P_agc_write=0 */
1653 .setup = (0 << 15) | (0 << 14) | (5 << 11)
1654 | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5)
1655 | (0 << 4) | (5 << 1) | (0 << 0),
1656
1657 .inv_gain = 684,
1658 .time_stabiliz = 10,
1659
1660 .alpha_level = 0,
1661 .thlock = 118,
1662
1663 .wbd_inv = 0,
1664 .wbd_ref = 1200,
1665 .wbd_sel = 3,
1666 .wbd_alpha = 5,
1667
1668 .agc1_max = 65535,
1669 .agc1_min = 0,
1670
1671 .agc2_max = 32767,
1672 .agc2_min = 0,
1673
1674 .agc1_pt1 = 0,
1675 .agc1_pt2 = 0,
1676 .agc1_pt3 = 105,
1677 .agc1_slope1 = 0,
1678 .agc1_slope2 = 156,
1679 .agc2_pt1 = 105,
1680 .agc2_pt2 = 255,
1681 .agc2_slope1 = 54,
1682 .agc2_slope2 = 0,
1683
1684 .alpha_mant = 28,
1685 .alpha_exp = 26,
1686 .beta_mant = 31,
1687 .beta_exp = 51,
1688
1689 .perform_agc_softsplit = 0,
1690 } , {
1691 .band_caps = BAND_FM | BAND_VHF | BAND_CBAND,
1692 /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,
1693 P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,
1694 P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1695 P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,
1696 P_agc_write=0 */
1697 .setup = (0 << 15) | (0 << 14) | (5 << 11)
1698 | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5)
1699 | (0 << 4) | (5 << 1) | (0 << 0),
1700
1701 .inv_gain = 732,
1702 .time_stabiliz = 10,
1703
1704 .alpha_level = 0,
1705 .thlock = 118,
1706
1707 .wbd_inv = 0,
1708 .wbd_ref = 1200,
1709 .wbd_sel = 3,
1710 .wbd_alpha = 5,
1711
1712 .agc1_max = 65535,
1713 .agc1_min = 0,
1714
1715 .agc2_max = 32767,
1716 .agc2_min = 0,
1717
1718 .agc1_pt1 = 0,
1719 .agc1_pt2 = 0,
1720 .agc1_pt3 = 98,
1721 .agc1_slope1 = 0,
1722 .agc1_slope2 = 167,
1723 .agc2_pt1 = 98,
1724 .agc2_pt2 = 255,
1725 .agc2_slope1 = 52,
1726 .agc2_slope2 = 0,
1727
1728 .alpha_mant = 28,
1729 .alpha_exp = 26,
1730 .beta_mant = 31,
1731 .beta_exp = 51,
1732
1733 .perform_agc_softsplit = 0,
1734 }
1735};
1736
1737static struct dibx000_bandwidth_config dib8096p_clock_config_12_mhz = {
1738 108000, 13500,
1739 1, 9, 1, 0, 0,
1740 0, 0, 0, 0, 2,
1741 (3 << 14) | (1 << 12) | (524 << 0),
1742 (0 << 25) | 0,
1743 20199729,
1744 12000000,
1745};
1746
1747static struct dib8000_config tfe8096p_dib8000_config = {
1748 .output_mpeg2_in_188_bytes = 1,
1749 .hostbus_diversity = 1,
1750 .update_lna = NULL,
1751
1752 .agc_config_count = 2,
1753 .agc = dib8096p_agc_config,
1754 .pll = &dib8096p_clock_config_12_mhz,
1755
1756 .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,
1757 .gpio_val = DIB8000_GPIO_DEFAULT_VALUES,
1758 .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,
1759
1760 .agc_control = NULL,
1761 .diversity_delay = 48,
1762 .output_mode = OUTMODE_MPEG2_FIFO,
1763 .enMpegOutput = 1,
1764};
1765
1766static struct dib0090_wbd_slope dib8096p_wbd_table[] = {
1767 { 380, 81, 850, 64, 540, 4},
1768 { 860, 51, 866, 21, 375, 4},
1769 {1700, 0, 250, 0, 100, 6},
1770 {2600, 0, 250, 0, 100, 6},
1771 { 0xFFFF, 0, 0, 0, 0, 0},
1772};
1773
1774static const struct dib0090_config tfe8096p_dib0090_config = {
1775 .io.clock_khz = 12000,
1776 .io.pll_bypass = 0,
1777 .io.pll_range = 0,
1778 .io.pll_prediv = 3,
1779 .io.pll_loopdiv = 6,
1780 .io.adc_clock_ratio = 0,
1781 .io.pll_int_loop_filt = 0,
1782 .reset = dib8096p_tuner_sleep,
1783 .sleep = dib8096p_tuner_sleep,
1784
1785 .freq_offset_khz_uhf = -143,
1786 .freq_offset_khz_vhf = -143,
1787
1788 .get_adc_power = dib8090_get_adc_power,
1789
1790 .clkouttobamse = 1,
1791 .analog_output = 0,
1792
1793 .wbd_vhf_offset = 0,
1794 .wbd_cband_offset = 0,
1795 .use_pwm_agc = 1,
1796 .clkoutdrive = 0,
1797
1798 .fref_clock_ratio = 1,
1799
1800 .wbd = dib8096p_wbd_table,
1801
1802 .ls_cfg_pad_drv = 0,
1803 .data_tx_drv = 0,
1804 .low_if = NULL,
1805 .in_soc = 1,
1806 .force_cband_input = 0,
1807};
1808
1809struct dibx090p_adc {
1810 u32 freq; /* RF freq MHz */
1811 u32 timf; /* New Timf */
1812 u32 pll_loopdiv; /* New prediv */
1813 u32 pll_prediv; /* New loopdiv */
1814};
1815
1816struct dibx090p_adc dib8090p_adc_tab[] = {
1817 { 50000, 17043521, 16, 3}, /* 64 MHz */
1818 {878000, 20199729, 9, 1}, /* 60 MHz */
1819 {0xffffffff, 0, 0, 0}, /* 60 MHz */
1820};
1821
1822static int dib8096p_agc_startup(struct dvb_frontend *fe,
1823 struct dvb_frontend_parameters *fep)
1824{
1825 struct dvb_usb_adapter *adap = fe->dvb->priv;
1826 struct dib0700_adapter_state *state = adap->priv;
1827 struct dibx000_bandwidth_config pll;
1828 u16 target;
1829 int better_sampling_freq = 0, ret;
1830 struct dibx090p_adc *adc_table = &dib8090p_adc_tab[0];
1831
1832 ret = state->set_param_save(fe, fep);
1833 if (ret < 0)
1834 return ret;
1835 memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));
1836
1837 dib0090_pwm_gain_reset(fe);
1838 /* dib0090_get_wbd_target is returning any possible
1839 temperature compensated wbd-target */
1840 target = (dib0090_get_wbd_target(fe) * 8 + 1) / 2;
1841 dib8000_set_wbd_ref(fe, target);
1842
1843
1844 while (fep->frequency / 1000 > adc_table->freq) {
1845 better_sampling_freq = 1;
1846 adc_table++;
1847 }
1848
1849 if ((adc_table->freq != 0xffffffff) && better_sampling_freq) {
1850 pll.pll_ratio = adc_table->pll_loopdiv;
1851 pll.pll_prediv = adc_table->pll_prediv;
1852 dib8000_update_pll(fe, &pll);
1853 dib8000_ctrl_timf(fe, DEMOD_TIMF_SET, adc_table->timf);
1854 }
1855 return 0;
1856}
1857
1858static int tfe8096p_frontend_attach(struct dvb_usb_adapter *adap)
1859{
1860 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
1861 msleep(20);
1862 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1863 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
1864 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
1865
1866 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
1867
1868 dib0700_ctrl_clock(adap->dev, 72, 1);
1869
1870 msleep(20);
1871 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
1872 msleep(20);
1873 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
1874
1875 dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80, 1);
1876
1877 adap->fe_adap[0].fe = dvb_attach(dib8000_attach,
1878 &adap->dev->i2c_adap, 0x80, &tfe8096p_dib8000_config);
1879
1880 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
1881}
1882
1883static int tfe8096p_tuner_attach(struct dvb_usb_adapter *adap)
1884{
1885 struct dib0700_adapter_state *st = adap->priv;
1886 struct i2c_adapter *tun_i2c = dib8096p_get_i2c_tuner(adap->fe_adap[0].fe);
1887
1888 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c,
1889 &tfe8096p_dib0090_config) == NULL)
1890 return -ENODEV;
1891
1892 dib8000_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
1893
1894 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1895 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096p_agc_startup;
1896 return 0;
1897}
1898
Olivier Greniebe9bae12011-01-04 05:42:19 -03001899/* STK9090M */
1900static int dib90x0_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)
1901{
Michael Krufky77eed212011-09-06 09:31:57 -03001902 return dib9000_fw_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001903}
1904
1905static int dib90x0_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)
1906{
Michael Krufky77eed212011-09-06 09:31:57 -03001907 return dib9000_fw_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff);
Olivier Greniebe9bae12011-01-04 05:42:19 -03001908}
1909
1910static int dib90x0_tuner_reset(struct dvb_frontend *fe, int onoff)
1911{
1912 return dib9000_set_gpio(fe, 5, 0, !onoff);
1913}
1914
1915static int dib90x0_tuner_sleep(struct dvb_frontend *fe, int onoff)
1916{
1917 return dib9000_set_gpio(fe, 0, 0, onoff);
1918}
1919
1920static int dib01x0_pmu_update(struct i2c_adapter *i2c, u16 *data, u8 len)
1921{
1922 u8 wb[4] = { 0xc >> 8, 0xc & 0xff, 0, 0 };
1923 u8 rb[2];
1924 struct i2c_msg msg[2] = {
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001925 {.addr = 0x1e >> 1, .flags = 0, .buf = wb, .len = 2},
1926 {.addr = 0x1e >> 1, .flags = I2C_M_RD, .buf = rb, .len = 2},
Olivier Greniebe9bae12011-01-04 05:42:19 -03001927 };
1928 u8 index_data;
1929
1930 dibx000_i2c_set_speed(i2c, 250);
1931
1932 if (i2c_transfer(i2c, msg, 2) != 2)
1933 return -EIO;
1934
1935 switch (rb[0] << 8 | rb[1]) {
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001936 case 0:
Olivier Greniebe9bae12011-01-04 05:42:19 -03001937 deb_info("Found DiB0170 rev1: This version of DiB0170 is not supported any longer.\n");
1938 return -EIO;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001939 case 1:
Olivier Greniebe9bae12011-01-04 05:42:19 -03001940 deb_info("Found DiB0170 rev2");
1941 break;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001942 case 2:
Olivier Greniebe9bae12011-01-04 05:42:19 -03001943 deb_info("Found DiB0190 rev2");
1944 break;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001945 default:
Olivier Greniebe9bae12011-01-04 05:42:19 -03001946 deb_info("DiB01x0 not found");
1947 return -EIO;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001948 }
Olivier Greniebe9bae12011-01-04 05:42:19 -03001949
1950 for (index_data = 0; index_data < len; index_data += 2) {
1951 wb[2] = (data[index_data + 1] >> 8) & 0xff;
1952 wb[3] = (data[index_data + 1]) & 0xff;
1953
1954 if (data[index_data] == 0) {
1955 wb[0] = (data[index_data] >> 8) & 0xff;
1956 wb[1] = (data[index_data]) & 0xff;
1957 msg[0].len = 2;
1958 if (i2c_transfer(i2c, msg, 2) != 2)
1959 return -EIO;
1960 wb[2] |= rb[0];
1961 wb[3] |= rb[1] & ~(3 << 4);
1962 }
1963
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03001964 wb[0] = (data[index_data] >> 8)&0xff;
1965 wb[1] = (data[index_data])&0xff;
Olivier Greniebe9bae12011-01-04 05:42:19 -03001966 msg[0].len = 4;
1967 if (i2c_transfer(i2c, &msg[0], 1) != 1)
1968 return -EIO;
1969 }
1970 return 0;
1971}
1972
1973static struct dib9000_config stk9090m_config = {
1974 .output_mpeg2_in_188_bytes = 1,
1975 .output_mode = OUTMODE_MPEG2_FIFO,
1976 .vcxo_timer = 279620,
1977 .timing_frequency = 20452225,
1978 .demod_clock_khz = 60000,
1979 .xtal_clock_khz = 30000,
1980 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
1981 .subband = {
1982 2,
1983 {
1984 { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0008 } }, /* GPIO 3 to 1 for VHF */
1985 { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0000 } }, /* GPIO 3 to 0 for UHF */
1986 { 0 },
1987 },
1988 },
1989 .gpio_function = {
1990 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
1991 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
1992 },
1993};
1994
1995static struct dib9000_config nim9090md_config[2] = {
1996 {
1997 .output_mpeg2_in_188_bytes = 1,
1998 .output_mode = OUTMODE_MPEG2_FIFO,
1999 .vcxo_timer = 279620,
2000 .timing_frequency = 20452225,
2001 .demod_clock_khz = 60000,
2002 .xtal_clock_khz = 30000,
2003 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
2004 }, {
2005 .output_mpeg2_in_188_bytes = 1,
2006 .output_mode = OUTMODE_DIVERSITY,
2007 .vcxo_timer = 279620,
2008 .timing_frequency = 20452225,
2009 .demod_clock_khz = 60000,
2010 .xtal_clock_khz = 30000,
2011 .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),
2012 .subband = {
2013 2,
2014 {
2015 { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0006 } }, /* GPIO 1 and 2 to 1 for VHF */
2016 { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0000 } }, /* GPIO 1 and 2 to 0 for UHF */
2017 { 0 },
2018 },
2019 },
2020 .gpio_function = {
2021 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },
2022 { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },
2023 },
2024 }
2025};
2026
2027static struct dib0090_config dib9090_dib0090_config = {
2028 .io.pll_bypass = 0,
2029 .io.pll_range = 1,
2030 .io.pll_prediv = 1,
2031 .io.pll_loopdiv = 8,
2032 .io.adc_clock_ratio = 8,
2033 .io.pll_int_loop_filt = 0,
2034 .io.clock_khz = 30000,
2035 .reset = dib90x0_tuner_reset,
2036 .sleep = dib90x0_tuner_sleep,
2037 .clkouttobamse = 0,
2038 .analog_output = 0,
2039 .use_pwm_agc = 0,
2040 .clkoutdrive = 0,
2041 .freq_offset_khz_uhf = 0,
2042 .freq_offset_khz_vhf = 0,
2043};
2044
2045static struct dib0090_config nim9090md_dib0090_config[2] = {
2046 {
2047 .io.pll_bypass = 0,
2048 .io.pll_range = 1,
2049 .io.pll_prediv = 1,
2050 .io.pll_loopdiv = 8,
2051 .io.adc_clock_ratio = 8,
2052 .io.pll_int_loop_filt = 0,
2053 .io.clock_khz = 30000,
2054 .reset = dib90x0_tuner_reset,
2055 .sleep = dib90x0_tuner_sleep,
2056 .clkouttobamse = 1,
2057 .analog_output = 0,
2058 .use_pwm_agc = 0,
2059 .clkoutdrive = 0,
2060 .freq_offset_khz_uhf = 0,
2061 .freq_offset_khz_vhf = 0,
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002062 }, {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002063 .io.pll_bypass = 0,
2064 .io.pll_range = 1,
2065 .io.pll_prediv = 1,
2066 .io.pll_loopdiv = 8,
2067 .io.adc_clock_ratio = 8,
2068 .io.pll_int_loop_filt = 0,
2069 .io.clock_khz = 30000,
2070 .reset = dib90x0_tuner_reset,
2071 .sleep = dib90x0_tuner_sleep,
2072 .clkouttobamse = 0,
2073 .analog_output = 0,
2074 .use_pwm_agc = 0,
2075 .clkoutdrive = 0,
2076 .freq_offset_khz_uhf = 0,
2077 .freq_offset_khz_vhf = 0,
2078 }
2079};
2080
2081
2082static int stk9090m_frontend_attach(struct dvb_usb_adapter *adap)
2083{
2084 struct dib0700_adapter_state *state = adap->priv;
2085 struct dib0700_state *st = adap->dev->priv;
2086 u32 fw_version;
2087
2088 /* Make use of the new i2c functions from FW 1.20 */
2089 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
2090 if (fw_version >= 0x10200)
2091 st->fw_use_new_i2c_api = 1;
2092 dib0700_set_i2c_speed(adap->dev, 340);
2093
2094 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002095 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002096 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2097 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2098 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2099 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2100
2101 dib0700_ctrl_clock(adap->dev, 72, 1);
2102
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002103 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002104 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002105 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002106 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2107
2108 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80);
2109
2110 if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {
2111 deb_info("%s: Upload failed. (file not found?)\n", __func__);
2112 return -ENODEV;
2113 } else {
2114 deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
2115 }
2116 stk9090m_config.microcode_B_fe_size = state->frontend_firmware->size;
2117 stk9090m_config.microcode_B_fe_buffer = state->frontend_firmware->data;
2118
Michael Krufky77eed212011-09-06 09:31:57 -03002119 adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &stk9090m_config);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002120
Michael Krufky77eed212011-09-06 09:31:57 -03002121 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Olivier Greniebe9bae12011-01-04 05:42:19 -03002122}
2123
2124static int dib9090_tuner_attach(struct dvb_usb_adapter *adap)
2125{
2126 struct dib0700_adapter_state *state = adap->priv;
Michael Krufky77eed212011-09-06 09:31:57 -03002127 struct i2c_adapter *i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002128 u16 data_dib190[10] = {
2129 1, 0x1374,
2130 2, 0x01a2,
2131 7, 0x0020,
2132 0, 0x00ef,
2133 8, 0x0486,
2134 };
2135
Michael Krufky77eed212011-09-06 09:31:57 -03002136 if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &dib9090_dib0090_config) == NULL)
Olivier Greniebe9bae12011-01-04 05:42:19 -03002137 return -ENODEV;
Michael Krufky77eed212011-09-06 09:31:57 -03002138 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002139 if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0)
2140 return -ENODEV;
2141 dib0700_set_i2c_speed(adap->dev, 2000);
Michael Krufky77eed212011-09-06 09:31:57 -03002142 if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0)
Olivier Greniebe9bae12011-01-04 05:42:19 -03002143 return -ENODEV;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002144 release_firmware(state->frontend_firmware);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002145 return 0;
2146}
2147
2148static int nim9090md_frontend_attach(struct dvb_usb_adapter *adap)
2149{
2150 struct dib0700_adapter_state *state = adap->priv;
2151 struct dib0700_state *st = adap->dev->priv;
2152 struct i2c_adapter *i2c;
2153 struct dvb_frontend *fe_slave;
2154 u32 fw_version;
2155
2156 /* Make use of the new i2c functions from FW 1.20 */
2157 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);
2158 if (fw_version >= 0x10200)
2159 st->fw_use_new_i2c_api = 1;
2160 dib0700_set_i2c_speed(adap->dev, 340);
2161
2162 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002163 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002164 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2165 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2166 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2167 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2168
2169 dib0700_ctrl_clock(adap->dev, 72, 1);
2170
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002171 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002172 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002173 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002174 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2175
2176 if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {
2177 deb_info("%s: Upload failed. (file not found?)\n", __func__);
2178 return -EIO;
2179 } else {
2180 deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);
2181 }
2182 nim9090md_config[0].microcode_B_fe_size = state->frontend_firmware->size;
2183 nim9090md_config[0].microcode_B_fe_buffer = state->frontend_firmware->data;
2184 nim9090md_config[1].microcode_B_fe_size = state->frontend_firmware->size;
2185 nim9090md_config[1].microcode_B_fe_buffer = state->frontend_firmware->data;
2186
2187 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, 0x80);
Michael Krufky77eed212011-09-06 09:31:57 -03002188 adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &nim9090md_config[0]);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002189
Michael Krufky77eed212011-09-06 09:31:57 -03002190 if (adap->fe_adap[0].fe == NULL)
Olivier Greniebe9bae12011-01-04 05:42:19 -03002191 return -ENODEV;
2192
Michael Krufky77eed212011-09-06 09:31:57 -03002193 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_3_4, 0);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002194 dib9000_i2c_enumeration(i2c, 1, 0x12, 0x82);
2195
2196 fe_slave = dvb_attach(dib9000_attach, i2c, 0x82, &nim9090md_config[1]);
Michael Krufky77eed212011-09-06 09:31:57 -03002197 dib9000_set_slave_frontend(adap->fe_adap[0].fe, fe_slave);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002198
2199 return fe_slave == NULL ? -ENODEV : 0;
2200}
2201
2202static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap)
2203{
2204 struct dib0700_adapter_state *state = adap->priv;
2205 struct i2c_adapter *i2c;
2206 struct dvb_frontend *fe_slave;
2207 u16 data_dib190[10] = {
2208 1, 0x5374,
2209 2, 0x01ae,
2210 7, 0x0020,
2211 0, 0x00ef,
2212 8, 0x0406,
2213 };
Michael Krufky77eed212011-09-06 09:31:57 -03002214 i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe);
2215 if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &nim9090md_dib0090_config[0]) == NULL)
Olivier Greniebe9bae12011-01-04 05:42:19 -03002216 return -ENODEV;
Michael Krufky77eed212011-09-06 09:31:57 -03002217 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002218 if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0)
2219 return -ENODEV;
2220 dib0700_set_i2c_speed(adap->dev, 2000);
Michael Krufky77eed212011-09-06 09:31:57 -03002221 if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0)
Olivier Greniebe9bae12011-01-04 05:42:19 -03002222 return -ENODEV;
2223
Michael Krufky77eed212011-09-06 09:31:57 -03002224 fe_slave = dib9000_get_slave_frontend(adap->fe_adap[0].fe, 1);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002225 if (fe_slave != NULL) {
Michael Krufky77eed212011-09-06 09:31:57 -03002226 i2c = dib9000_get_component_bus_interface(adap->fe_adap[0].fe);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002227 dib9000_set_i2c_adapter(fe_slave, i2c);
2228
2229 i2c = dib9000_get_tuner_interface(fe_slave);
2230 if (dvb_attach(dib0090_fw_register, fe_slave, i2c, &nim9090md_dib0090_config[1]) == NULL)
2231 return -ENODEV;
Michael Krufky77eed212011-09-06 09:31:57 -03002232 fe_slave->dvb = adap->fe_adap[0].fe->dvb;
2233 dib9000_fw_set_component_bus_speed(adap->fe_adap[0].fe, 2000);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002234 if (dib9000_firmware_post_pll_init(fe_slave) < 0)
2235 return -ENODEV;
2236 }
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002237 release_firmware(state->frontend_firmware);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002238
2239 return 0;
2240}
2241
2242/* NIM7090 */
2243struct dib7090p_best_adc {
2244 u32 timf;
2245 u32 pll_loopdiv;
2246 u32 pll_prediv;
2247};
2248
2249static int dib7090p_get_best_sampling(struct dvb_frontend *fe , struct dib7090p_best_adc *adc)
2250{
2251 u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1;
2252
2253 u16 xtal = 12000;
2254 u32 fcp_min = 1900; /* PLL Minimum Frequency comparator KHz */
2255 u32 fcp_max = 20000; /* PLL Maximum Frequency comparator KHz */
2256 u32 fdem_max = 76000;
2257 u32 fdem_min = 69500;
2258 u32 fcp = 0, fs = 0, fdem = 0;
2259 u32 harmonic_id = 0;
2260
2261 adc->pll_loopdiv = loopdiv;
2262 adc->pll_prediv = prediv;
2263 adc->timf = 0;
2264
2265 deb_info("bandwidth = %d fdem_min =%d", fe->dtv_property_cache.bandwidth_hz, fdem_min);
2266
2267 /* Find Min and Max prediv */
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002268 while ((xtal/max_prediv) >= fcp_min)
Olivier Greniebe9bae12011-01-04 05:42:19 -03002269 max_prediv++;
2270
2271 max_prediv--;
2272 min_prediv = max_prediv;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002273 while ((xtal/min_prediv) <= fcp_max) {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002274 min_prediv--;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002275 if (min_prediv == 1)
Olivier Greniebe9bae12011-01-04 05:42:19 -03002276 break;
2277 }
2278 deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv);
2279
2280 min_prediv = 2;
2281
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002282 for (prediv = min_prediv ; prediv < max_prediv; prediv++) {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002283 fcp = xtal / prediv;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002284 if (fcp > fcp_min && fcp < fcp_max) {
2285 for (loopdiv = 1 ; loopdiv < 64 ; loopdiv++) {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002286 fdem = ((xtal/prediv) * loopdiv);
2287 fs = fdem / 4;
2288 /* test min/max system restrictions */
2289
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002290 if ((fdem >= fdem_min) && (fdem <= fdem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz/1000)) {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002291 spur = 0;
2292 /* test fs harmonics positions */
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002293 for (harmonic_id = (fe->dtv_property_cache.frequency / (1000*fs)) ; harmonic_id <= ((fe->dtv_property_cache.frequency / (1000*fs))+1) ; harmonic_id++) {
2294 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 -03002295 spur = 1;
2296 break;
2297 }
2298 }
2299
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002300 if (!spur) {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002301 adc->pll_loopdiv = loopdiv;
2302 adc->pll_prediv = prediv;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002303 adc->timf = 2396745143UL/fdem*(1 << 9);
2304 adc->timf += ((2396745143UL%fdem) << 9)/fdem;
Olivier Greniebe9bae12011-01-04 05:42:19 -03002305 deb_info("loopdiv=%i prediv=%i timf=%i", loopdiv, prediv, adc->timf);
2306 break;
2307 }
2308 }
2309 }
2310 }
2311 if (!spur)
2312 break;
2313 }
2314
2315
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002316 if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0)
Olivier Greniebe9bae12011-01-04 05:42:19 -03002317 return -EINVAL;
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002318 else
Olivier Greniebe9bae12011-01-04 05:42:19 -03002319 return 0;
2320}
2321
2322static int dib7090_agc_startup(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
2323{
2324 struct dvb_usb_adapter *adap = fe->dvb->priv;
2325 struct dib0700_adapter_state *state = adap->priv;
2326 struct dibx000_bandwidth_config pll;
2327 u16 target;
2328 struct dib7090p_best_adc adc;
2329 int ret;
2330
2331 ret = state->set_param_save(fe, fep);
2332 if (ret < 0)
2333 return ret;
2334
2335 memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));
2336 dib0090_pwm_gain_reset(fe);
Olivier Grenie6724a2f2011-08-05 13:49:33 -03002337 target = (dib0090_get_wbd_target(fe) * 8 + 1) / 2;
Olivier Greniebe9bae12011-01-04 05:42:19 -03002338 dib7000p_set_wbd_ref(fe, target);
2339
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002340 if (dib7090p_get_best_sampling(fe, &adc) == 0) {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002341 pll.pll_ratio = adc.pll_loopdiv;
2342 pll.pll_prediv = adc.pll_prediv;
2343
2344 dib7000p_update_pll(fe, &pll);
2345 dib7000p_ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf);
2346 }
2347 return 0;
2348}
2349
Olivier Grenie2e802862011-08-05 10:39:15 -03002350static int dib7090_agc_restart(struct dvb_frontend *fe, u8 restart)
2351{
2352 deb_info("AGC restart callback: %d", restart);
2353 if (restart == 0) /* before AGC startup */
2354 dib0090_set_dc_servo(fe, 1);
2355 return 0;
2356}
2357
Olivier Grenie6724a2f2011-08-05 13:49:33 -03002358static int dib7090e_update_lna(struct dvb_frontend *fe, u16 agc_global)
2359{
2360 u16 agc1 = 0, agc2, wbd = 0, wbd_target, wbd_offset, threshold_agc1;
2361 s16 wbd_delta;
2362
2363 if ((fe->dtv_property_cache.frequency) < 400000000)
2364 threshold_agc1 = 25000;
2365 else
2366 threshold_agc1 = 30000;
2367
2368 wbd_target = (dib0090_get_wbd_target(fe)*8+1)/2;
2369 wbd_offset = dib0090_get_wbd_offset(fe);
2370 dib7000p_get_agc_values(fe, NULL, &agc1, &agc2, &wbd);
2371 wbd_delta = (s16)wbd - (((s16)wbd_offset+10)*4) ;
2372
2373 deb_info("update lna, agc_global=%d agc1=%d agc2=%d",
2374 agc_global, agc1, agc2);
2375 deb_info("update lna, wbd=%d wbd target=%d wbd offset=%d wbd delta=%d",
2376 wbd, wbd_target, wbd_offset, wbd_delta);
2377
2378 if ((agc1 < threshold_agc1) && (wbd_delta > 0)) {
2379 dib0090_set_switch(fe, 1, 1, 1);
2380 dib0090_set_vga(fe, 0);
2381 dib0090_update_rframp_7090(fe, 0);
2382 dib0090_update_tuning_table_7090(fe, 0);
2383 } else {
2384 dib0090_set_vga(fe, 1);
2385 dib0090_update_rframp_7090(fe, 1);
2386 dib0090_update_tuning_table_7090(fe, 1);
2387 dib0090_set_switch(fe, 0, 0, 0);
2388 }
2389
2390 return 0;
2391}
2392
Olivier Greniebe9bae12011-01-04 05:42:19 -03002393static struct dib0090_wbd_slope dib7090_wbd_table[] = {
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002394 { 380, 81, 850, 64, 540, 4},
2395 { 860, 51, 866, 21, 375, 4},
2396 {1700, 0, 250, 0, 100, 6},
2397 {2600, 0, 250, 0, 100, 6},
2398 { 0xFFFF, 0, 0, 0, 0, 0},
Olivier Greniebe9bae12011-01-04 05:42:19 -03002399};
2400
Olivier Grenie6724a2f2011-08-05 13:49:33 -03002401static struct dib0090_wbd_slope dib7090e_wbd_table[] = {
2402 { 380, 81, 850, 64, 540, 4},
2403 { 700, 51, 866, 21, 320, 4},
2404 { 860, 48, 666, 18, 330, 6},
2405 {1700, 0, 250, 0, 100, 6},
2406 {2600, 0, 250, 0, 100, 6},
2407 { 0xFFFF, 0, 0, 0, 0, 0},
2408};
2409
Olivier Greniea685dbb2011-08-05 14:10:40 -03002410static struct dibx000_agc_config dib7090_agc_config[2] = {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002411 {
2412 .band_caps = BAND_UHF,
2413 /* 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,
2414 * 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 -03002415 .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 -03002416
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002417 .inv_gain = 687,
2418 .time_stabiliz = 10,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002419
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002420 .alpha_level = 0,
2421 .thlock = 118,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002422
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002423 .wbd_inv = 0,
2424 .wbd_ref = 1200,
2425 .wbd_sel = 3,
2426 .wbd_alpha = 5,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002427
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002428 .agc1_max = 65535,
2429 .agc1_min = 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002430
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002431 .agc2_max = 65535,
2432 .agc2_min = 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002433
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002434 .agc1_pt1 = 0,
2435 .agc1_pt2 = 32,
2436 .agc1_pt3 = 114,
2437 .agc1_slope1 = 143,
2438 .agc1_slope2 = 144,
2439 .agc2_pt1 = 114,
2440 .agc2_pt2 = 227,
2441 .agc2_slope1 = 116,
2442 .agc2_slope2 = 117,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002443
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002444 .alpha_mant = 18,
2445 .alpha_exp = 0,
2446 .beta_mant = 20,
2447 .beta_exp = 59,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002448
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002449 .perform_agc_softsplit = 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002450 } , {
2451 .band_caps = BAND_FM | BAND_VHF | BAND_CBAND,
2452 /* 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,
2453 * 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 -03002454 .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 -03002455
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002456 .inv_gain = 732,
2457 .time_stabiliz = 10,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002458
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002459 .alpha_level = 0,
2460 .thlock = 118,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002461
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002462 .wbd_inv = 0,
2463 .wbd_ref = 1200,
2464 .wbd_sel = 3,
2465 .wbd_alpha = 5,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002466
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002467 .agc1_max = 65535,
2468 .agc1_min = 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002469
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002470 .agc2_max = 65535,
2471 .agc2_min = 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002472
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002473 .agc1_pt1 = 0,
2474 .agc1_pt2 = 0,
2475 .agc1_pt3 = 98,
2476 .agc1_slope1 = 0,
2477 .agc1_slope2 = 167,
Patrick Boettcher7f4d5272011-04-03 12:28:08 -03002478 .agc2_pt1 = 98,
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002479 .agc2_pt2 = 255,
2480 .agc2_slope1 = 104,
2481 .agc2_slope2 = 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002482
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002483 .alpha_mant = 18,
2484 .alpha_exp = 0,
2485 .beta_mant = 20,
2486 .beta_exp = 59,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002487
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002488 .perform_agc_softsplit = 0,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002489 }
2490};
2491
2492static struct dibx000_bandwidth_config dib7090_clock_config_12_mhz = {
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002493 60000, 15000,
2494 1, 5, 0, 0, 0,
2495 0, 0, 1, 1, 2,
2496 (3 << 14) | (1 << 12) | (524 << 0),
2497 (0 << 25) | 0,
2498 20452225,
2499 15000000,
Olivier Greniebe9bae12011-01-04 05:42:19 -03002500};
2501
2502static struct dib7000p_config nim7090_dib7000p_config = {
2503 .output_mpeg2_in_188_bytes = 1,
2504 .hostbus_diversity = 1,
2505 .tuner_is_baseband = 1,
2506 .update_lna = NULL,
2507
2508 .agc_config_count = 2,
2509 .agc = dib7090_agc_config,
2510
2511 .bw = &dib7090_clock_config_12_mhz,
2512
2513 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2514 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2515 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2516
2517 .pwm_freq_div = 0,
2518
2519 .agc_control = dib7090_agc_restart,
2520
2521 .spur_protect = 0,
2522 .disable_sample_and_hold = 0,
2523 .enable_current_mirror = 0,
2524 .diversity_delay = 0,
2525
2526 .output_mode = OUTMODE_MPEG2_FIFO,
2527 .enMpegOutput = 1,
2528};
2529
2530static struct dib7000p_config tfe7090pvr_dib7000p_config[2] = {
2531 {
2532 .output_mpeg2_in_188_bytes = 1,
2533 .hostbus_diversity = 1,
2534 .tuner_is_baseband = 1,
2535 .update_lna = NULL,
2536
2537 .agc_config_count = 2,
2538 .agc = dib7090_agc_config,
2539
2540 .bw = &dib7090_clock_config_12_mhz,
2541
2542 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2543 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2544 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2545
2546 .pwm_freq_div = 0,
2547
2548 .agc_control = dib7090_agc_restart,
2549
2550 .spur_protect = 0,
2551 .disable_sample_and_hold = 0,
2552 .enable_current_mirror = 0,
2553 .diversity_delay = 0,
2554
2555 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2556 .default_i2c_addr = 0x90,
2557 .enMpegOutput = 1,
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002558 }, {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002559 .output_mpeg2_in_188_bytes = 1,
2560 .hostbus_diversity = 1,
2561 .tuner_is_baseband = 1,
2562 .update_lna = NULL,
2563
2564 .agc_config_count = 2,
2565 .agc = dib7090_agc_config,
2566
2567 .bw = &dib7090_clock_config_12_mhz,
2568
2569 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2570 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2571 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2572
2573 .pwm_freq_div = 0,
2574
2575 .agc_control = dib7090_agc_restart,
2576
2577 .spur_protect = 0,
2578 .disable_sample_and_hold = 0,
2579 .enable_current_mirror = 0,
2580 .diversity_delay = 0,
2581
2582 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2583 .default_i2c_addr = 0x92,
2584 .enMpegOutput = 0,
2585 }
2586};
2587
Olivier Grenie6724a2f2011-08-05 13:49:33 -03002588static struct dib7000p_config tfe7090e_dib7000p_config = {
2589 .output_mpeg2_in_188_bytes = 1,
2590 .hostbus_diversity = 1,
2591 .tuner_is_baseband = 1,
2592 .update_lna = dib7090e_update_lna,
2593
2594 .agc_config_count = 2,
2595 .agc = dib7090_agc_config,
2596
2597 .bw = &dib7090_clock_config_12_mhz,
2598
2599 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2600 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2601 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2602
2603 .pwm_freq_div = 0,
2604
2605 .agc_control = dib7090_agc_restart,
2606
2607 .spur_protect = 0,
2608 .disable_sample_and_hold = 0,
2609 .enable_current_mirror = 0,
2610 .diversity_delay = 0,
2611
2612 .output_mode = OUTMODE_MPEG2_FIFO,
2613 .enMpegOutput = 1,
2614};
2615
Olivier Greniebe9bae12011-01-04 05:42:19 -03002616static const struct dib0090_config nim7090_dib0090_config = {
2617 .io.clock_khz = 12000,
2618 .io.pll_bypass = 0,
2619 .io.pll_range = 0,
2620 .io.pll_prediv = 3,
2621 .io.pll_loopdiv = 6,
2622 .io.adc_clock_ratio = 0,
2623 .io.pll_int_loop_filt = 0,
2624 .reset = dib7090_tuner_sleep,
2625 .sleep = dib7090_tuner_sleep,
2626
2627 .freq_offset_khz_uhf = 0,
2628 .freq_offset_khz_vhf = 0,
2629
2630 .get_adc_power = dib7090_get_adc_power,
2631
2632 .clkouttobamse = 1,
2633 .analog_output = 0,
2634
2635 .wbd_vhf_offset = 0,
2636 .wbd_cband_offset = 0,
2637 .use_pwm_agc = 1,
2638 .clkoutdrive = 0,
2639
2640 .fref_clock_ratio = 0,
2641
2642 .wbd = dib7090_wbd_table,
2643
2644 .ls_cfg_pad_drv = 0,
2645 .data_tx_drv = 0,
2646 .low_if = NULL,
2647 .in_soc = 1,
2648};
2649
Olivier Grenie6724a2f2011-08-05 13:49:33 -03002650static const struct dib0090_config tfe7090e_dib0090_config = {
2651 .io.clock_khz = 12000,
2652 .io.pll_bypass = 0,
2653 .io.pll_range = 0,
2654 .io.pll_prediv = 3,
2655 .io.pll_loopdiv = 6,
2656 .io.adc_clock_ratio = 0,
2657 .io.pll_int_loop_filt = 0,
2658 .reset = dib7090_tuner_sleep,
2659 .sleep = dib7090_tuner_sleep,
2660
2661 .freq_offset_khz_uhf = 0,
2662 .freq_offset_khz_vhf = 0,
2663
2664 .get_adc_power = dib7090_get_adc_power,
2665
2666 .clkouttobamse = 1,
2667 .analog_output = 0,
2668
2669 .wbd_vhf_offset = 0,
2670 .wbd_cband_offset = 0,
2671 .use_pwm_agc = 1,
2672 .clkoutdrive = 0,
2673
2674 .fref_clock_ratio = 0,
2675
2676 .wbd = dib7090e_wbd_table,
2677
2678 .ls_cfg_pad_drv = 0,
2679 .data_tx_drv = 0,
2680 .low_if = NULL,
2681 .in_soc = 1,
2682 .force_cband_input = 1,
2683 .is_dib7090e = 1,
2684};
2685
Olivier Grenieb293f302011-08-09 04:48:25 -03002686static struct dib7000p_config tfe7790e_dib7000p_config = {
2687 .output_mpeg2_in_188_bytes = 1,
2688 .hostbus_diversity = 1,
2689 .tuner_is_baseband = 1,
2690 .update_lna = dib7090e_update_lna,
2691
2692 .agc_config_count = 2,
2693 .agc = dib7090_agc_config,
2694
2695 .bw = &dib7090_clock_config_12_mhz,
2696
2697 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
2698 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
2699 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
2700
2701 .pwm_freq_div = 0,
2702
2703 .agc_control = dib7090_agc_restart,
2704
2705 .spur_protect = 0,
2706 .disable_sample_and_hold = 0,
2707 .enable_current_mirror = 0,
2708 .diversity_delay = 0,
2709
2710 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
2711 .enMpegOutput = 1,
2712};
2713
2714static const struct dib0090_config tfe7790e_dib0090_config = {
2715 .io.clock_khz = 12000,
2716 .io.pll_bypass = 0,
2717 .io.pll_range = 0,
2718 .io.pll_prediv = 3,
2719 .io.pll_loopdiv = 6,
2720 .io.adc_clock_ratio = 0,
2721 .io.pll_int_loop_filt = 0,
2722 .reset = dib7090_tuner_sleep,
2723 .sleep = dib7090_tuner_sleep,
2724
2725 .freq_offset_khz_uhf = 0,
2726 .freq_offset_khz_vhf = 0,
2727
2728 .get_adc_power = dib7090_get_adc_power,
2729
2730 .clkouttobamse = 1,
2731 .analog_output = 0,
2732
2733 .wbd_vhf_offset = 0,
2734 .wbd_cband_offset = 0,
2735 .use_pwm_agc = 1,
2736 .clkoutdrive = 0,
2737
2738 .fref_clock_ratio = 0,
2739
2740 .wbd = dib7090e_wbd_table,
2741
2742 .ls_cfg_pad_drv = 0,
2743 .data_tx_drv = 0,
2744 .low_if = NULL,
2745 .in_soc = 1,
2746 .force_cband_input = 1,
2747 .is_dib7090e = 1,
2748 .force_crystal_mode = 1,
2749};
2750
Olivier Greniebe9bae12011-01-04 05:42:19 -03002751static const struct dib0090_config tfe7090pvr_dib0090_config[2] = {
2752 {
2753 .io.clock_khz = 12000,
2754 .io.pll_bypass = 0,
2755 .io.pll_range = 0,
2756 .io.pll_prediv = 3,
2757 .io.pll_loopdiv = 6,
2758 .io.adc_clock_ratio = 0,
2759 .io.pll_int_loop_filt = 0,
2760 .reset = dib7090_tuner_sleep,
2761 .sleep = dib7090_tuner_sleep,
2762
2763 .freq_offset_khz_uhf = 50,
2764 .freq_offset_khz_vhf = 70,
2765
2766 .get_adc_power = dib7090_get_adc_power,
2767
2768 .clkouttobamse = 1,
2769 .analog_output = 0,
2770
2771 .wbd_vhf_offset = 0,
2772 .wbd_cband_offset = 0,
2773 .use_pwm_agc = 1,
2774 .clkoutdrive = 0,
2775
2776 .fref_clock_ratio = 0,
2777
2778 .wbd = dib7090_wbd_table,
2779
2780 .ls_cfg_pad_drv = 0,
2781 .data_tx_drv = 0,
2782 .low_if = NULL,
2783 .in_soc = 1,
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002784 }, {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002785 .io.clock_khz = 12000,
2786 .io.pll_bypass = 0,
2787 .io.pll_range = 0,
2788 .io.pll_prediv = 3,
2789 .io.pll_loopdiv = 6,
2790 .io.adc_clock_ratio = 0,
2791 .io.pll_int_loop_filt = 0,
2792 .reset = dib7090_tuner_sleep,
2793 .sleep = dib7090_tuner_sleep,
2794
2795 .freq_offset_khz_uhf = -50,
2796 .freq_offset_khz_vhf = -70,
2797
2798 .get_adc_power = dib7090_get_adc_power,
2799
2800 .clkouttobamse = 1,
2801 .analog_output = 0,
2802
2803 .wbd_vhf_offset = 0,
2804 .wbd_cband_offset = 0,
2805 .use_pwm_agc = 1,
2806 .clkoutdrive = 0,
2807
2808 .fref_clock_ratio = 0,
2809
2810 .wbd = dib7090_wbd_table,
2811
2812 .ls_cfg_pad_drv = 0,
2813 .data_tx_drv = 0,
2814 .low_if = NULL,
2815 .in_soc = 1,
2816 }
2817};
2818
2819static int nim7090_frontend_attach(struct dvb_usb_adapter *adap)
2820{
2821 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002822 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002823 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2824 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2825 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2826 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2827
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002828 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002829 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002830 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002831 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2832
2833 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, &nim7090_dib7000p_config) != 0) {
2834 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
2835 return -ENODEV;
2836 }
Michael Krufky77eed212011-09-06 09:31:57 -03002837 adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &nim7090_dib7000p_config);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002838
Michael Krufky77eed212011-09-06 09:31:57 -03002839 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Olivier Greniebe9bae12011-01-04 05:42:19 -03002840}
2841
2842static int nim7090_tuner_attach(struct dvb_usb_adapter *adap)
2843{
2844 struct dib0700_adapter_state *st = adap->priv;
Michael Krufky77eed212011-09-06 09:31:57 -03002845 struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe_adap[0].fe);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002846
Michael Krufky77eed212011-09-06 09:31:57 -03002847 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &nim7090_dib0090_config) == NULL)
Olivier Greniebe9bae12011-01-04 05:42:19 -03002848 return -ENODEV;
2849
Michael Krufky77eed212011-09-06 09:31:57 -03002850 dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002851
Michael Krufky77eed212011-09-06 09:31:57 -03002852 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
2853 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
Olivier Greniebe9bae12011-01-04 05:42:19 -03002854 return 0;
2855}
2856
2857static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter *adap)
2858{
2859 struct dib0700_state *st = adap->dev->priv;
2860
2861 /* The TFE7090 requires the dib0700 to not be in master mode */
2862 st->disable_streaming_master_mode = 1;
2863
2864 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002865 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002866 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2867 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2868 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2869 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2870
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002871 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002872 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
Olivier Grenieb4d6046e2011-01-04 13:08:14 -03002873 msleep(20);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002874 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2875
2876 /* initialize IC 0 */
2877 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, &tfe7090pvr_dib7000p_config[0]) != 0) {
2878 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
2879 return -ENODEV;
2880 }
2881
2882 dib0700_set_i2c_speed(adap->dev, 340);
Michael Krufky77eed212011-09-06 09:31:57 -03002883 adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]);
2884 if (adap->fe_adap[0].fe == NULL)
Olivier Greniebe9bae12011-01-04 05:42:19 -03002885 return -ENODEV;
2886
Michael Krufky77eed212011-09-06 09:31:57 -03002887 dib7090_slave_reset(adap->fe_adap[0].fe);
Patrick Boettcher71682522011-04-03 12:44:25 -03002888
Olivier Greniebe9bae12011-01-04 05:42:19 -03002889 return 0;
2890}
2891
2892static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter *adap)
2893{
2894 struct i2c_adapter *i2c;
2895
Michael Krufky77eed212011-09-06 09:31:57 -03002896 if (adap->dev->adapter[0].fe_adap[0].fe == NULL) {
Olivier Greniebe9bae12011-01-04 05:42:19 -03002897 err("the master dib7090 has to be initialized first");
2898 return -ENODEV; /* the master device has not been initialized */
2899 }
2900
Michael Krufky77eed212011-09-06 09:31:57 -03002901 i2c = dib7000p_get_i2c_master(adap->dev->adapter[0].fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_6_7, 1);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002902 if (dib7000p_i2c_enumeration(i2c, 1, 0x10, &tfe7090pvr_dib7000p_config[1]) != 0) {
2903 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);
2904 return -ENODEV;
2905 }
2906
Michael Krufky77eed212011-09-06 09:31:57 -03002907 adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, i2c, 0x92, &tfe7090pvr_dib7000p_config[1]);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002908 dib0700_set_i2c_speed(adap->dev, 200);
2909
Michael Krufky77eed212011-09-06 09:31:57 -03002910 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Olivier Greniebe9bae12011-01-04 05:42:19 -03002911}
2912
2913static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter *adap)
2914{
2915 struct dib0700_adapter_state *st = adap->priv;
Michael Krufky77eed212011-09-06 09:31:57 -03002916 struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe_adap[0].fe);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002917
Michael Krufky77eed212011-09-06 09:31:57 -03002918 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[0]) == NULL)
Olivier Greniebe9bae12011-01-04 05:42:19 -03002919 return -ENODEV;
2920
Michael Krufky77eed212011-09-06 09:31:57 -03002921 dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002922
Michael Krufky77eed212011-09-06 09:31:57 -03002923 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
2924 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
Olivier Greniebe9bae12011-01-04 05:42:19 -03002925 return 0;
2926}
2927
2928static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter *adap)
2929{
2930 struct dib0700_adapter_state *st = adap->priv;
Michael Krufky77eed212011-09-06 09:31:57 -03002931 struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe_adap[0].fe);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002932
Michael Krufky77eed212011-09-06 09:31:57 -03002933 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[1]) == NULL)
Olivier Greniebe9bae12011-01-04 05:42:19 -03002934 return -ENODEV;
2935
Michael Krufky77eed212011-09-06 09:31:57 -03002936 dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
Olivier Greniebe9bae12011-01-04 05:42:19 -03002937
Michael Krufky77eed212011-09-06 09:31:57 -03002938 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
2939 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
Olivier Greniebe9bae12011-01-04 05:42:19 -03002940 return 0;
2941}
2942
Olivier Grenie6724a2f2011-08-05 13:49:33 -03002943static int tfe7090e_frontend_attach(struct dvb_usb_adapter *adap)
2944{
2945 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2946 msleep(20);
2947 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2948 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2949 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2950 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2951
2952 msleep(20);
2953 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2954 msleep(20);
2955 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2956
2957 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap,
2958 1, 0x10, &tfe7090e_dib7000p_config) != 0) {
2959 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
2960 __func__);
2961 return -ENODEV;
2962 }
2963 adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,
2964 0x80, &tfe7090e_dib7000p_config);
2965
2966 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
2967}
2968
Olivier Grenieb293f302011-08-09 04:48:25 -03002969static int tfe7790e_frontend_attach(struct dvb_usb_adapter *adap)
2970{
2971 struct dib0700_state *st = adap->dev->priv;
2972
2973 /* The TFE7790E requires the dib0700 to not be in master mode */
2974 st->disable_streaming_master_mode = 1;
2975
2976 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
2977 msleep(20);
2978 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
2979 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
2980 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
2981 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
2982 msleep(20);
2983 dib0700_ctrl_clock(adap->dev, 72, 1);
2984 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
2985 msleep(20);
2986 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
2987
2988 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap,
2989 1, 0x10, &tfe7790e_dib7000p_config) != 0) {
2990 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
2991 __func__);
2992 return -ENODEV;
2993 }
2994 adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,
2995 0x80, &tfe7790e_dib7000p_config);
2996
2997 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
2998}
2999
3000static int tfe7790e_tuner_attach(struct dvb_usb_adapter *adap)
3001{
3002 struct dib0700_adapter_state *st = adap->priv;
3003 struct i2c_adapter *tun_i2c =
3004 dib7090_get_i2c_tuner(adap->fe_adap[0].fe);
3005
3006 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c,
3007 &tfe7790e_dib0090_config) == NULL)
3008 return -ENODEV;
3009
3010 dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3011
3012 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3013 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3014 return 0;
3015}
3016
Olivier Grenie6724a2f2011-08-05 13:49:33 -03003017static int tfe7090e_tuner_attach(struct dvb_usb_adapter *adap)
3018{
3019 struct dib0700_adapter_state *st = adap->priv;
3020 struct i2c_adapter *tun_i2c =
3021 dib7090_get_i2c_tuner(adap->fe_adap[0].fe);
3022
3023 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c,
3024 &tfe7090e_dib0090_config) == NULL)
3025 return -ENODEV;
3026
3027 dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
3028
3029 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
3030 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
3031 return 0;
3032}
3033
Patrick Boettcher01373a52007-07-30 12:49:04 -03003034/* STK7070PD */
3035static struct dib7000p_config stk7070pd_dib7000p_config[2] = {
3036 {
3037 .output_mpeg2_in_188_bytes = 1,
3038
3039 .agc_config_count = 1,
3040 .agc = &dib7070_agc_config,
3041 .bw = &dib7070_bw_config_12_mhz,
Patrick Boettcher3cb2c392008-01-25 07:25:20 -03003042 .tuner_is_baseband = 1,
3043 .spur_protect = 1,
Patrick Boettcher01373a52007-07-30 12:49:04 -03003044
3045 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
3046 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
3047 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
3048
3049 .hostbus_diversity = 1,
3050 }, {
3051 .output_mpeg2_in_188_bytes = 1,
3052
3053 .agc_config_count = 1,
3054 .agc = &dib7070_agc_config,
3055 .bw = &dib7070_bw_config_12_mhz,
Patrick Boettcher3cb2c392008-01-25 07:25:20 -03003056 .tuner_is_baseband = 1,
3057 .spur_protect = 1,
Patrick Boettcher01373a52007-07-30 12:49:04 -03003058
3059 .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
3060 .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
3061 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
3062
3063 .hostbus_diversity = 1,
3064 }
3065};
3066
3067static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
3068{
3069 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3070 msleep(10);
3071 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3072 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3073 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3074 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3075
3076 dib0700_ctrl_clock(adap->dev, 72, 1);
3077
3078 msleep(10);
3079 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3080 msleep(10);
3081 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3082
Devin Heitmueller83c4fdf2009-01-21 01:55:45 -03003083 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
3084 stk7070pd_dib7000p_config) != 0) {
3085 err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
3086 __func__);
3087 return -ENODEV;
3088 }
Patrick Boettcher01373a52007-07-30 12:49:04 -03003089
Michael Krufky77eed212011-09-06 09:31:57 -03003090 adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
3091 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Patrick Boettcher01373a52007-07-30 12:49:04 -03003092}
3093
3094static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)
3095{
Michael Krufky77eed212011-09-06 09:31:57 -03003096 adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);
3097 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Patrick Boettcher01373a52007-07-30 12:49:04 -03003098}
3099
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03003100/* S5H1411 */
3101static struct s5h1411_config pinnacle_801e_config = {
3102 .output_mode = S5H1411_PARALLEL_OUTPUT,
3103 .gpio = S5H1411_GPIO_OFF,
3104 .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
3105 .qam_if = S5H1411_IF_44000,
3106 .vsb_if = S5H1411_IF_44000,
3107 .inversion = S5H1411_INVERSION_OFF,
3108 .status_mode = S5H1411_DEMODLOCKING
3109};
3110
3111/* Pinnacle PCTV HD Pro 801e GPIOs map:
3112 GPIO0 - currently unknown
3113 GPIO1 - xc5000 tuner reset
3114 GPIO2 - CX25843 sleep
3115 GPIO3 - currently unknown
3116 GPIO4 - currently unknown
3117 GPIO6 - currently unknown
3118 GPIO7 - currently unknown
3119 GPIO9 - currently unknown
3120 GPIO10 - CX25843 reset
3121 */
3122static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)
3123{
3124 struct dib0700_state *st = adap->dev->priv;
3125
3126 /* Make use of the new i2c functions from FW 1.20 */
3127 st->fw_use_new_i2c_api = 1;
3128
3129 /* The s5h1411 requires the dib0700 to not be in master mode */
3130 st->disable_streaming_master_mode = 1;
3131
3132 /* All msleep values taken from Windows USB trace */
3133 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
3134 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);
3135 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3136 msleep(400);
3137 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3138 msleep(60);
3139 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3140 msleep(30);
3141 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
3142 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
3143 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
3144 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
3145 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);
3146 msleep(30);
3147
3148 /* Put the CX25843 to sleep for now since we're in digital mode */
3149 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
3150
3151 /* GPIOs are initialized, do the attach */
Michael Krufky77eed212011-09-06 09:31:57 -03003152 adap->fe_adap[0].fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03003153 &adap->dev->i2c_adap);
Michael Krufky77eed212011-09-06 09:31:57 -03003154 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03003155}
3156
Michael Krufky767f3b32008-09-25 09:47:07 -03003157static int dib0700_xc5000_tuner_callback(void *priv, int component,
3158 int command, int arg)
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03003159{
3160 struct dvb_usb_adapter *adap = priv;
3161
Devin Heitmueller79025a92008-10-06 12:07:48 -03003162 if (command == XC5000_TUNER_RESET) {
3163 /* Reset the tuner */
3164 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);
Devin Heitmuellerf0f46332009-05-04 21:57:41 -03003165 msleep(10);
Devin Heitmueller79025a92008-10-06 12:07:48 -03003166 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);
Devin Heitmuellerf0f46332009-05-04 21:57:41 -03003167 msleep(10);
Devin Heitmueller79025a92008-10-06 12:07:48 -03003168 } else {
3169 err("xc5000: unknown tuner callback command: %d\n", command);
3170 return -EINVAL;
3171 }
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03003172
3173 return 0;
3174}
3175
3176static struct xc5000_config s5h1411_xc5000_tunerconfig = {
3177 .i2c_address = 0x64,
3178 .if_khz = 5380,
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03003179};
3180
3181static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)
3182{
Devin Heitmueller79025a92008-10-06 12:07:48 -03003183 /* FIXME: generalize & move to common area */
Michael Krufky77eed212011-09-06 09:31:57 -03003184 adap->fe_adap[0].fe->callback = dib0700_xc5000_tuner_callback;
Devin Heitmueller79025a92008-10-06 12:07:48 -03003185
Michael Krufky77eed212011-09-06 09:31:57 -03003186 return dvb_attach(xc5000_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap,
Michael Krufky767f3b32008-09-25 09:47:07 -03003187 &s5h1411_xc5000_tunerconfig)
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03003188 == NULL ? -ENODEV : 0;
3189}
3190
Davide Ferri8d009a02009-06-23 22:34:06 -03003191static int dib0700_xc4000_tuner_callback(void *priv, int component,
3192 int command, int arg)
3193{
3194 struct dvb_usb_adapter *adap = priv;
3195
3196 if (command == XC4000_TUNER_RESET) {
3197 /* Reset the tuner */
Michael Krufky77eed212011-09-06 09:31:57 -03003198 dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 0);
Davide Ferri8d009a02009-06-23 22:34:06 -03003199 msleep(10);
Michael Krufky77eed212011-09-06 09:31:57 -03003200 dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
Davide Ferri8d009a02009-06-23 22:34:06 -03003201 } else {
3202 err("xc4000: unknown tuner callback command: %d\n", command);
3203 return -EINVAL;
3204 }
3205
3206 return 0;
3207}
3208
Devin Heitmueller8583fc82009-07-28 01:16:05 -03003209static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config = {
3210 .band_caps = BAND_UHF | BAND_VHF,
3211 .setup = 0x64,
3212 .inv_gain = 0x02c8,
3213 .time_stabiliz = 0x15,
3214 .alpha_level = 0x00,
3215 .thlock = 0x76,
3216 .wbd_inv = 0x01,
3217 .wbd_ref = 0x0b33,
3218 .wbd_sel = 0x00,
3219 .wbd_alpha = 0x02,
3220 .agc1_max = 0x00,
3221 .agc1_min = 0x00,
3222 .agc2_max = 0x9b26,
3223 .agc2_min = 0x26ca,
3224 .agc1_pt1 = 0x00,
3225 .agc1_pt2 = 0x00,
3226 .agc1_pt3 = 0x00,
3227 .agc1_slope1 = 0x00,
3228 .agc1_slope2 = 0x00,
3229 .agc2_pt1 = 0x00,
3230 .agc2_pt2 = 0x80,
3231 .agc2_slope1 = 0x1d,
3232 .agc2_slope2 = 0x1d,
Devin Heitmueller2df12512009-12-27 17:44:31 -03003233 .alpha_mant = 0x11,
Devin Heitmueller8583fc82009-07-28 01:16:05 -03003234 .alpha_exp = 0x1b,
3235 .beta_mant = 0x17,
3236 .beta_exp = 0x33,
3237 .perform_agc_softsplit = 0x00,
3238};
3239
Devin Heitmuellerf1c78d32009-10-05 00:34:04 -03003240static struct dibx000_bandwidth_config stk7700p_xc4000_pll_config = {
istvan_v@mailbox.hu341747b2011-06-06 12:54:54 -03003241 60000, 30000, /* internal, sampling */
3242 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
3243 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, */
3244 /* ADClkSrc, modulo */
3245 (3 << 14) | (1 << 12) | 524, /* sad_cfg: refsel, sel, freq_15k */
3246 39370534, /* ifreq */
3247 20452225, /* timf */
3248 30000000 /* xtal */
Devin Heitmuellerf1c78d32009-10-05 00:34:04 -03003249};
3250
Devin Heitmueller01f16262009-06-24 00:07:01 -03003251/* FIXME: none of these inputs are validated yet */
3252static struct dib7000p_config pctv_340e_config = {
Devin Heitmueller62956ce2009-12-27 18:58:11 -03003253 .output_mpeg2_in_188_bytes = 1,
Devin Heitmueller01f16262009-06-24 00:07:01 -03003254
3255 .agc_config_count = 1,
Devin Heitmueller8583fc82009-07-28 01:16:05 -03003256 .agc = &stk7700p_7000p_xc4000_agc_config,
Devin Heitmuellerf1c78d32009-10-05 00:34:04 -03003257 .bw = &stk7700p_xc4000_pll_config,
Devin Heitmueller01f16262009-06-24 00:07:01 -03003258
Devin Heitmueller01f16262009-06-24 00:07:01 -03003259 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
3260 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
3261 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
3262};
3263
3264/* PCTV 340e GPIOs map:
3265 dib0700:
3266 GPIO2 - CX25843 sleep
3267 GPIO3 - CS5340 reset
3268 GPIO5 - IRD
3269 GPIO6 - Power Supply
3270 GPIO8 - LNA (1=off 0=on)
3271 GPIO10 - CX25843 reset
3272 dib7000:
3273 GPIO8 - xc4000 reset
3274 */
3275static int pctv340e_frontend_attach(struct dvb_usb_adapter *adap)
3276{
3277 struct dib0700_state *st = adap->dev->priv;
3278
3279 /* Power Supply on */
3280 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
3281 msleep(50);
3282 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3283 msleep(100); /* Allow power supply to settle before probing */
3284
3285 /* cx25843 reset */
3286 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3287 msleep(1); /* cx25843 datasheet say 350us required */
3288 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3289
3290 /* LNA off for now */
3291 dib0700_set_gpio(adap->dev, GPIO8, GPIO_OUT, 1);
3292
3293 /* Put the CX25843 to sleep for now since we're in digital mode */
3294 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);
3295
3296 /* FIXME: not verified yet */
3297 dib0700_ctrl_clock(adap->dev, 72, 1);
3298
Devin Heitmueller2750d9c2009-07-20 00:42:33 -03003299 msleep(500);
3300
Devin Heitmueller01f16262009-06-24 00:07:01 -03003301 if (dib7000pc_detection(&adap->dev->i2c_adap) == 0) {
3302 /* Demodulator not found for some reason? */
3303 return -ENODEV;
3304 }
3305
Michael Krufky77eed212011-09-06 09:31:57 -03003306 adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x12,
Devin Heitmueller01f16262009-06-24 00:07:01 -03003307 &pctv_340e_config);
3308 st->is_dib7000pc = 1;
3309
Michael Krufky77eed212011-09-06 09:31:57 -03003310 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Devin Heitmueller01f16262009-06-24 00:07:01 -03003311}
3312
Devin Heitmueller8583fc82009-07-28 01:16:05 -03003313static struct xc4000_config dib7000p_xc4000_tunerconfig = {
istvan_v@mailbox.hu8edeb6e2011-06-06 13:03:44 -03003314 .i2c_address = 0x61,
3315 .default_pm = 1,
3316 .dvb_amplitude = 0,
3317 .set_smoothedcvbs = 0,
3318 .if_khz = 5400
Davide Ferri8d009a02009-06-23 22:34:06 -03003319};
3320
3321static int xc4000_tuner_attach(struct dvb_usb_adapter *adap)
3322{
Devin Heitmueller59d0c372009-06-29 21:11:02 -03003323 struct i2c_adapter *tun_i2c;
3324
3325 /* The xc4000 is not on the main i2c bus */
Michael Krufky77eed212011-09-06 09:31:57 -03003326 tun_i2c = dib7000p_get_i2c_master(adap->fe_adap[0].fe,
Devin Heitmueller59d0c372009-06-29 21:11:02 -03003327 DIBX000_I2C_INTERFACE_TUNER, 1);
3328 if (tun_i2c == NULL) {
Mauro Carvalho Chehab941830c2011-06-06 16:51:11 -03003329 printk(KERN_ERR "Could not reach tuner i2c bus\n");
Devin Heitmueller59d0c372009-06-29 21:11:02 -03003330 return 0;
3331 }
3332
3333 /* Setup the reset callback */
Michael Krufky77eed212011-09-06 09:31:57 -03003334 adap->fe_adap[0].fe->callback = dib0700_xc4000_tuner_callback;
Davide Ferri8d009a02009-06-23 22:34:06 -03003335
Michael Krufky77eed212011-09-06 09:31:57 -03003336 return dvb_attach(xc4000_attach, adap->fe_adap[0].fe, tun_i2c,
Devin Heitmueller8583fc82009-07-28 01:16:05 -03003337 &dib7000p_xc4000_tunerconfig)
Davide Ferri8d009a02009-06-23 22:34:06 -03003338 == NULL ? -ENODEV : 0;
3339}
3340
Michael Krufkyce904bc2009-01-19 01:12:55 -03003341static struct lgdt3305_config hcw_lgdt3305_config = {
3342 .i2c_addr = 0x0e,
3343 .mpeg_mode = LGDT3305_MPEG_PARALLEL,
3344 .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
3345 .tpvalid_polarity = LGDT3305_TP_VALID_LOW,
3346 .deny_i2c_rptr = 0,
3347 .spectral_inversion = 1,
3348 .qam_if_khz = 6000,
3349 .vsb_if_khz = 6000,
3350 .usref_8vsb = 0x0500,
3351};
3352
3353static struct mxl5007t_config hcw_mxl5007t_config = {
3354 .xtal_freq_hz = MxL_XTAL_25_MHZ,
3355 .if_freq_hz = MxL_IF_6_MHZ,
3356 .invert_if = 1,
3357};
3358
3359/* TIGER-ATSC map:
3360 GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)
3361 GPIO1 - ANT_SEL (H: VPA, L: MCX)
3362 GPIO4 - SCL2
3363 GPIO6 - EN_TUNER
3364 GPIO7 - SDA2
3365 GPIO10 - DEM_RST
3366
3367 MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB
3368 */
3369static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)
3370{
3371 struct dib0700_state *st = adap->dev->priv;
3372
3373 /* Make use of the new i2c functions from FW 1.20 */
3374 st->fw_use_new_i2c_api = 1;
3375
3376 st->disable_streaming_master_mode = 1;
3377
3378 /* fe power enable */
3379 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
3380 msleep(30);
3381 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
3382 msleep(30);
3383
3384 /* demod reset */
3385 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3386 msleep(30);
3387 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
3388 msleep(30);
3389 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
3390 msleep(30);
3391
Michael Krufky77eed212011-09-06 09:31:57 -03003392 adap->fe_adap[0].fe = dvb_attach(lgdt3305_attach,
Michael Krufkyce904bc2009-01-19 01:12:55 -03003393 &hcw_lgdt3305_config,
3394 &adap->dev->i2c_adap);
3395
Michael Krufky77eed212011-09-06 09:31:57 -03003396 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
Michael Krufkyce904bc2009-01-19 01:12:55 -03003397}
3398
3399static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)
3400{
Michael Krufky77eed212011-09-06 09:31:57 -03003401 return dvb_attach(mxl5007t_attach, adap->fe_adap[0].fe,
Michael Krufkyce904bc2009-01-19 01:12:55 -03003402 &adap->dev->i2c_adap, 0x60,
3403 &hcw_mxl5007t_config) == NULL ? -ENODEV : 0;
3404}
3405
3406
Patrick Boettcher01373a52007-07-30 12:49:04 -03003407/* DVB-USB and USB stuff follows */
Patrick Boettcherb7f54912006-09-19 12:51:37 -03003408struct usb_device_id dib0700_usb_id_table[] = {
Patrick Boettcher01373a52007-07-30 12:49:04 -03003409/* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003410 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },
3411 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
3412 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
3413 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
Patrick Boettcher01373a52007-07-30 12:49:04 -03003414/* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003415 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },
3416 { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },
3417 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },
3418 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },
Patrick Boettcher01373a52007-07-30 12:49:04 -03003419/* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003420 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
3421 { USB_DEVICE(USB_VID_TERRATEC,
3422 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
3423 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
3424 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
Patrick Boettcher01373a52007-07-30 12:49:04 -03003425/* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003426 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },
3427 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },
3428 { USB_DEVICE(USB_VID_PINNACLE,
3429 USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },
3430 { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },
Joachim Steigerfa3b8772007-10-08 20:08:46 -03003431/* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003432 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },
3433 { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },
3434 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },
3435 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },
3436/* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },
3437 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },
3438 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },
3439 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },
3440 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },
3441/* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },
3442 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },
3443 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
Alexander Simondc888072008-03-29 21:37:54 -03003444 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
Darryl Green5da4e2c2008-03-29 21:47:43 -03003445 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
Michael Krufkyaf2a8872008-09-03 17:12:24 -03003446/* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
Michael Krufky9a0c04a2008-09-03 17:12:24 -03003447 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },
Finn Thain17a370b2008-09-06 13:42:47 -03003448 { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },
Daniel Oliveira Nascimento8751aaa2008-09-07 12:39:44 -03003449 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },
Albert Comerma57697432008-09-07 12:43:33 -03003450 { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03003451/* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },
Devin Heitmuellerd2fc3bf2008-09-25 06:22:23 -03003452 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03003453 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
Nicolas Fournierdb4b2d12009-01-13 07:15:25 -03003454 { USB_DEVICE(USB_VID_TERRATEC,
3455 USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
sebastian.blanes@gmail.com0a6e1ed2009-02-24 14:51:43 -03003456 { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },
Pascal Terjan9abb6e62009-02-26 10:31:41 -03003457/* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },
Michael Krufkyce904bc2009-01-19 01:12:55 -03003458 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },
3459 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },
Xoan Loureiro16ba1ee2009-03-29 08:43:36 -03003460 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },
Klaus Flittner919a5482009-03-29 09:12:06 -03003461 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },
Armin Schenker513846e2009-04-20 11:57:49 -03003462/* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },
tomas petrf0f4ae72009-05-20 05:28:05 -03003463 { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },
Patrick Boettchera9b8fe32009-05-20 05:35:02 -03003464 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },
3465 { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },
Pete Hildebrandtc53d83c2009-08-05 11:46:38 -03003466 { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },
Olivier Grenie74b76f22009-09-02 08:19:19 -03003467/* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },
3468 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },
Patrick Boettchere4147532009-11-30 13:52:57 -03003469 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV73ESE) },
3470 { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV282E) },
Olivier Grenied300bd62009-09-15 06:55:35 -03003471 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },
Patrick Boettcherdb481382009-09-15 07:16:51 -03003472/* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03003473 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },
3474 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },
Mauro Carvalho Chehab3bfb3172010-09-03 10:50:24 -03003475 { USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x000, 0x3f00) },
S?rgio Fortier8a378e82009-09-28 04:19:21 -03003476 { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },
Patrick Boettcher20232c42009-12-01 12:08:56 -03003477/* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },
Patrick Boettchere4147532009-11-30 13:52:57 -03003478 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },
Olivier Grenie03245a52009-12-04 13:27:57 -03003479 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) },
Michael Müller84e2f032010-04-26 22:18:57 -03003480 { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) },
Olivier Greniebe9bae12011-01-04 05:42:19 -03003481 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090M) },
3482/* 70 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM8096MD) },
3483 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090MD) },
3484 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM7090) },
3485 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090PVR) },
Lukas Max Fisch498e6772011-02-08 16:51:45 -03003486 { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2) },
Stéphane Elmalehd1402302011-05-21 07:33:38 -03003487/* 75 */{ USB_DEVICE(USB_VID_MEDION, USB_PID_CREATIX_CTX1921) },
Davide Ferri8d009a02009-06-23 22:34:06 -03003488 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E) },
Devin Heitmueller33fb1682009-06-23 22:48:02 -03003489 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E_SE) },
Olivier Grenie6724a2f2011-08-05 13:49:33 -03003490 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090E) },
Olivier Grenieb293f302011-08-09 04:48:25 -03003491 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7790E) },
Olivier Grenie88f3a352011-08-10 05:28:38 -03003492/* 80 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE8096P) },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003493 { 0 } /* Terminating entry */
Patrick Boettcherb7f54912006-09-19 12:51:37 -03003494};
3495MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
3496
3497#define DIB0700_DEFAULT_DEVICE_PROPERTIES \
3498 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
3499 .usb_ctrl = DEVICE_SPECIFIC, \
Devin Heitmuellerbdc203e2008-09-06 13:45:27 -03003500 .firmware = "dvb-usb-dib0700-1.20.fw", \
Patrick Boettcherb7f54912006-09-19 12:51:37 -03003501 .download_firmware = dib0700_download_firmware, \
Patrick Boettcher6958eff2006-09-19 12:51:40 -03003502 .no_reconnect = 1, \
Patrick Boettcherb7f54912006-09-19 12:51:37 -03003503 .size_of_priv = sizeof(struct dib0700_state), \
Patrick Boettcher6958eff2006-09-19 12:51:40 -03003504 .i2c_algo = &dib0700_i2c_algo, \
3505 .identify_state = dib0700_identify_state
Patrick Boettcherb7f54912006-09-19 12:51:37 -03003506
3507#define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
3508 .streaming_ctrl = dib0700_streaming_ctrl, \
3509 .stream = { \
3510 .type = USB_BULK, \
3511 .count = 4, \
3512 .endpoint = ep, \
3513 .u = { \
3514 .bulk = { \
3515 .buffersize = 39480, \
3516 } \
3517 } \
3518 }
3519
3520struct dvb_usb_device_properties dib0700_devices[] = {
3521 {
3522 DIB0700_DEFAULT_DEVICE_PROPERTIES,
3523
3524 .num_adapters = 1,
3525 .adapter = {
3526 {
Michael Krufky77eed212011-09-06 09:31:57 -03003527 .num_frontends = 1,
3528 .fe = {{
Olivier Grenief8731f42009-09-18 04:08:43 -03003529 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3530 .pid_filter_count = 32,
Olivier Greniee192a7c2011-01-14 13:58:59 -03003531 .pid_filter = stk7700p_pid_filter,
3532 .pid_filter_ctrl = stk7700p_pid_filter_ctrl,
Patrick Boettcherb7f54912006-09-19 12:51:37 -03003533 .frontend_attach = stk7700p_frontend_attach,
3534 .tuner_attach = stk7700p_tuner_attach,
3535
3536 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03003537 }},
Patrick Boettcherb7f54912006-09-19 12:51:37 -03003538 },
3539 },
3540
dominik67053a42007-11-10 19:23:31 -03003541 .num_device_descs = 8,
Patrick Boettcherb7f54912006-09-19 12:51:37 -03003542 .devices = {
3543 { "DiBcom STK7700P reference design",
Tomi Koivulahti49a13762006-10-19 07:27:19 -03003544 { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03003545 { NULL },
3546 },
3547 { "Hauppauge Nova-T Stick",
Stefan Trabyf9aeba42006-11-12 13:02:51 -03003548 { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03003549 { NULL },
3550 },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03003551 { "AVerMedia AVerTV DVB-T Volar",
Jose Carlos Garcia Sogoced8fec2006-11-14 05:01:47 -03003552 { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03003553 { NULL },
3554 },
3555 { "Compro Videomate U500",
Patrick Boettcher1f8ca4b2007-07-30 14:24:37 -03003556 { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03003557 { NULL },
Henning Schroeer0ce215e2006-10-19 07:58:22 -03003558 },
3559 { "Uniwill STK7700P based (Hama and others)",
3560 { &dib0700_usb_id_table[7], NULL },
3561 { NULL },
Michael Krufky8637a872006-11-08 16:47:32 -03003562 },
3563 { "Leadtek Winfast DTV Dongle (STK7700P based)",
Patrick Boettcher1e13c8f2009-09-19 05:24:40 -03003564 { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },
Michael Krufky8637a872006-11-08 16:47:32 -03003565 { NULL },
Joachim Steigerfa3b8772007-10-08 20:08:46 -03003566 },
3567 { "AVerMedia AVerTV DVB-T Express",
3568 { &dib0700_usb_id_table[20] },
3569 { NULL },
dominik67053a42007-11-10 19:23:31 -03003570 },
dominik67053a42007-11-10 19:23:31 -03003571 { "Gigabyte U7000",
3572 { &dib0700_usb_id_table[21], NULL },
3573 { NULL },
Tomi Koivulahti49a13762006-10-19 07:27:19 -03003574 }
Darren Saltb1139e32007-08-18 18:05:31 -03003575 },
3576
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003577 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003578 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003579 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003580 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003581 .allowed_protos = RC_TYPE_RC5 |
3582 RC_TYPE_RC6 |
3583 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003584 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003585 },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03003586 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3587
3588 .num_adapters = 2,
3589 .adapter = {
3590 {
Michael Krufky77eed212011-09-06 09:31:57 -03003591 .num_frontends = 1,
3592 .fe = {{
Patrick Boettcherb7f54912006-09-19 12:51:37 -03003593 .frontend_attach = bristol_frontend_attach,
3594 .tuner_attach = bristol_tuner_attach,
3595
3596 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03003597 }},
Patrick Boettcherb7f54912006-09-19 12:51:37 -03003598 }, {
Michael Krufky77eed212011-09-06 09:31:57 -03003599 .num_frontends = 1,
3600 .fe = {{
Patrick Boettcherb7f54912006-09-19 12:51:37 -03003601 .frontend_attach = bristol_frontend_attach,
3602 .tuner_attach = bristol_tuner_attach,
3603
3604 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
Michael Krufky77eed212011-09-06 09:31:57 -03003605 }},
Patrick Boettcherb7f54912006-09-19 12:51:37 -03003606 }
3607 },
3608
3609 .num_device_descs = 1,
3610 .devices = {
3611 { "Hauppauge Nova-T 500 Dual DVB-T",
Tomi Koivulahti49a13762006-10-19 07:27:19 -03003612 { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03003613 { NULL },
3614 },
Janne Grunau82f3d552007-07-30 13:50:28 -03003615 },
3616
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003617 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003618 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003619 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003620 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003621 .allowed_protos = RC_TYPE_RC5 |
3622 RC_TYPE_RC6 |
3623 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003624 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003625 },
Olivier DANET54d75eb2007-07-25 14:42:54 -03003626 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3627
3628 .num_adapters = 2,
3629 .adapter = {
3630 {
Michael Krufky77eed212011-09-06 09:31:57 -03003631 .num_frontends = 1,
3632 .fe = {{
Olivier Grenief8731f42009-09-18 04:08:43 -03003633 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3634 .pid_filter_count = 32,
3635 .pid_filter = stk70x0p_pid_filter,
3636 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier DANET54d75eb2007-07-25 14:42:54 -03003637 .frontend_attach = stk7700d_frontend_attach,
3638 .tuner_attach = stk7700d_tuner_attach,
3639
3640 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03003641 }},
Olivier DANET54d75eb2007-07-25 14:42:54 -03003642 }, {
Michael Krufky77eed212011-09-06 09:31:57 -03003643 .num_frontends = 1,
3644 .fe = {{
Olivier Grenief8731f42009-09-18 04:08:43 -03003645 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3646 .pid_filter_count = 32,
3647 .pid_filter = stk70x0p_pid_filter,
3648 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier DANET54d75eb2007-07-25 14:42:54 -03003649 .frontend_attach = stk7700d_frontend_attach,
3650 .tuner_attach = stk7700d_tuner_attach,
3651
3652 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
Michael Krufky77eed212011-09-06 09:31:57 -03003653 }},
Olivier DANET54d75eb2007-07-25 14:42:54 -03003654 }
3655 },
3656
James A Webb200e8612009-08-04 02:38:05 -03003657 .num_device_descs = 5,
Olivier DANET54d75eb2007-07-25 14:42:54 -03003658 .devices = {
3659 { "Pinnacle PCTV 2000e",
3660 { &dib0700_usb_id_table[11], NULL },
3661 { NULL },
3662 },
3663 { "Terratec Cinergy DT XS Diversity",
3664 { &dib0700_usb_id_table[12], NULL },
3665 { NULL },
3666 },
Darren Saltfaebb912007-08-18 18:04:00 -03003667 { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",
Olivier DANET54d75eb2007-07-25 14:42:54 -03003668 { &dib0700_usb_id_table[13], NULL },
3669 { NULL },
3670 },
Patrick Boettcher01373a52007-07-30 12:49:04 -03003671 { "DiBcom STK7700D reference design",
Patrick Boettcherb6884a12007-07-27 10:08:51 -03003672 { &dib0700_usb_id_table[14], NULL },
3673 { NULL },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03003674 },
James A Webb200e8612009-08-04 02:38:05 -03003675 { "YUAN High-Tech DiBcom STK7700D",
3676 { &dib0700_usb_id_table[55], NULL },
3677 { NULL },
3678 },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03003679
Olivier DANET54d75eb2007-07-25 14:42:54 -03003680 },
Janne Grunau82f3d552007-07-30 13:50:28 -03003681
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003682 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003683 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003684 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003685 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003686 .allowed_protos = RC_TYPE_RC5 |
3687 RC_TYPE_RC6 |
3688 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003689 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003690 },
Patrick Boettcher01373a52007-07-30 12:49:04 -03003691 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3692
3693 .num_adapters = 1,
3694 .adapter = {
3695 {
Michael Krufky77eed212011-09-06 09:31:57 -03003696 .num_frontends = 1,
3697 .fe = {{
Olivier Grenief8731f42009-09-18 04:08:43 -03003698 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3699 .pid_filter_count = 32,
3700 .pid_filter = stk70x0p_pid_filter,
3701 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03003702 .frontend_attach = stk7700P2_frontend_attach,
3703 .tuner_attach = stk7700d_tuner_attach,
3704
3705 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03003706 }},
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03003707 },
3708 },
3709
Yusuf Altinbb1b0822009-01-08 07:58:45 -03003710 .num_device_descs = 3,
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03003711 .devices = {
3712 { "ASUS My Cinema U3000 Mini DVBT Tuner",
3713 { &dib0700_usb_id_table[23], NULL },
3714 { NULL },
3715 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003716 { "Yuan EC372S",
3717 { &dib0700_usb_id_table[31], NULL },
3718 { NULL },
Yusuf Altinbb1b0822009-01-08 07:58:45 -03003719 },
3720 { "Terratec Cinergy T Express",
3721 { &dib0700_usb_id_table[42], NULL },
3722 { NULL },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003723 }
Chris Rankin48aa7392008-09-25 06:52:24 -03003724 },
3725
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003726 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003727 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003728 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003729 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003730 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003731 .allowed_protos = RC_TYPE_RC5 |
3732 RC_TYPE_RC6 |
3733 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003734 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003735 },
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03003736 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3737
3738 .num_adapters = 1,
3739 .adapter = {
3740 {
Michael Krufky77eed212011-09-06 09:31:57 -03003741 .num_frontends = 1,
3742 .fe = {{
Olivier Grenief8731f42009-09-18 04:08:43 -03003743 .caps = DVB_USB_ADAP_HAS_PID_FILTER | 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,
Patrick Boettcher01373a52007-07-30 12:49:04 -03003747 .frontend_attach = stk7070p_frontend_attach,
3748 .tuner_attach = dib7070p_tuner_attach,
3749
3750 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03003751 }},
Patrick Boettcher01373a52007-07-30 12:49:04 -03003752 .size_of_priv = sizeof(struct dib0700_adapter_state),
3753 },
3754 },
3755
Patrick Boettcher1e13c8f2009-09-19 05:24:40 -03003756 .num_device_descs = 11,
Patrick Boettcher01373a52007-07-30 12:49:04 -03003757 .devices = {
3758 { "DiBcom STK7070P reference design",
3759 { &dib0700_usb_id_table[15], NULL },
3760 { NULL },
3761 },
3762 { "Pinnacle PCTV DVB-T Flash Stick",
3763 { &dib0700_usb_id_table[16], NULL },
3764 { NULL },
3765 },
Yousef Lamlum7999a812008-01-25 05:51:48 -03003766 { "Artec T14BR DVB-T",
3767 { &dib0700_usb_id_table[22], NULL },
3768 { NULL },
Daniel Gimpelevich132c3182008-01-25 06:02:42 -03003769 },
3770 { "ASUS My Cinema U3100 Mini DVBT Tuner",
3771 { &dib0700_usb_id_table[24], NULL },
3772 { NULL },
3773 },
Tim Taubertc7637b12008-01-25 06:16:36 -03003774 { "Hauppauge Nova-T Stick",
3775 { &dib0700_usb_id_table[25], NULL },
3776 { NULL },
3777 },
Darren Salt13b83b52008-01-25 06:20:02 -03003778 { "Hauppauge Nova-T MyTV.t",
3779 { &dib0700_usb_id_table[26], NULL },
3780 { NULL },
3781 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003782 { "Pinnacle PCTV 72e",
3783 { &dib0700_usb_id_table[29], NULL },
3784 { NULL },
3785 },
3786 { "Pinnacle PCTV 73e",
3787 { &dib0700_usb_id_table[30], NULL },
3788 { NULL },
3789 },
Klaus Flittner919a5482009-03-29 09:12:06 -03003790 { "Elgato EyeTV DTT",
3791 { &dib0700_usb_id_table[49], NULL },
3792 { NULL },
3793 },
Pascal Terjan9abb6e62009-02-26 10:31:41 -03003794 { "Yuan PD378S",
3795 { &dib0700_usb_id_table[45], NULL },
3796 { NULL },
3797 },
Armin Schenker513846e2009-04-20 11:57:49 -03003798 { "Elgato EyeTV Dtt Dlx PD378S",
3799 { &dib0700_usb_id_table[50], NULL },
3800 { NULL },
3801 },
Tim Taubertc7637b12008-01-25 06:16:36 -03003802 },
3803
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003804 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003805 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003806 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003807 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003808 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003809 .allowed_protos = RC_TYPE_RC5 |
3810 RC_TYPE_RC6 |
3811 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003812 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003813 },
Patrick Boettcher01373a52007-07-30 12:49:04 -03003814 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3815
Olivier Grenie74b76f22009-09-02 08:19:19 -03003816 .num_adapters = 1,
3817 .adapter = {
3818 {
Michael Krufky77eed212011-09-06 09:31:57 -03003819 .num_frontends = 1,
3820 .fe = {{
Mauro Carvalho Chehab648732f2009-11-04 12:11:43 -02003821 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3822 .pid_filter_count = 32,
3823 .pid_filter = stk70x0p_pid_filter,
3824 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier Grenie74b76f22009-09-02 08:19:19 -03003825 .frontend_attach = stk7070p_frontend_attach,
3826 .tuner_attach = dib7070p_tuner_attach,
3827
3828 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03003829 }},
Olivier Grenie74b76f22009-09-02 08:19:19 -03003830 .size_of_priv = sizeof(struct dib0700_adapter_state),
3831 },
3832 },
3833
Patrick Boettcher20232c42009-12-01 12:08:56 -03003834 .num_device_descs = 3,
Olivier Grenie74b76f22009-09-02 08:19:19 -03003835 .devices = {
3836 { "Pinnacle PCTV 73A",
3837 { &dib0700_usb_id_table[56], NULL },
3838 { NULL },
3839 },
3840 { "Pinnacle PCTV 73e SE",
Patrick Boettcher20232c42009-12-01 12:08:56 -03003841 { &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL },
Olivier Grenie74b76f22009-09-02 08:19:19 -03003842 { NULL },
3843 },
3844 { "Pinnacle PCTV 282e",
Patrick Boettcher20232c42009-12-01 12:08:56 -03003845 { &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL },
Olivier Grenie74b76f22009-09-02 08:19:19 -03003846 { NULL },
3847 },
3848 },
3849
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003850 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003851 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003852 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003853 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003854 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003855 .allowed_protos = RC_TYPE_RC5 |
3856 RC_TYPE_RC6 |
3857 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003858 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003859 },
Olivier Grenie74b76f22009-09-02 08:19:19 -03003860 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3861
Patrick Boettcher01373a52007-07-30 12:49:04 -03003862 .num_adapters = 2,
3863 .adapter = {
3864 {
Michael Krufky77eed212011-09-06 09:31:57 -03003865 .num_frontends = 1,
3866 .fe = {{
Olivier Grenief8731f42009-09-18 04:08:43 -03003867 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3868 .pid_filter_count = 32,
3869 .pid_filter = stk70x0p_pid_filter,
3870 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Patrick Boettcher01373a52007-07-30 12:49:04 -03003871 .frontend_attach = stk7070pd_frontend_attach0,
3872 .tuner_attach = dib7070p_tuner_attach,
3873
3874 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03003875 }},
Patrick Boettcher01373a52007-07-30 12:49:04 -03003876 .size_of_priv = sizeof(struct dib0700_adapter_state),
3877 }, {
Michael Krufky77eed212011-09-06 09:31:57 -03003878 .num_frontends = 1,
3879 .fe = {{
Olivier Grenief8731f42009-09-18 04:08:43 -03003880 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3881 .pid_filter_count = 32,
3882 .pid_filter = stk70x0p_pid_filter,
3883 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Patrick Boettcher01373a52007-07-30 12:49:04 -03003884 .frontend_attach = stk7070pd_frontend_attach1,
3885 .tuner_attach = dib7070p_tuner_attach,
3886
3887 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
Michael Krufky77eed212011-09-06 09:31:57 -03003888 }},
Patrick Boettcher01373a52007-07-30 12:49:04 -03003889 .size_of_priv = sizeof(struct dib0700_adapter_state),
3890 }
3891 },
3892
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003893 .num_device_descs = 6,
Patrick Boettcher01373a52007-07-30 12:49:04 -03003894 .devices = {
3895 { "DiBcom STK7070PD reference design",
3896 { &dib0700_usb_id_table[17], NULL },
3897 { NULL },
3898 },
3899 { "Pinnacle PCTV Dual DVB-T Diversity Stick",
3900 { &dib0700_usb_id_table[18], NULL },
3901 { NULL },
Michael Krufkyd01eb2d2008-07-03 23:43:36 -03003902 },
3903 { "Hauppauge Nova-TD Stick (52009)",
3904 { &dib0700_usb_id_table[35], NULL },
3905 { NULL },
Michael Krufky9a0c04a2008-09-03 17:12:24 -03003906 },
3907 { "Hauppauge Nova-TD-500 (84xxx)",
3908 { &dib0700_usb_id_table[36], NULL },
3909 { NULL },
Nicolas Fournierdb4b2d12009-01-13 07:15:25 -03003910 },
Patrick Boettchera9b8fe32009-05-20 05:35:02 -03003911 { "Terratec Cinergy DT USB XS Diversity/ T5",
3912 { &dib0700_usb_id_table[43],
3913 &dib0700_usb_id_table[53], NULL},
Nicolas Fournierdb4b2d12009-01-13 07:15:25 -03003914 { NULL },
sebastian.blanes@gmail.com0a6e1ed2009-02-24 14:51:43 -03003915 },
3916 { "Sony PlayTV",
3917 { &dib0700_usb_id_table[44], NULL },
3918 { NULL },
Michael Müller84e2f032010-04-26 22:18:57 -03003919 },
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003920 },
3921
3922 .rc.core = {
3923 .rc_interval = DEFAULT_RC_INTERVAL,
3924 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3925 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003926 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003927 .allowed_protos = RC_TYPE_RC5 |
3928 RC_TYPE_RC6 |
3929 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003930 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003931 },
3932 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3933
3934 .num_adapters = 2,
3935 .adapter = {
3936 {
Michael Krufky77eed212011-09-06 09:31:57 -03003937 .num_frontends = 1,
3938 .fe = {{
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003939 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3940 .pid_filter_count = 32,
3941 .pid_filter = stk70x0p_pid_filter,
3942 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3943 .frontend_attach = stk7070pd_frontend_attach0,
3944 .tuner_attach = dib7070p_tuner_attach,
3945
3946 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03003947 }},
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003948 .size_of_priv = sizeof(struct dib0700_adapter_state),
3949 }, {
Michael Krufky77eed212011-09-06 09:31:57 -03003950 .num_frontends = 1,
3951 .fe = {{
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003952 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3953 .pid_filter_count = 32,
3954 .pid_filter = stk70x0p_pid_filter,
3955 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
3956 .frontend_attach = stk7070pd_frontend_attach1,
3957 .tuner_attach = dib7070p_tuner_attach,
3958
3959 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
Michael Krufky77eed212011-09-06 09:31:57 -03003960 }},
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003961 .size_of_priv = sizeof(struct dib0700_adapter_state),
3962 }
3963 },
3964
3965 .num_device_descs = 1,
3966 .devices = {
Michael Müller84e2f032010-04-26 22:18:57 -03003967 { "Elgato EyeTV Diversity",
3968 { &dib0700_usb_id_table[68], NULL },
3969 { NULL },
3970 },
Arne Luehrsc985a8d2009-01-21 01:37:20 -03003971 },
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003972
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003973 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003974 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03003975 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03003976 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03003977 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03003978 .allowed_protos = RC_TYPE_RC5 |
3979 RC_TYPE_RC6 |
3980 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03003981 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03003982 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003983 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
3984
3985 .num_adapters = 1,
3986 .adapter = {
3987 {
Michael Krufky77eed212011-09-06 09:31:57 -03003988 .num_frontends = 1,
3989 .fe = {{
Olivier Grenief8731f42009-09-18 04:08:43 -03003990 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
3991 .pid_filter_count = 32,
3992 .pid_filter = stk70x0p_pid_filter,
3993 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003994 .frontend_attach = stk7700ph_frontend_attach,
3995 .tuner_attach = stk7700ph_tuner_attach,
3996
3997 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03003998 }},
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03003999 .size_of_priv = sizeof(struct
4000 dib0700_adapter_state),
4001 },
4002 },
4003
Pete Hildebrandtc53d83c2009-08-05 11:46:38 -03004004 .num_device_descs = 9,
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03004005 .devices = {
4006 { "Terratec Cinergy HT USB XE",
4007 { &dib0700_usb_id_table[27], NULL },
4008 { NULL },
4009 },
4010 { "Pinnacle Expresscard 320cx",
4011 { &dib0700_usb_id_table[28], NULL },
4012 { NULL },
4013 },
4014 { "Terratec Cinergy HT Express",
4015 { &dib0700_usb_id_table[32], NULL },
4016 { NULL },
4017 },
Finn Thain17a370b2008-09-06 13:42:47 -03004018 { "Gigabyte U8000-RH",
4019 { &dib0700_usb_id_table[37], NULL },
4020 { NULL },
4021 },
Daniel Oliveira Nascimento8751aaa2008-09-07 12:39:44 -03004022 { "YUAN High-Tech STK7700PH",
4023 { &dib0700_usb_id_table[38], NULL },
4024 { NULL },
4025 },
Albert Comerma57697432008-09-07 12:43:33 -03004026 { "Asus My Cinema-U3000Hybrid",
4027 { &dib0700_usb_id_table[39], NULL },
4028 { NULL },
4029 },
Xoan Loureiro16ba1ee2009-03-29 08:43:36 -03004030 { "YUAN High-Tech MC770",
4031 { &dib0700_usb_id_table[48], NULL },
4032 { NULL },
4033 },
tomas petrf0f4ae72009-05-20 05:28:05 -03004034 { "Leadtek WinFast DTV Dongle H",
4035 { &dib0700_usb_id_table[51], NULL },
4036 { NULL },
4037 },
Pete Hildebrandtc53d83c2009-08-05 11:46:38 -03004038 { "YUAN High-Tech STK7700D",
4039 { &dib0700_usb_id_table[54], NULL },
4040 { NULL },
4041 },
Albert Comerma6ca8f0b2008-03-29 21:35:57 -03004042 },
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03004043
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03004044 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03004045 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03004046 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03004047 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03004048 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03004049 .allowed_protos = RC_TYPE_RC5 |
4050 RC_TYPE_RC6 |
4051 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03004052 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03004053 },
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03004054 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4055 .num_adapters = 1,
4056 .adapter = {
4057 {
Michael Krufky77eed212011-09-06 09:31:57 -03004058 .num_frontends = 1,
4059 .fe = {{
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03004060 .frontend_attach = s5h1411_frontend_attach,
4061 .tuner_attach = xc5000_tuner_attach,
4062
4063 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03004064 }},
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03004065 .size_of_priv = sizeof(struct
4066 dib0700_adapter_state),
4067 },
4068 },
4069
Devin Heitmuellerd2fc3bf2008-09-25 06:22:23 -03004070 .num_device_descs = 2,
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03004071 .devices = {
4072 { "Pinnacle PCTV HD Pro USB Stick",
4073 { &dib0700_usb_id_table[40], NULL },
4074 { NULL },
4075 },
Devin Heitmuellerd2fc3bf2008-09-25 06:22:23 -03004076 { "Pinnacle PCTV HD USB Stick",
4077 { &dib0700_usb_id_table[41], NULL },
4078 { NULL },
4079 },
Devin Heitmuellercb22cb52008-09-08 05:42:42 -03004080 },
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03004081
4082 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03004083 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03004084 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03004085 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03004086 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03004087 .allowed_protos = RC_TYPE_RC5 |
4088 RC_TYPE_RC6 |
4089 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03004090 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03004091 },
Michael Krufkyce904bc2009-01-19 01:12:55 -03004092 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4093 .num_adapters = 1,
4094 .adapter = {
4095 {
Michael Krufky77eed212011-09-06 09:31:57 -03004096 .num_frontends = 1,
4097 .fe = {{
Michael Krufkyce904bc2009-01-19 01:12:55 -03004098 .frontend_attach = lgdt3305_frontend_attach,
4099 .tuner_attach = mxl5007t_tuner_attach,
4100
4101 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03004102 }},
Michael Krufkyce904bc2009-01-19 01:12:55 -03004103 .size_of_priv = sizeof(struct
4104 dib0700_adapter_state),
4105 },
4106 },
4107
4108 .num_device_descs = 2,
4109 .devices = {
4110 { "Hauppauge ATSC MiniCard (B200)",
4111 { &dib0700_usb_id_table[46], NULL },
4112 { NULL },
4113 },
4114 { "Hauppauge ATSC MiniCard (B210)",
4115 { &dib0700_usb_id_table[47], NULL },
4116 { NULL },
4117 },
4118 },
Olivier Grenied300bd62009-09-15 06:55:35 -03004119 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4120
4121 .num_adapters = 1,
4122 .adapter = {
4123 {
Michael Krufky77eed212011-09-06 09:31:57 -03004124 .num_frontends = 1,
4125 .fe = {{
Olivier Grenief8731f42009-09-18 04:08:43 -03004126 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4127 .pid_filter_count = 32,
4128 .pid_filter = stk70x0p_pid_filter,
4129 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
Olivier Grenie90e12ce2010-09-07 12:50:45 -03004130 .frontend_attach = stk7770p_frontend_attach,
Olivier Grenied300bd62009-09-15 06:55:35 -03004131 .tuner_attach = dib7770p_tuner_attach,
4132
4133 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03004134 }},
Olivier Grenied300bd62009-09-15 06:55:35 -03004135 .size_of_priv =
Patrick Boettcherdb481382009-09-15 07:16:51 -03004136 sizeof(struct dib0700_adapter_state),
Olivier Grenied300bd62009-09-15 06:55:35 -03004137 },
4138 },
4139
Stéphane Elmalehd1402302011-05-21 07:33:38 -03004140 .num_device_descs = 4,
Olivier Grenied300bd62009-09-15 06:55:35 -03004141 .devices = {
4142 { "DiBcom STK7770P reference design",
4143 { &dib0700_usb_id_table[59], NULL },
4144 { NULL },
4145 },
Patrick Boettcher1e13c8f2009-09-19 05:24:40 -03004146 { "Terratec Cinergy T USB XXS (HD)/ T3",
4147 { &dib0700_usb_id_table[33],
4148 &dib0700_usb_id_table[52],
4149 &dib0700_usb_id_table[60], NULL},
Patrick Boettcherdb481382009-09-15 07:16:51 -03004150 { NULL },
4151 },
Lukas Max Fisch498e6772011-02-08 16:51:45 -03004152 { "TechniSat AirStar TeleStick 2",
4153 { &dib0700_usb_id_table[74], NULL },
4154 { NULL },
4155 },
Stéphane Elmalehd1402302011-05-21 07:33:38 -03004156 { "Medion CTX1921 DVB-T USB",
4157 { &dib0700_usb_id_table[75], NULL },
4158 { NULL },
4159 },
Olivier Grenied300bd62009-09-15 06:55:35 -03004160 },
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03004161
4162 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03004163 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03004164 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03004165 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03004166 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03004167 .allowed_protos = RC_TYPE_RC5 |
4168 RC_TYPE_RC6 |
4169 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03004170 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03004171 },
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03004172 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4173 .num_adapters = 1,
4174 .adapter = {
4175 {
Michael Krufky77eed212011-09-06 09:31:57 -03004176 .num_frontends = 1,
4177 .fe = {{
Olivier Grenief8731f42009-09-18 04:08:43 -03004178 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4179 .pid_filter_count = 32,
Olivier Grenie03245a52009-12-04 13:27:57 -03004180 .pid_filter = stk80xx_pid_filter,
4181 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03004182 .frontend_attach = stk807x_frontend_attach,
4183 .tuner_attach = dib807x_tuner_attach,
4184
4185 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03004186 }},
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03004187 .size_of_priv =
4188 sizeof(struct dib0700_adapter_state),
4189 },
4190 },
4191
S?rgio Fortier8a378e82009-09-28 04:19:21 -03004192 .num_device_descs = 3,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03004193 .devices = {
4194 { "DiBcom STK807xP reference design",
4195 { &dib0700_usb_id_table[62], NULL },
4196 { NULL },
4197 },
Mauro Carvalho Chehabaaeab302009-09-16 09:18:26 -03004198 { "Prolink Pixelview SBTVD",
4199 { &dib0700_usb_id_table[63], NULL },
4200 { NULL },
4201 },
S?rgio Fortier8a378e82009-09-28 04:19:21 -03004202 { "EvolutePC TVWay+",
4203 { &dib0700_usb_id_table[64], NULL },
4204 { NULL },
4205 },
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03004206 },
4207
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03004208 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03004209 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03004210 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03004211 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03004212 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03004213 .allowed_protos = RC_TYPE_RC5 |
4214 RC_TYPE_RC6 |
4215 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03004216 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03004217 },
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03004218 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4219 .num_adapters = 2,
4220 .adapter = {
4221 {
Michael Krufky77eed212011-09-06 09:31:57 -03004222 .num_frontends = 1,
4223 .fe = {{
Olivier Grenief8731f42009-09-18 04:08:43 -03004224 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4225 .pid_filter_count = 32,
Olivier Grenie03245a52009-12-04 13:27:57 -03004226 .pid_filter = stk80xx_pid_filter,
4227 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03004228 .frontend_attach = stk807xpvr_frontend_attach0,
4229 .tuner_attach = dib807x_tuner_attach,
4230
4231 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03004232 }},
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03004233 .size_of_priv =
4234 sizeof(struct dib0700_adapter_state),
4235 },
4236 {
Michael Krufky77eed212011-09-06 09:31:57 -03004237 .num_frontends = 1,
4238 .fe = {{
Olivier Grenief8731f42009-09-18 04:08:43 -03004239 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4240 .pid_filter_count = 32,
Olivier Grenie03245a52009-12-04 13:27:57 -03004241 .pid_filter = stk80xx_pid_filter,
4242 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03004243 .frontend_attach = stk807xpvr_frontend_attach1,
4244 .tuner_attach = dib807x_tuner_attach,
4245
4246 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
Michael Krufky77eed212011-09-06 09:31:57 -03004247 }},
Patrick Boettcherba3fe3a2009-09-16 09:51:30 -03004248 .size_of_priv =
4249 sizeof(struct dib0700_adapter_state),
4250 },
4251 },
4252
4253 .num_device_descs = 1,
4254 .devices = {
4255 { "DiBcom STK807xPVR reference design",
4256 { &dib0700_usb_id_table[61], NULL },
4257 { NULL },
4258 },
4259 },
4260
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03004261 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03004262 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03004263 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03004264 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03004265 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03004266 .allowed_protos = RC_TYPE_RC5 |
4267 RC_TYPE_RC6 |
4268 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03004269 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03004270 },
Olivier Grenie03245a52009-12-04 13:27:57 -03004271 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4272 .num_adapters = 1,
4273 .adapter = {
4274 {
Michael Krufky77eed212011-09-06 09:31:57 -03004275 .num_frontends = 1,
4276 .fe = {{
Olivier Grenie03245a52009-12-04 13:27:57 -03004277 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4278 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4279 .pid_filter_count = 32,
4280 .pid_filter = stk80xx_pid_filter,
4281 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4282 .frontend_attach = stk809x_frontend_attach,
4283 .tuner_attach = dib809x_tuner_attach,
4284
4285 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03004286 }},
Olivier Grenie03245a52009-12-04 13:27:57 -03004287 .size_of_priv =
4288 sizeof(struct dib0700_adapter_state),
4289 },
4290 },
4291
4292 .num_device_descs = 1,
4293 .devices = {
4294 { "DiBcom STK8096GP reference design",
4295 { &dib0700_usb_id_table[67], NULL },
4296 { NULL },
4297 },
4298 },
4299
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03004300 .rc.core = {
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03004301 .rc_interval = DEFAULT_RC_INTERVAL,
Mauro Carvalho Chehab5af935c2010-08-01 08:02:35 -03004302 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
Mauro Carvalho Chehab72b39312010-07-31 22:56:00 -03004303 .module_name = "dib0700",
Mauro Carvalho Chehab0ffd1ab2010-08-01 09:37:23 -03004304 .rc_query = dib0700_rc_query_old_firmware,
Mauro Carvalho Chehab52b66142010-11-17 14:20:52 -03004305 .allowed_protos = RC_TYPE_RC5 |
4306 RC_TYPE_RC6 |
4307 RC_TYPE_NEC,
David Härdemand8b4b582010-10-29 16:08:23 -03004308 .change_protocol = dib0700_change_protocol,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03004309 },
Olivier Greniebe9bae12011-01-04 05:42:19 -03004310 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4311 .num_adapters = 1,
4312 .adapter = {
4313 {
Michael Krufky77eed212011-09-06 09:31:57 -03004314 .num_frontends = 1,
4315 .fe = {{
Olivier Greniebe9bae12011-01-04 05:42:19 -03004316 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4317 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4318 .pid_filter_count = 32,
4319 .pid_filter = dib90x0_pid_filter,
4320 .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
4321 .frontend_attach = stk9090m_frontend_attach,
4322 .tuner_attach = dib9090_tuner_attach,
4323
4324 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03004325 }},
Olivier Greniebe9bae12011-01-04 05:42:19 -03004326 .size_of_priv =
4327 sizeof(struct dib0700_adapter_state),
4328 },
4329 },
4330
4331 .num_device_descs = 1,
4332 .devices = {
4333 { "DiBcom STK9090M reference design",
4334 { &dib0700_usb_id_table[69], NULL },
4335 { NULL },
4336 },
4337 },
4338
4339 .rc.core = {
4340 .rc_interval = DEFAULT_RC_INTERVAL,
4341 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4342 .module_name = "dib0700",
4343 .rc_query = dib0700_rc_query_old_firmware,
4344 .allowed_protos = RC_TYPE_RC5 |
4345 RC_TYPE_RC6 |
4346 RC_TYPE_NEC,
4347 .change_protocol = dib0700_change_protocol,
4348 },
4349 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4350 .num_adapters = 1,
4351 .adapter = {
4352 {
Michael Krufky77eed212011-09-06 09:31:57 -03004353 .num_frontends = 1,
4354 .fe = {{
Olivier Greniebe9bae12011-01-04 05:42:19 -03004355 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4356 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4357 .pid_filter_count = 32,
4358 .pid_filter = stk80xx_pid_filter,
4359 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4360 .frontend_attach = nim8096md_frontend_attach,
4361 .tuner_attach = nim8096md_tuner_attach,
4362
4363 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03004364 }},
Olivier Greniebe9bae12011-01-04 05:42:19 -03004365 .size_of_priv =
4366 sizeof(struct dib0700_adapter_state),
4367 },
4368 },
4369
4370 .num_device_descs = 1,
4371 .devices = {
4372 { "DiBcom NIM8096MD reference design",
4373 { &dib0700_usb_id_table[70], NULL },
4374 { NULL },
4375 },
4376 },
4377
4378 .rc.core = {
4379 .rc_interval = DEFAULT_RC_INTERVAL,
4380 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4381 .module_name = "dib0700",
4382 .rc_query = dib0700_rc_query_old_firmware,
4383 .allowed_protos = RC_TYPE_RC5 |
4384 RC_TYPE_RC6 |
4385 RC_TYPE_NEC,
4386 .change_protocol = dib0700_change_protocol,
4387 },
4388 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4389 .num_adapters = 1,
4390 .adapter = {
4391 {
Michael Krufky77eed212011-09-06 09:31:57 -03004392 .num_frontends = 1,
4393 .fe = {{
Olivier Greniebe9bae12011-01-04 05:42:19 -03004394 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4395 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4396 .pid_filter_count = 32,
4397 .pid_filter = dib90x0_pid_filter,
4398 .pid_filter_ctrl = dib90x0_pid_filter_ctrl,
4399 .frontend_attach = nim9090md_frontend_attach,
4400 .tuner_attach = nim9090md_tuner_attach,
4401
4402 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03004403 }},
Olivier Greniebe9bae12011-01-04 05:42:19 -03004404 .size_of_priv =
4405 sizeof(struct dib0700_adapter_state),
4406 },
4407 },
4408
4409 .num_device_descs = 1,
4410 .devices = {
4411 { "DiBcom NIM9090MD reference design",
4412 { &dib0700_usb_id_table[71], NULL },
4413 { NULL },
4414 },
4415 },
4416
4417 .rc.core = {
4418 .rc_interval = DEFAULT_RC_INTERVAL,
4419 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4420 .module_name = "dib0700",
4421 .rc_query = dib0700_rc_query_old_firmware,
4422 .allowed_protos = RC_TYPE_RC5 |
4423 RC_TYPE_RC6 |
4424 RC_TYPE_NEC,
4425 .change_protocol = dib0700_change_protocol,
4426 },
4427 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4428 .num_adapters = 1,
4429 .adapter = {
4430 {
Michael Krufky77eed212011-09-06 09:31:57 -03004431 .num_frontends = 1,
4432 .fe = {{
Olivier Greniebe9bae12011-01-04 05:42:19 -03004433 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4434 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4435 .pid_filter_count = 32,
4436 .pid_filter = stk70x0p_pid_filter,
4437 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4438 .frontend_attach = nim7090_frontend_attach,
4439 .tuner_attach = nim7090_tuner_attach,
4440
4441 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03004442 }},
Olivier Greniebe9bae12011-01-04 05:42:19 -03004443 .size_of_priv =
4444 sizeof(struct dib0700_adapter_state),
4445 },
4446 },
4447
4448 .num_device_descs = 1,
4449 .devices = {
4450 { "DiBcom NIM7090 reference design",
4451 { &dib0700_usb_id_table[72], NULL },
4452 { NULL },
4453 },
4454 },
4455
4456 .rc.core = {
4457 .rc_interval = DEFAULT_RC_INTERVAL,
4458 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4459 .module_name = "dib0700",
4460 .rc_query = dib0700_rc_query_old_firmware,
4461 .allowed_protos = RC_TYPE_RC5 |
4462 RC_TYPE_RC6 |
4463 RC_TYPE_NEC,
4464 .change_protocol = dib0700_change_protocol,
4465 },
4466 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4467 .num_adapters = 2,
4468 .adapter = {
4469 {
Michael Krufky77eed212011-09-06 09:31:57 -03004470 .num_frontends = 1,
4471 .fe = {{
Olivier Greniebe9bae12011-01-04 05:42:19 -03004472 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4473 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4474 .pid_filter_count = 32,
4475 .pid_filter = stk70x0p_pid_filter,
4476 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4477 .frontend_attach = tfe7090pvr_frontend0_attach,
4478 .tuner_attach = tfe7090pvr_tuner0_attach,
4479
4480 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
Michael Krufky77eed212011-09-06 09:31:57 -03004481 }},
Olivier Greniebe9bae12011-01-04 05:42:19 -03004482 .size_of_priv =
4483 sizeof(struct dib0700_adapter_state),
4484 },
4485 {
Michael Krufky77eed212011-09-06 09:31:57 -03004486 .num_frontends = 1,
4487 .fe = {{
Olivier Greniebe9bae12011-01-04 05:42:19 -03004488 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4489 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4490 .pid_filter_count = 32,
4491 .pid_filter = stk70x0p_pid_filter,
4492 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4493 .frontend_attach = tfe7090pvr_frontend1_attach,
4494 .tuner_attach = tfe7090pvr_tuner1_attach,
4495
4496 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03004497 }},
Olivier Greniebe9bae12011-01-04 05:42:19 -03004498 .size_of_priv =
4499 sizeof(struct dib0700_adapter_state),
4500 },
4501 },
4502
4503 .num_device_descs = 1,
4504 .devices = {
4505 { "DiBcom TFE7090PVR reference design",
4506 { &dib0700_usb_id_table[73], NULL },
4507 { NULL },
4508 },
4509 },
4510
4511 .rc.core = {
4512 .rc_interval = DEFAULT_RC_INTERVAL,
4513 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4514 .module_name = "dib0700",
4515 .rc_query = dib0700_rc_query_old_firmware,
4516 .allowed_protos = RC_TYPE_RC5 |
4517 RC_TYPE_RC6 |
4518 RC_TYPE_NEC,
4519 .change_protocol = dib0700_change_protocol,
4520 },
Davide Ferri8d009a02009-06-23 22:34:06 -03004521 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4522 .num_adapters = 1,
4523 .adapter = {
4524 {
Michael Krufky77eed212011-09-06 09:31:57 -03004525 .num_frontends = 1,
4526 .fe = {{
Devin Heitmueller01f16262009-06-24 00:07:01 -03004527 .frontend_attach = pctv340e_frontend_attach,
Davide Ferri8d009a02009-06-23 22:34:06 -03004528 .tuner_attach = xc4000_tuner_attach,
4529
4530 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Michael Krufky77eed212011-09-06 09:31:57 -03004531 }},
Davide Ferri8d009a02009-06-23 22:34:06 -03004532 .size_of_priv = sizeof(struct
4533 dib0700_adapter_state),
4534 },
4535 },
4536
Devin Heitmueller33fb1682009-06-23 22:48:02 -03004537 .num_device_descs = 2,
Davide Ferri8d009a02009-06-23 22:34:06 -03004538 .devices = {
4539 { "Pinnacle PCTV 340e HD Pro USB Stick",
4540 { &dib0700_usb_id_table[76], NULL },
4541 { NULL },
4542 },
Devin Heitmueller33fb1682009-06-23 22:48:02 -03004543 { "Pinnacle PCTV Hybrid Stick Solo",
4544 { &dib0700_usb_id_table[77], NULL },
4545 { NULL },
4546 },
Davide Ferri8d009a02009-06-23 22:34:06 -03004547 },
4548 .rc.core = {
4549 .rc_interval = DEFAULT_RC_INTERVAL,
4550 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4551 .module_name = "dib0700",
4552 .rc_query = dib0700_rc_query_old_firmware,
4553 .allowed_protos = RC_TYPE_RC5 |
4554 RC_TYPE_RC6 |
4555 RC_TYPE_NEC,
4556 .change_protocol = dib0700_change_protocol,
4557 },
Olivier Grenie6724a2f2011-08-05 13:49:33 -03004558 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4559 .num_adapters = 1,
4560 .adapter = {
4561 {
4562 .num_frontends = 1,
4563 .fe = {{
4564 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4565 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4566 .pid_filter_count = 32,
4567 .pid_filter = stk70x0p_pid_filter,
4568 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4569 .frontend_attach = tfe7090e_frontend_attach,
4570 .tuner_attach = tfe7090e_tuner_attach,
4571
4572 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4573 } },
4574
4575 .size_of_priv =
4576 sizeof(struct dib0700_adapter_state),
4577 },
4578 },
4579
4580 .num_device_descs = 1,
4581 .devices = {
4582 { "DiBcom TFE7090E reference design",
4583 { &dib0700_usb_id_table[78], NULL },
4584 { NULL },
4585 },
4586 },
4587
4588 .rc.core = {
4589 .rc_interval = DEFAULT_RC_INTERVAL,
4590 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4591 .module_name = "dib0700",
4592 .rc_query = dib0700_rc_query_old_firmware,
4593 .allowed_protos = RC_TYPE_RC5 |
4594 RC_TYPE_RC6 |
4595 RC_TYPE_NEC,
4596 .change_protocol = dib0700_change_protocol,
4597 },
Olivier Grenieb293f302011-08-09 04:48:25 -03004598 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4599 .num_adapters = 1,
4600 .adapter = {
4601 {
4602 .num_frontends = 1,
4603 .fe = {{
4604 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4605 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4606 .pid_filter_count = 32,
4607 .pid_filter = stk70x0p_pid_filter,
4608 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
4609 .frontend_attach = tfe7790e_frontend_attach,
4610 .tuner_attach = tfe7790e_tuner_attach,
4611
4612 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
4613 } },
4614
4615 .size_of_priv =
4616 sizeof(struct dib0700_adapter_state),
4617 },
4618 },
4619
4620 .num_device_descs = 1,
4621 .devices = {
4622 { "DiBcom TFE7790E reference design",
4623 { &dib0700_usb_id_table[79], NULL },
4624 { NULL },
4625 },
4626 },
4627
4628 .rc.core = {
4629 .rc_interval = DEFAULT_RC_INTERVAL,
4630 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4631 .module_name = "dib0700",
4632 .rc_query = dib0700_rc_query_old_firmware,
4633 .allowed_protos = RC_TYPE_RC5 |
4634 RC_TYPE_RC6 |
4635 RC_TYPE_NEC,
4636 .change_protocol = dib0700_change_protocol,
4637 },
Olivier Grenie88f3a352011-08-10 05:28:38 -03004638 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
4639 .num_adapters = 1,
4640 .adapter = {
4641 {
4642 .num_frontends = 1,
4643 .fe = {{
4644 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
4645 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
4646 .pid_filter_count = 32,
4647 .pid_filter = stk80xx_pid_filter,
4648 .pid_filter_ctrl = stk80xx_pid_filter_ctrl,
4649 .frontend_attach = tfe8096p_frontend_attach,
4650 .tuner_attach = tfe8096p_tuner_attach,
4651
4652 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
4653
4654 } },
4655
4656 .size_of_priv =
4657 sizeof(struct dib0700_adapter_state),
4658 },
4659 },
4660
4661 .num_device_descs = 1,
4662 .devices = {
4663 { "DiBcom TFE8096P reference design",
4664 { &dib0700_usb_id_table[80], NULL },
4665 { NULL },
4666 },
4667 },
4668
4669 .rc.core = {
4670 .rc_interval = DEFAULT_RC_INTERVAL,
4671 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4672 .module_name = "dib0700",
4673 .rc_query = dib0700_rc_query_old_firmware,
4674 .allowed_protos = RC_TYPE_RC5 |
4675 RC_TYPE_RC6 |
4676 RC_TYPE_NEC,
4677 .change_protocol = dib0700_change_protocol,
4678 },
Patrick Boettcher01373a52007-07-30 12:49:04 -03004679 },
Patrick Boettcherb7f54912006-09-19 12:51:37 -03004680};
4681
4682int dib0700_device_count = ARRAY_SIZE(dib0700_devices);