aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2008-09-15 16:18:09 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 07:37:03 -0400
commit80619de8117701cad1fb5526be6fcfe6fc2a6cc2 (patch)
tree021bd83a9bf240a562d0d7f95679d74eadbb07e9 /drivers/media
parent825b96708054ca16d6e4d56a29326d3b2cdd697d (diff)
V4L/DVB (8972): initial driver for af9015 chipset
- initial driver for the Afatech AF9015 chipset Thanks-to: Mark Spieth <mark@digivation.com.au> Thanks-to: Lee Essen <lee.essen@nowonline.co.uk> Thanks-to: Luca Olivetti <luca@ventoso.org> Thanks-to: Andrew Leech <andrew@floppyspongeonline.com> Thanks-to: Nick Andrew <nick-linuxtv@nick-andrew.net> Thanks-to: Rafael Antoniello <rafael.antoniello@gmail.com> Thanks-to: Jarryd Beck <jarro.2783@gmail.com> Thanks-to: Jose Alberto Reguero <jareguero@telefonica.net> Thanks-to: Benjamin Larsson <banan@ludd.ltu.se> Thanks-to: Wolfgang Breyha <wbreyha@gmx.net> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/dvb-usb/Kconfig12
-rw-r--r--drivers/media/dvb/dvb-usb/Makefile3
-rw-r--r--drivers/media/dvb/dvb-usb/af9015.c1459
-rw-r--r--drivers/media/dvb/dvb-usb/af9015.h524
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-ids.h17
5 files changed, 2014 insertions, 1 deletions
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index 1d9e98cee9e7..b35d7f0db9aa 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -271,3 +271,15 @@ config DVB_USB_DTV5100
271 select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE 271 select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE
272 help 272 help
273 Say Y here to support the AME DTV-5100 USB2.0 DVB-T receiver. 273 Say Y here to support the AME DTV-5100 USB2.0 DVB-T receiver.
274
275config DVB_USB_AF9015
276 tristate "Afatech AF9015 DVB-T USB2.0 support"
277 depends on DVB_USB && EXPERIMENTAL
278 select DVB_AF9013
279 select DVB_PLL if !DVB_FE_CUSTOMISE
280 select MEDIA_TUNER_MT2060 if !DVB_FE_CUSTOMISE
281 select MEDIA_TUNER_QT1010 if !DVB_FE_CUSTOMISE
282 select MEDIA_TUNER_TDA18271 if !DVB_FE_CUSTOMISE
283 select MEDIA_TUNER_MXL5005S if !DVB_FE_CUSTOMISE
284 help
285 Say Y here to support the Afatech AF9015 based DVB-T USB2.0 receiver
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile
index 116544f4272d..ece8c9dfed18 100644
--- a/drivers/media/dvb/dvb-usb/Makefile
+++ b/drivers/media/dvb/dvb-usb/Makefile
@@ -70,6 +70,9 @@ obj-$(CONFIG_DVB_USB_DW2102) += dvb-usb-dw2102.o
70dvb-usb-dtv5100-objs = dtv5100.o 70dvb-usb-dtv5100-objs = dtv5100.o
71obj-$(CONFIG_DVB_USB_DTV5100) += dvb-usb-dtv5100.o 71obj-$(CONFIG_DVB_USB_DTV5100) += dvb-usb-dtv5100.o
72 72
73dvb-usb-af9015-objs = af9015.o
74obj-$(CONFIG_DVB_USB_AF9015) += dvb-usb-af9015.o
75
73EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ 76EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
74# due to tuner-xc3028 77# due to tuner-xc3028
75EXTRA_CFLAGS += -Idrivers/media/common/tuners 78EXTRA_CFLAGS += -Idrivers/media/common/tuners
diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c
new file mode 100644
index 000000000000..a284648094c2
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/af9015.c
@@ -0,0 +1,1459 @@
1/*
2 * DVB USB Linux driver for Afatech AF9015 DVB-T USB2.0 receiver
3 *
4 * Copyright (C) 2007 Antti Palosaari <crope@iki.fi>
5 *
6 * Thanks to Afatech who kindly provided information.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#include "af9015.h"
25#include "af9013.h"
26#include "mt2060.h"
27#include "qt1010.h"
28#include "tda18271.h"
29#include "mxl5005s.h"
30#if 0
31#include "mc44s80x.h"
32#endif
33
34int dvb_usb_af9015_debug;
35module_param_named(debug, dvb_usb_af9015_debug, int, 0644);
36MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS);
37int dvb_usb_af9015_remote;
38module_param_named(remote, dvb_usb_af9015_remote, int, 0644);
39MODULE_PARM_DESC(remote, "select remote");
40int dvb_usb_af9015_dual_mode;
41module_param_named(dual_mode, dvb_usb_af9015_dual_mode, int, 0644);
42MODULE_PARM_DESC(dual_mode, "enable dual mode");
43DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
44
45static DEFINE_MUTEX(af9015_usb_mutex);
46
47static struct af9015_config af9015_config;
48static struct dvb_usb_device_properties af9015_properties[2];
49int af9015_properties_count = ARRAY_SIZE(af9015_properties);
50
51static struct af9013_config af9015_af9013_config[] = {
52 {
53 .demod_address = AF9015_I2C_DEMOD,
54 .output_mode = AF9013_OUTPUT_MODE_USB,
55 .api_version = { 0, 1, 9, 0 },
56 .gpio[0] = AF9013_GPIO_HI,
57 .gpio[1] = AF9013_GPIO_LO,
58 .gpio[3] = AF9013_GPIO_TUNER_ON,
59
60 }, {
61 .output_mode = AF9013_OUTPUT_MODE_SERIAL,
62 .api_version = { 0, 1, 9, 0 },
63 .gpio[0] = AF9013_GPIO_TUNER_ON,
64 .gpio[1] = AF9013_GPIO_LO,
65 }
66};
67
68static int af9015_rw_udev(struct usb_device *udev, struct req_t *req)
69{
70 int act_len, ret;
71 u8 buf[64];
72 u8 write = 1;
73 u8 msg_len = 8;
74 static u8 seq; /* packet sequence number */
75
76 if (mutex_lock_interruptible(&af9015_usb_mutex) < 0)
77 return -EAGAIN;
78
79 buf[0] = req->cmd;
80 buf[1] = seq++;
81 buf[2] = req->i2c_addr;
82 buf[3] = req->addr >> 8;
83 buf[4] = req->addr & 0xff;
84 buf[5] = req->mbox;
85 buf[6] = req->addr_len;
86 buf[7] = req->data_len;
87
88 switch (req->cmd) {
89 case GET_CONFIG:
90 case BOOT:
91 case READ_MEMORY:
92 case RECONNECT_USB:
93 case GET_IR_CODE:
94 write = 0;
95 break;
96 case READ_I2C:
97 write = 0;
98 buf[2] |= 0x01; /* set I2C direction */
99 case WRITE_I2C:
100 buf[0] = READ_WRITE_I2C;
101 break;
102 case WRITE_MEMORY:
103 if (((req->addr & 0xff00) == 0xff00) ||
104 ((req->addr & 0xae00) == 0xae00))
105 buf[0] = WRITE_VIRTUAL_MEMORY;
106 case WRITE_VIRTUAL_MEMORY:
107 case COPY_FIRMWARE:
108 case DOWNLOAD_FIRMWARE:
109 break;
110 default:
111 err("unknown command:%d", req->cmd);
112 ret = -1;
113 goto error_unlock;
114 }
115
116 /* write requested */
117 if (write) {
118 memcpy(&buf[8], req->data, req->data_len);
119 msg_len += req->data_len;
120 }
121 deb_xfer(">>> ");
122 debug_dump(buf, msg_len, deb_xfer);
123
124 /* send req */
125 ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 0x02), buf, msg_len,
126 &act_len, AF9015_USB_TIMEOUT);
127 if (ret)
128 err("bulk message failed:%d (%d/%d)", ret, msg_len, act_len);
129 else
130 if (act_len != msg_len)
131 ret = -1; /* all data is not send */
132 if (ret)
133 goto error_unlock;
134
135 /* no ack for those packets */
136 if (req->cmd == DOWNLOAD_FIRMWARE || req->cmd == RECONNECT_USB)
137 goto exit_unlock;
138
139 /* receive ack and data if read req */
140 msg_len = 1 + 1 + req->data_len; /* seq + status + data len */
141 ret = usb_bulk_msg(udev, usb_rcvbulkpipe(udev, 0x81), buf, msg_len,
142 &act_len, AF9015_USB_TIMEOUT);
143 if (ret) {
144 err("recv bulk message failed:%d", ret);
145 ret = -1;
146 goto error_unlock;
147 }
148
149 deb_xfer("<<< ");
150 debug_dump(buf, act_len, deb_xfer);
151
152 /* remote controller query status is 1 if remote code is not received */
153 if (req->cmd == GET_IR_CODE && buf[1] == 1) {
154 buf[1] = 0; /* clear command "error" status */
155 memset(&buf[2], 0, req->data_len);
156 buf[3] = 1; /* no remote code received mark */
157 }
158
159 /* check status */
160 if (buf[1]) {
161 err("command failed:%d", buf[1]);
162 ret = -1;
163 goto error_unlock;
164 }
165
166 /* read request, copy returned data to return buf */
167 if (!write)
168 memcpy(req->data, &buf[2], req->data_len);
169
170error_unlock:
171exit_unlock:
172 mutex_unlock(&af9015_usb_mutex);
173
174 return ret;
175}
176
177static int af9015_ctrl_msg(struct dvb_usb_device *d, struct req_t *req)
178{
179 return af9015_rw_udev(d->udev, req);
180}
181
182static int af9015_write_regs(struct dvb_usb_device *d, u16 addr, u8 *val,
183 u8 len)
184{
185 struct req_t req = {WRITE_MEMORY, AF9015_I2C_DEMOD, addr, 0, 0, len,
186 val};
187 return af9015_ctrl_msg(d, &req);
188}
189
190static int af9015_write_reg(struct dvb_usb_device *d, u16 addr, u8 val)
191{
192 return af9015_write_regs(d, addr, &val, 1);
193}
194
195static int af9015_read_reg(struct dvb_usb_device *d, u16 addr, u8 *val)
196{
197 struct req_t req = {READ_MEMORY, AF9015_I2C_DEMOD, addr, 0, 0, 1, val};
198 return af9015_ctrl_msg(d, &req);
199}
200
201static int af9015_write_reg_i2c(struct dvb_usb_device *d, u8 addr, u16 reg,
202 u8 val)
203{
204 struct req_t req = {WRITE_I2C, addr, reg, 1, 1, 1, &val};
205
206 if (addr == af9015_af9013_config[0].demod_address ||
207 addr == af9015_af9013_config[1].demod_address)
208 req.addr_len = 3;
209
210 return af9015_ctrl_msg(d, &req);
211}
212
213static int af9015_read_reg_i2c(struct dvb_usb_device *d, u8 addr, u16 reg,
214 u8 *val)
215{
216 struct req_t req = {READ_I2C, addr, reg, 0, 1, 1, val};
217
218 if (addr == af9015_af9013_config[0].demod_address ||
219 addr == af9015_af9013_config[1].demod_address)
220 req.addr_len = 3;
221
222 return af9015_ctrl_msg(d, &req);
223}
224
225static int af9015_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
226 int num)
227{
228 struct dvb_usb_device *d = i2c_get_adapdata(adap);
229 int ret = 0, i = 0;
230 u16 addr;
231 u8 mbox, addr_len;
232 struct req_t req;
233
234/* TODO: implement bus lock
235
236The bus lock is needed because there is two tuners both using same I2C-address.
237Due to that the only way to select correct tuner is use demodulator I2C-gate.
238
239................................................
240. AF9015 includes integrated AF9013 demodulator.
241. ____________ ____________ . ____________
242.| uC | | demod | . | tuner |
243.|------------| |------------| . |------------|
244.| AF9015 | | AF9013/5 | . | MXL5003 |
245.| |--+----I2C-------|-----/ -----|-.-----I2C-------| |
246.| | | | addr 0x38 | . | addr 0xc6 |
247.|____________| | |____________| . |____________|
248.................|..............................
249 | ____________ ____________
250 | | demod | | tuner |
251 | |------------| |------------|
252 | | AF9013 | | MXL5003 |
253 +----I2C-------|-----/ -----|-------I2C-------| |
254 | addr 0x3a | | addr 0xc6 |
255 |____________| |____________|
256*/
257 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
258 return -EAGAIN;
259
260 while (i < num) {
261 if (msg[i].addr == af9015_af9013_config[0].demod_address ||
262 msg[i].addr == af9015_af9013_config[1].demod_address) {
263 addr = msg[i].buf[0] << 8;
264 addr += msg[i].buf[1];
265 mbox = msg[i].buf[2];
266 addr_len = 3;
267 } else {
268 addr = msg[i].buf[0];
269 addr_len = 1;
270 mbox = 0;
271 }
272
273 if (num > i + 1 && (msg[i+1].flags & I2C_M_RD)) {
274 if (msg[i].addr ==
275 af9015_af9013_config[0].demod_address)
276 req.cmd = READ_MEMORY;
277 else
278 req.cmd = READ_I2C;
279 req.i2c_addr = msg[i].addr;
280 req.addr = addr;
281 req.mbox = mbox;
282 req.addr_len = addr_len;
283 req.data_len = msg[i+1].len;
284 req.data = &msg[i+1].buf[0];
285 ret = af9015_ctrl_msg(d, &req);
286 i += 2;
287 } else {
288 if (msg[i].addr ==
289 af9015_af9013_config[0].demod_address)
290 req.cmd = WRITE_MEMORY;
291 else
292 req.cmd = WRITE_I2C;
293 req.i2c_addr = msg[i].addr;
294 req.addr = addr;
295 req.mbox = mbox;
296 req.addr_len = addr_len;
297 req.data_len = msg[i].len-addr_len;
298 req.data = &msg[i].buf[addr_len];
299 ret = af9015_ctrl_msg(d, &req);
300 i += 1;
301 }
302 if (ret)
303 goto error;
304
305 }
306 ret = i;
307
308error:
309 mutex_unlock(&d->i2c_mutex);
310
311 return ret;
312}
313
314static u32 af9015_i2c_func(struct i2c_adapter *adapter)
315{
316 return I2C_FUNC_I2C;
317}
318
319static struct i2c_algorithm af9015_i2c_algo = {
320 .master_xfer = af9015_i2c_xfer,
321 .functionality = af9015_i2c_func,
322};
323
324static int af9015_do_reg_bit(struct dvb_usb_device *d, u16 addr, u8 bit, u8 op)
325{
326 int ret;
327 u8 val, mask = 0x01;
328
329 ret = af9015_read_reg(d, addr, &val);
330 if (ret)
331 return ret;
332
333 mask <<= bit;
334 if (op) {
335 /* set bit */
336 val |= mask;
337 } else {
338 /* clear bit */
339 mask ^= 0xff;
340 val &= mask;
341 }
342
343 return af9015_write_reg(d, addr, val);
344}
345
346static int af9015_set_reg_bit(struct dvb_usb_device *d, u16 addr, u8 bit)
347{
348 return af9015_do_reg_bit(d, addr, bit, 1);
349}
350
351static int af9015_clear_reg_bit(struct dvb_usb_device *d, u16 addr, u8 bit)
352{
353 return af9015_do_reg_bit(d, addr, bit, 0);
354}
355
356static int af9015_init_endpoint(struct dvb_usb_device *d)
357{
358 int ret;
359 u16 frame_size;
360 u8 packet_size;
361 deb_info("%s: USB speed:%d\n", __func__, d->udev->speed);
362
363#define TS_PACKET_SIZE 188
364
365#define TS_USB20_PACKET_COUNT 348
366#define TS_USB20_FRAME_SIZE (TS_PACKET_SIZE*TS_USB20_PACKET_COUNT)
367
368#define TS_USB11_PACKET_COUNT 21
369#define TS_USB11_FRAME_SIZE (TS_PACKET_SIZE*TS_USB11_PACKET_COUNT)
370
371#define TS_USB20_MAX_PACKET_SIZE 512
372#define TS_USB11_MAX_PACKET_SIZE 64
373
374 if (d->udev->speed == USB_SPEED_FULL) {
375 frame_size = TS_USB11_FRAME_SIZE/4;
376 packet_size = TS_USB11_MAX_PACKET_SIZE/4;
377 } else {
378 frame_size = TS_USB20_FRAME_SIZE/4;
379 packet_size = TS_USB20_MAX_PACKET_SIZE/4;
380 }
381
382 ret = af9015_set_reg_bit(d, 0xd507, 2); /* assert EP4 reset */
383 if (ret)
384 goto error;
385 ret = af9015_set_reg_bit(d, 0xd50b, 1); /* assert EP5 reset */
386 if (ret)
387 goto error;
388 ret = af9015_clear_reg_bit(d, 0xdd11, 5); /* disable EP4 */
389 if (ret)
390 goto error;
391 ret = af9015_clear_reg_bit(d, 0xdd11, 6); /* disable EP5 */
392 if (ret)
393 goto error;
394 ret = af9015_set_reg_bit(d, 0xdd11, 5); /* enable EP4 */
395 if (ret)
396 goto error;
397 if (af9015_config.dual_mode) {
398 ret = af9015_set_reg_bit(d, 0xdd11, 6); /* enable EP5 */
399 if (ret)
400 goto error;
401 }
402 ret = af9015_clear_reg_bit(d, 0xdd13, 5); /* disable EP4 NAK */
403 if (ret)
404 goto error;
405 if (af9015_config.dual_mode) {
406 ret = af9015_clear_reg_bit(d, 0xdd13, 6); /* disable EP5 NAK */
407 if (ret)
408 goto error;
409 }
410 /* EP4 xfer length */
411 ret = af9015_write_reg(d, 0xdd88, frame_size & 0xff);
412 if (ret)
413 goto error;
414 ret = af9015_write_reg(d, 0xdd89, frame_size >> 8);
415 if (ret)
416 goto error;
417 /* EP5 xfer length */
418 ret = af9015_write_reg(d, 0xdd8a, frame_size & 0xff);
419 if (ret)
420 goto error;
421 ret = af9015_write_reg(d, 0xdd8b, frame_size >> 8);
422 if (ret)
423 goto error;
424 ret = af9015_write_reg(d, 0xdd0c, packet_size); /* EP4 packet size */
425 if (ret)
426 goto error;
427 ret = af9015_write_reg(d, 0xdd0d, packet_size); /* EP5 packet size */
428 if (ret)
429 goto error;
430 ret = af9015_clear_reg_bit(d, 0xd507, 2); /* negate EP4 reset */
431 if (ret)
432 goto error;
433 if (af9015_config.dual_mode) {
434 ret = af9015_clear_reg_bit(d, 0xd50b, 1); /* negate EP5 reset */
435 if (ret)
436 goto error;
437 }
438
439 /* enable / disable mp2if2 */
440 if (af9015_config.dual_mode)
441 ret = af9015_set_reg_bit(d, 0xd50b, 0);
442 else
443 ret = af9015_clear_reg_bit(d, 0xd50b, 0);
444error:
445 if (ret)
446 err("endpoint init failed:%d", ret);
447 return ret;
448}
449
450static int af9015_copy_firmware(struct dvb_usb_device *d)
451{
452 int ret;
453 u8 fw_params[4];
454 u8 val, i;
455 struct req_t req = {COPY_FIRMWARE, 0, 0x5100, 0, 0, sizeof(fw_params),
456 fw_params };
457 deb_info("%s:\n", __func__);
458
459 fw_params[0] = af9015_config.firmware_size >> 8;
460 fw_params[1] = af9015_config.firmware_size & 0xff;
461 fw_params[2] = af9015_config.firmware_checksum >> 8;
462 fw_params[3] = af9015_config.firmware_checksum & 0xff;
463
464 /* wait 2nd demodulator ready */
465 msleep(100);
466
467 ret = af9015_read_reg_i2c(d, 0x3a, 0x98be, &val);
468 if (ret)
469 goto error;
470 else
471 deb_info("%s: firmware status:%02x\n", __func__, val);
472
473 if (val == 0x0c) /* fw is running, no need for download */
474 goto exit;
475
476 /* set I2C master clock to fast (to speed up firmware copy) */
477 ret = af9015_write_reg(d, 0xd416, 0x04); /* 0x04 * 400ns */
478 if (ret)
479 goto error;
480
481 msleep(50);
482
483 /* copy firmware */
484 ret = af9015_ctrl_msg(d, &req);
485 if (ret)
486 err("firmware copy cmd failed:%d", ret);
487 deb_info("%s: firmware copy done\n", __func__);
488
489 /* set I2C master clock back to normal */
490 ret = af9015_write_reg(d, 0xd416, 0x14); /* 0x14 * 400ns */
491 if (ret)
492 goto error;
493
494 /* request boot firmware */
495 ret = af9015_write_reg_i2c(d, af9015_af9013_config[1].demod_address,
496 0xe205, 1);
497 deb_info("%s: firmware boot cmd status:%d\n", __func__, ret);
498 if (ret)
499 goto error;
500
501 for (i = 0; i < 15; i++) {
502 msleep(100);
503
504 /* check firmware status */
505 ret = af9015_read_reg_i2c(d,
506 af9015_af9013_config[1].demod_address, 0x98be, &val);
507 deb_info("%s: firmware status cmd status:%d fw status:%02x\n",
508 __func__, ret, val);
509 if (ret)
510 goto error;
511
512 if (val == 0x0c || val == 0x04) /* success or fail */
513 break;
514 }
515
516 if (val == 0x04) {
517 err("firmware did not run");
518 ret = -1;
519 } else if (val != 0x0c) {
520 err("firmware boot timeout");
521 ret = -1;
522 }
523
524error:
525exit:
526 return ret;
527}
528
529/* dump eeprom */
530static int af9015_eeprom_dump(struct dvb_usb_device *d)
531{
532 char buf[52], buf2[4];
533 u8 reg, val;
534
535 for (reg = 0; ; reg++) {
536 if (reg % 16 == 0) {
537 if (reg)
538 deb_info("%s\n", buf);
539 sprintf(buf, "%02x: ", reg);
540 }
541 if (af9015_read_reg_i2c(d, AF9015_I2C_EEPROM, reg, &val) == 0)
542 sprintf(buf2, "%02x ", val);
543 else
544 strcpy(buf2, "-- ");
545 strcat(buf, buf2);
546 if (reg == 0xff)
547 break;
548 }
549 deb_info("%s\n", buf);
550 return 0;
551}
552
553int af9015_download_ir_table(struct dvb_usb_device *d)
554{
555 int i, packets = 0, ret;
556 u16 addr = 0x9a56; /* ir-table start address */
557 struct req_t req = {WRITE_MEMORY, 0, 0, 0, 0, 1, NULL};
558 u8 *data = NULL;
559 deb_info("%s:\n", __func__);
560
561 data = af9015_config.ir_table;
562 packets = af9015_config.ir_table_size;
563
564 /* no remote */
565 if (!packets)
566 goto exit;
567
568 /* load remote ir-table */
569 for (i = 0; i < packets; i++) {
570 req.addr = addr + i;
571 req.data = &data[i];
572 ret = af9015_ctrl_msg(d, &req);
573 if (ret) {
574 err("ir-table download failed at packet %d with " \
575 "code %d", i, ret);
576 return ret;
577 }
578 }
579
580exit:
581 return 0;
582}
583
584static int af9015_init(struct dvb_usb_device *d)
585{
586 int ret;
587 deb_info("%s:\n", __func__);
588
589 ret = af9015_init_endpoint(d);
590 if (ret)
591 goto error;
592
593 ret = af9015_download_ir_table(d);
594 if (ret)
595 goto error;
596
597error:
598 return ret;
599}
600
601static int af9015_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
602{
603 int ret;
604 deb_info("%s: onoff:%d\n", __func__, onoff);
605
606 if (onoff)
607 ret = af9015_set_reg_bit(adap->dev, 0xd503, 0);
608 else
609 ret = af9015_clear_reg_bit(adap->dev, 0xd503, 0);
610
611 return ret;
612}
613
614static int af9015_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid,
615 int onoff)
616{
617 int ret;
618 u8 idx;
619
620 deb_info("%s: set pid filter, index %d, pid %x, onoff %d\n",
621 __func__, index, pid, onoff);
622
623 ret = af9015_write_reg(adap->dev, 0xd505, (pid & 0xff));
624 if (ret)
625 goto error;
626
627 ret = af9015_write_reg(adap->dev, 0xd506, (pid >> 8));
628 if (ret)
629 goto error;
630
631 idx = ((index & 0x1f) | (1 << 5));
632 ret = af9015_write_reg(adap->dev, 0xd504, idx);
633
634error:
635 return ret;
636}
637
638static int af9015_download_firmware(struct usb_device *udev,
639 const struct firmware *fw)
640{
641 int i, len, packets, remainder, ret;
642 struct req_t req = {DOWNLOAD_FIRMWARE, 0, 0, 0, 0, 0, NULL};
643 u16 addr = 0x5100; /* firmware start address */
644 u16 checksum = 0;
645
646 deb_info("%s:\n", __func__);
647
648 /* calc checksum */
649 for (i = 0; i < fw->size; i++)
650 checksum += fw->data[i];
651
652 af9015_config.firmware_size = fw->size;
653 af9015_config.firmware_checksum = checksum;
654
655 #define FW_PACKET_MAX_DATA 55
656
657 packets = fw->size / FW_PACKET_MAX_DATA;
658 remainder = fw->size % FW_PACKET_MAX_DATA;
659 len = FW_PACKET_MAX_DATA;
660 for (i = 0; i <= packets; i++) {
661 if (i == packets) /* set size of the last packet */
662 len = remainder;
663
664 req.data_len = len;
665 req.data = (fw->data + i * FW_PACKET_MAX_DATA);
666 req.addr = addr;
667 addr += FW_PACKET_MAX_DATA;
668
669 ret = af9015_rw_udev(udev, &req);
670 if (ret) {
671 err("firmware download failed at packet %d with " \
672 "code %d", i, ret);
673 goto error;
674 }
675 }
676 #undef FW_PACKET_MAX_DATA
677
678 /* firmware loaded, request boot */
679 req.cmd = BOOT;
680 ret = af9015_rw_udev(udev, &req);
681 if (ret) {
682 err("firmware boot failed:%d", ret);
683 goto error;
684 }
685
686 /* firmware is running, reconnect device in the usb bus */
687 req.cmd = RECONNECT_USB;
688 ret = af9015_rw_udev(udev, &req);
689 if (ret)
690 err("reconnect failed: %d", ret);
691
692error:
693 return ret;
694}
695
696static int af9015_read_config(struct usb_device *udev)
697{
698 int ret;
699 u8 val, i, offset = 0;
700 struct req_t req = {READ_I2C, AF9015_I2C_EEPROM, 0, 0, 1, 1, &val};
701 char manufacturer[10];
702
703 /* IR remote controller */
704 req.addr = AF9015_EEPROM_IR_MODE;
705 ret = af9015_rw_udev(udev, &req);
706 if (ret)
707 goto error;
708 deb_info("%s: IR mode:%d\n", __func__, val);
709 for (i = 0; i < af9015_properties_count; i++) {
710 if (val == AF9015_IR_MODE_DISABLED || val == 0x04) {
711 af9015_properties[i].rc_key_map = NULL;
712 af9015_properties[i].rc_key_map_size = 0;
713 } else if (dvb_usb_af9015_remote) {
714 /* load remote defined as module param */
715 switch (dvb_usb_af9015_remote) {
716 case AF9015_REMOTE_A_LINK_DTU_M:
717 af9015_properties[i].rc_key_map =
718 af9015_rc_keys_a_link;
719 af9015_properties[i].rc_key_map_size =
720 ARRAY_SIZE(af9015_rc_keys_a_link);
721 af9015_config.ir_table = af9015_ir_table_a_link;
722 af9015_config.ir_table_size =
723 ARRAY_SIZE(af9015_ir_table_a_link);
724 break;
725 case AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3:
726 af9015_properties[i].rc_key_map =
727 af9015_rc_keys_msi;
728 af9015_properties[i].rc_key_map_size =
729 ARRAY_SIZE(af9015_rc_keys_msi);
730 af9015_config.ir_table = af9015_ir_table_msi;
731 af9015_config.ir_table_size =
732 ARRAY_SIZE(af9015_ir_table_msi);
733 break;
734 case AF9015_REMOTE_MYGICTV_U718:
735 af9015_properties[i].rc_key_map =
736 af9015_rc_keys_mygictv;
737 af9015_properties[i].rc_key_map_size =
738 ARRAY_SIZE(af9015_rc_keys_mygictv);
739 af9015_config.ir_table =
740 af9015_ir_table_mygictv;
741 af9015_config.ir_table_size =
742 ARRAY_SIZE(af9015_ir_table_mygictv);
743 break;
744 }
745 } else {
746 switch (udev->descriptor.idVendor) {
747 case cpu_to_le16(USB_VID_LEADTEK):
748 af9015_properties[i].rc_key_map =
749 af9015_rc_keys_leadtek;
750 af9015_properties[i].rc_key_map_size =
751 ARRAY_SIZE(af9015_rc_keys_leadtek);
752 af9015_config.ir_table =
753 af9015_ir_table_leadtek;
754 af9015_config.ir_table_size =
755 ARRAY_SIZE(af9015_ir_table_leadtek);
756 break;
757 case cpu_to_le16(USB_VID_VISIONPLUS):
758 if (udev->descriptor.idProduct ==
759 cpu_to_le16(USB_PID_AZUREWAVE_AD_TU700)) {
760 af9015_properties[i].rc_key_map =
761 af9015_rc_keys_twinhan;
762 af9015_properties[i].rc_key_map_size =
763 ARRAY_SIZE(af9015_rc_keys_twinhan);
764 af9015_config.ir_table =
765 af9015_ir_table_twinhan;
766 af9015_config.ir_table_size =
767 ARRAY_SIZE(af9015_ir_table_twinhan);
768 }
769 break;
770 case cpu_to_le16(USB_VID_KWORLD_2):
771 /* TODO: use correct rc keys */
772 af9015_properties[i].rc_key_map =
773 af9015_rc_keys_twinhan;
774 af9015_properties[i].rc_key_map_size =
775 ARRAY_SIZE(af9015_rc_keys_twinhan);
776 af9015_config.ir_table = af9015_ir_table_kworld;
777 af9015_config.ir_table_size =
778 ARRAY_SIZE(af9015_ir_table_kworld);
779 break;
780 /* Check USB manufacturer and product strings and try
781 to determine correct remote in case of chip vendor
782 reference IDs are used. */
783 case cpu_to_le16(USB_VID_AFATECH):
784 memset(manufacturer, 0, sizeof(manufacturer));
785 usb_string(udev, udev->descriptor.iManufacturer,
786 manufacturer, sizeof(manufacturer));
787 if (!strcmp("Geniatech", manufacturer)) {
788 /* iManufacturer 1 Geniatech
789 iProduct 2 AF9015 */
790 af9015_properties[i].rc_key_map =
791 af9015_rc_keys_mygictv;
792 af9015_properties[i].rc_key_map_size =
793 ARRAY_SIZE(af9015_rc_keys_mygictv);
794 af9015_config.ir_table =
795 af9015_ir_table_mygictv;
796 af9015_config.ir_table_size =
797 ARRAY_SIZE(af9015_ir_table_mygictv);
798 } else if (!strcmp("MSI", manufacturer)) {
799 /* iManufacturer 1 MSI
800 iProduct 2 MSI K-VOX */
801 af9015_properties[i].rc_key_map =
802 af9015_rc_keys_msi;
803 af9015_properties[i].rc_key_map_size =
804 ARRAY_SIZE(af9015_rc_keys_msi);
805 af9015_config.ir_table =
806 af9015_ir_table_msi;
807 af9015_config.ir_table_size =
808 ARRAY_SIZE(af9015_ir_table_msi);
809 }
810 break;
811 }
812 }
813 }
814
815 /* TS mode - one or two receivers */
816 req.addr = AF9015_EEPROM_TS_MODE;
817 ret = af9015_rw_udev(udev, &req);
818 if (ret)
819 goto error;
820 af9015_config.dual_mode = val;
821 deb_info("%s: TS mode:%d\n", __func__, af9015_config.dual_mode);
822 /* disable dual mode by default because it is buggy */
823 if (!dvb_usb_af9015_dual_mode)
824 af9015_config.dual_mode = 0;
825
826 /* set buffer size according to USB port speed */
827 for (i = 0; i < af9015_properties_count; i++) {
828 /* USB1.1 set smaller buffersize and disable 2nd adapter */
829 if (udev->speed == USB_SPEED_FULL) {
830 af9015_properties[i].adapter->stream.u.bulk.buffersize =
831 TS_USB11_MAX_PACKET_SIZE;
832 /* disable 2nd adapter because we don't have
833 PID-filters */
834 af9015_config.dual_mode = 0;
835 } else {
836 af9015_properties[i].adapter->stream.u.bulk.buffersize =
837 TS_USB20_MAX_PACKET_SIZE;
838 }
839 }
840
841 if (af9015_config.dual_mode) {
842 /* read 2nd demodulator I2C address */
843 req.addr = AF9015_EEPROM_DEMOD2_I2C;
844 ret = af9015_rw_udev(udev, &req);
845 if (ret)
846 goto error;
847 af9015_af9013_config[1].demod_address = val;
848
849 /* enable 2nd adapter */
850 for (i = 0; i < af9015_properties_count; i++)
851 af9015_properties[i].num_adapters = 2;
852
853 } else {
854 /* disable 2nd adapter */
855 for (i = 0; i < af9015_properties_count; i++)
856 af9015_properties[i].num_adapters = 1;
857 }
858
859 for (i = 0; i < af9015_properties[0].num_adapters; i++) {
860 if (i == 1)
861 offset = AF9015_EEPROM_OFFSET;
862 /* xtal */
863 req.addr = AF9015_EEPROM_XTAL_TYPE1 + offset;
864 ret = af9015_rw_udev(udev, &req);
865 if (ret)
866 goto error;
867 switch (val) {
868 case 0:
869 af9015_af9013_config[i].adc_clock = 28800;
870 break;
871 case 1:
872 af9015_af9013_config[i].adc_clock = 20480;
873 break;
874 case 2:
875 af9015_af9013_config[i].adc_clock = 28000;
876 break;
877 case 3:
878 af9015_af9013_config[i].adc_clock = 25000;
879 break;
880 };
881 deb_info("%s: [%d] xtal:%d set adc_clock:%d\n", __func__, i,
882 val, af9015_af9013_config[i].adc_clock);
883
884 /* tuner IF */
885 req.addr = AF9015_EEPROM_IF1H + offset;
886 ret = af9015_rw_udev(udev, &req);
887 if (ret)
888 goto error;
889 af9015_af9013_config[i].tuner_if = val << 8;
890 req.addr = AF9015_EEPROM_IF1L + offset;
891 ret = af9015_rw_udev(udev, &req);
892 if (ret)
893 goto error;
894 af9015_af9013_config[i].tuner_if += val;
895 deb_info("%s: [%d] IF1:%d\n", __func__, i,
896 af9015_af9013_config[0].tuner_if);
897
898 /* MT2060 IF1 */
899 req.addr = AF9015_EEPROM_MT2060_IF1H + offset;
900 ret = af9015_rw_udev(udev, &req);
901 if (ret)
902 goto error;
903 af9015_config.mt2060_if1[i] = val << 8;
904 req.addr = AF9015_EEPROM_MT2060_IF1L + offset;
905 ret = af9015_rw_udev(udev, &req);
906 if (ret)
907 goto error;
908 af9015_config.mt2060_if1[i] += val;
909 deb_info("%s: [%d] MT2060 IF1:%d\n", __func__, i,
910 af9015_config.mt2060_if1[i]);
911
912 /* tuner */
913 req.addr = AF9015_EEPROM_TUNER_ID1 + offset;
914 ret = af9015_rw_udev(udev, &req);
915 if (ret)
916 goto error;
917 switch (val) {
918 case AF9013_TUNER_ENV77H11D5:
919 case AF9013_TUNER_MT2060:
920 case AF9013_TUNER_MC44S803:
921 case AF9013_TUNER_QT1010:
922 case AF9013_TUNER_UNKNOWN:
923 case AF9013_TUNER_MT2060_2:
924 case AF9013_TUNER_TDA18271:
925 case AF9013_TUNER_QT1010A:
926 af9015_af9013_config[i].rf_spec_inv = 1;
927 break;
928 case AF9013_TUNER_MXL5003D:
929 case AF9013_TUNER_MXL5005D:
930 case AF9013_TUNER_MXL5005R:
931 af9015_af9013_config[i].rf_spec_inv = 0;
932 break;
933 default:
934 warn("tuner id:%d not supported, please report!", val);
935 return -ENODEV;
936 };
937
938 af9015_af9013_config[i].tuner = val;
939 deb_info("%s: [%d] tuner id:%d\n", __func__, i, val);
940 }
941
942error:
943 if (ret)
944 err("eeprom read failed:%d", ret);
945
946 return ret;
947}
948
949static int af9015_identify_state(struct usb_device *udev,
950 struct dvb_usb_device_properties *props,
951 struct dvb_usb_device_description **desc,
952 int *cold)
953{
954 int ret;
955 u8 reply;
956 struct req_t req = {GET_CONFIG, 0, 0, 0, 0, 1, &reply};
957
958 ret = af9015_rw_udev(udev, &req);
959 if (ret)
960 return ret;
961
962 deb_info("%s: reply:%02x\n", __func__, reply);
963 if (reply == 0x02)
964 *cold = 0;
965 else
966 *cold = 1;
967
968 return ret;
969}
970
971static int af9015_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
972{
973 u8 buf[8];
974 struct req_t req = {GET_IR_CODE, 0, 0, 0, 0, sizeof(buf), buf};
975 struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
976 int i, ret;
977
978 memset(buf, 0, sizeof(buf));
979
980 ret = af9015_ctrl_msg(d, &req);
981 if (ret)
982 return ret;
983
984 *event = 0;
985 *state = REMOTE_NO_KEY_PRESSED;
986
987 for (i = 0; i < d->props.rc_key_map_size; i++) {
988 if (!buf[1] && keymap[i].custom == buf[0] &&
989 keymap[i].data == buf[2]) {
990 *event = keymap[i].event;
991 *state = REMOTE_KEY_PRESSED;
992 break;
993 }
994 }
995 if (!buf[1])
996 deb_rc("%s: %02x %02x %02x %02x %02x %02x %02x %02x\n",
997 __func__, buf[0], buf[1], buf[2], buf[3], buf[4],
998 buf[5], buf[6], buf[7]);
999
1000 return 0;
1001}
1002
1003/* init 2nd I2C adapter */
1004int af9015_i2c_init(struct dvb_usb_device *d)
1005{
1006 int ret;
1007 struct af9015_state *state = d->priv;
1008 deb_info("%s:\n", __func__);
1009
1010 strncpy(state->i2c_adap.name, d->desc->name,
1011 sizeof(state->i2c_adap.name));
1012#ifdef I2C_ADAP_CLASS_TV_DIGITAL
1013 state->i2c_adap.class = I2C_ADAP_CLASS_TV_DIGITAL,
1014#else
1015 state->i2c_adap.class = I2C_CLASS_TV_DIGITAL,
1016#endif
1017 state->i2c_adap.algo = d->props.i2c_algo;
1018 state->i2c_adap.algo_data = NULL;
1019 state->i2c_adap.dev.parent = &d->udev->dev;
1020
1021 i2c_set_adapdata(&state->i2c_adap, d);
1022
1023 ret = i2c_add_adapter(&state->i2c_adap);
1024 if (ret < 0)
1025 err("could not add i2c adapter");
1026
1027 return ret;
1028}
1029
1030static int af9015_af9013_frontend_attach(struct dvb_usb_adapter *adap)
1031{
1032 int ret;
1033 struct af9015_state *state = adap->dev->priv;
1034 struct i2c_adapter *i2c_adap;
1035
1036 if (adap->id == 0) {
1037 /* select I2C adapter */
1038 i2c_adap = &adap->dev->i2c_adap;
1039
1040 deb_info("%s: init I2C\n", __func__);
1041 ret = af9015_i2c_init(adap->dev);
1042
1043 /* dump eeprom (debug) */
1044 ret = af9015_eeprom_dump(adap->dev);
1045 if (ret)
1046 return ret;
1047 } else {
1048 /* select I2C adapter */
1049 i2c_adap = &state->i2c_adap;
1050
1051 /* copy firmware to 2nd demodulator */
1052 if (af9015_config.dual_mode) {
1053 ret = af9015_copy_firmware(adap->dev);
1054 if (ret) {
1055 err("firmware copy to 2nd frontend " \
1056 "failed, will disable it");
1057 af9015_config.dual_mode = 0;
1058 return -ENODEV;
1059 }
1060 } else {
1061 return -ENODEV;
1062 }
1063 }
1064
1065 /* attach demodulator */
1066 adap->fe = dvb_attach(af9013_attach, &af9015_af9013_config[adap->id],
1067 i2c_adap);
1068
1069 return adap->fe == NULL ? -ENODEV : 0;
1070}
1071
1072static struct mt2060_config af9015_mt2060_config = {
1073 .i2c_address = 0xc0,
1074 .clock_out = 0,
1075};
1076
1077static struct qt1010_config af9015_qt1010_config = {
1078 .i2c_address = 0xc4,
1079};
1080
1081static struct tda18271_config af9015_tda18271_config = {
1082 .gate = TDA18271_GATE_DIGITAL,
1083 .small_i2c = 1,
1084};
1085
1086static struct mxl5005s_config af9015_mxl5003_config = {
1087 .i2c_address = 0xc6,
1088 .if_freq = IF_FREQ_4570000HZ,
1089 .xtal_freq = CRYSTAL_FREQ_16000000HZ,
1090 .agc_mode = MXL_SINGLE_AGC,
1091 .tracking_filter = MXL_TF_DEFAULT,
1092 .rssi_enable = MXL_RSSI_DISABLE,
1093 .cap_select = MXL_CAP_SEL_ENABLE,
1094 .div_out = MXL_DIV_OUT_4,
1095 .clock_out = MXL_CLOCK_OUT_DISABLE,
1096 .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
1097 .top = MXL5005S_TOP_25P2,
1098 .mod_mode = MXL_DIGITAL_MODE,
1099 .if_mode = MXL_ZERO_IF,
1100 .AgcMasterByte = 0x00,
1101};
1102
1103static struct mxl5005s_config af9015_mxl5005_config = {
1104 .i2c_address = 0xc6,
1105 .if_freq = IF_FREQ_4570000HZ,
1106 .xtal_freq = CRYSTAL_FREQ_16000000HZ,
1107 .agc_mode = MXL_SINGLE_AGC,
1108 .tracking_filter = MXL_TF_OFF,
1109 .rssi_enable = MXL_RSSI_DISABLE,
1110 .cap_select = MXL_CAP_SEL_ENABLE,
1111 .div_out = MXL_DIV_OUT_4,
1112 .clock_out = MXL_CLOCK_OUT_DISABLE,
1113 .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
1114 .top = MXL5005S_TOP_25P2,
1115 .mod_mode = MXL_DIGITAL_MODE,
1116 .if_mode = MXL_ZERO_IF,
1117 .AgcMasterByte = 0x00,
1118};
1119
1120static int af9015_tuner_attach(struct dvb_usb_adapter *adap)
1121{
1122 struct af9015_state *state = adap->dev->priv;
1123 struct i2c_adapter *i2c_adap;
1124 int ret;
1125 deb_info("%s: \n", __func__);
1126
1127 /* select I2C adapter */
1128 if (adap->id == 0)
1129 i2c_adap = &adap->dev->i2c_adap;
1130 else
1131 i2c_adap = &state->i2c_adap;
1132
1133 switch (af9015_af9013_config[adap->id].tuner) {
1134 case AF9013_TUNER_MT2060:
1135 case AF9013_TUNER_MT2060_2:
1136 ret = dvb_attach(mt2060_attach, adap->fe, i2c_adap,
1137 &af9015_mt2060_config,
1138 af9015_config.mt2060_if1[adap->id])
1139 == NULL ? -ENODEV : 0;
1140 break;
1141 case AF9013_TUNER_QT1010:
1142 case AF9013_TUNER_QT1010A:
1143 ret = dvb_attach(qt1010_attach, adap->fe, i2c_adap,
1144 &af9015_qt1010_config) == NULL ? -ENODEV : 0;
1145 break;
1146 case AF9013_TUNER_TDA18271:
1147 ret = dvb_attach(tda18271_attach, adap->fe, 0xc0, i2c_adap,
1148 &af9015_tda18271_config) == NULL ? -ENODEV : 0;
1149 break;
1150 case AF9013_TUNER_MXL5003D:
1151 ret = dvb_attach(mxl5005s_attach, adap->fe, i2c_adap,
1152 &af9015_mxl5003_config) == NULL ? -ENODEV : 0;
1153 break;
1154 case AF9013_TUNER_MXL5005D:
1155 case AF9013_TUNER_MXL5005R:
1156 ret = dvb_attach(mxl5005s_attach, adap->fe, i2c_adap,
1157 &af9015_mxl5005_config) == NULL ? -ENODEV : 0;
1158 break;
1159 case AF9013_TUNER_ENV77H11D5:
1160 ret = dvb_attach(dvb_pll_attach, adap->fe, 0xc0, i2c_adap,
1161 DVB_PLL_TDA665X) == NULL ? -ENODEV : 0;
1162 break;
1163 case AF9013_TUNER_MC44S803:
1164#if 0
1165 ret = dvb_attach(mc44s80x_attach, adap->fe, i2c_adap)
1166 == NULL ? -ENODEV : 0;
1167#else
1168 ret = -ENODEV;
1169 info("Freescale MC44S803 tuner found but no driver for that" \
1170 "tuner. Look at the Linuxtv.org for tuner driver" \
1171 "status.");
1172#endif
1173 break;
1174 case AF9013_TUNER_UNKNOWN:
1175 default:
1176 ret = -ENODEV;
1177 err("Unknown tuner id:%d",
1178 af9015_af9013_config[adap->id].tuner);
1179 }
1180 return ret;
1181}
1182
1183static struct usb_device_id af9015_usb_table[] = {
1184/* 0 */{USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9015_9015)},
1185 {USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9015_9016)},
1186 {USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_GOLD)},
1187 {USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV71E)},
1188 {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_399U)},
1189/* 5 */{USB_DEVICE(USB_VID_VISIONPLUS,
1190 USB_PID_TINYTWIN)},
1191 {USB_DEVICE(USB_VID_VISIONPLUS,
1192 USB_PID_AZUREWAVE_AD_TU700)},
1193 {USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_USB_XE_REV2)},
1194 {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_PC160_2T)},
1195 {USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_X)},
1196/* 10 */{USB_DEVICE(USB_VID_XTENSIONS, USB_PID_XTENSIONS_XD_380)},
1197 {USB_DEVICE(USB_VID_MSI_2, USB_PID_MSI_DIGIVOX_DUO)},
1198 {USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_X_2)},
1199 {0},
1200};
1201MODULE_DEVICE_TABLE(usb, af9015_usb_table);
1202
1203static struct dvb_usb_device_properties af9015_properties[] = {
1204 {
1205 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1206
1207 .usb_ctrl = DEVICE_SPECIFIC,
1208 .download_firmware = af9015_download_firmware,
1209 .firmware = "dvb-usb-af9015.fw",
1210
1211 .size_of_priv = sizeof(struct af9015_state), \
1212
1213 .num_adapters = 2,
1214 .adapter = {
1215 {
1216 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
1217 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1218
1219 .pid_filter_count = 32,
1220 .pid_filter = af9015_pid_filter,
1221 .pid_filter_ctrl = af9015_pid_filter_ctrl,
1222
1223 .frontend_attach =
1224 af9015_af9013_frontend_attach,
1225 .tuner_attach = af9015_tuner_attach,
1226 .stream = {
1227 .type = USB_BULK,
1228 .count = 6,
1229 .endpoint = 0x84,
1230 },
1231 },
1232 {
1233 .frontend_attach =
1234 af9015_af9013_frontend_attach,
1235 .tuner_attach = af9015_tuner_attach,
1236 .stream = {
1237 .type = USB_BULK,
1238 .count = 6,
1239 .endpoint = 0x85,
1240 },
1241 }
1242 },
1243
1244 .identify_state = af9015_identify_state,
1245
1246 .rc_query = af9015_rc_query,
1247 .rc_interval = 150,
1248
1249 .i2c_algo = &af9015_i2c_algo,
1250
1251 .num_device_descs = 9,
1252 .devices = {
1253 {
1254 .name = "Afatech AF9015 DVB-T USB2.0 stick",
1255 .cold_ids = {&af9015_usb_table[0],
1256 &af9015_usb_table[1], NULL},
1257 .warm_ids = {NULL},
1258 },
1259 {
1260 .name = "Leadtek WinFast DTV Dongle Gold",
1261 .cold_ids = {&af9015_usb_table[2], NULL},
1262 .warm_ids = {NULL},
1263 },
1264 {
1265 .name = "Pinnacle PCTV 71e",
1266 .cold_ids = {&af9015_usb_table[3], NULL},
1267 .warm_ids = {NULL},
1268 },
1269 {
1270 .name = "KWorld PlusTV Dual DVB-T Stick " \
1271 "(DVB-T 399U)",
1272 .cold_ids = {&af9015_usb_table[4], NULL},
1273 .warm_ids = {NULL},
1274 },
1275 {
1276 .name = "DigitalNow TinyTwin DVB-T Receiver",
1277 .cold_ids = {&af9015_usb_table[5], NULL},
1278 .warm_ids = {NULL},
1279 },
1280 {
1281 .name = "TwinHan AzureWave AD-TU700(704J)",
1282 .cold_ids = {&af9015_usb_table[6], NULL},
1283 .warm_ids = {NULL},
1284 },
1285 {
1286 .name = "TerraTec Cinergy T USB XE",
1287 .cold_ids = {&af9015_usb_table[7], NULL},
1288 .warm_ids = {NULL},
1289 },
1290 {
1291 .name = "KWorld PlusTV Dual DVB-T PCI " \
1292 "(DVB-T PC160-2T)",
1293 .cold_ids = {&af9015_usb_table[8], NULL},
1294 .warm_ids = {NULL},
1295 },
1296 {
1297 .name = "AVerMedia AVerTV DVB-T Volar X",
1298 .cold_ids = {&af9015_usb_table[9], NULL},
1299 .warm_ids = {NULL},
1300 },
1301 }
1302 }, {
1303 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1304
1305 .usb_ctrl = DEVICE_SPECIFIC,
1306 .download_firmware = af9015_download_firmware,
1307 .firmware = "dvb-usb-af9015.fw",
1308
1309 .size_of_priv = sizeof(struct af9015_state), \
1310
1311 .num_adapters = 2,
1312 .adapter = {
1313 {
1314 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
1315 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1316
1317 .pid_filter_count = 32,
1318 .pid_filter = af9015_pid_filter,
1319 .pid_filter_ctrl = af9015_pid_filter_ctrl,
1320
1321 .frontend_attach =
1322 af9015_af9013_frontend_attach,
1323 .tuner_attach = af9015_tuner_attach,
1324 .stream = {
1325 .type = USB_BULK,
1326 .count = 6,
1327 .endpoint = 0x84,
1328 },
1329 },
1330 {
1331 .frontend_attach =
1332 af9015_af9013_frontend_attach,
1333 .tuner_attach = af9015_tuner_attach,
1334 .stream = {
1335 .type = USB_BULK,
1336 .count = 6,
1337 .endpoint = 0x85,
1338 },
1339 }
1340 },
1341
1342 .identify_state = af9015_identify_state,
1343
1344 .rc_query = af9015_rc_query,
1345 .rc_interval = 150,
1346
1347 .i2c_algo = &af9015_i2c_algo,
1348
1349 .num_device_descs = 3,
1350 .devices = {
1351 {
1352 .name = "Xtensions XD-380",
1353 .cold_ids = {&af9015_usb_table[10], NULL},
1354 .warm_ids = {NULL},
1355 },
1356 {
1357 .name = "MSI DIGIVOX Duo",
1358 .cold_ids = {&af9015_usb_table[11], NULL},
1359 .warm_ids = {NULL},
1360 },
1361 {
1362 .name = "Fujitsu-Siemens Slim Mobile USB DVB-T",
1363 .cold_ids = {&af9015_usb_table[12], NULL},
1364 .warm_ids = {NULL},
1365 },
1366 }
1367 }
1368};
1369#undef AF9015_DEFAULT_PROPERTIES
1370
1371static int af9015_usb_probe(struct usb_interface *intf,
1372 const struct usb_device_id *id)
1373{
1374 int ret = 0;
1375 struct dvb_usb_device *d = NULL;
1376 struct usb_device *udev = interface_to_usbdev(intf);
1377 u8 i;
1378
1379 deb_info("%s: interface:%d\n", __func__,
1380 intf->cur_altsetting->desc.bInterfaceNumber);
1381
1382 /* interface 0 is used by DVB-T receiver and
1383 interface 1 is for remote controller (HID) */
1384 if (intf->cur_altsetting->desc.bInterfaceNumber == 0) {
1385 ret = af9015_read_config(udev);
1386 if (ret)
1387 return ret;
1388
1389 for (i = 0; i < af9015_properties_count; i++) {
1390 ret = dvb_usb_device_init(intf, &af9015_properties[i],
1391 THIS_MODULE, &d, adapter_nr);
1392 if (!ret)
1393 break;
1394 if (ret != -ENODEV)
1395 return ret;
1396 }
1397 if (ret)
1398 return ret;
1399
1400 if (d)
1401 ret = af9015_init(d);
1402 }
1403
1404 return ret;
1405}
1406
1407void af9015_i2c_exit(struct dvb_usb_device *d)
1408{
1409 struct af9015_state *state = d->priv;
1410 deb_info("%s: \n", __func__);
1411
1412 /* remove 2nd I2C adapter */
1413 if (d->state & DVB_USB_STATE_I2C)
1414 i2c_del_adapter(&state->i2c_adap);
1415}
1416
1417static void af9015_usb_device_exit(struct usb_interface *intf)
1418{
1419 struct dvb_usb_device *d = usb_get_intfdata(intf);
1420 deb_info("%s: \n", __func__);
1421
1422 /* remove 2nd I2C adapter */
1423 if (d != NULL && d->desc != NULL)
1424 af9015_i2c_exit(d);
1425
1426 dvb_usb_device_exit(intf);
1427}
1428
1429/* usb specific object needed to register this driver with the usb subsystem */
1430static struct usb_driver af9015_usb_driver = {
1431 .name = "dvb_usb_af9015",
1432 .probe = af9015_usb_probe,
1433 .disconnect = af9015_usb_device_exit,
1434 .id_table = af9015_usb_table,
1435};
1436
1437/* module stuff */
1438static int __init af9015_usb_module_init(void)
1439{
1440 int ret;
1441 ret = usb_register(&af9015_usb_driver);
1442 if (ret)
1443 err("module init failed:%d", ret);
1444
1445 return ret;
1446}
1447
1448static void __exit af9015_usb_module_exit(void)
1449{
1450 /* deregister this driver from the USB subsystem */
1451 usb_deregister(&af9015_usb_driver);
1452}
1453
1454module_init(af9015_usb_module_init);
1455module_exit(af9015_usb_module_exit);
1456
1457MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
1458MODULE_DESCRIPTION("Driver for Afatech AF9015 DVB-T");
1459MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/dvb-usb/af9015.h b/drivers/media/dvb/dvb-usb/af9015.h
new file mode 100644
index 000000000000..882e8a4b3681
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/af9015.h
@@ -0,0 +1,524 @@
1/*
2 * DVB USB Linux driver for Afatech AF9015 DVB-T USB2.0 receiver
3 *
4 * Copyright (C) 2007 Antti Palosaari <crope@iki.fi>
5 *
6 * Thanks to Afatech who kindly provided information.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef _DVB_USB_AF9015_H_
25#define _DVB_USB_AF9015_H_
26
27#define DVB_USB_LOG_PREFIX "af9015"
28#include "dvb-usb.h"
29
30extern int dvb_usb_af9015_debug;
31#define deb_info(args...) dprintk(dvb_usb_af9015_debug, 0x01, args)
32#define deb_rc(args...) dprintk(dvb_usb_af9015_debug, 0x02, args)
33#define deb_xfer(args...) dprintk(dvb_usb_af9015_debug, 0x04, args)
34#define deb_reg(args...) dprintk(dvb_usb_af9015_debug, 0x08, args)
35#define deb_i2c(args...) dprintk(dvb_usb_af9015_debug, 0x10, args)
36#define deb_fw(args...) dprintk(dvb_usb_af9015_debug, 0x20, args)
37
38#define AF9015_I2C_EEPROM 0xa0
39#define AF9015_I2C_DEMOD 0x38
40#define AF9015_USB_TIMEOUT 2000
41
42/* EEPROM locations */
43#define AF9015_EEPROM_IR_MODE 0x18
44#define AF9015_EEPROM_IR_REMOTE_TYPE 0x34
45#define AF9015_EEPROM_TS_MODE 0x31
46#define AF9015_EEPROM_DEMOD2_I2C 0x32
47
48#define AF9015_EEPROM_SAW_BW1 0x35
49#define AF9015_EEPROM_XTAL_TYPE1 0x36
50#define AF9015_EEPROM_SPEC_INV1 0x37
51#define AF9015_EEPROM_IF1L 0x38
52#define AF9015_EEPROM_IF1H 0x39
53#define AF9015_EEPROM_MT2060_IF1L 0x3a
54#define AF9015_EEPROM_MT2060_IF1H 0x3b
55#define AF9015_EEPROM_TUNER_ID1 0x3c
56
57#define AF9015_EEPROM_SAW_BW2 0x45
58#define AF9015_EEPROM_XTAL_TYPE2 0x46
59#define AF9015_EEPROM_SPEC_INV2 0x47
60#define AF9015_EEPROM_IF2L 0x48
61#define AF9015_EEPROM_IF2H 0x49
62#define AF9015_EEPROM_MT2060_IF2L 0x4a
63#define AF9015_EEPROM_MT2060_IF2H 0x4b
64#define AF9015_EEPROM_TUNER_ID2 0x4c
65
66#define AF9015_EEPROM_OFFSET (AF9015_EEPROM_SAW_BW2 - AF9015_EEPROM_SAW_BW1)
67
68#define AF9015_GPIO_ON (1 << 0)
69#define AF9015_GPIO_EN (1 << 1)
70#define AF9015_GPIO_O (1 << 2)
71#define AF9015_GPIO_I (1 << 3)
72
73#define AF9015_GPIO_TUNER_ON (AF9015_GPIO_ON|AF9015_GPIO_EN)
74#define AF9015_GPIO_TUNER_OFF (AF9015_GPIO_ON|AF9015_GPIO_EN|AF9015_GPIO_O)
75
76struct req_t {
77 u8 cmd; /* [0] */
78 /* seq */ /* [1] */
79 u8 i2c_addr; /* [2] */
80 u16 addr; /* [3|4] */
81 u8 mbox; /* [5] */
82 u8 addr_len; /* [6] */
83 u8 data_len; /* [7] */
84 u8 *data;
85};
86
87enum af9015_cmd {
88 GET_CONFIG = 0x10,
89 DOWNLOAD_FIRMWARE = 0x11,
90 BOOT = 0x13,
91 READ_MEMORY = 0x20,
92 WRITE_MEMORY = 0x21,
93 READ_WRITE_I2C = 0x22,
94 COPY_FIRMWARE = 0x23,
95 RECONNECT_USB = 0x5a,
96 WRITE_VIRTUAL_MEMORY = 0x26,
97 GET_IR_CODE = 0x27,
98 READ_I2C,
99 WRITE_I2C,
100};
101
102enum af9015_ir_mode {
103 AF9015_IR_MODE_DISABLED = 0,
104 AF9015_IR_MODE_HID,
105 AF9015_IR_MODE_RLC,
106 AF9015_IR_MODE_RC6,
107};
108
109struct af9015_state {
110 struct i2c_adapter i2c_adap; /* I2C adapter for 2nd FE */
111};
112
113struct af9015_config {
114 u8 dual_mode:1;
115 u16 mt2060_if1[2];
116 u16 firmware_size;
117 u16 firmware_checksum;
118 u8 *ir_table;
119 u16 ir_table_size;
120};
121
122enum af9015_remote {
123 AF9015_REMOTE_NONE = 0,
124 AF9015_REMOTE_A_LINK_DTU_M,
125 AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3,
126 AF9015_REMOTE_MYGICTV_U718,
127};
128
129/* Leadtek WinFast DTV Dongle Gold */
130static struct dvb_usb_rc_key af9015_rc_keys_leadtek[] = {
131 { 0x00, 0x1e, KEY_1 },
132 { 0x00, 0x1f, KEY_2 },
133 { 0x00, 0x20, KEY_3 },
134 { 0x00, 0x21, KEY_4 },
135 { 0x00, 0x22, KEY_5 },
136 { 0x00, 0x23, KEY_6 },
137 { 0x00, 0x24, KEY_7 },
138 { 0x00, 0x25, KEY_8 },
139 { 0x00, 0x26, KEY_9 },
140 { 0x00, 0x27, KEY_0 },
141 { 0x00, 0x28, KEY_ENTER },
142 { 0x00, 0x4f, KEY_VOLUMEUP },
143 { 0x00, 0x50, KEY_VOLUMEDOWN },
144 { 0x00, 0x51, KEY_CHANNELDOWN },
145 { 0x00, 0x52, KEY_CHANNELUP },
146};
147
148static u8 af9015_ir_table_leadtek[] = {
149 0x03, 0xfc, 0x00, 0xff, 0x1a, 0x01, 0x00,
150 0x03, 0xfc, 0x56, 0xa9, 0x00, 0x00, 0x00,
151 0x03, 0xfc, 0x4b, 0xb4, 0x00, 0x00, 0x00,
152 0x03, 0xfc, 0x4c, 0xb3, 0xb2, 0x04, 0x00,
153 0x03, 0xfc, 0x4d, 0xb2, 0x00, 0x00, 0x00,
154 0x03, 0xfc, 0x4e, 0xb1, 0x00, 0x00, 0x00,
155 0x03, 0xfc, 0x1f, 0xe0, 0x3d, 0x00, 0x00,
156 0x03, 0xfc, 0x40, 0xbf, 0x13, 0x01, 0x00,
157 0x03, 0xfc, 0x14, 0xeb, 0x10, 0x00, 0x00,
158 0x03, 0xfc, 0x49, 0xb6, 0x05, 0x01, 0x00,
159 0x03, 0xfc, 0x50, 0xaf, 0x29, 0x00, 0x00,
160 0x03, 0xfc, 0x0c, 0xf3, 0x52, 0x00, 0x00,
161 0x03, 0xfc, 0x03, 0xfc, 0x09, 0x00, 0x00,
162 0x03, 0xfc, 0x08, 0xf7, 0x50, 0x00, 0x00,
163 0x03, 0xfc, 0x13, 0xec, 0x28, 0x00, 0x00,
164 0x03, 0xfc, 0x04, 0xfb, 0x4f, 0x00, 0x00,
165 0x03, 0xfc, 0x4f, 0xb0, 0x0f, 0x01, 0x00,
166 0x03, 0xfc, 0x10, 0xef, 0x51, 0x00, 0x00,
167 0x03, 0xfc, 0x51, 0xae, 0x3f, 0x00, 0x00,
168 0x03, 0xfc, 0x42, 0xbd, 0x13, 0x00, 0x00,
169 0x03, 0xfc, 0x43, 0xbc, 0x00, 0x00, 0x00,
170 0x03, 0xfc, 0x44, 0xbb, 0x11, 0x00, 0x00,
171 0x03, 0xfc, 0x52, 0xad, 0x19, 0x00, 0x00,
172 0x03, 0xfc, 0x54, 0xab, 0x05, 0x00, 0x00,
173 0x03, 0xfc, 0x46, 0xb9, 0x29, 0x00, 0x00,
174 0x03, 0xfc, 0x55, 0xaa, 0x2b, 0x00, 0x00,
175 0x03, 0xfc, 0x53, 0xac, 0x41, 0x00, 0x00,
176 0x03, 0xfc, 0x05, 0xfa, 0x1e, 0x00, 0x00,
177 0x03, 0xfc, 0x06, 0xf9, 0x1f, 0x00, 0x00,
178 0x03, 0xfc, 0x07, 0xf8, 0x20, 0x00, 0x00,
179 0x03, 0xfc, 0x1e, 0xe1, 0x19, 0x00, 0x00,
180 0x03, 0xfc, 0x09, 0xf6, 0x21, 0x00, 0x00,
181 0x03, 0xfc, 0x0a, 0xf5, 0x22, 0x00, 0x00,
182 0x03, 0xfc, 0x0b, 0xf4, 0x23, 0x00, 0x00,
183 0x03, 0xfc, 0x1b, 0xe4, 0x16, 0x00, 0x00,
184 0x03, 0xfc, 0x0d, 0xf2, 0x24, 0x00, 0x00,
185 0x03, 0xfc, 0x0e, 0xf1, 0x25, 0x00, 0x00,
186 0x03, 0xfc, 0x0f, 0xf0, 0x26, 0x00, 0x00,
187 0x03, 0xfc, 0x16, 0xe9, 0x28, 0x00, 0x00,
188 0x03, 0xfc, 0x41, 0xbe, 0x37, 0x00, 0x00,
189 0x03, 0xfc, 0x12, 0xed, 0x27, 0x00, 0x00,
190 0x03, 0xfc, 0x11, 0xee, 0x2a, 0x00, 0x00,
191 0x03, 0xfc, 0x48, 0xb7, 0x2c, 0x00, 0x00,
192 0x03, 0xfc, 0x4a, 0xb5, 0x3c, 0x00, 0x00,
193 0x03, 0xfc, 0x47, 0xb8, 0x15, 0x01, 0x00,
194 0x03, 0xfc, 0x45, 0xba, 0x0b, 0x01, 0x00,
195 0x03, 0xfc, 0x5e, 0xa1, 0x43, 0x00, 0x00,
196 0x03, 0xfc, 0x5a, 0xa5, 0x42, 0x00, 0x00,
197 0x03, 0xfc, 0x5b, 0xa4, 0x4b, 0x00, 0x00,
198 0x03, 0xfc, 0x5f, 0xa0, 0x4e, 0x00, 0x00,
199};
200
201/* TwinHan AzureWave AD-TU700(704J) */
202static struct dvb_usb_rc_key af9015_rc_keys_twinhan[] = {
203 { 0x05, 0x3f, KEY_POWER },
204 { 0x00, 0x19, KEY_FAVORITES }, /* Favorite List */
205 { 0x00, 0x04, KEY_TEXT }, /* Teletext */
206 { 0x00, 0x0e, KEY_POWER },
207 { 0x00, 0x0e, KEY_INFO }, /* Preview */
208 { 0x00, 0x08, KEY_EPG }, /* Info/EPG */
209 { 0x00, 0x0f, KEY_LIST }, /* Record List */
210 { 0x00, 0x1e, KEY_1 },
211 { 0x00, 0x1f, KEY_2 },
212 { 0x00, 0x20, KEY_3 },
213 { 0x00, 0x21, KEY_4 },
214 { 0x00, 0x22, KEY_5 },
215 { 0x00, 0x23, KEY_6 },
216 { 0x00, 0x24, KEY_7 },
217 { 0x00, 0x25, KEY_8 },
218 { 0x00, 0x26, KEY_9 },
219 { 0x00, 0x27, KEY_0 },
220 { 0x00, 0x29, KEY_CANCEL }, /* Cancel */
221 { 0x00, 0x4c, KEY_CLEAR }, /* Clear */
222 { 0x00, 0x2a, KEY_BACK }, /* Back */
223 { 0x00, 0x2b, KEY_TAB }, /* Tab */
224 { 0x00, 0x52, KEY_UP }, /* up arrow */
225 { 0x00, 0x51, KEY_DOWN }, /* down arrow */
226 { 0x00, 0x4f, KEY_RIGHT }, /* right arrow */
227 { 0x00, 0x50, KEY_LEFT }, /* left arrow */
228 { 0x00, 0x28, KEY_ENTER }, /* Enter / ok */
229 { 0x02, 0x52, KEY_VOLUMEUP },
230 { 0x02, 0x51, KEY_VOLUMEDOWN },
231 { 0x00, 0x4e, KEY_CHANNELDOWN },
232 { 0x00, 0x4b, KEY_CHANNELUP },
233 { 0x00, 0x4a, KEY_RECORD },
234 { 0x01, 0x11, KEY_PLAY },
235 { 0x00, 0x17, KEY_PAUSE },
236 { 0x00, 0x0c, KEY_REWIND }, /* FR << */
237 { 0x00, 0x11, KEY_FASTFORWARD }, /* FF >> */
238 { 0x01, 0x15, KEY_PREVIOUS }, /* Replay */
239 { 0x01, 0x0e, KEY_NEXT }, /* Skip */
240 { 0x00, 0x13, KEY_CAMERA }, /* Capture */
241 { 0x01, 0x0f, KEY_LANGUAGE }, /* SAP */
242 { 0x01, 0x13, KEY_TV2 }, /* PIP */
243 { 0x00, 0x1d, KEY_ZOOM }, /* Full Screen */
244 { 0x01, 0x17, KEY_SUBTITLE }, /* Subtitle / CC */
245 { 0x00, 0x10, KEY_MUTE },
246 { 0x01, 0x19, KEY_AUDIO }, /* L/R */ /* TODO better event */
247 { 0x01, 0x16, KEY_SLEEP }, /* Hibernate */
248 { 0x01, 0x16, KEY_SWITCHVIDEOMODE },
249 /* A/V */ /* TODO does not work */
250 { 0x00, 0x06, KEY_AGAIN }, /* Recall */
251 { 0x01, 0x16, KEY_KPPLUS }, /* Zoom+ */ /* TODO does not work */
252 { 0x01, 0x16, KEY_KPMINUS }, /* Zoom- */ /* TODO does not work */
253 { 0x02, 0x15, KEY_RED },
254 { 0x02, 0x0a, KEY_GREEN },
255 { 0x02, 0x1c, KEY_YELLOW },
256 { 0x02, 0x05, KEY_BLUE },
257};
258
259static u8 af9015_ir_table_twinhan[] = {
260 0x00, 0xff, 0x16, 0xe9, 0x3f, 0x05, 0x00,
261 0x00, 0xff, 0x07, 0xf8, 0x16, 0x01, 0x00,
262 0x00, 0xff, 0x14, 0xeb, 0x11, 0x01, 0x00,
263 0x00, 0xff, 0x1a, 0xe5, 0x4d, 0x00, 0x00,
264 0x00, 0xff, 0x4c, 0xb3, 0x17, 0x00, 0x00,
265 0x00, 0xff, 0x12, 0xed, 0x11, 0x00, 0x00,
266 0x00, 0xff, 0x40, 0xbf, 0x0c, 0x00, 0x00,
267 0x00, 0xff, 0x11, 0xee, 0x4a, 0x00, 0x00,
268 0x00, 0xff, 0x54, 0xab, 0x13, 0x00, 0x00,
269 0x00, 0xff, 0x41, 0xbe, 0x15, 0x01, 0x00,
270 0x00, 0xff, 0x42, 0xbd, 0x0e, 0x01, 0x00,
271 0x00, 0xff, 0x43, 0xbc, 0x17, 0x01, 0x00,
272 0x00, 0xff, 0x50, 0xaf, 0x0f, 0x01, 0x00,
273 0x00, 0xff, 0x4d, 0xb2, 0x1d, 0x00, 0x00,
274 0x00, 0xff, 0x47, 0xb8, 0x13, 0x01, 0x00,
275 0x00, 0xff, 0x05, 0xfa, 0x4b, 0x00, 0x00,
276 0x00, 0xff, 0x02, 0xfd, 0x4e, 0x00, 0x00,
277 0x00, 0xff, 0x0e, 0xf1, 0x06, 0x00, 0x00,
278 0x00, 0xff, 0x1e, 0xe1, 0x52, 0x02, 0x00,
279 0x00, 0xff, 0x0a, 0xf5, 0x51, 0x02, 0x00,
280 0x00, 0xff, 0x10, 0xef, 0x10, 0x00, 0x00,
281 0x00, 0xff, 0x49, 0xb6, 0x19, 0x01, 0x00,
282 0x00, 0xff, 0x15, 0xea, 0x27, 0x00, 0x00,
283 0x00, 0xff, 0x03, 0xfc, 0x1e, 0x00, 0x00,
284 0x00, 0xff, 0x01, 0xfe, 0x1f, 0x00, 0x00,
285 0x00, 0xff, 0x06, 0xf9, 0x20, 0x00, 0x00,
286 0x00, 0xff, 0x09, 0xf6, 0x21, 0x00, 0x00,
287 0x00, 0xff, 0x1d, 0xe2, 0x22, 0x00, 0x00,
288 0x00, 0xff, 0x1f, 0xe0, 0x23, 0x00, 0x00,
289 0x00, 0xff, 0x0d, 0xf2, 0x24, 0x00, 0x00,
290 0x00, 0xff, 0x19, 0xe6, 0x25, 0x00, 0x00,
291 0x00, 0xff, 0x1b, 0xe4, 0x26, 0x00, 0x00,
292 0x00, 0xff, 0x00, 0xff, 0x2b, 0x00, 0x00,
293 0x00, 0xff, 0x4a, 0xb5, 0x4c, 0x00, 0x00,
294 0x00, 0xff, 0x4b, 0xb4, 0x52, 0x00, 0x00,
295 0x00, 0xff, 0x51, 0xae, 0x51, 0x00, 0x00,
296 0x00, 0xff, 0x52, 0xad, 0x4f, 0x00, 0x00,
297 0x00, 0xff, 0x4e, 0xb1, 0x50, 0x00, 0x00,
298 0x00, 0xff, 0x0c, 0xf3, 0x29, 0x00, 0x00,
299 0x00, 0xff, 0x4f, 0xb0, 0x28, 0x00, 0x00,
300 0x00, 0xff, 0x13, 0xec, 0x2a, 0x00, 0x00,
301 0x00, 0xff, 0x17, 0xe8, 0x19, 0x00, 0x00,
302 0x00, 0xff, 0x04, 0xfb, 0x0f, 0x00, 0x00,
303 0x00, 0xff, 0x48, 0xb7, 0x0e, 0x00, 0x00,
304 0x00, 0xff, 0x0f, 0xf0, 0x04, 0x00, 0x00,
305 0x00, 0xff, 0x1c, 0xe3, 0x08, 0x00, 0x00,
306 0x00, 0xff, 0x18, 0xe7, 0x15, 0x02, 0x00,
307 0x00, 0xff, 0x53, 0xac, 0x0a, 0x02, 0x00,
308 0x00, 0xff, 0x5e, 0xa1, 0x1c, 0x02, 0x00,
309 0x00, 0xff, 0x5f, 0xa0, 0x05, 0x02, 0x00,
310};
311
312/* A-Link DTU(m) */
313static struct dvb_usb_rc_key af9015_rc_keys_a_link[] = {
314 { 0x00, 0x1e, KEY_1 },
315 { 0x00, 0x1f, KEY_2 },
316 { 0x00, 0x20, KEY_3 },
317 { 0x00, 0x21, KEY_4 },
318 { 0x00, 0x22, KEY_5 },
319 { 0x00, 0x23, KEY_6 },
320 { 0x00, 0x24, KEY_7 },
321 { 0x00, 0x25, KEY_8 },
322 { 0x00, 0x26, KEY_9 },
323 { 0x00, 0x27, KEY_0 },
324 { 0x00, 0x2e, KEY_CHANNELUP },
325 { 0x00, 0x2d, KEY_CHANNELDOWN },
326 { 0x04, 0x28, KEY_ZOOM },
327 { 0x00, 0x41, KEY_MUTE },
328 { 0x00, 0x42, KEY_VOLUMEDOWN },
329 { 0x00, 0x43, KEY_VOLUMEUP },
330 { 0x00, 0x44, KEY_GOTO }, /* jump */
331 { 0x05, 0x45, KEY_POWER },
332};
333
334static u8 af9015_ir_table_a_link[] = {
335 0x08, 0xf7, 0x12, 0xed, 0x45, 0x05, 0x00, /* power */
336 0x08, 0xf7, 0x1a, 0xe5, 0x41, 0x00, 0x00, /* mute */
337 0x08, 0xf7, 0x01, 0xfe, 0x1e, 0x00, 0x00, /* 1 */
338 0x08, 0xf7, 0x1c, 0xe3, 0x21, 0x00, 0x00, /* 4 */
339 0x08, 0xf7, 0x03, 0xfc, 0x24, 0x00, 0x00, /* 7 */
340 0x08, 0xf7, 0x05, 0xfa, 0x28, 0x04, 0x00, /* zoom */
341 0x08, 0xf7, 0x00, 0xff, 0x43, 0x00, 0x00, /* volume up */
342 0x08, 0xf7, 0x16, 0xe9, 0x42, 0x00, 0x00, /* volume down */
343 0x08, 0xf7, 0x0f, 0xf0, 0x1f, 0x00, 0x00, /* 2 */
344 0x08, 0xf7, 0x0d, 0xf2, 0x22, 0x00, 0x00, /* 5 */
345 0x08, 0xf7, 0x1b, 0xe4, 0x25, 0x00, 0x00, /* 8 */
346 0x08, 0xf7, 0x06, 0xf9, 0x27, 0x00, 0x00, /* 0 */
347 0x08, 0xf7, 0x14, 0xeb, 0x2e, 0x00, 0x00, /* channel up */
348 0x08, 0xf7, 0x1d, 0xe2, 0x2d, 0x00, 0x00, /* channel down */
349 0x08, 0xf7, 0x02, 0xfd, 0x20, 0x00, 0x00, /* 3 */
350 0x08, 0xf7, 0x18, 0xe7, 0x23, 0x00, 0x00, /* 6 */
351 0x08, 0xf7, 0x04, 0xfb, 0x26, 0x00, 0x00, /* 9 */
352 0x08, 0xf7, 0x07, 0xf8, 0x44, 0x00, 0x00, /* jump */
353};
354
355/* MSI DIGIVOX mini II V3.0 */
356static struct dvb_usb_rc_key af9015_rc_keys_msi[] = {
357 { 0x00, 0x1e, KEY_1 },
358 { 0x00, 0x1f, KEY_2 },
359 { 0x00, 0x20, KEY_3 },
360 { 0x00, 0x21, KEY_4 },
361 { 0x00, 0x22, KEY_5 },
362 { 0x00, 0x23, KEY_6 },
363 { 0x00, 0x24, KEY_7 },
364 { 0x00, 0x25, KEY_8 },
365 { 0x00, 0x26, KEY_9 },
366 { 0x00, 0x27, KEY_0 },
367 { 0x03, 0x0f, KEY_CHANNELUP },
368 { 0x03, 0x0e, KEY_CHANNELDOWN },
369 { 0x00, 0x42, KEY_VOLUMEDOWN },
370 { 0x00, 0x43, KEY_VOLUMEUP },
371 { 0x05, 0x45, KEY_POWER },
372 { 0x00, 0x52, KEY_UP }, /* up */
373 { 0x00, 0x51, KEY_DOWN }, /* down */
374 { 0x00, 0x28, KEY_ENTER },
375};
376
377static u8 af9015_ir_table_msi[] = {
378 0x03, 0xfc, 0x17, 0xe8, 0x45, 0x05, 0x00, /* power */
379 0x03, 0xfc, 0x0d, 0xf2, 0x51, 0x00, 0x00, /* down */
380 0x03, 0xfc, 0x03, 0xfc, 0x52, 0x00, 0x00, /* up */
381 0x03, 0xfc, 0x1a, 0xe5, 0x1e, 0x00, 0x00, /* 1 */
382 0x03, 0xfc, 0x02, 0xfd, 0x1f, 0x00, 0x00, /* 2 */
383 0x03, 0xfc, 0x04, 0xfb, 0x20, 0x00, 0x00, /* 3 */
384 0x03, 0xfc, 0x1c, 0xe3, 0x21, 0x00, 0x00, /* 4 */
385 0x03, 0xfc, 0x08, 0xf7, 0x22, 0x00, 0x00, /* 5 */
386 0x03, 0xfc, 0x1d, 0xe2, 0x23, 0x00, 0x00, /* 6 */
387 0x03, 0xfc, 0x11, 0xee, 0x24, 0x00, 0x00, /* 7 */
388 0x03, 0xfc, 0x0b, 0xf4, 0x25, 0x00, 0x00, /* 8 */
389 0x03, 0xfc, 0x10, 0xef, 0x26, 0x00, 0x00, /* 9 */
390 0x03, 0xfc, 0x09, 0xf6, 0x27, 0x00, 0x00, /* 0 */
391 0x03, 0xfc, 0x14, 0xeb, 0x43, 0x00, 0x00, /* volume up */
392 0x03, 0xfc, 0x1f, 0xe0, 0x42, 0x00, 0x00, /* volume down */
393 0x03, 0xfc, 0x15, 0xea, 0x0f, 0x03, 0x00, /* channel up */
394 0x03, 0xfc, 0x05, 0xfa, 0x0e, 0x03, 0x00, /* channel down */
395 0x03, 0xfc, 0x16, 0xe9, 0x28, 0x00, 0x00, /* enter */
396};
397
398/* MYGICTV U718 */
399static struct dvb_usb_rc_key af9015_rc_keys_mygictv[] = {
400 { 0x00, 0x3d, KEY_SWITCHVIDEOMODE },
401 /* TV / AV */
402 { 0x05, 0x45, KEY_POWER },
403 { 0x00, 0x1e, KEY_1 },
404 { 0x00, 0x1f, KEY_2 },
405 { 0x00, 0x20, KEY_3 },
406 { 0x00, 0x21, KEY_4 },
407 { 0x00, 0x22, KEY_5 },
408 { 0x00, 0x23, KEY_6 },
409 { 0x00, 0x24, KEY_7 },
410 { 0x00, 0x25, KEY_8 },
411 { 0x00, 0x26, KEY_9 },
412 { 0x00, 0x27, KEY_0 },
413 { 0x00, 0x41, KEY_MUTE },
414 { 0x00, 0x2a, KEY_ESC }, /* Esc */
415 { 0x00, 0x2e, KEY_CHANNELUP },
416 { 0x00, 0x2d, KEY_CHANNELDOWN },
417 { 0x00, 0x42, KEY_VOLUMEDOWN },
418 { 0x00, 0x43, KEY_VOLUMEUP },
419 { 0x00, 0x52, KEY_UP }, /* up arrow */
420 { 0x00, 0x51, KEY_DOWN }, /* down arrow */
421 { 0x00, 0x4f, KEY_RIGHT }, /* right arrow */
422 { 0x00, 0x50, KEY_LEFT }, /* left arrow */
423 { 0x00, 0x28, KEY_ENTER }, /* ok */
424 { 0x01, 0x15, KEY_RECORD },
425 { 0x03, 0x13, KEY_PLAY },
426 { 0x01, 0x13, KEY_PAUSE },
427 { 0x01, 0x16, KEY_STOP },
428 { 0x03, 0x07, KEY_REWIND }, /* FR << */
429 { 0x03, 0x09, KEY_FASTFORWARD }, /* FF >> */
430 { 0x00, 0x3b, KEY_TIME }, /* TimeShift */
431 { 0x00, 0x3e, KEY_CAMERA }, /* Snapshot */
432 { 0x03, 0x16, KEY_CYCLEWINDOWS }, /* yellow, min / max */
433 { 0x00, 0x00, KEY_ZOOM }, /* 'select' (?) */
434 { 0x03, 0x16, KEY_SHUFFLE }, /* Shuffle */
435 { 0x03, 0x45, KEY_POWER },
436};
437
438static u8 af9015_ir_table_mygictv[] = {
439 0x02, 0xbd, 0x0c, 0xf3, 0x3d, 0x00, 0x00, /* TV / AV */
440 0x02, 0xbd, 0x14, 0xeb, 0x45, 0x05, 0x00, /* power */
441 0x02, 0xbd, 0x00, 0xff, 0x1e, 0x00, 0x00, /* 1 */
442 0x02, 0xbd, 0x01, 0xfe, 0x1f, 0x00, 0x00, /* 2 */
443 0x02, 0xbd, 0x02, 0xfd, 0x20, 0x00, 0x00, /* 3 */
444 0x02, 0xbd, 0x03, 0xfc, 0x21, 0x00, 0x00, /* 4 */
445 0x02, 0xbd, 0x04, 0xfb, 0x22, 0x00, 0x00, /* 5 */
446 0x02, 0xbd, 0x05, 0xfa, 0x23, 0x00, 0x00, /* 6 */
447 0x02, 0xbd, 0x06, 0xf9, 0x24, 0x00, 0x00, /* 7 */
448 0x02, 0xbd, 0x07, 0xf8, 0x25, 0x00, 0x00, /* 8 */
449 0x02, 0xbd, 0x08, 0xf7, 0x26, 0x00, 0x00, /* 9 */
450 0x02, 0xbd, 0x09, 0xf6, 0x27, 0x00, 0x00, /* 0 */
451 0x02, 0xbd, 0x0a, 0xf5, 0x41, 0x00, 0x00, /* mute */
452 0x02, 0xbd, 0x1c, 0xe3, 0x2a, 0x00, 0x00, /* esc */
453 0x02, 0xbd, 0x1f, 0xe0, 0x43, 0x00, 0x00, /* volume up */
454 0x02, 0xbd, 0x12, 0xed, 0x52, 0x00, 0x00, /* up arrow */
455 0x02, 0xbd, 0x11, 0xee, 0x50, 0x00, 0x00, /* left arrow */
456 0x02, 0xbd, 0x15, 0xea, 0x28, 0x00, 0x00, /* ok */
457 0x02, 0xbd, 0x10, 0xef, 0x4f, 0x00, 0x00, /* right arrow */
458 0x02, 0xbd, 0x13, 0xec, 0x51, 0x00, 0x00, /* down arrow */
459 0x02, 0xbd, 0x0e, 0xf1, 0x42, 0x00, 0x00, /* volume down */
460 0x02, 0xbd, 0x19, 0xe6, 0x15, 0x01, 0x00, /* record */
461 0x02, 0xbd, 0x1e, 0xe1, 0x13, 0x03, 0x00, /* play */
462 0x02, 0xbd, 0x16, 0xe9, 0x16, 0x01, 0x00, /* stop */
463 0x02, 0xbd, 0x0b, 0xf4, 0x28, 0x04, 0x00, /* yellow, min / max */
464 0x02, 0xbd, 0x0f, 0xf0, 0x3b, 0x00, 0x00, /* time shift */
465 0x02, 0xbd, 0x18, 0xe7, 0x2e, 0x00, 0x00, /* channel up */
466 0x02, 0xbd, 0x1a, 0xe5, 0x2d, 0x00, 0x00, /* channel down */
467 0x02, 0xbd, 0x17, 0xe8, 0x3e, 0x00, 0x00, /* snapshot */
468 0x02, 0xbd, 0x40, 0xbf, 0x13, 0x01, 0x00, /* pause */
469 0x02, 0xbd, 0x41, 0xbe, 0x09, 0x03, 0x00, /* FF >> */
470 0x02, 0xbd, 0x42, 0xbd, 0x07, 0x03, 0x00, /* FR << */
471 0x02, 0xbd, 0x43, 0xbc, 0x00, 0x00, 0x00, /* 'select' (?) */
472 0x02, 0xbd, 0x44, 0xbb, 0x16, 0x03, 0x00, /* shuffle */
473 0x02, 0xbd, 0x45, 0xba, 0x45, 0x03, 0x00, /* power */
474};
475
476/* KWorld PlusTV Dual DVB-T Stick (DVB-T 399U) */
477static u8 af9015_ir_table_kworld[] = {
478 0x86, 0x6b, 0x0c, 0xf3, 0x2e, 0x07, 0x00,
479 0x86, 0x6b, 0x16, 0xe9, 0x2d, 0x07, 0x00,
480 0x86, 0x6b, 0x1d, 0xe2, 0x37, 0x07, 0x00,
481 0x86, 0x6b, 0x00, 0xff, 0x1e, 0x07, 0x00,
482 0x86, 0x6b, 0x01, 0xfe, 0x1f, 0x07, 0x00,
483 0x86, 0x6b, 0x02, 0xfd, 0x20, 0x07, 0x00,
484 0x86, 0x6b, 0x03, 0xfc, 0x21, 0x07, 0x00,
485 0x86, 0x6b, 0x04, 0xfb, 0x22, 0x07, 0x00,
486 0x86, 0x6b, 0x05, 0xfa, 0x23, 0x07, 0x00,
487 0x86, 0x6b, 0x06, 0xf9, 0x24, 0x07, 0x00,
488 0x86, 0x6b, 0x07, 0xf8, 0x25, 0x07, 0x00,
489 0x86, 0x6b, 0x08, 0xf7, 0x26, 0x07, 0x00,
490 0x86, 0x6b, 0x09, 0xf6, 0x4d, 0x07, 0x00,
491 0x86, 0x6b, 0x0a, 0xf5, 0x4e, 0x07, 0x00,
492 0x86, 0x6b, 0x14, 0xeb, 0x4f, 0x07, 0x00,
493 0x86, 0x6b, 0x1e, 0xe1, 0x50, 0x07, 0x00,
494 0x86, 0x6b, 0x17, 0xe8, 0x52, 0x07, 0x00,
495 0x86, 0x6b, 0x1f, 0xe0, 0x51, 0x07, 0x00,
496 0x86, 0x6b, 0x0e, 0xf1, 0x0b, 0x07, 0x00,
497 0x86, 0x6b, 0x20, 0xdf, 0x0c, 0x07, 0x00,
498 0x86, 0x6b, 0x42, 0xbd, 0x0d, 0x07, 0x00,
499 0x86, 0x6b, 0x0b, 0xf4, 0x0e, 0x07, 0x00,
500 0x86, 0x6b, 0x43, 0xbc, 0x0f, 0x07, 0x00,
501 0x86, 0x6b, 0x10, 0xef, 0x10, 0x07, 0x00,
502 0x86, 0x6b, 0x21, 0xde, 0x11, 0x07, 0x00,
503 0x86, 0x6b, 0x13, 0xec, 0x12, 0x07, 0x00,
504 0x86, 0x6b, 0x11, 0xee, 0x13, 0x07, 0x00,
505 0x86, 0x6b, 0x12, 0xed, 0x14, 0x07, 0x00,
506 0x86, 0x6b, 0x19, 0xe6, 0x15, 0x07, 0x00,
507 0x86, 0x6b, 0x1a, 0xe5, 0x16, 0x07, 0x00,
508 0x86, 0x6b, 0x1b, 0xe4, 0x17, 0x07, 0x00,
509 0x86, 0x6b, 0x4b, 0xb4, 0x18, 0x07, 0x00,
510 0x86, 0x6b, 0x40, 0xbf, 0x19, 0x07, 0x00,
511 0x86, 0x6b, 0x44, 0xbb, 0x1a, 0x07, 0x00,
512 0x86, 0x6b, 0x41, 0xbe, 0x1b, 0x07, 0x00,
513 0x86, 0x6b, 0x22, 0xdd, 0x1c, 0x07, 0x00,
514 0x86, 0x6b, 0x15, 0xea, 0x1d, 0x07, 0x00,
515 0x86, 0x6b, 0x0f, 0xf0, 0x3f, 0x07, 0x00,
516 0x86, 0x6b, 0x1c, 0xe3, 0x40, 0x07, 0x00,
517 0x86, 0x6b, 0x4a, 0xb5, 0x41, 0x07, 0x00,
518 0x86, 0x6b, 0x48, 0xb7, 0x42, 0x07, 0x00,
519 0x86, 0x6b, 0x49, 0xb6, 0x43, 0x07, 0x00,
520 0x86, 0x6b, 0x18, 0xe7, 0x44, 0x07, 0x00,
521 0x86, 0x6b, 0x23, 0xdc, 0x45, 0x07, 0x00,
522};
523
524#endif
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
index 81369b79e75a..2558f2b51c2b 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
@@ -34,12 +34,14 @@
34#define USB_VID_HAUPPAUGE 0x2040 34#define USB_VID_HAUPPAUGE 0x2040
35#define USB_VID_HYPER_PALTEK 0x1025 35#define USB_VID_HYPER_PALTEK 0x1025
36#define USB_VID_KWORLD 0xeb2a 36#define USB_VID_KWORLD 0xeb2a
37#define USB_VID_KWORLD_2 0x1b80
37#define USB_VID_KYE 0x0458 38#define USB_VID_KYE 0x0458
38#define USB_VID_LEADTEK 0x0413 39#define USB_VID_LEADTEK 0x0413
39#define USB_VID_LITEON 0x04ca 40#define USB_VID_LITEON 0x04ca
40#define USB_VID_MEDION 0x1660 41#define USB_VID_MEDION 0x1660
41#define USB_VID_MIGLIA 0x18f3 42#define USB_VID_MIGLIA 0x18f3
42#define USB_VID_MSI 0x0db0 43#define USB_VID_MSI 0x0db0
44#define USB_VID_MSI_2 0x1462
43#define USB_VID_OPERA1 0x695c 45#define USB_VID_OPERA1 0x695c
44#define USB_VID_PINNACLE 0x2304 46#define USB_VID_PINNACLE 0x2304
45#define USB_VID_TECHNOTREND 0x0b48 47#define USB_VID_TECHNOTREND 0x0b48
@@ -51,15 +53,18 @@
51#define USB_VID_WIDEVIEW 0x14aa 53#define USB_VID_WIDEVIEW 0x14aa
52#define USB_VID_GIGABYTE 0x1044 54#define USB_VID_GIGABYTE 0x1044
53#define USB_VID_YUAN 0x1164 55#define USB_VID_YUAN 0x1164
54 56#define USB_VID_XTENSIONS 0x1ae7
55 57
56/* Product IDs */ 58/* Product IDs */
57#define USB_PID_ADSTECH_USB2_COLD 0xa333 59#define USB_PID_ADSTECH_USB2_COLD 0xa333
58#define USB_PID_ADSTECH_USB2_WARM 0xa334 60#define USB_PID_ADSTECH_USB2_WARM 0xa334
59#define USB_PID_AFATECH_AF9005 0x9020 61#define USB_PID_AFATECH_AF9005 0x9020
62#define USB_PID_AFATECH_AF9015_9015 0x9015
63#define USB_PID_AFATECH_AF9015_9016 0x9016
60#define USB_VID_ALINK_DTU 0xf170 64#define USB_VID_ALINK_DTU 0xf170
61#define USB_PID_ANSONIC_DVBT_USB 0x6000 65#define USB_PID_ANSONIC_DVBT_USB 0x6000
62#define USB_PID_ANYSEE 0x861f 66#define USB_PID_ANYSEE 0x861f
67#define USB_PID_AZUREWAVE_AD_TU700 0x3237
63#define USB_PID_AVERMEDIA_DVBT_USB_COLD 0x0001 68#define USB_PID_AVERMEDIA_DVBT_USB_COLD 0x0001
64#define USB_PID_AVERMEDIA_DVBT_USB_WARM 0x0002 69#define USB_PID_AVERMEDIA_DVBT_USB_WARM 0x0002
65#define USB_PID_AVERMEDIA_DVBT_USB2_COLD 0xa800 70#define USB_PID_AVERMEDIA_DVBT_USB2_COLD 0xa800
@@ -89,9 +94,12 @@
89#define USB_PID_UNIWILL_STK7700P 0x6003 94#define USB_PID_UNIWILL_STK7700P 0x6003
90#define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0 95#define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0
91#define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1 96#define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1
97#define USB_PID_KWORLD_399U 0xe399
98#define USB_PID_KWORLD_PC160_2T 0xc160
92#define USB_PID_KWORLD_VSTREAM_COLD 0x17de 99#define USB_PID_KWORLD_VSTREAM_COLD 0x17de
93#define USB_PID_KWORLD_VSTREAM_WARM 0x17df 100#define USB_PID_KWORLD_VSTREAM_WARM 0x17df
94#define USB_PID_TERRATEC_CINERGY_T_USB_XE 0x0055 101#define USB_PID_TERRATEC_CINERGY_T_USB_XE 0x0055
102#define USB_PID_TERRATEC_CINERGY_T_USB_XE_REV2 0x0069
95#define USB_PID_TWINHAN_VP7041_COLD 0x3201 103#define USB_PID_TWINHAN_VP7041_COLD 0x3201
96#define USB_PID_TWINHAN_VP7041_WARM 0x3202 104#define USB_PID_TWINHAN_VP7041_WARM 0x3202
97#define USB_PID_TWINHAN_VP7020_COLD 0x3203 105#define USB_PID_TWINHAN_VP7020_COLD 0x3203
@@ -100,6 +108,7 @@
100#define USB_PID_TWINHAN_VP7045_WARM 0x3206 108#define USB_PID_TWINHAN_VP7045_WARM 0x3206
101#define USB_PID_TWINHAN_VP7021_COLD 0x3207 109#define USB_PID_TWINHAN_VP7021_COLD 0x3207
102#define USB_PID_TWINHAN_VP7021_WARM 0x3208 110#define USB_PID_TWINHAN_VP7021_WARM 0x3208
111#define USB_PID_TINYTWIN 0x3226
103#define USB_PID_DNTV_TINYUSB2_COLD 0x3223 112#define USB_PID_DNTV_TINYUSB2_COLD 0x3223
104#define USB_PID_DNTV_TINYUSB2_WARM 0x3224 113#define USB_PID_DNTV_TINYUSB2_WARM 0x3224
105#define USB_PID_ULTIMA_TVBOX_COLD 0x8105 114#define USB_PID_ULTIMA_TVBOX_COLD 0x8105
@@ -146,6 +155,8 @@
146#define USB_PID_AVERMEDIA_HYBRID_ULTRA_USB_M039R 0x0039 155#define USB_PID_AVERMEDIA_HYBRID_ULTRA_USB_M039R 0x0039
147#define USB_PID_AVERMEDIA_HYBRID_ULTRA_USB_M039R_ATSC 0x1039 156#define USB_PID_AVERMEDIA_HYBRID_ULTRA_USB_M039R_ATSC 0x1039
148#define USB_PID_AVERMEDIA_HYBRID_ULTRA_USB_M039R_DVBT 0x2039 157#define USB_PID_AVERMEDIA_HYBRID_ULTRA_USB_M039R_DVBT 0x2039
158#define USB_PID_AVERMEDIA_VOLAR_X 0xa815
159#define USB_PID_AVERMEDIA_VOLAR_X_2 0x8150
149#define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006 160#define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006
150#define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a 161#define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a
151#define USB_PID_TERRATEC_CINERGY_HT_USB_XE 0x0058 162#define USB_PID_TERRATEC_CINERGY_HT_USB_XE 0x0058
@@ -155,6 +166,7 @@
155#define USB_PID_PINNACLE_PCTV2000E 0x022c 166#define USB_PID_PINNACLE_PCTV2000E 0x022c
156#define USB_PID_PINNACLE_PCTV_DVB_T_FLASH 0x0228 167#define USB_PID_PINNACLE_PCTV_DVB_T_FLASH 0x0228
157#define USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T 0x0229 168#define USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T 0x0229
169#define USB_PID_PINNACLE_PCTV71E 0x022b
158#define USB_PID_PINNACLE_PCTV72E 0x0236 170#define USB_PID_PINNACLE_PCTV72E 0x0236
159#define USB_PID_PINNACLE_PCTV73E 0x0237 171#define USB_PID_PINNACLE_PCTV73E 0x0237
160#define USB_PID_PCTV_200E 0x020e 172#define USB_PID_PCTV_200E 0x020e
@@ -193,6 +205,7 @@
193#define USB_PID_WINFAST_DTV_DONGLE_WARM 0x6026 205#define USB_PID_WINFAST_DTV_DONGLE_WARM 0x6026
194#define USB_PID_WINFAST_DTV_DONGLE_STK7700P 0x6f00 206#define USB_PID_WINFAST_DTV_DONGLE_STK7700P 0x6f00
195#define USB_PID_WINFAST_DTV_DONGLE_STK7700P_2 0x6f01 207#define USB_PID_WINFAST_DTV_DONGLE_STK7700P_2 0x6f01
208#define USB_PID_WINFAST_DTV_DONGLE_GOLD 0x6029
196#define USB_PID_GENPIX_8PSK_REV_1_COLD 0x0200 209#define USB_PID_GENPIX_8PSK_REV_1_COLD 0x0200
197#define USB_PID_GENPIX_8PSK_REV_1_WARM 0x0201 210#define USB_PID_GENPIX_8PSK_REV_1_WARM 0x0201
198#define USB_PID_GENPIX_8PSK_REV_2 0x0202 211#define USB_PID_GENPIX_8PSK_REV_2 0x0202
@@ -200,6 +213,7 @@
200#define USB_PID_GENPIX_SKYWALKER_CW3K 0x0204 213#define USB_PID_GENPIX_SKYWALKER_CW3K 0x0204
201#define USB_PID_SIGMATEK_DVB_110 0x6610 214#define USB_PID_SIGMATEK_DVB_110 0x6610
202#define USB_PID_MSI_DIGI_VOX_MINI_II 0x1513 215#define USB_PID_MSI_DIGI_VOX_MINI_II 0x1513
216#define USB_PID_MSI_DIGIVOX_DUO 0x8801
203#define USB_PID_OPERA1_COLD 0x2830 217#define USB_PID_OPERA1_COLD 0x2830
204#define USB_PID_OPERA1_WARM 0x3829 218#define USB_PID_OPERA1_WARM 0x3829
205#define USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD 0x0514 219#define USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD 0x0514
@@ -209,5 +223,6 @@
209#define USB_PID_ASUS_U3100 0x173f 223#define USB_PID_ASUS_U3100 0x173f
210#define USB_PID_YUAN_EC372S 0x1edc 224#define USB_PID_YUAN_EC372S 0x1edc
211#define USB_PID_DW2102 0x2102 225#define USB_PID_DW2102 0x2102
226#define USB_PID_XTENSIONS_XD_380 0x0381
212 227
213#endif 228#endif