allow coexistance of N build and AC build.
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / drivers / media / dvb / dvb-usb / m920x.c
blobc546ddeda5d4fbd8d7e0f8a4dd8c40f131839cf0
1 /* DVB USB compliant linux driver for MSI Mega Sky 580 DVB-T USB2.0 receiver
3 * Copyright (C) 2006 Aapo Tahkola (aet@rasterburn.org)
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation, version 2.
9 * see Documentation/dvb/README.dvb-usb for more information
12 #include "m920x.h"
14 #include "mt352.h"
15 #include "mt352_priv.h"
16 #include "qt1010.h"
17 #include "tda1004x.h"
18 #include "tda827x.h"
20 /* debug */
21 static int dvb_usb_m920x_debug;
22 module_param_named(debug,dvb_usb_m920x_debug, int, 0644);
23 MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
25 static inline int m920x_read(struct usb_device *udev, u8 request, u16 value,
26 u16 index, void *data, int size)
28 int ret;
30 ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
31 request, USB_TYPE_VENDOR | USB_DIR_IN,
32 value, index, data, size, 2000);
33 if (ret < 0) {
34 printk(KERN_INFO "m920x_read = error: %d\n", ret);
35 return ret;
38 if (ret != size) {
39 deb("m920x_read = no data\n");
40 return -EIO;
43 return 0;
46 static inline int m920x_write(struct usb_device *udev, u8 request,
47 u16 value, u16 index)
49 int ret;
51 ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
52 request, USB_TYPE_VENDOR | USB_DIR_OUT,
53 value, index, NULL, 0, 2000);
55 return ret;
58 static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq)
60 int ret = 0;
62 /* Remote controller init. */
63 if (d->props.rc_query) {
64 deb("Initialising remote control\n");
65 while (rc_seq->address) {
66 if ((ret = m920x_write(d->udev, M9206_CORE,
67 rc_seq->data,
68 rc_seq->address)) != 0) {
69 deb("Initialising remote control failed\n");
70 return ret;
73 rc_seq++;
76 deb("Initialising remote control success\n");
79 return ret;
82 static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
84 struct m920x_state *m = d->priv;
85 int i, ret = 0;
86 u8 rc_state[2];
88 if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0)
89 goto unlock;
91 if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0)
92 goto unlock;
94 for (i = 0; i < d->props.rc_key_map_size; i++)
95 if (d->props.rc_key_map[i].data == rc_state[1]) {
96 *event = d->props.rc_key_map[i].event;
98 switch(rc_state[0]) {
99 case 0x80:
100 *state = REMOTE_NO_KEY_PRESSED;
101 goto unlock;
103 case 0x88: /* framing error or "invalid code" */
104 case 0x99:
105 case 0xc0:
106 case 0xd8:
107 *state = REMOTE_NO_KEY_PRESSED;
108 m->rep_count = 0;
109 goto unlock;
111 case 0x93:
112 case 0x92:
113 m->rep_count = 0;
114 *state = REMOTE_KEY_PRESSED;
115 goto unlock;
117 case 0x91:
118 /* prevent immediate auto-repeat */
119 if (++m->rep_count > 2)
120 *state = REMOTE_KEY_REPEAT;
121 else
122 *state = REMOTE_NO_KEY_PRESSED;
123 goto unlock;
125 default:
126 deb("Unexpected rc state %02x\n", rc_state[0]);
127 *state = REMOTE_NO_KEY_PRESSED;
128 goto unlock;
132 if (rc_state[1] != 0)
133 deb("Unknown rc key %02x\n", rc_state[1]);
135 *state = REMOTE_NO_KEY_PRESSED;
137 unlock:
139 return ret;
142 /* I2C */
143 static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
145 struct dvb_usb_device *d = i2c_get_adapdata(adap);
146 int i, j;
147 int ret = 0;
149 if (!num)
150 return -EINVAL;
152 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
153 return -EAGAIN;
155 for (i = 0; i < num; i++) {
156 if (msg[i].flags & (I2C_M_NO_RD_ACK | I2C_M_IGNORE_NAK | I2C_M_TEN) || msg[i].len == 0) {
157 /* For a 0 byte message, I think sending the address
158 * to index 0x80|0x40 would be the correct thing to
159 * do. However, zero byte messages are only used for
160 * probing, and since we don't know how to get the
161 * slave's ack, we can't probe. */
162 ret = -ENOTSUPP;
163 goto unlock;
165 /* Send START & address/RW bit */
166 if (!(msg[i].flags & I2C_M_NOSTART)) {
167 if ((ret = m920x_write(d->udev, M9206_I2C,
168 (msg[i].addr << 1) |
169 (msg[i].flags & I2C_M_RD ? 0x01 : 0), 0x80)) != 0)
170 goto unlock;
171 /* Should check for ack here, if we knew how. */
173 if (msg[i].flags & I2C_M_RD) {
174 for (j = 0; j < msg[i].len; j++) {
175 /* Last byte of transaction?
176 * Send STOP, otherwise send ACK. */
177 int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x01;
179 if ((ret = m920x_read(d->udev, M9206_I2C, 0x0,
180 0x20 | stop,
181 &msg[i].buf[j], 1)) != 0)
182 goto unlock;
184 } else {
185 for (j = 0; j < msg[i].len; j++) {
186 /* Last byte of transaction? Then send STOP. */
187 int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x00;
189 if ((ret = m920x_write(d->udev, M9206_I2C, msg[i].buf[j], stop)) != 0)
190 goto unlock;
191 /* Should check for ack here too. */
195 ret = num;
197 unlock:
198 mutex_unlock(&d->i2c_mutex);
200 return ret;
203 static u32 m920x_i2c_func(struct i2c_adapter *adapter)
205 return I2C_FUNC_I2C;
208 static struct i2c_algorithm m920x_i2c_algo = {
209 .master_xfer = m920x_i2c_xfer,
210 .functionality = m920x_i2c_func,
213 /* pid filter */
214 static int m920x_set_filter(struct dvb_usb_adapter *adap,
215 int type, int idx, int pid)
217 int ret = 0;
219 if (pid >= 0x8000)
220 return -EINVAL;
222 pid |= 0x8000;
224 if ((ret = m920x_write(adap->dev->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0)
225 return ret;
227 if ((ret = m920x_write(adap->dev->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0)
228 return ret;
230 return ret;
233 static int m920x_update_filters(struct dvb_usb_adapter *adap)
235 struct m920x_state *m = adap->dev->priv;
236 int enabled = m->filtering_enabled;
237 int i, ret = 0, filter = 0;
239 for (i = 0; i < M9206_MAX_FILTERS; i++)
240 if (m->filters[i] == 8192)
241 enabled = 0;
243 /* Disable all filters */
244 if ((ret = m920x_set_filter(adap, 0x81, 1, enabled)) != 0)
245 return ret;
247 for (i = 0; i < M9206_MAX_FILTERS; i++)
248 if ((ret = m920x_set_filter(adap, 0x81, i + 2, 0)) != 0)
249 return ret;
251 if ((ret = m920x_set_filter(adap, 0x82, 0, 0x0)) != 0)
252 return ret;
254 /* Set */
255 if (enabled) {
256 for (i = 0; i < M9206_MAX_FILTERS; i++) {
257 if (m->filters[i] == 0)
258 continue;
260 if ((ret = m920x_set_filter(adap, 0x81, filter + 2, m->filters[i])) != 0)
261 return ret;
263 filter++;
267 if ((ret = m920x_set_filter(adap, 0x82, 0, 0x02f5)) != 0)
268 return ret;
270 return ret;
273 static int m920x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
275 struct m920x_state *m = adap->dev->priv;
277 m->filtering_enabled = onoff ? 1 : 0;
279 return m920x_update_filters(adap);
282 static int m920x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff)
284 struct m920x_state *m = adap->dev->priv;
286 m->filters[index] = onoff ? pid : 0;
288 return m920x_update_filters(adap);
291 static int m920x_firmware_download(struct usb_device *udev, const struct firmware *fw)
293 u16 value, index, size;
294 u8 read[4], *buff;
295 int i, pass, ret = 0;
297 buff = kmalloc(65536, GFP_KERNEL);
299 if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0)
300 goto done;
301 deb("%x %x %x %x\n", read[0], read[1], read[2], read[3]);
303 if ((ret = m920x_read(udev, M9206_FW, 0x0, 0x0, read, 1)) != 0)
304 goto done;
305 deb("%x\n", read[0]);
307 for (pass = 0; pass < 2; pass++) {
308 for (i = 0; i + (sizeof(u16) * 3) < fw->size;) {
309 value = le16_to_cpu(*(u16 *)(fw->data + i));
310 i += sizeof(u16);
312 index = le16_to_cpu(*(u16 *)(fw->data + i));
313 i += sizeof(u16);
315 size = le16_to_cpu(*(u16 *)(fw->data + i));
316 i += sizeof(u16);
318 if (pass == 1) {
319 /* Will stall if using fw->data ... */
320 memcpy(buff, fw->data + i, size);
322 ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0),
323 M9206_FW,
324 USB_TYPE_VENDOR | USB_DIR_OUT,
325 value, index, buff, size, 20);
326 if (ret != size) {
327 deb("error while uploading fw!\n");
328 ret = -EIO;
329 goto done;
331 msleep(3);
333 i += size;
335 if (i != fw->size) {
336 deb("bad firmware file!\n");
337 ret = -EINVAL;
338 goto done;
342 msleep(36);
344 /* m920x will disconnect itself from the bus after this. */
345 (void) m920x_write(udev, M9206_CORE, 0x01, M9206_FW_GO);
346 deb("firmware uploaded!\n");
348 done:
349 kfree(buff);
351 return ret;
354 /* Callbacks for DVB USB */
355 static int m920x_identify_state(struct usb_device *udev,
356 struct dvb_usb_device_properties *props,
357 struct dvb_usb_device_description **desc,
358 int *cold)
360 struct usb_host_interface *alt;
362 alt = usb_altnum_to_altsetting(usb_ifnum_to_if(udev, 0), 1);
363 *cold = (alt == NULL) ? 1 : 0;
365 return 0;
368 /* demod configurations */
369 static int m920x_mt352_demod_init(struct dvb_frontend *fe)
371 u8 config[] = { CONFIG, 0x3d };
372 u8 clock[] = { CLOCK_CTL, 0x30 };
373 u8 reset[] = { RESET, 0x80 };
374 u8 adc_ctl[] = { ADC_CTL_1, 0x40 };
375 u8 agc[] = { AGC_TARGET, 0x1c, 0x20 };
376 u8 sec_agc[] = { 0x69, 0x00, 0xff, 0xff, 0x40, 0xff, 0x00, 0x40, 0x40 };
377 u8 unk1[] = { 0x93, 0x1a };
378 u8 unk2[] = { 0xb5, 0x7a };
380 mt352_write(fe, config, ARRAY_SIZE(config));
381 mt352_write(fe, clock, ARRAY_SIZE(clock));
382 mt352_write(fe, reset, ARRAY_SIZE(reset));
383 mt352_write(fe, adc_ctl, ARRAY_SIZE(adc_ctl));
384 mt352_write(fe, agc, ARRAY_SIZE(agc));
385 mt352_write(fe, sec_agc, ARRAY_SIZE(sec_agc));
386 mt352_write(fe, unk1, ARRAY_SIZE(unk1));
387 mt352_write(fe, unk2, ARRAY_SIZE(unk2));
389 deb("Demod init!\n");
391 return 0;
394 static struct mt352_config m920x_mt352_config = {
395 .demod_address = 0x0f,
396 .no_tuner = 1,
397 .demod_init = m920x_mt352_demod_init,
400 static struct tda1004x_config m920x_tda10046_08_config = {
401 .demod_address = 0x08,
402 .invert = 0,
403 .invert_oclk = 0,
404 .ts_mode = TDA10046_TS_SERIAL,
405 .xtal_freq = TDA10046_XTAL_16M,
406 .if_freq = TDA10046_FREQ_045,
407 .agc_config = TDA10046_AGC_TDA827X,
408 .gpio_config = TDA10046_GPTRI,
409 .request_firmware = NULL,
412 static struct tda1004x_config m920x_tda10046_0b_config = {
413 .demod_address = 0x0b,
414 .invert = 0,
415 .invert_oclk = 0,
416 .ts_mode = TDA10046_TS_SERIAL,
417 .xtal_freq = TDA10046_XTAL_16M,
418 .if_freq = TDA10046_FREQ_045,
419 .agc_config = TDA10046_AGC_TDA827X,
420 .gpio_config = TDA10046_GPTRI,
421 .request_firmware = NULL, /* uses firmware EEPROM */
424 /* tuner configurations */
425 static struct qt1010_config m920x_qt1010_config = {
426 .i2c_address = 0x62
429 /* Callbacks for DVB USB */
430 static int m920x_mt352_frontend_attach(struct dvb_usb_adapter *adap)
432 deb("%s\n",__FUNCTION__);
434 if ((adap->fe = dvb_attach(mt352_attach,
435 &m920x_mt352_config,
436 &adap->dev->i2c_adap)) == NULL)
437 return -EIO;
439 return 0;
442 static int m920x_tda10046_08_frontend_attach(struct dvb_usb_adapter *adap)
444 deb("%s\n",__FUNCTION__);
446 if ((adap->fe = dvb_attach(tda10046_attach,
447 &m920x_tda10046_08_config,
448 &adap->dev->i2c_adap)) == NULL)
449 return -EIO;
451 return 0;
454 static int m920x_tda10046_0b_frontend_attach(struct dvb_usb_adapter *adap)
456 deb("%s\n",__FUNCTION__);
458 if ((adap->fe = dvb_attach(tda10046_attach,
459 &m920x_tda10046_0b_config,
460 &adap->dev->i2c_adap)) == NULL)
461 return -EIO;
463 return 0;
466 static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter *adap)
468 deb("%s\n",__FUNCTION__);
470 if (dvb_attach(qt1010_attach, adap->fe, &adap->dev->i2c_adap, &m920x_qt1010_config) == NULL)
471 return -ENODEV;
473 return 0;
476 static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter *adap)
478 deb("%s\n",__FUNCTION__);
480 if (dvb_attach(tda827x_attach, adap->fe, 0x60, &adap->dev->i2c_adap, NULL) == NULL)
481 return -ENODEV;
483 return 0;
486 static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap)
488 deb("%s\n",__FUNCTION__);
490 if (dvb_attach(tda827x_attach, adap->fe, 0x61, &adap->dev->i2c_adap, NULL) == NULL)
491 return -ENODEV;
493 return 0;
496 /* device-specific initialization */
497 static struct m920x_inits megasky_rc_init [] = {
498 { M9206_RC_INIT2, 0xa8 },
499 { M9206_RC_INIT1, 0x51 },
500 { } /* terminating entry */
503 static struct m920x_inits tvwalkertwin_rc_init [] = {
504 { M9206_RC_INIT2, 0x00 },
505 { M9206_RC_INIT1, 0xef },
506 { 0xff28, 0x00 },
507 { 0xff23, 0x00 },
508 { 0xff21, 0x30 },
509 { } /* terminating entry */
512 /* ir keymaps */
513 static struct dvb_usb_rc_key megasky_rc_keys [] = {
514 { 0x0, 0x12, KEY_POWER },
515 { 0x0, 0x1e, KEY_CYCLEWINDOWS }, /* min/max */
516 { 0x0, 0x02, KEY_CHANNELUP },
517 { 0x0, 0x05, KEY_CHANNELDOWN },
518 { 0x0, 0x03, KEY_VOLUMEUP },
519 { 0x0, 0x06, KEY_VOLUMEDOWN },
520 { 0x0, 0x04, KEY_MUTE },
521 { 0x0, 0x07, KEY_OK }, /* TS */
522 { 0x0, 0x08, KEY_STOP },
523 { 0x0, 0x09, KEY_MENU }, /* swap */
524 { 0x0, 0x0a, KEY_REWIND },
525 { 0x0, 0x1b, KEY_PAUSE },
526 { 0x0, 0x1f, KEY_FASTFORWARD },
527 { 0x0, 0x0c, KEY_RECORD },
528 { 0x0, 0x0d, KEY_CAMERA }, /* screenshot */
529 { 0x0, 0x0e, KEY_COFFEE }, /* "MTS" */
532 static struct dvb_usb_rc_key tvwalkertwin_rc_keys [] = {
533 { 0x0, 0x01, KEY_ZOOM }, /* Full Screen */
534 { 0x0, 0x02, KEY_CAMERA }, /* snapshot */
535 { 0x0, 0x03, KEY_MUTE },
536 { 0x0, 0x04, KEY_REWIND },
537 { 0x0, 0x05, KEY_PLAYPAUSE }, /* Play/Pause */
538 { 0x0, 0x06, KEY_FASTFORWARD },
539 { 0x0, 0x07, KEY_RECORD },
540 { 0x0, 0x08, KEY_STOP },
541 { 0x0, 0x09, KEY_TIME }, /* Timeshift */
542 { 0x0, 0x0c, KEY_COFFEE }, /* Recall */
543 { 0x0, 0x0e, KEY_CHANNELUP },
544 { 0x0, 0x12, KEY_POWER },
545 { 0x0, 0x15, KEY_MENU }, /* source */
546 { 0x0, 0x18, KEY_CYCLEWINDOWS }, /* TWIN PIP */
547 { 0x0, 0x1a, KEY_CHANNELDOWN },
548 { 0x0, 0x1b, KEY_VOLUMEDOWN },
549 { 0x0, 0x1e, KEY_VOLUMEUP },
552 /* DVB USB Driver stuff */
553 static struct dvb_usb_device_properties megasky_properties;
554 static struct dvb_usb_device_properties digivox_mini_ii_properties;
555 static struct dvb_usb_device_properties tvwalkertwin_properties;
556 static struct dvb_usb_device_properties dposh_properties;
558 static int m920x_probe(struct usb_interface *intf,
559 const struct usb_device_id *id)
561 struct dvb_usb_device *d;
562 struct usb_host_interface *alt;
563 int ret;
564 struct m920x_inits *rc_init_seq = NULL;
565 int bInterfaceNumber = intf->cur_altsetting->desc.bInterfaceNumber;
567 deb("Probing for m920x device at interface %d\n", bInterfaceNumber);
569 if (bInterfaceNumber == 0) {
570 /* Single-tuner device, or first interface on
571 * multi-tuner device
574 if ((ret = dvb_usb_device_init(intf, &megasky_properties,
575 THIS_MODULE, &d)) == 0) {
576 rc_init_seq = megasky_rc_init;
577 goto found;
580 if ((ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties,
581 THIS_MODULE, &d)) == 0) {
582 /* No remote control, so no rc_init_seq */
583 goto found;
586 /* This configures both tuners on the TV Walker Twin */
587 if ((ret = dvb_usb_device_init(intf, &tvwalkertwin_properties,
588 THIS_MODULE, &d)) == 0) {
589 rc_init_seq = tvwalkertwin_rc_init;
590 goto found;
593 if ((ret = dvb_usb_device_init(intf, &dposh_properties,
594 THIS_MODULE, &d)) == 0) {
595 /* Remote controller not supported yet. */
596 goto found;
599 return ret;
600 } else {
601 /* Another interface on a multi-tuner device */
603 /* The LifeView TV Walker Twin gets here, but struct
604 * tvwalkertwin_properties already configured both
605 * tuners, so there is nothing for us to do here
608 return -ENODEV;
611 found:
612 alt = usb_altnum_to_altsetting(intf, 1);
613 if (alt == NULL) {
614 deb("No alt found!\n");
615 return -ENODEV;
618 ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber,
619 alt->desc.bAlternateSetting);
620 if (ret < 0)
621 return ret;
623 if ((ret = m920x_init(d, rc_init_seq)) != 0)
624 return ret;
626 return ret;
629 static struct usb_device_id m920x_table [] = {
630 { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580) },
631 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,
632 USB_PID_MSI_DIGI_VOX_MINI_II) },
633 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,
634 USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD) },
635 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,
636 USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM) },
637 { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_COLD) },
638 { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_WARM) },
639 { } /* Terminating entry */
641 MODULE_DEVICE_TABLE (usb, m920x_table);
643 static struct dvb_usb_device_properties megasky_properties = {
644 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
646 .usb_ctrl = DEVICE_SPECIFIC,
647 .firmware = "dvb-usb-megasky-02.fw",
648 .download_firmware = m920x_firmware_download,
650 .rc_interval = 100,
651 .rc_key_map = megasky_rc_keys,
652 .rc_key_map_size = ARRAY_SIZE(megasky_rc_keys),
653 .rc_query = m920x_rc_query,
655 .size_of_priv = sizeof(struct m920x_state),
657 .identify_state = m920x_identify_state,
658 .num_adapters = 1,
659 .adapter = {{
660 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
661 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
663 .pid_filter_count = 8,
664 .pid_filter = m920x_pid_filter,
665 .pid_filter_ctrl = m920x_pid_filter_ctrl,
667 .frontend_attach = m920x_mt352_frontend_attach,
668 .tuner_attach = m920x_qt1010_tuner_attach,
670 .stream = {
671 .type = USB_BULK,
672 .count = 8,
673 .endpoint = 0x81,
674 .u = {
675 .bulk = {
676 .buffersize = 512,
681 .i2c_algo = &m920x_i2c_algo,
683 .num_device_descs = 1,
684 .devices = {
685 { "MSI Mega Sky 580 DVB-T USB2.0",
686 { &m920x_table[0], NULL },
687 { NULL },
692 static struct dvb_usb_device_properties digivox_mini_ii_properties = {
693 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
695 .usb_ctrl = DEVICE_SPECIFIC,
696 .firmware = "dvb-usb-digivox-02.fw",
697 .download_firmware = m920x_firmware_download,
699 .size_of_priv = sizeof(struct m920x_state),
701 .identify_state = m920x_identify_state,
702 .num_adapters = 1,
703 .adapter = {{
704 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
705 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
707 .pid_filter_count = 8,
708 .pid_filter = m920x_pid_filter,
709 .pid_filter_ctrl = m920x_pid_filter_ctrl,
711 .frontend_attach = m920x_tda10046_08_frontend_attach,
712 .tuner_attach = m920x_tda8275_60_tuner_attach,
714 .stream = {
715 .type = USB_BULK,
716 .count = 8,
717 .endpoint = 0x81,
718 .u = {
719 .bulk = {
720 .buffersize = 0x4000,
725 .i2c_algo = &m920x_i2c_algo,
727 .num_device_descs = 1,
728 .devices = {
729 { "MSI DIGI VOX mini II DVB-T USB2.0",
730 { &m920x_table[1], NULL },
731 { NULL },
736 /* LifeView TV Walker Twin support by Nick Andrew <nick@nick-andrew.net>
738 * LifeView TV Walker Twin has 1 x M9206, 2 x TDA10046, 2 x TDA8275A
739 * TDA10046 #0 is located at i2c address 0x08
740 * TDA10046 #1 is located at i2c address 0x0b (presently disabled - not yet working)
741 * TDA8275A #0 is located at i2c address 0x60
742 * TDA8275A #1 is located at i2c address 0x61 (presently disabled - not yet working)
744 static struct dvb_usb_device_properties tvwalkertwin_properties = {
745 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
747 .usb_ctrl = DEVICE_SPECIFIC,
748 .firmware = "dvb-usb-tvwalkert.fw",
749 .download_firmware = m920x_firmware_download,
751 .rc_interval = 100,
752 .rc_key_map = tvwalkertwin_rc_keys,
753 .rc_key_map_size = ARRAY_SIZE(tvwalkertwin_rc_keys),
754 .rc_query = m920x_rc_query,
756 .size_of_priv = sizeof(struct m920x_state),
758 .identify_state = m920x_identify_state,
759 .num_adapters = 1,
760 .adapter = {{
761 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
762 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
764 .pid_filter_count = 8,
765 .pid_filter = m920x_pid_filter,
766 .pid_filter_ctrl = m920x_pid_filter_ctrl,
768 .frontend_attach = m920x_tda10046_08_frontend_attach,
769 .tuner_attach = m920x_tda8275_60_tuner_attach,
771 .stream = {
772 .type = USB_BULK,
773 .count = 8,
774 .endpoint = 0x81,
775 .u = {
776 .bulk = {
777 .buffersize = 512,
780 }},{
781 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
782 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
784 .pid_filter_count = 8,
785 .pid_filter = m920x_pid_filter,
786 .pid_filter_ctrl = m920x_pid_filter_ctrl,
788 .frontend_attach = m920x_tda10046_0b_frontend_attach,
789 .tuner_attach = m920x_tda8275_61_tuner_attach,
791 .stream = {
792 .type = USB_BULK,
793 .count = 8,
794 .endpoint = 0x82,
795 .u = {
796 .bulk = {
797 .buffersize = 512,
802 .i2c_algo = &m920x_i2c_algo,
804 .num_device_descs = 1,
805 .devices = {
806 { .name = "LifeView TV Walker Twin DVB-T USB2.0",
807 .cold_ids = { &m920x_table[2], NULL },
808 .warm_ids = { &m920x_table[3], NULL },
813 static struct dvb_usb_device_properties dposh_properties = {
814 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
816 .usb_ctrl = DEVICE_SPECIFIC,
817 .firmware = "dvb-usb-dposh-01.fw",
818 .download_firmware = m920x_firmware_download,
820 .size_of_priv = sizeof(struct m920x_state),
822 .identify_state = m920x_identify_state,
823 .num_adapters = 1,
824 .adapter = {{
825 /* Hardware pid filters don't work with this device/firmware */
827 .frontend_attach = m920x_mt352_frontend_attach,
828 .tuner_attach = m920x_qt1010_tuner_attach,
830 .stream = {
831 .type = USB_BULK,
832 .count = 8,
833 .endpoint = 0x81,
834 .u = {
835 .bulk = {
836 .buffersize = 512,
841 .i2c_algo = &m920x_i2c_algo,
843 .num_device_descs = 1,
844 .devices = {
845 { .name = "Dposh DVB-T USB2.0",
846 .cold_ids = { &m920x_table[4], NULL },
847 .warm_ids = { &m920x_table[5], NULL },
852 static struct usb_driver m920x_driver = {
853 .name = "dvb_usb_m920x",
854 .probe = m920x_probe,
855 .disconnect = dvb_usb_device_exit,
856 .id_table = m920x_table,
859 /* module stuff */
860 static int __init m920x_module_init(void)
862 int ret;
864 if ((ret = usb_register(&m920x_driver))) {
865 err("usb_register failed. Error number %d", ret);
866 return ret;
869 return 0;
872 static void __exit m920x_module_exit(void)
874 /* deregister this driver from the USB subsystem */
875 usb_deregister(&m920x_driver);
878 module_init (m920x_module_init);
879 module_exit (m920x_module_exit);
881 MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>");
882 MODULE_DESCRIPTION("DVB Driver for ULI M920x");
883 MODULE_VERSION("0.1");
884 MODULE_LICENSE("GPL");
887 * Local variables:
888 * c-basic-offset: 8