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/media/dvb-drivers/dvb-usb.rst for more information
15 #include "mt352_priv.h"
21 #include <media/tuner.h>
22 #include "tuner-simple.h"
23 #include <asm/unaligned.h>
26 static int dvb_usb_m920x_debug;
27 module_param_named(debug,dvb_usb_m920x_debug, int, 0644);
28 MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
30 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
32 static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid);
34 static inline int m920x_read(struct usb_device *udev, u8 request, u16 value,
35 u16 index, void *data, int size)
39 ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
40 request, USB_TYPE_VENDOR | USB_DIR_IN,
41 value, index, data, size, 2000);
43 printk(KERN_INFO "m920x_read = error: %d\n", ret);
48 deb("m920x_read = no data\n");
55 static inline int m920x_write(struct usb_device *udev, u8 request,
58 return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), request,
59 USB_TYPE_VENDOR | USB_DIR_OUT, value, index,
63 static inline int m920x_write_seq(struct usb_device *udev, u8 request,
64 struct m920x_inits *seq)
68 ret = m920x_write(udev, request, seq->data, seq->address);
73 } while (seq->address);
78 static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq)
80 int ret, i, epi, flags = 0;
81 int adap_enabled[M9206_MAX_ADAPTERS] = { 0 };
83 /* Remote controller init. */
84 if (d->props.rc.legacy.rc_query || d->props.rc.core.rc_query) {
85 deb("Initialising remote control\n");
86 ret = m920x_write_seq(d->udev, M9206_CORE, rc_seq);
88 deb("Initialising remote control failed\n");
92 deb("Initialising remote control success\n");
95 for (i = 0; i < d->props.num_adapters; i++)
96 flags |= d->adapter[i].props.fe[0].caps;
98 /* Some devices(Dposh) might crash if we attempt touch at all. */
99 if (flags & DVB_USB_ADAP_HAS_PID_FILTER) {
100 for (i = 0; i < d->props.num_adapters; i++) {
101 epi = d->adapter[i].props.fe[0].stream.endpoint - 0x81;
103 if (epi < 0 || epi >= M9206_MAX_ADAPTERS) {
104 printk(KERN_INFO "m920x: Unexpected adapter endpoint!\n");
108 adap_enabled[epi] = 1;
111 for (i = 0; i < M9206_MAX_ADAPTERS; i++) {
115 if ((ret = m920x_set_filter(d, 0x81 + i, 0, 0x0)) != 0)
118 if ((ret = m920x_set_filter(d, 0x81 + i, 0, 0x02f5)) != 0)
126 static int m920x_init_ep(struct usb_interface *intf)
128 struct usb_device *udev = interface_to_usbdev(intf);
129 struct usb_host_interface *alt;
131 if ((alt = usb_altnum_to_altsetting(intf, 1)) == NULL) {
132 deb("No alt found!\n");
136 return usb_set_interface(udev, alt->desc.bInterfaceNumber,
137 alt->desc.bAlternateSetting);
140 static inline void m920x_parse_rc_state(struct dvb_usb_device *d, u8 rc_state,
143 struct m920x_state *m = d->priv;
147 *state = REMOTE_NO_KEY_PRESSED;
150 case 0x88: /* framing error or "invalid code" */
154 *state = REMOTE_NO_KEY_PRESSED;
160 case 0x83: /* pinnacle PCTV310e */
163 *state = REMOTE_KEY_PRESSED;
167 case 0x81: /* pinnacle PCTV310e */
168 /* prevent immediate auto-repeat */
169 if (++m->rep_count > 2)
170 *state = REMOTE_KEY_REPEAT;
172 *state = REMOTE_NO_KEY_PRESSED;
176 deb("Unexpected rc state %02x\n", rc_state);
177 *state = REMOTE_NO_KEY_PRESSED;
182 static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
187 rc_state = kmalloc(2, GFP_KERNEL);
191 ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE,
196 ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY,
201 m920x_parse_rc_state(d, rc_state[0], state);
203 for (i = 0; i < d->props.rc.legacy.rc_map_size; i++)
204 if (rc5_data(&d->props.rc.legacy.rc_map_table[i]) == rc_state[1]) {
205 *event = d->props.rc.legacy.rc_map_table[i].keycode;
209 if (rc_state[1] != 0)
210 deb("Unknown rc key %02x\n", rc_state[1]);
212 *state = REMOTE_NO_KEY_PRESSED;
219 static int m920x_rc_core_query(struct dvb_usb_device *d)
225 rc_state = kmalloc(2, GFP_KERNEL);
229 if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, &rc_state[0], 1)) != 0)
232 if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, &rc_state[1], 1)) != 0)
235 deb("state=0x%02x keycode=0x%02x\n", rc_state[0], rc_state[1]);
237 m920x_parse_rc_state(d, rc_state[0], &state);
239 if (state == REMOTE_NO_KEY_PRESSED)
241 else if (state == REMOTE_KEY_REPEAT)
242 rc_repeat(d->rc_dev);
244 rc_keydown(d->rc_dev, RC_PROTO_UNKNOWN, rc_state[1], 0);
252 static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
254 struct dvb_usb_device *d = i2c_get_adapdata(adap);
258 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
261 for (i = 0; i < num; i++) {
262 if (msg[i].flags & (I2C_M_NO_RD_ACK | I2C_M_IGNORE_NAK | I2C_M_TEN) || msg[i].len == 0) {
263 /* For a 0 byte message, I think sending the address
264 * to index 0x80|0x40 would be the correct thing to
265 * do. However, zero byte messages are only used for
266 * probing, and since we don't know how to get the
267 * slave's ack, we can't probe. */
271 /* Send START & address/RW bit */
272 if (!(msg[i].flags & I2C_M_NOSTART)) {
273 if ((ret = m920x_write(d->udev, M9206_I2C,
275 (msg[i].flags & I2C_M_RD ? 0x01 : 0), 0x80)) != 0)
277 /* Should check for ack here, if we knew how. */
279 if (msg[i].flags & I2C_M_RD) {
280 char *read = kmalloc(1, GFP_KERNEL);
287 for (j = 0; j < msg[i].len; j++) {
288 /* Last byte of transaction?
289 * Send STOP, otherwise send ACK. */
290 int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x01;
292 if ((ret = m920x_read(d->udev, M9206_I2C, 0x0,
296 msg[i].buf[j] = read[0];
301 for (j = 0; j < msg[i].len; j++) {
302 /* Last byte of transaction? Then send STOP. */
303 int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x00;
305 if ((ret = m920x_write(d->udev, M9206_I2C, msg[i].buf[j], stop)) != 0)
307 /* Should check for ack here too. */
314 mutex_unlock(&d->i2c_mutex);
319 static u32 m920x_i2c_func(struct i2c_adapter *adapter)
324 static struct i2c_algorithm m920x_i2c_algo = {
325 .master_xfer = m920x_i2c_xfer,
326 .functionality = m920x_i2c_func,
330 static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid)
339 if ((ret = m920x_write(d->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0)
342 if ((ret = m920x_write(d->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0)
348 static int m920x_update_filters(struct dvb_usb_adapter *adap)
350 struct m920x_state *m = adap->dev->priv;
351 int enabled = m->filtering_enabled[adap->id];
352 int i, ret = 0, filter = 0;
353 int ep = adap->props.fe[0].stream.endpoint;
355 for (i = 0; i < M9206_MAX_FILTERS; i++)
356 if (m->filters[adap->id][i] == 8192)
359 /* Disable all filters */
360 if ((ret = m920x_set_filter(adap->dev, ep, 1, enabled)) != 0)
363 for (i = 0; i < M9206_MAX_FILTERS; i++)
364 if ((ret = m920x_set_filter(adap->dev, ep, i + 2, 0)) != 0)
369 for (i = 0; i < M9206_MAX_FILTERS; i++) {
370 if (m->filters[adap->id][i] == 0)
373 if ((ret = m920x_set_filter(adap->dev, ep, filter + 2, m->filters[adap->id][i])) != 0)
383 static int m920x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
385 struct m920x_state *m = adap->dev->priv;
387 m->filtering_enabled[adap->id] = onoff ? 1 : 0;
389 return m920x_update_filters(adap);
392 static int m920x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff)
394 struct m920x_state *m = adap->dev->priv;
396 m->filters[adap->id][index] = onoff ? pid : 0;
398 return m920x_update_filters(adap);
401 static int m920x_firmware_download(struct usb_device *udev, const struct firmware *fw)
403 u16 value, index, size;
405 int i, pass, ret = 0;
407 buff = kmalloc(65536, GFP_KERNEL);
411 read = kmalloc(4, GFP_KERNEL);
417 if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0)
419 deb("%*ph\n", 4, read);
421 if ((ret = m920x_read(udev, M9206_FW, 0x0, 0x0, read, 1)) != 0)
423 deb("%x\n", read[0]);
425 for (pass = 0; pass < 2; pass++) {
426 for (i = 0; i + (sizeof(u16) * 3) < fw->size;) {
427 value = get_unaligned_le16(fw->data + i);
430 index = get_unaligned_le16(fw->data + i);
433 size = get_unaligned_le16(fw->data + i);
437 /* Will stall if using fw->data ... */
438 memcpy(buff, fw->data + i, size);
440 ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0),
442 USB_TYPE_VENDOR | USB_DIR_OUT,
443 value, index, buff, size, 20);
445 deb("error while uploading fw!\n");
454 deb("bad firmware file!\n");
462 /* m920x will disconnect itself from the bus after this. */
463 (void) m920x_write(udev, M9206_CORE, 0x01, M9206_FW_GO);
464 deb("firmware uploaded!\n");
473 /* Callbacks for DVB USB */
474 static int m920x_identify_state(struct usb_device *udev,
475 struct dvb_usb_device_properties *props,
476 struct dvb_usb_device_description **desc,
479 struct usb_host_interface *alt;
481 alt = usb_altnum_to_altsetting(usb_ifnum_to_if(udev, 0), 1);
482 *cold = (alt == NULL) ? 1 : 0;
487 /* demod configurations */
488 static int m920x_mt352_demod_init(struct dvb_frontend *fe)
491 u8 config[] = { CONFIG, 0x3d };
492 u8 clock[] = { CLOCK_CTL, 0x30 };
493 u8 reset[] = { RESET, 0x80 };
494 u8 adc_ctl[] = { ADC_CTL_1, 0x40 };
495 u8 agc[] = { AGC_TARGET, 0x1c, 0x20 };
496 u8 sec_agc[] = { 0x69, 0x00, 0xff, 0xff, 0x40, 0xff, 0x00, 0x40, 0x40 };
497 u8 unk1[] = { 0x93, 0x1a };
498 u8 unk2[] = { 0xb5, 0x7a };
500 deb("Demod init!\n");
502 if ((ret = mt352_write(fe, config, ARRAY_SIZE(config))) != 0)
504 if ((ret = mt352_write(fe, clock, ARRAY_SIZE(clock))) != 0)
506 if ((ret = mt352_write(fe, reset, ARRAY_SIZE(reset))) != 0)
508 if ((ret = mt352_write(fe, adc_ctl, ARRAY_SIZE(adc_ctl))) != 0)
510 if ((ret = mt352_write(fe, agc, ARRAY_SIZE(agc))) != 0)
512 if ((ret = mt352_write(fe, sec_agc, ARRAY_SIZE(sec_agc))) != 0)
514 if ((ret = mt352_write(fe, unk1, ARRAY_SIZE(unk1))) != 0)
516 if ((ret = mt352_write(fe, unk2, ARRAY_SIZE(unk2))) != 0)
522 static struct mt352_config m920x_mt352_config = {
523 .demod_address = 0x0f,
525 .demod_init = m920x_mt352_demod_init,
528 static struct tda1004x_config m920x_tda10046_08_config = {
529 .demod_address = 0x08,
532 .ts_mode = TDA10046_TS_SERIAL,
533 .xtal_freq = TDA10046_XTAL_16M,
534 .if_freq = TDA10046_FREQ_045,
535 .agc_config = TDA10046_AGC_TDA827X,
536 .gpio_config = TDA10046_GPTRI,
537 .request_firmware = NULL,
540 static struct tda1004x_config m920x_tda10046_0b_config = {
541 .demod_address = 0x0b,
544 .ts_mode = TDA10046_TS_SERIAL,
545 .xtal_freq = TDA10046_XTAL_16M,
546 .if_freq = TDA10046_FREQ_045,
547 .agc_config = TDA10046_AGC_TDA827X,
548 .gpio_config = TDA10046_GPTRI,
549 .request_firmware = NULL, /* uses firmware EEPROM */
552 /* tuner configurations */
553 static struct qt1010_config m920x_qt1010_config = {
557 static struct mt2060_config m920x_mt2060_config = {
558 .i2c_address = 0x60, /* 0xc0 */
563 /* Callbacks for DVB USB */
564 static int m920x_mt352_frontend_attach(struct dvb_usb_adapter *adap)
566 deb("%s\n",__func__);
568 adap->fe_adap[0].fe = dvb_attach(mt352_attach,
570 &adap->dev->i2c_adap);
571 if ((adap->fe_adap[0].fe) == NULL)
577 static int m920x_mt352_frontend_attach_vp7049(struct dvb_usb_adapter *adap)
579 struct m920x_inits vp7049_fe_init_seq[] = {
580 /* XXX without these commands the frontend cannot be detected,
581 * they must be sent BEFORE the frontend is attached */
593 { } /* terminating entry */
597 deb("%s\n", __func__);
599 ret = m920x_write_seq(adap->dev->udev, M9206_CORE, vp7049_fe_init_seq);
601 deb("Initialization of vp7049 frontend failed.");
605 return m920x_mt352_frontend_attach(adap);
608 static int m920x_tda10046_08_frontend_attach(struct dvb_usb_adapter *adap)
610 deb("%s\n",__func__);
612 adap->fe_adap[0].fe = dvb_attach(tda10046_attach,
613 &m920x_tda10046_08_config,
614 &adap->dev->i2c_adap);
615 if ((adap->fe_adap[0].fe) == NULL)
621 static int m920x_tda10046_0b_frontend_attach(struct dvb_usb_adapter *adap)
623 deb("%s\n",__func__);
625 adap->fe_adap[0].fe = dvb_attach(tda10046_attach,
626 &m920x_tda10046_0b_config,
627 &adap->dev->i2c_adap);
628 if ((adap->fe_adap[0].fe) == NULL)
634 static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter *adap)
636 deb("%s\n",__func__);
638 if (dvb_attach(qt1010_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap, &m920x_qt1010_config) == NULL)
644 static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter *adap)
646 deb("%s\n",__func__);
648 if (dvb_attach(tda827x_attach, adap->fe_adap[0].fe, 0x60, &adap->dev->i2c_adap, NULL) == NULL)
654 static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap)
656 deb("%s\n",__func__);
658 if (dvb_attach(tda827x_attach, adap->fe_adap[0].fe, 0x61, &adap->dev->i2c_adap, NULL) == NULL)
664 static int m920x_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap)
666 dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe,
667 &adap->dev->i2c_adap, 0x61,
668 TUNER_PHILIPS_FMD1216ME_MK3);
672 static int m920x_mt2060_tuner_attach(struct dvb_usb_adapter *adap)
674 deb("%s\n", __func__);
676 if (dvb_attach(mt2060_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap,
677 &m920x_mt2060_config, 1220) == NULL)
684 /* device-specific initialization */
685 static struct m920x_inits megasky_rc_init [] = {
686 { M9206_RC_INIT2, 0xa8 },
687 { M9206_RC_INIT1, 0x51 },
688 { } /* terminating entry */
691 static struct m920x_inits tvwalkertwin_rc_init [] = {
692 { M9206_RC_INIT2, 0x00 },
693 { M9206_RC_INIT1, 0xef },
697 { } /* terminating entry */
700 static struct m920x_inits pinnacle310e_init[] = {
701 /* without these the tuner doesn't work */
707 { M9206_RC_INIT1, 0x00 },
708 { M9206_RC_INIT2, 0xff },
709 { } /* terminating entry */
712 static struct m920x_inits vp7049_rc_init[] = {
716 { M9206_RC_INIT2, 0x00 },
717 { M9206_RC_INIT1, 0xff },
718 { } /* terminating entry */
722 static struct rc_map_table rc_map_megasky_table[] = {
723 { 0x0012, KEY_POWER },
724 { 0x001e, KEY_CYCLEWINDOWS }, /* min/max */
725 { 0x0002, KEY_CHANNELUP },
726 { 0x0005, KEY_CHANNELDOWN },
727 { 0x0003, KEY_VOLUMEUP },
728 { 0x0006, KEY_VOLUMEDOWN },
729 { 0x0004, KEY_MUTE },
730 { 0x0007, KEY_OK }, /* TS */
731 { 0x0008, KEY_STOP },
732 { 0x0009, KEY_MENU }, /* swap */
733 { 0x000a, KEY_REWIND },
734 { 0x001b, KEY_PAUSE },
735 { 0x001f, KEY_FASTFORWARD },
736 { 0x000c, KEY_RECORD },
737 { 0x000d, KEY_CAMERA }, /* screenshot */
738 { 0x000e, KEY_COFFEE }, /* "MTS" */
741 static struct rc_map_table rc_map_tvwalkertwin_table[] = {
742 { 0x0001, KEY_ZOOM }, /* Full Screen */
743 { 0x0002, KEY_CAMERA }, /* snapshot */
744 { 0x0003, KEY_MUTE },
745 { 0x0004, KEY_REWIND },
746 { 0x0005, KEY_PLAYPAUSE }, /* Play/Pause */
747 { 0x0006, KEY_FASTFORWARD },
748 { 0x0007, KEY_RECORD },
749 { 0x0008, KEY_STOP },
750 { 0x0009, KEY_TIME }, /* Timeshift */
751 { 0x000c, KEY_COFFEE }, /* Recall */
752 { 0x000e, KEY_CHANNELUP },
753 { 0x0012, KEY_POWER },
754 { 0x0015, KEY_MENU }, /* source */
755 { 0x0018, KEY_CYCLEWINDOWS }, /* TWIN PIP */
756 { 0x001a, KEY_CHANNELDOWN },
757 { 0x001b, KEY_VOLUMEDOWN },
758 { 0x001e, KEY_VOLUMEUP },
761 static struct rc_map_table rc_map_pinnacle310e_table[] = {
763 { 0x17, KEY_FAVORITES },
765 { 0x48, KEY_PROGRAM }, /* preview */
767 { 0x04, KEY_LIST }, /* record list */
778 { 0x0c, KEY_CANCEL },
786 { 0x4f, KEY_ENTER }, /* could also be KEY_OK */
787 { 0x1e, KEY_VOLUMEUP },
788 { 0x0a, KEY_VOLUMEDOWN },
789 { 0x05, KEY_CHANNELUP },
790 { 0x02, KEY_CHANNELDOWN },
791 { 0x11, KEY_RECORD },
795 { 0x40, KEY_REWIND },
796 { 0x12, KEY_FASTFORWARD },
797 { 0x41, KEY_PREVIOUSSONG }, /* Replay */
798 { 0x42, KEY_NEXTSONG }, /* Skip */
799 { 0x54, KEY_CAMERA }, /* Capture */
800 /* { 0x50, KEY_SAP }, */ /* Sap */
801 { 0x47, KEY_CYCLEWINDOWS }, /* Pip */
802 { 0x4d, KEY_SCREEN }, /* FullScreen */
803 { 0x08, KEY_SUBTITLE },
805 /* { 0x49, KEY_LR }, */ /* L/R */
806 { 0x07, KEY_SLEEP }, /* Hibernate */
807 { 0x08, KEY_VIDEO }, /* A/V */
808 { 0x0e, KEY_MENU }, /* Recall */
809 { 0x45, KEY_ZOOMIN },
810 { 0x46, KEY_ZOOMOUT },
811 { 0x18, KEY_RED }, /* Red */
812 { 0x53, KEY_GREEN }, /* Green */
813 { 0x5e, KEY_YELLOW }, /* Yellow */
814 { 0x5f, KEY_BLUE }, /* Blue */
817 /* DVB USB Driver stuff */
818 static struct dvb_usb_device_properties megasky_properties;
819 static struct dvb_usb_device_properties digivox_mini_ii_properties;
820 static struct dvb_usb_device_properties tvwalkertwin_properties;
821 static struct dvb_usb_device_properties dposh_properties;
822 static struct dvb_usb_device_properties pinnacle_pctv310e_properties;
823 static struct dvb_usb_device_properties vp7049_properties;
825 static int m920x_probe(struct usb_interface *intf,
826 const struct usb_device_id *id)
828 struct dvb_usb_device *d = NULL;
830 struct m920x_inits *rc_init_seq = NULL;
831 int bInterfaceNumber = intf->cur_altsetting->desc.bInterfaceNumber;
833 deb("Probing for m920x device at interface %d\n", bInterfaceNumber);
835 if (bInterfaceNumber == 0) {
836 /* Single-tuner device, or first interface on
840 ret = dvb_usb_device_init(intf, &megasky_properties,
841 THIS_MODULE, &d, adapter_nr);
843 rc_init_seq = megasky_rc_init;
847 ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties,
848 THIS_MODULE, &d, adapter_nr);
850 /* No remote control, so no rc_init_seq */
854 /* This configures both tuners on the TV Walker Twin */
855 ret = dvb_usb_device_init(intf, &tvwalkertwin_properties,
856 THIS_MODULE, &d, adapter_nr);
858 rc_init_seq = tvwalkertwin_rc_init;
862 ret = dvb_usb_device_init(intf, &dposh_properties,
863 THIS_MODULE, &d, adapter_nr);
865 /* Remote controller not supported yet. */
869 ret = dvb_usb_device_init(intf, &pinnacle_pctv310e_properties,
870 THIS_MODULE, &d, adapter_nr);
872 rc_init_seq = pinnacle310e_init;
876 ret = dvb_usb_device_init(intf, &vp7049_properties,
877 THIS_MODULE, &d, adapter_nr);
879 rc_init_seq = vp7049_rc_init;
885 /* Another interface on a multi-tuner device */
887 /* The LifeView TV Walker Twin gets here, but struct
888 * tvwalkertwin_properties already configured both
889 * tuners, so there is nothing for us to do here
894 if ((ret = m920x_init_ep(intf)) < 0)
897 if (d && (ret = m920x_init(d, rc_init_seq)) != 0)
903 static struct usb_device_id m920x_table [] = {
904 { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580) },
905 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,
906 USB_PID_MSI_DIGI_VOX_MINI_II) },
907 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,
908 USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD) },
909 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,
910 USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM) },
911 { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_COLD) },
912 { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_WARM) },
913 { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_PINNACLE_PCTV310E) },
914 { USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_TWINHAN_VP7049) },
915 { } /* Terminating entry */
917 MODULE_DEVICE_TABLE (usb, m920x_table);
919 static struct dvb_usb_device_properties megasky_properties = {
920 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
922 .usb_ctrl = DEVICE_SPECIFIC,
923 .firmware = "/*(DEBLOBBED)*/",
924 .download_firmware = m920x_firmware_download,
928 .rc_map_table = rc_map_megasky_table,
929 .rc_map_size = ARRAY_SIZE(rc_map_megasky_table),
930 .rc_query = m920x_rc_query,
933 .size_of_priv = sizeof(struct m920x_state),
935 .identify_state = m920x_identify_state,
941 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
942 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
944 .pid_filter_count = 8,
945 .pid_filter = m920x_pid_filter,
946 .pid_filter_ctrl = m920x_pid_filter_ctrl,
948 .frontend_attach = m920x_mt352_frontend_attach,
949 .tuner_attach = m920x_qt1010_tuner_attach,
963 .i2c_algo = &m920x_i2c_algo,
965 .num_device_descs = 1,
967 { "MSI Mega Sky 580 DVB-T USB2.0",
968 { &m920x_table[0], NULL },
974 static struct dvb_usb_device_properties digivox_mini_ii_properties = {
975 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
977 .usb_ctrl = DEVICE_SPECIFIC,
978 .firmware = "/*(DEBLOBBED)*/",
979 .download_firmware = m920x_firmware_download,
981 .size_of_priv = sizeof(struct m920x_state),
983 .identify_state = m920x_identify_state,
989 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
990 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
992 .pid_filter_count = 8,
993 .pid_filter = m920x_pid_filter,
994 .pid_filter_ctrl = m920x_pid_filter_ctrl,
996 .frontend_attach = m920x_tda10046_08_frontend_attach,
997 .tuner_attach = m920x_tda8275_60_tuner_attach,
1005 .buffersize = 0x4000,
1011 .i2c_algo = &m920x_i2c_algo,
1013 .num_device_descs = 1,
1015 { "MSI DIGI VOX mini II DVB-T USB2.0",
1016 { &m920x_table[1], NULL },
1022 /* LifeView TV Walker Twin support by Nick Andrew <nick@nick-andrew.net>
1024 * LifeView TV Walker Twin has 1 x M9206, 2 x TDA10046, 2 x TDA8275A
1025 * TDA10046 #0 is located at i2c address 0x08
1026 * TDA10046 #1 is located at i2c address 0x0b
1027 * TDA8275A #0 is located at i2c address 0x60
1028 * TDA8275A #1 is located at i2c address 0x61
1030 static struct dvb_usb_device_properties tvwalkertwin_properties = {
1031 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1033 .usb_ctrl = DEVICE_SPECIFIC,
1034 .firmware = "/*(DEBLOBBED)*/",
1035 .download_firmware = m920x_firmware_download,
1039 .rc_map_table = rc_map_tvwalkertwin_table,
1040 .rc_map_size = ARRAY_SIZE(rc_map_tvwalkertwin_table),
1041 .rc_query = m920x_rc_query,
1044 .size_of_priv = sizeof(struct m920x_state),
1046 .identify_state = m920x_identify_state,
1052 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
1053 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1055 .pid_filter_count = 8,
1056 .pid_filter = m920x_pid_filter,
1057 .pid_filter_ctrl = m920x_pid_filter_ctrl,
1059 .frontend_attach = m920x_tda10046_08_frontend_attach,
1060 .tuner_attach = m920x_tda8275_60_tuner_attach,
1076 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
1077 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1079 .pid_filter_count = 8,
1080 .pid_filter = m920x_pid_filter,
1081 .pid_filter_ctrl = m920x_pid_filter_ctrl,
1083 .frontend_attach = m920x_tda10046_0b_frontend_attach,
1084 .tuner_attach = m920x_tda8275_61_tuner_attach,
1098 .i2c_algo = &m920x_i2c_algo,
1100 .num_device_descs = 1,
1102 { .name = "LifeView TV Walker Twin DVB-T USB2.0",
1103 .cold_ids = { &m920x_table[2], NULL },
1104 .warm_ids = { &m920x_table[3], NULL },
1109 static struct dvb_usb_device_properties dposh_properties = {
1110 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1112 .usb_ctrl = DEVICE_SPECIFIC,
1113 .firmware = "/*(DEBLOBBED)*/",
1114 .download_firmware = m920x_firmware_download,
1116 .size_of_priv = sizeof(struct m920x_state),
1118 .identify_state = m920x_identify_state,
1123 /* Hardware pid filters don't work with this device/firmware */
1125 .frontend_attach = m920x_mt352_frontend_attach,
1126 .tuner_attach = m920x_qt1010_tuner_attach,
1140 .i2c_algo = &m920x_i2c_algo,
1142 .num_device_descs = 1,
1144 { .name = "Dposh DVB-T USB2.0",
1145 .cold_ids = { &m920x_table[4], NULL },
1146 .warm_ids = { &m920x_table[5], NULL },
1151 static struct dvb_usb_device_properties pinnacle_pctv310e_properties = {
1152 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1154 .usb_ctrl = DEVICE_SPECIFIC,
1155 .download_firmware = NULL,
1159 .rc_map_table = rc_map_pinnacle310e_table,
1160 .rc_map_size = ARRAY_SIZE(rc_map_pinnacle310e_table),
1161 .rc_query = m920x_rc_query,
1164 .size_of_priv = sizeof(struct m920x_state),
1166 .identify_state = m920x_identify_state,
1172 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
1173 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1175 .pid_filter_count = 8,
1176 .pid_filter = m920x_pid_filter,
1177 .pid_filter_ctrl = m920x_pid_filter_ctrl,
1179 .frontend_attach = m920x_mt352_frontend_attach,
1180 .tuner_attach = m920x_fmd1216me_tuner_attach,
1188 .framesperurb = 128,
1196 .i2c_algo = &m920x_i2c_algo,
1198 .num_device_descs = 1,
1200 { "Pinnacle PCTV 310e",
1201 { &m920x_table[6], NULL },
1207 static struct dvb_usb_device_properties vp7049_properties = {
1208 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1210 .usb_ctrl = DEVICE_SPECIFIC,
1211 .firmware = "/*(DEBLOBBED)*/",
1212 .download_firmware = m920x_firmware_download,
1216 .rc_codes = RC_MAP_TWINHAN_VP1027_DVBS,
1217 .rc_query = m920x_rc_core_query,
1218 .allowed_protos = RC_PROTO_BIT_UNKNOWN,
1221 .size_of_priv = sizeof(struct m920x_state),
1223 .identify_state = m920x_identify_state,
1229 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
1230 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1232 .pid_filter_count = 8,
1233 .pid_filter = m920x_pid_filter,
1234 .pid_filter_ctrl = m920x_pid_filter_ctrl,
1236 .frontend_attach = m920x_mt352_frontend_attach_vp7049,
1237 .tuner_attach = m920x_mt2060_tuner_attach,
1251 .i2c_algo = &m920x_i2c_algo,
1253 .num_device_descs = 1,
1255 { "DTV-DVB UDTT7049",
1256 { &m920x_table[7], NULL },
1262 static struct usb_driver m920x_driver = {
1263 .name = "dvb_usb_m920x",
1264 .probe = m920x_probe,
1265 .disconnect = dvb_usb_device_exit,
1266 .id_table = m920x_table,
1269 module_usb_driver(m920x_driver);
1271 MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>");
1272 MODULE_DESCRIPTION("DVB Driver for ULI M920x");
1273 MODULE_VERSION("0.1");
1274 MODULE_LICENSE("GPL");