[media] az6007: Fix IR receive code
[deliverable/linux.git] / drivers / media / dvb / dvb-usb / az6007.c
CommitLineData
25c16466
MCC
1/*
2 * Driver for AzureWave 6007 DVB-C/T USB2.0 and clones
3 *
4 * Copyright (c) Henry Wang <Henry.wang@AzureWave.com>
5 *
6 * This driver was made publicly available by Terratec, at:
7 * http://linux.terratec.de/files/TERRATEC_H7/20110323_TERRATEC_H7_Linux.tar.gz
8 * The original driver's license is GPL, as declared with MODULE_LICENSE()
9 *
10 * Driver modifiyed by Mauro Carvalho Chehab <mchehab@redhat.com> in order
11 * to work with upstream drxk driver, and to fix some bugs.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation under version 2 of the License.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
71d67634
MCC
21 */
22
71d67634
MCC
23#include "drxk.h"
24#include "mt2063.h"
25#include "dvb_ca_en50221.h"
70fa444d
MCC
26
27#define DVB_USB_LOG_PREFIX "az6007"
c108a5a0 28#include "dvb-usb.h"
71d67634
MCC
29
30/* debug */
31int dvb_usb_az6007_debug;
93b32126
MCC
32module_param_named(debug, dvb_usb_az6007_debug, int, 0644);
33MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))."
34 DVB_USB_DEBUG_STATUS);
71d67634 35
70fa444d
MCC
36#define deb_info(args...) dprintk(dvb_usb_az6007_debug, 0x01, args)
37#define deb_xfer(args...) dprintk(dvb_usb_az6007_debug, 0x02, args)
38#define deb_rc(args...) dprintk(dvb_usb_az6007_debug, 0x04, args)
39#define deb_fe(args...) dprintk(dvb_usb_az6007_debug, 0x08, args)
40
71d67634
MCC
41DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
42
3aecf2c5
MCC
43/* Known requests (Cypress FX2 firmware + az6007 "private" ones*/
44
45#define FX2_OED 0xb5
46#define AZ6007_READ_DATA 0xb7
47#define AZ6007_I2C_RD 0xb9
48#define AZ6007_POWER 0xbc
49#define AZ6007_I2C_WR 0xbd
50#define FX2_SCON1 0xc0
51#define AZ6007_TS_THROUGH 0xc7
2d5161b7 52#define AZ6007_READ_IR 0xb4
3aecf2c5 53
71d67634 54struct az6007_device_state {
93b32126
MCC
55 struct dvb_ca_en50221 ca;
56 struct mutex ca_mutex;
57 u8 power_state;
71d67634 58
6da34706 59 /* Due to DRX-K - probably need changes */
93b32126
MCC
60 int (*gate_ctrl) (struct dvb_frontend *, int);
61 struct semaphore pll_mutex;
6da34706 62 bool dont_attach_fe1;
71d67634
MCC
63};
64
93b32126 65static struct drxk_config terratec_h7_drxk = {
6da34706
MCC
66 .adr = 0x29,
67 .single_master = 1,
d20a7f72 68 .no_i2c_bridge = 0,
da989e0b 69 .max_size = 64,
81091144
MCC
70 .microcode_name = "dvb-usb-terratec-h7-drxk.fw",
71 .parallel_ts = 1,
71d67634
MCC
72};
73
6da34706
MCC
74static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable)
75{
76 struct dvb_usb_adapter *adap = fe->sec_priv;
caa1a700 77 struct az6007_device_state *st;
f2ba9e5d 78 int status = 0;
6da34706 79
f2ba9e5d 80 deb_info("%s: %s\n", __func__, enable ? "enable" : "disable");
caa1a700
MCC
81
82 if (!adap)
83 return -EINVAL;
84
85 st = adap->priv;
86
87 if (!st)
6da34706
MCC
88 return -EINVAL;
89
90 if (enable) {
2212501f 91#if 0
6da34706 92 down(&st->pll_mutex);
2212501f 93#endif
6da34706
MCC
94 status = st->gate_ctrl(fe, 1);
95 } else {
2212501f 96#if 0
6da34706 97 status = st->gate_ctrl(fe, 0);
2212501f 98#endif
6da34706
MCC
99 up(&st->pll_mutex);
100 }
101 return status;
102}
103
93b32126 104static struct mt2063_config az6007_mt2063_config = {
caa1a700 105 .tuner_address = 0x60,
71d67634
MCC
106 .refclock = 36125000,
107};
108
109/* check for mutex FIXME */
3af2f4f1 110static int az6007_read(struct usb_device *udev, u8 req, u16 value,
93b32126 111 u16 index, u8 *b, int blen)
71d67634
MCC
112{
113 int ret = -1;
114
3af2f4f1
MCC
115 ret = usb_control_msg(udev,
116 usb_rcvctrlpipe(udev, 0),
93b32126
MCC
117 req,
118 USB_TYPE_VENDOR | USB_DIR_IN,
119 value, index, b, blen, 5000);
71d67634
MCC
120
121 if (ret < 0) {
122 warn("usb in operation failed. (%d)", ret);
caa1a700
MCC
123 return -EIO;
124 }
71d67634 125
93b32126
MCC
126 deb_xfer("in: req. %02x, val: %04x, ind: %04x, buffer: ", req, value,
127 index);
128 debug_dump(b, blen, deb_xfer);
71d67634
MCC
129
130 return ret;
131}
132
3af2f4f1 133static int az6007_write(struct usb_device *udev, u8 req, u16 value,
71d67634
MCC
134 u16 index, u8 *b, int blen)
135{
136 int ret;
137
93b32126
MCC
138 deb_xfer("out: req. %02x, val: %04x, ind: %04x, buffer: ", req, value,
139 index);
140 debug_dump(b, blen, deb_xfer);
71d67634 141
35753580 142 if (blen > 64) {
da989e0b
MCC
143 err("az6007: tried to write %d bytes, but I2C max size is 64 bytes\n",
144 blen);
35753580 145 return -EOPNOTSUPP;
71d67634 146 }
35753580 147
3af2f4f1
MCC
148 ret = usb_control_msg(udev,
149 usb_sndctrlpipe(udev, 0),
93b32126
MCC
150 req,
151 USB_TYPE_VENDOR | USB_DIR_OUT,
152 value, index, b, blen, 5000);
153 if (ret != blen) {
f2ba9e5d 154 err("usb out operation failed. (%d)", ret);
35753580 155 return -EIO;
71d67634 156 }
6da34706 157
71d67634
MCC
158 return 0;
159}
160
161static int az6007_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
162{
163 return 0;
164}
165
166/* keys for the enclosed remote control */
93b32126
MCC
167static struct rc_map_table rc_map_az6007_table[] = {
168 {0x0001, KEY_1},
169 {0x0002, KEY_2},
71d67634
MCC
170};
171
172/* remote control stuff (does not work with my box) */
93b32126 173static int az6007_rc_query(struct dvb_usb_device *d, u32 * event, int *state)
71d67634 174{
2d5161b7 175 struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
71d67634
MCC
176 u8 key[10];
177 int i;
178
2d5161b7
MCC
179 /*
180 * FIXME: remove the following return to enabled remote querying
181 * The driver likely needs proper locking to avoid troubles between
182 * this call and other concurrent calls.
183 */
184 return 0;
71d67634 185
3aecf2c5 186 az6007_read(d->udev, AZ6007_READ_IR, 0, 0, key, 10);
71d67634 187
71d67634
MCC
188 if (key[1] == 0x44) {
189 *state = REMOTE_NO_KEY_PRESSED;
190 return 0;
191 }
192
2d5161b7
MCC
193 /*
194 * FIXME: need to make something useful with the keycodes and to
195 * convert it to the non-legacy mode. Yet, it is producing some
196 * debug info already, like:
197 * 88 04 eb 02 fd ff 00 82 63 82 (terratec IR)
198 * 88 04 eb 03 fc 00 00 82 63 82 (terratec IR)
199 * 88 80 7e 0d f2 ff 00 82 63 82 (another NEC-extended based IR)
200 * I suspect that the IR data is at bytes 1 to 4, and byte 5 is parity
201 */
202 deb_rc("remote query key: %x %d\n", key[1], key[1]);
203 print_hex_dump_bytes("Remote: ", DUMP_PREFIX_NONE, key, 10);
204
205 for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
206 if (rc5_custom(&keymap[i]) == key[1]) {
207 *event = keymap[i].keycode;
71d67634 208 *state = REMOTE_KEY_PRESSED;
2d5161b7
MCC
209
210 return 0;
71d67634 211 }
2d5161b7 212 }
71d67634 213 return 0;
71d67634
MCC
214}
215
3aecf2c5 216#if 0
71d67634
MCC
217int az6007_power_ctrl(struct dvb_usb_device *d, int onoff)
218{
219 u8 v = onoff;
3aecf2c5 220 return az6007_write(d->udev, AZ6007_POWER, v , 3, NULL, 1);
71d67634 221}
3aecf2c5 222#endif
71d67634 223
93b32126 224static int az6007_read_mac_addr(struct dvb_usb_device *d, u8 mac[6])
71d67634 225{
3aecf2c5
MCC
226 int ret;
227 ret = az6007_read(d->udev, AZ6007_READ_DATA, 6, 0, mac, 6);
71d67634 228
3aecf2c5
MCC
229 if (ret > 0)
230 deb_info("%s: mac is %02x:%02x:%02x:%02x:%02x:%02x\n",
231 __func__, mac[0], mac[1], mac[2],
232 mac[3], mac[4], mac[5]);
233
234 return ret;
235}
81091144 236
71d67634
MCC
237static int az6007_frontend_poweron(struct dvb_usb_adapter *adap)
238{
3aecf2c5
MCC
239 int ret;
240 struct usb_device *udev = adap->dev->udev;
71d67634 241
3aecf2c5 242 deb_info("%s: adap=%p adap->dev=%p\n", __func__, adap, adap->dev);
71d67634 243
3aecf2c5
MCC
244 ret = az6007_write(udev, AZ6007_POWER, 0, 2, NULL, 0);
245 if (ret < 0)
246 goto error;
81091144 247 msleep(150);
3aecf2c5
MCC
248 ret = az6007_write(udev, AZ6007_POWER, 1, 4, NULL, 0);
249 if (ret < 0)
250 goto error;
81091144 251 msleep(100);
3aecf2c5
MCC
252 ret = az6007_write(udev, AZ6007_POWER, 1, 3, NULL, 0);
253 if (ret < 0)
254 goto error;
81091144 255 msleep(100);
3aecf2c5
MCC
256 ret = az6007_write(udev, AZ6007_POWER, 1, 4, NULL, 0);
257 if (ret < 0)
258 goto error;
81091144 259 msleep(100);
3aecf2c5
MCC
260 ret = az6007_write(udev, FX2_SCON1, 0, 3, NULL, 0);
261 if (ret < 0)
262 goto error;
81091144 263 msleep (10);
3aecf2c5
MCC
264 ret = az6007_write(udev, FX2_SCON1, 1, 3, NULL, 0);
265 if (ret < 0)
266 goto error;
81091144 267 msleep (10);
3aecf2c5 268 ret = az6007_write(udev, AZ6007_POWER, 0, 0, NULL, 0);
71d67634 269
3aecf2c5
MCC
270error:
271 if (ret < 0)
272 err("%s failed with error %d", __func__, ret);
caa1a700 273
3aecf2c5 274 return ret;
71d67634
MCC
275}
276
71d67634
MCC
277static int az6007_led_on_off(struct usb_interface *intf, int onoff)
278{
3aecf2c5
MCC
279 struct usb_device *udev = interface_to_usbdev(intf);
280 int ret;
71d67634 281
3aecf2c5
MCC
282 /* TS through */
283 ret = az6007_write(udev, AZ6007_POWER, onoff, 0, NULL, 0);
284 if (ret < 0)
285 err("%s failed with error %d", __func__, ret);
71d67634
MCC
286
287 return ret;
288}
289
71d67634
MCC
290static int az6007_frontend_attach(struct dvb_usb_adapter *adap)
291{
6da34706
MCC
292 struct az6007_device_state *st = adap->priv;
293
294 int result;
295
caa1a700
MCC
296 BUG_ON(!st);
297
71d67634 298 az6007_frontend_poweron(adap);
71d67634 299
f2ba9e5d 300 info("az6007: attaching demod drxk");
6da34706
MCC
301 adap->fe = dvb_attach(drxk_attach, &terratec_h7_drxk,
302 &adap->dev->i2c_adap, &adap->fe2);
303 if (!adap->fe) {
304 result = -EINVAL;
305 goto out_free;
71d67634 306 }
6da34706 307
f2ba9e5d 308 deb_info("Setting hacks\n");
caa1a700 309
6da34706
MCC
310 /* FIXME: do we need a pll semaphore? */
311 adap->fe->sec_priv = adap;
312 sema_init(&st->pll_mutex, 1);
313 st->gate_ctrl = adap->fe->ops.i2c_gate_ctrl;
314 adap->fe->ops.i2c_gate_ctrl = drxk_gate_ctrl;
315 adap->fe2->id = 1;
316
f2ba9e5d 317 info("az6007: attaching tuner mt2063");
6da34706
MCC
318 /* Attach mt2063 to DVB-C frontend */
319 if (adap->fe->ops.i2c_gate_ctrl)
320 adap->fe->ops.i2c_gate_ctrl(adap->fe, 1);
321 if (!dvb_attach(mt2063_attach, adap->fe, &az6007_mt2063_config,
322 &adap->dev->i2c_adap)) {
323 result = -EINVAL;
324
325 goto out_free;
71d67634 326 }
6da34706
MCC
327 if (adap->fe->ops.i2c_gate_ctrl)
328 adap->fe->ops.i2c_gate_ctrl(adap->fe, 0);
329
330 /* Hack - needed due to drxk */
331 adap->fe2->tuner_priv = adap->fe->tuner_priv;
332 memcpy(&adap->fe2->ops.tuner_ops,
93b32126 333 &adap->fe->ops.tuner_ops, sizeof(adap->fe->ops.tuner_ops));
da989e0b 334
71d67634 335 return 0;
6da34706
MCC
336
337out_free:
338 if (adap->fe)
339 dvb_frontend_detach(adap->fe);
340 adap->fe = NULL;
341 adap->fe2 = NULL;
342
343 return result;
71d67634
MCC
344}
345
81091144
MCC
346int az6007_power_ctrl(struct dvb_usb_device *d, int onoff)
347{
348 if (!onoff)
349 return 0;
350
351
352 info("Sending poweron sequence");
353
3aecf2c5 354 az6007_write(d->udev, AZ6007_TS_THROUGH, 0, 0, NULL, 0);
81091144
MCC
355
356#if 0
357 // Seems to be a poweroff sequence
3af2f4f1
MCC
358 az6007_write(d->udev, 0xbc, 1, 3, NULL, 0);
359 az6007_write(d->udev, 0xbc, 1, 4, NULL, 0);
360 az6007_write(d->udev, 0xc0, 0, 3, NULL, 0);
361 az6007_write(d->udev, 0xc0, 1, 3, NULL, 0);
362 az6007_write(d->udev, 0xbc, 0, 1, NULL, 0);
81091144
MCC
363#endif
364 return 0;
365}
366
71d67634
MCC
367static struct dvb_usb_device_properties az6007_properties;
368
93b32126 369static void az6007_usb_disconnect(struct usb_interface *intf)
71d67634 370{
93b32126 371 dvb_usb_device_exit(intf);
71d67634
MCC
372}
373
374/* I2C */
93b32126
MCC
375static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
376 int num)
71d67634
MCC
377{
378 struct dvb_usb_device *d = i2c_get_adapdata(adap);
caa1a700
MCC
379 int i, j, len;
380 int ret = 0;
71d67634
MCC
381 u16 index;
382 u16 value;
383 int length;
caa1a700 384 u8 req, addr;
71d67634 385 u8 data[512];
6da34706 386
71d67634
MCC
387 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
388 return -EAGAIN;
71d67634 389
caa1a700
MCC
390 for (i = 0; i < num; i++) {
391 addr = msgs[i].addr << 1;
caa1a700
MCC
392 if (((i + 1) < num)
393 && (msgs[i].len == 1)
394 && (!msgs[i].flags & I2C_M_RD)
395 && (msgs[i + 1].flags & I2C_M_RD)
396 && (msgs[i].addr == msgs[i + 1].addr)) {
397 /*
398 * A write + read xfer for the same address, where
399 * the first xfer has just 1 byte length.
400 * Need to join both into one operation
401 */
d20a7f72
MCC
402 if (dvb_usb_az6007_debug & 2)
403 printk(KERN_DEBUG
404 "az6007 I2C xfer write+read addr=0x%x len=%d/%d: ",
405 addr, msgs[i].len, msgs[i + 1].len);
3aecf2c5 406 req = AZ6007_I2C_RD;
d20a7f72
MCC
407 index = msgs[i].buf[0];
408 value = addr | (1 << 8);
caa1a700
MCC
409 length = 6 + msgs[i + 1].len;
410 len = msgs[i + 1].len;
3af2f4f1 411 ret = az6007_read(d->udev, req, value, index, data,
93b32126 412 length);
caa1a700
MCC
413 if (ret >= len) {
414 for (j = 0; j < len; j++) {
415 msgs[i + 1].buf[j] = data[j + 5];
d20a7f72
MCC
416 if (dvb_usb_az6007_debug & 2)
417 printk(KERN_CONT
418 "0x%02x ",
419 msgs[i + 1].buf[j]);
caa1a700
MCC
420 }
421 } else
422 ret = -EIO;
423 i++;
424 } else if (!(msgs[i].flags & I2C_M_RD)) {
425 /* write bytes */
d20a7f72
MCC
426 if (dvb_usb_az6007_debug & 2)
427 printk(KERN_DEBUG
428 "az6007 I2C xfer write addr=0x%x len=%d: ",
429 addr, msgs[i].len);
3aecf2c5 430 req = AZ6007_I2C_WR;
caa1a700
MCC
431 index = msgs[i].buf[0];
432 value = addr | (1 << 8);
433 length = msgs[i].len - 1;
434 len = msgs[i].len - 1;
d20a7f72 435 if (dvb_usb_az6007_debug & 2)
93b32126
MCC
436 printk(KERN_CONT "(0x%02x) ", msgs[i].buf[0]);
437 for (j = 0; j < len; j++) {
caa1a700 438 data[j] = msgs[i].buf[j + 1];
d20a7f72 439 if (dvb_usb_az6007_debug & 2)
93b32126 440 printk(KERN_CONT "0x%02x ", data[j]);
71d67634 441 }
3af2f4f1 442 ret = az6007_write(d->udev, req, value, index, data,
93b32126 443 length);
caa1a700
MCC
444 } else {
445 /* read bytes */
d20a7f72
MCC
446 if (dvb_usb_az6007_debug & 2)
447 printk(KERN_DEBUG
448 "az6007 I2C xfer read addr=0x%x len=%d: ",
449 addr, msgs[i].len);
3aecf2c5 450 req = AZ6007_I2C_RD;
caa1a700
MCC
451 index = msgs[i].buf[0];
452 value = addr;
453 length = msgs[i].len + 6;
454 len = msgs[i].len;
3af2f4f1 455 ret = az6007_read(d->udev, req, value, index, data,
93b32126
MCC
456 length);
457 for (j = 0; j < len; j++) {
caa1a700 458 msgs[i].buf[j] = data[j + 5];
d20a7f72
MCC
459 if (dvb_usb_az6007_debug & 2)
460 printk(KERN_CONT
461 "0x%02x ", data[j + 5]);
71d67634 462 }
71d67634 463 }
d20a7f72
MCC
464 if (dvb_usb_az6007_debug & 2)
465 printk(KERN_CONT "\n");
caa1a700
MCC
466 if (ret < 0)
467 goto err;
71d67634 468 }
caa1a700 469err:
71d67634 470 mutex_unlock(&d->i2c_mutex);
caa1a700
MCC
471
472 if (ret < 0) {
f2ba9e5d 473 info("%s ERROR: %i", __func__, ret);
caa1a700
MCC
474 return ret;
475 }
476 return num;
71d67634
MCC
477}
478
71d67634
MCC
479static u32 az6007_i2c_func(struct i2c_adapter *adapter)
480{
481 return I2C_FUNC_I2C;
482}
483
484static struct i2c_algorithm az6007_i2c_algo = {
93b32126 485 .master_xfer = az6007_i2c_xfer,
71d67634 486 .functionality = az6007_i2c_func,
71d67634
MCC
487};
488
93b32126
MCC
489int az6007_identify_state(struct usb_device *udev,
490 struct dvb_usb_device_properties *props,
491 struct dvb_usb_device_description **desc, int *cold)
71d67634 492{
3aecf2c5
MCC
493 int ret;
494 u8 mac[6];
71d67634 495
3aecf2c5
MCC
496 /* Try to read the mac address */
497 ret = az6007_read(udev, AZ6007_READ_DATA, 6, 0, mac, 6);
498 if (ret == 6)
499 *cold = 0;
500 else
501 *cold = 1;
71d67634 502
3aecf2c5 503 deb_info("Device is on %s state\n", *cold? "warm" : "cold");
71d67634
MCC
504 return 0;
505}
506
507static int az6007_usb_probe(struct usb_interface *intf,
93b32126 508 const struct usb_device_id *id)
71d67634 509{
6da34706
MCC
510 az6007_led_on_off(intf, 0);
511
71d67634 512 return dvb_usb_device_init(intf, &az6007_properties,
6da34706 513 THIS_MODULE, NULL, adapter_nr);
71d67634
MCC
514}
515
93b32126
MCC
516static struct usb_device_id az6007_usb_table[] = {
517 {USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_AZUREWAVE_6007)},
518 {USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_H7)},
519 {0},
71d67634
MCC
520};
521
522MODULE_DEVICE_TABLE(usb, az6007_usb_table);
523
524static struct dvb_usb_device_properties az6007_properties = {
525 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
526 .usb_ctrl = CYPRESS_FX2,
81091144 527 .firmware = "dvb-usb-terratec-h7-az6007.fw",
71d67634
MCC
528 .no_reconnect = 1,
529
71d67634
MCC
530 .identify_state = az6007_identify_state,
531 .num_adapters = 1,
532 .adapter = {
533 {
71d67634
MCC
534 .streaming_ctrl = az6007_streaming_ctrl,
535 .frontend_attach = az6007_frontend_attach,
536
537 /* parameter for the MPEG2-data transfer */
538 .stream = {
539 .type = USB_BULK,
540 .count = 10,
541 .endpoint = 0x02,
542 .u = {
543 .bulk = {
544 .buffersize = 4096,
545 }
546 }
547 },
caa1a700 548 .size_of_priv = sizeof(struct az6007_device_state),
71d67634
MCC
549 }
550 },
81091144 551 .power_ctrl = az6007_power_ctrl,
71d67634
MCC
552 .read_mac_address = az6007_read_mac_addr,
553
6da34706
MCC
554 .rc.legacy = {
555 .rc_map_table = rc_map_az6007_table,
556 .rc_map_size = ARRAY_SIZE(rc_map_az6007_table),
557 .rc_interval = 400,
558 .rc_query = az6007_rc_query,
559 },
71d67634
MCC
560 .i2c_algo = &az6007_i2c_algo,
561
562 .num_device_descs = 2,
563 .devices = {
564 { .name = "AzureWave DTV StarBox DVB-T/C USB2.0 (az6007)",
565 .cold_ids = { &az6007_usb_table[0], NULL },
566 .warm_ids = { NULL },
567 },
568 { .name = "TerraTec DTV StarBox DVB-T/C USB2.0 (az6007)",
569 .cold_ids = { &az6007_usb_table[1], NULL },
570 .warm_ids = { NULL },
571 },
6da34706 572 { NULL },
71d67634
MCC
573 }
574};
6da34706 575
71d67634
MCC
576/* usb specific object needed to register this driver with the usb subsystem */
577static struct usb_driver az6007_usb_driver = {
578 .name = "dvb_usb_az6007",
93b32126 579 .probe = az6007_usb_probe,
71d67634 580 .disconnect = dvb_usb_device_exit,
93b32126
MCC
581 /* .disconnect = az6007_usb_disconnect, */
582 .id_table = az6007_usb_table,
71d67634
MCC
583};
584
585/* module stuff */
586static int __init az6007_usb_module_init(void)
587{
588 int result;
f2ba9e5d 589 deb_info("az6007 usb module init\n");
93b32126
MCC
590
591 result = usb_register(&az6007_usb_driver);
592 if (result) {
593 err("usb_register failed. (%d)", result);
71d67634
MCC
594 return result;
595 }
596
597 return 0;
598}
599
600static void __exit az6007_usb_module_exit(void)
601{
602 /* deregister this driver from the USB subsystem */
f2ba9e5d 603 deb_info("az6007 usb module exit\n");
71d67634
MCC
604 usb_deregister(&az6007_usb_driver);
605}
606
607module_init(az6007_usb_module_init);
608module_exit(az6007_usb_module_exit);
609
610MODULE_AUTHOR("Henry Wang <Henry.wang@AzureWave.com>");
611MODULE_DESCRIPTION("Driver for AzureWave 6007 DVB-C/T USB2.0 and clones");
35753580 612MODULE_VERSION("1.1");
71d67634 613MODULE_LICENSE("GPL");
This page took 0.180383 seconds and 5 git commands to generate.