blob: 5ae3529f81ad8a3b219c55199c449d83be60e8b0 [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. Liplianin141cc352009-11-27 14:37:35 -0300958static struct stv0900_config dw2104a_stv0900_config = {
959 .demod_address = 0x6a,
960 .demod_mode = 0,
961 .xtal = 27000000,
962 .clkmode = 3,/* 0-CLKI, 2-XTALI, else AUTO */
963 .diseqc_mode = 2,/* 2/3 PWM */
964 .tun1_maddress = 0,/* 0x60 */
965 .tun1_adc = 0,/* 2 Vpp */
966 .path1_mode = 3,
967};
968
969static struct stb6100_config dw2104a_stb6100_config = {
970 .tuner_address = 0x60,
971 .refclock = 27000000,
972};
973
974static struct stv0900_config dw2104_stv0900_config = {
975 .demod_address = 0x68,
976 .demod_mode = 0,
977 .xtal = 8000000,
978 .clkmode = 3,
979 .diseqc_mode = 2,
980 .tun1_maddress = 0,
981 .tun1_adc = 1,/* 1 Vpp */
982 .path1_mode = 3,
983};
984
985static struct stv6110_config dw2104_stv6110_config = {
986 .i2c_address = 0x60,
987 .mclk = 16000000,
988 .clk_div = 1,
989};
990
Igor M. Liplianincd79d332009-12-14 20:24:56 -0300991static struct stv0900_config prof_7500_stv0900_config = {
992 .demod_address = 0x6a,
993 .demod_mode = 0,
994 .xtal = 27000000,
995 .clkmode = 3,/* 0-CLKI, 2-XTALI, else AUTO */
996 .diseqc_mode = 2,/* 2/3 PWM */
997 .tun1_maddress = 0,/* 0x60 */
998 .tun1_adc = 0,/* 2 Vpp */
999 .path1_mode = 3,
1000 .tun1_type = 3,
Igor M. Liplianinfa8bae12011-02-25 18:41:22 -03001001 .set_lock_led = dw210x_led_ctrl,
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001002};
1003
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001004static struct ds3000_config su3000_ds3000_config = {
1005 .demod_address = 0x68,
1006 .ci_mode = 1,
1007};
1008
Konstantin Dimitrov73f0af42012-12-23 19:25:38 -03001009static struct ts2020_config su3000_ts2020_config = {
1010 .tuner_address = 0x60,
1011};
1012
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03001013static u8 m88rs2000_inittab[] = {
1014 DEMOD_WRITE, 0x9a, 0x30,
1015 DEMOD_WRITE, 0x00, 0x01,
1016 WRITE_DELAY, 0x19, 0x00,
1017 DEMOD_WRITE, 0x00, 0x00,
1018 DEMOD_WRITE, 0x9a, 0xb0,
1019 DEMOD_WRITE, 0x81, 0xc1,
1020 TUNER_WRITE, 0x42, 0x73,
1021 TUNER_WRITE, 0x05, 0x07,
1022 TUNER_WRITE, 0x20, 0x27,
1023 TUNER_WRITE, 0x07, 0x02,
1024 TUNER_WRITE, 0x11, 0xff,
1025 TUNER_WRITE, 0x60, 0xf9,
1026 TUNER_WRITE, 0x08, 0x01,
1027 TUNER_WRITE, 0x00, 0x41,
1028 DEMOD_WRITE, 0x81, 0x81,
1029 DEMOD_WRITE, 0x86, 0xc6,
1030 DEMOD_WRITE, 0x9a, 0x30,
1031 DEMOD_WRITE, 0xf0, 0x80,
1032 DEMOD_WRITE, 0xf1, 0xbf,
1033 DEMOD_WRITE, 0xb0, 0x45,
1034 DEMOD_WRITE, 0xb2, 0x01,
1035 DEMOD_WRITE, 0x9a, 0xb0,
1036 0xff, 0xaa, 0xff
1037};
1038
1039static struct m88rs2000_config s421_m88rs2000_config = {
1040 .demod_addr = 0x68,
1041 .tuner_addr = 0x60,
1042 .inittab = m88rs2000_inittab,
1043};
1044
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001045static int dw2104_frontend_attach(struct dvb_usb_adapter *d)
1046{
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001047 struct dvb_tuner_ops *tuner_ops = NULL;
1048
1049 if (demod_probe & 4) {
Michael Krufky77eed212011-09-06 09:31:57 -03001050 d->fe_adap[0].fe = dvb_attach(stv0900_attach, &dw2104a_stv0900_config,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001051 &d->dev->i2c_adap, 0);
Michael Krufky77eed212011-09-06 09:31:57 -03001052 if (d->fe_adap[0].fe != NULL) {
1053 if (dvb_attach(stb6100_attach, d->fe_adap[0].fe,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001054 &dw2104a_stb6100_config,
1055 &d->dev->i2c_adap)) {
Michael Krufky77eed212011-09-06 09:31:57 -03001056 tuner_ops = &d->fe_adap[0].fe->ops.tuner_ops;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001057 tuner_ops->set_frequency = stb6100_set_freq;
1058 tuner_ops->get_frequency = stb6100_get_freq;
1059 tuner_ops->set_bandwidth = stb6100_set_bandw;
1060 tuner_ops->get_bandwidth = stb6100_get_bandw;
Michael Krufky77eed212011-09-06 09:31:57 -03001061 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001062 info("Attached STV0900+STB6100!\n");
1063 return 0;
1064 }
1065 }
1066 }
1067
1068 if (demod_probe & 2) {
Michael Krufky77eed212011-09-06 09:31:57 -03001069 d->fe_adap[0].fe = dvb_attach(stv0900_attach, &dw2104_stv0900_config,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001070 &d->dev->i2c_adap, 0);
Michael Krufky77eed212011-09-06 09:31:57 -03001071 if (d->fe_adap[0].fe != NULL) {
1072 if (dvb_attach(stv6110_attach, d->fe_adap[0].fe,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001073 &dw2104_stv6110_config,
1074 &d->dev->i2c_adap)) {
Michael Krufky77eed212011-09-06 09:31:57 -03001075 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001076 info("Attached STV0900+STV6110A!\n");
1077 return 0;
1078 }
1079 }
1080 }
1081
1082 if (demod_probe & 1) {
Michael Krufky77eed212011-09-06 09:31:57 -03001083 d->fe_adap[0].fe = dvb_attach(cx24116_attach, &dw2104_config,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001084 &d->dev->i2c_adap);
Michael Krufky77eed212011-09-06 09:31:57 -03001085 if (d->fe_adap[0].fe != NULL) {
1086 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001087 info("Attached cx24116!\n");
1088 return 0;
1089 }
1090 }
1091
Michael Krufky77eed212011-09-06 09:31:57 -03001092 d->fe_adap[0].fe = dvb_attach(ds3000_attach, &dw2104_ds3000_config,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001093 &d->dev->i2c_adap);
Michael Krufky77eed212011-09-06 09:31:57 -03001094 if (d->fe_adap[0].fe != NULL) {
Konstantin Dimitrov73f0af42012-12-23 19:25:38 -03001095 dvb_attach(ts2020_attach, d->fe_adap[0].fe,
1096 &dw2104_ts2020_config, &d->dev->i2c_adap);
Michael Krufky77eed212011-09-06 09:31:57 -03001097 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001098 info("Attached DS3000!\n");
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001099 return 0;
1100 }
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001101
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001102 return -EIO;
1103}
1104
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001105static struct dvb_usb_device_properties dw2102_properties;
Igor M. Liplianinb42e1d72009-06-14 19:41:22 -03001106static struct dvb_usb_device_properties dw2104_properties;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001107static struct dvb_usb_device_properties s6x0_properties;
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001108
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001109static int dw2102_frontend_attach(struct dvb_usb_adapter *d)
1110{
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001111 if (dw2102_properties.i2c_algo == &dw2102_serit_i2c_algo) {
1112 /*dw2102_properties.adapter->tuner_attach = NULL;*/
Michael Krufky77eed212011-09-06 09:31:57 -03001113 d->fe_adap[0].fe = dvb_attach(si21xx_attach, &serit_sp1511lhb_config,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001114 &d->dev->i2c_adap);
Michael Krufky77eed212011-09-06 09:31:57 -03001115 if (d->fe_adap[0].fe != NULL) {
1116 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001117 info("Attached si21xx!\n");
1118 return 0;
1119 }
1120 }
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001121
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -03001122 if (dw2102_properties.i2c_algo == &dw2102_earda_i2c_algo) {
Michael Krufky77eed212011-09-06 09:31:57 -03001123 d->fe_adap[0].fe = dvb_attach(stv0288_attach, &earda_config,
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -03001124 &d->dev->i2c_adap);
Michael Krufky77eed212011-09-06 09:31:57 -03001125 if (d->fe_adap[0].fe != NULL) {
1126 if (dvb_attach(stb6000_attach, d->fe_adap[0].fe, 0x61,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001127 &d->dev->i2c_adap)) {
Michael Krufky77eed212011-09-06 09:31:57 -03001128 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001129 info("Attached stv0288!\n");
1130 return 0;
1131 }
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -03001132 }
1133 }
1134
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001135 if (dw2102_properties.i2c_algo == &dw2102_i2c_algo) {
1136 /*dw2102_properties.adapter->tuner_attach = dw2102_tuner_attach;*/
Michael Krufky77eed212011-09-06 09:31:57 -03001137 d->fe_adap[0].fe = dvb_attach(stv0299_attach, &sharp_z0194a_config,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001138 &d->dev->i2c_adap);
Michael Krufky77eed212011-09-06 09:31:57 -03001139 if (d->fe_adap[0].fe != NULL) {
1140 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001141 info("Attached stv0299!\n");
1142 return 0;
1143 }
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001144 }
1145 return -EIO;
1146}
1147
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001148static int dw3101_frontend_attach(struct dvb_usb_adapter *d)
1149{
Michael Krufky77eed212011-09-06 09:31:57 -03001150 d->fe_adap[0].fe = dvb_attach(tda10023_attach, &dw3101_tda10023_config,
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001151 &d->dev->i2c_adap, 0x48);
Michael Krufky77eed212011-09-06 09:31:57 -03001152 if (d->fe_adap[0].fe != NULL) {
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001153 info("Attached tda10023!\n");
1154 return 0;
1155 }
1156 return -EIO;
1157}
1158
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001159static int zl100313_frontend_attach(struct dvb_usb_adapter *d)
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001160{
Michael Krufky77eed212011-09-06 09:31:57 -03001161 d->fe_adap[0].fe = dvb_attach(mt312_attach, &zl313_config,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001162 &d->dev->i2c_adap);
Michael Krufky77eed212011-09-06 09:31:57 -03001163 if (d->fe_adap[0].fe != NULL) {
1164 if (dvb_attach(zl10039_attach, d->fe_adap[0].fe, 0x60,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001165 &d->dev->i2c_adap)) {
Michael Krufky77eed212011-09-06 09:31:57 -03001166 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001167 info("Attached zl100313+zl10039!\n");
1168 return 0;
1169 }
1170 }
1171
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001172 return -EIO;
1173}
1174
1175static int stv0288_frontend_attach(struct dvb_usb_adapter *d)
1176{
Igor M. Liplianinfd5466d2011-02-27 16:22:52 -03001177 u8 obuf[] = {7, 1};
1178
Michael Krufky77eed212011-09-06 09:31:57 -03001179 d->fe_adap[0].fe = dvb_attach(stv0288_attach, &earda_config,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001180 &d->dev->i2c_adap);
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001181
Michael Krufky77eed212011-09-06 09:31:57 -03001182 if (d->fe_adap[0].fe == NULL)
Igor M. Liplianinfd5466d2011-02-27 16:22:52 -03001183 return -EIO;
1184
Michael Krufky77eed212011-09-06 09:31:57 -03001185 if (NULL == dvb_attach(stb6000_attach, d->fe_adap[0].fe, 0x61, &d->dev->i2c_adap))
Igor M. Liplianinfd5466d2011-02-27 16:22:52 -03001186 return -EIO;
1187
Michael Krufky77eed212011-09-06 09:31:57 -03001188 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianinfd5466d2011-02-27 16:22:52 -03001189
1190 dw210x_op_rw(d->dev->udev, 0x8a, 0, 0, obuf, 2, DW210X_WRITE_MSG);
1191
1192 info("Attached stv0288+stb6000!\n");
1193
1194 return 0;
1195
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001196}
1197
1198static int ds3000_frontend_attach(struct dvb_usb_adapter *d)
1199{
Igor M. Liplianin52c506e2011-02-25 18:41:23 -03001200 struct s6x0_state *st = (struct s6x0_state *)d->dev->priv;
Igor M. Liplianin5a530cb2011-02-25 18:41:23 -03001201 u8 obuf[] = {7, 1};
Igor M. Liplianin52c506e2011-02-25 18:41:23 -03001202
Michael Krufky77eed212011-09-06 09:31:57 -03001203 d->fe_adap[0].fe = dvb_attach(ds3000_attach, &dw2104_ds3000_config,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001204 &d->dev->i2c_adap);
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001205
Michael Krufky77eed212011-09-06 09:31:57 -03001206 if (d->fe_adap[0].fe == NULL)
Igor M. Liplianin52c506e2011-02-25 18:41:23 -03001207 return -EIO;
1208
Konstantin Dimitrov73f0af42012-12-23 19:25:38 -03001209 dvb_attach(ts2020_attach, d->fe_adap[0].fe, &dw2104_ts2020_config,
1210 &d->dev->i2c_adap);
1211
Michael Krufky77eed212011-09-06 09:31:57 -03001212 st->old_set_voltage = d->fe_adap[0].fe->ops.set_voltage;
1213 d->fe_adap[0].fe->ops.set_voltage = s660_set_voltage;
Igor M. Liplianin5a530cb2011-02-25 18:41:23 -03001214
1215 dw210x_op_rw(d->dev->udev, 0x8a, 0, 0, obuf, 2, DW210X_WRITE_MSG);
1216
Igor M. Liplianin52c506e2011-02-25 18:41:23 -03001217 info("Attached ds3000+ds2020!\n");
1218
1219 return 0;
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001220}
1221
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001222static int prof_7500_frontend_attach(struct dvb_usb_adapter *d)
1223{
Igor M. Liplianin4e59df82011-02-25 18:41:23 -03001224 u8 obuf[] = {7, 1};
1225
Michael Krufky77eed212011-09-06 09:31:57 -03001226 d->fe_adap[0].fe = dvb_attach(stv0900_attach, &prof_7500_stv0900_config,
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001227 &d->dev->i2c_adap, 0);
Michael Krufky77eed212011-09-06 09:31:57 -03001228 if (d->fe_adap[0].fe == NULL)
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001229 return -EIO;
Igor M. Liplianin4e59df82011-02-25 18:41:23 -03001230
Michael Krufky77eed212011-09-06 09:31:57 -03001231 d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001232
Igor M. Liplianin4e59df82011-02-25 18:41:23 -03001233 dw210x_op_rw(d->dev->udev, 0x8a, 0, 0, obuf, 2, DW210X_WRITE_MSG);
1234
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001235 info("Attached STV0900+STB6100A!\n");
1236
1237 return 0;
1238}
1239
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001240static int su3000_frontend_attach(struct dvb_usb_adapter *d)
1241{
1242 u8 obuf[3] = { 0xe, 0x80, 0 };
1243 u8 ibuf[] = { 0 };
1244
1245 if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1246 err("command 0x0e transfer failed.");
1247
1248 obuf[0] = 0xe;
1249 obuf[1] = 0x83;
1250 obuf[2] = 0;
1251
1252 if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1253 err("command 0x0e transfer failed.");
1254
1255 obuf[0] = 0xe;
1256 obuf[1] = 0x83;
1257 obuf[2] = 1;
1258
1259 if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
1260 err("command 0x0e transfer failed.");
1261
1262 obuf[0] = 0x51;
1263
1264 if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
1265 err("command 0x51 transfer failed.");
1266
Michael Krufky77eed212011-09-06 09:31:57 -03001267 d->fe_adap[0].fe = dvb_attach(ds3000_attach, &su3000_ds3000_config,
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001268 &d->dev->i2c_adap);
Michael Krufky77eed212011-09-06 09:31:57 -03001269 if (d->fe_adap[0].fe == NULL)
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001270 return -EIO;
1271
Konstantin Dimitrov73f0af42012-12-23 19:25:38 -03001272 dvb_attach(ts2020_attach, d->fe_adap[0].fe, &su3000_ts2020_config,
1273 &d->dev->i2c_adap);
1274
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001275 info("Attached DS3000!\n");
1276
1277 return 0;
1278}
1279
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03001280static int m88rs2000_frontend_attach(struct dvb_usb_adapter *d)
1281{
1282 u8 obuf[] = { 0x51 };
1283 u8 ibuf[] = { 0 };
1284
1285 if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
1286 err("command 0x51 transfer failed.");
1287
1288 d->fe_adap[0].fe = dvb_attach(m88rs2000_attach, &s421_m88rs2000_config,
1289 &d->dev->i2c_adap);
1290 if (d->fe_adap[0].fe == NULL)
1291 return -EIO;
1292
1293 info("Attached m88rs2000!\n");
1294
1295 return 0;
1296}
1297
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001298static int dw2102_tuner_attach(struct dvb_usb_adapter *adap)
1299{
Michael Krufky77eed212011-09-06 09:31:57 -03001300 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60,
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001301 &adap->dev->i2c_adap, DVB_PLL_OPERA1);
1302 return 0;
1303}
1304
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001305static int dw3101_tuner_attach(struct dvb_usb_adapter *adap)
1306{
Michael Krufky77eed212011-09-06 09:31:57 -03001307 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60,
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001308 &adap->dev->i2c_adap, DVB_PLL_TUA6034);
1309
1310 return 0;
1311}
1312
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001313static struct rc_map_table rc_map_dw210x_table[] = {
Mauro Carvalho Chehab991bd3c2011-01-24 12:18:40 -03001314 { 0xf80a, KEY_POWER2 }, /*power*/
1315 { 0xf80c, KEY_MUTE }, /*mute*/
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -03001316 { 0xf811, KEY_1 },
1317 { 0xf812, KEY_2 },
1318 { 0xf813, KEY_3 },
1319 { 0xf814, KEY_4 },
1320 { 0xf815, KEY_5 },
1321 { 0xf816, KEY_6 },
1322 { 0xf817, KEY_7 },
1323 { 0xf818, KEY_8 },
1324 { 0xf819, KEY_9 },
1325 { 0xf810, KEY_0 },
Mauro Carvalho Chehab991bd3c2011-01-24 12:18:40 -03001326 { 0xf81c, KEY_CHANNELUP }, /*ch+*/
1327 { 0xf80f, KEY_CHANNELDOWN }, /*ch-*/
1328 { 0xf81a, KEY_VOLUMEUP }, /*vol+*/
1329 { 0xf80e, KEY_VOLUMEDOWN }, /*vol-*/
1330 { 0xf804, KEY_RECORD }, /*rec*/
1331 { 0xf809, KEY_FAVORITES }, /*fav*/
1332 { 0xf808, KEY_REWIND }, /*rewind*/
1333 { 0xf807, KEY_FASTFORWARD }, /*fast*/
1334 { 0xf80b, KEY_PAUSE }, /*pause*/
1335 { 0xf802, KEY_ESC }, /*cancel*/
1336 { 0xf803, KEY_TAB }, /*tab*/
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -03001337 { 0xf800, KEY_UP }, /*up*/
Mauro Carvalho Chehab991bd3c2011-01-24 12:18:40 -03001338 { 0xf81f, KEY_OK }, /*ok*/
1339 { 0xf801, KEY_DOWN }, /*down*/
1340 { 0xf805, KEY_CAMERA }, /*cap*/
1341 { 0xf806, KEY_STOP }, /*stop*/
1342 { 0xf840, KEY_ZOOM }, /*full*/
1343 { 0xf81e, KEY_TV }, /*tvmode*/
1344 { 0xf81b, KEY_LAST }, /*recall*/
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001345};
1346
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001347static struct rc_map_table rc_map_tevii_table[] = {
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -03001348 { 0xf80a, KEY_POWER },
1349 { 0xf80c, KEY_MUTE },
1350 { 0xf811, KEY_1 },
1351 { 0xf812, KEY_2 },
1352 { 0xf813, KEY_3 },
1353 { 0xf814, KEY_4 },
1354 { 0xf815, KEY_5 },
1355 { 0xf816, KEY_6 },
1356 { 0xf817, KEY_7 },
1357 { 0xf818, KEY_8 },
1358 { 0xf819, KEY_9 },
1359 { 0xf810, KEY_0 },
1360 { 0xf81c, KEY_MENU },
1361 { 0xf80f, KEY_VOLUMEDOWN },
1362 { 0xf81a, KEY_LAST },
1363 { 0xf80e, KEY_OPEN },
1364 { 0xf804, KEY_RECORD },
1365 { 0xf809, KEY_VOLUMEUP },
1366 { 0xf808, KEY_CHANNELUP },
1367 { 0xf807, KEY_PVR },
1368 { 0xf80b, KEY_TIME },
1369 { 0xf802, KEY_RIGHT },
1370 { 0xf803, KEY_LEFT },
1371 { 0xf800, KEY_UP },
1372 { 0xf81f, KEY_OK },
1373 { 0xf801, KEY_DOWN },
1374 { 0xf805, KEY_TUNER },
1375 { 0xf806, KEY_CHANNELDOWN },
1376 { 0xf840, KEY_PLAYPAUSE },
1377 { 0xf81e, KEY_REWIND },
1378 { 0xf81b, KEY_FAVORITES },
1379 { 0xf81d, KEY_BACK },
1380 { 0xf84d, KEY_FASTFORWARD },
1381 { 0xf844, KEY_EPG },
1382 { 0xf84c, KEY_INFO },
1383 { 0xf841, KEY_AB },
1384 { 0xf843, KEY_AUDIO },
1385 { 0xf845, KEY_SUBTITLE },
1386 { 0xf84a, KEY_LIST },
1387 { 0xf846, KEY_F1 },
1388 { 0xf847, KEY_F2 },
1389 { 0xf85e, KEY_F3 },
1390 { 0xf85c, KEY_F4 },
1391 { 0xf852, KEY_F5 },
1392 { 0xf85a, KEY_F6 },
1393 { 0xf856, KEY_MODE },
1394 { 0xf858, KEY_SWITCHVIDEOMODE },
Igor M. Liplianinb42e1d72009-06-14 19:41:22 -03001395};
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001396
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001397static struct rc_map_table rc_map_tbs_table[] = {
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -03001398 { 0xf884, KEY_POWER },
1399 { 0xf894, KEY_MUTE },
1400 { 0xf887, KEY_1 },
1401 { 0xf886, KEY_2 },
1402 { 0xf885, KEY_3 },
1403 { 0xf88b, KEY_4 },
1404 { 0xf88a, KEY_5 },
1405 { 0xf889, KEY_6 },
1406 { 0xf88f, KEY_7 },
1407 { 0xf88e, KEY_8 },
1408 { 0xf88d, KEY_9 },
1409 { 0xf892, KEY_0 },
1410 { 0xf896, KEY_CHANNELUP },
1411 { 0xf891, KEY_CHANNELDOWN },
1412 { 0xf893, KEY_VOLUMEUP },
1413 { 0xf88c, KEY_VOLUMEDOWN },
1414 { 0xf883, KEY_RECORD },
1415 { 0xf898, KEY_PAUSE },
1416 { 0xf899, KEY_OK },
1417 { 0xf89a, KEY_SHUFFLE },
1418 { 0xf881, KEY_UP },
1419 { 0xf890, KEY_LEFT },
1420 { 0xf882, KEY_RIGHT },
1421 { 0xf888, KEY_DOWN },
1422 { 0xf895, KEY_FAVORITES },
1423 { 0xf897, KEY_SUBTITLE },
1424 { 0xf89d, KEY_ZOOM },
1425 { 0xf89f, KEY_EXIT },
1426 { 0xf89e, KEY_MENU },
1427 { 0xf89c, KEY_EPG },
1428 { 0xf880, KEY_PREVIOUS },
1429 { 0xf89b, KEY_MODE }
Igor M. Liplianinb42e1d72009-06-14 19:41:22 -03001430};
1431
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001432static struct rc_map_table rc_map_su3000_table[] = {
1433 { 0x25, KEY_POWER }, /* right-bottom Red */
1434 { 0x0a, KEY_MUTE }, /* -/-- */
1435 { 0x01, KEY_1 },
1436 { 0x02, KEY_2 },
1437 { 0x03, KEY_3 },
1438 { 0x04, KEY_4 },
1439 { 0x05, KEY_5 },
1440 { 0x06, KEY_6 },
1441 { 0x07, KEY_7 },
1442 { 0x08, KEY_8 },
1443 { 0x09, KEY_9 },
1444 { 0x00, KEY_0 },
1445 { 0x20, KEY_UP }, /* CH+ */
1446 { 0x21, KEY_DOWN }, /* CH+ */
1447 { 0x12, KEY_VOLUMEUP }, /* Brightness Up */
1448 { 0x13, KEY_VOLUMEDOWN },/* Brightness Down */
1449 { 0x1f, KEY_RECORD },
1450 { 0x17, KEY_PLAY },
1451 { 0x16, KEY_PAUSE },
1452 { 0x0b, KEY_STOP },
1453 { 0x27, KEY_FASTFORWARD },/* >> */
1454 { 0x26, KEY_REWIND }, /* << */
1455 { 0x0d, KEY_OK }, /* Mute */
1456 { 0x11, KEY_LEFT }, /* VOL- */
1457 { 0x10, KEY_RIGHT }, /* VOL+ */
1458 { 0x29, KEY_BACK }, /* button under 9 */
1459 { 0x2c, KEY_MENU }, /* TTX */
1460 { 0x2b, KEY_EPG }, /* EPG */
1461 { 0x1e, KEY_RED }, /* OSD */
1462 { 0x0e, KEY_GREEN }, /* Window */
1463 { 0x2d, KEY_YELLOW }, /* button under << */
1464 { 0x0f, KEY_BLUE }, /* bottom yellow button */
1465 { 0x14, KEY_AUDIO }, /* Snapshot */
1466 { 0x38, KEY_TV }, /* TV/Radio */
Justin P. Mattock70f23fd2011-05-10 10:16:21 +02001467 { 0x0c, KEY_ESC } /* upper Red button */
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001468};
1469
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001470static struct rc_map_dvb_usb_table_table keys_tables[] = {
1471 { rc_map_dw210x_table, ARRAY_SIZE(rc_map_dw210x_table) },
1472 { rc_map_tevii_table, ARRAY_SIZE(rc_map_tevii_table) },
1473 { rc_map_tbs_table, ARRAY_SIZE(rc_map_tbs_table) },
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001474 { rc_map_su3000_table, ARRAY_SIZE(rc_map_su3000_table) },
Igor M. Liplianinb42e1d72009-06-14 19:41:22 -03001475};
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001476
1477static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
1478{
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001479 struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
1480 int keymap_size = d->props.rc.legacy.rc_map_size;
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001481 u8 key[2];
Igor M. Liplianin8a8dad72009-06-13 08:10:24 -03001482 struct i2c_msg msg = {
1483 .addr = DW2102_RC_QUERY,
1484 .flags = I2C_M_RD,
1485 .buf = key,
1486 .len = 2
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001487 };
1488 int i;
Igor M. Liplianinb42e1d72009-06-14 19:41:22 -03001489 /* override keymap */
1490 if ((ir_keymap > 0) && (ir_keymap <= ARRAY_SIZE(keys_tables))) {
1491 keymap = keys_tables[ir_keymap - 1].rc_keys ;
1492 keymap_size = keys_tables[ir_keymap - 1].rc_keys_size;
Igor M. Liplianinfeb16e92011-02-25 18:41:22 -03001493 } else if (ir_keymap > ARRAY_SIZE(keys_tables))
1494 return 0; /* none */
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001495
1496 *state = REMOTE_NO_KEY_PRESSED;
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001497 if (d->props.i2c_algo->master_xfer(&d->i2c_adap, &msg, 1) == 1) {
Igor M. Liplianinb42e1d72009-06-14 19:41:22 -03001498 for (i = 0; i < keymap_size ; i++) {
Mauro Carvalho Chehab2e365882009-08-29 15:19:31 -03001499 if (rc5_data(&keymap[i]) == msg.buf[0]) {
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001500 *state = REMOTE_KEY_PRESSED;
Mauro Carvalho Chehab34abf212010-07-31 11:24:57 -03001501 *event = keymap[i].keycode;
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001502 break;
1503 }
Igor M. Liplianin8a8dad72009-06-13 08:10:24 -03001504
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001505 }
Igor M. Liplianin8a8dad72009-06-13 08:10:24 -03001506
1507 if ((*state) == REMOTE_KEY_PRESSED)
1508 deb_rc("%s: found rc key: %x, %x, event: %x\n",
1509 __func__, key[0], key[1], (*event));
1510 else if (key[0] != 0xff)
1511 deb_rc("%s: unknown rc key: %x, %x\n",
1512 __func__, key[0], key[1]);
1513
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001514 }
Igor M. Liplianin8a8dad72009-06-13 08:10:24 -03001515
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001516 return 0;
1517}
1518
Jonathan Nieder27351b12011-12-23 19:00:45 -03001519enum dw2102_table_entry {
1520 CYPRESS_DW2102,
1521 CYPRESS_DW2101,
1522 CYPRESS_DW2104,
1523 TEVII_S650,
1524 TERRATEC_CINERGY_S,
1525 CYPRESS_DW3101,
1526 TEVII_S630,
1527 PROF_1100,
1528 TEVII_S660,
1529 PROF_7500,
1530 GENIATECH_SU3000,
1531 TERRATEC_CINERGY_S2,
1532 TEVII_S480_1,
1533 TEVII_S480_2,
1534 X3M_SPC1400HD,
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03001535 TEVII_S421,
1536 TEVII_S632,
Jonathan Nieder27351b12011-12-23 19:00:45 -03001537};
1538
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001539static struct usb_device_id dw2102_table[] = {
Jonathan Nieder27351b12011-12-23 19:00:45 -03001540 [CYPRESS_DW2102] = {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2102)},
1541 [CYPRESS_DW2101] = {USB_DEVICE(USB_VID_CYPRESS, 0x2101)},
1542 [CYPRESS_DW2104] = {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2104)},
1543 [TEVII_S650] = {USB_DEVICE(0x9022, USB_PID_TEVII_S650)},
1544 [TERRATEC_CINERGY_S] = {USB_DEVICE(USB_VID_TERRATEC, USB_PID_CINERGY_S)},
1545 [CYPRESS_DW3101] = {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW3101)},
1546 [TEVII_S630] = {USB_DEVICE(0x9022, USB_PID_TEVII_S630)},
1547 [PROF_1100] = {USB_DEVICE(0x3011, USB_PID_PROF_1100)},
1548 [TEVII_S660] = {USB_DEVICE(0x9022, USB_PID_TEVII_S660)},
1549 [PROF_7500] = {USB_DEVICE(0x3034, 0x7500)},
1550 [GENIATECH_SU3000] = {USB_DEVICE(0x1f4d, 0x3000)},
1551 [TERRATEC_CINERGY_S2] = {USB_DEVICE(USB_VID_TERRATEC, 0x00a8)},
1552 [TEVII_S480_1] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_1)},
1553 [TEVII_S480_2] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_2)},
1554 [X3M_SPC1400HD] = {USB_DEVICE(0x1f4d, 0x3100)},
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03001555 [TEVII_S421] = {USB_DEVICE(0x9022, USB_PID_TEVII_S421)},
1556 [TEVII_S632] = {USB_DEVICE(0x9022, USB_PID_TEVII_S632)},
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001557 { }
1558};
1559
1560MODULE_DEVICE_TABLE(usb, dw2102_table);
1561
1562static int dw2102_load_firmware(struct usb_device *dev,
1563 const struct firmware *frmwr)
1564{
1565 u8 *b, *p;
1566 int ret = 0, i;
1567 u8 reset;
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -03001568 u8 reset16[] = {0, 0, 0, 0, 0, 0, 0};
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001569 const struct firmware *fw;
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001570
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001571 switch (dev->descriptor.idProduct) {
1572 case 0x2101:
Rémi Cardona68236272012-09-28 08:59:32 -03001573 ret = request_firmware(&fw, DW2101_FIRMWARE, &dev->dev);
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001574 if (ret != 0) {
Rémi Cardona68236272012-09-28 08:59:32 -03001575 err(err_str, DW2101_FIRMWARE);
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001576 return ret;
1577 }
1578 break;
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001579 default:
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001580 fw = frmwr;
1581 break;
1582 }
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001583 info("start downloading DW210X firmware");
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001584 p = kmalloc(fw->size, GFP_KERNEL);
1585 reset = 1;
1586 /*stop the CPU*/
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001587 dw210x_op_rw(dev, 0xa0, 0x7f92, 0, &reset, 1, DW210X_WRITE_MSG);
1588 dw210x_op_rw(dev, 0xa0, 0xe600, 0, &reset, 1, DW210X_WRITE_MSG);
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001589
1590 if (p != NULL) {
1591 memcpy(p, fw->data, fw->size);
1592 for (i = 0; i < fw->size; i += 0x40) {
1593 b = (u8 *) p + i;
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001594 if (dw210x_op_rw(dev, 0xa0, i, 0, b , 0x40,
1595 DW210X_WRITE_MSG) != 0x40) {
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001596 err("error while transferring firmware");
1597 ret = -EINVAL;
1598 break;
1599 }
1600 }
1601 /* restart the CPU */
1602 reset = 0;
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001603 if (ret || dw210x_op_rw(dev, 0xa0, 0x7f92, 0, &reset, 1,
1604 DW210X_WRITE_MSG) != 1) {
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001605 err("could not restart the USB controller CPU.");
1606 ret = -EINVAL;
1607 }
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001608 if (ret || dw210x_op_rw(dev, 0xa0, 0xe600, 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 }
1613 /* init registers */
1614 switch (dev->descriptor.idProduct) {
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001615 case USB_PID_TEVII_S650:
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001616 dw2104_properties.rc.legacy.rc_map_table = rc_map_tevii_table;
1617 dw2104_properties.rc.legacy.rc_map_size =
1618 ARRAY_SIZE(rc_map_tevii_table);
Igor M. Liplianinb42e1d72009-06-14 19:41:22 -03001619 case USB_PID_DW2104:
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001620 reset = 1;
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001621 dw210x_op_rw(dev, 0xc4, 0x0000, 0, &reset, 1,
1622 DW210X_WRITE_MSG);
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001623 /* break omitted intentionally */
1624 case USB_PID_DW3101:
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001625 reset = 0;
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001626 dw210x_op_rw(dev, 0xbf, 0x0040, 0, &reset, 0,
1627 DW210X_WRITE_MSG);
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001628 break;
Igor M. Liplianin4cc0edf2008-11-05 22:12:56 -03001629 case USB_PID_CINERGY_S:
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001630 case USB_PID_DW2102:
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001631 dw210x_op_rw(dev, 0xbf, 0x0040, 0, &reset, 0,
1632 DW210X_WRITE_MSG);
1633 dw210x_op_rw(dev, 0xb9, 0x0000, 0, &reset16[0], 2,
1634 DW210X_READ_MSG);
1635 /* check STV0299 frontend */
1636 dw210x_op_rw(dev, 0xb5, 0, 0, &reset16[0], 2,
1637 DW210X_READ_MSG);
Igor M. Liplianinea023df2008-12-04 12:49:23 -03001638 if ((reset16[0] == 0xa1) || (reset16[0] == 0x80)) {
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001639 dw2102_properties.i2c_algo = &dw2102_i2c_algo;
Michael Krufky77eed212011-09-06 09:31:57 -03001640 dw2102_properties.adapter->fe[0].tuner_attach = &dw2102_tuner_attach;
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -03001641 break;
1642 } else {
1643 /* check STV0288 frontend */
1644 reset16[0] = 0xd0;
1645 reset16[1] = 1;
1646 reset16[2] = 0;
1647 dw210x_op_rw(dev, 0xc2, 0, 0, &reset16[0], 3,
1648 DW210X_WRITE_MSG);
1649 dw210x_op_rw(dev, 0xc3, 0xd1, 0, &reset16[0], 3,
1650 DW210X_READ_MSG);
1651 if (reset16[2] == 0x11) {
1652 dw2102_properties.i2c_algo = &dw2102_earda_i2c_algo;
Igor M. Liplianin8a4949b2008-10-05 09:11:21 -03001653 break;
1654 }
1655 }
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001656 case 0x2101:
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001657 dw210x_op_rw(dev, 0xbc, 0x0030, 0, &reset16[0], 2,
1658 DW210X_READ_MSG);
1659 dw210x_op_rw(dev, 0xba, 0x0000, 0, &reset16[0], 7,
1660 DW210X_READ_MSG);
1661 dw210x_op_rw(dev, 0xba, 0x0000, 0, &reset16[0], 7,
1662 DW210X_READ_MSG);
1663 dw210x_op_rw(dev, 0xb9, 0x0000, 0, &reset16[0], 2,
1664 DW210X_READ_MSG);
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001665 break;
1666 }
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001667
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001668 msleep(100);
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001669 kfree(p);
1670 }
1671 return ret;
1672}
1673
1674static struct dvb_usb_device_properties dw2102_properties = {
1675 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1676 .usb_ctrl = DEVICE_SPECIFIC,
Rémi Cardona68236272012-09-28 08:59:32 -03001677 .firmware = DW2102_FIRMWARE,
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001678 .no_reconnect = 1,
1679
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001680 .i2c_algo = &dw2102_serit_i2c_algo,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001681
1682 .rc.legacy = {
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001683 .rc_map_table = rc_map_dw210x_table,
1684 .rc_map_size = ARRAY_SIZE(rc_map_dw210x_table),
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001685 .rc_interval = 150,
1686 .rc_query = dw2102_rc_query,
1687 },
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001688
1689 .generic_bulk_ctrl_endpoint = 0x81,
1690 /* parameter for the MPEG2-data transfer */
1691 .num_adapters = 1,
1692 .download_firmware = dw2102_load_firmware,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001693 .read_mac_address = dw210x_read_mac_address,
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001694 .adapter = {
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001695 {
Michael Krufky77eed212011-09-06 09:31:57 -03001696 .num_frontends = 1,
1697 .fe = {{
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001698 .frontend_attach = dw2102_frontend_attach,
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001699 .stream = {
1700 .type = USB_BULK,
1701 .count = 8,
1702 .endpoint = 0x82,
1703 .u = {
1704 .bulk = {
1705 .buffersize = 4096,
1706 }
1707 }
1708 },
Michael Krufky77eed212011-09-06 09:31:57 -03001709 }},
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001710 }
1711 },
Igor M. Liplianin4cc0edf2008-11-05 22:12:56 -03001712 .num_device_descs = 3,
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001713 .devices = {
1714 {"DVBWorld DVB-S 2102 USB2.0",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001715 {&dw2102_table[CYPRESS_DW2102], NULL},
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001716 {NULL},
1717 },
1718 {"DVBWorld DVB-S 2101 USB2.0",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001719 {&dw2102_table[CYPRESS_DW2101], NULL},
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001720 {NULL},
1721 },
Igor M. Liplianin4cc0edf2008-11-05 22:12:56 -03001722 {"TerraTec Cinergy S USB",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001723 {&dw2102_table[TERRATEC_CINERGY_S], NULL},
Igor M. Liplianin4cc0edf2008-11-05 22:12:56 -03001724 {NULL},
1725 },
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001726 }
1727};
1728
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001729static struct dvb_usb_device_properties dw2104_properties = {
1730 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1731 .usb_ctrl = DEVICE_SPECIFIC,
Rémi Cardona68236272012-09-28 08:59:32 -03001732 .firmware = DW2104_FIRMWARE,
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001733 .no_reconnect = 1,
1734
1735 .i2c_algo = &dw2104_i2c_algo,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001736 .rc.legacy = {
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001737 .rc_map_table = rc_map_dw210x_table,
1738 .rc_map_size = ARRAY_SIZE(rc_map_dw210x_table),
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001739 .rc_interval = 150,
1740 .rc_query = dw2102_rc_query,
1741 },
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001742
1743 .generic_bulk_ctrl_endpoint = 0x81,
1744 /* parameter for the MPEG2-data transfer */
1745 .num_adapters = 1,
1746 .download_firmware = dw2102_load_firmware,
Igor M. Liplianin21b007b2008-09-17 19:19:19 -03001747 .read_mac_address = dw210x_read_mac_address,
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001748 .adapter = {
1749 {
Michael Krufky77eed212011-09-06 09:31:57 -03001750 .num_frontends = 1,
1751 .fe = {{
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001752 .frontend_attach = dw2104_frontend_attach,
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001753 .stream = {
1754 .type = USB_BULK,
1755 .count = 8,
1756 .endpoint = 0x82,
1757 .u = {
1758 .bulk = {
1759 .buffersize = 4096,
1760 }
1761 }
1762 },
Michael Krufky77eed212011-09-06 09:31:57 -03001763 }},
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001764 }
1765 },
1766 .num_device_descs = 2,
1767 .devices = {
1768 { "DVBWorld DW2104 USB2.0",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001769 {&dw2102_table[CYPRESS_DW2104], NULL},
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001770 {NULL},
1771 },
1772 { "TeVii S650 USB2.0",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001773 {&dw2102_table[TEVII_S650], NULL},
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03001774 {NULL},
1775 },
1776 }
1777};
1778
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001779static struct dvb_usb_device_properties dw3101_properties = {
1780 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1781 .usb_ctrl = DEVICE_SPECIFIC,
Rémi Cardona68236272012-09-28 08:59:32 -03001782 .firmware = DW3101_FIRMWARE,
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001783 .no_reconnect = 1,
1784
1785 .i2c_algo = &dw3101_i2c_algo,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001786 .rc.legacy = {
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001787 .rc_map_table = rc_map_dw210x_table,
1788 .rc_map_size = ARRAY_SIZE(rc_map_dw210x_table),
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001789 .rc_interval = 150,
1790 .rc_query = dw2102_rc_query,
1791 },
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001792
1793 .generic_bulk_ctrl_endpoint = 0x81,
1794 /* parameter for the MPEG2-data transfer */
1795 .num_adapters = 1,
1796 .download_firmware = dw2102_load_firmware,
1797 .read_mac_address = dw210x_read_mac_address,
1798 .adapter = {
1799 {
Michael Krufky77eed212011-09-06 09:31:57 -03001800 .num_frontends = 1,
1801 .fe = {{
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001802 .frontend_attach = dw3101_frontend_attach,
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001803 .tuner_attach = dw3101_tuner_attach,
1804 .stream = {
1805 .type = USB_BULK,
1806 .count = 8,
1807 .endpoint = 0x82,
1808 .u = {
1809 .bulk = {
1810 .buffersize = 4096,
1811 }
1812 }
1813 },
Michael Krufky77eed212011-09-06 09:31:57 -03001814 }},
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001815 }
1816 },
1817 .num_device_descs = 1,
1818 .devices = {
1819 { "DVBWorld DVB-C 3101 USB2.0",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001820 {&dw2102_table[CYPRESS_DW3101], NULL},
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03001821 {NULL},
1822 },
1823 }
1824};
1825
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001826static struct dvb_usb_device_properties s6x0_properties = {
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001827 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1828 .usb_ctrl = DEVICE_SPECIFIC,
Igor M. Liplianin52c506e2011-02-25 18:41:23 -03001829 .size_of_priv = sizeof(struct s6x0_state),
Rémi Cardona68236272012-09-28 08:59:32 -03001830 .firmware = S630_FIRMWARE,
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001831 .no_reconnect = 1,
1832
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001833 .i2c_algo = &s6x0_i2c_algo,
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001834 .rc.legacy = {
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03001835 .rc_map_table = rc_map_tevii_table,
1836 .rc_map_size = ARRAY_SIZE(rc_map_tevii_table),
Mauro Carvalho Chehabf72a27b2010-07-31 18:04:09 -03001837 .rc_interval = 150,
1838 .rc_query = dw2102_rc_query,
1839 },
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001840
1841 .generic_bulk_ctrl_endpoint = 0x81,
1842 .num_adapters = 1,
1843 .download_firmware = dw2102_load_firmware,
Igor M. Liplianin141cc352009-11-27 14:37:35 -03001844 .read_mac_address = s6x0_read_mac_address,
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001845 .adapter = {
1846 {
Michael Krufky77eed212011-09-06 09:31:57 -03001847 .num_frontends = 1,
1848 .fe = {{
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001849 .frontend_attach = zl100313_frontend_attach,
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001850 .stream = {
1851 .type = USB_BULK,
1852 .count = 8,
1853 .endpoint = 0x82,
1854 .u = {
1855 .bulk = {
1856 .buffersize = 4096,
1857 }
1858 }
1859 },
Michael Krufky77eed212011-09-06 09:31:57 -03001860 }},
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001861 }
1862 },
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001863 .num_device_descs = 1,
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001864 .devices = {
1865 {"TeVii S630 USB",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001866 {&dw2102_table[TEVII_S630], NULL},
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03001867 {NULL},
1868 },
1869 }
1870};
1871
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001872struct dvb_usb_device_properties *p1100;
1873static struct dvb_usb_device_description d1100 = {
1874 "Prof 1100 USB ",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001875 {&dw2102_table[PROF_1100], NULL},
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001876 {NULL},
1877};
1878
1879struct dvb_usb_device_properties *s660;
1880static struct dvb_usb_device_description d660 = {
1881 "TeVii S660 USB",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001882 {&dw2102_table[TEVII_S660], NULL},
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001883 {NULL},
1884};
1885
Igor M. Liplianine8f50552011-02-25 18:41:23 -03001886static struct dvb_usb_device_description d480_1 = {
1887 "TeVii S480.1 USB",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001888 {&dw2102_table[TEVII_S480_1], NULL},
Igor M. Liplianine8f50552011-02-25 18:41:23 -03001889 {NULL},
1890};
1891
1892static struct dvb_usb_device_description d480_2 = {
1893 "TeVii S480.2 USB",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001894 {&dw2102_table[TEVII_S480_2], NULL},
Igor M. Liplianine8f50552011-02-25 18:41:23 -03001895 {NULL},
1896};
1897
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001898struct dvb_usb_device_properties *p7500;
1899static struct dvb_usb_device_description d7500 = {
1900 "Prof 7500 USB DVB-S2",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001901 {&dw2102_table[PROF_7500], NULL},
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001902 {NULL},
1903};
1904
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03001905struct dvb_usb_device_properties *s421;
1906static struct dvb_usb_device_description d421 = {
1907 "TeVii S421 PCI",
1908 {&dw2102_table[TEVII_S421], NULL},
1909 {NULL},
1910};
1911
1912static struct dvb_usb_device_description d632 = {
1913 "TeVii S632 USB",
1914 {&dw2102_table[TEVII_S632], NULL},
1915 {NULL},
1916};
1917
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001918static struct dvb_usb_device_properties su3000_properties = {
1919 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1920 .usb_ctrl = DEVICE_SPECIFIC,
1921 .size_of_priv = sizeof(struct su3000_state),
1922 .power_ctrl = su3000_power_ctrl,
1923 .num_adapters = 1,
1924 .identify_state = su3000_identify_state,
1925 .i2c_algo = &su3000_i2c_algo,
1926
1927 .rc.legacy = {
1928 .rc_map_table = rc_map_su3000_table,
1929 .rc_map_size = ARRAY_SIZE(rc_map_su3000_table),
1930 .rc_interval = 150,
1931 .rc_query = dw2102_rc_query,
1932 },
1933
1934 .read_mac_address = su3000_read_mac_address,
1935
1936 .generic_bulk_ctrl_endpoint = 0x01,
1937
1938 .adapter = {
1939 {
Michael Krufky77eed212011-09-06 09:31:57 -03001940 .num_frontends = 1,
1941 .fe = {{
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001942 .streaming_ctrl = su3000_streaming_ctrl,
1943 .frontend_attach = su3000_frontend_attach,
1944 .stream = {
1945 .type = USB_BULK,
1946 .count = 8,
1947 .endpoint = 0x82,
1948 .u = {
1949 .bulk = {
1950 .buffersize = 4096,
1951 }
1952 }
1953 }
Michael Krufky77eed212011-09-06 09:31:57 -03001954 }},
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001955 }
1956 },
Mauro Carvalho Chehabb7e38632012-07-07 00:19:20 -03001957 .num_device_descs = 3,
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001958 .devices = {
1959 { "SU3000HD DVB-S USB2.0",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001960 { &dw2102_table[GENIATECH_SU3000], NULL },
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001961 { NULL },
1962 },
Igor M. Liplianin2adc5912011-02-25 18:41:22 -03001963 { "Terratec Cinergy S2 USB HD",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001964 { &dw2102_table[TERRATEC_CINERGY_S2], NULL },
Igor M. Liplianin2adc5912011-02-25 18:41:22 -03001965 { NULL },
1966 },
Igor M. Liplianin5265ea52011-02-27 16:17:25 -03001967 { "X3M TV SPC1400HD PCI",
Jonathan Nieder27351b12011-12-23 19:00:45 -03001968 { &dw2102_table[X3M_SPC1400HD], NULL },
Igor M. Liplianin5265ea52011-02-27 16:17:25 -03001969 { NULL },
1970 },
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03001971 }
1972};
1973
Igor M Liplianin7fd48282008-07-20 08:05:50 -03001974static int dw2102_probe(struct usb_interface *intf,
1975 const struct usb_device_id *id)
1976{
Thomas Meyer68dd9dd2011-11-17 18:43:40 -03001977 p1100 = kmemdup(&s6x0_properties,
1978 sizeof(struct dvb_usb_device_properties), GFP_KERNEL);
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001979 if (!p1100)
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001980 return -ENOMEM;
1981 /* copy default structure */
Igor M. Liplianincd79d332009-12-14 20:24:56 -03001982 /* fill only different fields */
Rémi Cardona68236272012-09-28 08:59:32 -03001983 p1100->firmware = P1100_FIRMWARE;
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001984 p1100->devices[0] = d1100;
1985 p1100->rc.legacy.rc_map_table = rc_map_tbs_table;
1986 p1100->rc.legacy.rc_map_size = ARRAY_SIZE(rc_map_tbs_table);
Michael Krufky77eed212011-09-06 09:31:57 -03001987 p1100->adapter->fe[0].frontend_attach = stv0288_frontend_attach;
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001988
Thomas Meyer68dd9dd2011-11-17 18:43:40 -03001989 s660 = kmemdup(&s6x0_properties,
1990 sizeof(struct dvb_usb_device_properties), GFP_KERNEL);
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001991 if (!s660) {
1992 kfree(p1100);
1993 return -ENOMEM;
1994 }
Rémi Cardona68236272012-09-28 08:59:32 -03001995 s660->firmware = S660_FIRMWARE;
Igor M. Liplianine8f50552011-02-25 18:41:23 -03001996 s660->num_device_descs = 3;
Igor M. Liplianin195288d2011-02-25 18:41:22 -03001997 s660->devices[0] = d660;
Igor M. Liplianine8f50552011-02-25 18:41:23 -03001998 s660->devices[1] = d480_1;
1999 s660->devices[2] = d480_2;
Michael Krufky77eed212011-09-06 09:31:57 -03002000 s660->adapter->fe[0].frontend_attach = ds3000_frontend_attach;
Igor M. Liplianin195288d2011-02-25 18:41:22 -03002001
Thomas Meyer68dd9dd2011-11-17 18:43:40 -03002002 p7500 = kmemdup(&s6x0_properties,
2003 sizeof(struct dvb_usb_device_properties), GFP_KERNEL);
Igor M. Liplianin195288d2011-02-25 18:41:22 -03002004 if (!p7500) {
2005 kfree(p1100);
2006 kfree(s660);
2007 return -ENOMEM;
2008 }
Rémi Cardona68236272012-09-28 08:59:32 -03002009 p7500->firmware = P7500_FIRMWARE;
Igor M. Liplianincd79d332009-12-14 20:24:56 -03002010 p7500->devices[0] = d7500;
Mauro Carvalho Chehab2f4f58d2010-11-17 15:46:09 -03002011 p7500->rc.legacy.rc_map_table = rc_map_tbs_table;
2012 p7500->rc.legacy.rc_map_size = ARRAY_SIZE(rc_map_tbs_table);
Michael Krufky77eed212011-09-06 09:31:57 -03002013 p7500->adapter->fe[0].frontend_attach = prof_7500_frontend_attach;
Igor M. Liplianincd79d332009-12-14 20:24:56 -03002014
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03002015
2016 s421 = kmemdup(&su3000_properties,
2017 sizeof(struct dvb_usb_device_properties), GFP_KERNEL);
2018 if (!s421) {
2019 kfree(p1100);
2020 kfree(s660);
2021 kfree(p7500);
2022 return -ENOMEM;
2023 }
2024 s421->num_device_descs = 2;
2025 s421->devices[0] = d421;
2026 s421->devices[1] = d632;
2027 s421->adapter->fe[0].frontend_attach = m88rs2000_frontend_attach;
2028
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03002029 if (0 == dvb_usb_device_init(intf, &dw2102_properties,
2030 THIS_MODULE, NULL, adapter_nr) ||
2031 0 == dvb_usb_device_init(intf, &dw2104_properties,
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03002032 THIS_MODULE, NULL, adapter_nr) ||
2033 0 == dvb_usb_device_init(intf, &dw3101_properties,
Igor M. Liplianind0a1dda2009-06-20 09:54:18 -03002034 THIS_MODULE, NULL, adapter_nr) ||
Igor M. Liplianin141cc352009-11-27 14:37:35 -03002035 0 == dvb_usb_device_init(intf, &s6x0_properties,
Igor M. Liplianincd79d332009-12-14 20:24:56 -03002036 THIS_MODULE, NULL, adapter_nr) ||
Igor M. Liplianin195288d2011-02-25 18:41:22 -03002037 0 == dvb_usb_device_init(intf, p1100,
2038 THIS_MODULE, NULL, adapter_nr) ||
2039 0 == dvb_usb_device_init(intf, s660,
2040 THIS_MODULE, NULL, adapter_nr) ||
Igor M. Liplianincd79d332009-12-14 20:24:56 -03002041 0 == dvb_usb_device_init(intf, p7500,
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03002042 THIS_MODULE, NULL, adapter_nr) ||
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03002043 0 == dvb_usb_device_init(intf, s421,
2044 THIS_MODULE, NULL, adapter_nr) ||
Igor M. Liplianind2ffc442011-02-25 18:41:22 -03002045 0 == dvb_usb_device_init(intf, &su3000_properties,
2046 THIS_MODULE, NULL, adapter_nr))
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03002047 return 0;
Igor M. Liplianin141cc352009-11-27 14:37:35 -03002048
Igor M. Liplianinfe03d5e2008-09-08 17:16:40 -03002049 return -ENODEV;
Igor M Liplianin7fd48282008-07-20 08:05:50 -03002050}
2051
2052static struct usb_driver dw2102_driver = {
2053 .name = "dw2102",
2054 .probe = dw2102_probe,
2055 .disconnect = dvb_usb_device_exit,
2056 .id_table = dw2102_table,
2057};
2058
Greg Kroah-Hartmanecb3b2b2011-11-18 09:46:12 -08002059module_usb_driver(dw2102_driver);
Igor M Liplianin7fd48282008-07-20 08:05:50 -03002060
2061MODULE_AUTHOR("Igor M. Liplianin (c) liplianin@me.by");
Igor M. Liplianin1dac77c2009-06-14 20:51:45 -03002062MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101, 2102, DVB-S2 2104,"
Igor M. Liplianin955d00a2012-05-08 03:53:17 -03002063 " DVB-C 3101 USB2.0,"
2064 " TeVii S600, S630, S650, S660, S480, S421, S632"
2065 " Prof 1100, 7500 USB2.0,"
2066 " Geniatech SU3000 devices");
Igor M Liplianin7fd48282008-07-20 08:05:50 -03002067MODULE_VERSION("0.1");
2068MODULE_LICENSE("GPL");
Rémi Cardona68236272012-09-28 08:59:32 -03002069MODULE_FIRMWARE(DW2101_FIRMWARE);
2070MODULE_FIRMWARE(DW2102_FIRMWARE);
2071MODULE_FIRMWARE(DW2104_FIRMWARE);
2072MODULE_FIRMWARE(DW3101_FIRMWARE);
2073MODULE_FIRMWARE(S630_FIRMWARE);
2074MODULE_FIRMWARE(S660_FIRMWARE);
2075MODULE_FIRMWARE(P1100_FIRMWARE);
2076MODULE_FIRMWARE(P7500_FIRMWARE);