First Support on Ginger and OMAP TI
[linux-ginger.git] / drivers / media / dvb / dvb-usb / m920x.c
blobef9b7bed13ffe84538b3e47f27d1e07bf8ff26bd
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"
19 #include <asm/unaligned.h>
21 /* debug */
22 static int dvb_usb_m920x_debug;
23 module_param_named(debug,dvb_usb_m920x_debug, int, 0644);
24 MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
26 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
28 static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid);
30 static inline int m920x_read(struct usb_device *udev, u8 request, u16 value,
31 u16 index, void *data, int size)
33 int ret;
35 ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
36 request, USB_TYPE_VENDOR | USB_DIR_IN,
37 value, index, data, size, 2000);
38 if (ret < 0) {
39 printk(KERN_INFO "m920x_read = error: %d\n", ret);
40 return ret;
43 if (ret != size) {
44 deb("m920x_read = no data\n");
45 return -EIO;
48 return 0;
51 static inline int m920x_write(struct usb_device *udev, u8 request,
52 u16 value, u16 index)
54 int ret;
56 ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
57 request, USB_TYPE_VENDOR | USB_DIR_OUT,
58 value, index, NULL, 0, 2000);
60 return ret;
63 static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq)
65 int ret = 0, i, epi, flags = 0;
66 int adap_enabled[M9206_MAX_ADAPTERS] = { 0 };
68 /* Remote controller init. */
69 if (d->props.rc_query) {
70 deb("Initialising remote control\n");
71 while (rc_seq->address) {
72 if ((ret = m920x_write(d->udev, M9206_CORE,
73 rc_seq->data,
74 rc_seq->address)) != 0) {
75 deb("Initialising remote control failed\n");
76 return ret;
79 rc_seq++;
82 deb("Initialising remote control success\n");
85 for (i = 0; i < d->props.num_adapters; i++)
86 flags |= d->adapter[i].props.caps;
88 /* Some devices(Dposh) might crash if we attempt touch at all. */
89 if (flags & DVB_USB_ADAP_HAS_PID_FILTER) {
90 for (i = 0; i < d->props.num_adapters; i++) {
91 epi = d->adapter[i].props.stream.endpoint - 0x81;
93 if (epi < 0 || epi >= M9206_MAX_ADAPTERS) {
94 printk(KERN_INFO "m920x: Unexpected adapter endpoint!\n");
95 return -EINVAL;
98 adap_enabled[epi] = 1;
101 for (i = 0; i < M9206_MAX_ADAPTERS; i++) {
102 if (adap_enabled[i])
103 continue;
105 if ((ret = m920x_set_filter(d, 0x81 + i, 0, 0x0)) != 0)
106 return ret;
108 if ((ret = m920x_set_filter(d, 0x81 + i, 0, 0x02f5)) != 0)
109 return ret;
113 return ret;
116 static int m920x_init_ep(struct usb_interface *intf)
118 struct usb_device *udev = interface_to_usbdev(intf);
119 struct usb_host_interface *alt;
121 if ((alt = usb_altnum_to_altsetting(intf, 1)) == NULL) {
122 deb("No alt found!\n");
123 return -ENODEV;
126 return usb_set_interface(udev, alt->desc.bInterfaceNumber,
127 alt->desc.bAlternateSetting);
130 static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
132 struct m920x_state *m = d->priv;
133 int i, ret = 0;
134 u8 rc_state[2];
136 if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0)
137 goto unlock;
139 if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0)
140 goto unlock;
142 for (i = 0; i < d->props.rc_key_map_size; i++)
143 if (rc5_data(&d->props.rc_key_map[i]) == rc_state[1]) {
144 *event = d->props.rc_key_map[i].event;
146 switch(rc_state[0]) {
147 case 0x80:
148 *state = REMOTE_NO_KEY_PRESSED;
149 goto unlock;
151 case 0x88: /* framing error or "invalid code" */
152 case 0x99:
153 case 0xc0:
154 case 0xd8:
155 *state = REMOTE_NO_KEY_PRESSED;
156 m->rep_count = 0;
157 goto unlock;
159 case 0x93:
160 case 0x92:
161 m->rep_count = 0;
162 *state = REMOTE_KEY_PRESSED;
163 goto unlock;
165 case 0x91:
166 /* prevent immediate auto-repeat */
167 if (++m->rep_count > 2)
168 *state = REMOTE_KEY_REPEAT;
169 else
170 *state = REMOTE_NO_KEY_PRESSED;
171 goto unlock;
173 default:
174 deb("Unexpected rc state %02x\n", rc_state[0]);
175 *state = REMOTE_NO_KEY_PRESSED;
176 goto unlock;
180 if (rc_state[1] != 0)
181 deb("Unknown rc key %02x\n", rc_state[1]);
183 *state = REMOTE_NO_KEY_PRESSED;
185 unlock:
187 return ret;
190 /* I2C */
191 static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
193 struct dvb_usb_device *d = i2c_get_adapdata(adap);
194 int i, j;
195 int ret = 0;
197 if (!num)
198 return -EINVAL;
200 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
201 return -EAGAIN;
203 for (i = 0; i < num; i++) {
204 if (msg[i].flags & (I2C_M_NO_RD_ACK | I2C_M_IGNORE_NAK | I2C_M_TEN) || msg[i].len == 0) {
205 /* For a 0 byte message, I think sending the address
206 * to index 0x80|0x40 would be the correct thing to
207 * do. However, zero byte messages are only used for
208 * probing, and since we don't know how to get the
209 * slave's ack, we can't probe. */
210 ret = -ENOTSUPP;
211 goto unlock;
213 /* Send START & address/RW bit */
214 if (!(msg[i].flags & I2C_M_NOSTART)) {
215 if ((ret = m920x_write(d->udev, M9206_I2C,
216 (msg[i].addr << 1) |
217 (msg[i].flags & I2C_M_RD ? 0x01 : 0), 0x80)) != 0)
218 goto unlock;
219 /* Should check for ack here, if we knew how. */
221 if (msg[i].flags & I2C_M_RD) {
222 for (j = 0; j < msg[i].len; j++) {
223 /* Last byte of transaction?
224 * Send STOP, otherwise send ACK. */
225 int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x01;
227 if ((ret = m920x_read(d->udev, M9206_I2C, 0x0,
228 0x20 | stop,
229 &msg[i].buf[j], 1)) != 0)
230 goto unlock;
232 } else {
233 for (j = 0; j < msg[i].len; j++) {
234 /* Last byte of transaction? Then send STOP. */
235 int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x00;
237 if ((ret = m920x_write(d->udev, M9206_I2C, msg[i].buf[j], stop)) != 0)
238 goto unlock;
239 /* Should check for ack here too. */
243 ret = num;
245 unlock:
246 mutex_unlock(&d->i2c_mutex);
248 return ret;
251 static u32 m920x_i2c_func(struct i2c_adapter *adapter)
253 return I2C_FUNC_I2C;
256 static struct i2c_algorithm m920x_i2c_algo = {
257 .master_xfer = m920x_i2c_xfer,
258 .functionality = m920x_i2c_func,
261 /* pid filter */
262 static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid)
264 int ret = 0;
266 if (pid >= 0x8000)
267 return -EINVAL;
269 pid |= 0x8000;
271 if ((ret = m920x_write(d->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0)
272 return ret;
274 if ((ret = m920x_write(d->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0)
275 return ret;
277 return ret;
280 static int m920x_update_filters(struct dvb_usb_adapter *adap)
282 struct m920x_state *m = adap->dev->priv;
283 int enabled = m->filtering_enabled[adap->id];
284 int i, ret = 0, filter = 0;
285 int ep = adap->props.stream.endpoint;
287 for (i = 0; i < M9206_MAX_FILTERS; i++)
288 if (m->filters[adap->id][i] == 8192)
289 enabled = 0;
291 /* Disable all filters */
292 if ((ret = m920x_set_filter(adap->dev, ep, 1, enabled)) != 0)
293 return ret;
295 for (i = 0; i < M9206_MAX_FILTERS; i++)
296 if ((ret = m920x_set_filter(adap->dev, ep, i + 2, 0)) != 0)
297 return ret;
299 /* Set */
300 if (enabled) {
301 for (i = 0; i < M9206_MAX_FILTERS; i++) {
302 if (m->filters[adap->id][i] == 0)
303 continue;
305 if ((ret = m920x_set_filter(adap->dev, ep, filter + 2, m->filters[adap->id][i])) != 0)
306 return ret;
308 filter++;
312 return ret;
315 static int m920x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
317 struct m920x_state *m = adap->dev->priv;
319 m->filtering_enabled[adap->id] = onoff ? 1 : 0;
321 return m920x_update_filters(adap);
324 static int m920x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff)
326 struct m920x_state *m = adap->dev->priv;
328 m->filters[adap->id][index] = onoff ? pid : 0;
330 return m920x_update_filters(adap);
333 static int m920x_firmware_download(struct usb_device *udev, const struct firmware *fw)
335 u16 value, index, size;
336 u8 read[4], *buff;
337 int i, pass, ret = 0;
339 buff = kmalloc(65536, GFP_KERNEL);
340 if (buff == NULL)
341 return -ENOMEM;
343 if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0)
344 goto done;
345 deb("%x %x %x %x\n", read[0], read[1], read[2], read[3]);
347 if ((ret = m920x_read(udev, M9206_FW, 0x0, 0x0, read, 1)) != 0)
348 goto done;
349 deb("%x\n", read[0]);
351 for (pass = 0; pass < 2; pass++) {
352 for (i = 0; i + (sizeof(u16) * 3) < fw->size;) {
353 value = get_unaligned_le16(fw->data + i);
354 i += sizeof(u16);
356 index = get_unaligned_le16(fw->data + i);
357 i += sizeof(u16);
359 size = get_unaligned_le16(fw->data + i);
360 i += sizeof(u16);
362 if (pass == 1) {
363 /* Will stall if using fw->data ... */
364 memcpy(buff, fw->data + i, size);
366 ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0),
367 M9206_FW,
368 USB_TYPE_VENDOR | USB_DIR_OUT,
369 value, index, buff, size, 20);
370 if (ret != size) {
371 deb("error while uploading fw!\n");
372 ret = -EIO;
373 goto done;
375 msleep(3);
377 i += size;
379 if (i != fw->size) {
380 deb("bad firmware file!\n");
381 ret = -EINVAL;
382 goto done;
386 msleep(36);
388 /* m920x will disconnect itself from the bus after this. */
389 (void) m920x_write(udev, M9206_CORE, 0x01, M9206_FW_GO);
390 deb("firmware uploaded!\n");
392 done:
393 kfree(buff);
395 return ret;
398 /* Callbacks for DVB USB */
399 static int m920x_identify_state(struct usb_device *udev,
400 struct dvb_usb_device_properties *props,
401 struct dvb_usb_device_description **desc,
402 int *cold)
404 struct usb_host_interface *alt;
406 alt = usb_altnum_to_altsetting(usb_ifnum_to_if(udev, 0), 1);
407 *cold = (alt == NULL) ? 1 : 0;
409 return 0;
412 /* demod configurations */
413 static int m920x_mt352_demod_init(struct dvb_frontend *fe)
415 int ret;
416 u8 config[] = { CONFIG, 0x3d };
417 u8 clock[] = { CLOCK_CTL, 0x30 };
418 u8 reset[] = { RESET, 0x80 };
419 u8 adc_ctl[] = { ADC_CTL_1, 0x40 };
420 u8 agc[] = { AGC_TARGET, 0x1c, 0x20 };
421 u8 sec_agc[] = { 0x69, 0x00, 0xff, 0xff, 0x40, 0xff, 0x00, 0x40, 0x40 };
422 u8 unk1[] = { 0x93, 0x1a };
423 u8 unk2[] = { 0xb5, 0x7a };
425 deb("Demod init!\n");
427 if ((ret = mt352_write(fe, config, ARRAY_SIZE(config))) != 0)
428 return ret;
429 if ((ret = mt352_write(fe, clock, ARRAY_SIZE(clock))) != 0)
430 return ret;
431 if ((ret = mt352_write(fe, reset, ARRAY_SIZE(reset))) != 0)
432 return ret;
433 if ((ret = mt352_write(fe, adc_ctl, ARRAY_SIZE(adc_ctl))) != 0)
434 return ret;
435 if ((ret = mt352_write(fe, agc, ARRAY_SIZE(agc))) != 0)
436 return ret;
437 if ((ret = mt352_write(fe, sec_agc, ARRAY_SIZE(sec_agc))) != 0)
438 return ret;
439 if ((ret = mt352_write(fe, unk1, ARRAY_SIZE(unk1))) != 0)
440 return ret;
441 if ((ret = mt352_write(fe, unk2, ARRAY_SIZE(unk2))) != 0)
442 return ret;
444 return 0;
447 static struct mt352_config m920x_mt352_config = {
448 .demod_address = 0x0f,
449 .no_tuner = 1,
450 .demod_init = m920x_mt352_demod_init,
453 static struct tda1004x_config m920x_tda10046_08_config = {
454 .demod_address = 0x08,
455 .invert = 0,
456 .invert_oclk = 0,
457 .ts_mode = TDA10046_TS_SERIAL,
458 .xtal_freq = TDA10046_XTAL_16M,
459 .if_freq = TDA10046_FREQ_045,
460 .agc_config = TDA10046_AGC_TDA827X,
461 .gpio_config = TDA10046_GPTRI,
462 .request_firmware = NULL,
465 static struct tda1004x_config m920x_tda10046_0b_config = {
466 .demod_address = 0x0b,
467 .invert = 0,
468 .invert_oclk = 0,
469 .ts_mode = TDA10046_TS_SERIAL,
470 .xtal_freq = TDA10046_XTAL_16M,
471 .if_freq = TDA10046_FREQ_045,
472 .agc_config = TDA10046_AGC_TDA827X,
473 .gpio_config = TDA10046_GPTRI,
474 .request_firmware = NULL, /* uses firmware EEPROM */
477 /* tuner configurations */
478 static struct qt1010_config m920x_qt1010_config = {
479 .i2c_address = 0x62
482 /* Callbacks for DVB USB */
483 static int m920x_mt352_frontend_attach(struct dvb_usb_adapter *adap)
485 deb("%s\n",__func__);
487 if ((adap->fe = dvb_attach(mt352_attach,
488 &m920x_mt352_config,
489 &adap->dev->i2c_adap)) == NULL)
490 return -EIO;
492 return 0;
495 static int m920x_tda10046_08_frontend_attach(struct dvb_usb_adapter *adap)
497 deb("%s\n",__func__);
499 if ((adap->fe = dvb_attach(tda10046_attach,
500 &m920x_tda10046_08_config,
501 &adap->dev->i2c_adap)) == NULL)
502 return -EIO;
504 return 0;
507 static int m920x_tda10046_0b_frontend_attach(struct dvb_usb_adapter *adap)
509 deb("%s\n",__func__);
511 if ((adap->fe = dvb_attach(tda10046_attach,
512 &m920x_tda10046_0b_config,
513 &adap->dev->i2c_adap)) == NULL)
514 return -EIO;
516 return 0;
519 static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter *adap)
521 deb("%s\n",__func__);
523 if (dvb_attach(qt1010_attach, adap->fe, &adap->dev->i2c_adap, &m920x_qt1010_config) == NULL)
524 return -ENODEV;
526 return 0;
529 static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter *adap)
531 deb("%s\n",__func__);
533 if (dvb_attach(tda827x_attach, adap->fe, 0x60, &adap->dev->i2c_adap, NULL) == NULL)
534 return -ENODEV;
536 return 0;
539 static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap)
541 deb("%s\n",__func__);
543 if (dvb_attach(tda827x_attach, adap->fe, 0x61, &adap->dev->i2c_adap, NULL) == NULL)
544 return -ENODEV;
546 return 0;
549 /* device-specific initialization */
550 static struct m920x_inits megasky_rc_init [] = {
551 { M9206_RC_INIT2, 0xa8 },
552 { M9206_RC_INIT1, 0x51 },
553 { } /* terminating entry */
556 static struct m920x_inits tvwalkertwin_rc_init [] = {
557 { M9206_RC_INIT2, 0x00 },
558 { M9206_RC_INIT1, 0xef },
559 { 0xff28, 0x00 },
560 { 0xff23, 0x00 },
561 { 0xff21, 0x30 },
562 { } /* terminating entry */
565 /* ir keymaps */
566 static struct dvb_usb_rc_key megasky_rc_keys [] = {
567 { 0x0012, KEY_POWER },
568 { 0x001e, KEY_CYCLEWINDOWS }, /* min/max */
569 { 0x0002, KEY_CHANNELUP },
570 { 0x0005, KEY_CHANNELDOWN },
571 { 0x0003, KEY_VOLUMEUP },
572 { 0x0006, KEY_VOLUMEDOWN },
573 { 0x0004, KEY_MUTE },
574 { 0x0007, KEY_OK }, /* TS */
575 { 0x0008, KEY_STOP },
576 { 0x0009, KEY_MENU }, /* swap */
577 { 0x000a, KEY_REWIND },
578 { 0x001b, KEY_PAUSE },
579 { 0x001f, KEY_FASTFORWARD },
580 { 0x000c, KEY_RECORD },
581 { 0x000d, KEY_CAMERA }, /* screenshot */
582 { 0x000e, KEY_COFFEE }, /* "MTS" */
585 static struct dvb_usb_rc_key tvwalkertwin_rc_keys [] = {
586 { 0x0001, KEY_ZOOM }, /* Full Screen */
587 { 0x0002, KEY_CAMERA }, /* snapshot */
588 { 0x0003, KEY_MUTE },
589 { 0x0004, KEY_REWIND },
590 { 0x0005, KEY_PLAYPAUSE }, /* Play/Pause */
591 { 0x0006, KEY_FASTFORWARD },
592 { 0x0007, KEY_RECORD },
593 { 0x0008, KEY_STOP },
594 { 0x0009, KEY_TIME }, /* Timeshift */
595 { 0x000c, KEY_COFFEE }, /* Recall */
596 { 0x000e, KEY_CHANNELUP },
597 { 0x0012, KEY_POWER },
598 { 0x0015, KEY_MENU }, /* source */
599 { 0x0018, KEY_CYCLEWINDOWS }, /* TWIN PIP */
600 { 0x001a, KEY_CHANNELDOWN },
601 { 0x001b, KEY_VOLUMEDOWN },
602 { 0x001e, KEY_VOLUMEUP },
605 /* DVB USB Driver stuff */
606 static struct dvb_usb_device_properties megasky_properties;
607 static struct dvb_usb_device_properties digivox_mini_ii_properties;
608 static struct dvb_usb_device_properties tvwalkertwin_properties;
609 static struct dvb_usb_device_properties dposh_properties;
611 static int m920x_probe(struct usb_interface *intf,
612 const struct usb_device_id *id)
614 struct dvb_usb_device *d = NULL;
615 int ret;
616 struct m920x_inits *rc_init_seq = NULL;
617 int bInterfaceNumber = intf->cur_altsetting->desc.bInterfaceNumber;
619 deb("Probing for m920x device at interface %d\n", bInterfaceNumber);
621 if (bInterfaceNumber == 0) {
622 /* Single-tuner device, or first interface on
623 * multi-tuner device
626 ret = dvb_usb_device_init(intf, &megasky_properties,
627 THIS_MODULE, &d, adapter_nr);
628 if (ret == 0) {
629 rc_init_seq = megasky_rc_init;
630 goto found;
633 ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties,
634 THIS_MODULE, &d, adapter_nr);
635 if (ret == 0) {
636 /* No remote control, so no rc_init_seq */
637 goto found;
640 /* This configures both tuners on the TV Walker Twin */
641 ret = dvb_usb_device_init(intf, &tvwalkertwin_properties,
642 THIS_MODULE, &d, adapter_nr);
643 if (ret == 0) {
644 rc_init_seq = tvwalkertwin_rc_init;
645 goto found;
648 ret = dvb_usb_device_init(intf, &dposh_properties,
649 THIS_MODULE, &d, adapter_nr);
650 if (ret == 0) {
651 /* Remote controller not supported yet. */
652 goto found;
655 return ret;
656 } else {
657 /* Another interface on a multi-tuner device */
659 /* The LifeView TV Walker Twin gets here, but struct
660 * tvwalkertwin_properties already configured both
661 * tuners, so there is nothing for us to do here
665 found:
666 if ((ret = m920x_init_ep(intf)) < 0)
667 return ret;
669 if (d && (ret = m920x_init(d, rc_init_seq)) != 0)
670 return ret;
672 return ret;
675 static struct usb_device_id m920x_table [] = {
676 { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580) },
677 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,
678 USB_PID_MSI_DIGI_VOX_MINI_II) },
679 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,
680 USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD) },
681 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,
682 USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM) },
683 { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_COLD) },
684 { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_WARM) },
685 { } /* Terminating entry */
687 MODULE_DEVICE_TABLE (usb, m920x_table);
689 static struct dvb_usb_device_properties megasky_properties = {
690 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
692 .usb_ctrl = DEVICE_SPECIFIC,
693 .firmware = "dvb-usb-megasky-02.fw",
694 .download_firmware = m920x_firmware_download,
696 .rc_interval = 100,
697 .rc_key_map = megasky_rc_keys,
698 .rc_key_map_size = ARRAY_SIZE(megasky_rc_keys),
699 .rc_query = m920x_rc_query,
701 .size_of_priv = sizeof(struct m920x_state),
703 .identify_state = m920x_identify_state,
704 .num_adapters = 1,
705 .adapter = {{
706 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
707 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
709 .pid_filter_count = 8,
710 .pid_filter = m920x_pid_filter,
711 .pid_filter_ctrl = m920x_pid_filter_ctrl,
713 .frontend_attach = m920x_mt352_frontend_attach,
714 .tuner_attach = m920x_qt1010_tuner_attach,
716 .stream = {
717 .type = USB_BULK,
718 .count = 8,
719 .endpoint = 0x81,
720 .u = {
721 .bulk = {
722 .buffersize = 512,
727 .i2c_algo = &m920x_i2c_algo,
729 .num_device_descs = 1,
730 .devices = {
731 { "MSI Mega Sky 580 DVB-T USB2.0",
732 { &m920x_table[0], NULL },
733 { NULL },
738 static struct dvb_usb_device_properties digivox_mini_ii_properties = {
739 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
741 .usb_ctrl = DEVICE_SPECIFIC,
742 .firmware = "dvb-usb-digivox-02.fw",
743 .download_firmware = m920x_firmware_download,
745 .size_of_priv = sizeof(struct m920x_state),
747 .identify_state = m920x_identify_state,
748 .num_adapters = 1,
749 .adapter = {{
750 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
751 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
753 .pid_filter_count = 8,
754 .pid_filter = m920x_pid_filter,
755 .pid_filter_ctrl = m920x_pid_filter_ctrl,
757 .frontend_attach = m920x_tda10046_08_frontend_attach,
758 .tuner_attach = m920x_tda8275_60_tuner_attach,
760 .stream = {
761 .type = USB_BULK,
762 .count = 8,
763 .endpoint = 0x81,
764 .u = {
765 .bulk = {
766 .buffersize = 0x4000,
771 .i2c_algo = &m920x_i2c_algo,
773 .num_device_descs = 1,
774 .devices = {
775 { "MSI DIGI VOX mini II DVB-T USB2.0",
776 { &m920x_table[1], NULL },
777 { NULL },
782 /* LifeView TV Walker Twin support by Nick Andrew <nick@nick-andrew.net>
784 * LifeView TV Walker Twin has 1 x M9206, 2 x TDA10046, 2 x TDA8275A
785 * TDA10046 #0 is located at i2c address 0x08
786 * TDA10046 #1 is located at i2c address 0x0b
787 * TDA8275A #0 is located at i2c address 0x60
788 * TDA8275A #1 is located at i2c address 0x61
790 static struct dvb_usb_device_properties tvwalkertwin_properties = {
791 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
793 .usb_ctrl = DEVICE_SPECIFIC,
794 .firmware = "dvb-usb-tvwalkert.fw",
795 .download_firmware = m920x_firmware_download,
797 .rc_interval = 100,
798 .rc_key_map = tvwalkertwin_rc_keys,
799 .rc_key_map_size = ARRAY_SIZE(tvwalkertwin_rc_keys),
800 .rc_query = m920x_rc_query,
802 .size_of_priv = sizeof(struct m920x_state),
804 .identify_state = m920x_identify_state,
805 .num_adapters = 2,
806 .adapter = {{
807 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
808 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
810 .pid_filter_count = 8,
811 .pid_filter = m920x_pid_filter,
812 .pid_filter_ctrl = m920x_pid_filter_ctrl,
814 .frontend_attach = m920x_tda10046_08_frontend_attach,
815 .tuner_attach = m920x_tda8275_60_tuner_attach,
817 .stream = {
818 .type = USB_BULK,
819 .count = 8,
820 .endpoint = 0x81,
821 .u = {
822 .bulk = {
823 .buffersize = 512,
826 }},{
827 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
828 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
830 .pid_filter_count = 8,
831 .pid_filter = m920x_pid_filter,
832 .pid_filter_ctrl = m920x_pid_filter_ctrl,
834 .frontend_attach = m920x_tda10046_0b_frontend_attach,
835 .tuner_attach = m920x_tda8275_61_tuner_attach,
837 .stream = {
838 .type = USB_BULK,
839 .count = 8,
840 .endpoint = 0x82,
841 .u = {
842 .bulk = {
843 .buffersize = 512,
848 .i2c_algo = &m920x_i2c_algo,
850 .num_device_descs = 1,
851 .devices = {
852 { .name = "LifeView TV Walker Twin DVB-T USB2.0",
853 .cold_ids = { &m920x_table[2], NULL },
854 .warm_ids = { &m920x_table[3], NULL },
859 static struct dvb_usb_device_properties dposh_properties = {
860 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
862 .usb_ctrl = DEVICE_SPECIFIC,
863 .firmware = "dvb-usb-dposh-01.fw",
864 .download_firmware = m920x_firmware_download,
866 .size_of_priv = sizeof(struct m920x_state),
868 .identify_state = m920x_identify_state,
869 .num_adapters = 1,
870 .adapter = {{
871 /* Hardware pid filters don't work with this device/firmware */
873 .frontend_attach = m920x_mt352_frontend_attach,
874 .tuner_attach = m920x_qt1010_tuner_attach,
876 .stream = {
877 .type = USB_BULK,
878 .count = 8,
879 .endpoint = 0x81,
880 .u = {
881 .bulk = {
882 .buffersize = 512,
887 .i2c_algo = &m920x_i2c_algo,
889 .num_device_descs = 1,
890 .devices = {
891 { .name = "Dposh DVB-T USB2.0",
892 .cold_ids = { &m920x_table[4], NULL },
893 .warm_ids = { &m920x_table[5], NULL },
898 static struct usb_driver m920x_driver = {
899 .name = "dvb_usb_m920x",
900 .probe = m920x_probe,
901 .disconnect = dvb_usb_device_exit,
902 .id_table = m920x_table,
905 /* module stuff */
906 static int __init m920x_module_init(void)
908 int ret;
910 if ((ret = usb_register(&m920x_driver))) {
911 err("usb_register failed. Error number %d", ret);
912 return ret;
915 return 0;
918 static void __exit m920x_module_exit(void)
920 /* deregister this driver from the USB subsystem */
921 usb_deregister(&m920x_driver);
924 module_init (m920x_module_init);
925 module_exit (m920x_module_exit);
927 MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>");
928 MODULE_DESCRIPTION("DVB Driver for ULI M920x");
929 MODULE_VERSION("0.1");
930 MODULE_LICENSE("GPL");
933 * Local variables:
934 * c-basic-offset: 8