blob: f027a2c1c3e80202cd953e2e5abc7379bd06136a [file] [log] [blame]
Malcolm Priestleyf6d87352011-07-25 15:35:03 -03001/* DVB USB compliant linux driver for IT9137
2 *
3 * Copyright (C) 2011 Malcolm Priestley (tvboxspy@gmail.com)
4 * IT9137 (C) ITE Tech Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License Version 2, as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 *
20 * see Documentation/dvb/README.dvb-usb for more information
21 * see Documentation/dvb/it9137.txt for firmware information
22 *
23 */
24#define DVB_USB_LOG_PREFIX "it913x"
25
26#include <linux/usb.h>
27#include <linux/usb/input.h>
28#include <media/rc-core.h>
29
30#include "dvb-usb.h"
31#include "it913x-fe.h"
32
33/* debug */
34static int dvb_usb_it913x_debug;
35#define l_dprintk(var, level, args...) do { \
36 if ((var >= level)) \
37 printk(KERN_DEBUG DVB_USB_LOG_PREFIX ": " args); \
38} while (0)
39
40#define deb_info(level, args...) l_dprintk(dvb_usb_it913x_debug, level, args)
41#define debug_data_snipet(level, name, p) \
42 deb_info(level, name" (%02x%02x%02x%02x%02x%02x%02x%02x)", \
43 *p, *(p+1), *(p+2), *(p+3), *(p+4), \
44 *(p+5), *(p+6), *(p+7));
45
46
47module_param_named(debug, dvb_usb_it913x_debug, int, 0644);
48MODULE_PARM_DESC(debug, "set debugging level (1=info (or-able))."
49 DVB_USB_DEBUG_STATUS);
50
51static int pid_filter;
52module_param_named(pid, pid_filter, int, 0644);
53MODULE_PARM_DESC(pid, "set default 0=on 1=off");
54
55int cmd_counter;
56
57DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
58
59struct it913x_state {
60 u8 id;
61};
62
63static int it913x_bulk_write(struct usb_device *dev,
64 u8 *snd, int len, u8 pipe)
65{
66 int ret, actual_l;
67
68 ret = usb_bulk_msg(dev, usb_sndbulkpipe(dev, pipe),
69 snd, len , &actual_l, 100);
70 return ret;
71}
72
73static int it913x_bulk_read(struct usb_device *dev,
74 u8 *rev, int len, u8 pipe)
75{
76 int ret, actual_l;
77
78 ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, pipe),
79 rev, len , &actual_l, 200);
80 return ret;
81}
82
83static u16 check_sum(u8 *p, u8 len)
84{
85 u16 sum = 0;
86 u8 i = 1;
87 while (i < len)
88 sum += (i++ & 1) ? (*p++) << 8 : *p++;
89 return ~sum;
90}
91
92static int it913x_io(struct usb_device *udev, u8 mode, u8 pro,
93 u8 cmd, u32 reg, u8 addr, u8 *data, u8 len)
94{
95 int ret = 0, i, buf_size = 1;
96 u8 *buff;
97 u8 rlen;
98 u16 chk_sum;
99
100 buff = kzalloc(256, GFP_KERNEL);
101 if (!buff) {
102 info("USB Buffer Failed");
103 return -ENOMEM;
104 }
105
106 buff[buf_size++] = pro;
107 buff[buf_size++] = cmd;
108 buff[buf_size++] = cmd_counter;
109
110 switch (mode) {
111 case READ_LONG:
112 case WRITE_LONG:
113 buff[buf_size++] = len;
114 buff[buf_size++] = 2;
115 buff[buf_size++] = (reg >> 24);
116 buff[buf_size++] = (reg >> 16) & 0xff;
117 buff[buf_size++] = (reg >> 8) & 0xff;
118 buff[buf_size++] = reg & 0xff;
119 break;
120 case READ_SHORT:
121 buff[buf_size++] = addr;
122 break;
123 case WRITE_SHORT:
124 buff[buf_size++] = len;
125 buff[buf_size++] = addr;
126 buff[buf_size++] = (reg >> 8) & 0xff;
127 buff[buf_size++] = reg & 0xff;
128 break;
129 case READ_DATA:
130 case WRITE_DATA:
131 break;
132 case WRITE_CMD:
133 mode = 7;
134 break;
135 default:
136 kfree(buff);
137 return -EINVAL;
138 }
139
140 if (mode & 1) {
141 for (i = 0; i < len ; i++)
142 buff[buf_size++] = data[i];
143 }
144 chk_sum = check_sum(&buff[1], buf_size);
145
146 buff[buf_size++] = chk_sum >> 8;
147 buff[0] = buf_size;
148 buff[buf_size++] = (chk_sum & 0xff);
149
150 ret = it913x_bulk_write(udev, buff, buf_size , 0x02);
151
152 ret |= it913x_bulk_read(udev, buff, (mode & 1) ?
153 5 : len + 5 , 0x01);
154
155 rlen = (mode & 0x1) ? 0x1 : len;
156
157 if (mode & 1)
158 ret |= buff[2];
159 else
160 memcpy(data, &buff[3], rlen);
161
162 cmd_counter++;
163
164 kfree(buff);
165
166 return (ret < 0) ? -ENODEV : 0;
167}
168
169static int it913x_wr_reg(struct usb_device *udev, u8 pro, u32 reg , u8 data)
170{
171 int ret;
172 u8 b[1];
173 b[0] = data;
174 ret = it913x_io(udev, WRITE_LONG, pro,
175 CMD_DEMOD_WRITE, reg, 0, b, sizeof(b));
176
177 return ret;
178}
179
180static int it913x_read_reg(struct usb_device *udev, u32 reg)
181{
182 int ret;
183 u8 data[1];
184
185 ret = it913x_io(udev, READ_LONG, DEV_0,
186 CMD_DEMOD_READ, reg, 0, &data[0], 1);
187
188 return (ret < 0) ? ret : data[0];
189}
190
191static u32 it913x_query(struct usb_device *udev, u8 pro)
192{
193 int ret;
194 u32 res = 0;
195 u8 data[4];
196 ret = it913x_io(udev, READ_LONG, pro, CMD_DEMOD_READ,
197 0x1222, 0, &data[0], 1);
198 if (data[0] == 0x1) {
199 ret = it913x_io(udev, READ_SHORT, pro,
200 CMD_QUERYINFO, 0, 0x1, &data[0], 4);
201 res = (data[0] << 24) + (data[1] << 16) +
202 (data[2] << 8) + data[3];
203 }
204
205 return (ret < 0) ? 0 : res;
206}
207
208static int it913x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
209{
210 int ret = 0;
211 u8 pro = (adap->id == 0) ? DEV_0_DMOD : DEV_1_DMOD;
212
213 if (mutex_lock_interruptible(&adap->dev->i2c_mutex) < 0)
214 return -EAGAIN;
215 deb_info(1, "PID_C (%02x)", onoff);
216
217 if (!onoff)
218 ret = it913x_wr_reg(adap->dev->udev, pro, PID_RST, 0x1);
219
220 mutex_unlock(&adap->dev->i2c_mutex);
221 return ret;
222}
223
224static int it913x_pid_filter(struct dvb_usb_adapter *adap,
225 int index, u16 pid, int onoff)
226{
227 struct usb_device *udev = adap->dev->udev;
228 int ret = 0;
229 u8 pro = (adap->id == 0) ? DEV_0_DMOD : DEV_1_DMOD;
230
231 if (pid_filter > 0)
232 return 0;
233
234 if (mutex_lock_interruptible(&adap->dev->i2c_mutex) < 0)
235 return -EAGAIN;
236 deb_info(1, "PID_F (%02x)", onoff);
237 if (onoff) {
238 ret = it913x_wr_reg(udev, pro, PID_EN, 0x1);
239
240 ret |= it913x_wr_reg(udev, pro, PID_LSB, (u8)(pid & 0xff));
241
242 ret |= it913x_wr_reg(udev, pro, PID_MSB, (u8)(pid >> 8));
243
244 ret |= it913x_wr_reg(udev, pro, PID_INX_EN, (u8)onoff);
245
246 ret |= it913x_wr_reg(udev, pro, PID_INX, (u8)(index & 0x1f));
247
248 }
249
250 mutex_unlock(&adap->dev->i2c_mutex);
251 return 0;
252}
253
254
255static int it913x_return_status(struct usb_device *udev)
256{
257 u32 firm = 0;
258
259 firm = it913x_query(udev, DEV_0);
260 if (firm > 0)
261 info("Firmware Version %d", firm);
262
263 return (firm > 0) ? firm : 0;
264}
265
266static int it913x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
267 int num)
268{
269 struct dvb_usb_device *d = i2c_get_adapdata(adap);
270 static u8 data[256];
271 int ret;
272 u32 reg;
273 u8 pro;
274 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
275 return -EAGAIN;
276
277 debug_data_snipet(1, "Message out", msg[0].buf);
278 deb_info(2, "num of messages %d address %02x", num, msg[0].addr);
279
280 pro = (msg[0].addr & 0x2) ? DEV_0_DMOD : 0x0;
281 pro |= (msg[0].addr & 0x20) ? DEV_1 : DEV_0;
282 memcpy(data, msg[0].buf, msg[0].len);
283 reg = (data[0] << 24) + (data[1] << 16) +
284 (data[2] << 8) + data[3];
285 if (num == 2) {
286 ret = it913x_io(d->udev, READ_LONG, pro,
287 CMD_DEMOD_READ, reg, 0, data, msg[1].len);
288 memcpy(msg[1].buf, data, msg[1].len);
289 } else
290 ret = it913x_io(d->udev, WRITE_LONG, pro, CMD_DEMOD_WRITE,
291 reg, 0, &data[4], msg[0].len - 4);
292
293 mutex_unlock(&d->i2c_mutex);
294
295 return ret;
296}
297
298static u32 it913x_i2c_func(struct i2c_adapter *adapter)
299{
300 return I2C_FUNC_I2C;
301}
302
303static struct i2c_algorithm it913x_i2c_algo = {
304 .master_xfer = it913x_i2c_xfer,
305 .functionality = it913x_i2c_func,
306};
307
308/* Callbacks for DVB USB */
tvboxspy2ba0f942011-09-21 18:57:41 -0300309#define IT913X_POLL 250
310static int it913x_rc_query(struct dvb_usb_device *d)
311{
312 u8 ibuf[4];
313 int ret;
314 u32 key;
315 /* Avoid conflict with frontends*/
316 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
317 return -EAGAIN;
318
319 ret = it913x_io(d->udev, READ_LONG, PRO_LINK, CMD_IR_GET,
320 0, 0, &ibuf[0], sizeof(ibuf));
321
322 if ((ibuf[2] + ibuf[3]) == 0xff) {
323 key = ibuf[2];
324 key += ibuf[0] << 8;
325 deb_info(1, "INT Key =%08x", key);
326 if (d->rc_dev != NULL)
327 rc_keydown(d->rc_dev, key, 0);
328 }
329 mutex_unlock(&d->i2c_mutex);
330
331 return ret;
332}
Malcolm Priestleyf6d87352011-07-25 15:35:03 -0300333static int it913x_identify_state(struct usb_device *udev,
334 struct dvb_usb_device_properties *props,
335 struct dvb_usb_device_description **desc,
336 int *cold)
337{
338 int ret = 0, firm_no;
339 u8 reg, adap, ep, tun0, tun1;
340
341 firm_no = it913x_return_status(udev);
342
343 ep = it913x_read_reg(udev, 0x49ac);
344 adap = it913x_read_reg(udev, 0x49c5);
345 tun0 = it913x_read_reg(udev, 0x49d0);
346 info("No. Adapters=%x Endpoints=%x Tuner Type=%x", adap, ep, tun0);
347
348 if (firm_no > 0) {
349 *cold = 0;
350 return 0;
351 }
352
353 if (adap > 2) {
354 tun1 = it913x_read_reg(udev, 0x49e0);
355 ret = it913x_wr_reg(udev, DEV_0, GPIOH1_EN, 0x1);
356 ret |= it913x_wr_reg(udev, DEV_0, GPIOH1_ON, 0x1);
357 ret |= it913x_wr_reg(udev, DEV_0, GPIOH1_O, 0x1);
358 msleep(50); /* Delay noticed reset cycle ? */
359 ret |= it913x_wr_reg(udev, DEV_0, GPIOH1_O, 0x0);
360 msleep(50);
361 reg = it913x_read_reg(udev, GPIOH1_O);
362 if (reg == 0) {
363 ret |= it913x_wr_reg(udev, DEV_0, GPIOH1_O, 0x1);
364 ret |= it913x_return_status(udev);
365 if (ret != 0)
366 ret = it913x_wr_reg(udev, DEV_0,
367 GPIOH1_O, 0x0);
368 }
369 } else
370 props->num_adapters = 1;
371
372 reg = it913x_read_reg(udev, IO_MUX_POWER_CLK);
373
374 ret |= it913x_wr_reg(udev, DEV_0, 0x4bfb, CHIP2_I2C_ADDR);
375
376 ret |= it913x_wr_reg(udev, DEV_0, CLK_O_EN, 0x1);
377
378 *cold = 1;
379
380 return (ret < 0) ? -ENODEV : 0;
381}
382
383static int it913x_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
384{
385 int ret = 0;
386 u8 pro = (adap->id == 0) ? DEV_0_DMOD : DEV_1_DMOD;
387
388 if (mutex_lock_interruptible(&adap->dev->i2c_mutex) < 0)
389 return -EAGAIN;
390 deb_info(1, "STM (%02x)", onoff);
391
392 if (!onoff)
393 ret = it913x_wr_reg(adap->dev->udev, pro, PID_RST, 0x1);
394
395
396 mutex_unlock(&adap->dev->i2c_mutex);
397
398 return ret;
399}
400
401
402static int it913x_download_firmware(struct usb_device *udev,
403 const struct firmware *fw)
404{
405 int ret = 0, i;
406 u8 packet_size, dlen, tun1;
407 u8 *fw_data;
408
409 packet_size = 0x29;
410
411 tun1 = it913x_read_reg(udev, 0x49e0);
412
413 ret = it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_100);
414
415 info("FRM Starting Firmware Download");
416 /* This uses scatter write firmware headers follow */
417 /* 03 XX 00 XX = chip number? */
418
419 for (i = 0; i < fw->size; i += packet_size) {
420 if (i > 0)
421 packet_size = 0x39;
422 fw_data = (u8 *)(fw->data + i);
423 dlen = ((i + packet_size) > fw->size)
424 ? (fw->size - i) : packet_size;
425 ret |= it913x_io(udev, WRITE_DATA, DEV_0,
426 CMD_SCATTER_WRITE, 0, 0, fw_data, dlen);
427 udelay(1000);
428 }
429
430 ret |= it913x_io(udev, WRITE_CMD, DEV_0,
431 CMD_BOOT, 0, 0, NULL, 0);
432
433 msleep(100);
434
435 if (ret < 0)
436 info("FRM Firmware Download Failed (%04x)" , ret);
437 else
438 info("FRM Firmware Download Completed - Resetting Device");
439
440 ret |= it913x_return_status(udev);
441
442 msleep(30);
443
444 ret |= it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_400);
445
446 /* Tuner function */
447 ret |= it913x_wr_reg(udev, DEV_0_DMOD , 0xec4c, 0xa0);
448
449 ret |= it913x_wr_reg(udev, DEV_0, PADODPU, 0x0);
450 ret |= it913x_wr_reg(udev, DEV_0, AGC_O_D, 0x0);
451 if (tun1 > 0) {
452 ret |= it913x_wr_reg(udev, DEV_1, PADODPU, 0x0);
453 ret |= it913x_wr_reg(udev, DEV_1, AGC_O_D, 0x0);
454 }
455
456 return (ret < 0) ? -ENODEV : 0;
457}
458
459static int it913x_name(struct dvb_usb_adapter *adap)
460{
461 const char *desc = adap->dev->desc->name;
462 char *fe_name[] = {"_1", "_2", "_3", "_4"};
Michael Krufky77eed212011-09-06 09:31:57 -0300463 char *name = adap->fe_adap[0].fe->ops.info.name;
Malcolm Priestleyf6d87352011-07-25 15:35:03 -0300464
465 strlcpy(name, desc, 128);
466 strlcat(name, fe_name[adap->id], 128);
467
468 return 0;
469}
470
471static int it913x_frontend_attach(struct dvb_usb_adapter *adap)
472{
473 struct usb_device *udev = adap->dev->udev;
474 int ret = 0;
475 u8 adf = it913x_read_reg(udev, IO_MUX_POWER_CLK);
476 u8 adap_addr = I2C_BASE_ADDR + (adap->id << 5);
Michael Krufky77eed212011-09-06 09:31:57 -0300477 u16 ep_size = adap->props.fe[0].stream.u.bulk.buffersize;
Malcolm Priestleyf6d87352011-07-25 15:35:03 -0300478
Michael Krufky77eed212011-09-06 09:31:57 -0300479 adap->fe_adap[0].fe = dvb_attach(it913x_fe_attach,
Malcolm Priestleyf6d87352011-07-25 15:35:03 -0300480 &adap->dev->i2c_adap, adap_addr, adf, IT9137);
481
Michael Krufky77eed212011-09-06 09:31:57 -0300482 if (adap->id == 0 && adap->fe_adap[0].fe) {
Malcolm Priestleyf6d87352011-07-25 15:35:03 -0300483 ret = it913x_wr_reg(udev, DEV_0_DMOD, MP2_SW_RST, 0x1);
484 ret = it913x_wr_reg(udev, DEV_0_DMOD, MP2IF2_SW_RST, 0x1);
485 ret = it913x_wr_reg(udev, DEV_0, EP0_TX_EN, 0x0f);
486 ret = it913x_wr_reg(udev, DEV_0, EP0_TX_NAK, 0x1b);
487 ret = it913x_wr_reg(udev, DEV_0, EP0_TX_EN, 0x2f);
488 ret = it913x_wr_reg(udev, DEV_0, EP4_TX_LEN_LSB,
489 ep_size & 0xff);
490 ret = it913x_wr_reg(udev, DEV_0, EP4_TX_LEN_MSB, ep_size >> 8);
491 ret = it913x_wr_reg(udev, DEV_0, EP4_MAX_PKT, 0x80);
Michael Krufky77eed212011-09-06 09:31:57 -0300492 } else if (adap->id == 1 && adap->fe_adap[0].fe) {
Malcolm Priestleyf6d87352011-07-25 15:35:03 -0300493 ret = it913x_wr_reg(udev, DEV_0, EP0_TX_EN, 0x6f);
494 ret = it913x_wr_reg(udev, DEV_0, EP5_TX_LEN_LSB,
495 ep_size & 0xff);
496 ret = it913x_wr_reg(udev, DEV_0, EP5_TX_LEN_MSB, ep_size >> 8);
497 ret = it913x_wr_reg(udev, DEV_0, EP5_MAX_PKT, 0x80);
498 ret = it913x_wr_reg(udev, DEV_0_DMOD, MP2IF2_EN, 0x1);
499 ret = it913x_wr_reg(udev, DEV_1_DMOD, MP2IF_SERIAL, 0x1);
500 ret = it913x_wr_reg(udev, DEV_1, TOP_HOSTB_SER_MODE, 0x1);
501 ret = it913x_wr_reg(udev, DEV_0_DMOD, TSIS_ENABLE, 0x1);
502 ret = it913x_wr_reg(udev, DEV_0_DMOD, MP2_SW_RST, 0x0);
503 ret = it913x_wr_reg(udev, DEV_0_DMOD, MP2IF2_SW_RST, 0x0);
504 ret = it913x_wr_reg(udev, DEV_0_DMOD, MP2IF2_HALF_PSB, 0x0);
505 ret = it913x_wr_reg(udev, DEV_0_DMOD, MP2IF_STOP_EN, 0x1);
506 ret = it913x_wr_reg(udev, DEV_1_DMOD, MPEG_FULL_SPEED, 0x0);
507 ret = it913x_wr_reg(udev, DEV_1_DMOD, MP2IF_STOP_EN, 0x0);
508 } else
509 return -ENODEV;
510
511 ret = it913x_name(adap);
512
513 return ret;
514}
515
516/* DVB USB Driver */
517static struct dvb_usb_device_properties it913x_properties;
518
519static int it913x_probe(struct usb_interface *intf,
520 const struct usb_device_id *id)
521{
522 cmd_counter = 0;
523 if (0 == dvb_usb_device_init(intf, &it913x_properties,
524 THIS_MODULE, NULL, adapter_nr)) {
525 info("DEV registering device driver");
526 return 0;
527 }
528
529 info("DEV it913x Error");
530 return -ENODEV;
531
532}
533
534static struct usb_device_id it913x_table[] = {
535 { USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_UB499_2T_T09) },
536 {} /* Terminating entry */
537};
538
539MODULE_DEVICE_TABLE(usb, it913x_table);
540
541static struct dvb_usb_device_properties it913x_properties = {
542 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
543 .usb_ctrl = DEVICE_SPECIFIC,
544 .download_firmware = it913x_download_firmware,
545 .firmware = "dvb-usb-it9137-01.fw",
546 .no_reconnect = 1,
547 .size_of_priv = sizeof(struct it913x_state),
548 .num_adapters = 2,
549 .adapter = {
550 {
Michael Krufky77eed212011-09-06 09:31:57 -0300551 .num_frontends = 1,
552 .fe = {{
Malcolm Priestleyf6d87352011-07-25 15:35:03 -0300553 .caps = DVB_USB_ADAP_HAS_PID_FILTER|
554 DVB_USB_ADAP_NEED_PID_FILTERING|
555 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
556 .streaming_ctrl = it913x_streaming_ctrl,
557 .pid_filter_count = 31,
558 .pid_filter = it913x_pid_filter,
559 .pid_filter_ctrl = it913x_pid_filter_ctrl,
560 .frontend_attach = it913x_frontend_attach,
561 /* parameter for the MPEG2-data transfer */
562 .stream = {
563 .type = USB_BULK,
564 .count = 10,
565 .endpoint = 0x04,
566 .u = {/* Keep Low if PID filter on */
567 .bulk = {
568 .buffersize = 3584,
569
570 }
571 }
572 }
Michael Krufky77eed212011-09-06 09:31:57 -0300573 }},
Malcolm Priestleyf6d87352011-07-25 15:35:03 -0300574 },
575 {
Michael Krufky77eed212011-09-06 09:31:57 -0300576 .num_frontends = 1,
577 .fe = {{
Malcolm Priestleyf6d87352011-07-25 15:35:03 -0300578 .caps = DVB_USB_ADAP_HAS_PID_FILTER|
579 DVB_USB_ADAP_NEED_PID_FILTERING|
580 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
581 .streaming_ctrl = it913x_streaming_ctrl,
582 .pid_filter_count = 31,
583 .pid_filter = it913x_pid_filter,
584 .pid_filter_ctrl = it913x_pid_filter_ctrl,
585 .frontend_attach = it913x_frontend_attach,
586 /* parameter for the MPEG2-data transfer */
587 .stream = {
588 .type = USB_BULK,
589 .count = 5,
590 .endpoint = 0x05,
591 .u = {
592 .bulk = {
593 .buffersize = 3584,
594
595 }
596 }
597 }
Michael Krufky77eed212011-09-06 09:31:57 -0300598 }},
Malcolm Priestleyf6d87352011-07-25 15:35:03 -0300599 }
600 },
601 .identify_state = it913x_identify_state,
tvboxspy2ba0f942011-09-21 18:57:41 -0300602 .rc.core = {
603 .protocol = RC_TYPE_NEC,
604 .module_name = "it913x",
605 .rc_query = it913x_rc_query,
606 .rc_interval = IT913X_POLL,
607 .allowed_protos = RC_TYPE_NEC,
608 .rc_codes = RC_MAP_KWORLD_315U,
609 },
Malcolm Priestleyf6d87352011-07-25 15:35:03 -0300610 .i2c_algo = &it913x_i2c_algo,
611 .num_device_descs = 1,
612 .devices = {
613 { "Kworld UB499-2T T09(IT9137)",
614 { &it913x_table[0], NULL },
615 },
616
617 }
618};
619
620static struct usb_driver it913x_driver = {
621 .name = "it913x",
622 .probe = it913x_probe,
623 .disconnect = dvb_usb_device_exit,
624 .id_table = it913x_table,
625};
626
627/* module stuff */
628static int __init it913x_module_init(void)
629{
630 int result = usb_register(&it913x_driver);
631 if (result) {
632 err("usb_register failed. Error number %d", result);
633 return result;
634 }
635
636 return 0;
637}
638
639static void __exit it913x_module_exit(void)
640{
641 /* deregister this driver from the USB subsystem */
642 usb_deregister(&it913x_driver);
643}
644
645module_init(it913x_module_init);
646module_exit(it913x_module_exit);
647
648MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>");
649MODULE_DESCRIPTION("it913x USB 2 Driver");
tvboxspy2ba0f942011-09-21 18:57:41 -0300650MODULE_VERSION("1.06");
Malcolm Priestleyf6d87352011-07-25 15:35:03 -0300651MODULE_LICENSE("GPL");