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
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);
261 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
264 for (i = 0; i < num; i++) {
265 if (msg[i].flags & (I2C_M_NO_RD_ACK | I2C_M_IGNORE_NAK | I2C_M_TEN) || msg[i].len == 0) {
266 /* For a 0 byte message, I think sending the address
267 * to index 0x80|0x40 would be the correct thing to
268 * do. However, zero byte messages are only used for
269 * probing, and since we don't know how to get the
270 * slave's ack, we can't probe. */
274 /* Send START & address/RW bit */
275 if (!(msg[i].flags & I2C_M_NOSTART)) {
276 if ((ret = m920x_write(d->udev, M9206_I2C,
278 (msg[i].flags & I2C_M_RD ? 0x01 : 0), 0x80)) != 0)
280 /* Should check for ack here, if we knew how. */
282 if (msg[i].flags & I2C_M_RD) {
283 char *read = kmalloc(1, GFP_KERNEL);
290 for (j = 0; j < msg[i].len; j++) {
291 /* Last byte of transaction?
292 * Send STOP, otherwise send ACK. */
293 int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x01;
295 if ((ret = m920x_read(d->udev, M9206_I2C, 0x0,
299 msg[i].buf[j] = read[0];
304 for (j = 0; j < msg[i].len; j++) {
305 /* Last byte of transaction? Then send STOP. */
306 int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x00;
308 if ((ret = m920x_write(d->udev, M9206_I2C, msg[i].buf[j], stop)) != 0)
310 /* Should check for ack here too. */
317 mutex_unlock(&d->i2c_mutex);
322 static u32 m920x_i2c_func(struct i2c_adapter *adapter)
327 static struct i2c_algorithm m920x_i2c_algo = {
328 .master_xfer = m920x_i2c_xfer,
329 .functionality = m920x_i2c_func,
333 static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid)
342 if ((ret = m920x_write(d->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0)
345 if ((ret = m920x_write(d->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0)
351 static int m920x_update_filters(struct dvb_usb_adapter *adap)
353 struct m920x_state *m = adap->dev->priv;
354 int enabled = m->filtering_enabled[adap->id];
355 int i, ret = 0, filter = 0;
356 int ep = adap->props.fe[0].stream.endpoint;
358 for (i = 0; i < M9206_MAX_FILTERS; i++)
359 if (m->filters[adap->id][i] == 8192)
362 /* Disable all filters */
363 if ((ret = m920x_set_filter(adap->dev, ep, 1, enabled)) != 0)
366 for (i = 0; i < M9206_MAX_FILTERS; i++)
367 if ((ret = m920x_set_filter(adap->dev, ep, i + 2, 0)) != 0)
372 for (i = 0; i < M9206_MAX_FILTERS; i++) {
373 if (m->filters[adap->id][i] == 0)
376 if ((ret = m920x_set_filter(adap->dev, ep, filter + 2, m->filters[adap->id][i])) != 0)
386 static int m920x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
388 struct m920x_state *m = adap->dev->priv;
390 m->filtering_enabled[adap->id] = onoff ? 1 : 0;
392 return m920x_update_filters(adap);
395 static int m920x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff)
397 struct m920x_state *m = adap->dev->priv;
399 m->filters[adap->id][index] = onoff ? pid : 0;
401 return m920x_update_filters(adap);
404 static int m920x_firmware_download(struct usb_device *udev, const struct firmware *fw)
406 u16 value, index, size;
408 int i, pass, ret = 0;
410 buff = kmalloc(65536, GFP_KERNEL);
414 read = kmalloc(4, GFP_KERNEL);
420 if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0)
422 deb("%*ph\n", 4, read);
424 if ((ret = m920x_read(udev, M9206_FW, 0x0, 0x0, read, 1)) != 0)
426 deb("%x\n", read[0]);
428 for (pass = 0; pass < 2; pass++) {
429 for (i = 0; i + (sizeof(u16) * 3) < fw->size;) {
430 value = get_unaligned_le16(fw->data + i);
433 index = get_unaligned_le16(fw->data + i);
436 size = get_unaligned_le16(fw->data + i);
440 /* Will stall if using fw->data ... */
441 memcpy(buff, fw->data + i, size);
443 ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0),
445 USB_TYPE_VENDOR | USB_DIR_OUT,
446 value, index, buff, size, 20);
448 deb("error while uploading fw!\n");
457 deb("bad firmware file!\n");
465 /* m920x will disconnect itself from the bus after this. */
466 (void) m920x_write(udev, M9206_CORE, 0x01, M9206_FW_GO);
467 deb("firmware uploaded!\n");
476 /* Callbacks for DVB USB */
477 static int m920x_identify_state(struct usb_device *udev,
478 struct dvb_usb_device_properties *props,
479 struct dvb_usb_device_description **desc,
482 struct usb_host_interface *alt;
484 alt = usb_altnum_to_altsetting(usb_ifnum_to_if(udev, 0), 1);
485 *cold = (alt == NULL) ? 1 : 0;
490 /* demod configurations */
491 static int m920x_mt352_demod_init(struct dvb_frontend *fe)
494 u8 config[] = { CONFIG, 0x3d };
495 u8 clock[] = { CLOCK_CTL, 0x30 };
496 u8 reset[] = { RESET, 0x80 };
497 u8 adc_ctl[] = { ADC_CTL_1, 0x40 };
498 u8 agc[] = { AGC_TARGET, 0x1c, 0x20 };
499 u8 sec_agc[] = { 0x69, 0x00, 0xff, 0xff, 0x40, 0xff, 0x00, 0x40, 0x40 };
500 u8 unk1[] = { 0x93, 0x1a };
501 u8 unk2[] = { 0xb5, 0x7a };
503 deb("Demod init!\n");
505 if ((ret = mt352_write(fe, config, ARRAY_SIZE(config))) != 0)
507 if ((ret = mt352_write(fe, clock, ARRAY_SIZE(clock))) != 0)
509 if ((ret = mt352_write(fe, reset, ARRAY_SIZE(reset))) != 0)
511 if ((ret = mt352_write(fe, adc_ctl, ARRAY_SIZE(adc_ctl))) != 0)
513 if ((ret = mt352_write(fe, agc, ARRAY_SIZE(agc))) != 0)
515 if ((ret = mt352_write(fe, sec_agc, ARRAY_SIZE(sec_agc))) != 0)
517 if ((ret = mt352_write(fe, unk1, ARRAY_SIZE(unk1))) != 0)
519 if ((ret = mt352_write(fe, unk2, ARRAY_SIZE(unk2))) != 0)
525 static struct mt352_config m920x_mt352_config = {
526 .demod_address = 0x0f,
528 .demod_init = m920x_mt352_demod_init,
531 static struct tda1004x_config m920x_tda10046_08_config = {
532 .demod_address = 0x08,
535 .ts_mode = TDA10046_TS_SERIAL,
536 .xtal_freq = TDA10046_XTAL_16M,
537 .if_freq = TDA10046_FREQ_045,
538 .agc_config = TDA10046_AGC_TDA827X,
539 .gpio_config = TDA10046_GPTRI,
540 .request_firmware = NULL,
543 static struct tda1004x_config m920x_tda10046_0b_config = {
544 .demod_address = 0x0b,
547 .ts_mode = TDA10046_TS_SERIAL,
548 .xtal_freq = TDA10046_XTAL_16M,
549 .if_freq = TDA10046_FREQ_045,
550 .agc_config = TDA10046_AGC_TDA827X,
551 .gpio_config = TDA10046_GPTRI,
552 .request_firmware = NULL, /* uses firmware EEPROM */
555 /* tuner configurations */
556 static struct qt1010_config m920x_qt1010_config = {
560 static struct mt2060_config m920x_mt2060_config = {
561 .i2c_address = 0x60, /* 0xc0 */
566 /* Callbacks for DVB USB */
567 static int m920x_mt352_frontend_attach(struct dvb_usb_adapter *adap)
569 deb("%s\n",__func__);
571 adap->fe_adap[0].fe = dvb_attach(mt352_attach,
573 &adap->dev->i2c_adap);
574 if ((adap->fe_adap[0].fe) == NULL)
580 static int m920x_mt352_frontend_attach_vp7049(struct dvb_usb_adapter *adap)
582 struct m920x_inits vp7049_fe_init_seq[] = {
583 /* XXX without these commands the frontend cannot be detected,
584 * they must be sent BEFORE the frontend is attached */
596 { } /* terminating entry */
600 deb("%s\n", __func__);
602 ret = m920x_write_seq(adap->dev->udev, M9206_CORE, vp7049_fe_init_seq);
604 deb("Initialization of vp7049 frontend failed.");
608 return m920x_mt352_frontend_attach(adap);
611 static int m920x_tda10046_08_frontend_attach(struct dvb_usb_adapter *adap)
613 deb("%s\n",__func__);
615 adap->fe_adap[0].fe = dvb_attach(tda10046_attach,
616 &m920x_tda10046_08_config,
617 &adap->dev->i2c_adap);
618 if ((adap->fe_adap[0].fe) == NULL)
624 static int m920x_tda10046_0b_frontend_attach(struct dvb_usb_adapter *adap)
626 deb("%s\n",__func__);
628 adap->fe_adap[0].fe = dvb_attach(tda10046_attach,
629 &m920x_tda10046_0b_config,
630 &adap->dev->i2c_adap);
631 if ((adap->fe_adap[0].fe) == NULL)
637 static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter *adap)
639 deb("%s\n",__func__);
641 if (dvb_attach(qt1010_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap, &m920x_qt1010_config) == NULL)
647 static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter *adap)
649 deb("%s\n",__func__);
651 if (dvb_attach(tda827x_attach, adap->fe_adap[0].fe, 0x60, &adap->dev->i2c_adap, NULL) == NULL)
657 static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap)
659 deb("%s\n",__func__);
661 if (dvb_attach(tda827x_attach, adap->fe_adap[0].fe, 0x61, &adap->dev->i2c_adap, NULL) == NULL)
667 static int m920x_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap)
669 dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe,
670 &adap->dev->i2c_adap, 0x61,
671 TUNER_PHILIPS_FMD1216ME_MK3);
675 static int m920x_mt2060_tuner_attach(struct dvb_usb_adapter *adap)
677 deb("%s\n", __func__);
679 if (dvb_attach(mt2060_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap,
680 &m920x_mt2060_config, 1220) == NULL)
687 /* device-specific initialization */
688 static struct m920x_inits megasky_rc_init [] = {
689 { M9206_RC_INIT2, 0xa8 },
690 { M9206_RC_INIT1, 0x51 },
691 { } /* terminating entry */
694 static struct m920x_inits tvwalkertwin_rc_init [] = {
695 { M9206_RC_INIT2, 0x00 },
696 { M9206_RC_INIT1, 0xef },
700 { } /* terminating entry */
703 static struct m920x_inits pinnacle310e_init[] = {
704 /* without these the tuner doesn't work */
710 { M9206_RC_INIT1, 0x00 },
711 { M9206_RC_INIT2, 0xff },
712 { } /* terminating entry */
715 static struct m920x_inits vp7049_rc_init[] = {
719 { M9206_RC_INIT2, 0x00 },
720 { M9206_RC_INIT1, 0xff },
721 { } /* terminating entry */
725 static struct rc_map_table rc_map_megasky_table[] = {
726 { 0x0012, KEY_POWER },
727 { 0x001e, KEY_CYCLEWINDOWS }, /* min/max */
728 { 0x0002, KEY_CHANNELUP },
729 { 0x0005, KEY_CHANNELDOWN },
730 { 0x0003, KEY_VOLUMEUP },
731 { 0x0006, KEY_VOLUMEDOWN },
732 { 0x0004, KEY_MUTE },
733 { 0x0007, KEY_OK }, /* TS */
734 { 0x0008, KEY_STOP },
735 { 0x0009, KEY_MENU }, /* swap */
736 { 0x000a, KEY_REWIND },
737 { 0x001b, KEY_PAUSE },
738 { 0x001f, KEY_FASTFORWARD },
739 { 0x000c, KEY_RECORD },
740 { 0x000d, KEY_CAMERA }, /* screenshot */
741 { 0x000e, KEY_COFFEE }, /* "MTS" */
744 static struct rc_map_table rc_map_tvwalkertwin_table[] = {
745 { 0x0001, KEY_ZOOM }, /* Full Screen */
746 { 0x0002, KEY_CAMERA }, /* snapshot */
747 { 0x0003, KEY_MUTE },
748 { 0x0004, KEY_REWIND },
749 { 0x0005, KEY_PLAYPAUSE }, /* Play/Pause */
750 { 0x0006, KEY_FASTFORWARD },
751 { 0x0007, KEY_RECORD },
752 { 0x0008, KEY_STOP },
753 { 0x0009, KEY_TIME }, /* Timeshift */
754 { 0x000c, KEY_COFFEE }, /* Recall */
755 { 0x000e, KEY_CHANNELUP },
756 { 0x0012, KEY_POWER },
757 { 0x0015, KEY_MENU }, /* source */
758 { 0x0018, KEY_CYCLEWINDOWS }, /* TWIN PIP */
759 { 0x001a, KEY_CHANNELDOWN },
760 { 0x001b, KEY_VOLUMEDOWN },
761 { 0x001e, KEY_VOLUMEUP },
764 static struct rc_map_table rc_map_pinnacle310e_table[] = {
766 { 0x17, KEY_FAVORITES },
768 { 0x48, KEY_PROGRAM }, /* preview */
770 { 0x04, KEY_LIST }, /* record list */
781 { 0x0c, KEY_CANCEL },
789 { 0x4f, KEY_ENTER }, /* could also be KEY_OK */
790 { 0x1e, KEY_VOLUMEUP },
791 { 0x0a, KEY_VOLUMEDOWN },
792 { 0x05, KEY_CHANNELUP },
793 { 0x02, KEY_CHANNELDOWN },
794 { 0x11, KEY_RECORD },
798 { 0x40, KEY_REWIND },
799 { 0x12, KEY_FASTFORWARD },
800 { 0x41, KEY_PREVIOUSSONG }, /* Replay */
801 { 0x42, KEY_NEXTSONG }, /* Skip */
802 { 0x54, KEY_CAMERA }, /* Capture */
803 /* { 0x50, KEY_SAP }, */ /* Sap */
804 { 0x47, KEY_CYCLEWINDOWS }, /* Pip */
805 { 0x4d, KEY_SCREEN }, /* FullScreen */
806 { 0x08, KEY_SUBTITLE },
808 /* { 0x49, KEY_LR }, */ /* L/R */
809 { 0x07, KEY_SLEEP }, /* Hibernate */
810 { 0x08, KEY_VIDEO }, /* A/V */
811 { 0x0e, KEY_MENU }, /* Recall */
812 { 0x45, KEY_ZOOMIN },
813 { 0x46, KEY_ZOOMOUT },
814 { 0x18, KEY_RED }, /* Red */
815 { 0x53, KEY_GREEN }, /* Green */
816 { 0x5e, KEY_YELLOW }, /* Yellow */
817 { 0x5f, KEY_BLUE }, /* Blue */
820 /* DVB USB Driver stuff */
821 static struct dvb_usb_device_properties megasky_properties;
822 static struct dvb_usb_device_properties digivox_mini_ii_properties;
823 static struct dvb_usb_device_properties tvwalkertwin_properties;
824 static struct dvb_usb_device_properties dposh_properties;
825 static struct dvb_usb_device_properties pinnacle_pctv310e_properties;
826 static struct dvb_usb_device_properties vp7049_properties;
828 static int m920x_probe(struct usb_interface *intf,
829 const struct usb_device_id *id)
831 struct dvb_usb_device *d = NULL;
833 struct m920x_inits *rc_init_seq = NULL;
834 int bInterfaceNumber = intf->cur_altsetting->desc.bInterfaceNumber;
836 deb("Probing for m920x device at interface %d\n", bInterfaceNumber);
838 if (bInterfaceNumber == 0) {
839 /* Single-tuner device, or first interface on
843 ret = dvb_usb_device_init(intf, &megasky_properties,
844 THIS_MODULE, &d, adapter_nr);
846 rc_init_seq = megasky_rc_init;
850 ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties,
851 THIS_MODULE, &d, adapter_nr);
853 /* No remote control, so no rc_init_seq */
857 /* This configures both tuners on the TV Walker Twin */
858 ret = dvb_usb_device_init(intf, &tvwalkertwin_properties,
859 THIS_MODULE, &d, adapter_nr);
861 rc_init_seq = tvwalkertwin_rc_init;
865 ret = dvb_usb_device_init(intf, &dposh_properties,
866 THIS_MODULE, &d, adapter_nr);
868 /* Remote controller not supported yet. */
872 ret = dvb_usb_device_init(intf, &pinnacle_pctv310e_properties,
873 THIS_MODULE, &d, adapter_nr);
875 rc_init_seq = pinnacle310e_init;
879 ret = dvb_usb_device_init(intf, &vp7049_properties,
880 THIS_MODULE, &d, adapter_nr);
882 rc_init_seq = vp7049_rc_init;
888 /* Another interface on a multi-tuner device */
890 /* The LifeView TV Walker Twin gets here, but struct
891 * tvwalkertwin_properties already configured both
892 * tuners, so there is nothing for us to do here
897 if ((ret = m920x_init_ep(intf)) < 0)
900 if (d && (ret = m920x_init(d, rc_init_seq)) != 0)
906 static struct usb_device_id m920x_table [] = {
907 { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580) },
908 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,
909 USB_PID_MSI_DIGI_VOX_MINI_II) },
910 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,
911 USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD) },
912 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC,
913 USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM) },
914 { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_COLD) },
915 { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_WARM) },
916 { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_PINNACLE_PCTV310E) },
917 { USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_TWINHAN_VP7049) },
918 { } /* Terminating entry */
920 MODULE_DEVICE_TABLE (usb, m920x_table);
922 static struct dvb_usb_device_properties megasky_properties = {
923 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
925 .usb_ctrl = DEVICE_SPECIFIC,
926 .firmware = "/*(DEBLOBBED)*/",
927 .download_firmware = m920x_firmware_download,
931 .rc_map_table = rc_map_megasky_table,
932 .rc_map_size = ARRAY_SIZE(rc_map_megasky_table),
933 .rc_query = m920x_rc_query,
936 .size_of_priv = sizeof(struct m920x_state),
938 .identify_state = m920x_identify_state,
944 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
945 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
947 .pid_filter_count = 8,
948 .pid_filter = m920x_pid_filter,
949 .pid_filter_ctrl = m920x_pid_filter_ctrl,
951 .frontend_attach = m920x_mt352_frontend_attach,
952 .tuner_attach = m920x_qt1010_tuner_attach,
966 .i2c_algo = &m920x_i2c_algo,
968 .num_device_descs = 1,
970 { "MSI Mega Sky 580 DVB-T USB2.0",
971 { &m920x_table[0], NULL },
977 static struct dvb_usb_device_properties digivox_mini_ii_properties = {
978 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
980 .usb_ctrl = DEVICE_SPECIFIC,
981 .firmware = "/*(DEBLOBBED)*/",
982 .download_firmware = m920x_firmware_download,
984 .size_of_priv = sizeof(struct m920x_state),
986 .identify_state = m920x_identify_state,
992 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
993 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
995 .pid_filter_count = 8,
996 .pid_filter = m920x_pid_filter,
997 .pid_filter_ctrl = m920x_pid_filter_ctrl,
999 .frontend_attach = m920x_tda10046_08_frontend_attach,
1000 .tuner_attach = m920x_tda8275_60_tuner_attach,
1008 .buffersize = 0x4000,
1014 .i2c_algo = &m920x_i2c_algo,
1016 .num_device_descs = 1,
1018 { "MSI DIGI VOX mini II DVB-T USB2.0",
1019 { &m920x_table[1], NULL },
1025 /* LifeView TV Walker Twin support by Nick Andrew <nick@nick-andrew.net>
1027 * LifeView TV Walker Twin has 1 x M9206, 2 x TDA10046, 2 x TDA8275A
1028 * TDA10046 #0 is located at i2c address 0x08
1029 * TDA10046 #1 is located at i2c address 0x0b
1030 * TDA8275A #0 is located at i2c address 0x60
1031 * TDA8275A #1 is located at i2c address 0x61
1033 static struct dvb_usb_device_properties tvwalkertwin_properties = {
1034 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1036 .usb_ctrl = DEVICE_SPECIFIC,
1037 .firmware = "/*(DEBLOBBED)*/",
1038 .download_firmware = m920x_firmware_download,
1042 .rc_map_table = rc_map_tvwalkertwin_table,
1043 .rc_map_size = ARRAY_SIZE(rc_map_tvwalkertwin_table),
1044 .rc_query = m920x_rc_query,
1047 .size_of_priv = sizeof(struct m920x_state),
1049 .identify_state = m920x_identify_state,
1055 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
1056 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1058 .pid_filter_count = 8,
1059 .pid_filter = m920x_pid_filter,
1060 .pid_filter_ctrl = m920x_pid_filter_ctrl,
1062 .frontend_attach = m920x_tda10046_08_frontend_attach,
1063 .tuner_attach = m920x_tda8275_60_tuner_attach,
1079 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
1080 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1082 .pid_filter_count = 8,
1083 .pid_filter = m920x_pid_filter,
1084 .pid_filter_ctrl = m920x_pid_filter_ctrl,
1086 .frontend_attach = m920x_tda10046_0b_frontend_attach,
1087 .tuner_attach = m920x_tda8275_61_tuner_attach,
1101 .i2c_algo = &m920x_i2c_algo,
1103 .num_device_descs = 1,
1105 { .name = "LifeView TV Walker Twin DVB-T USB2.0",
1106 .cold_ids = { &m920x_table[2], NULL },
1107 .warm_ids = { &m920x_table[3], NULL },
1112 static struct dvb_usb_device_properties dposh_properties = {
1113 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1115 .usb_ctrl = DEVICE_SPECIFIC,
1116 .firmware = "/*(DEBLOBBED)*/",
1117 .download_firmware = m920x_firmware_download,
1119 .size_of_priv = sizeof(struct m920x_state),
1121 .identify_state = m920x_identify_state,
1126 /* Hardware pid filters don't work with this device/firmware */
1128 .frontend_attach = m920x_mt352_frontend_attach,
1129 .tuner_attach = m920x_qt1010_tuner_attach,
1143 .i2c_algo = &m920x_i2c_algo,
1145 .num_device_descs = 1,
1147 { .name = "Dposh DVB-T USB2.0",
1148 .cold_ids = { &m920x_table[4], NULL },
1149 .warm_ids = { &m920x_table[5], NULL },
1154 static struct dvb_usb_device_properties pinnacle_pctv310e_properties = {
1155 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1157 .usb_ctrl = DEVICE_SPECIFIC,
1158 .download_firmware = NULL,
1162 .rc_map_table = rc_map_pinnacle310e_table,
1163 .rc_map_size = ARRAY_SIZE(rc_map_pinnacle310e_table),
1164 .rc_query = m920x_rc_query,
1167 .size_of_priv = sizeof(struct m920x_state),
1169 .identify_state = m920x_identify_state,
1175 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
1176 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1178 .pid_filter_count = 8,
1179 .pid_filter = m920x_pid_filter,
1180 .pid_filter_ctrl = m920x_pid_filter_ctrl,
1182 .frontend_attach = m920x_mt352_frontend_attach,
1183 .tuner_attach = m920x_fmd1216me_tuner_attach,
1191 .framesperurb = 128,
1199 .i2c_algo = &m920x_i2c_algo,
1201 .num_device_descs = 1,
1203 { "Pinnacle PCTV 310e",
1204 { &m920x_table[6], NULL },
1210 static struct dvb_usb_device_properties vp7049_properties = {
1211 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1213 .usb_ctrl = DEVICE_SPECIFIC,
1214 .firmware = "/*(DEBLOBBED)*/",
1215 .download_firmware = m920x_firmware_download,
1219 .rc_codes = RC_MAP_TWINHAN_VP1027_DVBS,
1220 .rc_query = m920x_rc_core_query,
1221 .allowed_protos = RC_PROTO_BIT_UNKNOWN,
1224 .size_of_priv = sizeof(struct m920x_state),
1226 .identify_state = m920x_identify_state,
1232 .caps = DVB_USB_ADAP_HAS_PID_FILTER |
1233 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
1235 .pid_filter_count = 8,
1236 .pid_filter = m920x_pid_filter,
1237 .pid_filter_ctrl = m920x_pid_filter_ctrl,
1239 .frontend_attach = m920x_mt352_frontend_attach_vp7049,
1240 .tuner_attach = m920x_mt2060_tuner_attach,
1254 .i2c_algo = &m920x_i2c_algo,
1256 .num_device_descs = 1,
1258 { "DTV-DVB UDTT7049",
1259 { &m920x_table[7], NULL },
1265 static struct usb_driver m920x_driver = {
1266 .name = "dvb_usb_m920x",
1267 .probe = m920x_probe,
1268 .disconnect = dvb_usb_device_exit,
1269 .id_table = m920x_table,
1272 module_usb_driver(m920x_driver);
1274 MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>");
1275 MODULE_DESCRIPTION("DVB Driver for ULI M920x");
1276 MODULE_VERSION("0.1");
1277 MODULE_LICENSE("GPL");