blob: d8a5ebb436260d845905a69480a0fe2056184f7d [file] [log] [blame]
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001/* DVB USB framework compliant Linux driver for the
Igor M. Liplianin2f30fb42011-02-25 18:41:23 -03002 * DVBWorld DVB-S 2101, 2102, DVB-S2 2104, DVB-C 3101,
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03003 * TeVii S600, S630, S650, S660, S480, S421, S632
Igor M. Liplianin2f30fb42011-02-25 18:41:23 -03004 * Prof 1100, 7500,
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03005 * Geniatech SU3000 Cards
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03006 * Copyright (C) 2008-2012 Igor M. Liplianin (liplianin@me.by)
Igor M. Liplianin2f30fb42011-02-25 18:41:23 -03007 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation, version 2.
11 *
12 * see Documentation/dvb/README.dvb-usb for more information
13 */
Igor M Liplianin7fd48282008-07-20 08:05:50 -030014#include "dw2102.h"
Igor M. Liplianin21b007b2008-09-17 19:19:19 -030015#include "si21xx.h"
Igor M Liplianin7fd48282008-07-20 08:05:50 -030016#include "stv0299.h"
17#include "z0194a.h"
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -030018#include "stv0288.h"
19#include "stb6000.h"
20#include "eds1547.h"
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -030021#include "cx24116.h"
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -030022#include "tda1002x.h"
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -030023#include "mt312.h"
24#include "zl10039.h"
Konstantin Dimitrov73f0af42012-12-23 19:25:38 -030025#include "ts2020.h"
Igor M. Liplianin141cc352009-11-27 14:37:35 -030026#include "ds3000.h"
27#include "stv0900.h"
28#include "stv6110.h"
29#include "stb6100.h"
30#include "stb6100_proc.h"
Igor M. Liplianin955d00a2012-05-08 03:53:17 -030031#include "m88rs2000.h"
Igor M Liplianin7fd48282008-07-20 08:05:50 -030032
33#ifndef USB_PID_DW2102
34#define USB_PID_DW2102 0x2102
35#endif
36
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -030037#ifndef USB_PID_DW2104
38#define USB_PID_DW2104 0x2104
39#endif
40
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -030041#ifndef USB_PID_DW3101
42#define USB_PID_DW3101 0x3101
43#endif
44
Igor M. Liplianin4cc0edf2008-11-05 22:12:56 -030045#ifndef USB_PID_CINERGY_S
46#define USB_PID_CINERGY_S 0x0064
47#endif
48
Igor M. Liplianin141cc352009-11-27 14:37:35 -030049#ifndef USB_PID_TEVII_S630
50#define USB_PID_TEVII_S630 0xd630
51#endif
52
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -030053#ifndef USB_PID_TEVII_S650
54#define USB_PID_TEVII_S650 0xd650
55#endif
56
Igor M. Liplianin141cc352009-11-27 14:37:35 -030057#ifndef USB_PID_TEVII_S660
58#define USB_PID_TEVII_S660 0xd660
59#endif
60
Igor M. Liplianine8f50552011-02-25 18:41:23 -030061#ifndef USB_PID_TEVII_S480_1
62#define USB_PID_TEVII_S480_1 0xd481
63#endif
64
65#ifndef USB_PID_TEVII_S480_2
66#define USB_PID_TEVII_S480_2 0xd482
67#endif
68
Igor M. Liplianin141cc352009-11-27 14:37:35 -030069#ifndef USB_PID_PROF_1100
70#define USB_PID_PROF_1100 0xb012
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -030071#endif
72
Igor M. Liplianin955d00a2012-05-08 03:53:17 -030073#ifndef USB_PID_TEVII_S421
74#define USB_PID_TEVII_S421 0xd421
75#endif
76
77#ifndef USB_PID_TEVII_S632
78#define USB_PID_TEVII_S632 0xd632
79#endif
80
Igor M. Liplianin21b007b2008-09-17 19:19:19 -030081#define DW210X_READ_MSG 0
82#define DW210X_WRITE_MSG 1
Igor M Liplianin7fd48282008-07-20 08:05:50 -030083
84#define REG_1F_SYMBOLRATE_BYTE0 0x1f
85#define REG_20_SYMBOLRATE_BYTE1 0x20
86#define REG_21_SYMBOLRATE_BYTE2 0x21
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -030087/* on my own*/
Igor M Liplianin7fd48282008-07-20 08:05:50 -030088#define DW2102_VOLTAGE_CTRL (0x1800)
Igor M. Liplianind2ffc442011-02-25 18:41:22 -030089#define SU3000_STREAM_CTRL (0x1900)
Igor M Liplianin7fd48282008-07-20 08:05:50 -030090#define DW2102_RC_QUERY (0x1a00)
Igor M. Liplianinfa8bae12011-02-25 18:41:22 -030091#define DW2102_LED_CTRL (0x1b00)
Igor M Liplianin7fd48282008-07-20 08:05:50 -030092
Rémi Cardona68236272012-09-28 08:59:32 -030093#define DW2101_FIRMWARE "dvb-usb-dw2101.fw"
94#define DW2102_FIRMWARE "dvb-usb-dw2102.fw"
95#define DW2104_FIRMWARE "dvb-usb-dw2104.fw"
96#define DW3101_FIRMWARE "dvb-usb-dw3101.fw"
97#define S630_FIRMWARE "dvb-usb-s630.fw"
98#define S660_FIRMWARE "dvb-usb-s660.fw"
99#define P1100_FIRMWARE "dvb-usb-p1100.fw"
100#define P7500_FIRMWARE "dvb-usb-p7500.fw"
101
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300102#define err_str "did not find the firmware file. (%s) " \
103 "Please see linux/Documentation/dvb/ for more details " \
104 "on firmware-problems."
105
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -0300106struct rc_map_dvb_usb_table_table {
107 struct rc_map_table *rc_keys;
Igor M. Liplianinb42e1d72009-06-14 19:41:22 -0300108 int rc_keys_size;
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300109};
110
Igor M. Liplianind2ffc442011-02-25 18:41:22 -0300111struct su3000_state {
112 u8 initialized;
113};
114
Igor M. Liplianin52c506e2011-02-25 18:41:23 -0300115struct s6x0_state {
116 int (*old_set_voltage)(struct dvb_frontend *f, fe_sec_voltage_t v);
117};
118
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300119/* debug */
120static int dvb_usb_dw2102_debug;
121module_param_named(debug, dvb_usb_dw2102_debug, int, 0644);
Igor M. Liplianin8a8dad72009-06-13 08:10:24 -0300122MODULE_PARM_DESC(debug, "set debugging level (1=info 2=xfer 4=rc(or-able))."
123 DVB_USB_DEBUG_STATUS);
124
Igor M. Liplianinb42e1d72009-06-14 19:41:22 -0300125/* keymaps */
126static int ir_keymap;
127module_param_named(keymap, ir_keymap, int, 0644);
Igor M. Liplianinfeb16e92011-02-25 18:41:22 -0300128MODULE_PARM_DESC(keymap, "set keymap 0=default 1=dvbworld 2=tevii 3=tbs ..."
129 " 256=none");
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300130
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300131/* demod probe */
132static int demod_probe = 1;
133module_param_named(demod, demod_probe, int, 0644);
134MODULE_PARM_DESC(demod, "demod to probe (1=cx24116 2=stv0903+stv6110 "
135 "4=stv0903+stb6100(or-able)).");
136
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300137DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
138
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300139static int dw210x_op_rw(struct usb_device *dev, u8 request, u16 value,
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300140 u16 index, u8 * data, u16 len, int flags)
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300141{
142 int ret;
Florian Micklerb47b8502011-03-21 15:33:44 -0300143 u8 *u8buf;
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300144 unsigned int pipe = (flags == DW210X_READ_MSG) ?
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300145 usb_rcvctrlpipe(dev, 0) : usb_sndctrlpipe(dev, 0);
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300146 u8 request_type = (flags == DW210X_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT;
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300147
Florian Micklerb47b8502011-03-21 15:33:44 -0300148 u8buf = kmalloc(len, GFP_KERNEL);
149 if (!u8buf)
150 return -ENOMEM;
151
152
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300153 if (flags == DW210X_WRITE_MSG)
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300154 memcpy(u8buf, data, len);
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300155 ret = usb_control_msg(dev, pipe, request, request_type | USB_TYPE_VENDOR,
156 value, index , u8buf, len, 2000);
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300157
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300158 if (flags == DW210X_READ_MSG)
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300159 memcpy(data, u8buf, len);
Florian Micklerb47b8502011-03-21 15:33:44 -0300160
161 kfree(u8buf);
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300162 return ret;
163}
164
165/* I2C */
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300166static int dw2102_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
167 int num)
168{
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -0300169 struct dvb_usb_device *d = i2c_get_adapdata(adap);
Hans Verkuild51dbec2012-04-20 03:30:11 -0300170 int i = 0;
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300171 u8 buf6[] = {0x2c, 0x05, 0xc0, 0, 0, 0, 0};
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300172 u16 value;
173
174 if (!d)
175 return -ENODEV;
176 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
177 return -EAGAIN;
178
179 switch (num) {
180 case 2:
181 /* read stv0299 register */
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300182 value = msg[0].buf[0];/* register */
183 for (i = 0; i < msg[1].len; i++) {
Hans Verkuild51dbec2012-04-20 03:30:11 -0300184 dw210x_op_rw(d->udev, 0xb5, value + i, 0,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300185 buf6, 2, DW210X_READ_MSG);
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300186 msg[1].buf[i] = buf6[0];
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300187 }
188 break;
189 case 1:
190 switch (msg[0].addr) {
191 case 0x68:
192 /* write to stv0299 register */
193 buf6[0] = 0x2a;
194 buf6[1] = msg[0].buf[0];
195 buf6[2] = msg[0].buf[1];
Hans Verkuild51dbec2012-04-20 03:30:11 -0300196 dw210x_op_rw(d->udev, 0xb2, 0, 0,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300197 buf6, 3, DW210X_WRITE_MSG);
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300198 break;
199 case 0x60:
200 if (msg[0].flags == 0) {
201 /* write to tuner pll */
202 buf6[0] = 0x2c;
203 buf6[1] = 5;
204 buf6[2] = 0xc0;
205 buf6[3] = msg[0].buf[0];
206 buf6[4] = msg[0].buf[1];
207 buf6[5] = msg[0].buf[2];
208 buf6[6] = msg[0].buf[3];
Hans Verkuild51dbec2012-04-20 03:30:11 -0300209 dw210x_op_rw(d->udev, 0xb2, 0, 0,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300210 buf6, 7, DW210X_WRITE_MSG);
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300211 } else {
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300212 /* read from tuner */
Hans Verkuild51dbec2012-04-20 03:30:11 -0300213 dw210x_op_rw(d->udev, 0xb5, 0, 0,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300214 buf6, 1, DW210X_READ_MSG);
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300215 msg[0].buf[0] = buf6[0];
216 }
217 break;
218 case (DW2102_RC_QUERY):
Hans Verkuild51dbec2012-04-20 03:30:11 -0300219 dw210x_op_rw(d->udev, 0xb8, 0, 0,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300220 buf6, 2, DW210X_READ_MSG);
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300221 msg[0].buf[0] = buf6[0];
222 msg[0].buf[1] = buf6[1];
223 break;
224 case (DW2102_VOLTAGE_CTRL):
225 buf6[0] = 0x30;
226 buf6[1] = msg[0].buf[0];
Hans Verkuild51dbec2012-04-20 03:30:11 -0300227 dw210x_op_rw(d->udev, 0xb2, 0, 0,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300228 buf6, 2, DW210X_WRITE_MSG);
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300229 break;
230 }
231
232 break;
233 }
234
235 mutex_unlock(&d->i2c_mutex);
236 return num;
237}
238
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300239static int dw2102_serit_i2c_transfer(struct i2c_adapter *adap,
240 struct i2c_msg msg[], int num)
241{
242 struct dvb_usb_device *d = i2c_get_adapdata(adap);
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300243 u8 buf6[] = {0, 0, 0, 0, 0, 0, 0};
244
245 if (!d)
246 return -ENODEV;
247 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
248 return -EAGAIN;
249
250 switch (num) {
251 case 2:
252 /* read si2109 register by number */
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300253 buf6[0] = msg[0].addr << 1;
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300254 buf6[1] = msg[0].len;
255 buf6[2] = msg[0].buf[0];
Hans Verkuild51dbec2012-04-20 03:30:11 -0300256 dw210x_op_rw(d->udev, 0xc2, 0, 0,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300257 buf6, msg[0].len + 2, DW210X_WRITE_MSG);
258 /* read si2109 register */
Hans Verkuild51dbec2012-04-20 03:30:11 -0300259 dw210x_op_rw(d->udev, 0xc3, 0xd0, 0,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300260 buf6, msg[1].len + 2, DW210X_READ_MSG);
261 memcpy(msg[1].buf, buf6 + 2, msg[1].len);
262
263 break;
264 case 1:
265 switch (msg[0].addr) {
266 case 0x68:
267 /* write to si2109 register */
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300268 buf6[0] = msg[0].addr << 1;
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300269 buf6[1] = msg[0].len;
270 memcpy(buf6 + 2, msg[0].buf, msg[0].len);
Hans Verkuild51dbec2012-04-20 03:30:11 -0300271 dw210x_op_rw(d->udev, 0xc2, 0, 0, buf6,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300272 msg[0].len + 2, DW210X_WRITE_MSG);
273 break;
274 case(DW2102_RC_QUERY):
Hans Verkuild51dbec2012-04-20 03:30:11 -0300275 dw210x_op_rw(d->udev, 0xb8, 0, 0,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300276 buf6, 2, DW210X_READ_MSG);
277 msg[0].buf[0] = buf6[0];
278 msg[0].buf[1] = buf6[1];
279 break;
280 case(DW2102_VOLTAGE_CTRL):
281 buf6[0] = 0x30;
282 buf6[1] = msg[0].buf[0];
Hans Verkuild51dbec2012-04-20 03:30:11 -0300283 dw210x_op_rw(d->udev, 0xb2, 0, 0,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300284 buf6, 2, DW210X_WRITE_MSG);
285 break;
286 }
287 break;
288 }
289
290 mutex_unlock(&d->i2c_mutex);
291 return num;
292}
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -0300293
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -0300294static int dw2102_earda_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
295{
296 struct dvb_usb_device *d = i2c_get_adapdata(adap);
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -0300297
298 if (!d)
299 return -ENODEV;
300 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
301 return -EAGAIN;
302
303 switch (num) {
304 case 2: {
305 /* read */
306 /* first write first register number */
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -0300307 u8 ibuf[msg[1].len + 2], obuf[3];
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300308 obuf[0] = msg[0].addr << 1;
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -0300309 obuf[1] = msg[0].len;
310 obuf[2] = msg[0].buf[0];
Hans Verkuild51dbec2012-04-20 03:30:11 -0300311 dw210x_op_rw(d->udev, 0xc2, 0, 0,
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -0300312 obuf, msg[0].len + 2, DW210X_WRITE_MSG);
313 /* second read registers */
Hans Verkuild51dbec2012-04-20 03:30:11 -0300314 dw210x_op_rw(d->udev, 0xc3, 0xd1 , 0,
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -0300315 ibuf, msg[1].len + 2, DW210X_READ_MSG);
316 memcpy(msg[1].buf, ibuf + 2, msg[1].len);
317
318 break;
319 }
320 case 1:
321 switch (msg[0].addr) {
322 case 0x68: {
323 /* write to register */
324 u8 obuf[msg[0].len + 2];
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300325 obuf[0] = msg[0].addr << 1;
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -0300326 obuf[1] = msg[0].len;
327 memcpy(obuf + 2, msg[0].buf, msg[0].len);
Hans Verkuild51dbec2012-04-20 03:30:11 -0300328 dw210x_op_rw(d->udev, 0xc2, 0, 0,
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -0300329 obuf, msg[0].len + 2, DW210X_WRITE_MSG);
330 break;
331 }
332 case 0x61: {
333 /* write to tuner */
334 u8 obuf[msg[0].len + 2];
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300335 obuf[0] = msg[0].addr << 1;
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -0300336 obuf[1] = msg[0].len;
337 memcpy(obuf + 2, msg[0].buf, msg[0].len);
Hans Verkuild51dbec2012-04-20 03:30:11 -0300338 dw210x_op_rw(d->udev, 0xc2, 0, 0,
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -0300339 obuf, msg[0].len + 2, DW210X_WRITE_MSG);
340 break;
341 }
342 case(DW2102_RC_QUERY): {
343 u8 ibuf[2];
Hans Verkuild51dbec2012-04-20 03:30:11 -0300344 dw210x_op_rw(d->udev, 0xb8, 0, 0,
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -0300345 ibuf, 2, DW210X_READ_MSG);
346 memcpy(msg[0].buf, ibuf , 2);
347 break;
348 }
349 case(DW2102_VOLTAGE_CTRL): {
350 u8 obuf[2];
351 obuf[0] = 0x30;
352 obuf[1] = msg[0].buf[0];
Hans Verkuild51dbec2012-04-20 03:30:11 -0300353 dw210x_op_rw(d->udev, 0xb2, 0, 0,
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -0300354 obuf, 2, DW210X_WRITE_MSG);
355 break;
356 }
357 }
358
359 break;
360 }
361
362 mutex_unlock(&d->i2c_mutex);
363 return num;
364}
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300365
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300366static int dw2104_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
367{
368 struct dvb_usb_device *d = i2c_get_adapdata(adap);
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300369 int len, i, j;
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300370
371 if (!d)
372 return -ENODEV;
373 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
374 return -EAGAIN;
375
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300376 for (j = 0; j < num; j++) {
377 switch (msg[j].addr) {
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300378 case(DW2102_RC_QUERY): {
379 u8 ibuf[2];
Hans Verkuild51dbec2012-04-20 03:30:11 -0300380 dw210x_op_rw(d->udev, 0xb8, 0, 0,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300381 ibuf, 2, DW210X_READ_MSG);
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300382 memcpy(msg[j].buf, ibuf , 2);
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300383 break;
384 }
385 case(DW2102_VOLTAGE_CTRL): {
386 u8 obuf[2];
387 obuf[0] = 0x30;
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300388 obuf[1] = msg[j].buf[0];
Hans Verkuild51dbec2012-04-20 03:30:11 -0300389 dw210x_op_rw(d->udev, 0xb2, 0, 0,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300390 obuf, 2, DW210X_WRITE_MSG);
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300391 break;
392 }
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300393 /*case 0x55: cx24116
394 case 0x6a: stv0903
395 case 0x68: ds3000, stv0903
396 case 0x60: ts2020, stv6110, stb6100 */
397 default: {
398 if (msg[j].flags == I2C_M_RD) {
399 /* read registers */
400 u8 ibuf[msg[j].len + 2];
Hans Verkuild51dbec2012-04-20 03:30:11 -0300401 dw210x_op_rw(d->udev, 0xc3,
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300402 (msg[j].addr << 1) + 1, 0,
403 ibuf, msg[j].len + 2,
404 DW210X_READ_MSG);
405 memcpy(msg[j].buf, ibuf + 2, msg[j].len);
406 mdelay(10);
407 } else if (((msg[j].buf[0] == 0xb0) &&
408 (msg[j].addr == 0x68)) ||
409 ((msg[j].buf[0] == 0xf7) &&
410 (msg[j].addr == 0x55))) {
411 /* write firmware */
412 u8 obuf[19];
413 obuf[0] = msg[j].addr << 1;
414 obuf[1] = (msg[j].len > 15 ? 17 : msg[j].len);
415 obuf[2] = msg[j].buf[0];
416 len = msg[j].len - 1;
417 i = 1;
418 do {
419 memcpy(obuf + 3, msg[j].buf + i,
420 (len > 16 ? 16 : len));
Hans Verkuild51dbec2012-04-20 03:30:11 -0300421 dw210x_op_rw(d->udev, 0xc2, 0, 0,
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300422 obuf, (len > 16 ? 16 : len) + 3,
423 DW210X_WRITE_MSG);
424 i += 16;
425 len -= 16;
426 } while (len > 0);
427 } else {
428 /* write registers */
429 u8 obuf[msg[j].len + 2];
430 obuf[0] = msg[j].addr << 1;
431 obuf[1] = msg[j].len;
432 memcpy(obuf + 2, msg[j].buf, msg[j].len);
Hans Verkuild51dbec2012-04-20 03:30:11 -0300433 dw210x_op_rw(d->udev, 0xc2, 0, 0,
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300434 obuf, msg[j].len + 2,
435 DW210X_WRITE_MSG);
436 }
437 break;
438 }
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300439 }
440
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300441 }
442
443 mutex_unlock(&d->i2c_mutex);
444 return num;
445}
446
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -0300447static int dw3101_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
448 int num)
449{
450 struct dvb_usb_device *d = i2c_get_adapdata(adap);
Hans Verkuild51dbec2012-04-20 03:30:11 -0300451 int i;
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -0300452
453 if (!d)
454 return -ENODEV;
455 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
456 return -EAGAIN;
457
458 switch (num) {
459 case 2: {
460 /* read */
461 /* first write first register number */
462 u8 ibuf[msg[1].len + 2], obuf[3];
463 obuf[0] = msg[0].addr << 1;
464 obuf[1] = msg[0].len;
465 obuf[2] = msg[0].buf[0];
Hans Verkuild51dbec2012-04-20 03:30:11 -0300466 dw210x_op_rw(d->udev, 0xc2, 0, 0,
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -0300467 obuf, msg[0].len + 2, DW210X_WRITE_MSG);
468 /* second read registers */
Hans Verkuild51dbec2012-04-20 03:30:11 -0300469 dw210x_op_rw(d->udev, 0xc3, 0x19 , 0,
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -0300470 ibuf, msg[1].len + 2, DW210X_READ_MSG);
471 memcpy(msg[1].buf, ibuf + 2, msg[1].len);
472
473 break;
474 }
475 case 1:
476 switch (msg[0].addr) {
477 case 0x60:
478 case 0x0c: {
479 /* write to register */
480 u8 obuf[msg[0].len + 2];
481 obuf[0] = msg[0].addr << 1;
482 obuf[1] = msg[0].len;
483 memcpy(obuf + 2, msg[0].buf, msg[0].len);
Hans Verkuild51dbec2012-04-20 03:30:11 -0300484 dw210x_op_rw(d->udev, 0xc2, 0, 0,
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -0300485 obuf, msg[0].len + 2, DW210X_WRITE_MSG);
486 break;
487 }
488 case(DW2102_RC_QUERY): {
489 u8 ibuf[2];
Hans Verkuild51dbec2012-04-20 03:30:11 -0300490 dw210x_op_rw(d->udev, 0xb8, 0, 0,
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -0300491 ibuf, 2, DW210X_READ_MSG);
492 memcpy(msg[0].buf, ibuf , 2);
493 break;
494 }
495 }
496
497 break;
498 }
499
500 for (i = 0; i < num; i++) {
501 deb_xfer("%02x:%02x: %s ", i, msg[i].addr,
502 msg[i].flags == 0 ? ">>>" : "<<<");
503 debug_dump(msg[i].buf, msg[i].len, deb_xfer);
504 }
505
506 mutex_unlock(&d->i2c_mutex);
507 return num;
508}
509
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300510static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -0300511 int num)
512{
513 struct dvb_usb_device *d = i2c_get_adapdata(adap);
Julia Lawall21ead032009-12-22 18:00:07 -0300514 struct usb_device *udev;
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300515 int len, i, j;
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -0300516
517 if (!d)
518 return -ENODEV;
Julia Lawall21ead032009-12-22 18:00:07 -0300519 udev = d->udev;
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -0300520 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
521 return -EAGAIN;
522
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300523 for (j = 0; j < num; j++) {
524 switch (msg[j].addr) {
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -0300525 case (DW2102_RC_QUERY): {
Igor M. Liplianin5a530cb2011-02-25 18:41:23 -0300526 u8 ibuf[5];
Hans Verkuild51dbec2012-04-20 03:30:11 -0300527 dw210x_op_rw(d->udev, 0xb8, 0, 0,
Igor M. Liplianin5a530cb2011-02-25 18:41:23 -0300528 ibuf, 5, DW210X_READ_MSG);
529 memcpy(msg[j].buf, ibuf + 3, 2);
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -0300530 break;
531 }
532 case (DW2102_VOLTAGE_CTRL): {
533 u8 obuf[2];
Igor M. Liplianincd79d332009-12-14 20:24:56 -0300534
535 obuf[0] = 1;
536 obuf[1] = msg[j].buf[1];/* off-on */
Hans Verkuild51dbec2012-04-20 03:30:11 -0300537 dw210x_op_rw(d->udev, 0x8a, 0, 0,
Igor M. Liplianincd79d332009-12-14 20:24:56 -0300538 obuf, 2, DW210X_WRITE_MSG);
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300539 obuf[0] = 3;
Igor M. Liplianincd79d332009-12-14 20:24:56 -0300540 obuf[1] = msg[j].buf[0];/* 13v-18v */
Hans Verkuild51dbec2012-04-20 03:30:11 -0300541 dw210x_op_rw(d->udev, 0x8a, 0, 0,
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -0300542 obuf, 2, DW210X_WRITE_MSG);
543 break;
544 }
Igor M. Liplianinfa8bae12011-02-25 18:41:22 -0300545 case (DW2102_LED_CTRL): {
546 u8 obuf[2];
547
548 obuf[0] = 5;
549 obuf[1] = msg[j].buf[0];
Hans Verkuild51dbec2012-04-20 03:30:11 -0300550 dw210x_op_rw(d->udev, 0x8a, 0, 0,
Igor M. Liplianinfa8bae12011-02-25 18:41:22 -0300551 obuf, 2, DW210X_WRITE_MSG);
552 break;
553 }
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300554 /*case 0x55: cx24116
555 case 0x6a: stv0903
Igor M. Liplianin955d00a2012-05-08 03:53:17 -0300556 case 0x68: ds3000, stv0903, rs2000
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300557 case 0x60: ts2020, stv6110, stb6100
558 case 0xa0: eeprom */
559 default: {
560 if (msg[j].flags == I2C_M_RD) {
561 /* read registers */
562 u8 ibuf[msg[j].len];
Hans Verkuild51dbec2012-04-20 03:30:11 -0300563 dw210x_op_rw(d->udev, 0x91, 0, 0,
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300564 ibuf, msg[j].len,
565 DW210X_READ_MSG);
566 memcpy(msg[j].buf, ibuf, msg[j].len);
567 break;
568 } else if ((msg[j].buf[0] == 0xb0) &&
569 (msg[j].addr == 0x68)) {
570 /* write firmware */
571 u8 obuf[19];
572 obuf[0] = (msg[j].len > 16 ?
573 18 : msg[j].len + 1);
574 obuf[1] = msg[j].addr << 1;
575 obuf[2] = msg[j].buf[0];
576 len = msg[j].len - 1;
577 i = 1;
578 do {
579 memcpy(obuf + 3, msg[j].buf + i,
580 (len > 16 ? 16 : len));
Hans Verkuild51dbec2012-04-20 03:30:11 -0300581 dw210x_op_rw(d->udev, 0x80, 0, 0,
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300582 obuf, (len > 16 ? 16 : len) + 3,
583 DW210X_WRITE_MSG);
584 i += 16;
585 len -= 16;
586 } while (len > 0);
Igor M. Liplianina84adf42011-02-27 16:18:38 -0300587 } else if (j < (num - 1)) {
Igor M. Liplianincd79d332009-12-14 20:24:56 -0300588 /* write register addr before read */
589 u8 obuf[msg[j].len + 2];
590 obuf[0] = msg[j + 1].len;
591 obuf[1] = (msg[j].addr << 1);
592 memcpy(obuf + 2, msg[j].buf, msg[j].len);
Hans Verkuild51dbec2012-04-20 03:30:11 -0300593 dw210x_op_rw(d->udev,
Igor M. Liplianina84adf42011-02-27 16:18:38 -0300594 udev->descriptor.idProduct ==
595 0x7500 ? 0x92 : 0x90, 0, 0,
Igor M. Liplianincd79d332009-12-14 20:24:56 -0300596 obuf, msg[j].len + 2,
597 DW210X_WRITE_MSG);
598 break;
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300599 } else {
600 /* write registers */
601 u8 obuf[msg[j].len + 2];
602 obuf[0] = msg[j].len + 1;
603 obuf[1] = (msg[j].addr << 1);
604 memcpy(obuf + 2, msg[j].buf, msg[j].len);
Hans Verkuild51dbec2012-04-20 03:30:11 -0300605 dw210x_op_rw(d->udev, 0x80, 0, 0,
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300606 obuf, msg[j].len + 2,
607 DW210X_WRITE_MSG);
608 break;
609 }
610 break;
611 }
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -0300612 }
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -0300613 }
614
615 mutex_unlock(&d->i2c_mutex);
616 return num;
617}
618
Igor M. Liplianind2ffc442011-02-25 18:41:22 -0300619static int su3000_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
620 int num)
621{
622 struct dvb_usb_device *d = i2c_get_adapdata(adap);
623 u8 obuf[0x40], ibuf[0x40];
624
625 if (!d)
626 return -ENODEV;
627 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
628 return -EAGAIN;
629
630 switch (num) {
631 case 1:
632 switch (msg[0].addr) {
633 case SU3000_STREAM_CTRL:
634 obuf[0] = msg[0].buf[0] + 0x36;
635 obuf[1] = 3;
636 obuf[2] = 0;
637 if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 0, 0) < 0)
638 err("i2c transfer failed.");
639 break;
640 case DW2102_RC_QUERY:
641 obuf[0] = 0x10;
642 if (dvb_usb_generic_rw(d, obuf, 1, ibuf, 2, 0) < 0)
643 err("i2c transfer failed.");
644 msg[0].buf[1] = ibuf[0];
645 msg[0].buf[0] = ibuf[1];
646 break;
647 default:
648 /* always i2c write*/
649 obuf[0] = 0x08;
650 obuf[1] = msg[0].addr;
651 obuf[2] = msg[0].len;
652
653 memcpy(&obuf[3], msg[0].buf, msg[0].len);
654
655 if (dvb_usb_generic_rw(d, obuf, msg[0].len + 3,
656 ibuf, 1, 0) < 0)
657 err("i2c transfer failed.");
658
659 }
660 break;
661 case 2:
662 /* always i2c read */
663 obuf[0] = 0x09;
664 obuf[1] = msg[0].len;
665 obuf[2] = msg[1].len;
666 obuf[3] = msg[0].addr;
667 memcpy(&obuf[4], msg[0].buf, msg[0].len);
668
669 if (dvb_usb_generic_rw(d, obuf, msg[0].len + 4,
670 ibuf, msg[1].len + 1, 0) < 0)
671 err("i2c transfer failed.");
672
673 memcpy(msg[1].buf, &ibuf[1], msg[1].len);
674 break;
675 default:
676 warn("more than 2 i2c messages at a time is not handled yet.");
677 break;
678 }
679 mutex_unlock(&d->i2c_mutex);
680 return num;
681}
682
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300683static u32 dw210x_i2c_func(struct i2c_adapter *adapter)
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300684{
685 return I2C_FUNC_I2C;
686}
687
688static struct i2c_algorithm dw2102_i2c_algo = {
689 .master_xfer = dw2102_i2c_transfer,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300690 .functionality = dw210x_i2c_func,
691};
692
693static struct i2c_algorithm dw2102_serit_i2c_algo = {
694 .master_xfer = dw2102_serit_i2c_transfer,
695 .functionality = dw210x_i2c_func,
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300696};
697
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -0300698static struct i2c_algorithm dw2102_earda_i2c_algo = {
699 .master_xfer = dw2102_earda_i2c_transfer,
700 .functionality = dw210x_i2c_func,
701};
702
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300703static struct i2c_algorithm dw2104_i2c_algo = {
704 .master_xfer = dw2104_i2c_transfer,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300705 .functionality = dw210x_i2c_func,
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300706};
707
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -0300708static struct i2c_algorithm dw3101_i2c_algo = {
709 .master_xfer = dw3101_i2c_transfer,
710 .functionality = dw210x_i2c_func,
711};
712
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300713static struct i2c_algorithm s6x0_i2c_algo = {
714 .master_xfer = s6x0_i2c_transfer,
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -0300715 .functionality = dw210x_i2c_func,
716};
717
Igor M. Liplianind2ffc442011-02-25 18:41:22 -0300718static struct i2c_algorithm su3000_i2c_algo = {
719 .master_xfer = su3000_i2c_transfer,
720 .functionality = dw210x_i2c_func,
721};
722
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300723static int dw210x_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300724{
725 int i;
726 u8 ibuf[] = {0, 0};
727 u8 eeprom[256], eepromline[16];
728
729 for (i = 0; i < 256; i++) {
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300730 if (dw210x_op_rw(d->udev, 0xb6, 0xa0 , i, ibuf, 2, DW210X_READ_MSG) < 0) {
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300731 err("read eeprom failed.");
732 return -1;
733 } else {
734 eepromline[i%16] = ibuf[0];
735 eeprom[i] = ibuf[0];
736 }
737 if ((i % 16) == 15) {
738 deb_xfer("%02x: ", i - 15);
739 debug_dump(eepromline, 16, deb_xfer);
740 }
741 }
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -0300742
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300743 memcpy(mac, eeprom + 8, 6);
744 return 0;
745};
746
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300747static int s6x0_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -0300748{
749 int i, ret;
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300750 u8 ibuf[] = { 0 }, obuf[] = { 0 };
751 u8 eeprom[256], eepromline[16];
752 struct i2c_msg msg[] = {
753 {
754 .addr = 0xa0 >> 1,
755 .flags = 0,
756 .buf = obuf,
757 .len = 1,
758 }, {
759 .addr = 0xa0 >> 1,
760 .flags = I2C_M_RD,
761 .buf = ibuf,
762 .len = 1,
763 }
764 };
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -0300765
766 for (i = 0; i < 256; i++) {
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300767 obuf[0] = i;
768 ret = s6x0_i2c_transfer(&d->i2c_adap, msg, 2);
769 if (ret != 2) {
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -0300770 err("read eeprom failed.");
771 return -1;
772 } else {
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300773 eepromline[i % 16] = ibuf[0];
774 eeprom[i] = ibuf[0];
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -0300775 }
776
777 if ((i % 16) == 15) {
778 deb_xfer("%02x: ", i - 15);
779 debug_dump(eepromline, 16, deb_xfer);
780 }
781 }
782
783 memcpy(mac, eeprom + 16, 6);
784 return 0;
785};
786
Igor M. Liplianind2ffc442011-02-25 18:41:22 -0300787static int su3000_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
788{
789 static u8 command_start[] = {0x00};
790 static u8 command_stop[] = {0x01};
791 struct i2c_msg msg = {
792 .addr = SU3000_STREAM_CTRL,
793 .flags = 0,
794 .buf = onoff ? command_start : command_stop,
795 .len = 1
796 };
797
798 i2c_transfer(&adap->dev->i2c_adap, &msg, 1);
799
800 return 0;
801}
802
803static int su3000_power_ctrl(struct dvb_usb_device *d, int i)
804{
805 struct su3000_state *state = (struct su3000_state *)d->priv;
806 u8 obuf[] = {0xde, 0};
807
808 info("%s: %d, initialized %d\n", __func__, i, state->initialized);
809
810 if (i && !state->initialized) {
811 state->initialized = 1;
812 /* reset board */
813 dvb_usb_generic_rw(d, obuf, 2, NULL, 0, 0);
814 }
815
816 return 0;
817}
818
819static int su3000_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
820{
821 int i;
822 u8 obuf[] = { 0x1f, 0xf0 };
823 u8 ibuf[] = { 0 };
824 struct i2c_msg msg[] = {
825 {
826 .addr = 0x51,
827 .flags = 0,
828 .buf = obuf,
829 .len = 2,
830 }, {
831 .addr = 0x51,
832 .flags = I2C_M_RD,
833 .buf = ibuf,
834 .len = 1,
835
836 }
837 };
838
839 for (i = 0; i < 6; i++) {
840 obuf[1] = 0xf0 + i;
841 if (i2c_transfer(&d->i2c_adap, msg, 2) != 2)
842 break;
843 else
844 mac[i] = ibuf[0];
845
846 debug_dump(mac, 6, printk);
847 }
848
849 return 0;
850}
851
852static int su3000_identify_state(struct usb_device *udev,
853 struct dvb_usb_device_properties *props,
854 struct dvb_usb_device_description **desc,
855 int *cold)
856{
857 info("%s\n", __func__);
858
859 *cold = 0;
860 return 0;
861}
862
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300863static int dw210x_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300864{
Igor M. Liplianincd79d332009-12-14 20:24:56 -0300865 static u8 command_13v[] = {0x00, 0x01};
866 static u8 command_18v[] = {0x01, 0x01};
867 static u8 command_off[] = {0x00, 0x00};
868 struct i2c_msg msg = {
869 .addr = DW2102_VOLTAGE_CTRL,
870 .flags = 0,
871 .buf = command_off,
872 .len = 2,
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300873 };
874
875 struct dvb_usb_adapter *udev_adap =
876 (struct dvb_usb_adapter *)(fe->dvb->priv);
877 if (voltage == SEC_VOLTAGE_18)
Igor M. Liplianincd79d332009-12-14 20:24:56 -0300878 msg.buf = command_18v;
879 else if (voltage == SEC_VOLTAGE_13)
880 msg.buf = command_13v;
881
882 i2c_transfer(&udev_adap->dev->i2c_adap, &msg, 1);
883
Igor M Liplianin7fd48282008-07-20 08:05:50 -0300884 return 0;
885}
886
Igor M. Liplianin52c506e2011-02-25 18:41:23 -0300887static int s660_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
888{
889 struct dvb_usb_adapter *d =
890 (struct dvb_usb_adapter *)(fe->dvb->priv);
891 struct s6x0_state *st = (struct s6x0_state *)d->dev->priv;
892
893 dw210x_set_voltage(fe, voltage);
894 if (st->old_set_voltage)
895 st->old_set_voltage(fe, voltage);
896
897 return 0;
898}
899
Igor M. Liplianinfa8bae12011-02-25 18:41:22 -0300900static void dw210x_led_ctrl(struct dvb_frontend *fe, int offon)
901{
902 static u8 led_off[] = { 0 };
903 static u8 led_on[] = { 1 };
904 struct i2c_msg msg = {
905 .addr = DW2102_LED_CTRL,
906 .flags = 0,
907 .buf = led_off,
908 .len = 1
909 };
910 struct dvb_usb_adapter *udev_adap =
911 (struct dvb_usb_adapter *)(fe->dvb->priv);
912
913 if (offon)
914 msg.buf = led_on;
915 i2c_transfer(&udev_adap->dev->i2c_adap, &msg, 1);
916}
917
Igor M. Liplianind4305c62008-10-17 13:45:55 -0300918static struct stv0299_config sharp_z0194a_config = {
919 .demod_address = 0x68,
920 .inittab = sharp_z0194a_inittab,
921 .mclk = 88000000UL,
922 .invert = 1,
923 .skip_reinit = 0,
924 .lock_output = STV0299_LOCKOUTPUT_1,
925 .volt13_op0_op1 = STV0299_VOLT13_OP1,
926 .min_delay_ms = 100,
927 .set_symbol_rate = sharp_z0194a_set_symbol_rate,
928};
929
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300930static struct cx24116_config dw2104_config = {
931 .demod_address = 0x55,
Igor M. Liplianincc8c4f32008-09-09 13:57:47 -0300932 .mpg_clk_pos_pol = 0x01,
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -0300933};
934
Igor M. Liplianin21b007b2008-09-17 19:19:19 -0300935static struct si21xx_config serit_sp1511lhb_config = {
936 .demod_address = 0x68,
937 .min_delay_ms = 100,
938
939};
940
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -0300941static struct tda10023_config dw3101_tda10023_config = {
942 .demod_address = 0x0c,
943 .invert = 1,
944};
945
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -0300946static struct mt312_config zl313_config = {
947 .demod_address = 0x0e,
948};
949
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300950static struct ds3000_config dw2104_ds3000_config = {
951 .demod_address = 0x68,
952};
953
Konstantin Dimitrov73f0af42012-12-23 19:25:38 -0300954static struct ts2020_config dw2104_ts2020_config = {
955 .tuner_address = 0x60,
956};
957
Igor M. Liplianin43385c82012-12-28 19:40:24 -0300958static struct ds3000_config s660_ds3000_config = {
959 .demod_address = 0x68,
960 .set_lock_led = dw210x_led_ctrl,
961};
962
Igor M. Liplianin141cc352009-11-27 14:37:35 -0300963static struct stv0900_config dw2104a_stv0900_config = {
964 .demod_address = 0x6a,
965 .demod_mode = 0,
966 .xtal = 27000000,
967 .clkmode = 3,/* 0-CLKI, 2-XTALI, else AUTO */
968 .diseqc_mode = 2,/* 2/3 PWM */
969 .tun1_maddress = 0,/* 0x60 */
970 .tun1_adc = 0,/* 2 Vpp */
971 .path1_mode = 3,
972};
973
974static struct stb6100_config dw2104a_stb6100_config = {
975 .tuner_address = 0x60,
976 .refclock = 27000000,
977};
978
979static struct stv0900_config dw2104_stv0900_config = {
980 .demod_address = 0x68,
981 .demod_mode = 0,
982 .xtal = 8000000,
983 .clkmode = 3,
984 .diseqc_mode = 2,
985 .tun1_maddress = 0,
986 .tun1_adc = 1,/* 1 Vpp */
987 .path1_mode = 3,
988};
989
990static struct stv6110_config dw2104_stv6110_config = {
991 .i2c_address = 0x60,
992 .mclk = 16000000,
993 .clk_div = 1,
994};
995
Igor M. Liplianincd79d332009-12-14 20:24:56 -0300996static struct stv0900_config prof_7500_stv0900_config = {
997 .demod_address = 0x6a,
998 .demod_mode = 0,
999 .xtal = 27000000,
1000 .clkmode = 3,/* 0-CLKI, 2-XTALI, else AUTO */
1001 .diseqc_mode = 2,/* 2/3 PWM */
1002 .tun1_maddress = 0,/* 0x60 */
1003 .tun1_adc = 0,/* 2 Vpp */
1004 .path1_mode = 3,
1005 .tun1_type = 3,
Igor M. Liplianinfa8bae12011-02-25 18:41:22 -03001006 .set_lock_led = dw210x_led_ctrl,
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001007};
1008
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001009static struct ds3000_config su3000_ds3000_config = {
1010 .demod_address = 0x68,
1011 .ci_mode = 1,
1012};
1013
Konstantin Dimitrov73f0af42012-12-23 19:25:38 -03001014static struct ts2020_config su3000_ts2020_config = {
1015 .tuner_address = 0x60,
1016};
1017
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03001018static u8 m88rs2000_inittab[] = {
1019 DEMOD_WRITE, 0x9a, 0x30,
1020 DEMOD_WRITE, 0x00, 0x01,
1021 WRITE_DELAY, 0x19, 0x00,
1022 DEMOD_WRITE, 0x00, 0x00,
1023 DEMOD_WRITE, 0x9a, 0xb0,
1024 DEMOD_WRITE, 0x81, 0xc1,
1025 TUNER_WRITE, 0x42, 0x73,
1026 TUNER_WRITE, 0x05, 0x07,
1027 TUNER_WRITE, 0x20, 0x27,
1028 TUNER_WRITE, 0x07, 0x02,
1029 TUNER_WRITE, 0x11, 0xff,
1030 TUNER_WRITE, 0x60, 0xf9,
1031 TUNER_WRITE, 0x08, 0x01,
1032 TUNER_WRITE, 0x00, 0x41,
1033 DEMOD_WRITE, 0x81, 0x81,
1034 DEMOD_WRITE, 0x86, 0xc6,
1035 DEMOD_WRITE, 0x9a, 0x30,
1036 DEMOD_WRITE, 0xf0, 0x80,
1037 DEMOD_WRITE, 0xf1, 0xbf,
1038 DEMOD_WRITE, 0xb0, 0x45,
1039 DEMOD_WRITE, 0xb2, 0x01,
1040 DEMOD_WRITE, 0x9a, 0xb0,
1041 0xff, 0xaa, 0xff
1042};
1043
1044static struct m88rs2000_config s421_m88rs2000_config = {
1045 .demod_addr = 0x68,
1046 .tuner_addr = 0x60,
1047 .inittab = m88rs2000_inittab,
1048};
1049
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001050static int dw2104_frontend_attach(struct dvb_usb_adapter *d)
1051{
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001052 struct dvb_tuner_ops *tuner_ops = NULL;
1053
1054 if (demod_probe & 4) {
Michael Krufky77eed212011-09-06 09:31:57 -03001055 d->fe_adap[0].fe = dvb_attach(stv0900_attach, &dw2104a_stv0900_config,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001056 &d->dev->i2c_adap, 0);
Michael Krufky77eed212011-09-06 09:31:57 -03001057 if (d->fe_adap[0].fe != NULL) {
1058 if (dvb_attach(stb6100_attach, d->fe_adap[0].fe,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001059 &dw2104a_stb6100_config,
1060 &d->dev->i2c_adap)) {
Michael Krufky77eed212011-09-06 09:31:57 -03001061 tuner_ops = &d->fe_adap[0].fe->ops.tuner_ops;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001062 tuner_ops->set_frequency = stb6100_set_freq;
1063 tuner_ops->get_frequency = stb6100_get_freq;
1064 tuner_ops->set_bandwidth = stb6100_set_bandw;
1065 tuner_ops->get_bandwidth = stb6100_get_bandw;
Michael Krufky77eed212011-09-06 09:31:57 -03001066 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001067 info("Attached STV0900+STB6100!\n");
1068 return 0;
1069 }
1070 }
1071 }
1072
1073 if (demod_probe & 2) {
Michael Krufky77eed212011-09-06 09:31:57 -03001074 d->fe_adap[0].fe = dvb_attach(stv0900_attach, &dw2104_stv0900_config,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001075 &d->dev->i2c_adap, 0);
Michael Krufky77eed212011-09-06 09:31:57 -03001076 if (d->fe_adap[0].fe != NULL) {
1077 if (dvb_attach(stv6110_attach, d->fe_adap[0].fe,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001078 &dw2104_stv6110_config,
1079 &d->dev->i2c_adap)) {
Michael Krufky77eed212011-09-06 09:31:57 -03001080 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001081 info("Attached STV0900+STV6110A!\n");
1082 return 0;
1083 }
1084 }
1085 }
1086
1087 if (demod_probe & 1) {
Michael Krufky77eed212011-09-06 09:31:57 -03001088 d->fe_adap[0].fe = dvb_attach(cx24116_attach, &dw2104_config,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001089 &d->dev->i2c_adap);
Michael Krufky77eed212011-09-06 09:31:57 -03001090 if (d->fe_adap[0].fe != NULL) {
1091 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001092 info("Attached cx24116!\n");
1093 return 0;
1094 }
1095 }
1096
Michael Krufky77eed212011-09-06 09:31:57 -03001097 d->fe_adap[0].fe = dvb_attach(ds3000_attach, &dw2104_ds3000_config,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001098 &d->dev->i2c_adap);
Michael Krufky77eed212011-09-06 09:31:57 -03001099 if (d->fe_adap[0].fe != NULL) {
Konstantin Dimitrov73f0af42012-12-23 19:25:38 -03001100 dvb_attach(ts2020_attach, d->fe_adap[0].fe,
1101 &dw2104_ts2020_config, &d->dev->i2c_adap);
Michael Krufky77eed212011-09-06 09:31:57 -03001102 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001103 info("Attached DS3000!\n");
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001104 return 0;
1105 }
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001106
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001107 return -EIO;
1108}
1109
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001110static struct dvb_usb_device_properties dw2102_properties;
Igor M. Liplianinb42e1d72009-06-14 19:41:22 -03001111static struct dvb_usb_device_properties dw2104_properties;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001112static struct dvb_usb_device_properties s6x0_properties;
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001113
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001114static int dw2102_frontend_attach(struct dvb_usb_adapter *d)
1115{
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001116 if (dw2102_properties.i2c_algo == &dw2102_serit_i2c_algo) {
1117 /*dw2102_properties.adapter->tuner_attach = NULL;*/
Michael Krufky77eed212011-09-06 09:31:57 -03001118 d->fe_adap[0].fe = dvb_attach(si21xx_attach, &serit_sp1511lhb_config,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001119 &d->dev->i2c_adap);
Michael Krufky77eed212011-09-06 09:31:57 -03001120 if (d->fe_adap[0].fe != NULL) {
1121 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001122 info("Attached si21xx!\n");
1123 return 0;
1124 }
1125 }
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001126
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -03001127 if (dw2102_properties.i2c_algo == &dw2102_earda_i2c_algo) {
Michael Krufky77eed212011-09-06 09:31:57 -03001128 d->fe_adap[0].fe = dvb_attach(stv0288_attach, &earda_config,
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -03001129 &d->dev->i2c_adap);
Michael Krufky77eed212011-09-06 09:31:57 -03001130 if (d->fe_adap[0].fe != NULL) {
1131 if (dvb_attach(stb6000_attach, d->fe_adap[0].fe, 0x61,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001132 &d->dev->i2c_adap)) {
Michael Krufky77eed212011-09-06 09:31:57 -03001133 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001134 info("Attached stv0288!\n");
1135 return 0;
1136 }
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -03001137 }
1138 }
1139
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001140 if (dw2102_properties.i2c_algo == &dw2102_i2c_algo) {
1141 /*dw2102_properties.adapter->tuner_attach = dw2102_tuner_attach;*/
Michael Krufky77eed212011-09-06 09:31:57 -03001142 d->fe_adap[0].fe = dvb_attach(stv0299_attach, &sharp_z0194a_config,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001143 &d->dev->i2c_adap);
Michael Krufky77eed212011-09-06 09:31:57 -03001144 if (d->fe_adap[0].fe != NULL) {
1145 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001146 info("Attached stv0299!\n");
1147 return 0;
1148 }
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001149 }
1150 return -EIO;
1151}
1152
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001153static int dw3101_frontend_attach(struct dvb_usb_adapter *d)
1154{
Michael Krufky77eed212011-09-06 09:31:57 -03001155 d->fe_adap[0].fe = dvb_attach(tda10023_attach, &dw3101_tda10023_config,
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001156 &d->dev->i2c_adap, 0x48);
Michael Krufky77eed212011-09-06 09:31:57 -03001157 if (d->fe_adap[0].fe != NULL) {
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001158 info("Attached tda10023!\n");
1159 return 0;
1160 }
1161 return -EIO;
1162}
1163
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001164static int zl100313_frontend_attach(struct dvb_usb_adapter *d)
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001165{
Michael Krufky77eed212011-09-06 09:31:57 -03001166 d->fe_adap[0].fe = dvb_attach(mt312_attach, &zl313_config,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001167 &d->dev->i2c_adap);
Michael Krufky77eed212011-09-06 09:31:57 -03001168 if (d->fe_adap[0].fe != NULL) {
1169 if (dvb_attach(zl10039_attach, d->fe_adap[0].fe, 0x60,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001170 &d->dev->i2c_adap)) {
Michael Krufky77eed212011-09-06 09:31:57 -03001171 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001172 info("Attached zl100313+zl10039!\n");
1173 return 0;
1174 }
1175 }
1176
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001177 return -EIO;
1178}
1179
1180static int stv0288_frontend_attach(struct dvb_usb_adapter *d)
1181{
Igor M. Liplianinfd5466d2011-02-27 16:22:52 -03001182 u8 obuf[] = {7, 1};
1183
Michael Krufky77eed212011-09-06 09:31:57 -03001184 d->fe_adap[0].fe = dvb_attach(stv0288_attach, &earda_config,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001185 &d->dev->i2c_adap);
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001186
Michael Krufky77eed212011-09-06 09:31:57 -03001187 if (d->fe_adap[0].fe == NULL)
Igor M. Liplianinfd5466d2011-02-27 16:22:52 -03001188 return -EIO;
1189
Michael Krufky77eed212011-09-06 09:31:57 -03001190 if (NULL == dvb_attach(stb6000_attach, d->fe_adap[0].fe, 0x61, &d->dev->i2c_adap))
Igor M. Liplianinfd5466d2011-02-27 16:22:52 -03001191 return -EIO;
1192
Michael Krufky77eed212011-09-06 09:31:57 -03001193 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianinfd5466d2011-02-27 16:22:52 -03001194
1195 dw210x_op_rw(d->dev->udev, 0x8a, 0, 0, obuf, 2, DW210X_WRITE_MSG);
1196
1197 info("Attached stv0288+stb6000!\n");
1198
1199 return 0;
1200
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001201}
1202
1203static int ds3000_frontend_attach(struct dvb_usb_adapter *d)
1204{
Igor M. Liplianin52c506e2011-02-25 18:41:23 -03001205 struct s6x0_state *st = (struct s6x0_state *)d->dev->priv;
Igor M. Liplianin5a530cb2011-02-25 18:41:23 -03001206 u8 obuf[] = {7, 1};
Igor M. Liplianin52c506e2011-02-25 18:41:23 -03001207
Igor M. Liplianin43385c82012-12-28 19:40:24 -03001208 d->fe_adap[0].fe = dvb_attach(ds3000_attach, &s660_ds3000_config,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001209 &d->dev->i2c_adap);
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001210
Michael Krufky77eed212011-09-06 09:31:57 -03001211 if (d->fe_adap[0].fe == NULL)
Igor M. Liplianin52c506e2011-02-25 18:41:23 -03001212 return -EIO;
1213
Konstantin Dimitrov73f0af42012-12-23 19:25:38 -03001214 dvb_attach(ts2020_attach, d->fe_adap[0].fe, &dw2104_ts2020_config,
1215 &d->dev->i2c_adap);
1216
Michael Krufky77eed212011-09-06 09:31:57 -03001217 st->old_set_voltage = d->fe_adap[0].fe->ops.set_voltage;
1218 d->fe_adap[0].fe->ops.set_voltage = s660_set_voltage;
Igor M. Liplianin5a530cb2011-02-25 18:41:23 -03001219
1220 dw210x_op_rw(d->dev->udev, 0x8a, 0, 0, obuf, 2, DW210X_WRITE_MSG);
1221
Igor M. Liplianin52c506e2011-02-25 18:41:23 -03001222 info("Attached ds3000+ds2020!\n");
1223
1224 return 0;
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001225}
1226
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001227static int prof_7500_frontend_attach(struct dvb_usb_adapter *d)
1228{
Igor M. Liplianin4e59df82011-02-25 18:41:23 -03001229 u8 obuf[] = {7, 1};
1230
Michael Krufky77eed212011-09-06 09:31:57 -03001231 d->fe_adap[0].fe = dvb_attach(stv0900_attach, &prof_7500_stv0900_config,
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001232 &d->dev->i2c_adap, 0);
Michael Krufky77eed212011-09-06 09:31:57 -03001233 if (d->fe_adap[0].fe == NULL)
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001234 return -EIO;
Igor M. Liplianin4e59df82011-02-25 18:41:23 -03001235
Michael Krufky77eed212011-09-06 09:31:57 -03001236 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001237
Igor M. Liplianin4e59df82011-02-25 18:41:23 -03001238 dw210x_op_rw(d->dev->udev, 0x8a, 0, 0, obuf, 2, DW210X_WRITE_MSG);
1239
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001240 info("Attached STV0900+STB6100A!\n");
1241
1242 return 0;
1243}
1244
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001245static int su3000_frontend_attach(struct dvb_usb_adapter *d)
1246{
1247 u8 obuf[3] = { 0xe, 0x80, 0 };
1248 u8 ibuf[] = { 0 };
1249
1250 if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1251 err("command 0x0e transfer failed.");
1252
1253 obuf[0] = 0xe;
1254 obuf[1] = 0x83;
1255 obuf[2] = 0;
1256
1257 if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1258 err("command 0x0e transfer failed.");
1259
1260 obuf[0] = 0xe;
1261 obuf[1] = 0x83;
1262 obuf[2] = 1;
1263
1264 if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1265 err("command 0x0e transfer failed.");
1266
1267 obuf[0] = 0x51;
1268
1269 if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
1270 err("command 0x51 transfer failed.");
1271
Michael Krufky77eed212011-09-06 09:31:57 -03001272 d->fe_adap[0].fe = dvb_attach(ds3000_attach, &su3000_ds3000_config,
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001273 &d->dev->i2c_adap);
Michael Krufky77eed212011-09-06 09:31:57 -03001274 if (d->fe_adap[0].fe == NULL)
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001275 return -EIO;
1276
Konstantin Dimitrov73f0af42012-12-23 19:25:38 -03001277 dvb_attach(ts2020_attach, d->fe_adap[0].fe, &su3000_ts2020_config,
1278 &d->dev->i2c_adap);
1279
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001280 info("Attached DS3000!\n");
1281
1282 return 0;
1283}
1284
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03001285static int m88rs2000_frontend_attach(struct dvb_usb_adapter *d)
1286{
1287 u8 obuf[] = { 0x51 };
1288 u8 ibuf[] = { 0 };
1289
1290 if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
1291 err("command 0x51 transfer failed.");
1292
1293 d->fe_adap[0].fe = dvb_attach(m88rs2000_attach, &s421_m88rs2000_config,
1294 &d->dev->i2c_adap);
1295 if (d->fe_adap[0].fe == NULL)
1296 return -EIO;
1297
1298 info("Attached m88rs2000!\n");
1299
1300 return 0;
1301}
1302
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001303static int dw2102_tuner_attach(struct dvb_usb_adapter *adap)
1304{
Michael Krufky77eed212011-09-06 09:31:57 -03001305 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60,
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001306 &adap->dev->i2c_adap, DVB_PLL_OPERA1);
1307 return 0;
1308}
1309
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001310static int dw3101_tuner_attach(struct dvb_usb_adapter *adap)
1311{
Michael Krufky77eed212011-09-06 09:31:57 -03001312 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60,
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001313 &adap->dev->i2c_adap, DVB_PLL_TUA6034);
1314
1315 return 0;
1316}
1317
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001318static struct rc_map_table rc_map_dw210x_table[] = {
Mauro Carvalho Chehab991bd3c2011-01-24 12:18:40 -03001319 { 0xf80a, KEY_POWER2 }, /*power*/
1320 { 0xf80c, KEY_MUTE }, /*mute*/
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -03001321 { 0xf811, KEY_1 },
1322 { 0xf812, KEY_2 },
1323 { 0xf813, KEY_3 },
1324 { 0xf814, KEY_4 },
1325 { 0xf815, KEY_5 },
1326 { 0xf816, KEY_6 },
1327 { 0xf817, KEY_7 },
1328 { 0xf818, KEY_8 },
1329 { 0xf819, KEY_9 },
1330 { 0xf810, KEY_0 },
Mauro Carvalho Chehab991bd3c2011-01-24 12:18:40 -03001331 { 0xf81c, KEY_CHANNELUP }, /*ch+*/
1332 { 0xf80f, KEY_CHANNELDOWN }, /*ch-*/
1333 { 0xf81a, KEY_VOLUMEUP }, /*vol+*/
1334 { 0xf80e, KEY_VOLUMEDOWN }, /*vol-*/
1335 { 0xf804, KEY_RECORD }, /*rec*/
1336 { 0xf809, KEY_FAVORITES }, /*fav*/
1337 { 0xf808, KEY_REWIND }, /*rewind*/
1338 { 0xf807, KEY_FASTFORWARD }, /*fast*/
1339 { 0xf80b, KEY_PAUSE }, /*pause*/
1340 { 0xf802, KEY_ESC }, /*cancel*/
1341 { 0xf803, KEY_TAB }, /*tab*/
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -03001342 { 0xf800, KEY_UP }, /*up*/
Mauro Carvalho Chehab991bd3c2011-01-24 12:18:40 -03001343 { 0xf81f, KEY_OK }, /*ok*/
1344 { 0xf801, KEY_DOWN }, /*down*/
1345 { 0xf805, KEY_CAMERA }, /*cap*/
1346 { 0xf806, KEY_STOP }, /*stop*/
1347 { 0xf840, KEY_ZOOM }, /*full*/
1348 { 0xf81e, KEY_TV }, /*tvmode*/
1349 { 0xf81b, KEY_LAST }, /*recall*/
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001350};
1351
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001352static struct rc_map_table rc_map_tevii_table[] = {
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -03001353 { 0xf80a, KEY_POWER },
1354 { 0xf80c, KEY_MUTE },
1355 { 0xf811, KEY_1 },
1356 { 0xf812, KEY_2 },
1357 { 0xf813, KEY_3 },
1358 { 0xf814, KEY_4 },
1359 { 0xf815, KEY_5 },
1360 { 0xf816, KEY_6 },
1361 { 0xf817, KEY_7 },
1362 { 0xf818, KEY_8 },
1363 { 0xf819, KEY_9 },
1364 { 0xf810, KEY_0 },
1365 { 0xf81c, KEY_MENU },
1366 { 0xf80f, KEY_VOLUMEDOWN },
1367 { 0xf81a, KEY_LAST },
1368 { 0xf80e, KEY_OPEN },
1369 { 0xf804, KEY_RECORD },
1370 { 0xf809, KEY_VOLUMEUP },
1371 { 0xf808, KEY_CHANNELUP },
1372 { 0xf807, KEY_PVR },
1373 { 0xf80b, KEY_TIME },
1374 { 0xf802, KEY_RIGHT },
1375 { 0xf803, KEY_LEFT },
1376 { 0xf800, KEY_UP },
1377 { 0xf81f, KEY_OK },
1378 { 0xf801, KEY_DOWN },
1379 { 0xf805, KEY_TUNER },
1380 { 0xf806, KEY_CHANNELDOWN },
1381 { 0xf840, KEY_PLAYPAUSE },
1382 { 0xf81e, KEY_REWIND },
1383 { 0xf81b, KEY_FAVORITES },
1384 { 0xf81d, KEY_BACK },
1385 { 0xf84d, KEY_FASTFORWARD },
1386 { 0xf844, KEY_EPG },
1387 { 0xf84c, KEY_INFO },
1388 { 0xf841, KEY_AB },
1389 { 0xf843, KEY_AUDIO },
1390 { 0xf845, KEY_SUBTITLE },
1391 { 0xf84a, KEY_LIST },
1392 { 0xf846, KEY_F1 },
1393 { 0xf847, KEY_F2 },
1394 { 0xf85e, KEY_F3 },
1395 { 0xf85c, KEY_F4 },
1396 { 0xf852, KEY_F5 },
1397 { 0xf85a, KEY_F6 },
1398 { 0xf856, KEY_MODE },
1399 { 0xf858, KEY_SWITCHVIDEOMODE },
Igor M. Liplianinb42e1d72009-06-14 19:41:22 -03001400};
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001401
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001402static struct rc_map_table rc_map_tbs_table[] = {
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -03001403 { 0xf884, KEY_POWER },
1404 { 0xf894, KEY_MUTE },
1405 { 0xf887, KEY_1 },
1406 { 0xf886, KEY_2 },
1407 { 0xf885, KEY_3 },
1408 { 0xf88b, KEY_4 },
1409 { 0xf88a, KEY_5 },
1410 { 0xf889, KEY_6 },
1411 { 0xf88f, KEY_7 },
1412 { 0xf88e, KEY_8 },
1413 { 0xf88d, KEY_9 },
1414 { 0xf892, KEY_0 },
1415 { 0xf896, KEY_CHANNELUP },
1416 { 0xf891, KEY_CHANNELDOWN },
1417 { 0xf893, KEY_VOLUMEUP },
1418 { 0xf88c, KEY_VOLUMEDOWN },
1419 { 0xf883, KEY_RECORD },
1420 { 0xf898, KEY_PAUSE },
1421 { 0xf899, KEY_OK },
1422 { 0xf89a, KEY_SHUFFLE },
1423 { 0xf881, KEY_UP },
1424 { 0xf890, KEY_LEFT },
1425 { 0xf882, KEY_RIGHT },
1426 { 0xf888, KEY_DOWN },
1427 { 0xf895, KEY_FAVORITES },
1428 { 0xf897, KEY_SUBTITLE },
1429 { 0xf89d, KEY_ZOOM },
1430 { 0xf89f, KEY_EXIT },
1431 { 0xf89e, KEY_MENU },
1432 { 0xf89c, KEY_EPG },
1433 { 0xf880, KEY_PREVIOUS },
1434 { 0xf89b, KEY_MODE }
Igor M. Liplianinb42e1d72009-06-14 19:41:22 -03001435};
1436
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001437static struct rc_map_table rc_map_su3000_table[] = {
1438 { 0x25, KEY_POWER }, /* right-bottom Red */
1439 { 0x0a, KEY_MUTE }, /* -/-- */
1440 { 0x01, KEY_1 },
1441 { 0x02, KEY_2 },
1442 { 0x03, KEY_3 },
1443 { 0x04, KEY_4 },
1444 { 0x05, KEY_5 },
1445 { 0x06, KEY_6 },
1446 { 0x07, KEY_7 },
1447 { 0x08, KEY_8 },
1448 { 0x09, KEY_9 },
1449 { 0x00, KEY_0 },
1450 { 0x20, KEY_UP }, /* CH+ */
1451 { 0x21, KEY_DOWN }, /* CH+ */
1452 { 0x12, KEY_VOLUMEUP }, /* Brightness Up */
1453 { 0x13, KEY_VOLUMEDOWN },/* Brightness Down */
1454 { 0x1f, KEY_RECORD },
1455 { 0x17, KEY_PLAY },
1456 { 0x16, KEY_PAUSE },
1457 { 0x0b, KEY_STOP },
1458 { 0x27, KEY_FASTFORWARD },/* >> */
1459 { 0x26, KEY_REWIND }, /* << */
1460 { 0x0d, KEY_OK }, /* Mute */
1461 { 0x11, KEY_LEFT }, /* VOL- */
1462 { 0x10, KEY_RIGHT }, /* VOL+ */
1463 { 0x29, KEY_BACK }, /* button under 9 */
1464 { 0x2c, KEY_MENU }, /* TTX */
1465 { 0x2b, KEY_EPG }, /* EPG */
1466 { 0x1e, KEY_RED }, /* OSD */
1467 { 0x0e, KEY_GREEN }, /* Window */
1468 { 0x2d, KEY_YELLOW }, /* button under << */
1469 { 0x0f, KEY_BLUE }, /* bottom yellow button */
1470 { 0x14, KEY_AUDIO }, /* Snapshot */
1471 { 0x38, KEY_TV }, /* TV/Radio */
Justin P. Mattock70f23fd2011-05-10 10:16:21 +02001472 { 0x0c, KEY_ESC } /* upper Red button */
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001473};
1474
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001475static struct rc_map_dvb_usb_table_table keys_tables[] = {
1476 { rc_map_dw210x_table, ARRAY_SIZE(rc_map_dw210x_table) },
1477 { rc_map_tevii_table, ARRAY_SIZE(rc_map_tevii_table) },
1478 { rc_map_tbs_table, ARRAY_SIZE(rc_map_tbs_table) },
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001479 { rc_map_su3000_table, ARRAY_SIZE(rc_map_su3000_table) },
Igor M. Liplianinb42e1d72009-06-14 19:41:22 -03001480};
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001481
1482static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
1483{
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001484 struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
1485 int keymap_size = d->props.rc.legacy.rc_map_size;
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001486 u8 key[2];
Igor M. Liplianin8a8dad72009-06-13 08:10:24 -03001487 struct i2c_msg msg = {
1488 .addr = DW2102_RC_QUERY,
1489 .flags = I2C_M_RD,
1490 .buf = key,
1491 .len = 2
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001492 };
1493 int i;
Igor M. Liplianinb42e1d72009-06-14 19:41:22 -03001494 /* override keymap */
1495 if ((ir_keymap > 0) && (ir_keymap <= ARRAY_SIZE(keys_tables))) {
1496 keymap = keys_tables[ir_keymap - 1].rc_keys ;
1497 keymap_size = keys_tables[ir_keymap - 1].rc_keys_size;
Igor M. Liplianinfeb16e92011-02-25 18:41:22 -03001498 } else if (ir_keymap > ARRAY_SIZE(keys_tables))
1499 return 0; /* none */
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001500
1501 *state = REMOTE_NO_KEY_PRESSED;
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001502 if (d->props.i2c_algo->master_xfer(&d->i2c_adap, &msg, 1) == 1) {
Igor M. Liplianinb42e1d72009-06-14 19:41:22 -03001503 for (i = 0; i < keymap_size ; i++) {
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -03001504 if (rc5_data(&keymap[i]) == msg.buf[0]) {
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001505 *state = REMOTE_KEY_PRESSED;
Mauro Carvalho Chehab34abf212010-07-31 11:24:57 -03001506 *event = keymap[i].keycode;
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001507 break;
1508 }
Igor M. Liplianin8a8dad72009-06-13 08:10:24 -03001509
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001510 }
Igor M. Liplianin8a8dad72009-06-13 08:10:24 -03001511
1512 if ((*state) == REMOTE_KEY_PRESSED)
1513 deb_rc("%s: found rc key: %x, %x, event: %x\n",
1514 __func__, key[0], key[1], (*event));
1515 else if (key[0] != 0xff)
1516 deb_rc("%s: unknown rc key: %x, %x\n",
1517 __func__, key[0], key[1]);
1518
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001519 }
Igor M. Liplianin8a8dad72009-06-13 08:10:24 -03001520
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001521 return 0;
1522}
1523
Jonathan Nieder27351b12011-12-23 19:00:45 -03001524enum dw2102_table_entry {
1525 CYPRESS_DW2102,
1526 CYPRESS_DW2101,
1527 CYPRESS_DW2104,
1528 TEVII_S650,
1529 TERRATEC_CINERGY_S,
1530 CYPRESS_DW3101,
1531 TEVII_S630,
1532 PROF_1100,
1533 TEVII_S660,
1534 PROF_7500,
1535 GENIATECH_SU3000,
1536 TERRATEC_CINERGY_S2,
1537 TEVII_S480_1,
1538 TEVII_S480_2,
1539 X3M_SPC1400HD,
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03001540 TEVII_S421,
1541 TEVII_S632,
Jonathan Nieder27351b12011-12-23 19:00:45 -03001542};
1543
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001544static struct usb_device_id dw2102_table[] = {
Jonathan Nieder27351b12011-12-23 19:00:45 -03001545 [CYPRESS_DW2102] = {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2102)},
1546 [CYPRESS_DW2101] = {USB_DEVICE(USB_VID_CYPRESS, 0x2101)},
1547 [CYPRESS_DW2104] = {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2104)},
1548 [TEVII_S650] = {USB_DEVICE(0x9022, USB_PID_TEVII_S650)},
1549 [TERRATEC_CINERGY_S] = {USB_DEVICE(USB_VID_TERRATEC, USB_PID_CINERGY_S)},
1550 [CYPRESS_DW3101] = {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW3101)},
1551 [TEVII_S630] = {USB_DEVICE(0x9022, USB_PID_TEVII_S630)},
1552 [PROF_1100] = {USB_DEVICE(0x3011, USB_PID_PROF_1100)},
1553 [TEVII_S660] = {USB_DEVICE(0x9022, USB_PID_TEVII_S660)},
1554 [PROF_7500] = {USB_DEVICE(0x3034, 0x7500)},
1555 [GENIATECH_SU3000] = {USB_DEVICE(0x1f4d, 0x3000)},
1556 [TERRATEC_CINERGY_S2] = {USB_DEVICE(USB_VID_TERRATEC, 0x00a8)},
1557 [TEVII_S480_1] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_1)},
1558 [TEVII_S480_2] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_2)},
1559 [X3M_SPC1400HD] = {USB_DEVICE(0x1f4d, 0x3100)},
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03001560 [TEVII_S421] = {USB_DEVICE(0x9022, USB_PID_TEVII_S421)},
1561 [TEVII_S632] = {USB_DEVICE(0x9022, USB_PID_TEVII_S632)},
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001562 { }
1563};
1564
1565MODULE_DEVICE_TABLE(usb, dw2102_table);
1566
1567static int dw2102_load_firmware(struct usb_device *dev,
1568 const struct firmware *frmwr)
1569{
1570 u8 *b, *p;
1571 int ret = 0, i;
1572 u8 reset;
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -03001573 u8 reset16[] = {0, 0, 0, 0, 0, 0, 0};
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001574 const struct firmware *fw;
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001575
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001576 switch (dev->descriptor.idProduct) {
1577 case 0x2101:
Rémi Cardona68236272012-09-28 08:59:32 -03001578 ret = request_firmware(&fw, DW2101_FIRMWARE, &dev->dev);
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001579 if (ret != 0) {
Rémi Cardona68236272012-09-28 08:59:32 -03001580 err(err_str, DW2101_FIRMWARE);
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001581 return ret;
1582 }
1583 break;
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001584 default:
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001585 fw = frmwr;
1586 break;
1587 }
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001588 info("start downloading DW210X firmware");
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001589 p = kmalloc(fw->size, GFP_KERNEL);
1590 reset = 1;
1591 /*stop the CPU*/
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001592 dw210x_op_rw(dev, 0xa0, 0x7f92, 0, &reset, 1, DW210X_WRITE_MSG);
1593 dw210x_op_rw(dev, 0xa0, 0xe600, 0, &reset, 1, DW210X_WRITE_MSG);
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001594
1595 if (p != NULL) {
1596 memcpy(p, fw->data, fw->size);
1597 for (i = 0; i < fw->size; i += 0x40) {
1598 b = (u8 *) p + i;
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001599 if (dw210x_op_rw(dev, 0xa0, i, 0, b , 0x40,
1600 DW210X_WRITE_MSG) != 0x40) {
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001601 err("error while transferring firmware");
1602 ret = -EINVAL;
1603 break;
1604 }
1605 }
1606 /* restart the CPU */
1607 reset = 0;
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001608 if (ret || dw210x_op_rw(dev, 0xa0, 0x7f92, 0, &reset, 1,
1609 DW210X_WRITE_MSG) != 1) {
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001610 err("could not restart the USB controller CPU.");
1611 ret = -EINVAL;
1612 }
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001613 if (ret || dw210x_op_rw(dev, 0xa0, 0xe600, 0, &reset, 1,
1614 DW210X_WRITE_MSG) != 1) {
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001615 err("could not restart the USB controller CPU.");
1616 ret = -EINVAL;
1617 }
1618 /* init registers */
1619 switch (dev->descriptor.idProduct) {
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001620 case USB_PID_TEVII_S650:
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001621 dw2104_properties.rc.legacy.rc_map_table = rc_map_tevii_table;
1622 dw2104_properties.rc.legacy.rc_map_size =
1623 ARRAY_SIZE(rc_map_tevii_table);
Igor M. Liplianinb42e1d72009-06-14 19:41:22 -03001624 case USB_PID_DW2104:
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001625 reset = 1;
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001626 dw210x_op_rw(dev, 0xc4, 0x0000, 0, &reset, 1,
1627 DW210X_WRITE_MSG);
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001628 /* break omitted intentionally */
1629 case USB_PID_DW3101:
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001630 reset = 0;
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001631 dw210x_op_rw(dev, 0xbf, 0x0040, 0, &reset, 0,
1632 DW210X_WRITE_MSG);
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001633 break;
Igor M. Liplianin4cc0edf2008-11-05 22:12:56 -03001634 case USB_PID_CINERGY_S:
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001635 case USB_PID_DW2102:
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001636 dw210x_op_rw(dev, 0xbf, 0x0040, 0, &reset, 0,
1637 DW210X_WRITE_MSG);
1638 dw210x_op_rw(dev, 0xb9, 0x0000, 0, &reset16[0], 2,
1639 DW210X_READ_MSG);
1640 /* check STV0299 frontend */
1641 dw210x_op_rw(dev, 0xb5, 0, 0, &reset16[0], 2,
1642 DW210X_READ_MSG);
Igor M. Liplianinea023df2008-12-04 12:49:23 -03001643 if ((reset16[0] == 0xa1) || (reset16[0] == 0x80)) {
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001644 dw2102_properties.i2c_algo = &dw2102_i2c_algo;
Michael Krufky77eed212011-09-06 09:31:57 -03001645 dw2102_properties.adapter->fe[0].tuner_attach = &dw2102_tuner_attach;
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -03001646 break;
1647 } else {
1648 /* check STV0288 frontend */
1649 reset16[0] = 0xd0;
1650 reset16[1] = 1;
1651 reset16[2] = 0;
1652 dw210x_op_rw(dev, 0xc2, 0, 0, &reset16[0], 3,
1653 DW210X_WRITE_MSG);
1654 dw210x_op_rw(dev, 0xc3, 0xd1, 0, &reset16[0], 3,
1655 DW210X_READ_MSG);
1656 if (reset16[2] == 0x11) {
1657 dw2102_properties.i2c_algo = &dw2102_earda_i2c_algo;
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -03001658 break;
1659 }
1660 }
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001661 case 0x2101:
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001662 dw210x_op_rw(dev, 0xbc, 0x0030, 0, &reset16[0], 2,
1663 DW210X_READ_MSG);
1664 dw210x_op_rw(dev, 0xba, 0x0000, 0, &reset16[0], 7,
1665 DW210X_READ_MSG);
1666 dw210x_op_rw(dev, 0xba, 0x0000, 0, &reset16[0], 7,
1667 DW210X_READ_MSG);
1668 dw210x_op_rw(dev, 0xb9, 0x0000, 0, &reset16[0], 2,
1669 DW210X_READ_MSG);
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001670 break;
1671 }
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001672
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001673 msleep(100);
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001674 kfree(p);
1675 }
1676 return ret;
1677}
1678
1679static struct dvb_usb_device_properties dw2102_properties = {
1680 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1681 .usb_ctrl = DEVICE_SPECIFIC,
Rémi Cardona68236272012-09-28 08:59:32 -03001682 .firmware = DW2102_FIRMWARE,
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001683 .no_reconnect = 1,
1684
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001685 .i2c_algo = &dw2102_serit_i2c_algo,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001686
1687 .rc.legacy = {
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001688 .rc_map_table = rc_map_dw210x_table,
1689 .rc_map_size = ARRAY_SIZE(rc_map_dw210x_table),
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001690 .rc_interval = 150,
1691 .rc_query = dw2102_rc_query,
1692 },
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001693
1694 .generic_bulk_ctrl_endpoint = 0x81,
1695 /* parameter for the MPEG2-data transfer */
1696 .num_adapters = 1,
1697 .download_firmware = dw2102_load_firmware,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001698 .read_mac_address = dw210x_read_mac_address,
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001699 .adapter = {
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001700 {
Michael Krufky77eed212011-09-06 09:31:57 -03001701 .num_frontends = 1,
1702 .fe = {{
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001703 .frontend_attach = dw2102_frontend_attach,
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001704 .stream = {
1705 .type = USB_BULK,
1706 .count = 8,
1707 .endpoint = 0x82,
1708 .u = {
1709 .bulk = {
1710 .buffersize = 4096,
1711 }
1712 }
1713 },
Michael Krufky77eed212011-09-06 09:31:57 -03001714 }},
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001715 }
1716 },
Igor M. Liplianin4cc0edf2008-11-05 22:12:56 -03001717 .num_device_descs = 3,
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001718 .devices = {
1719 {"DVBWorld DVB-S 2102 USB2.0",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001720 {&dw2102_table[CYPRESS_DW2102], NULL},
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001721 {NULL},
1722 },
1723 {"DVBWorld DVB-S 2101 USB2.0",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001724 {&dw2102_table[CYPRESS_DW2101], NULL},
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001725 {NULL},
1726 },
Igor M. Liplianin4cc0edf2008-11-05 22:12:56 -03001727 {"TerraTec Cinergy S USB",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001728 {&dw2102_table[TERRATEC_CINERGY_S], NULL},
Igor M. Liplianin4cc0edf2008-11-05 22:12:56 -03001729 {NULL},
1730 },
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001731 }
1732};
1733
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001734static struct dvb_usb_device_properties dw2104_properties = {
1735 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1736 .usb_ctrl = DEVICE_SPECIFIC,
Rémi Cardona68236272012-09-28 08:59:32 -03001737 .firmware = DW2104_FIRMWARE,
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001738 .no_reconnect = 1,
1739
1740 .i2c_algo = &dw2104_i2c_algo,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001741 .rc.legacy = {
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001742 .rc_map_table = rc_map_dw210x_table,
1743 .rc_map_size = ARRAY_SIZE(rc_map_dw210x_table),
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001744 .rc_interval = 150,
1745 .rc_query = dw2102_rc_query,
1746 },
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001747
1748 .generic_bulk_ctrl_endpoint = 0x81,
1749 /* parameter for the MPEG2-data transfer */
1750 .num_adapters = 1,
1751 .download_firmware = dw2102_load_firmware,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001752 .read_mac_address = dw210x_read_mac_address,
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001753 .adapter = {
1754 {
Michael Krufky77eed212011-09-06 09:31:57 -03001755 .num_frontends = 1,
1756 .fe = {{
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001757 .frontend_attach = dw2104_frontend_attach,
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001758 .stream = {
1759 .type = USB_BULK,
1760 .count = 8,
1761 .endpoint = 0x82,
1762 .u = {
1763 .bulk = {
1764 .buffersize = 4096,
1765 }
1766 }
1767 },
Michael Krufky77eed212011-09-06 09:31:57 -03001768 }},
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001769 }
1770 },
1771 .num_device_descs = 2,
1772 .devices = {
1773 { "DVBWorld DW2104 USB2.0",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001774 {&dw2102_table[CYPRESS_DW2104], NULL},
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001775 {NULL},
1776 },
1777 { "TeVii S650 USB2.0",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001778 {&dw2102_table[TEVII_S650], NULL},
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001779 {NULL},
1780 },
1781 }
1782};
1783
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001784static struct dvb_usb_device_properties dw3101_properties = {
1785 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1786 .usb_ctrl = DEVICE_SPECIFIC,
Rémi Cardona68236272012-09-28 08:59:32 -03001787 .firmware = DW3101_FIRMWARE,
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001788 .no_reconnect = 1,
1789
1790 .i2c_algo = &dw3101_i2c_algo,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001791 .rc.legacy = {
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001792 .rc_map_table = rc_map_dw210x_table,
1793 .rc_map_size = ARRAY_SIZE(rc_map_dw210x_table),
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001794 .rc_interval = 150,
1795 .rc_query = dw2102_rc_query,
1796 },
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001797
1798 .generic_bulk_ctrl_endpoint = 0x81,
1799 /* parameter for the MPEG2-data transfer */
1800 .num_adapters = 1,
1801 .download_firmware = dw2102_load_firmware,
1802 .read_mac_address = dw210x_read_mac_address,
1803 .adapter = {
1804 {
Michael Krufky77eed212011-09-06 09:31:57 -03001805 .num_frontends = 1,
1806 .fe = {{
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001807 .frontend_attach = dw3101_frontend_attach,
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001808 .tuner_attach = dw3101_tuner_attach,
1809 .stream = {
1810 .type = USB_BULK,
1811 .count = 8,
1812 .endpoint = 0x82,
1813 .u = {
1814 .bulk = {
1815 .buffersize = 4096,
1816 }
1817 }
1818 },
Michael Krufky77eed212011-09-06 09:31:57 -03001819 }},
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001820 }
1821 },
1822 .num_device_descs = 1,
1823 .devices = {
1824 { "DVBWorld DVB-C 3101 USB2.0",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001825 {&dw2102_table[CYPRESS_DW3101], NULL},
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001826 {NULL},
1827 },
1828 }
1829};
1830
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001831static struct dvb_usb_device_properties s6x0_properties = {
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001832 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1833 .usb_ctrl = DEVICE_SPECIFIC,
Igor M. Liplianin52c506e2011-02-25 18:41:23 -03001834 .size_of_priv = sizeof(struct s6x0_state),
Rémi Cardona68236272012-09-28 08:59:32 -03001835 .firmware = S630_FIRMWARE,
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001836 .no_reconnect = 1,
1837
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001838 .i2c_algo = &s6x0_i2c_algo,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001839 .rc.legacy = {
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001840 .rc_map_table = rc_map_tevii_table,
1841 .rc_map_size = ARRAY_SIZE(rc_map_tevii_table),
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001842 .rc_interval = 150,
1843 .rc_query = dw2102_rc_query,
1844 },
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001845
1846 .generic_bulk_ctrl_endpoint = 0x81,
1847 .num_adapters = 1,
1848 .download_firmware = dw2102_load_firmware,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001849 .read_mac_address = s6x0_read_mac_address,
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001850 .adapter = {
1851 {
Michael Krufky77eed212011-09-06 09:31:57 -03001852 .num_frontends = 1,
1853 .fe = {{
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001854 .frontend_attach = zl100313_frontend_attach,
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001855 .stream = {
1856 .type = USB_BULK,
1857 .count = 8,
1858 .endpoint = 0x82,
1859 .u = {
1860 .bulk = {
1861 .buffersize = 4096,
1862 }
1863 }
1864 },
Michael Krufky77eed212011-09-06 09:31:57 -03001865 }},
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001866 }
1867 },
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001868 .num_device_descs = 1,
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001869 .devices = {
1870 {"TeVii S630 USB",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001871 {&dw2102_table[TEVII_S630], NULL},
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001872 {NULL},
1873 },
1874 }
1875};
1876
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001877struct dvb_usb_device_properties *p1100;
1878static struct dvb_usb_device_description d1100 = {
1879 "Prof 1100 USB ",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001880 {&dw2102_table[PROF_1100], NULL},
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001881 {NULL},
1882};
1883
1884struct dvb_usb_device_properties *s660;
1885static struct dvb_usb_device_description d660 = {
1886 "TeVii S660 USB",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001887 {&dw2102_table[TEVII_S660], NULL},
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001888 {NULL},
1889};
1890
Igor M. Liplianine8f50552011-02-25 18:41:23 -03001891static struct dvb_usb_device_description d480_1 = {
1892 "TeVii S480.1 USB",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001893 {&dw2102_table[TEVII_S480_1], NULL},
Igor M. Liplianine8f50552011-02-25 18:41:23 -03001894 {NULL},
1895};
1896
1897static struct dvb_usb_device_description d480_2 = {
1898 "TeVii S480.2 USB",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001899 {&dw2102_table[TEVII_S480_2], NULL},
Igor M. Liplianine8f50552011-02-25 18:41:23 -03001900 {NULL},
1901};
1902
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001903struct dvb_usb_device_properties *p7500;
1904static struct dvb_usb_device_description d7500 = {
1905 "Prof 7500 USB DVB-S2",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001906 {&dw2102_table[PROF_7500], NULL},
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001907 {NULL},
1908};
1909
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03001910struct dvb_usb_device_properties *s421;
1911static struct dvb_usb_device_description d421 = {
1912 "TeVii S421 PCI",
1913 {&dw2102_table[TEVII_S421], NULL},
1914 {NULL},
1915};
1916
1917static struct dvb_usb_device_description d632 = {
1918 "TeVii S632 USB",
1919 {&dw2102_table[TEVII_S632], NULL},
1920 {NULL},
1921};
1922
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001923static struct dvb_usb_device_properties su3000_properties = {
1924 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1925 .usb_ctrl = DEVICE_SPECIFIC,
1926 .size_of_priv = sizeof(struct su3000_state),
1927 .power_ctrl = su3000_power_ctrl,
1928 .num_adapters = 1,
1929 .identify_state = su3000_identify_state,
1930 .i2c_algo = &su3000_i2c_algo,
1931
1932 .rc.legacy = {
1933 .rc_map_table = rc_map_su3000_table,
1934 .rc_map_size = ARRAY_SIZE(rc_map_su3000_table),
1935 .rc_interval = 150,
1936 .rc_query = dw2102_rc_query,
1937 },
1938
1939 .read_mac_address = su3000_read_mac_address,
1940
1941 .generic_bulk_ctrl_endpoint = 0x01,
1942
1943 .adapter = {
1944 {
Michael Krufky77eed212011-09-06 09:31:57 -03001945 .num_frontends = 1,
1946 .fe = {{
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001947 .streaming_ctrl = su3000_streaming_ctrl,
1948 .frontend_attach = su3000_frontend_attach,
1949 .stream = {
1950 .type = USB_BULK,
1951 .count = 8,
1952 .endpoint = 0x82,
1953 .u = {
1954 .bulk = {
1955 .buffersize = 4096,
1956 }
1957 }
1958 }
Michael Krufky77eed212011-09-06 09:31:57 -03001959 }},
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001960 }
1961 },
Mauro Carvalho Chehabb7e38632012-07-07 00:19:20 -03001962 .num_device_descs = 3,
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001963 .devices = {
1964 { "SU3000HD DVB-S USB2.0",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001965 { &dw2102_table[GENIATECH_SU3000], NULL },
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001966 { NULL },
1967 },
Igor M. Liplianin2adc5912011-02-25 18:41:22 -03001968 { "Terratec Cinergy S2 USB HD",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001969 { &dw2102_table[TERRATEC_CINERGY_S2], NULL },
Igor M. Liplianin2adc5912011-02-25 18:41:22 -03001970 { NULL },
1971 },
Igor M. Liplianin5265ea52011-02-27 16:17:25 -03001972 { "X3M TV SPC1400HD PCI",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001973 { &dw2102_table[X3M_SPC1400HD], NULL },
Igor M. Liplianin5265ea52011-02-27 16:17:25 -03001974 { NULL },
1975 },
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001976 }
1977};
1978
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001979static int dw2102_probe(struct usb_interface *intf,
1980 const struct usb_device_id *id)
1981{
Thomas Meyer68dd9dd2011-11-17 18:43:40 -03001982 p1100 = kmemdup(&s6x0_properties,
1983 sizeof(struct dvb_usb_device_properties), GFP_KERNEL);
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001984 if (!p1100)
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001985 return -ENOMEM;
1986 /* copy default structure */
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001987 /* fill only different fields */
Rémi Cardona68236272012-09-28 08:59:32 -03001988 p1100->firmware = P1100_FIRMWARE;
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001989 p1100->devices[0] = d1100;
1990 p1100->rc.legacy.rc_map_table = rc_map_tbs_table;
1991 p1100->rc.legacy.rc_map_size = ARRAY_SIZE(rc_map_tbs_table);
Michael Krufky77eed212011-09-06 09:31:57 -03001992 p1100->adapter->fe[0].frontend_attach = stv0288_frontend_attach;
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001993
Thomas Meyer68dd9dd2011-11-17 18:43:40 -03001994 s660 = kmemdup(&s6x0_properties,
1995 sizeof(struct dvb_usb_device_properties), GFP_KERNEL);
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001996 if (!s660) {
1997 kfree(p1100);
1998 return -ENOMEM;
1999 }
Rémi Cardona68236272012-09-28 08:59:32 -03002000 s660->firmware = S660_FIRMWARE;
Igor M. Liplianine8f50552011-02-25 18:41:23 -03002001 s660->num_device_descs = 3;
Igor M. Liplianin195288d2011-02-25 18:41:22 -03002002 s660->devices[0] = d660;
Igor M. Liplianine8f50552011-02-25 18:41:23 -03002003 s660->devices[1] = d480_1;
2004 s660->devices[2] = d480_2;
Michael Krufky77eed212011-09-06 09:31:57 -03002005 s660->adapter->fe[0].frontend_attach = ds3000_frontend_attach;
Igor M. Liplianin195288d2011-02-25 18:41:22 -03002006
Thomas Meyer68dd9dd2011-11-17 18:43:40 -03002007 p7500 = kmemdup(&s6x0_properties,
2008 sizeof(struct dvb_usb_device_properties), GFP_KERNEL);
Igor M. Liplianin195288d2011-02-25 18:41:22 -03002009 if (!p7500) {
2010 kfree(p1100);
2011 kfree(s660);
2012 return -ENOMEM;
2013 }
Rémi Cardona68236272012-09-28 08:59:32 -03002014 p7500->firmware = P7500_FIRMWARE;
Igor M. Liplianincd79d332009-12-14 20:24:56 -03002015 p7500->devices[0] = d7500;
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03002016 p7500->rc.legacy.rc_map_table = rc_map_tbs_table;
2017 p7500->rc.legacy.rc_map_size = ARRAY_SIZE(rc_map_tbs_table);
Michael Krufky77eed212011-09-06 09:31:57 -03002018 p7500->adapter->fe[0].frontend_attach = prof_7500_frontend_attach;
Igor M. Liplianincd79d332009-12-14 20:24:56 -03002019
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03002020
2021 s421 = kmemdup(&su3000_properties,
2022 sizeof(struct dvb_usb_device_properties), GFP_KERNEL);
2023 if (!s421) {
2024 kfree(p1100);
2025 kfree(s660);
2026 kfree(p7500);
2027 return -ENOMEM;
2028 }
2029 s421->num_device_descs = 2;
2030 s421->devices[0] = d421;
2031 s421->devices[1] = d632;
2032 s421->adapter->fe[0].frontend_attach = m88rs2000_frontend_attach;
2033
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03002034 if (0 == dvb_usb_device_init(intf, &dw2102_properties,
2035 THIS_MODULE, NULL, adapter_nr) ||
2036 0 == dvb_usb_device_init(intf, &dw2104_properties,
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03002037 THIS_MODULE, NULL, adapter_nr) ||
2038 0 == dvb_usb_device_init(intf, &dw3101_properties,
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03002039 THIS_MODULE, NULL, adapter_nr) ||
Igor M. Liplianin141cc352009-11-27 14:37:35 -03002040 0 == dvb_usb_device_init(intf, &s6x0_properties,
Igor M. Liplianincd79d332009-12-14 20:24:56 -03002041 THIS_MODULE, NULL, adapter_nr) ||
Igor M. Liplianin195288d2011-02-25 18:41:22 -03002042 0 == dvb_usb_device_init(intf, p1100,
2043 THIS_MODULE, NULL, adapter_nr) ||
2044 0 == dvb_usb_device_init(intf, s660,
2045 THIS_MODULE, NULL, adapter_nr) ||
Igor M. Liplianincd79d332009-12-14 20:24:56 -03002046 0 == dvb_usb_device_init(intf, p7500,
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03002047 THIS_MODULE, NULL, adapter_nr) ||
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03002048 0 == dvb_usb_device_init(intf, s421,
2049 THIS_MODULE, NULL, adapter_nr) ||
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03002050 0 == dvb_usb_device_init(intf, &su3000_properties,
2051 THIS_MODULE, NULL, adapter_nr))
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03002052 return 0;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03002053
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03002054 return -ENODEV;
Igor M Liplianin7fd48282008-07-20 08:05:50 -03002055}
2056
2057static struct usb_driver dw2102_driver = {
2058 .name = "dw2102",
2059 .probe = dw2102_probe,
2060 .disconnect = dvb_usb_device_exit,
2061 .id_table = dw2102_table,
2062};
2063
Greg Kroah-Hartmanecb3b2b2011-11-18 09:46:12 -08002064module_usb_driver(dw2102_driver);
Igor M Liplianin7fd48282008-07-20 08:05:50 -03002065
2066MODULE_AUTHOR("Igor M. Liplianin (c) liplianin@me.by");
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03002067MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101, 2102, DVB-S2 2104,"
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03002068 " DVB-C 3101 USB2.0,"
2069 " TeVii S600, S630, S650, S660, S480, S421, S632"
2070 " Prof 1100, 7500 USB2.0,"
2071 " Geniatech SU3000 devices");
Igor M Liplianin7fd48282008-07-20 08:05:50 -03002072MODULE_VERSION("0.1");
2073MODULE_LICENSE("GPL");
Rémi Cardona68236272012-09-28 08:59:32 -03002074MODULE_FIRMWARE(DW2101_FIRMWARE);
2075MODULE_FIRMWARE(DW2102_FIRMWARE);
2076MODULE_FIRMWARE(DW2104_FIRMWARE);
2077MODULE_FIRMWARE(DW3101_FIRMWARE);
2078MODULE_FIRMWARE(S630_FIRMWARE);
2079MODULE_FIRMWARE(S660_FIRMWARE);
2080MODULE_FIRMWARE(P1100_FIRMWARE);
2081MODULE_FIRMWARE(P7500_FIRMWARE);