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 for (j
= 0; j
< msg
[i
].len
; j
++) {
281 /* Last byte of transaction?
282 * Send STOP, otherwise send ACK. */
283 int stop
= (i
+1 == num
&& j
+1 == msg
[i
].len
) ? 0x40 : 0x01;
285 if ((ret
= m920x_read(d
->udev
, M9206_I2C
, 0x0,
287 &msg
[i
].buf
[j
], 1)) != 0)
291 for (j
= 0; j
< msg
[i
].len
; j
++) {
292 /* Last byte of transaction? Then send STOP. */
293 int stop
= (i
+1 == num
&& j
+1 == msg
[i
].len
) ? 0x40 : 0x00;
295 if ((ret
= m920x_write(d
->udev
, M9206_I2C
, msg
[i
].buf
[j
], stop
)) != 0)
297 /* Should check for ack here too. */
304 mutex_unlock(&d
->i2c_mutex
);
309 static u32
m920x_i2c_func(struct i2c_adapter
*adapter
)
314 static struct i2c_algorithm m920x_i2c_algo
= {
315 .master_xfer
= m920x_i2c_xfer
,
316 .functionality
= m920x_i2c_func
,
320 static int m920x_set_filter(struct dvb_usb_device
*d
, int type
, int idx
, int pid
)
329 if ((ret
= m920x_write(d
->udev
, M9206_FILTER
, pid
, (type
<< 8) | (idx
* 4) )) != 0)
332 if ((ret
= m920x_write(d
->udev
, M9206_FILTER
, 0, (type
<< 8) | (idx
* 4) )) != 0)
338 static int m920x_update_filters(struct dvb_usb_adapter
*adap
)
340 struct m920x_state
*m
= adap
->dev
->priv
;
341 int enabled
= m
->filtering_enabled
[adap
->id
];
342 int i
, ret
= 0, filter
= 0;
343 int ep
= adap
->props
.fe
[0].stream
.endpoint
;
345 for (i
= 0; i
< M9206_MAX_FILTERS
; i
++)
346 if (m
->filters
[adap
->id
][i
] == 8192)
349 /* Disable all filters */
350 if ((ret
= m920x_set_filter(adap
->dev
, ep
, 1, enabled
)) != 0)
353 for (i
= 0; i
< M9206_MAX_FILTERS
; i
++)
354 if ((ret
= m920x_set_filter(adap
->dev
, ep
, i
+ 2, 0)) != 0)
359 for (i
= 0; i
< M9206_MAX_FILTERS
; i
++) {
360 if (m
->filters
[adap
->id
][i
] == 0)
363 if ((ret
= m920x_set_filter(adap
->dev
, ep
, filter
+ 2, m
->filters
[adap
->id
][i
])) != 0)
373 static int m920x_pid_filter_ctrl(struct dvb_usb_adapter
*adap
, int onoff
)
375 struct m920x_state
*m
= adap
->dev
->priv
;
377 m
->filtering_enabled
[adap
->id
] = onoff
? 1 : 0;
379 return m920x_update_filters(adap
);
382 static int m920x_pid_filter(struct dvb_usb_adapter
*adap
, int index
, u16 pid
, int onoff
)
384 struct m920x_state
*m
= adap
->dev
->priv
;
386 m
->filters
[adap
->id
][index
] = onoff
? pid
: 0;
388 return m920x_update_filters(adap
);
391 static int m920x_firmware_download(struct usb_device
*udev
, const struct firmware
*fw
)
393 u16 value
, index
, size
;
395 int i
, pass
, ret
= 0;
397 buff
= kmalloc(65536, GFP_KERNEL
);
401 read
= kmalloc(4, GFP_KERNEL
);
407 if ((ret
= m920x_read(udev
, M9206_FILTER
, 0x0, 0x8000, read
, 4)) != 0)
409 deb("%*ph\n", 4, read
);
411 if ((ret
= m920x_read(udev
, M9206_FW
, 0x0, 0x0, read
, 1)) != 0)
413 deb("%x\n", read
[0]);
415 for (pass
= 0; pass
< 2; pass
++) {
416 for (i
= 0; i
+ (sizeof(u16
) * 3) < fw
->size
;) {
417 value
= get_unaligned_le16(fw
->data
+ i
);
420 index
= get_unaligned_le16(fw
->data
+ i
);
423 size
= get_unaligned_le16(fw
->data
+ i
);
427 /* Will stall if using fw->data ... */
428 memcpy(buff
, fw
->data
+ i
, size
);
430 ret
= usb_control_msg(udev
, usb_sndctrlpipe(udev
,0),
432 USB_TYPE_VENDOR
| USB_DIR_OUT
,
433 value
, index
, buff
, size
, 20);
435 deb("error while uploading fw!\n");
444 deb("bad firmware file!\n");
452 /* m920x will disconnect itself from the bus after this. */
453 (void) m920x_write(udev
, M9206_CORE
, 0x01, M9206_FW_GO
);
454 deb("firmware uploaded!\n");
463 /* Callbacks for DVB USB */
464 static int m920x_identify_state(struct usb_device
*udev
,
465 struct dvb_usb_device_properties
*props
,
466 struct dvb_usb_device_description
**desc
,
469 struct usb_host_interface
*alt
;
471 alt
= usb_altnum_to_altsetting(usb_ifnum_to_if(udev
, 0), 1);
472 *cold
= (alt
== NULL
) ? 1 : 0;
477 /* demod configurations */
478 static int m920x_mt352_demod_init(struct dvb_frontend
*fe
)
481 u8 config
[] = { CONFIG
, 0x3d };
482 u8 clock
[] = { CLOCK_CTL
, 0x30 };
483 u8 reset
[] = { RESET
, 0x80 };
484 u8 adc_ctl
[] = { ADC_CTL_1
, 0x40 };
485 u8 agc
[] = { AGC_TARGET
, 0x1c, 0x20 };
486 u8 sec_agc
[] = { 0x69, 0x00, 0xff, 0xff, 0x40, 0xff, 0x00, 0x40, 0x40 };
487 u8 unk1
[] = { 0x93, 0x1a };
488 u8 unk2
[] = { 0xb5, 0x7a };
490 deb("Demod init!\n");
492 if ((ret
= mt352_write(fe
, config
, ARRAY_SIZE(config
))) != 0)
494 if ((ret
= mt352_write(fe
, clock
, ARRAY_SIZE(clock
))) != 0)
496 if ((ret
= mt352_write(fe
, reset
, ARRAY_SIZE(reset
))) != 0)
498 if ((ret
= mt352_write(fe
, adc_ctl
, ARRAY_SIZE(adc_ctl
))) != 0)
500 if ((ret
= mt352_write(fe
, agc
, ARRAY_SIZE(agc
))) != 0)
502 if ((ret
= mt352_write(fe
, sec_agc
, ARRAY_SIZE(sec_agc
))) != 0)
504 if ((ret
= mt352_write(fe
, unk1
, ARRAY_SIZE(unk1
))) != 0)
506 if ((ret
= mt352_write(fe
, unk2
, ARRAY_SIZE(unk2
))) != 0)
512 static struct mt352_config m920x_mt352_config
= {
513 .demod_address
= 0x0f,
515 .demod_init
= m920x_mt352_demod_init
,
518 static struct tda1004x_config m920x_tda10046_08_config
= {
519 .demod_address
= 0x08,
522 .ts_mode
= TDA10046_TS_SERIAL
,
523 .xtal_freq
= TDA10046_XTAL_16M
,
524 .if_freq
= TDA10046_FREQ_045
,
525 .agc_config
= TDA10046_AGC_TDA827X
,
526 .gpio_config
= TDA10046_GPTRI
,
527 .request_firmware
= NULL
,
530 static struct tda1004x_config m920x_tda10046_0b_config
= {
531 .demod_address
= 0x0b,
534 .ts_mode
= TDA10046_TS_SERIAL
,
535 .xtal_freq
= TDA10046_XTAL_16M
,
536 .if_freq
= TDA10046_FREQ_045
,
537 .agc_config
= TDA10046_AGC_TDA827X
,
538 .gpio_config
= TDA10046_GPTRI
,
539 .request_firmware
= NULL
, /* uses firmware EEPROM */
542 /* tuner configurations */
543 static struct qt1010_config m920x_qt1010_config
= {
547 static struct mt2060_config m920x_mt2060_config
= {
548 .i2c_address
= 0x60, /* 0xc0 */
553 /* Callbacks for DVB USB */
554 static int m920x_mt352_frontend_attach(struct dvb_usb_adapter
*adap
)
556 deb("%s\n",__func__
);
558 adap
->fe_adap
[0].fe
= dvb_attach(mt352_attach
,
560 &adap
->dev
->i2c_adap
);
561 if ((adap
->fe_adap
[0].fe
) == NULL
)
567 static int m920x_mt352_frontend_attach_vp7049(struct dvb_usb_adapter
*adap
)
569 struct m920x_inits vp7049_fe_init_seq
[] = {
570 /* XXX without these commands the frontend cannot be detected,
571 * they must be sent BEFORE the frontend is attached */
583 { } /* terminating entry */
587 deb("%s\n", __func__
);
589 ret
= m920x_write_seq(adap
->dev
->udev
, M9206_CORE
, vp7049_fe_init_seq
);
591 deb("Initialization of vp7049 frontend failed.");
595 return m920x_mt352_frontend_attach(adap
);
598 static int m920x_tda10046_08_frontend_attach(struct dvb_usb_adapter
*adap
)
600 deb("%s\n",__func__
);
602 adap
->fe_adap
[0].fe
= dvb_attach(tda10046_attach
,
603 &m920x_tda10046_08_config
,
604 &adap
->dev
->i2c_adap
);
605 if ((adap
->fe_adap
[0].fe
) == NULL
)
611 static int m920x_tda10046_0b_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_0b_config
,
617 &adap
->dev
->i2c_adap
);
618 if ((adap
->fe_adap
[0].fe
) == NULL
)
624 static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter
*adap
)
626 deb("%s\n",__func__
);
628 if (dvb_attach(qt1010_attach
, adap
->fe_adap
[0].fe
, &adap
->dev
->i2c_adap
, &m920x_qt1010_config
) == NULL
)
634 static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter
*adap
)
636 deb("%s\n",__func__
);
638 if (dvb_attach(tda827x_attach
, adap
->fe_adap
[0].fe
, 0x60, &adap
->dev
->i2c_adap
, NULL
) == NULL
)
644 static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter
*adap
)
646 deb("%s\n",__func__
);
648 if (dvb_attach(tda827x_attach
, adap
->fe_adap
[0].fe
, 0x61, &adap
->dev
->i2c_adap
, NULL
) == NULL
)
654 static int m920x_fmd1216me_tuner_attach(struct dvb_usb_adapter
*adap
)
656 dvb_attach(simple_tuner_attach
, adap
->fe_adap
[0].fe
,
657 &adap
->dev
->i2c_adap
, 0x61,
658 TUNER_PHILIPS_FMD1216ME_MK3
);
662 static int m920x_mt2060_tuner_attach(struct dvb_usb_adapter
*adap
)
664 deb("%s\n", __func__
);
666 if (dvb_attach(mt2060_attach
, adap
->fe_adap
[0].fe
, &adap
->dev
->i2c_adap
,
667 &m920x_mt2060_config
, 1220) == NULL
)
674 /* device-specific initialization */
675 static struct m920x_inits megasky_rc_init
[] = {
676 { M9206_RC_INIT2
, 0xa8 },
677 { M9206_RC_INIT1
, 0x51 },
678 { } /* terminating entry */
681 static struct m920x_inits tvwalkertwin_rc_init
[] = {
682 { M9206_RC_INIT2
, 0x00 },
683 { M9206_RC_INIT1
, 0xef },
687 { } /* terminating entry */
690 static struct m920x_inits pinnacle310e_init
[] = {
691 /* without these the tuner doesn't work */
697 { M9206_RC_INIT1
, 0x00 },
698 { M9206_RC_INIT2
, 0xff },
699 { } /* terminating entry */
702 static struct m920x_inits vp7049_rc_init
[] = {
706 { M9206_RC_INIT2
, 0x00 },
707 { M9206_RC_INIT1
, 0xff },
708 { } /* terminating entry */
712 static struct rc_map_table rc_map_megasky_table
[] = {
713 { 0x0012, KEY_POWER
},
714 { 0x001e, KEY_CYCLEWINDOWS
}, /* min/max */
715 { 0x0002, KEY_CHANNELUP
},
716 { 0x0005, KEY_CHANNELDOWN
},
717 { 0x0003, KEY_VOLUMEUP
},
718 { 0x0006, KEY_VOLUMEDOWN
},
719 { 0x0004, KEY_MUTE
},
720 { 0x0007, KEY_OK
}, /* TS */
721 { 0x0008, KEY_STOP
},
722 { 0x0009, KEY_MENU
}, /* swap */
723 { 0x000a, KEY_REWIND
},
724 { 0x001b, KEY_PAUSE
},
725 { 0x001f, KEY_FASTFORWARD
},
726 { 0x000c, KEY_RECORD
},
727 { 0x000d, KEY_CAMERA
}, /* screenshot */
728 { 0x000e, KEY_COFFEE
}, /* "MTS" */
731 static struct rc_map_table rc_map_tvwalkertwin_table
[] = {
732 { 0x0001, KEY_ZOOM
}, /* Full Screen */
733 { 0x0002, KEY_CAMERA
}, /* snapshot */
734 { 0x0003, KEY_MUTE
},
735 { 0x0004, KEY_REWIND
},
736 { 0x0005, KEY_PLAYPAUSE
}, /* Play/Pause */
737 { 0x0006, KEY_FASTFORWARD
},
738 { 0x0007, KEY_RECORD
},
739 { 0x0008, KEY_STOP
},
740 { 0x0009, KEY_TIME
}, /* Timeshift */
741 { 0x000c, KEY_COFFEE
}, /* Recall */
742 { 0x000e, KEY_CHANNELUP
},
743 { 0x0012, KEY_POWER
},
744 { 0x0015, KEY_MENU
}, /* source */
745 { 0x0018, KEY_CYCLEWINDOWS
}, /* TWIN PIP */
746 { 0x001a, KEY_CHANNELDOWN
},
747 { 0x001b, KEY_VOLUMEDOWN
},
748 { 0x001e, KEY_VOLUMEUP
},
751 static struct rc_map_table rc_map_pinnacle310e_table
[] = {
753 { 0x17, KEY_FAVORITES
},
755 { 0x48, KEY_PROGRAM
}, /* preview */
757 { 0x04, KEY_LIST
}, /* record list */
768 { 0x0c, KEY_CANCEL
},
776 { 0x4f, KEY_ENTER
}, /* could also be KEY_OK */
777 { 0x1e, KEY_VOLUMEUP
},
778 { 0x0a, KEY_VOLUMEDOWN
},
779 { 0x05, KEY_CHANNELUP
},
780 { 0x02, KEY_CHANNELDOWN
},
781 { 0x11, KEY_RECORD
},
785 { 0x40, KEY_REWIND
},
786 { 0x12, KEY_FASTFORWARD
},
787 { 0x41, KEY_PREVIOUSSONG
}, /* Replay */
788 { 0x42, KEY_NEXTSONG
}, /* Skip */
789 { 0x54, KEY_CAMERA
}, /* Capture */
790 /* { 0x50, KEY_SAP }, */ /* Sap */
791 { 0x47, KEY_CYCLEWINDOWS
}, /* Pip */
792 { 0x4d, KEY_SCREEN
}, /* FullScreen */
793 { 0x08, KEY_SUBTITLE
},
795 /* { 0x49, KEY_LR }, */ /* L/R */
796 { 0x07, KEY_SLEEP
}, /* Hibernate */
797 { 0x08, KEY_VIDEO
}, /* A/V */
798 { 0x0e, KEY_MENU
}, /* Recall */
799 { 0x45, KEY_ZOOMIN
},
800 { 0x46, KEY_ZOOMOUT
},
801 { 0x18, KEY_RED
}, /* Red */
802 { 0x53, KEY_GREEN
}, /* Green */
803 { 0x5e, KEY_YELLOW
}, /* Yellow */
804 { 0x5f, KEY_BLUE
}, /* Blue */
807 /* DVB USB Driver stuff */
808 static struct dvb_usb_device_properties megasky_properties
;
809 static struct dvb_usb_device_properties digivox_mini_ii_properties
;
810 static struct dvb_usb_device_properties tvwalkertwin_properties
;
811 static struct dvb_usb_device_properties dposh_properties
;
812 static struct dvb_usb_device_properties pinnacle_pctv310e_properties
;
813 static struct dvb_usb_device_properties vp7049_properties
;
815 static int m920x_probe(struct usb_interface
*intf
,
816 const struct usb_device_id
*id
)
818 struct dvb_usb_device
*d
= NULL
;
820 struct m920x_inits
*rc_init_seq
= NULL
;
821 int bInterfaceNumber
= intf
->cur_altsetting
->desc
.bInterfaceNumber
;
823 deb("Probing for m920x device at interface %d\n", bInterfaceNumber
);
825 if (bInterfaceNumber
== 0) {
826 /* Single-tuner device, or first interface on
830 ret
= dvb_usb_device_init(intf
, &megasky_properties
,
831 THIS_MODULE
, &d
, adapter_nr
);
833 rc_init_seq
= megasky_rc_init
;
837 ret
= dvb_usb_device_init(intf
, &digivox_mini_ii_properties
,
838 THIS_MODULE
, &d
, adapter_nr
);
840 /* No remote control, so no rc_init_seq */
844 /* This configures both tuners on the TV Walker Twin */
845 ret
= dvb_usb_device_init(intf
, &tvwalkertwin_properties
,
846 THIS_MODULE
, &d
, adapter_nr
);
848 rc_init_seq
= tvwalkertwin_rc_init
;
852 ret
= dvb_usb_device_init(intf
, &dposh_properties
,
853 THIS_MODULE
, &d
, adapter_nr
);
855 /* Remote controller not supported yet. */
859 ret
= dvb_usb_device_init(intf
, &pinnacle_pctv310e_properties
,
860 THIS_MODULE
, &d
, adapter_nr
);
862 rc_init_seq
= pinnacle310e_init
;
866 ret
= dvb_usb_device_init(intf
, &vp7049_properties
,
867 THIS_MODULE
, &d
, adapter_nr
);
869 rc_init_seq
= vp7049_rc_init
;
875 /* Another interface on a multi-tuner device */
877 /* The LifeView TV Walker Twin gets here, but struct
878 * tvwalkertwin_properties already configured both
879 * tuners, so there is nothing for us to do here
884 if ((ret
= m920x_init_ep(intf
)) < 0)
887 if (d
&& (ret
= m920x_init(d
, rc_init_seq
)) != 0)
893 static struct usb_device_id m920x_table
[] = {
894 { USB_DEVICE(USB_VID_MSI
, USB_PID_MSI_MEGASKY580
) },
895 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC
,
896 USB_PID_MSI_DIGI_VOX_MINI_II
) },
897 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC
,
898 USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD
) },
899 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC
,
900 USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM
) },
901 { USB_DEVICE(USB_VID_DPOSH
, USB_PID_DPOSH_M9206_COLD
) },
902 { USB_DEVICE(USB_VID_DPOSH
, USB_PID_DPOSH_M9206_WARM
) },
903 { USB_DEVICE(USB_VID_VISIONPLUS
, USB_PID_PINNACLE_PCTV310E
) },
904 { USB_DEVICE(USB_VID_AZUREWAVE
, USB_PID_TWINHAN_VP7049
) },
905 { } /* Terminating entry */
907 MODULE_DEVICE_TABLE (usb
, m920x_table
);
909 static struct dvb_usb_device_properties megasky_properties
= {
910 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
912 .usb_ctrl
= DEVICE_SPECIFIC
,
913 .firmware
= "dvb-usb-megasky-02.fw",
914 .download_firmware
= m920x_firmware_download
,
918 .rc_map_table
= rc_map_megasky_table
,
919 .rc_map_size
= ARRAY_SIZE(rc_map_megasky_table
),
920 .rc_query
= m920x_rc_query
,
923 .size_of_priv
= sizeof(struct m920x_state
),
925 .identify_state
= m920x_identify_state
,
931 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
932 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
934 .pid_filter_count
= 8,
935 .pid_filter
= m920x_pid_filter
,
936 .pid_filter_ctrl
= m920x_pid_filter_ctrl
,
938 .frontend_attach
= m920x_mt352_frontend_attach
,
939 .tuner_attach
= m920x_qt1010_tuner_attach
,
953 .i2c_algo
= &m920x_i2c_algo
,
955 .num_device_descs
= 1,
957 { "MSI Mega Sky 580 DVB-T USB2.0",
958 { &m920x_table
[0], NULL
},
964 static struct dvb_usb_device_properties digivox_mini_ii_properties
= {
965 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
967 .usb_ctrl
= DEVICE_SPECIFIC
,
968 .firmware
= "dvb-usb-digivox-02.fw",
969 .download_firmware
= m920x_firmware_download
,
971 .size_of_priv
= sizeof(struct m920x_state
),
973 .identify_state
= m920x_identify_state
,
979 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
980 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
982 .pid_filter_count
= 8,
983 .pid_filter
= m920x_pid_filter
,
984 .pid_filter_ctrl
= m920x_pid_filter_ctrl
,
986 .frontend_attach
= m920x_tda10046_08_frontend_attach
,
987 .tuner_attach
= m920x_tda8275_60_tuner_attach
,
995 .buffersize
= 0x4000,
1001 .i2c_algo
= &m920x_i2c_algo
,
1003 .num_device_descs
= 1,
1005 { "MSI DIGI VOX mini II DVB-T USB2.0",
1006 { &m920x_table
[1], NULL
},
1012 /* LifeView TV Walker Twin support by Nick Andrew <nick@nick-andrew.net>
1014 * LifeView TV Walker Twin has 1 x M9206, 2 x TDA10046, 2 x TDA8275A
1015 * TDA10046 #0 is located at i2c address 0x08
1016 * TDA10046 #1 is located at i2c address 0x0b
1017 * TDA8275A #0 is located at i2c address 0x60
1018 * TDA8275A #1 is located at i2c address 0x61
1020 static struct dvb_usb_device_properties tvwalkertwin_properties
= {
1021 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1023 .usb_ctrl
= DEVICE_SPECIFIC
,
1024 .firmware
= "dvb-usb-tvwalkert.fw",
1025 .download_firmware
= m920x_firmware_download
,
1029 .rc_map_table
= rc_map_tvwalkertwin_table
,
1030 .rc_map_size
= ARRAY_SIZE(rc_map_tvwalkertwin_table
),
1031 .rc_query
= m920x_rc_query
,
1034 .size_of_priv
= sizeof(struct m920x_state
),
1036 .identify_state
= m920x_identify_state
,
1042 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
1043 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
1045 .pid_filter_count
= 8,
1046 .pid_filter
= m920x_pid_filter
,
1047 .pid_filter_ctrl
= m920x_pid_filter_ctrl
,
1049 .frontend_attach
= m920x_tda10046_08_frontend_attach
,
1050 .tuner_attach
= m920x_tda8275_60_tuner_attach
,
1066 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
1067 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
1069 .pid_filter_count
= 8,
1070 .pid_filter
= m920x_pid_filter
,
1071 .pid_filter_ctrl
= m920x_pid_filter_ctrl
,
1073 .frontend_attach
= m920x_tda10046_0b_frontend_attach
,
1074 .tuner_attach
= m920x_tda8275_61_tuner_attach
,
1088 .i2c_algo
= &m920x_i2c_algo
,
1090 .num_device_descs
= 1,
1092 { .name
= "LifeView TV Walker Twin DVB-T USB2.0",
1093 .cold_ids
= { &m920x_table
[2], NULL
},
1094 .warm_ids
= { &m920x_table
[3], NULL
},
1099 static struct dvb_usb_device_properties dposh_properties
= {
1100 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1102 .usb_ctrl
= DEVICE_SPECIFIC
,
1103 .firmware
= "dvb-usb-dposh-01.fw",
1104 .download_firmware
= m920x_firmware_download
,
1106 .size_of_priv
= sizeof(struct m920x_state
),
1108 .identify_state
= m920x_identify_state
,
1113 /* Hardware pid filters don't work with this device/firmware */
1115 .frontend_attach
= m920x_mt352_frontend_attach
,
1116 .tuner_attach
= m920x_qt1010_tuner_attach
,
1130 .i2c_algo
= &m920x_i2c_algo
,
1132 .num_device_descs
= 1,
1134 { .name
= "Dposh DVB-T USB2.0",
1135 .cold_ids
= { &m920x_table
[4], NULL
},
1136 .warm_ids
= { &m920x_table
[5], NULL
},
1141 static struct dvb_usb_device_properties pinnacle_pctv310e_properties
= {
1142 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1144 .usb_ctrl
= DEVICE_SPECIFIC
,
1145 .download_firmware
= NULL
,
1149 .rc_map_table
= rc_map_pinnacle310e_table
,
1150 .rc_map_size
= ARRAY_SIZE(rc_map_pinnacle310e_table
),
1151 .rc_query
= m920x_rc_query
,
1154 .size_of_priv
= sizeof(struct m920x_state
),
1156 .identify_state
= m920x_identify_state
,
1162 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
1163 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
1165 .pid_filter_count
= 8,
1166 .pid_filter
= m920x_pid_filter
,
1167 .pid_filter_ctrl
= m920x_pid_filter_ctrl
,
1169 .frontend_attach
= m920x_mt352_frontend_attach
,
1170 .tuner_attach
= m920x_fmd1216me_tuner_attach
,
1178 .framesperurb
= 128,
1186 .i2c_algo
= &m920x_i2c_algo
,
1188 .num_device_descs
= 1,
1190 { "Pinnacle PCTV 310e",
1191 { &m920x_table
[6], NULL
},
1197 static struct dvb_usb_device_properties vp7049_properties
= {
1198 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1200 .usb_ctrl
= DEVICE_SPECIFIC
,
1201 .firmware
= "dvb-usb-vp7049-0.95.fw",
1202 .download_firmware
= m920x_firmware_download
,
1206 .rc_codes
= RC_MAP_TWINHAN_VP1027_DVBS
,
1207 .rc_query
= m920x_rc_core_query
,
1208 .allowed_protos
= RC_PROTO_BIT_UNKNOWN
,
1211 .size_of_priv
= sizeof(struct m920x_state
),
1213 .identify_state
= m920x_identify_state
,
1219 .caps
= DVB_USB_ADAP_HAS_PID_FILTER
|
1220 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF
,
1222 .pid_filter_count
= 8,
1223 .pid_filter
= m920x_pid_filter
,
1224 .pid_filter_ctrl
= m920x_pid_filter_ctrl
,
1226 .frontend_attach
= m920x_mt352_frontend_attach_vp7049
,
1227 .tuner_attach
= m920x_mt2060_tuner_attach
,
1241 .i2c_algo
= &m920x_i2c_algo
,
1243 .num_device_descs
= 1,
1245 { "DTV-DVB UDTT7049",
1246 { &m920x_table
[7], NULL
},
1252 static struct usb_driver m920x_driver
= {
1253 .name
= "dvb_usb_m920x",
1254 .probe
= m920x_probe
,
1255 .disconnect
= dvb_usb_device_exit
,
1256 .id_table
= m920x_table
,
1259 module_usb_driver(m920x_driver
);
1261 MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>");
1262 MODULE_DESCRIPTION("DVB Driver for ULI M920x");
1263 MODULE_VERSION("0.1");
1264 MODULE_LICENSE("GPL");