blob: ba5332676b4984fe0ae484ee3eded05165790a46 [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
141 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
142 return -EAGAIN;
143
144 if (num > 2)
145 return -EINVAL;
146
147 for (i = 0; i < num; i++) {
148 u8 w_len;
149
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300150 if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].addr, 0x80)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300151 goto unlock;
152
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300153 if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].buf[0], 0x0)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300154 goto unlock;
155
156 if (i + 1 < num && msg[i + 1].flags & I2C_M_RD) {
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300157 /* Possibly device dependant */
158 if (msg[i].addr == d->adapter[0].pll_addr)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300159 w_len = 0xc5;
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300160 else
161 w_len = 0x1f;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300162
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300163 if ((ret = m9206_write(d->udev, M9206_I2C, w_len, 0x80)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300164 goto unlock;
165
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300166 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 -0300167 goto unlock;
168
169 i++;
170 } else {
171 if (msg[i].len != 2)
172 return -EINVAL;
173
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300174 if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].buf[1], 0x40)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300175 goto unlock;
176 }
177 }
178 ret = i;
179 unlock:
180 mutex_unlock(&d->i2c_mutex);
181
182 return ret;
183}
184
185static u32 m9206_i2c_func(struct i2c_adapter *adapter)
186{
187 return I2C_FUNC_I2C;
188}
189
190static struct i2c_algorithm m9206_i2c_algo = {
191 .master_xfer = m9206_i2c_xfer,
192 .functionality = m9206_i2c_func,
193};
194
195/* Callbacks for DVB USB */
Michael Krufky2a2bfa72006-09-23 20:13:12 -0300196static int megasky_identify_state(struct usb_device *udev,
197 struct dvb_usb_device_properties *props,
198 struct dvb_usb_device_description **desc,
199 int *cold)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300200{
201 struct usb_host_interface *alt;
202
203 alt = usb_altnum_to_altsetting(usb_ifnum_to_if(udev, 0), 1);
204 *cold = (alt == NULL) ? 1 : 0;
205
206 return 0;
207}
208
209static int megasky_mt352_demod_init(struct dvb_frontend *fe)
210{
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300211 u8 config[] = { CONFIG, 0x3d };
212 u8 clock[] = { CLOCK_CTL, 0x30 };
213 u8 reset[] = { RESET, 0x80 };
214 u8 adc_ctl[] = { ADC_CTL_1, 0x40 };
215 u8 agc[] = { AGC_TARGET, 0x1c, 0x20 };
216 u8 sec_agc[] = { 0x69, 0x00, 0xff, 0xff, 0x40, 0xff, 0x00, 0x40, 0x40 };
217 u8 unk1[] = { 0x93, 0x1a };
218 u8 unk2[] = { 0xb5, 0x7a };
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300219
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300220 mt352_write(fe, config, ARRAY_SIZE(config));
221 mt352_write(fe, clock, ARRAY_SIZE(clock));
222 mt352_write(fe, reset, ARRAY_SIZE(reset));
223 mt352_write(fe, adc_ctl, ARRAY_SIZE(adc_ctl));
224 mt352_write(fe, agc, ARRAY_SIZE(agc));
225 mt352_write(fe, sec_agc, ARRAY_SIZE(sec_agc));
226 mt352_write(fe, unk1, ARRAY_SIZE(unk1));
227 mt352_write(fe, unk2, ARRAY_SIZE(unk2));
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300228
229 deb_rc("Demod init!\n");
230
231 return 0;
232}
233
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300234static struct mt352_config megasky_mt352_config = {
235 .demod_address = 0x1e,
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300236 .no_tuner = 1,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300237 .demod_init = megasky_mt352_demod_init,
238};
239
Michael Krufky01cb34d2006-09-23 20:01:29 -0300240static int megasky_frontend_attach(struct dvb_usb_adapter *adap)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300241{
242 deb_rc("megasky_frontend_attach!\n");
243
Patrick Boettcher94a47dc2006-09-28 13:48:03 -0300244 if ((adap->fe = dvb_attach(mt352_attach, &megasky_mt352_config, &adap->dev->i2c_adap)) != NULL)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300245 return 0;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300246 return -EIO;
247}
248
Michael Krufky26f48ea2006-09-28 01:46:49 -0300249static int m9206_set_filter(struct dvb_usb_adapter *adap, int type, int idx, int pid)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300250{
251 int ret = 0;
252
253 if (pid >= 0x8000)
254 return -EINVAL;
255
256 pid |= 0x8000;
257
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300258 if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300259 return ret;
260
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300261 if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0)
262 return ret;
263
264 return ret;
265}
266
267static int m9206_update_filters(struct dvb_usb_adapter *adap)
268{
269 struct m9206_state *m = adap->dev->priv;
270 int enabled = m->filtering_enabled;
271 int i, ret = 0, filter = 0;
272
273 for (i = 0; i < M9206_MAX_FILTERS; i++)
274 if (m->filters[i] == 8192)
275 enabled = 0;
276
277 /* Disable all filters */
Michael Krufky26f48ea2006-09-28 01:46:49 -0300278 if ((ret = m9206_set_filter(adap, 0x81, 1, enabled)) != 0)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300279 return ret;
280
281 for (i = 0; i < M9206_MAX_FILTERS; i++)
Michael Krufky26f48ea2006-09-28 01:46:49 -0300282 if ((ret = m9206_set_filter(adap, 0x81, i + 2, 0)) != 0)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300283 return ret;
284
Michael Krufky26f48ea2006-09-28 01:46:49 -0300285 if ((ret = m9206_set_filter(adap, 0x82, 0, 0x0)) != 0)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300286 return ret;
287
288 /* Set */
289 if (enabled) {
290 for (i = 0; i < M9206_MAX_FILTERS; i++) {
291 if (m->filters[i] == 0)
292 continue;
293
Michael Krufky26f48ea2006-09-28 01:46:49 -0300294 if ((ret = m9206_set_filter(adap, 0x81, filter + 2, m->filters[i])) != 0)
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300295 return ret;
296
297 filter++;
298 }
299 }
300
Michael Krufky26f48ea2006-09-28 01:46:49 -0300301 if ((ret = m9206_set_filter(adap, 0x82, 0, 0x02f5)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300302 return ret;
303
304 return ret;
305}
306
Michael Krufky01cb34d2006-09-23 20:01:29 -0300307static int m9206_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300308{
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300309 struct m9206_state *m = adap->dev->priv;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300310
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300311 m->filtering_enabled = onoff ? 1 : 0;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300312
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300313 return m9206_update_filters(adap);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300314}
315
Michael Krufky01cb34d2006-09-23 20:01:29 -0300316static int m9206_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300317{
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300318 struct m9206_state *m = adap->dev->priv;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300319
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300320 m->filters[index] = onoff ? pid : 0;
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300321
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300322 return m9206_update_filters(adap);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300323}
324
325static int m9206_firmware_download(struct usb_device *udev, const struct firmware *fw)
326{
327 u16 value, index, size;
328 u8 read[4], *buff;
329 int i, pass, ret = 0;
330
331 buff = kmalloc(65536, GFP_KERNEL);
332
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300333 if ((ret = m9206_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300334 goto done;
335 deb_rc("%x %x %x %x\n", read[0], read[1], read[2], read[3]);
336
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300337 if ((ret = m9206_read(udev, M9206_FW, 0x0, 0x0, read, 1)) != 0)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300338 goto done;
339 deb_rc("%x\n", read[0]);
340
341 for (pass = 0; pass < 2; pass++) {
342 for (i = 0; i + (sizeof(u16) * 3) < fw->size;) {
343 value = le16_to_cpu(*(u16 *)(fw->data + i));
344 i += sizeof(u16);
345
346 index = le16_to_cpu(*(u16 *)(fw->data + i));
347 i += sizeof(u16);
348
349 size = le16_to_cpu(*(u16 *)(fw->data + i));
350 i += sizeof(u16);
351
352 if (pass == 1) {
353 /* Will stall if using fw->data ... */
354 memcpy(buff, fw->data + i, size);
355
356 ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0),
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300357 M9206_FW,
358 USB_TYPE_VENDOR | USB_DIR_OUT,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300359 value, index, buff, size, 20);
360 if (ret != size) {
361 deb_rc("error while uploading fw!\n");
362 ret = -EIO;
363 goto done;
364 }
365 msleep(3);
366 }
367 i += size;
368 }
369 if (i != fw->size) {
370 ret = -EINVAL;
371 goto done;
372 }
373 }
374
375 msleep(36);
376
377 /* m9206 will disconnect itself from the bus after this. */
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300378 (void) m9206_write(udev, M9206_CORE, 0x01, M9206_FW_GO);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300379 deb_rc("firmware uploaded!\n");
380
381 done:
382 kfree(buff);
383
384 return ret;
385}
386
Michael Krufky26f48ea2006-09-28 01:46:49 -0300387/* DVB USB Driver stuff */
388static struct dvb_usb_device_properties megasky_properties;
389
390static int m920x_probe(struct usb_interface *intf, const struct usb_device_id *id)
391{
392 struct dvb_usb_device *d;
393 struct usb_host_interface *alt;
394 int ret;
395
396 if ((ret = dvb_usb_device_init(intf, &megasky_properties, THIS_MODULE, &d)) == 0) {
397 deb_rc("probed!\n");
398
399 alt = usb_altnum_to_altsetting(intf, 1);
400 if (alt == NULL) {
401 deb_rc("not alt found!\n");
402 return -ENODEV;
403 }
404
405 ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber, alt->desc.bAlternateSetting);
406 if (ret < 0)
407 return ret;
408
409 deb_rc("Changed to alternate setting!\n");
410
411 if ((ret = m9206_rc_init(d->udev)) != 0)
412 return ret;
413 }
414 return ret;
415}
416
417static struct usb_device_id m920x_table [] = {
418 { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580) },
419 { } /* Terminating entry */
420};
421MODULE_DEVICE_TABLE (usb, m920x_table);
422
Michael Krufky01cb34d2006-09-23 20:01:29 -0300423static struct dvb_usb_device_properties megasky_properties = {
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300424 .usb_ctrl = DEVICE_SPECIFIC,
425 .firmware = "dvb-usb-megasky-02.fw",
426 .download_firmware = m9206_firmware_download,
427
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300428 .rc_interval = 100,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300429 .rc_key_map = megasky_rc_keys,
430 .rc_key_map_size = ARRAY_SIZE(megasky_rc_keys),
431 .rc_query = m9206_rc_query,
432
Aapo Tahkolae2adbecf72006-09-28 00:47:51 -0300433 .size_of_priv = sizeof(struct m9206_state),
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300434
435 .identify_state = megasky_identify_state,
Michael Krufky01cb34d2006-09-23 20:01:29 -0300436 .num_adapters = 1,
437 .adapter = {{
Michael Krufky26f48ea2006-09-28 01:46:49 -0300438 .caps = DVB_USB_IS_AN_I2C_ADAPTER | DVB_USB_ADAP_HAS_PID_FILTER |
439 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
440
Michael Krufky01cb34d2006-09-23 20:01:29 -0300441 .pid_filter_count = 8,
442 .pid_filter = m9206_pid_filter,
443 .pid_filter_ctrl = m9206_pid_filter_ctrl,
444
445 .frontend_attach = megasky_frontend_attach,
Michael Krufky6cf2a102006-09-28 14:47:21 -0300446 .tuner_attach = qt1010_tuner_attach,
Michael Krufky01cb34d2006-09-23 20:01:29 -0300447
448 .stream = {
449 .type = USB_BULK,
450 .count = 8,
451 .endpoint = 0x81,
452 .u = {
453 .bulk = {
454 .buffersize = 512,
455 }
456 }
457 },
458 }},
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300459 .i2c_algo = &m9206_i2c_algo,
460
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300461 .num_device_descs = 1,
462 .devices = {
463 { "MSI Mega Sky 580 DVB-T USB2.0",
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300464 { &m920x_table[0], NULL },
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300465 { NULL },
466 },
467 { NULL },
468 }
469};
470
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300471static struct usb_driver m920x_driver = {
472 .name = "dvb_usb_m920x",
Michael Krufky2a2bfa72006-09-23 20:13:12 -0300473 .probe = m920x_probe,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300474 .disconnect = dvb_usb_device_exit,
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300475 .id_table = m920x_table,
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300476};
477
478/* module stuff */
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300479static int __init m920x_module_init(void)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300480{
481 int ret;
482
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300483 if ((ret = usb_register(&m920x_driver))) {
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300484 err("usb_register failed. Error number %d", ret);
485 return ret;
486 }
487
488 return 0;
489}
490
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300491static void __exit m920x_module_exit(void)
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300492{
493 /* deregister this driver from the USB subsystem */
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300494 usb_deregister(&m920x_driver);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300495}
496
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300497module_init (m920x_module_init);
498module_exit (m920x_module_exit);
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300499
500MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>");
Michael Krufkybaa2ed02006-09-23 20:01:29 -0300501MODULE_DESCRIPTION("Driver MSI Mega Sky 580 DVB-T USB2.0 / Uli m920x");
Aapo Tahkola5fecd9f2006-09-23 20:00:41 -0300502MODULE_VERSION("0.1");
503MODULE_LICENSE("GPL");