1 /* DVB USB compliant linux driver for Conexant USB reference design.
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.
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
14 * TODO: Use the cx25840-driver for the analogue part
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)
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.
24 * see Documentation/dvb/README.dvb-usb for more information
26 #include <media/tuner.h>
27 #include <linux/vmalloc.h>
28 #include <linux/slab.h>
35 #include "mt352_priv.h"
37 #include "tuner-xc2028.h"
38 #include "tuner-simple.h"
46 /* Max transfer size done by I2C transfer functions */
47 #define MAX_XFER_SIZE 64
50 static int dvb_usb_cxusb_debug
;
51 module_param_named(debug
, dvb_usb_cxusb_debug
, int, 0644);
52 MODULE_PARM_DESC(debug
, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS
);
54 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr
);
56 #define deb_info(args...) dprintk(dvb_usb_cxusb_debug, 0x03, args)
57 #define deb_i2c(args...) dprintk(dvb_usb_cxusb_debug, 0x02, args)
59 static int cxusb_ctrl_msg(struct dvb_usb_device
*d
,
60 u8 cmd
, u8
*wbuf
, int wlen
, u8
*rbuf
, int rlen
)
62 int wo
= (rbuf
== NULL
|| rlen
== 0); /* write-only */
63 u8 sndbuf
[MAX_XFER_SIZE
];
65 if (1 + wlen
> sizeof(sndbuf
)) {
66 warn("i2c wr: len=%d is too big!\n",
71 memset(sndbuf
, 0, 1+wlen
);
74 memcpy(&sndbuf
[1], wbuf
, wlen
);
76 return dvb_usb_generic_write(d
, sndbuf
, 1+wlen
);
78 return dvb_usb_generic_rw(d
, sndbuf
, 1+wlen
, rbuf
, rlen
, 0);
82 static void cxusb_gpio_tuner(struct dvb_usb_device
*d
, int onoff
)
84 struct cxusb_state
*st
= d
->priv
;
87 if (st
->gpio_write_state
[GPIO_TUNER
] == onoff
)
92 cxusb_ctrl_msg(d
, CMD_GPIO_WRITE
, o
, 2, &i
, 1);
95 deb_info("gpio_write failed.\n");
97 st
->gpio_write_state
[GPIO_TUNER
] = onoff
;
100 static int cxusb_bluebird_gpio_rw(struct dvb_usb_device
*d
, u8 changemask
,
106 o
[0] = 0xff & ~changemask
; /* mask of bits to keep */
107 o
[1] = newval
& changemask
; /* new values for bits */
109 rc
= cxusb_ctrl_msg(d
, CMD_BLUEBIRD_GPIO_RW
, o
, 2, &gpio_state
, 1);
110 if (rc
< 0 || (gpio_state
& changemask
) != (newval
& changemask
))
111 deb_info("bluebird_gpio_write failed.\n");
113 return rc
< 0 ? rc
: gpio_state
;
116 static void cxusb_bluebird_gpio_pulse(struct dvb_usb_device
*d
, u8 pin
, int low
)
118 cxusb_bluebird_gpio_rw(d
, pin
, low
? 0 : pin
);
120 cxusb_bluebird_gpio_rw(d
, pin
, low
? pin
: 0);
123 static void cxusb_nano2_led(struct dvb_usb_device
*d
, int onoff
)
125 cxusb_bluebird_gpio_rw(d
, 0x40, onoff
? 0 : 0x40);
128 static int cxusb_d680_dmb_gpio_tuner(struct dvb_usb_device
*d
,
131 u8 o
[2] = {addr
, onoff
};
135 rc
= cxusb_ctrl_msg(d
, CMD_GPIO_WRITE
, o
, 2, &i
, 1);
142 deb_info("gpio_write failed.\n");
148 static int cxusb_i2c_xfer(struct i2c_adapter
*adap
, struct i2c_msg msg
[],
151 struct dvb_usb_device
*d
= i2c_get_adapdata(adap
);
155 if (mutex_lock_interruptible(&d
->i2c_mutex
) < 0)
158 for (i
= 0; i
< num
; i
++) {
160 if (d
->udev
->descriptor
.idVendor
== USB_VID_MEDION
)
161 switch (msg
[i
].addr
) {
163 cxusb_gpio_tuner(d
, 0);
166 cxusb_gpio_tuner(d
, 1);
170 if (msg
[i
].flags
& I2C_M_RD
) {
172 u8 obuf
[3], ibuf
[MAX_XFER_SIZE
];
174 if (1 + msg
[i
].len
> sizeof(ibuf
)) {
175 warn("i2c rd: len=%d is too big!\n",
181 obuf
[1] = msg
[i
].len
;
182 obuf
[2] = msg
[i
].addr
;
183 if (cxusb_ctrl_msg(d
, CMD_I2C_READ
,
185 ibuf
, 1+msg
[i
].len
) < 0) {
186 warn("i2c read failed");
189 memcpy(msg
[i
].buf
, &ibuf
[1], msg
[i
].len
);
190 } else if (i
+1 < num
&& (msg
[i
+1].flags
& I2C_M_RD
) &&
191 msg
[i
].addr
== msg
[i
+1].addr
) {
192 /* write to then read from same address */
193 u8 obuf
[MAX_XFER_SIZE
], ibuf
[MAX_XFER_SIZE
];
195 if (3 + msg
[i
].len
> sizeof(obuf
)) {
196 warn("i2c wr: len=%d is too big!\n",
201 if (1 + msg
[i
+ 1].len
> sizeof(ibuf
)) {
202 warn("i2c rd: len=%d is too big!\n",
207 obuf
[0] = msg
[i
].len
;
208 obuf
[1] = msg
[i
+1].len
;
209 obuf
[2] = msg
[i
].addr
;
210 memcpy(&obuf
[3], msg
[i
].buf
, msg
[i
].len
);
212 if (cxusb_ctrl_msg(d
, CMD_I2C_READ
,
214 ibuf
, 1+msg
[i
+1].len
) < 0)
218 deb_i2c("i2c read may have failed\n");
220 memcpy(msg
[i
+1].buf
, &ibuf
[1], msg
[i
+1].len
);
225 u8 obuf
[MAX_XFER_SIZE
], ibuf
;
227 if (2 + msg
[i
].len
> sizeof(obuf
)) {
228 warn("i2c wr: len=%d is too big!\n",
233 obuf
[0] = msg
[i
].addr
;
234 obuf
[1] = msg
[i
].len
;
235 memcpy(&obuf
[2], msg
[i
].buf
, msg
[i
].len
);
237 if (cxusb_ctrl_msg(d
, CMD_I2C_WRITE
, obuf
,
238 2+msg
[i
].len
, &ibuf
,1) < 0)
241 deb_i2c("i2c write may have failed\n");
251 mutex_unlock(&d
->i2c_mutex
);
255 static u32
cxusb_i2c_func(struct i2c_adapter
*adapter
)
260 static struct i2c_algorithm cxusb_i2c_algo
= {
261 .master_xfer
= cxusb_i2c_xfer
,
262 .functionality
= cxusb_i2c_func
,
265 static int cxusb_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
269 return cxusb_ctrl_msg(d
, CMD_POWER_ON
, &b
, 1, NULL
, 0);
271 return cxusb_ctrl_msg(d
, CMD_POWER_OFF
, &b
, 1, NULL
, 0);
274 static int cxusb_aver_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
278 return cxusb_ctrl_msg(d
, CMD_POWER_OFF
, NULL
, 0, NULL
, 0);
279 if (d
->state
== DVB_USB_STATE_INIT
&&
280 usb_set_interface(d
->udev
, 0, 0) < 0)
281 err("set interface failed");
282 do {} while (!(ret
= cxusb_ctrl_msg(d
, CMD_POWER_ON
, NULL
, 0, NULL
, 0)) &&
283 !(ret
= cxusb_ctrl_msg(d
, 0x15, NULL
, 0, NULL
, 0)) &&
284 !(ret
= cxusb_ctrl_msg(d
, 0x17, NULL
, 0, NULL
, 0)) && 0);
286 /* FIXME: We don't know why, but we need to configure the
287 * lgdt3303 with the register settings below on resume */
290 0x0e, 0x2, 0x00, 0x7f,
291 0x0e, 0x2, 0x02, 0xfe,
292 0x0e, 0x2, 0x02, 0x01,
293 0x0e, 0x2, 0x00, 0x03,
294 0x0e, 0x2, 0x0d, 0x40,
295 0x0e, 0x2, 0x0e, 0x87,
296 0x0e, 0x2, 0x0f, 0x8e,
297 0x0e, 0x2, 0x10, 0x01,
298 0x0e, 0x2, 0x14, 0xd7,
299 0x0e, 0x2, 0x47, 0x88,
302 for (i
= 0; i
< sizeof(bufs
)/sizeof(u8
); i
+= 4/sizeof(u8
)) {
303 ret
= cxusb_ctrl_msg(d
, CMD_I2C_WRITE
,
314 static int cxusb_bluebird_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
318 return cxusb_ctrl_msg(d
, CMD_POWER_ON
, &b
, 1, NULL
, 0);
323 static int cxusb_nano2_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
327 rc
= cxusb_power_ctrl(d
, onoff
);
329 cxusb_nano2_led(d
, 0);
334 static int cxusb_d680_dmb_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
338 ret
= cxusb_power_ctrl(d
, onoff
);
343 cxusb_ctrl_msg(d
, CMD_DIGITAL
, NULL
, 0, &b
, 1);
348 static int cxusb_streaming_ctrl(struct dvb_usb_adapter
*adap
, int onoff
)
350 u8 buf
[2] = { 0x03, 0x00 };
352 cxusb_ctrl_msg(adap
->dev
, CMD_STREAMING_ON
, buf
, 2, NULL
, 0);
354 cxusb_ctrl_msg(adap
->dev
, CMD_STREAMING_OFF
, NULL
, 0, NULL
, 0);
359 static int cxusb_aver_streaming_ctrl(struct dvb_usb_adapter
*adap
, int onoff
)
362 cxusb_ctrl_msg(adap
->dev
, CMD_AVER_STREAM_ON
, NULL
, 0, NULL
, 0);
364 cxusb_ctrl_msg(adap
->dev
, CMD_AVER_STREAM_OFF
,
369 static void cxusb_d680_dmb_drain_message(struct dvb_usb_device
*d
)
371 int ep
= d
->props
.generic_bulk_ctrl_endpoint
;
372 const int timeout
= 100;
373 const int junk_len
= 32;
377 /* Discard remaining data in video pipe */
378 junk
= kmalloc(junk_len
, GFP_KERNEL
);
382 if (usb_bulk_msg(d
->udev
,
383 usb_rcvbulkpipe(d
->udev
, ep
),
384 junk
, junk_len
, &rd_count
, timeout
) < 0)
392 static void cxusb_d680_dmb_drain_video(struct dvb_usb_device
*d
)
394 struct usb_data_stream_properties
*p
= &d
->props
.adapter
[0].fe
[0].stream
;
395 const int timeout
= 100;
396 const int junk_len
= p
->u
.bulk
.buffersize
;
400 /* Discard remaining data in video pipe */
401 junk
= kmalloc(junk_len
, GFP_KERNEL
);
405 if (usb_bulk_msg(d
->udev
,
406 usb_rcvbulkpipe(d
->udev
, p
->endpoint
),
407 junk
, junk_len
, &rd_count
, timeout
) < 0)
415 static int cxusb_d680_dmb_streaming_ctrl(
416 struct dvb_usb_adapter
*adap
, int onoff
)
419 u8 buf
[2] = { 0x03, 0x00 };
420 cxusb_d680_dmb_drain_video(adap
->dev
);
421 return cxusb_ctrl_msg(adap
->dev
, CMD_STREAMING_ON
,
422 buf
, sizeof(buf
), NULL
, 0);
424 int ret
= cxusb_ctrl_msg(adap
->dev
,
425 CMD_STREAMING_OFF
, NULL
, 0, NULL
, 0);
430 static int cxusb_rc_query(struct dvb_usb_device
*d
, u32
*event
, int *state
)
432 struct rc_map_table
*keymap
= d
->props
.rc
.legacy
.rc_map_table
;
436 cxusb_ctrl_msg(d
, CMD_GET_IR_CODE
, NULL
, 0, ircode
, 4);
439 *state
= REMOTE_NO_KEY_PRESSED
;
441 for (i
= 0; i
< d
->props
.rc
.legacy
.rc_map_size
; i
++) {
442 if (rc5_custom(&keymap
[i
]) == ircode
[2] &&
443 rc5_data(&keymap
[i
]) == ircode
[3]) {
444 *event
= keymap
[i
].keycode
;
445 *state
= REMOTE_KEY_PRESSED
;
454 static int cxusb_bluebird2_rc_query(struct dvb_usb_device
*d
, u32
*event
,
457 struct rc_map_table
*keymap
= d
->props
.rc
.legacy
.rc_map_table
;
460 struct i2c_msg msg
= { .addr
= 0x6b, .flags
= I2C_M_RD
,
461 .buf
= ircode
, .len
= 4 };
464 *state
= REMOTE_NO_KEY_PRESSED
;
466 if (cxusb_i2c_xfer(&d
->i2c_adap
, &msg
, 1) != 1)
469 for (i
= 0; i
< d
->props
.rc
.legacy
.rc_map_size
; i
++) {
470 if (rc5_custom(&keymap
[i
]) == ircode
[1] &&
471 rc5_data(&keymap
[i
]) == ircode
[2]) {
472 *event
= keymap
[i
].keycode
;
473 *state
= REMOTE_KEY_PRESSED
;
482 static int cxusb_d680_dmb_rc_query(struct dvb_usb_device
*d
, u32
*event
,
485 struct rc_map_table
*keymap
= d
->props
.rc
.legacy
.rc_map_table
;
490 *state
= REMOTE_NO_KEY_PRESSED
;
492 if (cxusb_ctrl_msg(d
, 0x10, NULL
, 0, ircode
, 2) < 0)
495 for (i
= 0; i
< d
->props
.rc
.legacy
.rc_map_size
; i
++) {
496 if (rc5_custom(&keymap
[i
]) == ircode
[0] &&
497 rc5_data(&keymap
[i
]) == ircode
[1]) {
498 *event
= keymap
[i
].keycode
;
499 *state
= REMOTE_KEY_PRESSED
;
508 static struct rc_map_table rc_map_dvico_mce_table
[] = {
512 { 0xfe1e, KEY_FAVORITES
},
513 { 0xfe16, KEY_SETUP
},
514 { 0xfe46, KEY_POWER2
},
516 { 0xfe49, KEY_BACK
},
517 { 0xfe4d, KEY_MENU
},
519 { 0xfe5b, KEY_LEFT
},
520 { 0xfe5f, KEY_RIGHT
},
521 { 0xfe53, KEY_DOWN
},
523 { 0xfe59, KEY_INFO
},
525 { 0xfe0f, KEY_PREVIOUSSONG
},/* Replay */
526 { 0xfe12, KEY_NEXTSONG
}, /* Skip */
527 { 0xfe42, KEY_ENTER
}, /* Windows/Start */
528 { 0xfe15, KEY_VOLUMEUP
},
529 { 0xfe05, KEY_VOLUMEDOWN
},
530 { 0xfe11, KEY_CHANNELUP
},
531 { 0xfe09, KEY_CHANNELDOWN
},
532 { 0xfe52, KEY_CAMERA
},
533 { 0xfe5a, KEY_TUNER
}, /* Live */
534 { 0xfe19, KEY_OPEN
},
544 { 0xfe13, KEY_ANGLE
}, /* Aspect */
546 { 0xfe1f, KEY_ZOOM
},
547 { 0xfe43, KEY_REWIND
},
548 { 0xfe47, KEY_PLAYPAUSE
},
549 { 0xfe4f, KEY_FASTFORWARD
},
550 { 0xfe57, KEY_MUTE
},
551 { 0xfe0d, KEY_STOP
},
552 { 0xfe01, KEY_RECORD
},
553 { 0xfe4e, KEY_POWER
},
556 static struct rc_map_table rc_map_dvico_portable_table
[] = {
557 { 0xfc02, KEY_SETUP
}, /* Profile */
558 { 0xfc43, KEY_POWER2
},
560 { 0xfc5a, KEY_BACK
},
561 { 0xfc05, KEY_MENU
},
562 { 0xfc47, KEY_INFO
},
564 { 0xfc42, KEY_PREVIOUSSONG
},/* Replay */
565 { 0xfc49, KEY_VOLUMEUP
},
566 { 0xfc09, KEY_VOLUMEDOWN
},
567 { 0xfc54, KEY_CHANNELUP
},
568 { 0xfc0b, KEY_CHANNELDOWN
},
569 { 0xfc16, KEY_CAMERA
},
570 { 0xfc40, KEY_TUNER
}, /* ATV/DTV */
571 { 0xfc45, KEY_OPEN
},
581 { 0xfc44, KEY_ANGLE
}, /* Aspect */
583 { 0xfc07, KEY_ZOOM
},
584 { 0xfc0a, KEY_REWIND
},
585 { 0xfc08, KEY_PLAYPAUSE
},
586 { 0xfc4b, KEY_FASTFORWARD
},
587 { 0xfc5b, KEY_MUTE
},
588 { 0xfc04, KEY_STOP
},
589 { 0xfc56, KEY_RECORD
},
590 { 0xfc57, KEY_POWER
},
591 { 0xfc41, KEY_UNKNOWN
}, /* INPUT */
592 { 0xfc00, KEY_UNKNOWN
}, /* HD */
595 static struct rc_map_table rc_map_d680_dmb_table
[] = {
596 { 0x0038, KEY_UNKNOWN
}, /* TV/AV */
597 { 0x080c, KEY_ZOOM
},
608 { 0x000a, KEY_MUTE
},
609 { 0x0829, KEY_BACK
},
610 { 0x0012, KEY_CHANNELUP
},
611 { 0x0813, KEY_CHANNELDOWN
},
612 { 0x002b, KEY_VOLUMEUP
},
613 { 0x082c, KEY_VOLUMEDOWN
},
615 { 0x0821, KEY_DOWN
},
616 { 0x0011, KEY_LEFT
},
617 { 0x0810, KEY_RIGHT
},
619 { 0x081f, KEY_RECORD
},
620 { 0x0017, KEY_PLAYPAUSE
},
621 { 0x0816, KEY_PLAYPAUSE
},
622 { 0x000b, KEY_STOP
},
623 { 0x0827, KEY_FASTFORWARD
},
624 { 0x0026, KEY_REWIND
},
625 { 0x081e, KEY_UNKNOWN
}, /* Time Shift */
626 { 0x000e, KEY_UNKNOWN
}, /* Snapshot */
627 { 0x082d, KEY_UNKNOWN
}, /* Mouse Cursor */
628 { 0x000f, KEY_UNKNOWN
}, /* Minimize/Maximize */
629 { 0x0814, KEY_UNKNOWN
}, /* Shuffle */
630 { 0x0025, KEY_POWER
},
633 static int cxusb_dee1601_demod_init(struct dvb_frontend
* fe
)
635 static u8 clock_config
[] = { CLOCK_CTL
, 0x38, 0x28 };
636 static u8 reset
[] = { RESET
, 0x80 };
637 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
638 static u8 agc_cfg
[] = { AGC_TARGET
, 0x28, 0x20 };
639 static u8 gpp_ctl_cfg
[] = { GPP_CTL
, 0x33 };
640 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x32 };
642 mt352_write(fe
, clock_config
, sizeof(clock_config
));
644 mt352_write(fe
, reset
, sizeof(reset
));
645 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
647 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
648 mt352_write(fe
, gpp_ctl_cfg
, sizeof(gpp_ctl_cfg
));
649 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
654 static int cxusb_mt352_demod_init(struct dvb_frontend
* fe
)
655 { /* used in both lgz201 and th7579 */
656 static u8 clock_config
[] = { CLOCK_CTL
, 0x38, 0x29 };
657 static u8 reset
[] = { RESET
, 0x80 };
658 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
659 static u8 agc_cfg
[] = { AGC_TARGET
, 0x24, 0x20 };
660 static u8 gpp_ctl_cfg
[] = { GPP_CTL
, 0x33 };
661 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x32 };
663 mt352_write(fe
, clock_config
, sizeof(clock_config
));
665 mt352_write(fe
, reset
, sizeof(reset
));
666 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
668 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
669 mt352_write(fe
, gpp_ctl_cfg
, sizeof(gpp_ctl_cfg
));
670 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
674 static struct cx22702_config cxusb_cx22702_config
= {
675 .demod_address
= 0x63,
676 .output_mode
= CX22702_PARALLEL_OUTPUT
,
679 static struct lgdt330x_config cxusb_lgdt3303_config
= {
680 .demod_address
= 0x0e,
681 .demod_chip
= LGDT3303
,
684 static struct lgdt330x_config cxusb_aver_lgdt3303_config
= {
685 .demod_address
= 0x0e,
686 .demod_chip
= LGDT3303
,
687 .clock_polarity_flip
= 2,
690 static struct mt352_config cxusb_dee1601_config
= {
691 .demod_address
= 0x0f,
692 .demod_init
= cxusb_dee1601_demod_init
,
695 static struct zl10353_config cxusb_zl10353_dee1601_config
= {
696 .demod_address
= 0x0f,
700 static struct mt352_config cxusb_mt352_config
= {
701 /* used in both lgz201 and th7579 */
702 .demod_address
= 0x0f,
703 .demod_init
= cxusb_mt352_demod_init
,
706 static struct zl10353_config cxusb_zl10353_xc3028_config
= {
707 .demod_address
= 0x0f,
713 static struct zl10353_config cxusb_zl10353_xc3028_config_no_i2c_gate
= {
714 .demod_address
= 0x0f,
718 .disable_i2c_gate_ctrl
= 1,
721 static struct mt352_config cxusb_mt352_xc3028_config
= {
722 .demod_address
= 0x0f,
725 .demod_init
= cxusb_mt352_demod_init
,
728 /* FIXME: needs tweaking */
729 static struct mxl5005s_config aver_a868r_tuner
= {
731 .if_freq
= 6000000UL,
732 .xtal_freq
= CRYSTAL_FREQ_16000000HZ
,
733 .agc_mode
= MXL_SINGLE_AGC
,
734 .tracking_filter
= MXL_TF_C
,
735 .rssi_enable
= MXL_RSSI_ENABLE
,
736 .cap_select
= MXL_CAP_SEL_ENABLE
,
737 .div_out
= MXL_DIV_OUT_4
,
738 .clock_out
= MXL_CLOCK_OUT_DISABLE
,
739 .output_load
= MXL5005S_IF_OUTPUT_LOAD_200_OHM
,
740 .top
= MXL5005S_TOP_25P2
,
741 .mod_mode
= MXL_DIGITAL_MODE
,
742 .if_mode
= MXL_ZERO_IF
,
743 .AgcMasterByte
= 0x00,
746 /* FIXME: needs tweaking */
747 static struct mxl5005s_config d680_dmb_tuner
= {
749 .if_freq
= 36125000UL,
750 .xtal_freq
= CRYSTAL_FREQ_16000000HZ
,
751 .agc_mode
= MXL_SINGLE_AGC
,
752 .tracking_filter
= MXL_TF_C
,
753 .rssi_enable
= MXL_RSSI_ENABLE
,
754 .cap_select
= MXL_CAP_SEL_ENABLE
,
755 .div_out
= MXL_DIV_OUT_4
,
756 .clock_out
= MXL_CLOCK_OUT_DISABLE
,
757 .output_load
= MXL5005S_IF_OUTPUT_LOAD_200_OHM
,
758 .top
= MXL5005S_TOP_25P2
,
759 .mod_mode
= MXL_DIGITAL_MODE
,
760 .if_mode
= MXL_ZERO_IF
,
761 .AgcMasterByte
= 0x00,
764 static struct max2165_config mygica_d689_max2165_cfg
= {
769 /* Callbacks for DVB USB */
770 static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter
*adap
)
772 dvb_attach(simple_tuner_attach
, adap
->fe_adap
[0].fe
,
773 &adap
->dev
->i2c_adap
, 0x61,
774 TUNER_PHILIPS_FMD1216ME_MK3
);
778 static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter
*adap
)
780 dvb_attach(dvb_pll_attach
, adap
->fe_adap
[0].fe
, 0x61,
781 NULL
, DVB_PLL_THOMSON_DTT7579
);
785 static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter
*adap
)
787 dvb_attach(dvb_pll_attach
, adap
->fe_adap
[0].fe
, 0x61, NULL
, DVB_PLL_LG_Z201
);
791 static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter
*adap
)
793 dvb_attach(dvb_pll_attach
, adap
->fe_adap
[0].fe
, 0x60,
794 NULL
, DVB_PLL_THOMSON_DTT7579
);
798 static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter
*adap
)
800 dvb_attach(simple_tuner_attach
, adap
->fe_adap
[0].fe
,
801 &adap
->dev
->i2c_adap
, 0x61, TUNER_LG_TDVS_H06XF
);
805 static int dvico_bluebird_xc2028_callback(void *ptr
, int component
,
806 int command
, int arg
)
808 struct dvb_usb_adapter
*adap
= ptr
;
809 struct dvb_usb_device
*d
= adap
->dev
;
812 case XC2028_TUNER_RESET
:
813 deb_info("%s: XC2028_TUNER_RESET %d\n", __func__
, arg
);
814 cxusb_bluebird_gpio_pulse(d
, 0x01, 1);
816 case XC2028_RESET_CLK
:
817 deb_info("%s: XC2028_RESET_CLK %d\n", __func__
, arg
);
820 deb_info("%s: unknown command %d, arg %d\n", __func__
,
828 static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter
*adap
)
830 struct dvb_frontend
*fe
;
831 struct xc2028_config cfg
= {
832 .i2c_adap
= &adap
->dev
->i2c_adap
,
835 static struct xc2028_ctrl ctl
= {
836 .fname
= XC2028_DEFAULT_FIRMWARE
,
838 .demod
= XC3028_FE_ZARLINK456
,
841 /* FIXME: generalize & move to common area */
842 adap
->fe_adap
[0].fe
->callback
= dvico_bluebird_xc2028_callback
;
844 fe
= dvb_attach(xc2028_attach
, adap
->fe_adap
[0].fe
, &cfg
);
845 if (fe
== NULL
|| fe
->ops
.tuner_ops
.set_config
== NULL
)
848 fe
->ops
.tuner_ops
.set_config(fe
, &ctl
);
853 static int cxusb_mxl5003s_tuner_attach(struct dvb_usb_adapter
*adap
)
855 dvb_attach(mxl5005s_attach
, adap
->fe_adap
[0].fe
,
856 &adap
->dev
->i2c_adap
, &aver_a868r_tuner
);
860 static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter
*adap
)
862 struct dvb_frontend
*fe
;
863 fe
= dvb_attach(mxl5005s_attach
, adap
->fe_adap
[0].fe
,
864 &adap
->dev
->i2c_adap
, &d680_dmb_tuner
);
865 return (fe
== NULL
) ? -EIO
: 0;
868 static int cxusb_mygica_d689_tuner_attach(struct dvb_usb_adapter
*adap
)
870 struct dvb_frontend
*fe
;
871 fe
= dvb_attach(max2165_attach
, adap
->fe_adap
[0].fe
,
872 &adap
->dev
->i2c_adap
, &mygica_d689_max2165_cfg
);
873 return (fe
== NULL
) ? -EIO
: 0;
876 static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter
*adap
)
879 if (usb_set_interface(adap
->dev
->udev
, 0, 6) < 0)
880 err("set interface failed");
882 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, &b
, 1);
884 adap
->fe_adap
[0].fe
= dvb_attach(cx22702_attach
, &cxusb_cx22702_config
,
885 &adap
->dev
->i2c_adap
);
886 if ((adap
->fe_adap
[0].fe
) != NULL
)
892 static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter
*adap
)
894 if (usb_set_interface(adap
->dev
->udev
, 0, 7) < 0)
895 err("set interface failed");
897 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
899 adap
->fe_adap
[0].fe
= dvb_attach(lgdt330x_attach
,
900 &cxusb_lgdt3303_config
,
901 &adap
->dev
->i2c_adap
);
902 if ((adap
->fe_adap
[0].fe
) != NULL
)
908 static int cxusb_aver_lgdt3303_frontend_attach(struct dvb_usb_adapter
*adap
)
910 adap
->fe_adap
[0].fe
= dvb_attach(lgdt330x_attach
, &cxusb_aver_lgdt3303_config
,
911 &adap
->dev
->i2c_adap
);
912 if (adap
->fe_adap
[0].fe
!= NULL
)
918 static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter
*adap
)
920 /* used in both lgz201 and th7579 */
921 if (usb_set_interface(adap
->dev
->udev
, 0, 0) < 0)
922 err("set interface failed");
924 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
926 adap
->fe_adap
[0].fe
= dvb_attach(mt352_attach
, &cxusb_mt352_config
,
927 &adap
->dev
->i2c_adap
);
928 if ((adap
->fe_adap
[0].fe
) != NULL
)
934 static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter
*adap
)
936 if (usb_set_interface(adap
->dev
->udev
, 0, 0) < 0)
937 err("set interface failed");
939 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
941 adap
->fe_adap
[0].fe
= dvb_attach(mt352_attach
, &cxusb_dee1601_config
,
942 &adap
->dev
->i2c_adap
);
943 if ((adap
->fe_adap
[0].fe
) != NULL
)
946 adap
->fe_adap
[0].fe
= dvb_attach(zl10353_attach
,
947 &cxusb_zl10353_dee1601_config
,
948 &adap
->dev
->i2c_adap
);
949 if ((adap
->fe_adap
[0].fe
) != NULL
)
955 static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter
*adap
)
959 struct i2c_msg msg
= { .addr
= 0x6b, .flags
= I2C_M_RD
,
960 .buf
= ircode
, .len
= 4 };
962 if (usb_set_interface(adap
->dev
->udev
, 0, 1) < 0)
963 err("set interface failed");
965 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
967 /* reset the tuner and demodulator */
968 cxusb_bluebird_gpio_rw(adap
->dev
, 0x04, 0);
969 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x01, 1);
970 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x02, 1);
972 adap
->fe_adap
[0].fe
=
973 dvb_attach(zl10353_attach
,
974 &cxusb_zl10353_xc3028_config_no_i2c_gate
,
975 &adap
->dev
->i2c_adap
);
976 if ((adap
->fe_adap
[0].fe
) == NULL
)
979 /* try to determine if there is no IR decoder on the I2C bus */
980 for (i
= 0; adap
->dev
->props
.rc
.legacy
.rc_map_table
!= NULL
&& i
< 5; i
++) {
982 if (cxusb_i2c_xfer(&adap
->dev
->i2c_adap
, &msg
, 1) != 1)
984 if (ircode
[0] == 0 && ircode
[1] == 0)
986 if (ircode
[2] + ircode
[3] != 0xff) {
988 adap
->dev
->props
.rc
.legacy
.rc_map_table
= NULL
;
989 info("No IR receiver detected on this device.");
997 static struct dibx000_agc_config dib7070_agc_config
= {
998 .band_caps
= BAND_UHF
| BAND_VHF
| BAND_LBAND
| BAND_SBAND
,
1001 * P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5,
1002 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1003 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0
1005 .setup
= (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) |
1006 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1008 .time_stabiliz
= 10,
1032 .perform_agc_softsplit
= 0,
1035 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz
= {
1045 .IO_CLK_en_core
= 1,
1048 /* refsel, sel, freq_15k */
1049 .sad_cfg
= (3 << 14) | (1 << 12) | (524 << 0),
1050 .ifreq
= (0 << 25) | 0,
1052 .xtal_hz
= 12000000,
1055 static struct dib7000p_config cxusb_dualdig4_rev2_config
= {
1056 .output_mode
= OUTMODE_MPEG2_PAR_GATED_CLK
,
1057 .output_mpeg2_in_188_bytes
= 1,
1059 .agc_config_count
= 1,
1060 .agc
= &dib7070_agc_config
,
1061 .bw
= &dib7070_bw_config_12_mhz
,
1062 .tuner_is_baseband
= 1,
1068 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
1070 .hostbus_diversity
= 1,
1073 static int cxusb_dualdig4_rev2_frontend_attach(struct dvb_usb_adapter
*adap
)
1075 if (usb_set_interface(adap
->dev
->udev
, 0, 1) < 0)
1076 err("set interface failed");
1078 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
1080 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x02, 1);
1082 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
1083 &cxusb_dualdig4_rev2_config
) < 0) {
1084 printk(KERN_WARNING
"Unable to enumerate dib7000p\n");
1088 adap
->fe_adap
[0].fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x80,
1089 &cxusb_dualdig4_rev2_config
);
1090 if (adap
->fe_adap
[0].fe
== NULL
)
1096 static int dib7070_tuner_reset(struct dvb_frontend
*fe
, int onoff
)
1098 return dib7000p_set_gpio(fe
, 8, 0, !onoff
);
1101 static int dib7070_tuner_sleep(struct dvb_frontend
*fe
, int onoff
)
1106 static struct dib0070_config dib7070p_dib0070_config
= {
1107 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
1108 .reset
= dib7070_tuner_reset
,
1109 .sleep
= dib7070_tuner_sleep
,
1113 struct dib0700_adapter_state
{
1114 int (*set_param_save
) (struct dvb_frontend
*);
1117 static int dib7070_set_param_override(struct dvb_frontend
*fe
)
1119 struct dtv_frontend_properties
*p
= &fe
->dtv_property_cache
;
1120 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
1121 struct dib0700_adapter_state
*state
= adap
->priv
;
1124 u8 band
= BAND_OF_FREQUENCY(p
->frequency
/1000);
1126 case BAND_VHF
: offset
= 950; break;
1128 case BAND_UHF
: offset
= 550; break;
1131 dib7000p_set_wbd_ref(fe
, offset
+ dib0070_wbd_offset(fe
));
1133 return state
->set_param_save(fe
);
1136 static int cxusb_dualdig4_rev2_tuner_attach(struct dvb_usb_adapter
*adap
)
1138 struct dib0700_adapter_state
*st
= adap
->priv
;
1139 struct i2c_adapter
*tun_i2c
=
1140 dib7000p_get_i2c_master(adap
->fe_adap
[0].fe
,
1141 DIBX000_I2C_INTERFACE_TUNER
, 1);
1143 if (dvb_attach(dib0070_attach
, adap
->fe_adap
[0].fe
, tun_i2c
,
1144 &dib7070p_dib0070_config
) == NULL
)
1147 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
1148 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib7070_set_param_override
;
1152 static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter
*adap
)
1154 if (usb_set_interface(adap
->dev
->udev
, 0, 1) < 0)
1155 err("set interface failed");
1157 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
1159 /* reset the tuner and demodulator */
1160 cxusb_bluebird_gpio_rw(adap
->dev
, 0x04, 0);
1161 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x01, 1);
1162 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x02, 1);
1164 adap
->fe_adap
[0].fe
= dvb_attach(zl10353_attach
,
1165 &cxusb_zl10353_xc3028_config
,
1166 &adap
->dev
->i2c_adap
);
1167 if ((adap
->fe_adap
[0].fe
) != NULL
)
1170 adap
->fe_adap
[0].fe
= dvb_attach(mt352_attach
,
1171 &cxusb_mt352_xc3028_config
,
1172 &adap
->dev
->i2c_adap
);
1173 if ((adap
->fe_adap
[0].fe
) != NULL
)
1179 static struct lgs8gxx_config d680_lgs8gl5_cfg
= {
1180 .prod
= LGS8GXX_PROD_LGS8GL5
,
1181 .demod_address
= 0x19,
1185 .if_clk_freq
= 30400, /* 30.4 MHz */
1186 .if_freq
= 5725, /* 5.725 MHz */
1193 static int cxusb_d680_dmb_frontend_attach(struct dvb_usb_adapter
*adap
)
1195 struct dvb_usb_device
*d
= adap
->dev
;
1198 /* Select required USB configuration */
1199 if (usb_set_interface(d
->udev
, 0, 0) < 0)
1200 err("set interface failed");
1202 /* Unblock all USB pipes */
1203 usb_clear_halt(d
->udev
,
1204 usb_sndbulkpipe(d
->udev
, d
->props
.generic_bulk_ctrl_endpoint
));
1205 usb_clear_halt(d
->udev
,
1206 usb_rcvbulkpipe(d
->udev
, d
->props
.generic_bulk_ctrl_endpoint
));
1207 usb_clear_halt(d
->udev
,
1208 usb_rcvbulkpipe(d
->udev
, d
->props
.adapter
[0].fe
[0].stream
.endpoint
));
1210 /* Drain USB pipes to avoid hang after reboot */
1211 for (n
= 0; n
< 5; n
++) {
1212 cxusb_d680_dmb_drain_message(d
);
1213 cxusb_d680_dmb_drain_video(d
);
1217 /* Reset the tuner */
1218 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 0) < 0) {
1219 err("clear tuner gpio failed");
1223 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 1) < 0) {
1224 err("set tuner gpio failed");
1229 /* Attach frontend */
1230 adap
->fe_adap
[0].fe
= dvb_attach(lgs8gxx_attach
, &d680_lgs8gl5_cfg
, &d
->i2c_adap
);
1231 if (adap
->fe_adap
[0].fe
== NULL
)
1237 static struct atbm8830_config mygica_d689_atbm8830_cfg
= {
1238 .prod
= ATBM8830_PROD_8830
,
1239 .demod_address
= 0x40,
1241 .ts_sampling_edge
= 1,
1243 .osc_clk_freq
= 30400, /* in kHz */
1244 .if_freq
= 0, /* zero IF */
1251 static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter
*adap
)
1253 struct dvb_usb_device
*d
= adap
->dev
;
1255 /* Select required USB configuration */
1256 if (usb_set_interface(d
->udev
, 0, 0) < 0)
1257 err("set interface failed");
1259 /* Unblock all USB pipes */
1260 usb_clear_halt(d
->udev
,
1261 usb_sndbulkpipe(d
->udev
, d
->props
.generic_bulk_ctrl_endpoint
));
1262 usb_clear_halt(d
->udev
,
1263 usb_rcvbulkpipe(d
->udev
, d
->props
.generic_bulk_ctrl_endpoint
));
1264 usb_clear_halt(d
->udev
,
1265 usb_rcvbulkpipe(d
->udev
, d
->props
.adapter
[0].fe
[0].stream
.endpoint
));
1268 /* Reset the tuner */
1269 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 0) < 0) {
1270 err("clear tuner gpio failed");
1274 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 1) < 0) {
1275 err("set tuner gpio failed");
1280 /* Attach frontend */
1281 adap
->fe_adap
[0].fe
= dvb_attach(atbm8830_attach
, &mygica_d689_atbm8830_cfg
,
1283 if (adap
->fe_adap
[0].fe
== NULL
)
1290 * DViCO has shipped two devices with the same USB ID, but only one of them
1291 * needs a firmware download. Check the device class details to see if they
1292 * have non-default values to decide whether the device is actually cold or
1293 * not, and forget a match if it turns out we selected the wrong device.
1295 static int bluebird_fx2_identify_state(struct usb_device
*udev
,
1296 struct dvb_usb_device_properties
*props
,
1297 struct dvb_usb_device_description
**desc
,
1300 int wascold
= *cold
;
1302 *cold
= udev
->descriptor
.bDeviceClass
== 0xff &&
1303 udev
->descriptor
.bDeviceSubClass
== 0xff &&
1304 udev
->descriptor
.bDeviceProtocol
== 0xff;
1306 if (*cold
&& !wascold
)
1313 * DViCO bluebird firmware needs the "warm" product ID to be patched into the
1314 * firmware file before download.
1317 static const int dvico_firmware_id_offsets
[] = { 6638, 3204 };
1318 static int bluebird_patch_dvico_firmware_download(struct usb_device
*udev
,
1319 const struct firmware
*fw
)
1323 for (pos
= 0; pos
< ARRAY_SIZE(dvico_firmware_id_offsets
); pos
++) {
1324 int idoff
= dvico_firmware_id_offsets
[pos
];
1326 if (fw
->size
< idoff
+ 4)
1329 if (fw
->data
[idoff
] == (USB_VID_DVICO
& 0xff) &&
1330 fw
->data
[idoff
+ 1] == USB_VID_DVICO
>> 8) {
1331 struct firmware new_fw
;
1332 u8
*new_fw_data
= vmalloc(fw
->size
);
1338 memcpy(new_fw_data
, fw
->data
, fw
->size
);
1339 new_fw
.size
= fw
->size
;
1340 new_fw
.data
= new_fw_data
;
1342 new_fw_data
[idoff
+ 2] =
1343 le16_to_cpu(udev
->descriptor
.idProduct
) + 1;
1344 new_fw_data
[idoff
+ 3] =
1345 le16_to_cpu(udev
->descriptor
.idProduct
) >> 8;
1347 ret
= usb_cypress_load_firmware(udev
, &new_fw
,
1357 /* DVB USB Driver stuff */
1358 static struct dvb_usb_device_properties cxusb_medion_properties
;
1359 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties
;
1360 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties
;
1361 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties
;
1362 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties
;
1363 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties
;
1364 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties
;
1365 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties
;
1366 static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties
;
1367 static struct dvb_usb_device_properties cxusb_aver_a868r_properties
;
1368 static struct dvb_usb_device_properties cxusb_d680_dmb_properties
;
1369 static struct dvb_usb_device_properties cxusb_mygica_d689_properties
;
1371 static int cxusb_probe(struct usb_interface
*intf
,
1372 const struct usb_device_id
*id
)
1374 if (0 == dvb_usb_device_init(intf
, &cxusb_medion_properties
,
1375 THIS_MODULE
, NULL
, adapter_nr
) ||
1376 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_lgh064f_properties
,
1377 THIS_MODULE
, NULL
, adapter_nr
) ||
1378 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_dee1601_properties
,
1379 THIS_MODULE
, NULL
, adapter_nr
) ||
1380 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_lgz201_properties
,
1381 THIS_MODULE
, NULL
, adapter_nr
) ||
1382 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_dtt7579_properties
,
1383 THIS_MODULE
, NULL
, adapter_nr
) ||
1384 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_dualdig4_properties
,
1385 THIS_MODULE
, NULL
, adapter_nr
) ||
1386 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_nano2_properties
,
1387 THIS_MODULE
, NULL
, adapter_nr
) ||
1388 0 == dvb_usb_device_init(intf
,
1389 &cxusb_bluebird_nano2_needsfirmware_properties
,
1390 THIS_MODULE
, NULL
, adapter_nr
) ||
1391 0 == dvb_usb_device_init(intf
, &cxusb_aver_a868r_properties
,
1392 THIS_MODULE
, NULL
, adapter_nr
) ||
1393 0 == dvb_usb_device_init(intf
,
1394 &cxusb_bluebird_dualdig4_rev2_properties
,
1395 THIS_MODULE
, NULL
, adapter_nr
) ||
1396 0 == dvb_usb_device_init(intf
, &cxusb_d680_dmb_properties
,
1397 THIS_MODULE
, NULL
, adapter_nr
) ||
1398 0 == dvb_usb_device_init(intf
, &cxusb_mygica_d689_properties
,
1399 THIS_MODULE
, NULL
, adapter_nr
) ||
1406 static struct usb_device_id cxusb_table
[] = {
1407 { USB_DEVICE(USB_VID_MEDION
, USB_PID_MEDION_MD95700
) },
1408 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LG064F_COLD
) },
1409 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LG064F_WARM
) },
1410 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD
) },
1411 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM
) },
1412 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD
) },
1413 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM
) },
1414 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_TH7579_COLD
) },
1415 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_TH7579_WARM
) },
1416 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD
) },
1417 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM
) },
1418 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD
) },
1419 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM
) },
1420 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_4
) },
1421 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2
) },
1422 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM
) },
1423 { USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_VOLAR_A868R
) },
1424 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2
) },
1425 { USB_DEVICE(USB_VID_CONEXANT
, USB_PID_CONEXANT_D680_DMB
) },
1426 { USB_DEVICE(USB_VID_CONEXANT
, USB_PID_MYGICA_D689
) },
1427 {} /* Terminating entry */
1429 MODULE_DEVICE_TABLE (usb
, cxusb_table
);
1431 static struct dvb_usb_device_properties cxusb_medion_properties
= {
1432 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1434 .usb_ctrl
= CYPRESS_FX2
,
1436 .size_of_priv
= sizeof(struct cxusb_state
),
1443 .streaming_ctrl
= cxusb_streaming_ctrl
,
1444 .frontend_attach
= cxusb_cx22702_frontend_attach
,
1445 .tuner_attach
= cxusb_fmd1216me_tuner_attach
,
1446 /* parameter for the MPEG2-data transfer */
1460 .power_ctrl
= cxusb_power_ctrl
,
1462 .i2c_algo
= &cxusb_i2c_algo
,
1464 .generic_bulk_ctrl_endpoint
= 0x01,
1466 .num_device_descs
= 1,
1468 { "Medion MD95700 (MDUSBTV-HYBRID)",
1470 { &cxusb_table
[0], NULL
},
1475 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties
= {
1476 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1478 .usb_ctrl
= DEVICE_SPECIFIC
,
1479 .firmware
= "dvb-usb-bluebird-01.fw",
1480 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1481 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1482 use usb alt setting 7 for EP2 transfer (atsc) */
1484 .size_of_priv
= sizeof(struct cxusb_state
),
1491 .streaming_ctrl
= cxusb_streaming_ctrl
,
1492 .frontend_attach
= cxusb_lgdt3303_frontend_attach
,
1493 .tuner_attach
= cxusb_lgh064f_tuner_attach
,
1495 /* parameter for the MPEG2-data transfer */
1510 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1512 .i2c_algo
= &cxusb_i2c_algo
,
1516 .rc_map_table
= rc_map_dvico_portable_table
,
1517 .rc_map_size
= ARRAY_SIZE(rc_map_dvico_portable_table
),
1518 .rc_query
= cxusb_rc_query
,
1521 .generic_bulk_ctrl_endpoint
= 0x01,
1523 .num_device_descs
= 1,
1525 { "DViCO FusionHDTV5 USB Gold",
1526 { &cxusb_table
[1], NULL
},
1527 { &cxusb_table
[2], NULL
},
1532 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties
= {
1533 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1535 .usb_ctrl
= DEVICE_SPECIFIC
,
1536 .firmware
= "dvb-usb-bluebird-01.fw",
1537 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1538 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1539 use usb alt setting 7 for EP2 transfer (atsc) */
1541 .size_of_priv
= sizeof(struct cxusb_state
),
1548 .streaming_ctrl
= cxusb_streaming_ctrl
,
1549 .frontend_attach
= cxusb_dee1601_frontend_attach
,
1550 .tuner_attach
= cxusb_dee1601_tuner_attach
,
1551 /* parameter for the MPEG2-data transfer */
1566 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1568 .i2c_algo
= &cxusb_i2c_algo
,
1572 .rc_map_table
= rc_map_dvico_mce_table
,
1573 .rc_map_size
= ARRAY_SIZE(rc_map_dvico_mce_table
),
1574 .rc_query
= cxusb_rc_query
,
1577 .generic_bulk_ctrl_endpoint
= 0x01,
1579 .num_device_descs
= 3,
1581 { "DViCO FusionHDTV DVB-T Dual USB",
1582 { &cxusb_table
[3], NULL
},
1583 { &cxusb_table
[4], NULL
},
1585 { "DigitalNow DVB-T Dual USB",
1586 { &cxusb_table
[9], NULL
},
1587 { &cxusb_table
[10], NULL
},
1589 { "DViCO FusionHDTV DVB-T Dual Digital 2",
1590 { &cxusb_table
[11], NULL
},
1591 { &cxusb_table
[12], NULL
},
1596 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties
= {
1597 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1599 .usb_ctrl
= DEVICE_SPECIFIC
,
1600 .firmware
= "dvb-usb-bluebird-01.fw",
1601 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1602 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1603 use usb alt setting 7 for EP2 transfer (atsc) */
1605 .size_of_priv
= sizeof(struct cxusb_state
),
1612 .streaming_ctrl
= cxusb_streaming_ctrl
,
1613 .frontend_attach
= cxusb_mt352_frontend_attach
,
1614 .tuner_attach
= cxusb_lgz201_tuner_attach
,
1616 /* parameter for the MPEG2-data transfer */
1630 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1632 .i2c_algo
= &cxusb_i2c_algo
,
1636 .rc_map_table
= rc_map_dvico_portable_table
,
1637 .rc_map_size
= ARRAY_SIZE(rc_map_dvico_portable_table
),
1638 .rc_query
= cxusb_rc_query
,
1641 .generic_bulk_ctrl_endpoint
= 0x01,
1642 .num_device_descs
= 1,
1644 { "DViCO FusionHDTV DVB-T USB (LGZ201)",
1645 { &cxusb_table
[5], NULL
},
1646 { &cxusb_table
[6], NULL
},
1651 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties
= {
1652 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1654 .usb_ctrl
= DEVICE_SPECIFIC
,
1655 .firmware
= "dvb-usb-bluebird-01.fw",
1656 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1657 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1658 use usb alt setting 7 for EP2 transfer (atsc) */
1660 .size_of_priv
= sizeof(struct cxusb_state
),
1667 .streaming_ctrl
= cxusb_streaming_ctrl
,
1668 .frontend_attach
= cxusb_mt352_frontend_attach
,
1669 .tuner_attach
= cxusb_dtt7579_tuner_attach
,
1671 /* parameter for the MPEG2-data transfer */
1685 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1687 .i2c_algo
= &cxusb_i2c_algo
,
1691 .rc_map_table
= rc_map_dvico_portable_table
,
1692 .rc_map_size
= ARRAY_SIZE(rc_map_dvico_portable_table
),
1693 .rc_query
= cxusb_rc_query
,
1696 .generic_bulk_ctrl_endpoint
= 0x01,
1698 .num_device_descs
= 1,
1700 { "DViCO FusionHDTV DVB-T USB (TH7579)",
1701 { &cxusb_table
[7], NULL
},
1702 { &cxusb_table
[8], NULL
},
1707 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties
= {
1708 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1710 .usb_ctrl
= CYPRESS_FX2
,
1712 .size_of_priv
= sizeof(struct cxusb_state
),
1719 .streaming_ctrl
= cxusb_streaming_ctrl
,
1720 .frontend_attach
= cxusb_dualdig4_frontend_attach
,
1721 .tuner_attach
= cxusb_dvico_xc3028_tuner_attach
,
1722 /* parameter for the MPEG2-data transfer */
1737 .power_ctrl
= cxusb_power_ctrl
,
1739 .i2c_algo
= &cxusb_i2c_algo
,
1741 .generic_bulk_ctrl_endpoint
= 0x01,
1745 .rc_map_table
= rc_map_dvico_mce_table
,
1746 .rc_map_size
= ARRAY_SIZE(rc_map_dvico_mce_table
),
1747 .rc_query
= cxusb_bluebird2_rc_query
,
1750 .num_device_descs
= 1,
1752 { "DViCO FusionHDTV DVB-T Dual Digital 4",
1754 { &cxusb_table
[13], NULL
},
1759 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties
= {
1760 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1762 .usb_ctrl
= CYPRESS_FX2
,
1763 .identify_state
= bluebird_fx2_identify_state
,
1765 .size_of_priv
= sizeof(struct cxusb_state
),
1772 .streaming_ctrl
= cxusb_streaming_ctrl
,
1773 .frontend_attach
= cxusb_nano2_frontend_attach
,
1774 .tuner_attach
= cxusb_dvico_xc3028_tuner_attach
,
1775 /* parameter for the MPEG2-data transfer */
1790 .power_ctrl
= cxusb_nano2_power_ctrl
,
1792 .i2c_algo
= &cxusb_i2c_algo
,
1794 .generic_bulk_ctrl_endpoint
= 0x01,
1798 .rc_map_table
= rc_map_dvico_portable_table
,
1799 .rc_map_size
= ARRAY_SIZE(rc_map_dvico_portable_table
),
1800 .rc_query
= cxusb_bluebird2_rc_query
,
1803 .num_device_descs
= 1,
1805 { "DViCO FusionHDTV DVB-T NANO2",
1807 { &cxusb_table
[14], NULL
},
1812 static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties
= {
1813 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1815 .usb_ctrl
= DEVICE_SPECIFIC
,
1816 .firmware
= "dvb-usb-bluebird-02.fw",
1817 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1818 .identify_state
= bluebird_fx2_identify_state
,
1820 .size_of_priv
= sizeof(struct cxusb_state
),
1827 .streaming_ctrl
= cxusb_streaming_ctrl
,
1828 .frontend_attach
= cxusb_nano2_frontend_attach
,
1829 .tuner_attach
= cxusb_dvico_xc3028_tuner_attach
,
1830 /* parameter for the MPEG2-data transfer */
1845 .power_ctrl
= cxusb_nano2_power_ctrl
,
1847 .i2c_algo
= &cxusb_i2c_algo
,
1849 .generic_bulk_ctrl_endpoint
= 0x01,
1853 .rc_map_table
= rc_map_dvico_portable_table
,
1854 .rc_map_size
= ARRAY_SIZE(rc_map_dvico_portable_table
),
1855 .rc_query
= cxusb_rc_query
,
1858 .num_device_descs
= 1,
1860 { "DViCO FusionHDTV DVB-T NANO2 w/o firmware",
1861 { &cxusb_table
[14], NULL
},
1862 { &cxusb_table
[15], NULL
},
1867 static struct dvb_usb_device_properties cxusb_aver_a868r_properties
= {
1868 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1870 .usb_ctrl
= CYPRESS_FX2
,
1872 .size_of_priv
= sizeof(struct cxusb_state
),
1879 .streaming_ctrl
= cxusb_aver_streaming_ctrl
,
1880 .frontend_attach
= cxusb_aver_lgdt3303_frontend_attach
,
1881 .tuner_attach
= cxusb_mxl5003s_tuner_attach
,
1882 /* parameter for the MPEG2-data transfer */
1896 .power_ctrl
= cxusb_aver_power_ctrl
,
1898 .i2c_algo
= &cxusb_i2c_algo
,
1900 .generic_bulk_ctrl_endpoint
= 0x01,
1902 .num_device_descs
= 1,
1904 { "AVerMedia AVerTVHD Volar (A868R)",
1906 { &cxusb_table
[16], NULL
},
1912 struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties
= {
1913 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1915 .usb_ctrl
= CYPRESS_FX2
,
1917 .size_of_priv
= sizeof(struct cxusb_state
),
1922 .size_of_priv
= sizeof(struct dib0700_adapter_state
),
1925 .streaming_ctrl
= cxusb_streaming_ctrl
,
1926 .frontend_attach
= cxusb_dualdig4_rev2_frontend_attach
,
1927 .tuner_attach
= cxusb_dualdig4_rev2_tuner_attach
,
1928 /* parameter for the MPEG2-data transfer */
1943 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1945 .i2c_algo
= &cxusb_i2c_algo
,
1947 .generic_bulk_ctrl_endpoint
= 0x01,
1951 .rc_map_table
= rc_map_dvico_mce_table
,
1952 .rc_map_size
= ARRAY_SIZE(rc_map_dvico_mce_table
),
1953 .rc_query
= cxusb_rc_query
,
1956 .num_device_descs
= 1,
1958 { "DViCO FusionHDTV DVB-T Dual Digital 4 (rev 2)",
1960 { &cxusb_table
[17], NULL
},
1965 static struct dvb_usb_device_properties cxusb_d680_dmb_properties
= {
1966 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1968 .usb_ctrl
= CYPRESS_FX2
,
1970 .size_of_priv
= sizeof(struct cxusb_state
),
1977 .streaming_ctrl
= cxusb_d680_dmb_streaming_ctrl
,
1978 .frontend_attach
= cxusb_d680_dmb_frontend_attach
,
1979 .tuner_attach
= cxusb_d680_dmb_tuner_attach
,
1981 /* parameter for the MPEG2-data transfer */
1996 .power_ctrl
= cxusb_d680_dmb_power_ctrl
,
1998 .i2c_algo
= &cxusb_i2c_algo
,
2000 .generic_bulk_ctrl_endpoint
= 0x01,
2004 .rc_map_table
= rc_map_d680_dmb_table
,
2005 .rc_map_size
= ARRAY_SIZE(rc_map_d680_dmb_table
),
2006 .rc_query
= cxusb_d680_dmb_rc_query
,
2009 .num_device_descs
= 1,
2012 "Conexant DMB-TH Stick",
2014 { &cxusb_table
[18], NULL
},
2019 static struct dvb_usb_device_properties cxusb_mygica_d689_properties
= {
2020 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
2022 .usb_ctrl
= CYPRESS_FX2
,
2024 .size_of_priv
= sizeof(struct cxusb_state
),
2031 .streaming_ctrl
= cxusb_d680_dmb_streaming_ctrl
,
2032 .frontend_attach
= cxusb_mygica_d689_frontend_attach
,
2033 .tuner_attach
= cxusb_mygica_d689_tuner_attach
,
2035 /* parameter for the MPEG2-data transfer */
2050 .power_ctrl
= cxusb_d680_dmb_power_ctrl
,
2052 .i2c_algo
= &cxusb_i2c_algo
,
2054 .generic_bulk_ctrl_endpoint
= 0x01,
2058 .rc_map_table
= rc_map_d680_dmb_table
,
2059 .rc_map_size
= ARRAY_SIZE(rc_map_d680_dmb_table
),
2060 .rc_query
= cxusb_d680_dmb_rc_query
,
2063 .num_device_descs
= 1,
2066 "Mygica D689 DMB-TH",
2068 { &cxusb_table
[19], NULL
},
2073 static struct usb_driver cxusb_driver
= {
2074 .name
= "dvb_usb_cxusb",
2075 .probe
= cxusb_probe
,
2076 .disconnect
= dvb_usb_device_exit
,
2077 .id_table
= cxusb_table
,
2080 module_usb_driver(cxusb_driver
);
2082 MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
2083 MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
2084 MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
2085 MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
2086 MODULE_VERSION("1.0-alpha");
2087 MODULE_LICENSE("GPL");