blob: fd9d19b9cf2d29b3d91be3b073ef761a7781842b [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 */
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300134static int m9206_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
135{
136 struct dvb_usb_device *d = i2c_get_adapdata(adap);
137 int i;
138 int ret = 0;
139
140 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
141 return -EAGAIN;
142
143 if (num > 2)
144 return -EINVAL;
145
146 for (i = 0; i < num; i++) {
147 u8 w_len;
148
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300149 if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].addr, 0x80)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300150 goto unlock;
151
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300152 if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].buf[0], 0x0)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300153 goto unlock;
154
155 if (i + 1 < num && msg[i + 1].flags & I2C_M_RD) {
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300156 /* Possibly device dependant */
157 if (msg[i].addr == d->adapter[0].pll_addr)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300158 w_len = 0xc5;
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300159 else
160 w_len = 0x1f;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300161
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300162 if ((ret = m9206_write(d->udev, M9206_I2C, w_len, 0x80)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300163 goto unlock;
164
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300165 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 -0300166 goto unlock;
167
168 i++;
169 } else {
170 if (msg[i].len != 2)
171 return -EINVAL;
172
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300173 if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].buf[1], 0x40)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300174 goto unlock;
175 }
176 }
177 ret = i;
178 unlock:
179 mutex_unlock(&d->i2c_mutex);
180
181 return ret;
182}
183
184static u32 m9206_i2c_func(struct i2c_adapter *adapter)
185{
186 return I2C_FUNC_I2C;
187}
188
189static struct i2c_algorithm m9206_i2c_algo = {
190 .master_xfer = m9206_i2c_xfer,
191 .functionality = m9206_i2c_func,
192};
193
194/* Callbacks for DVB USB */
Michael Krufky2a2bfa72006-09-23 20:13:12 -0300195static int megasky_identify_state(struct usb_device *udev,
196 struct dvb_usb_device_properties *props,
197 struct dvb_usb_device_description **desc,
198 int *cold)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300199{
200 struct usb_host_interface *alt;
201
202 alt = usb_altnum_to_altsetting(usb_ifnum_to_if(udev, 0), 1);
203 *cold = (alt == NULL) ? 1 : 0;
204
205 return 0;
206}
207
208static int megasky_mt352_demod_init(struct dvb_frontend *fe)
209{
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300210 u8 config[] = { CONFIG, 0x3d };
211 u8 clock[] = { CLOCK_CTL, 0x30 };
212 u8 reset[] = { RESET, 0x80 };
213 u8 adc_ctl[] = { ADC_CTL_1, 0x40 };
214 u8 agc[] = { AGC_TARGET, 0x1c, 0x20 };
215 u8 sec_agc[] = { 0x69, 0x00, 0xff, 0xff, 0x40, 0xff, 0x00, 0x40, 0x40 };
216 u8 unk1[] = { 0x93, 0x1a };
217 u8 unk2[] = { 0xb5, 0x7a };
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300218
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300219 mt352_write(fe, config, ARRAY_SIZE(config));
220 mt352_write(fe, clock, ARRAY_SIZE(clock));
221 mt352_write(fe, reset, ARRAY_SIZE(reset));
222 mt352_write(fe, adc_ctl, ARRAY_SIZE(adc_ctl));
223 mt352_write(fe, agc, ARRAY_SIZE(agc));
224 mt352_write(fe, sec_agc, ARRAY_SIZE(sec_agc));
225 mt352_write(fe, unk1, ARRAY_SIZE(unk1));
226 mt352_write(fe, unk2, ARRAY_SIZE(unk2));
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300227
228 deb_rc("Demod init!\n");
229
230 return 0;
231}
232
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300233static struct mt352_config megasky_mt352_config = {
234 .demod_address = 0x1e,
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300235 .no_tuner = 1,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300236 .demod_init = megasky_mt352_demod_init,
237};
238
Michael Krufky01cb34d2006-09-23 20:01:29 -0300239static int megasky_frontend_attach(struct dvb_usb_adapter *adap)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300240{
241 deb_rc("megasky_frontend_attach!\n");
242
Patrick Boettcher94a47dc2006-09-28 13:48:03 -0300243 if ((adap->fe = dvb_attach(mt352_attach, &megasky_mt352_config, &adap->dev->i2c_adap)) != NULL)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300244 return 0;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300245 return -EIO;
246}
247
Michael Krufky26f48ea2006-09-28 01:46:49 -0300248static int m9206_set_filter(struct dvb_usb_adapter *adap, int type, int idx, int pid)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300249{
250 int ret = 0;
251
252 if (pid >= 0x8000)
253 return -EINVAL;
254
255 pid |= 0x8000;
256
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300257 if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300258 return ret;
259
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300260 if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0)
261 return ret;
262
263 return ret;
264}
265
266static int m9206_update_filters(struct dvb_usb_adapter *adap)
267{
268 struct m9206_state *m = adap->dev->priv;
269 int enabled = m->filtering_enabled;
270 int i, ret = 0, filter = 0;
271
272 for (i = 0; i < M9206_MAX_FILTERS; i++)
273 if (m->filters[i] == 8192)
274 enabled = 0;
275
276 /* Disable all filters */
Michael Krufky26f48ea2006-09-28 01:46:49 -0300277 if ((ret = m9206_set_filter(adap, 0x81, 1, enabled)) != 0)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300278 return ret;
279
280 for (i = 0; i < M9206_MAX_FILTERS; i++)
Michael Krufky26f48ea2006-09-28 01:46:49 -0300281 if ((ret = m9206_set_filter(adap, 0x81, i + 2, 0)) != 0)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300282 return ret;
283
Michael Krufky26f48ea2006-09-28 01:46:49 -0300284 if ((ret = m9206_set_filter(adap, 0x82, 0, 0x0)) != 0)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300285 return ret;
286
287 /* Set */
288 if (enabled) {
289 for (i = 0; i < M9206_MAX_FILTERS; i++) {
290 if (m->filters[i] == 0)
291 continue;
292
Michael Krufky26f48ea2006-09-28 01:46:49 -0300293 if ((ret = m9206_set_filter(adap, 0x81, filter + 2, m->filters[i])) != 0)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300294 return ret;
295
296 filter++;
297 }
298 }
299
Michael Krufky26f48ea2006-09-28 01:46:49 -0300300 if ((ret = m9206_set_filter(adap, 0x82, 0, 0x02f5)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300301 return ret;
302
303 return ret;
304}
305
Michael Krufky01cb34d2006-09-23 20:01:29 -0300306static int m9206_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300307{
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300308 struct m9206_state *m = adap->dev->priv;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300309
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300310 m->filtering_enabled = onoff ? 1 : 0;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300311
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300312 return m9206_update_filters(adap);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300313}
314
Michael Krufky01cb34d2006-09-23 20:01:29 -0300315static int m9206_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300316{
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300317 struct m9206_state *m = adap->dev->priv;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300318
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300319 m->filters[index] = onoff ? pid : 0;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300320
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300321 return m9206_update_filters(adap);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300322}
323
324static int m9206_firmware_download(struct usb_device *udev, const struct firmware *fw)
325{
326 u16 value, index, size;
327 u8 read[4], *buff;
328 int i, pass, ret = 0;
329
330 buff = kmalloc(65536, GFP_KERNEL);
331
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300332 if ((ret = m9206_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300333 goto done;
334 deb_rc("%x %x %x %x\n", read[0], read[1], read[2], read[3]);
335
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300336 if ((ret = m9206_read(udev, M9206_FW, 0x0, 0x0, read, 1)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300337 goto done;
338 deb_rc("%x\n", read[0]);
339
340 for (pass = 0; pass < 2; pass++) {
341 for (i = 0; i + (sizeof(u16) * 3) < fw->size;) {
342 value = le16_to_cpu(*(u16 *)(fw->data + i));
343 i += sizeof(u16);
344
345 index = le16_to_cpu(*(u16 *)(fw->data + i));
346 i += sizeof(u16);
347
348 size = le16_to_cpu(*(u16 *)(fw->data + i));
349 i += sizeof(u16);
350
351 if (pass == 1) {
352 /* Will stall if using fw->data ... */
353 memcpy(buff, fw->data + i, size);
354
355 ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0),
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300356 M9206_FW,
357 USB_TYPE_VENDOR | USB_DIR_OUT,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300358 value, index, buff, size, 20);
359 if (ret != size) {
360 deb_rc("error while uploading fw!\n");
361 ret = -EIO;
362 goto done;
363 }
364 msleep(3);
365 }
366 i += size;
367 }
368 if (i != fw->size) {
369 ret = -EINVAL;
370 goto done;
371 }
372 }
373
374 msleep(36);
375
376 /* m9206 will disconnect itself from the bus after this. */
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300377 (void) m9206_write(udev, M9206_CORE, 0x01, M9206_FW_GO);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300378 deb_rc("firmware uploaded!\n");
379
380 done:
381 kfree(buff);
382
383 return ret;
384}
385
Antti Palosaaricbdc80e2007-01-21 15:56:10 -0300386static struct qt1010_config megasky_qt1010_config = {
387 .i2c_address = 0xc4
388};
389
390static int megasky_tuner_attach(struct dvb_usb_adapter *adap)
391{
392 return dvb_attach(qt1010_attach,
393 adap->fe, &adap->dev->i2c_adap,
394 &megasky_qt1010_config) == NULL ? -ENODEV : 0;
395}
396
Michael Krufky26f48ea2006-09-28 01:46:49 -0300397/* DVB USB Driver stuff */
398static struct dvb_usb_device_properties megasky_properties;
399
400static int m920x_probe(struct usb_interface *intf, const struct usb_device_id *id)
401{
402 struct dvb_usb_device *d;
403 struct usb_host_interface *alt;
404 int ret;
405
406 if ((ret = dvb_usb_device_init(intf, &megasky_properties, THIS_MODULE, &d)) == 0) {
407 deb_rc("probed!\n");
408
409 alt = usb_altnum_to_altsetting(intf, 1);
410 if (alt == NULL) {
411 deb_rc("not alt found!\n");
412 return -ENODEV;
413 }
414
415 ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber, alt->desc.bAlternateSetting);
416 if (ret < 0)
417 return ret;
418
419 deb_rc("Changed to alternate setting!\n");
420
421 if ((ret = m9206_rc_init(d->udev)) != 0)
422 return ret;
423 }
424 return ret;
425}
426
427static struct usb_device_id m920x_table [] = {
428 { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580) },
429 { } /* Terminating entry */
430};
431MODULE_DEVICE_TABLE (usb, m920x_table);
432
Michael Krufky01cb34d2006-09-23 20:01:29 -0300433static struct dvb_usb_device_properties megasky_properties = {
Michael Krufky1f61f3b2006-10-07 15:03:04 -0300434 .caps = DVB_USB_IS_AN_I2C_ADAPTER | DVB_USB_ADAP_HAS_PID_FILTER |
435 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
436
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300437 .usb_ctrl = DEVICE_SPECIFIC,
438 .firmware = "dvb-usb-megasky-02.fw",
439 .download_firmware = m9206_firmware_download,
440
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300441 .rc_interval = 100,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300442 .rc_key_map = megasky_rc_keys,
443 .rc_key_map_size = ARRAY_SIZE(megasky_rc_keys),
444 .rc_query = m9206_rc_query,
445
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300446 .size_of_priv = sizeof(struct m9206_state),
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300447
448 .identify_state = megasky_identify_state,
Michael Krufky01cb34d2006-09-23 20:01:29 -0300449 .num_adapters = 1,
450 .adapter = {{
Michael Krufky01cb34d2006-09-23 20:01:29 -0300451 .pid_filter_count = 8,
452 .pid_filter = m9206_pid_filter,
453 .pid_filter_ctrl = m9206_pid_filter_ctrl,
454
455 .frontend_attach = megasky_frontend_attach,
Antti Palosaaricbdc80e2007-01-21 15:56:10 -0300456 .tuner_attach = megasky_tuner_attach,
Michael Krufky01cb34d2006-09-23 20:01:29 -0300457
458 .stream = {
459 .type = USB_BULK,
460 .count = 8,
461 .endpoint = 0x81,
462 .u = {
463 .bulk = {
464 .buffersize = 512,
465 }
466 }
467 },
468 }},
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300469 .i2c_algo = &m9206_i2c_algo,
470
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300471 .num_device_descs = 1,
472 .devices = {
473 { "MSI Mega Sky 580 DVB-T USB2.0",
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300474 { &m920x_table[0], NULL },
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300475 { NULL },
476 },
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300477 }
478};
479
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300480static struct usb_driver m920x_driver = {
481 .name = "dvb_usb_m920x",
Michael Krufky2a2bfa72006-09-23 20:13:12 -0300482 .probe = m920x_probe,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300483 .disconnect = dvb_usb_device_exit,
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300484 .id_table = m920x_table,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300485};
486
487/* module stuff */
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300488static int __init m920x_module_init(void)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300489{
490 int ret;
491
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300492 if ((ret = usb_register(&m920x_driver))) {
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300493 err("usb_register failed. Error number %d", ret);
494 return ret;
495 }
496
497 return 0;
498}
499
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300500static void __exit m920x_module_exit(void)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300501{
502 /* deregister this driver from the USB subsystem */
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300503 usb_deregister(&m920x_driver);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300504}
505
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300506module_init (m920x_module_init);
507module_exit (m920x_module_exit);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300508
509MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>");
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300510MODULE_DESCRIPTION("Driver MSI Mega Sky 580 DVB-T USB2.0 / Uli m920x");
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300511MODULE_VERSION("0.1");
512MODULE_LICENSE("GPL");