Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394...
[linux-2.6] / drivers / media / dvb / dvb-usb / cxusb.c
1 /* DVB USB compliant linux driver for Conexant USB reference design.
2  *
3  * The Conexant reference design I saw on their website was only for analogue
4  * capturing (using the cx25842). The box I took to write this driver (reverse
5  * engineered) is the one labeled Medion MD95700. In addition to the cx25842
6  * for analogue capturing it also has a cx22702 DVB-T demodulator on the main
7  * board. Besides it has a atiremote (X10) and a USB2.0 hub onboard.
8  *
9  * Maybe it is a little bit premature to call this driver cxusb, but I assume
10  * the USB protocol is identical or at least inherited from the reference
11  * design, so it can be reused for the "analogue-only" device (if it will
12  * appear at all).
13  *
14  * TODO: Use the cx25840-driver for the analogue part
15  *
16  * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de)
17  * Copyright (C) 2006 Michael Krufky (mkrufky@linuxtv.org)
18  * Copyright (C) 2006, 2007 Chris Pascoe (c.pascoe@itee.uq.edu.au)
19  *
20  *   This program is free software; you can redistribute it and/or modify it
21  *   under the terms of the GNU General Public License as published by the Free
22  *   Software Foundation, version 2.
23  *
24  * see Documentation/dvb/README.dvb-usb for more information
25  */
26 #include <media/tuner.h>
27
28 #include "cxusb.h"
29
30 #include "cx22702.h"
31 #include "lgdt330x.h"
32 #include "mt352.h"
33 #include "mt352_priv.h"
34 #include "zl10353.h"
35 #include "tuner-xc2028.h"
36 #include "tuner-simple.h"
37
38 /* debug */
39 static int dvb_usb_cxusb_debug;
40 module_param_named(debug, dvb_usb_cxusb_debug, int, 0644);
41 MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
42
43 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
44
45 #define deb_info(args...)   dprintk(dvb_usb_cxusb_debug,0x01,args)
46 #define deb_i2c(args...)    if (d->udev->descriptor.idVendor == USB_VID_MEDION) \
47                                 dprintk(dvb_usb_cxusb_debug,0x01,args)
48
49 static int cxusb_ctrl_msg(struct dvb_usb_device *d,
50                           u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
51 {
52         int wo = (rbuf == NULL || rlen == 0); /* write-only */
53         u8 sndbuf[1+wlen];
54         memset(sndbuf, 0, 1+wlen);
55
56         sndbuf[0] = cmd;
57         memcpy(&sndbuf[1], wbuf, wlen);
58         if (wo)
59                 return dvb_usb_generic_write(d, sndbuf, 1+wlen);
60         else
61                 return dvb_usb_generic_rw(d, sndbuf, 1+wlen, rbuf, rlen, 0);
62 }
63
64 /* GPIO */
65 static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff)
66 {
67         struct cxusb_state *st = d->priv;
68         u8 o[2], i;
69
70         if (st->gpio_write_state[GPIO_TUNER] == onoff)
71                 return;
72
73         o[0] = GPIO_TUNER;
74         o[1] = onoff;
75         cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1);
76
77         if (i != 0x01)
78                 deb_info("gpio_write failed.\n");
79
80         st->gpio_write_state[GPIO_TUNER] = onoff;
81 }
82
83 static int cxusb_bluebird_gpio_rw(struct dvb_usb_device *d, u8 changemask,
84                                  u8 newval)
85 {
86         u8 o[2], gpio_state;
87         int rc;
88
89         o[0] = 0xff & ~changemask;      /* mask of bits to keep */
90         o[1] = newval & changemask;     /* new values for bits  */
91
92         rc = cxusb_ctrl_msg(d, CMD_BLUEBIRD_GPIO_RW, o, 2, &gpio_state, 1);
93         if (rc < 0 || (gpio_state & changemask) != (newval & changemask))
94                 deb_info("bluebird_gpio_write failed.\n");
95
96         return rc < 0 ? rc : gpio_state;
97 }
98
99 static void cxusb_bluebird_gpio_pulse(struct dvb_usb_device *d, u8 pin, int low)
100 {
101         cxusb_bluebird_gpio_rw(d, pin, low ? 0 : pin);
102         msleep(5);
103         cxusb_bluebird_gpio_rw(d, pin, low ? pin : 0);
104 }
105
106 static void cxusb_nano2_led(struct dvb_usb_device *d, int onoff)
107 {
108         cxusb_bluebird_gpio_rw(d, 0x40, onoff ? 0 : 0x40);
109 }
110
111 /* I2C */
112 static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
113                           int num)
114 {
115         struct dvb_usb_device *d = i2c_get_adapdata(adap);
116         int i;
117
118         if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
119                 return -EAGAIN;
120
121         for (i = 0; i < num; i++) {
122
123                 if (d->udev->descriptor.idVendor == USB_VID_MEDION)
124                         switch (msg[i].addr) {
125                         case 0x63:
126                                 cxusb_gpio_tuner(d, 0);
127                                 break;
128                         default:
129                                 cxusb_gpio_tuner(d, 1);
130                                 break;
131                         }
132
133                 if (msg[i].flags & I2C_M_RD) {
134                         /* read only */
135                         u8 obuf[3], ibuf[1+msg[i].len];
136                         obuf[0] = 0;
137                         obuf[1] = msg[i].len;
138                         obuf[2] = msg[i].addr;
139                         if (cxusb_ctrl_msg(d, CMD_I2C_READ,
140                                            obuf, 3,
141                                            ibuf, 1+msg[i].len) < 0) {
142                                 warn("i2c read failed");
143                                 break;
144                         }
145                         memcpy(msg[i].buf, &ibuf[1], msg[i].len);
146                 } else if (i+1 < num && (msg[i+1].flags & I2C_M_RD) &&
147                            msg[i].addr == msg[i+1].addr) {
148                         /* write to then read from same address */
149                         u8 obuf[3+msg[i].len], ibuf[1+msg[i+1].len];
150                         obuf[0] = msg[i].len;
151                         obuf[1] = msg[i+1].len;
152                         obuf[2] = msg[i].addr;
153                         memcpy(&obuf[3], msg[i].buf, msg[i].len);
154
155                         if (cxusb_ctrl_msg(d, CMD_I2C_READ,
156                                            obuf, 3+msg[i].len,
157                                            ibuf, 1+msg[i+1].len) < 0)
158                                 break;
159
160                         if (ibuf[0] != 0x08)
161                                 deb_i2c("i2c read may have failed\n");
162
163                         memcpy(msg[i+1].buf, &ibuf[1], msg[i+1].len);
164
165                         i++;
166                 } else {
167                         /* write only */
168                         u8 obuf[2+msg[i].len], ibuf;
169                         obuf[0] = msg[i].addr;
170                         obuf[1] = msg[i].len;
171                         memcpy(&obuf[2], msg[i].buf, msg[i].len);
172
173                         if (cxusb_ctrl_msg(d, CMD_I2C_WRITE, obuf,
174                                            2+msg[i].len, &ibuf,1) < 0)
175                                 break;
176                         if (ibuf != 0x08)
177                                 deb_i2c("i2c write may have failed\n");
178                 }
179         }
180
181         mutex_unlock(&d->i2c_mutex);
182         return i == num ? num : -EREMOTEIO;
183 }
184
185 static u32 cxusb_i2c_func(struct i2c_adapter *adapter)
186 {
187         return I2C_FUNC_I2C;
188 }
189
190 static struct i2c_algorithm cxusb_i2c_algo = {
191         .master_xfer   = cxusb_i2c_xfer,
192         .functionality = cxusb_i2c_func,
193 };
194
195 static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff)
196 {
197         u8 b = 0;
198         if (onoff)
199                 return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0);
200         else
201                 return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0);
202 }
203
204 static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff)
205 {
206         u8 b = 0;
207         if (onoff)
208                 return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0);
209         else
210                 return 0;
211 }
212
213 static int cxusb_nano2_power_ctrl(struct dvb_usb_device *d, int onoff)
214 {
215         int rc = 0;
216
217         rc = cxusb_power_ctrl(d, onoff);
218         if (!onoff)
219                 cxusb_nano2_led(d, 0);
220
221         return rc;
222 }
223
224 static int cxusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
225 {
226         u8 buf[2] = { 0x03, 0x00 };
227         if (onoff)
228                 cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON, buf, 2, NULL, 0);
229         else
230                 cxusb_ctrl_msg(adap->dev, CMD_STREAMING_OFF, NULL, 0, NULL, 0);
231
232         return 0;
233 }
234
235 static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
236 {
237         struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
238         u8 ircode[4];
239         int i;
240
241         cxusb_ctrl_msg(d, CMD_GET_IR_CODE, NULL, 0, ircode, 4);
242
243         *event = 0;
244         *state = REMOTE_NO_KEY_PRESSED;
245
246         for (i = 0; i < d->props.rc_key_map_size; i++) {
247                 if (keymap[i].custom == ircode[2] &&
248                     keymap[i].data == ircode[3]) {
249                         *event = keymap[i].event;
250                         *state = REMOTE_KEY_PRESSED;
251
252                         return 0;
253                 }
254         }
255
256         return 0;
257 }
258
259 static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event,
260                                     int *state)
261 {
262         struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
263         u8 ircode[4];
264         int i;
265         struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD,
266                                .buf = ircode, .len = 4 };
267
268         *event = 0;
269         *state = REMOTE_NO_KEY_PRESSED;
270
271         if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1)
272                 return 0;
273
274         for (i = 0; i < d->props.rc_key_map_size; i++) {
275                 if (keymap[i].custom == ircode[1] &&
276                     keymap[i].data == ircode[2]) {
277                         *event = keymap[i].event;
278                         *state = REMOTE_KEY_PRESSED;
279
280                         return 0;
281                 }
282         }
283
284         return 0;
285 }
286
287 static struct dvb_usb_rc_key dvico_mce_rc_keys[] = {
288         { 0xfe, 0x02, KEY_TV },
289         { 0xfe, 0x0e, KEY_MP3 },
290         { 0xfe, 0x1a, KEY_DVD },
291         { 0xfe, 0x1e, KEY_FAVORITES },
292         { 0xfe, 0x16, KEY_SETUP },
293         { 0xfe, 0x46, KEY_POWER2 },
294         { 0xfe, 0x0a, KEY_EPG },
295         { 0xfe, 0x49, KEY_BACK },
296         { 0xfe, 0x4d, KEY_MENU },
297         { 0xfe, 0x51, KEY_UP },
298         { 0xfe, 0x5b, KEY_LEFT },
299         { 0xfe, 0x5f, KEY_RIGHT },
300         { 0xfe, 0x53, KEY_DOWN },
301         { 0xfe, 0x5e, KEY_OK },
302         { 0xfe, 0x59, KEY_INFO },
303         { 0xfe, 0x55, KEY_TAB },
304         { 0xfe, 0x0f, KEY_PREVIOUSSONG },/* Replay */
305         { 0xfe, 0x12, KEY_NEXTSONG },   /* Skip */
306         { 0xfe, 0x42, KEY_ENTER  },     /* Windows/Start */
307         { 0xfe, 0x15, KEY_VOLUMEUP },
308         { 0xfe, 0x05, KEY_VOLUMEDOWN },
309         { 0xfe, 0x11, KEY_CHANNELUP },
310         { 0xfe, 0x09, KEY_CHANNELDOWN },
311         { 0xfe, 0x52, KEY_CAMERA },
312         { 0xfe, 0x5a, KEY_TUNER },      /* Live */
313         { 0xfe, 0x19, KEY_OPEN },
314         { 0xfe, 0x0b, KEY_1 },
315         { 0xfe, 0x17, KEY_2 },
316         { 0xfe, 0x1b, KEY_3 },
317         { 0xfe, 0x07, KEY_4 },
318         { 0xfe, 0x50, KEY_5 },
319         { 0xfe, 0x54, KEY_6 },
320         { 0xfe, 0x48, KEY_7 },
321         { 0xfe, 0x4c, KEY_8 },
322         { 0xfe, 0x58, KEY_9 },
323         { 0xfe, 0x13, KEY_ANGLE },      /* Aspect */
324         { 0xfe, 0x03, KEY_0 },
325         { 0xfe, 0x1f, KEY_ZOOM },
326         { 0xfe, 0x43, KEY_REWIND },
327         { 0xfe, 0x47, KEY_PLAYPAUSE },
328         { 0xfe, 0x4f, KEY_FASTFORWARD },
329         { 0xfe, 0x57, KEY_MUTE },
330         { 0xfe, 0x0d, KEY_STOP },
331         { 0xfe, 0x01, KEY_RECORD },
332         { 0xfe, 0x4e, KEY_POWER },
333 };
334
335 static struct dvb_usb_rc_key dvico_portable_rc_keys[] = {
336         { 0xfc, 0x02, KEY_SETUP },       /* Profile */
337         { 0xfc, 0x43, KEY_POWER2 },
338         { 0xfc, 0x06, KEY_EPG },
339         { 0xfc, 0x5a, KEY_BACK },
340         { 0xfc, 0x05, KEY_MENU },
341         { 0xfc, 0x47, KEY_INFO },
342         { 0xfc, 0x01, KEY_TAB },
343         { 0xfc, 0x42, KEY_PREVIOUSSONG },/* Replay */
344         { 0xfc, 0x49, KEY_VOLUMEUP },
345         { 0xfc, 0x09, KEY_VOLUMEDOWN },
346         { 0xfc, 0x54, KEY_CHANNELUP },
347         { 0xfc, 0x0b, KEY_CHANNELDOWN },
348         { 0xfc, 0x16, KEY_CAMERA },
349         { 0xfc, 0x40, KEY_TUNER },      /* ATV/DTV */
350         { 0xfc, 0x45, KEY_OPEN },
351         { 0xfc, 0x19, KEY_1 },
352         { 0xfc, 0x18, KEY_2 },
353         { 0xfc, 0x1b, KEY_3 },
354         { 0xfc, 0x1a, KEY_4 },
355         { 0xfc, 0x58, KEY_5 },
356         { 0xfc, 0x59, KEY_6 },
357         { 0xfc, 0x15, KEY_7 },
358         { 0xfc, 0x14, KEY_8 },
359         { 0xfc, 0x17, KEY_9 },
360         { 0xfc, 0x44, KEY_ANGLE },      /* Aspect */
361         { 0xfc, 0x55, KEY_0 },
362         { 0xfc, 0x07, KEY_ZOOM },
363         { 0xfc, 0x0a, KEY_REWIND },
364         { 0xfc, 0x08, KEY_PLAYPAUSE },
365         { 0xfc, 0x4b, KEY_FASTFORWARD },
366         { 0xfc, 0x5b, KEY_MUTE },
367         { 0xfc, 0x04, KEY_STOP },
368         { 0xfc, 0x56, KEY_RECORD },
369         { 0xfc, 0x57, KEY_POWER },
370         { 0xfc, 0x41, KEY_UNKNOWN },    /* INPUT */
371         { 0xfc, 0x00, KEY_UNKNOWN },    /* HD */
372 };
373
374 static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
375 {
376         static u8 clock_config []  = { CLOCK_CTL,  0x38, 0x28 };
377         static u8 reset []         = { RESET,      0x80 };
378         static u8 adc_ctl_1_cfg [] = { ADC_CTL_1,  0x40 };
379         static u8 agc_cfg []       = { AGC_TARGET, 0x28, 0x20 };
380         static u8 gpp_ctl_cfg []   = { GPP_CTL,    0x33 };
381         static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
382
383         mt352_write(fe, clock_config,   sizeof(clock_config));
384         udelay(200);
385         mt352_write(fe, reset,          sizeof(reset));
386         mt352_write(fe, adc_ctl_1_cfg,  sizeof(adc_ctl_1_cfg));
387
388         mt352_write(fe, agc_cfg,        sizeof(agc_cfg));
389         mt352_write(fe, gpp_ctl_cfg,    sizeof(gpp_ctl_cfg));
390         mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
391
392         return 0;
393 }
394
395 static int cxusb_mt352_demod_init(struct dvb_frontend* fe)
396 {       /* used in both lgz201 and th7579 */
397         static u8 clock_config []  = { CLOCK_CTL,  0x38, 0x29 };
398         static u8 reset []         = { RESET,      0x80 };
399         static u8 adc_ctl_1_cfg [] = { ADC_CTL_1,  0x40 };
400         static u8 agc_cfg []       = { AGC_TARGET, 0x24, 0x20 };
401         static u8 gpp_ctl_cfg []   = { GPP_CTL,    0x33 };
402         static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
403
404         mt352_write(fe, clock_config,   sizeof(clock_config));
405         udelay(200);
406         mt352_write(fe, reset,          sizeof(reset));
407         mt352_write(fe, adc_ctl_1_cfg,  sizeof(adc_ctl_1_cfg));
408
409         mt352_write(fe, agc_cfg,        sizeof(agc_cfg));
410         mt352_write(fe, gpp_ctl_cfg,    sizeof(gpp_ctl_cfg));
411         mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
412         return 0;
413 }
414
415 static struct cx22702_config cxusb_cx22702_config = {
416         .demod_address = 0x63,
417         .output_mode = CX22702_PARALLEL_OUTPUT,
418 };
419
420 static struct lgdt330x_config cxusb_lgdt3303_config = {
421         .demod_address = 0x0e,
422         .demod_chip    = LGDT3303,
423 };
424
425 static struct mt352_config cxusb_dee1601_config = {
426         .demod_address = 0x0f,
427         .demod_init    = cxusb_dee1601_demod_init,
428 };
429
430 static struct zl10353_config cxusb_zl10353_dee1601_config = {
431         .demod_address = 0x0f,
432         .parallel_ts = 1,
433 };
434
435 static struct mt352_config cxusb_mt352_config = {
436         /* used in both lgz201 and th7579 */
437         .demod_address = 0x0f,
438         .demod_init    = cxusb_mt352_demod_init,
439 };
440
441 static struct zl10353_config cxusb_zl10353_xc3028_config = {
442         .demod_address = 0x0f,
443         .if2 = 45600,
444         .no_tuner = 1,
445         .parallel_ts = 1,
446 };
447
448 static struct mt352_config cxusb_mt352_xc3028_config = {
449         .demod_address = 0x0f,
450         .if2 = 4560,
451         .no_tuner = 1,
452         .demod_init = cxusb_mt352_demod_init,
453 };
454
455 /* Callbacks for DVB USB */
456 static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap)
457 {
458         dvb_attach(simple_tuner_attach, adap->fe,
459                    &adap->dev->i2c_adap, 0x61,
460                    TUNER_PHILIPS_FMD1216ME_MK3);
461         return 0;
462 }
463
464 static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter *adap)
465 {
466         dvb_attach(dvb_pll_attach, adap->fe, 0x61,
467                    NULL, DVB_PLL_THOMSON_DTT7579);
468         return 0;
469 }
470
471 static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap)
472 {
473         dvb_attach(dvb_pll_attach, adap->fe, 0x61, NULL, DVB_PLL_LG_Z201);
474         return 0;
475 }
476
477 static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter *adap)
478 {
479         dvb_attach(dvb_pll_attach, adap->fe, 0x60,
480                    NULL, DVB_PLL_THOMSON_DTT7579);
481         return 0;
482 }
483
484 static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap)
485 {
486         dvb_attach(simple_tuner_attach, adap->fe,
487                    &adap->dev->i2c_adap, 0x61, TUNER_LG_TDVS_H06XF);
488         return 0;
489 }
490
491 static int dvico_bluebird_xc2028_callback(void *ptr, int command, int arg)
492 {
493         struct dvb_usb_device *d = ptr;
494
495         switch (command) {
496         case XC2028_TUNER_RESET:
497                 deb_info("%s: XC2028_TUNER_RESET %d\n", __func__, arg);
498                 cxusb_bluebird_gpio_pulse(d, 0x01, 1);
499                 break;
500         case XC2028_RESET_CLK:
501                 deb_info("%s: XC2028_RESET_CLK %d\n", __func__, arg);
502                 break;
503         default:
504                 deb_info("%s: unknown command %d, arg %d\n", __func__,
505                          command, arg);
506                 return -EINVAL;
507         }
508
509         return 0;
510 }
511
512 static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
513 {
514         struct dvb_frontend      *fe;
515         struct xc2028_config      cfg = {
516                 .i2c_adap  = &adap->dev->i2c_adap,
517                 .i2c_addr  = 0x61,
518                 .callback  = dvico_bluebird_xc2028_callback,
519         };
520         static struct xc2028_ctrl ctl = {
521                 .fname       = "xc3028-dvico-au-01.fw",
522                 .max_len     = 64,
523                 .scode_table = XC3028_FE_ZARLINK456,
524         };
525
526         fe = dvb_attach(xc2028_attach, adap->fe, &cfg);
527         if (fe == NULL || fe->ops.tuner_ops.set_config == NULL)
528                 return -EIO;
529
530         fe->ops.tuner_ops.set_config(fe, &ctl);
531
532         return 0;
533 }
534
535 static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap)
536 {
537         u8 b;
538         if (usb_set_interface(adap->dev->udev, 0, 6) < 0)
539                 err("set interface failed");
540
541         cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, &b, 1);
542
543         if ((adap->fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config,
544                                    &adap->dev->i2c_adap)) != NULL)
545                 return 0;
546
547         return -EIO;
548 }
549
550 static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap)
551 {
552         if (usb_set_interface(adap->dev->udev, 0, 7) < 0)
553                 err("set interface failed");
554
555         cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
556
557         if ((adap->fe = dvb_attach(lgdt330x_attach, &cxusb_lgdt3303_config,
558                                    &adap->dev->i2c_adap)) != NULL)
559                 return 0;
560
561         return -EIO;
562 }
563
564 static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap)
565 {
566         /* used in both lgz201 and th7579 */
567         if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
568                 err("set interface failed");
569
570         cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
571
572         if ((adap->fe = dvb_attach(mt352_attach, &cxusb_mt352_config,
573                                    &adap->dev->i2c_adap)) != NULL)
574                 return 0;
575
576         return -EIO;
577 }
578
579 static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter *adap)
580 {
581         if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
582                 err("set interface failed");
583
584         cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
585
586         if (((adap->fe = dvb_attach(mt352_attach, &cxusb_dee1601_config,
587                                     &adap->dev->i2c_adap)) != NULL) ||
588                 ((adap->fe = dvb_attach(zl10353_attach,
589                                         &cxusb_zl10353_dee1601_config,
590                                         &adap->dev->i2c_adap)) != NULL))
591                 return 0;
592
593         return -EIO;
594 }
595
596 static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap)
597 {
598         u8 ircode[4];
599         int i;
600         struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD,
601                                .buf = ircode, .len = 4 };
602
603         if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
604                 err("set interface failed");
605
606         cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
607
608         /* reset the tuner and demodulator */
609         cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0);
610         cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1);
611         cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
612
613         if ((adap->fe = dvb_attach(zl10353_attach,
614                                    &cxusb_zl10353_xc3028_config,
615                                    &adap->dev->i2c_adap)) == NULL)
616                 return -EIO;
617
618         /* try to determine if there is no IR decoder on the I2C bus */
619         for (i = 0; adap->dev->props.rc_key_map != NULL && i < 5; i++) {
620                 msleep(20);
621                 if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1)
622                         goto no_IR;
623                 if (ircode[0] == 0 && ircode[1] == 0)
624                         continue;
625                 if (ircode[2] + ircode[3] != 0xff) {
626 no_IR:
627                         adap->dev->props.rc_key_map = NULL;
628                         info("No IR receiver detected on this device.");
629                         break;
630                 }
631         }
632
633         return 0;
634 }
635
636 static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap)
637 {
638         if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
639                 err("set interface failed");
640
641         cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
642
643         /* reset the tuner and demodulator */
644         cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0);
645         cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1);
646         cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
647
648         if ((adap->fe = dvb_attach(zl10353_attach,
649                                    &cxusb_zl10353_xc3028_config,
650                                    &adap->dev->i2c_adap)) != NULL)
651                 return 0;
652
653         if ((adap->fe = dvb_attach(mt352_attach,
654                                    &cxusb_mt352_xc3028_config,
655                                    &adap->dev->i2c_adap)) != NULL)
656                 return 0;
657
658         return -EIO;
659 }
660
661 /*
662  * DViCO has shipped two devices with the same USB ID, but only one of them
663  * needs a firmware download.  Check the device class details to see if they
664  * have non-default values to decide whether the device is actually cold or
665  * not, and forget a match if it turns out we selected the wrong device.
666  */
667 static int bluebird_fx2_identify_state(struct usb_device *udev,
668                                        struct dvb_usb_device_properties *props,
669                                        struct dvb_usb_device_description **desc,
670                                        int *cold)
671 {
672         int wascold = *cold;
673
674         *cold = udev->descriptor.bDeviceClass == 0xff &&
675                 udev->descriptor.bDeviceSubClass == 0xff &&
676                 udev->descriptor.bDeviceProtocol == 0xff;
677
678         if (*cold && !wascold)
679                 *desc = NULL;
680
681         return 0;
682 }
683
684 /*
685  * DViCO bluebird firmware needs the "warm" product ID to be patched into the
686  * firmware file before download.
687  */
688
689 static const int dvico_firmware_id_offsets[] = { 6638, 3204 };
690 static int bluebird_patch_dvico_firmware_download(struct usb_device *udev,
691                                                   const struct firmware *fw)
692 {
693         int pos;
694
695         for (pos = 0; pos < ARRAY_SIZE(dvico_firmware_id_offsets); pos++) {
696                 int idoff = dvico_firmware_id_offsets[pos];
697
698                 if (fw->size < idoff + 4)
699                         continue;
700
701                 if (fw->data[idoff] == (USB_VID_DVICO & 0xff) &&
702                     fw->data[idoff + 1] == USB_VID_DVICO >> 8) {
703                         fw->data[idoff + 2] =
704                                 le16_to_cpu(udev->descriptor.idProduct) + 1;
705                         fw->data[idoff + 3] =
706                                 le16_to_cpu(udev->descriptor.idProduct) >> 8;
707
708                         return usb_cypress_load_firmware(udev, fw, CYPRESS_FX2);
709                 }
710         }
711
712         return -EINVAL;
713 }
714
715 /* DVB USB Driver stuff */
716 static struct dvb_usb_device_properties cxusb_medion_properties;
717 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties;
718 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties;
719 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties;
720 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties;
721 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties;
722 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties;
723 static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties;
724
725 static int cxusb_probe(struct usb_interface *intf,
726                        const struct usb_device_id *id)
727 {
728         if (0 == dvb_usb_device_init(intf, &cxusb_medion_properties,
729                                      THIS_MODULE, NULL, adapter_nr) ||
730             0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgh064f_properties,
731                                      THIS_MODULE, NULL, adapter_nr) ||
732             0 == dvb_usb_device_init(intf, &cxusb_bluebird_dee1601_properties,
733                                      THIS_MODULE, NULL, adapter_nr) ||
734             0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgz201_properties,
735                                      THIS_MODULE, NULL, adapter_nr) ||
736             0 == dvb_usb_device_init(intf, &cxusb_bluebird_dtt7579_properties,
737                                      THIS_MODULE, NULL, adapter_nr) ||
738             0 == dvb_usb_device_init(intf, &cxusb_bluebird_dualdig4_properties,
739                                      THIS_MODULE, NULL, adapter_nr) ||
740             0 == dvb_usb_device_init(intf, &cxusb_bluebird_nano2_properties,
741                                      THIS_MODULE, NULL, adapter_nr) ||
742             0 == dvb_usb_device_init(intf,
743                                 &cxusb_bluebird_nano2_needsfirmware_properties,
744                                      THIS_MODULE, NULL, adapter_nr))
745                 return 0;
746
747         return -EINVAL;
748 }
749
750 static struct usb_device_id cxusb_table [] = {
751         { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) },
752         { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) },
753         { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) },
754         { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD) },
755         { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM) },
756         { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) },
757         { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) },
758         { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) },
759         { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) },
760         { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD) },
761         { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM) },
762         { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD) },
763         { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM) },
764         { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4) },
765         { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2) },
766         { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM) },
767         {}              /* Terminating entry */
768 };
769 MODULE_DEVICE_TABLE (usb, cxusb_table);
770
771 static struct dvb_usb_device_properties cxusb_medion_properties = {
772         .caps = DVB_USB_IS_AN_I2C_ADAPTER,
773
774         .usb_ctrl = CYPRESS_FX2,
775
776         .size_of_priv     = sizeof(struct cxusb_state),
777
778         .num_adapters = 1,
779         .adapter = {
780                 {
781                         .streaming_ctrl   = cxusb_streaming_ctrl,
782                         .frontend_attach  = cxusb_cx22702_frontend_attach,
783                         .tuner_attach     = cxusb_fmd1216me_tuner_attach,
784                         /* parameter for the MPEG2-data transfer */
785                                         .stream = {
786                                                 .type = USB_BULK,
787                                 .count = 5,
788                                 .endpoint = 0x02,
789                                 .u = {
790                                         .bulk = {
791                                                 .buffersize = 8192,
792                                         }
793                                 }
794                         },
795
796                 },
797         },
798         .power_ctrl       = cxusb_power_ctrl,
799
800         .i2c_algo         = &cxusb_i2c_algo,
801
802         .generic_bulk_ctrl_endpoint = 0x01,
803
804         .num_device_descs = 1,
805         .devices = {
806                 {   "Medion MD95700 (MDUSBTV-HYBRID)",
807                         { NULL },
808                         { &cxusb_table[0], NULL },
809                 },
810         }
811 };
812
813 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = {
814         .caps = DVB_USB_IS_AN_I2C_ADAPTER,
815
816         .usb_ctrl          = DEVICE_SPECIFIC,
817         .firmware          = "dvb-usb-bluebird-01.fw",
818         .download_firmware = bluebird_patch_dvico_firmware_download,
819         /* use usb alt setting 0 for EP4 transfer (dvb-t),
820            use usb alt setting 7 for EP2 transfer (atsc) */
821
822         .size_of_priv     = sizeof(struct cxusb_state),
823
824         .num_adapters = 1,
825         .adapter = {
826                 {
827                         .streaming_ctrl   = cxusb_streaming_ctrl,
828                         .frontend_attach  = cxusb_lgdt3303_frontend_attach,
829                         .tuner_attach     = cxusb_lgh064f_tuner_attach,
830
831                         /* parameter for the MPEG2-data transfer */
832                                         .stream = {
833                                                 .type = USB_BULK,
834                                 .count = 5,
835                                 .endpoint = 0x02,
836                                 .u = {
837                                         .bulk = {
838                                                 .buffersize = 8192,
839                                         }
840                                 }
841                         },
842                 },
843         },
844
845         .power_ctrl       = cxusb_bluebird_power_ctrl,
846
847         .i2c_algo         = &cxusb_i2c_algo,
848
849         .rc_interval      = 100,
850         .rc_key_map       = dvico_portable_rc_keys,
851         .rc_key_map_size  = ARRAY_SIZE(dvico_portable_rc_keys),
852         .rc_query         = cxusb_rc_query,
853
854         .generic_bulk_ctrl_endpoint = 0x01,
855
856         .num_device_descs = 1,
857         .devices = {
858                 {   "DViCO FusionHDTV5 USB Gold",
859                         { &cxusb_table[1], NULL },
860                         { &cxusb_table[2], NULL },
861                 },
862         }
863 };
864
865 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = {
866         .caps = DVB_USB_IS_AN_I2C_ADAPTER,
867
868         .usb_ctrl          = DEVICE_SPECIFIC,
869         .firmware          = "dvb-usb-bluebird-01.fw",
870         .download_firmware = bluebird_patch_dvico_firmware_download,
871         /* use usb alt setting 0 for EP4 transfer (dvb-t),
872            use usb alt setting 7 for EP2 transfer (atsc) */
873
874         .size_of_priv     = sizeof(struct cxusb_state),
875
876         .num_adapters = 1,
877         .adapter = {
878                 {
879                         .streaming_ctrl   = cxusb_streaming_ctrl,
880                         .frontend_attach  = cxusb_dee1601_frontend_attach,
881                         .tuner_attach     = cxusb_dee1601_tuner_attach,
882                         /* parameter for the MPEG2-data transfer */
883                         .stream = {
884                                 .type = USB_BULK,
885                                 .count = 5,
886                                 .endpoint = 0x04,
887                                 .u = {
888                                         .bulk = {
889                                                 .buffersize = 8192,
890                                         }
891                                 }
892                         },
893                 },
894         },
895
896         .power_ctrl       = cxusb_bluebird_power_ctrl,
897
898         .i2c_algo         = &cxusb_i2c_algo,
899
900         .rc_interval      = 150,
901         .rc_key_map       = dvico_mce_rc_keys,
902         .rc_key_map_size  = ARRAY_SIZE(dvico_mce_rc_keys),
903         .rc_query         = cxusb_rc_query,
904
905         .generic_bulk_ctrl_endpoint = 0x01,
906
907         .num_device_descs = 3,
908         .devices = {
909                 {   "DViCO FusionHDTV DVB-T Dual USB",
910                         { &cxusb_table[3], NULL },
911                         { &cxusb_table[4], NULL },
912                 },
913                 {   "DigitalNow DVB-T Dual USB",
914                         { &cxusb_table[9],  NULL },
915                         { &cxusb_table[10], NULL },
916                 },
917                 {   "DViCO FusionHDTV DVB-T Dual Digital 2",
918                         { &cxusb_table[11], NULL },
919                         { &cxusb_table[12], NULL },
920                 },
921         }
922 };
923
924 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = {
925         .caps = DVB_USB_IS_AN_I2C_ADAPTER,
926
927         .usb_ctrl          = DEVICE_SPECIFIC,
928         .firmware          = "dvb-usb-bluebird-01.fw",
929         .download_firmware = bluebird_patch_dvico_firmware_download,
930         /* use usb alt setting 0 for EP4 transfer (dvb-t),
931            use usb alt setting 7 for EP2 transfer (atsc) */
932
933         .size_of_priv     = sizeof(struct cxusb_state),
934
935         .num_adapters = 2,
936         .adapter = {
937                 {
938                         .streaming_ctrl   = cxusb_streaming_ctrl,
939                         .frontend_attach  = cxusb_mt352_frontend_attach,
940                         .tuner_attach     = cxusb_lgz201_tuner_attach,
941
942                         /* parameter for the MPEG2-data transfer */
943                         .stream = {
944                                 .type = USB_BULK,
945                                 .count = 5,
946                                 .endpoint = 0x04,
947                                 .u = {
948                                         .bulk = {
949                                                 .buffersize = 8192,
950                                         }
951                                 }
952                         },
953                 },
954         },
955         .power_ctrl       = cxusb_bluebird_power_ctrl,
956
957         .i2c_algo         = &cxusb_i2c_algo,
958
959         .rc_interval      = 100,
960         .rc_key_map       = dvico_portable_rc_keys,
961         .rc_key_map_size  = ARRAY_SIZE(dvico_portable_rc_keys),
962         .rc_query         = cxusb_rc_query,
963
964         .generic_bulk_ctrl_endpoint = 0x01,
965         .num_device_descs = 1,
966         .devices = {
967                 {   "DViCO FusionHDTV DVB-T USB (LGZ201)",
968                         { &cxusb_table[5], NULL },
969                         { &cxusb_table[6], NULL },
970                 },
971         }
972 };
973
974 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = {
975         .caps = DVB_USB_IS_AN_I2C_ADAPTER,
976
977         .usb_ctrl          = DEVICE_SPECIFIC,
978         .firmware          = "dvb-usb-bluebird-01.fw",
979         .download_firmware = bluebird_patch_dvico_firmware_download,
980         /* use usb alt setting 0 for EP4 transfer (dvb-t),
981            use usb alt setting 7 for EP2 transfer (atsc) */
982
983         .size_of_priv     = sizeof(struct cxusb_state),
984
985         .num_adapters = 1,
986         .adapter = {
987                 {
988                         .streaming_ctrl   = cxusb_streaming_ctrl,
989                         .frontend_attach  = cxusb_mt352_frontend_attach,
990                         .tuner_attach     = cxusb_dtt7579_tuner_attach,
991
992                         /* parameter for the MPEG2-data transfer */
993                         .stream = {
994                                 .type = USB_BULK,
995                                 .count = 5,
996                                 .endpoint = 0x04,
997                                 .u = {
998                                         .bulk = {
999                                                 .buffersize = 8192,
1000                                         }
1001                                 }
1002                         },
1003                 },
1004         },
1005         .power_ctrl       = cxusb_bluebird_power_ctrl,
1006
1007         .i2c_algo         = &cxusb_i2c_algo,
1008
1009         .rc_interval      = 100,
1010         .rc_key_map       = dvico_portable_rc_keys,
1011         .rc_key_map_size  = ARRAY_SIZE(dvico_portable_rc_keys),
1012         .rc_query         = cxusb_rc_query,
1013
1014         .generic_bulk_ctrl_endpoint = 0x01,
1015
1016         .num_device_descs = 1,
1017         .devices = {
1018                 {   "DViCO FusionHDTV DVB-T USB (TH7579)",
1019                         { &cxusb_table[7], NULL },
1020                         { &cxusb_table[8], NULL },
1021                 },
1022         }
1023 };
1024
1025 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = {
1026         .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1027
1028         .usb_ctrl         = CYPRESS_FX2,
1029
1030         .size_of_priv     = sizeof(struct cxusb_state),
1031
1032         .num_adapters = 1,
1033         .adapter = {
1034                 {
1035                         .streaming_ctrl   = cxusb_streaming_ctrl,
1036                         .frontend_attach  = cxusb_dualdig4_frontend_attach,
1037                         .tuner_attach     = cxusb_dvico_xc3028_tuner_attach,
1038                         /* parameter for the MPEG2-data transfer */
1039                         .stream = {
1040                                 .type = USB_BULK,
1041                                 .count = 5,
1042                                 .endpoint = 0x02,
1043                                 .u = {
1044                                         .bulk = {
1045                                                 .buffersize = 8192,
1046                                         }
1047                                 }
1048                         },
1049                 },
1050         },
1051
1052         .power_ctrl       = cxusb_power_ctrl,
1053
1054         .i2c_algo         = &cxusb_i2c_algo,
1055
1056         .generic_bulk_ctrl_endpoint = 0x01,
1057
1058         .rc_interval      = 100,
1059         .rc_key_map       = dvico_mce_rc_keys,
1060         .rc_key_map_size  = ARRAY_SIZE(dvico_mce_rc_keys),
1061         .rc_query         = cxusb_bluebird2_rc_query,
1062
1063         .num_device_descs = 1,
1064         .devices = {
1065                 {   "DViCO FusionHDTV DVB-T Dual Digital 4",
1066                         { NULL },
1067                         { &cxusb_table[13], NULL },
1068                 },
1069         }
1070 };
1071
1072 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = {
1073         .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1074
1075         .usb_ctrl         = CYPRESS_FX2,
1076         .identify_state   = bluebird_fx2_identify_state,
1077
1078         .size_of_priv     = sizeof(struct cxusb_state),
1079
1080         .num_adapters = 1,
1081         .adapter = {
1082                 {
1083                         .streaming_ctrl   = cxusb_streaming_ctrl,
1084                         .frontend_attach  = cxusb_nano2_frontend_attach,
1085                         .tuner_attach     = cxusb_dvico_xc3028_tuner_attach,
1086                         /* parameter for the MPEG2-data transfer */
1087                         .stream = {
1088                                 .type = USB_BULK,
1089                                 .count = 5,
1090                                 .endpoint = 0x02,
1091                                 .u = {
1092                                         .bulk = {
1093                                                 .buffersize = 8192,
1094                                         }
1095                                 }
1096                         },
1097                 },
1098         },
1099
1100         .power_ctrl       = cxusb_nano2_power_ctrl,
1101
1102         .i2c_algo         = &cxusb_i2c_algo,
1103
1104         .generic_bulk_ctrl_endpoint = 0x01,
1105
1106         .rc_interval      = 100,
1107         .rc_key_map       = dvico_portable_rc_keys,
1108         .rc_key_map_size  = ARRAY_SIZE(dvico_portable_rc_keys),
1109         .rc_query         = cxusb_bluebird2_rc_query,
1110
1111         .num_device_descs = 1,
1112         .devices = {
1113                 {   "DViCO FusionHDTV DVB-T NANO2",
1114                         { NULL },
1115                         { &cxusb_table[14], NULL },
1116                 },
1117         }
1118 };
1119
1120 static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties = {
1121         .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1122
1123         .usb_ctrl          = DEVICE_SPECIFIC,
1124         .firmware          = "dvb-usb-bluebird-02.fw",
1125         .download_firmware = bluebird_patch_dvico_firmware_download,
1126         .identify_state    = bluebird_fx2_identify_state,
1127
1128         .size_of_priv      = sizeof(struct cxusb_state),
1129
1130         .num_adapters = 1,
1131         .adapter = {
1132                 {
1133                         .streaming_ctrl   = cxusb_streaming_ctrl,
1134                         .frontend_attach  = cxusb_nano2_frontend_attach,
1135                         .tuner_attach     = cxusb_dvico_xc3028_tuner_attach,
1136                         /* parameter for the MPEG2-data transfer */
1137                         .stream = {
1138                                 .type = USB_BULK,
1139                                 .count = 5,
1140                                 .endpoint = 0x02,
1141                                 .u = {
1142                                         .bulk = {
1143                                                 .buffersize = 8192,
1144                                         }
1145                                 }
1146                         },
1147                 },
1148         },
1149
1150         .power_ctrl       = cxusb_nano2_power_ctrl,
1151
1152         .i2c_algo         = &cxusb_i2c_algo,
1153
1154         .generic_bulk_ctrl_endpoint = 0x01,
1155
1156         .rc_interval      = 100,
1157         .rc_key_map       = dvico_portable_rc_keys,
1158         .rc_key_map_size  = ARRAY_SIZE(dvico_portable_rc_keys),
1159         .rc_query         = cxusb_rc_query,
1160
1161         .num_device_descs = 1,
1162         .devices = {
1163                 {   "DViCO FusionHDTV DVB-T NANO2 w/o firmware",
1164                         { &cxusb_table[14], NULL },
1165                         { &cxusb_table[15], NULL },
1166                 },
1167         }
1168 };
1169
1170 static struct usb_driver cxusb_driver = {
1171         .name           = "dvb_usb_cxusb",
1172         .probe          = cxusb_probe,
1173         .disconnect     = dvb_usb_device_exit,
1174         .id_table       = cxusb_table,
1175 };
1176
1177 /* module stuff */
1178 static int __init cxusb_module_init(void)
1179 {
1180         int result;
1181         if ((result = usb_register(&cxusb_driver))) {
1182                 err("usb_register failed. Error number %d",result);
1183                 return result;
1184         }
1185
1186         return 0;
1187 }
1188
1189 static void __exit cxusb_module_exit(void)
1190 {
1191         /* deregister this driver from the USB subsystem */
1192         usb_deregister(&cxusb_driver);
1193 }
1194
1195 module_init (cxusb_module_init);
1196 module_exit (cxusb_module_exit);
1197
1198 MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
1199 MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
1200 MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
1201 MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
1202 MODULE_VERSION("1.0-alpha");
1203 MODULE_LICENSE("GPL");