blob: 14b32ff40ed5bc65643fa8e8f7ce208ac2a6a925 [file] [log] [blame]
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -03001/* DVB USB compliant linux driver for MSI Mega Sky 580 DVB-T USB2.0 receiver
2 *
3 * Copyright (C) 2006 Aapo Tahkola (aet@rasterburn.org)
4 *
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 Free
7 * Software Foundation, version 2.
8 *
9 * see Documentation/dvb/README.dvb-usb for more information
10 */
Michael Krufkybaa2ed02006-09-23 20:01:29 -030011
Michael Krufky2aef7d02006-09-23 20:00:42 -030012#include "m920x.h"
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030013
14#include "mt352.h"
15#include "mt352_priv.h"
Michael Krufky017cf012006-09-23 20:40:20 -030016#include "qt1010.h"
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030017
18/* debug */
Michael Krufky26f48ea2006-09-28 01:46:49 -030019static int dvb_usb_m920x_debug;
Michael Krufkybaa2ed02006-09-23 20:01:29 -030020module_param_named(debug,dvb_usb_m920x_debug, int, 0644);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030021MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
22
23static struct dvb_usb_rc_key megasky_rc_keys [] = {
24 { 0x0, 0x12, KEY_POWER },
25 { 0x0, 0x1e, KEY_CYCLEWINDOWS }, /* min/max */
26 { 0x0, 0x02, KEY_CHANNELUP },
27 { 0x0, 0x05, KEY_CHANNELDOWN },
28 { 0x0, 0x03, KEY_VOLUMEUP },
29 { 0x0, 0x06, KEY_VOLUMEDOWN },
30 { 0x0, 0x04, KEY_MUTE },
31 { 0x0, 0x07, KEY_OK }, /* TS */
32 { 0x0, 0x08, KEY_STOP },
33 { 0x0, 0x09, KEY_MENU }, /* swap */
34 { 0x0, 0x0a, KEY_REWIND },
35 { 0x0, 0x1b, KEY_PAUSE },
36 { 0x0, 0x1f, KEY_FASTFORWARD },
37 { 0x0, 0x0c, KEY_RECORD },
38 { 0x0, 0x0d, KEY_CAMERA }, /* screenshot */
39 { 0x0, 0x0e, KEY_COFFEE }, /* "MTS" */
40};
41
42static inline int m9206_read(struct usb_device *udev, u8 request, u16 value, u16 index, void *data, int size)
43{
44 int ret;
45
46 ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
47 request, USB_TYPE_VENDOR | USB_DIR_IN,
48 value, index, data, size, 2000);
49 if (ret < 0)
50 return ret;
51
52 if (ret != size)
53 return -EIO;
54
55 return 0;
56}
57
58static inline int m9206_write(struct usb_device *udev, u8 request, u16 value, u16 index)
59{
60 int ret;
61
62 ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
63 request, USB_TYPE_VENDOR | USB_DIR_OUT,
64 value, index, NULL, 0, 2000);
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -030065 return ret;
66}
67
68static int m9206_rc_init(struct usb_device *udev)
69{
70 int ret = 0;
71
72 /* Remote controller init. */
73 if ((ret = m9206_write(udev, M9206_CORE, 0xa8, M9206_RC_INIT2)) != 0)
74 return ret;
75
76 if ((ret = m9206_write(udev, M9206_CORE, 0x51, M9206_RC_INIT1)) != 0)
77 return ret;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030078
79 return ret;
80}
81
82static int m9206_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
83{
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -030084 struct m9206_state *m = d->priv;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030085 int i, ret = 0;
86 u8 rc_state[2];
87
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030088
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -030089 if ((ret = m9206_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030090 goto unlock;
91
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -030092 if ((ret = m9206_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -030093 goto unlock;
94
95 for (i = 0; i < ARRAY_SIZE(megasky_rc_keys); i++)
96 if (megasky_rc_keys[i].data == rc_state[1]) {
97 *event = megasky_rc_keys[i].event;
98
99 switch(rc_state[0]) {
100 case 0x80:
101 *state = REMOTE_NO_KEY_PRESSED;
102 goto unlock;
103
104 case 0x93:
105 case 0x92:
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300106 m->rep_count = 0;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300107 *state = REMOTE_KEY_PRESSED;
108 goto unlock;
109
110 case 0x91:
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300111 /* For comfort. */
112 if (++m->rep_count > 2)
113 *state = REMOTE_KEY_REPEAT;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300114 goto unlock;
115
116 default:
117 deb_rc("Unexpected rc response %x\n", rc_state[0]);
118 *state = REMOTE_NO_KEY_PRESSED;
119 goto unlock;
120 }
121 }
122
123 if (rc_state[1] != 0)
124 deb_rc("Unknown rc key %x\n", rc_state[1]);
125
126 *state = REMOTE_NO_KEY_PRESSED;
127
128 unlock:
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300129
130 return ret;
131}
132
133/* I2C */
134
135static int m9206_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
136{
137 struct dvb_usb_device *d = i2c_get_adapdata(adap);
138 int i;
139 int ret = 0;
140
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300141 /* Need to access d->adapter[0] */
142 if (d->num_adapters_initialized != 1) {
143 deb_rc("Impossible happened!\n");
144 return -EINVAL;
145 }
146
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300147 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
148 return -EAGAIN;
149
150 if (num > 2)
151 return -EINVAL;
152
153 for (i = 0; i < num; i++) {
154 u8 w_len;
155
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300156 if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].addr, 0x80)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300157 goto unlock;
158
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300159 if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].buf[0], 0x0)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300160 goto unlock;
161
162 if (i + 1 < num && msg[i + 1].flags & I2C_M_RD) {
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300163 /* Possibly device dependant */
164 if (msg[i].addr == d->adapter[0].pll_addr)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300165 w_len = 0xc5;
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300166 else
167 w_len = 0x1f;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300168
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300169 if ((ret = m9206_write(d->udev, M9206_I2C, w_len, 0x80)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300170 goto unlock;
171
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300172 if ((ret = m9206_read(d->udev, M9206_I2C, 0x0, 0x60, msg[i + 1].buf, msg[i + 1].len)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300173 goto unlock;
174
175 i++;
176 } else {
177 if (msg[i].len != 2)
178 return -EINVAL;
179
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300180 if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].buf[1], 0x40)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300181 goto unlock;
182 }
183 }
184 ret = i;
185 unlock:
186 mutex_unlock(&d->i2c_mutex);
187
188 return ret;
189}
190
191static u32 m9206_i2c_func(struct i2c_adapter *adapter)
192{
193 return I2C_FUNC_I2C;
194}
195
196static struct i2c_algorithm m9206_i2c_algo = {
197 .master_xfer = m9206_i2c_xfer,
198 .functionality = m9206_i2c_func,
199};
200
201/* Callbacks for DVB USB */
Michael Krufky2a2bfa72006-09-23 20:13:12 -0300202static int megasky_identify_state(struct usb_device *udev,
203 struct dvb_usb_device_properties *props,
204 struct dvb_usb_device_description **desc,
205 int *cold)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300206{
207 struct usb_host_interface *alt;
208
209 alt = usb_altnum_to_altsetting(usb_ifnum_to_if(udev, 0), 1);
210 *cold = (alt == NULL) ? 1 : 0;
211
212 return 0;
213}
214
215static int megasky_mt352_demod_init(struct dvb_frontend *fe)
216{
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300217 u8 config[] = { CONFIG, 0x3d };
218 u8 clock[] = { CLOCK_CTL, 0x30 };
219 u8 reset[] = { RESET, 0x80 };
220 u8 adc_ctl[] = { ADC_CTL_1, 0x40 };
221 u8 agc[] = { AGC_TARGET, 0x1c, 0x20 };
222 u8 sec_agc[] = { 0x69, 0x00, 0xff, 0xff, 0x40, 0xff, 0x00, 0x40, 0x40 };
223 u8 unk1[] = { 0x93, 0x1a };
224 u8 unk2[] = { 0xb5, 0x7a };
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300225
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300226 mt352_write(fe, config, ARRAY_SIZE(config));
227 mt352_write(fe, clock, ARRAY_SIZE(clock));
228 mt352_write(fe, reset, ARRAY_SIZE(reset));
229 mt352_write(fe, adc_ctl, ARRAY_SIZE(adc_ctl));
230 mt352_write(fe, agc, ARRAY_SIZE(agc));
231 mt352_write(fe, sec_agc, ARRAY_SIZE(sec_agc));
232 mt352_write(fe, unk1, ARRAY_SIZE(unk1));
233 mt352_write(fe, unk2, ARRAY_SIZE(unk2));
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300234
235 deb_rc("Demod init!\n");
236
237 return 0;
238}
239
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300240static struct mt352_config megasky_mt352_config = {
241 .demod_address = 0x1e,
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300242 .no_tuner = 1,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300243 .demod_init = megasky_mt352_demod_init,
244};
245
Michael Krufky01cb34d2006-09-23 20:01:29 -0300246static int megasky_frontend_attach(struct dvb_usb_adapter *adap)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300247{
248 deb_rc("megasky_frontend_attach!\n");
249
Michael Krufky01cb34d2006-09-23 20:01:29 -0300250 if ((adap->fe = dvb_attach(mt352_attach, &megasky_mt352_config, &adap->dev->i2c_adap)) != NULL) {
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300251 return 0;
252 }
253 return -EIO;
254}
255
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300256static int megasky_tuner_attach(struct dvb_usb_adapter *adap)
257{
258 adap->pll_addr = 0xc4;
259 adap->pll_desc = NULL;
260 adap->fe->ops.tuner_ops.set_params = qt1010_set_params;
261
262 return 0;
263}
264
Michael Krufky26f48ea2006-09-28 01:46:49 -0300265static int m9206_set_filter(struct dvb_usb_adapter *adap, int type, int idx, int pid)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300266{
267 int ret = 0;
268
269 if (pid >= 0x8000)
270 return -EINVAL;
271
272 pid |= 0x8000;
273
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300274 if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300275 return ret;
276
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300277 if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0)
278 return ret;
279
280 return ret;
281}
282
283static int m9206_update_filters(struct dvb_usb_adapter *adap)
284{
285 struct m9206_state *m = adap->dev->priv;
286 int enabled = m->filtering_enabled;
287 int i, ret = 0, filter = 0;
288
289 for (i = 0; i < M9206_MAX_FILTERS; i++)
290 if (m->filters[i] == 8192)
291 enabled = 0;
292
293 /* Disable all filters */
Michael Krufky26f48ea2006-09-28 01:46:49 -0300294 if ((ret = m9206_set_filter(adap, 0x81, 1, enabled)) != 0)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300295 return ret;
296
297 for (i = 0; i < M9206_MAX_FILTERS; i++)
Michael Krufky26f48ea2006-09-28 01:46:49 -0300298 if ((ret = m9206_set_filter(adap, 0x81, i + 2, 0)) != 0)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300299 return ret;
300
Michael Krufky26f48ea2006-09-28 01:46:49 -0300301 if ((ret = m9206_set_filter(adap, 0x82, 0, 0x0)) != 0)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300302 return ret;
303
304 /* Set */
305 if (enabled) {
306 for (i = 0; i < M9206_MAX_FILTERS; i++) {
307 if (m->filters[i] == 0)
308 continue;
309
Michael Krufky26f48ea2006-09-28 01:46:49 -0300310 if ((ret = m9206_set_filter(adap, 0x81, filter + 2, m->filters[i])) != 0)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300311 return ret;
312
313 filter++;
314 }
315 }
316
Michael Krufky26f48ea2006-09-28 01:46:49 -0300317 if ((ret = m9206_set_filter(adap, 0x82, 0, 0x02f5)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300318 return ret;
319
320 return ret;
321}
322
Michael Krufky01cb34d2006-09-23 20:01:29 -0300323static int m9206_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300324{
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300325 struct m9206_state *m = adap->dev->priv;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300326
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300327 m->filtering_enabled = onoff ? 1 : 0;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300328
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300329 return m9206_update_filters(adap);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300330}
331
Michael Krufky01cb34d2006-09-23 20:01:29 -0300332static int m9206_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300333{
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300334 struct m9206_state *m = adap->dev->priv;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300335
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300336 m->filters[index] = onoff ? pid : 0;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300337
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300338 return m9206_update_filters(adap);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300339}
340
341static int m9206_firmware_download(struct usb_device *udev, const struct firmware *fw)
342{
343 u16 value, index, size;
344 u8 read[4], *buff;
345 int i, pass, ret = 0;
346
347 buff = kmalloc(65536, GFP_KERNEL);
348
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300349 if ((ret = m9206_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300350 goto done;
351 deb_rc("%x %x %x %x\n", read[0], read[1], read[2], read[3]);
352
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300353 if ((ret = m9206_read(udev, M9206_FW, 0x0, 0x0, read, 1)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300354 goto done;
355 deb_rc("%x\n", read[0]);
356
357 for (pass = 0; pass < 2; pass++) {
358 for (i = 0; i + (sizeof(u16) * 3) < fw->size;) {
359 value = le16_to_cpu(*(u16 *)(fw->data + i));
360 i += sizeof(u16);
361
362 index = le16_to_cpu(*(u16 *)(fw->data + i));
363 i += sizeof(u16);
364
365 size = le16_to_cpu(*(u16 *)(fw->data + i));
366 i += sizeof(u16);
367
368 if (pass == 1) {
369 /* Will stall if using fw->data ... */
370 memcpy(buff, fw->data + i, size);
371
372 ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0),
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300373 M9206_FW,
374 USB_TYPE_VENDOR | USB_DIR_OUT,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300375 value, index, buff, size, 20);
376 if (ret != size) {
377 deb_rc("error while uploading fw!\n");
378 ret = -EIO;
379 goto done;
380 }
381 msleep(3);
382 }
383 i += size;
384 }
385 if (i != fw->size) {
386 ret = -EINVAL;
387 goto done;
388 }
389 }
390
391 msleep(36);
392
393 /* m9206 will disconnect itself from the bus after this. */
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300394 (void) m9206_write(udev, M9206_CORE, 0x01, M9206_FW_GO);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300395 deb_rc("firmware uploaded!\n");
396
397 done:
398 kfree(buff);
399
400 return ret;
401}
402
Michael Krufky26f48ea2006-09-28 01:46:49 -0300403/* DVB USB Driver stuff */
404static struct dvb_usb_device_properties megasky_properties;
405
406static int m920x_probe(struct usb_interface *intf, const struct usb_device_id *id)
407{
408 struct dvb_usb_device *d;
409 struct usb_host_interface *alt;
410 int ret;
411
412 if ((ret = dvb_usb_device_init(intf, &megasky_properties, THIS_MODULE, &d)) == 0) {
413 deb_rc("probed!\n");
414
415 alt = usb_altnum_to_altsetting(intf, 1);
416 if (alt == NULL) {
417 deb_rc("not alt found!\n");
418 return -ENODEV;
419 }
420
421 ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber, alt->desc.bAlternateSetting);
422 if (ret < 0)
423 return ret;
424
425 deb_rc("Changed to alternate setting!\n");
426
427 if ((ret = m9206_rc_init(d->udev)) != 0)
428 return ret;
429 }
430 return ret;
431}
432
433static struct usb_device_id m920x_table [] = {
434 { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580) },
435 { } /* Terminating entry */
436};
437MODULE_DEVICE_TABLE (usb, m920x_table);
438
Michael Krufky01cb34d2006-09-23 20:01:29 -0300439static struct dvb_usb_device_properties megasky_properties = {
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300440 .usb_ctrl = DEVICE_SPECIFIC,
441 .firmware = "dvb-usb-megasky-02.fw",
442 .download_firmware = m9206_firmware_download,
443
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300444 .rc_interval = 100,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300445 .rc_key_map = megasky_rc_keys,
446 .rc_key_map_size = ARRAY_SIZE(megasky_rc_keys),
447 .rc_query = m9206_rc_query,
448
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300449 .size_of_priv = sizeof(struct m9206_state),
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300450
451 .identify_state = megasky_identify_state,
Michael Krufky01cb34d2006-09-23 20:01:29 -0300452 .num_adapters = 1,
453 .adapter = {{
Michael Krufky26f48ea2006-09-28 01:46:49 -0300454 .caps = DVB_USB_IS_AN_I2C_ADAPTER | DVB_USB_ADAP_HAS_PID_FILTER |
455 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
456
Michael Krufky01cb34d2006-09-23 20:01:29 -0300457 .pid_filter_count = 8,
458 .pid_filter = m9206_pid_filter,
459 .pid_filter_ctrl = m9206_pid_filter_ctrl,
460
461 .frontend_attach = megasky_frontend_attach,
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300462 .tuner_attach = megasky_tuner_attach,
Michael Krufky01cb34d2006-09-23 20:01:29 -0300463
464 .stream = {
465 .type = USB_BULK,
466 .count = 8,
467 .endpoint = 0x81,
468 .u = {
469 .bulk = {
470 .buffersize = 512,
471 }
472 }
473 },
474 }},
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300475 .i2c_algo = &m9206_i2c_algo,
476
477 .generic_bulk_ctrl_endpoint = 0x01,
Michael Krufky01cb34d2006-09-23 20:01:29 -0300478
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300479 .num_device_descs = 1,
480 .devices = {
481 { "MSI Mega Sky 580 DVB-T USB2.0",
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300482 { &m920x_table[0], NULL },
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300483 { NULL },
484 },
485 { NULL },
486 }
487};
488
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300489static struct usb_driver m920x_driver = {
490 .name = "dvb_usb_m920x",
Michael Krufky2a2bfa72006-09-23 20:13:12 -0300491 .probe = m920x_probe,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300492 .disconnect = dvb_usb_device_exit,
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300493 .id_table = m920x_table,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300494};
495
496/* module stuff */
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300497static int __init m920x_module_init(void)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300498{
499 int ret;
500
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300501 if ((ret = usb_register(&m920x_driver))) {
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300502 err("usb_register failed. Error number %d", ret);
503 return ret;
504 }
505
506 return 0;
507}
508
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300509static void __exit m920x_module_exit(void)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300510{
511 /* deregister this driver from the USB subsystem */
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300512 usb_deregister(&m920x_driver);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300513}
514
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300515module_init (m920x_module_init);
516module_exit (m920x_module_exit);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300517
518MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>");
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300519MODULE_DESCRIPTION("Driver MSI Mega Sky 580 DVB-T USB2.0 / Uli m920x");
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300520MODULE_VERSION("0.1");
521MODULE_LICENSE("GPL");