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"
47 static int dvb_usb_cxusb_debug
;
48 module_param_named(debug
, dvb_usb_cxusb_debug
, int, 0644);
49 MODULE_PARM_DESC(debug
, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS
);
51 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr
);
53 #define deb_info(args...) dprintk(dvb_usb_cxusb_debug, 0x03, args)
54 #define deb_i2c(args...) dprintk(dvb_usb_cxusb_debug, 0x02, args)
56 static int cxusb_ctrl_msg(struct dvb_usb_device
*d
,
57 u8 cmd
, u8
*wbuf
, int wlen
, u8
*rbuf
, int rlen
)
59 int wo
= (rbuf
== NULL
|| rlen
== 0); /* write-only */
61 memset(sndbuf
, 0, 1+wlen
);
64 memcpy(&sndbuf
[1], wbuf
, wlen
);
66 return dvb_usb_generic_write(d
, sndbuf
, 1+wlen
);
68 return dvb_usb_generic_rw(d
, sndbuf
, 1+wlen
, rbuf
, rlen
, 0);
72 static void cxusb_gpio_tuner(struct dvb_usb_device
*d
, int onoff
)
74 struct cxusb_state
*st
= d
->priv
;
77 if (st
->gpio_write_state
[GPIO_TUNER
] == onoff
)
82 cxusb_ctrl_msg(d
, CMD_GPIO_WRITE
, o
, 2, &i
, 1);
85 deb_info("gpio_write failed.\n");
87 st
->gpio_write_state
[GPIO_TUNER
] = onoff
;
90 static int cxusb_bluebird_gpio_rw(struct dvb_usb_device
*d
, u8 changemask
,
96 o
[0] = 0xff & ~changemask
; /* mask of bits to keep */
97 o
[1] = newval
& changemask
; /* new values for bits */
99 rc
= cxusb_ctrl_msg(d
, CMD_BLUEBIRD_GPIO_RW
, o
, 2, &gpio_state
, 1);
100 if (rc
< 0 || (gpio_state
& changemask
) != (newval
& changemask
))
101 deb_info("bluebird_gpio_write failed.\n");
103 return rc
< 0 ? rc
: gpio_state
;
106 static void cxusb_bluebird_gpio_pulse(struct dvb_usb_device
*d
, u8 pin
, int low
)
108 cxusb_bluebird_gpio_rw(d
, pin
, low
? 0 : pin
);
110 cxusb_bluebird_gpio_rw(d
, pin
, low
? pin
: 0);
113 static void cxusb_nano2_led(struct dvb_usb_device
*d
, int onoff
)
115 cxusb_bluebird_gpio_rw(d
, 0x40, onoff
? 0 : 0x40);
118 static int cxusb_d680_dmb_gpio_tuner(struct dvb_usb_device
*d
,
121 u8 o
[2] = {addr
, onoff
};
125 rc
= cxusb_ctrl_msg(d
, CMD_GPIO_WRITE
, o
, 2, &i
, 1);
132 deb_info("gpio_write failed.\n");
138 static int cxusb_i2c_xfer(struct i2c_adapter
*adap
, struct i2c_msg msg
[],
141 struct dvb_usb_device
*d
= i2c_get_adapdata(adap
);
144 if (mutex_lock_interruptible(&d
->i2c_mutex
) < 0)
147 for (i
= 0; i
< num
; i
++) {
149 if (d
->udev
->descriptor
.idVendor
== USB_VID_MEDION
)
150 switch (msg
[i
].addr
) {
152 cxusb_gpio_tuner(d
, 0);
155 cxusb_gpio_tuner(d
, 1);
159 if (msg
[i
].flags
& I2C_M_RD
) {
161 u8 obuf
[3], ibuf
[1+msg
[i
].len
];
163 obuf
[1] = msg
[i
].len
;
164 obuf
[2] = msg
[i
].addr
;
165 if (cxusb_ctrl_msg(d
, CMD_I2C_READ
,
167 ibuf
, 1+msg
[i
].len
) < 0) {
168 warn("i2c read failed");
171 memcpy(msg
[i
].buf
, &ibuf
[1], msg
[i
].len
);
172 } else if (i
+1 < num
&& (msg
[i
+1].flags
& I2C_M_RD
) &&
173 msg
[i
].addr
== msg
[i
+1].addr
) {
174 /* write to then read from same address */
175 u8 obuf
[3+msg
[i
].len
], ibuf
[1+msg
[i
+1].len
];
176 obuf
[0] = msg
[i
].len
;
177 obuf
[1] = msg
[i
+1].len
;
178 obuf
[2] = msg
[i
].addr
;
179 memcpy(&obuf
[3], msg
[i
].buf
, msg
[i
].len
);
181 if (cxusb_ctrl_msg(d
, CMD_I2C_READ
,
183 ibuf
, 1+msg
[i
+1].len
) < 0)
187 deb_i2c("i2c read may have failed\n");
189 memcpy(msg
[i
+1].buf
, &ibuf
[1], msg
[i
+1].len
);
194 u8 obuf
[2+msg
[i
].len
], ibuf
;
195 obuf
[0] = msg
[i
].addr
;
196 obuf
[1] = msg
[i
].len
;
197 memcpy(&obuf
[2], msg
[i
].buf
, msg
[i
].len
);
199 if (cxusb_ctrl_msg(d
, CMD_I2C_WRITE
, obuf
,
200 2+msg
[i
].len
, &ibuf
,1) < 0)
203 deb_i2c("i2c write may have failed\n");
207 mutex_unlock(&d
->i2c_mutex
);
208 return i
== num
? num
: -EREMOTEIO
;
211 static u32
cxusb_i2c_func(struct i2c_adapter
*adapter
)
216 static struct i2c_algorithm cxusb_i2c_algo
= {
217 .master_xfer
= cxusb_i2c_xfer
,
218 .functionality
= cxusb_i2c_func
,
221 static int cxusb_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
225 return cxusb_ctrl_msg(d
, CMD_POWER_ON
, &b
, 1, NULL
, 0);
227 return cxusb_ctrl_msg(d
, CMD_POWER_OFF
, &b
, 1, NULL
, 0);
230 static int cxusb_aver_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
234 return cxusb_ctrl_msg(d
, CMD_POWER_OFF
, NULL
, 0, NULL
, 0);
235 if (d
->state
== DVB_USB_STATE_INIT
&&
236 usb_set_interface(d
->udev
, 0, 0) < 0)
237 err("set interface failed");
238 do {} while (!(ret
= cxusb_ctrl_msg(d
, CMD_POWER_ON
, NULL
, 0, NULL
, 0)) &&
239 !(ret
= cxusb_ctrl_msg(d
, 0x15, NULL
, 0, NULL
, 0)) &&
240 !(ret
= cxusb_ctrl_msg(d
, 0x17, NULL
, 0, NULL
, 0)) && 0);
242 /* FIXME: We don't know why, but we need to configure the
243 * lgdt3303 with the register settings below on resume */
246 0x0e, 0x2, 0x00, 0x7f,
247 0x0e, 0x2, 0x02, 0xfe,
248 0x0e, 0x2, 0x02, 0x01,
249 0x0e, 0x2, 0x00, 0x03,
250 0x0e, 0x2, 0x0d, 0x40,
251 0x0e, 0x2, 0x0e, 0x87,
252 0x0e, 0x2, 0x0f, 0x8e,
253 0x0e, 0x2, 0x10, 0x01,
254 0x0e, 0x2, 0x14, 0xd7,
255 0x0e, 0x2, 0x47, 0x88,
258 for (i
= 0; i
< sizeof(bufs
)/sizeof(u8
); i
+= 4/sizeof(u8
)) {
259 ret
= cxusb_ctrl_msg(d
, CMD_I2C_WRITE
,
270 static int cxusb_bluebird_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
274 return cxusb_ctrl_msg(d
, CMD_POWER_ON
, &b
, 1, NULL
, 0);
279 static int cxusb_nano2_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
283 rc
= cxusb_power_ctrl(d
, onoff
);
285 cxusb_nano2_led(d
, 0);
290 static int cxusb_d680_dmb_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
294 ret
= cxusb_power_ctrl(d
, onoff
);
299 cxusb_ctrl_msg(d
, CMD_DIGITAL
, NULL
, 0, &b
, 1);
304 static int cxusb_streaming_ctrl(struct dvb_usb_adapter
*adap
, int onoff
)
306 u8 buf
[2] = { 0x03, 0x00 };
308 cxusb_ctrl_msg(adap
->dev
, CMD_STREAMING_ON
, buf
, 2, NULL
, 0);
310 cxusb_ctrl_msg(adap
->dev
, CMD_STREAMING_OFF
, NULL
, 0, NULL
, 0);
315 static int cxusb_aver_streaming_ctrl(struct dvb_usb_adapter
*adap
, int onoff
)
318 cxusb_ctrl_msg(adap
->dev
, CMD_AVER_STREAM_ON
, NULL
, 0, NULL
, 0);
320 cxusb_ctrl_msg(adap
->dev
, CMD_AVER_STREAM_OFF
,
325 static void cxusb_d680_dmb_drain_message(struct dvb_usb_device
*d
)
327 int ep
= d
->props
.generic_bulk_ctrl_endpoint
;
328 const int timeout
= 100;
329 const int junk_len
= 32;
333 /* Discard remaining data in video pipe */
334 junk
= kmalloc(junk_len
, GFP_KERNEL
);
338 if (usb_bulk_msg(d
->udev
,
339 usb_rcvbulkpipe(d
->udev
, ep
),
340 junk
, junk_len
, &rd_count
, timeout
) < 0)
348 static void cxusb_d680_dmb_drain_video(struct dvb_usb_device
*d
)
350 struct usb_data_stream_properties
*p
= &d
->props
.adapter
[0].fe
[0].stream
;
351 const int timeout
= 100;
352 const int junk_len
= p
->u
.bulk
.buffersize
;
356 /* Discard remaining data in video pipe */
357 junk
= kmalloc(junk_len
, GFP_KERNEL
);
361 if (usb_bulk_msg(d
->udev
,
362 usb_rcvbulkpipe(d
->udev
, p
->endpoint
),
363 junk
, junk_len
, &rd_count
, timeout
) < 0)
371 static int cxusb_d680_dmb_streaming_ctrl(
372 struct dvb_usb_adapter
*adap
, int onoff
)
375 u8 buf
[2] = { 0x03, 0x00 };
376 cxusb_d680_dmb_drain_video(adap
->dev
);
377 return cxusb_ctrl_msg(adap
->dev
, CMD_STREAMING_ON
,
378 buf
, sizeof(buf
), NULL
, 0);
380 int ret
= cxusb_ctrl_msg(adap
->dev
,
381 CMD_STREAMING_OFF
, NULL
, 0, NULL
, 0);
386 static int cxusb_rc_query(struct dvb_usb_device
*d
, u32
*event
, int *state
)
388 struct rc_map_table
*keymap
= d
->props
.rc
.legacy
.rc_map_table
;
392 cxusb_ctrl_msg(d
, CMD_GET_IR_CODE
, NULL
, 0, ircode
, 4);
395 *state
= REMOTE_NO_KEY_PRESSED
;
397 for (i
= 0; i
< d
->props
.rc
.legacy
.rc_map_size
; i
++) {
398 if (rc5_custom(&keymap
[i
]) == ircode
[2] &&
399 rc5_data(&keymap
[i
]) == ircode
[3]) {
400 *event
= keymap
[i
].keycode
;
401 *state
= REMOTE_KEY_PRESSED
;
410 static int cxusb_bluebird2_rc_query(struct dvb_usb_device
*d
, u32
*event
,
413 struct rc_map_table
*keymap
= d
->props
.rc
.legacy
.rc_map_table
;
416 struct i2c_msg msg
= { .addr
= 0x6b, .flags
= I2C_M_RD
,
417 .buf
= ircode
, .len
= 4 };
420 *state
= REMOTE_NO_KEY_PRESSED
;
422 if (cxusb_i2c_xfer(&d
->i2c_adap
, &msg
, 1) != 1)
425 for (i
= 0; i
< d
->props
.rc
.legacy
.rc_map_size
; i
++) {
426 if (rc5_custom(&keymap
[i
]) == ircode
[1] &&
427 rc5_data(&keymap
[i
]) == ircode
[2]) {
428 *event
= keymap
[i
].keycode
;
429 *state
= REMOTE_KEY_PRESSED
;
438 static int cxusb_d680_dmb_rc_query(struct dvb_usb_device
*d
, u32
*event
,
441 struct rc_map_table
*keymap
= d
->props
.rc
.legacy
.rc_map_table
;
446 *state
= REMOTE_NO_KEY_PRESSED
;
448 if (cxusb_ctrl_msg(d
, 0x10, NULL
, 0, ircode
, 2) < 0)
451 for (i
= 0; i
< d
->props
.rc
.legacy
.rc_map_size
; i
++) {
452 if (rc5_custom(&keymap
[i
]) == ircode
[0] &&
453 rc5_data(&keymap
[i
]) == ircode
[1]) {
454 *event
= keymap
[i
].keycode
;
455 *state
= REMOTE_KEY_PRESSED
;
464 static struct rc_map_table rc_map_dvico_mce_table
[] = {
468 { 0xfe1e, KEY_FAVORITES
},
469 { 0xfe16, KEY_SETUP
},
470 { 0xfe46, KEY_POWER2
},
472 { 0xfe49, KEY_BACK
},
473 { 0xfe4d, KEY_MENU
},
475 { 0xfe5b, KEY_LEFT
},
476 { 0xfe5f, KEY_RIGHT
},
477 { 0xfe53, KEY_DOWN
},
479 { 0xfe59, KEY_INFO
},
481 { 0xfe0f, KEY_PREVIOUSSONG
},/* Replay */
482 { 0xfe12, KEY_NEXTSONG
}, /* Skip */
483 { 0xfe42, KEY_ENTER
}, /* Windows/Start */
484 { 0xfe15, KEY_VOLUMEUP
},
485 { 0xfe05, KEY_VOLUMEDOWN
},
486 { 0xfe11, KEY_CHANNELUP
},
487 { 0xfe09, KEY_CHANNELDOWN
},
488 { 0xfe52, KEY_CAMERA
},
489 { 0xfe5a, KEY_TUNER
}, /* Live */
490 { 0xfe19, KEY_OPEN
},
500 { 0xfe13, KEY_ANGLE
}, /* Aspect */
502 { 0xfe1f, KEY_ZOOM
},
503 { 0xfe43, KEY_REWIND
},
504 { 0xfe47, KEY_PLAYPAUSE
},
505 { 0xfe4f, KEY_FASTFORWARD
},
506 { 0xfe57, KEY_MUTE
},
507 { 0xfe0d, KEY_STOP
},
508 { 0xfe01, KEY_RECORD
},
509 { 0xfe4e, KEY_POWER
},
512 static struct rc_map_table rc_map_dvico_portable_table
[] = {
513 { 0xfc02, KEY_SETUP
}, /* Profile */
514 { 0xfc43, KEY_POWER2
},
516 { 0xfc5a, KEY_BACK
},
517 { 0xfc05, KEY_MENU
},
518 { 0xfc47, KEY_INFO
},
520 { 0xfc42, KEY_PREVIOUSSONG
},/* Replay */
521 { 0xfc49, KEY_VOLUMEUP
},
522 { 0xfc09, KEY_VOLUMEDOWN
},
523 { 0xfc54, KEY_CHANNELUP
},
524 { 0xfc0b, KEY_CHANNELDOWN
},
525 { 0xfc16, KEY_CAMERA
},
526 { 0xfc40, KEY_TUNER
}, /* ATV/DTV */
527 { 0xfc45, KEY_OPEN
},
537 { 0xfc44, KEY_ANGLE
}, /* Aspect */
539 { 0xfc07, KEY_ZOOM
},
540 { 0xfc0a, KEY_REWIND
},
541 { 0xfc08, KEY_PLAYPAUSE
},
542 { 0xfc4b, KEY_FASTFORWARD
},
543 { 0xfc5b, KEY_MUTE
},
544 { 0xfc04, KEY_STOP
},
545 { 0xfc56, KEY_RECORD
},
546 { 0xfc57, KEY_POWER
},
547 { 0xfc41, KEY_UNKNOWN
}, /* INPUT */
548 { 0xfc00, KEY_UNKNOWN
}, /* HD */
551 static struct rc_map_table rc_map_d680_dmb_table
[] = {
552 { 0x0038, KEY_UNKNOWN
}, /* TV/AV */
553 { 0x080c, KEY_ZOOM
},
564 { 0x000a, KEY_MUTE
},
565 { 0x0829, KEY_BACK
},
566 { 0x0012, KEY_CHANNELUP
},
567 { 0x0813, KEY_CHANNELDOWN
},
568 { 0x002b, KEY_VOLUMEUP
},
569 { 0x082c, KEY_VOLUMEDOWN
},
571 { 0x0821, KEY_DOWN
},
572 { 0x0011, KEY_LEFT
},
573 { 0x0810, KEY_RIGHT
},
575 { 0x081f, KEY_RECORD
},
576 { 0x0017, KEY_PLAYPAUSE
},
577 { 0x0816, KEY_PLAYPAUSE
},
578 { 0x000b, KEY_STOP
},
579 { 0x0827, KEY_FASTFORWARD
},
580 { 0x0026, KEY_REWIND
},
581 { 0x081e, KEY_UNKNOWN
}, /* Time Shift */
582 { 0x000e, KEY_UNKNOWN
}, /* Snapshot */
583 { 0x082d, KEY_UNKNOWN
}, /* Mouse Cursor */
584 { 0x000f, KEY_UNKNOWN
}, /* Minimize/Maximize */
585 { 0x0814, KEY_UNKNOWN
}, /* Shuffle */
586 { 0x0025, KEY_POWER
},
589 static int cxusb_dee1601_demod_init(struct dvb_frontend
* fe
)
591 static u8 clock_config
[] = { CLOCK_CTL
, 0x38, 0x28 };
592 static u8 reset
[] = { RESET
, 0x80 };
593 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
594 static u8 agc_cfg
[] = { AGC_TARGET
, 0x28, 0x20 };
595 static u8 gpp_ctl_cfg
[] = { GPP_CTL
, 0x33 };
596 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x32 };
598 mt352_write(fe
, clock_config
, sizeof(clock_config
));
600 mt352_write(fe
, reset
, sizeof(reset
));
601 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
603 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
604 mt352_write(fe
, gpp_ctl_cfg
, sizeof(gpp_ctl_cfg
));
605 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
610 static int cxusb_mt352_demod_init(struct dvb_frontend
* fe
)
611 { /* used in both lgz201 and th7579 */
612 static u8 clock_config
[] = { CLOCK_CTL
, 0x38, 0x29 };
613 static u8 reset
[] = { RESET
, 0x80 };
614 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
615 static u8 agc_cfg
[] = { AGC_TARGET
, 0x24, 0x20 };
616 static u8 gpp_ctl_cfg
[] = { GPP_CTL
, 0x33 };
617 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x32 };
619 mt352_write(fe
, clock_config
, sizeof(clock_config
));
621 mt352_write(fe
, reset
, sizeof(reset
));
622 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
624 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
625 mt352_write(fe
, gpp_ctl_cfg
, sizeof(gpp_ctl_cfg
));
626 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
630 static struct cx22702_config cxusb_cx22702_config
= {
631 .demod_address
= 0x63,
632 .output_mode
= CX22702_PARALLEL_OUTPUT
,
635 static struct lgdt330x_config cxusb_lgdt3303_config
= {
636 .demod_address
= 0x0e,
637 .demod_chip
= LGDT3303
,
640 static struct lgdt330x_config cxusb_aver_lgdt3303_config
= {
641 .demod_address
= 0x0e,
642 .demod_chip
= LGDT3303
,
643 .clock_polarity_flip
= 2,
646 static struct mt352_config cxusb_dee1601_config
= {
647 .demod_address
= 0x0f,
648 .demod_init
= cxusb_dee1601_demod_init
,
651 static struct zl10353_config cxusb_zl10353_dee1601_config
= {
652 .demod_address
= 0x0f,
656 static struct mt352_config cxusb_mt352_config
= {
657 /* used in both lgz201 and th7579 */
658 .demod_address
= 0x0f,
659 .demod_init
= cxusb_mt352_demod_init
,
662 static struct zl10353_config cxusb_zl10353_xc3028_config
= {
663 .demod_address
= 0x0f,
669 static struct zl10353_config cxusb_zl10353_xc3028_config_no_i2c_gate
= {
670 .demod_address
= 0x0f,
674 .disable_i2c_gate_ctrl
= 1,
677 static struct mt352_config cxusb_mt352_xc3028_config
= {
678 .demod_address
= 0x0f,
681 .demod_init
= cxusb_mt352_demod_init
,
684 /* FIXME: needs tweaking */
685 static struct mxl5005s_config aver_a868r_tuner
= {
687 .if_freq
= 6000000UL,
688 .xtal_freq
= CRYSTAL_FREQ_16000000HZ
,
689 .agc_mode
= MXL_SINGLE_AGC
,
690 .tracking_filter
= MXL_TF_C
,
691 .rssi_enable
= MXL_RSSI_ENABLE
,
692 .cap_select
= MXL_CAP_SEL_ENABLE
,
693 .div_out
= MXL_DIV_OUT_4
,
694 .clock_out
= MXL_CLOCK_OUT_DISABLE
,
695 .output_load
= MXL5005S_IF_OUTPUT_LOAD_200_OHM
,
696 .top
= MXL5005S_TOP_25P2
,
697 .mod_mode
= MXL_DIGITAL_MODE
,
698 .if_mode
= MXL_ZERO_IF
,
699 .AgcMasterByte
= 0x00,
702 /* FIXME: needs tweaking */
703 static struct mxl5005s_config d680_dmb_tuner
= {
705 .if_freq
= 36125000UL,
706 .xtal_freq
= CRYSTAL_FREQ_16000000HZ
,
707 .agc_mode
= MXL_SINGLE_AGC
,
708 .tracking_filter
= MXL_TF_C
,
709 .rssi_enable
= MXL_RSSI_ENABLE
,
710 .cap_select
= MXL_CAP_SEL_ENABLE
,
711 .div_out
= MXL_DIV_OUT_4
,
712 .clock_out
= MXL_CLOCK_OUT_DISABLE
,
713 .output_load
= MXL5005S_IF_OUTPUT_LOAD_200_OHM
,
714 .top
= MXL5005S_TOP_25P2
,
715 .mod_mode
= MXL_DIGITAL_MODE
,
716 .if_mode
= MXL_ZERO_IF
,
717 .AgcMasterByte
= 0x00,
720 static struct max2165_config mygica_d689_max2165_cfg
= {
725 /* Callbacks for DVB USB */
726 static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter
*adap
)
728 dvb_attach(simple_tuner_attach
, adap
->fe_adap
[0].fe
,
729 &adap
->dev
->i2c_adap
, 0x61,
730 TUNER_PHILIPS_FMD1216ME_MK3
);
734 static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter
*adap
)
736 dvb_attach(dvb_pll_attach
, adap
->fe_adap
[0].fe
, 0x61,
737 NULL
, DVB_PLL_THOMSON_DTT7579
);
741 static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter
*adap
)
743 dvb_attach(dvb_pll_attach
, adap
->fe_adap
[0].fe
, 0x61, NULL
, DVB_PLL_LG_Z201
);
747 static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter
*adap
)
749 dvb_attach(dvb_pll_attach
, adap
->fe_adap
[0].fe
, 0x60,
750 NULL
, DVB_PLL_THOMSON_DTT7579
);
754 static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter
*adap
)
756 dvb_attach(simple_tuner_attach
, adap
->fe_adap
[0].fe
,
757 &adap
->dev
->i2c_adap
, 0x61, TUNER_LG_TDVS_H06XF
);
761 static int dvico_bluebird_xc2028_callback(void *ptr
, int component
,
762 int command
, int arg
)
764 struct dvb_usb_adapter
*adap
= ptr
;
765 struct dvb_usb_device
*d
= adap
->dev
;
768 case XC2028_TUNER_RESET
:
769 deb_info("%s: XC2028_TUNER_RESET %d\n", __func__
, arg
);
770 cxusb_bluebird_gpio_pulse(d
, 0x01, 1);
772 case XC2028_RESET_CLK
:
773 deb_info("%s: XC2028_RESET_CLK %d\n", __func__
, arg
);
776 deb_info("%s: unknown command %d, arg %d\n", __func__
,
784 static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter
*adap
)
786 struct dvb_frontend
*fe
;
787 struct xc2028_config cfg
= {
788 .i2c_adap
= &adap
->dev
->i2c_adap
,
791 static struct xc2028_ctrl ctl
= {
792 .fname
= XC2028_DEFAULT_FIRMWARE
,
794 .demod
= XC3028_FE_ZARLINK456
,
797 /* FIXME: generalize & move to common area */
798 adap
->fe_adap
[0].fe
->callback
= dvico_bluebird_xc2028_callback
;
800 fe
= dvb_attach(xc2028_attach
, adap
->fe_adap
[0].fe
, &cfg
);
801 if (fe
== NULL
|| fe
->ops
.tuner_ops
.set_config
== NULL
)
804 fe
->ops
.tuner_ops
.set_config(fe
, &ctl
);
809 static int cxusb_mxl5003s_tuner_attach(struct dvb_usb_adapter
*adap
)
811 dvb_attach(mxl5005s_attach
, adap
->fe_adap
[0].fe
,
812 &adap
->dev
->i2c_adap
, &aver_a868r_tuner
);
816 static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter
*adap
)
818 struct dvb_frontend
*fe
;
819 fe
= dvb_attach(mxl5005s_attach
, adap
->fe_adap
[0].fe
,
820 &adap
->dev
->i2c_adap
, &d680_dmb_tuner
);
821 return (fe
== NULL
) ? -EIO
: 0;
824 static int cxusb_mygica_d689_tuner_attach(struct dvb_usb_adapter
*adap
)
826 struct dvb_frontend
*fe
;
827 fe
= dvb_attach(max2165_attach
, adap
->fe_adap
[0].fe
,
828 &adap
->dev
->i2c_adap
, &mygica_d689_max2165_cfg
);
829 return (fe
== NULL
) ? -EIO
: 0;
832 static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter
*adap
)
835 if (usb_set_interface(adap
->dev
->udev
, 0, 6) < 0)
836 err("set interface failed");
838 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, &b
, 1);
840 adap
->fe_adap
[0].fe
= dvb_attach(cx22702_attach
, &cxusb_cx22702_config
,
841 &adap
->dev
->i2c_adap
);
842 if ((adap
->fe_adap
[0].fe
) != NULL
)
848 static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter
*adap
)
850 if (usb_set_interface(adap
->dev
->udev
, 0, 7) < 0)
851 err("set interface failed");
853 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
855 adap
->fe_adap
[0].fe
= dvb_attach(lgdt330x_attach
,
856 &cxusb_lgdt3303_config
,
857 &adap
->dev
->i2c_adap
);
858 if ((adap
->fe_adap
[0].fe
) != NULL
)
864 static int cxusb_aver_lgdt3303_frontend_attach(struct dvb_usb_adapter
*adap
)
866 adap
->fe_adap
[0].fe
= dvb_attach(lgdt330x_attach
, &cxusb_aver_lgdt3303_config
,
867 &adap
->dev
->i2c_adap
);
868 if (adap
->fe_adap
[0].fe
!= NULL
)
874 static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter
*adap
)
876 /* used in both lgz201 and th7579 */
877 if (usb_set_interface(adap
->dev
->udev
, 0, 0) < 0)
878 err("set interface failed");
880 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
882 adap
->fe_adap
[0].fe
= dvb_attach(mt352_attach
, &cxusb_mt352_config
,
883 &adap
->dev
->i2c_adap
);
884 if ((adap
->fe_adap
[0].fe
) != NULL
)
890 static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter
*adap
)
892 if (usb_set_interface(adap
->dev
->udev
, 0, 0) < 0)
893 err("set interface failed");
895 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
897 adap
->fe_adap
[0].fe
= dvb_attach(mt352_attach
, &cxusb_dee1601_config
,
898 &adap
->dev
->i2c_adap
);
899 if ((adap
->fe_adap
[0].fe
) != NULL
)
902 adap
->fe_adap
[0].fe
= dvb_attach(zl10353_attach
,
903 &cxusb_zl10353_dee1601_config
,
904 &adap
->dev
->i2c_adap
);
905 if ((adap
->fe_adap
[0].fe
) != NULL
)
911 static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter
*adap
)
915 struct i2c_msg msg
= { .addr
= 0x6b, .flags
= I2C_M_RD
,
916 .buf
= ircode
, .len
= 4 };
918 if (usb_set_interface(adap
->dev
->udev
, 0, 1) < 0)
919 err("set interface failed");
921 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
923 /* reset the tuner and demodulator */
924 cxusb_bluebird_gpio_rw(adap
->dev
, 0x04, 0);
925 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x01, 1);
926 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x02, 1);
928 adap
->fe_adap
[0].fe
=
929 dvb_attach(zl10353_attach
,
930 &cxusb_zl10353_xc3028_config_no_i2c_gate
,
931 &adap
->dev
->i2c_adap
);
932 if ((adap
->fe_adap
[0].fe
) == NULL
)
935 /* try to determine if there is no IR decoder on the I2C bus */
936 for (i
= 0; adap
->dev
->props
.rc
.legacy
.rc_map_table
!= NULL
&& i
< 5; i
++) {
938 if (cxusb_i2c_xfer(&adap
->dev
->i2c_adap
, &msg
, 1) != 1)
940 if (ircode
[0] == 0 && ircode
[1] == 0)
942 if (ircode
[2] + ircode
[3] != 0xff) {
944 adap
->dev
->props
.rc
.legacy
.rc_map_table
= NULL
;
945 info("No IR receiver detected on this device.");
953 static struct dibx000_agc_config dib7070_agc_config
= {
954 .band_caps
= BAND_UHF
| BAND_VHF
| BAND_LBAND
| BAND_SBAND
,
957 * P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5,
958 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
959 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0
961 .setup
= (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) |
962 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
988 .perform_agc_softsplit
= 0,
991 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz
= {
1001 .IO_CLK_en_core
= 1,
1004 /* refsel, sel, freq_15k */
1005 .sad_cfg
= (3 << 14) | (1 << 12) | (524 << 0),
1006 .ifreq
= (0 << 25) | 0,
1008 .xtal_hz
= 12000000,
1011 static struct dib7000p_config cxusb_dualdig4_rev2_config
= {
1012 .output_mode
= OUTMODE_MPEG2_PAR_GATED_CLK
,
1013 .output_mpeg2_in_188_bytes
= 1,
1015 .agc_config_count
= 1,
1016 .agc
= &dib7070_agc_config
,
1017 .bw
= &dib7070_bw_config_12_mhz
,
1018 .tuner_is_baseband
= 1,
1024 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
1026 .hostbus_diversity
= 1,
1029 static int cxusb_dualdig4_rev2_frontend_attach(struct dvb_usb_adapter
*adap
)
1031 if (usb_set_interface(adap
->dev
->udev
, 0, 1) < 0)
1032 err("set interface failed");
1034 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
1036 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x02, 1);
1038 if (dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
1039 &cxusb_dualdig4_rev2_config
) < 0) {
1040 printk(KERN_WARNING
"Unable to enumerate dib7000p\n");
1044 adap
->fe_adap
[0].fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x80,
1045 &cxusb_dualdig4_rev2_config
);
1046 if (adap
->fe_adap
[0].fe
== NULL
)
1052 static int dib7070_tuner_reset(struct dvb_frontend
*fe
, int onoff
)
1054 return dib7000p_set_gpio(fe
, 8, 0, !onoff
);
1057 static int dib7070_tuner_sleep(struct dvb_frontend
*fe
, int onoff
)
1062 static struct dib0070_config dib7070p_dib0070_config
= {
1063 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
1064 .reset
= dib7070_tuner_reset
,
1065 .sleep
= dib7070_tuner_sleep
,
1069 struct dib0700_adapter_state
{
1070 int (*set_param_save
) (struct dvb_frontend
*);
1073 static int dib7070_set_param_override(struct dvb_frontend
*fe
)
1075 struct dtv_frontend_properties
*p
= &fe
->dtv_property_cache
;
1076 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
1077 struct dib0700_adapter_state
*state
= adap
->priv
;
1080 u8 band
= BAND_OF_FREQUENCY(p
->frequency
/1000);
1082 case BAND_VHF
: offset
= 950; break;
1084 case BAND_UHF
: offset
= 550; break;
1087 dib7000p_set_wbd_ref(fe
, offset
+ dib0070_wbd_offset(fe
));
1089 return state
->set_param_save(fe
);
1092 static int cxusb_dualdig4_rev2_tuner_attach(struct dvb_usb_adapter
*adap
)
1094 struct dib0700_adapter_state
*st
= adap
->priv
;
1095 struct i2c_adapter
*tun_i2c
=
1096 dib7000p_get_i2c_master(adap
->fe_adap
[0].fe
,
1097 DIBX000_I2C_INTERFACE_TUNER
, 1);
1099 if (dvb_attach(dib0070_attach
, adap
->fe_adap
[0].fe
, tun_i2c
,
1100 &dib7070p_dib0070_config
) == NULL
)
1103 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
1104 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib7070_set_param_override
;
1108 static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter
*adap
)
1110 if (usb_set_interface(adap
->dev
->udev
, 0, 1) < 0)
1111 err("set interface failed");
1113 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
1115 /* reset the tuner and demodulator */
1116 cxusb_bluebird_gpio_rw(adap
->dev
, 0x04, 0);
1117 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x01, 1);
1118 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x02, 1);
1120 adap
->fe_adap
[0].fe
= dvb_attach(zl10353_attach
,
1121 &cxusb_zl10353_xc3028_config
,
1122 &adap
->dev
->i2c_adap
);
1123 if ((adap
->fe_adap
[0].fe
) != NULL
)
1126 adap
->fe_adap
[0].fe
= dvb_attach(mt352_attach
,
1127 &cxusb_mt352_xc3028_config
,
1128 &adap
->dev
->i2c_adap
);
1129 if ((adap
->fe_adap
[0].fe
) != NULL
)
1135 static struct lgs8gxx_config d680_lgs8gl5_cfg
= {
1136 .prod
= LGS8GXX_PROD_LGS8GL5
,
1137 .demod_address
= 0x19,
1141 .if_clk_freq
= 30400, /* 30.4 MHz */
1142 .if_freq
= 5725, /* 5.725 MHz */
1149 static int cxusb_d680_dmb_frontend_attach(struct dvb_usb_adapter
*adap
)
1151 struct dvb_usb_device
*d
= adap
->dev
;
1154 /* Select required USB configuration */
1155 if (usb_set_interface(d
->udev
, 0, 0) < 0)
1156 err("set interface failed");
1158 /* Unblock all USB pipes */
1159 usb_clear_halt(d
->udev
,
1160 usb_sndbulkpipe(d
->udev
, d
->props
.generic_bulk_ctrl_endpoint
));
1161 usb_clear_halt(d
->udev
,
1162 usb_rcvbulkpipe(d
->udev
, d
->props
.generic_bulk_ctrl_endpoint
));
1163 usb_clear_halt(d
->udev
,
1164 usb_rcvbulkpipe(d
->udev
, d
->props
.adapter
[0].fe
[0].stream
.endpoint
));
1166 /* Drain USB pipes to avoid hang after reboot */
1167 for (n
= 0; n
< 5; n
++) {
1168 cxusb_d680_dmb_drain_message(d
);
1169 cxusb_d680_dmb_drain_video(d
);
1173 /* Reset the tuner */
1174 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 0) < 0) {
1175 err("clear tuner gpio failed");
1179 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 1) < 0) {
1180 err("set tuner gpio failed");
1185 /* Attach frontend */
1186 adap
->fe_adap
[0].fe
= dvb_attach(lgs8gxx_attach
, &d680_lgs8gl5_cfg
, &d
->i2c_adap
);
1187 if (adap
->fe_adap
[0].fe
== NULL
)
1193 static struct atbm8830_config mygica_d689_atbm8830_cfg
= {
1194 .prod
= ATBM8830_PROD_8830
,
1195 .demod_address
= 0x40,
1197 .ts_sampling_edge
= 1,
1199 .osc_clk_freq
= 30400, /* in kHz */
1200 .if_freq
= 0, /* zero IF */
1207 static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter
*adap
)
1209 struct dvb_usb_device
*d
= adap
->dev
;
1211 /* Select required USB configuration */
1212 if (usb_set_interface(d
->udev
, 0, 0) < 0)
1213 err("set interface failed");
1215 /* Unblock all USB pipes */
1216 usb_clear_halt(d
->udev
,
1217 usb_sndbulkpipe(d
->udev
, d
->props
.generic_bulk_ctrl_endpoint
));
1218 usb_clear_halt(d
->udev
,
1219 usb_rcvbulkpipe(d
->udev
, d
->props
.generic_bulk_ctrl_endpoint
));
1220 usb_clear_halt(d
->udev
,
1221 usb_rcvbulkpipe(d
->udev
, d
->props
.adapter
[0].fe
[0].stream
.endpoint
));
1224 /* Reset the tuner */
1225 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 0) < 0) {
1226 err("clear tuner gpio failed");
1230 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 1) < 0) {
1231 err("set tuner gpio failed");
1236 /* Attach frontend */
1237 adap
->fe_adap
[0].fe
= dvb_attach(atbm8830_attach
, &mygica_d689_atbm8830_cfg
,
1239 if (adap
->fe_adap
[0].fe
== NULL
)
1246 * DViCO has shipped two devices with the same USB ID, but only one of them
1247 * needs a firmware download. Check the device class details to see if they
1248 * have non-default values to decide whether the device is actually cold or
1249 * not, and forget a match if it turns out we selected the wrong device.
1251 static int bluebird_fx2_identify_state(struct usb_device
*udev
,
1252 struct dvb_usb_device_properties
*props
,
1253 struct dvb_usb_device_description
**desc
,
1256 int wascold
= *cold
;
1258 *cold
= udev
->descriptor
.bDeviceClass
== 0xff &&
1259 udev
->descriptor
.bDeviceSubClass
== 0xff &&
1260 udev
->descriptor
.bDeviceProtocol
== 0xff;
1262 if (*cold
&& !wascold
)
1269 * DViCO bluebird firmware needs the "warm" product ID to be patched into the
1270 * firmware file before download.
1273 static const int dvico_firmware_id_offsets
[] = { 6638, 3204 };
1274 static int bluebird_patch_dvico_firmware_download(struct usb_device
*udev
,
1275 const struct firmware
*fw
)
1279 for (pos
= 0; pos
< ARRAY_SIZE(dvico_firmware_id_offsets
); pos
++) {
1280 int idoff
= dvico_firmware_id_offsets
[pos
];
1282 if (fw
->size
< idoff
+ 4)
1285 if (fw
->data
[idoff
] == (USB_VID_DVICO
& 0xff) &&
1286 fw
->data
[idoff
+ 1] == USB_VID_DVICO
>> 8) {
1287 struct firmware new_fw
;
1288 u8
*new_fw_data
= vmalloc(fw
->size
);
1294 memcpy(new_fw_data
, fw
->data
, fw
->size
);
1295 new_fw
.size
= fw
->size
;
1296 new_fw
.data
= new_fw_data
;
1298 new_fw_data
[idoff
+ 2] =
1299 le16_to_cpu(udev
->descriptor
.idProduct
) + 1;
1300 new_fw_data
[idoff
+ 3] =
1301 le16_to_cpu(udev
->descriptor
.idProduct
) >> 8;
1303 ret
= usb_cypress_load_firmware(udev
, &new_fw
,
1313 /* DVB USB Driver stuff */
1314 static struct dvb_usb_device_properties cxusb_medion_properties
;
1315 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties
;
1316 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties
;
1317 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties
;
1318 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties
;
1319 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties
;
1320 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties
;
1321 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties
;
1322 static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties
;
1323 static struct dvb_usb_device_properties cxusb_aver_a868r_properties
;
1324 static struct dvb_usb_device_properties cxusb_d680_dmb_properties
;
1325 static struct dvb_usb_device_properties cxusb_mygica_d689_properties
;
1327 static int cxusb_probe(struct usb_interface
*intf
,
1328 const struct usb_device_id
*id
)
1330 if (0 == dvb_usb_device_init(intf
, &cxusb_medion_properties
,
1331 THIS_MODULE
, NULL
, adapter_nr
) ||
1332 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_lgh064f_properties
,
1333 THIS_MODULE
, NULL
, adapter_nr
) ||
1334 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_dee1601_properties
,
1335 THIS_MODULE
, NULL
, adapter_nr
) ||
1336 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_lgz201_properties
,
1337 THIS_MODULE
, NULL
, adapter_nr
) ||
1338 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_dtt7579_properties
,
1339 THIS_MODULE
, NULL
, adapter_nr
) ||
1340 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_dualdig4_properties
,
1341 THIS_MODULE
, NULL
, adapter_nr
) ||
1342 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_nano2_properties
,
1343 THIS_MODULE
, NULL
, adapter_nr
) ||
1344 0 == dvb_usb_device_init(intf
,
1345 &cxusb_bluebird_nano2_needsfirmware_properties
,
1346 THIS_MODULE
, NULL
, adapter_nr
) ||
1347 0 == dvb_usb_device_init(intf
, &cxusb_aver_a868r_properties
,
1348 THIS_MODULE
, NULL
, adapter_nr
) ||
1349 0 == dvb_usb_device_init(intf
,
1350 &cxusb_bluebird_dualdig4_rev2_properties
,
1351 THIS_MODULE
, NULL
, adapter_nr
) ||
1352 0 == dvb_usb_device_init(intf
, &cxusb_d680_dmb_properties
,
1353 THIS_MODULE
, NULL
, adapter_nr
) ||
1354 0 == dvb_usb_device_init(intf
, &cxusb_mygica_d689_properties
,
1355 THIS_MODULE
, NULL
, adapter_nr
) ||
1362 static struct usb_device_id cxusb_table
[] = {
1363 { USB_DEVICE(USB_VID_MEDION
, USB_PID_MEDION_MD95700
) },
1364 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LG064F_COLD
) },
1365 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LG064F_WARM
) },
1366 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD
) },
1367 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM
) },
1368 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD
) },
1369 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM
) },
1370 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_TH7579_COLD
) },
1371 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_TH7579_WARM
) },
1372 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD
) },
1373 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM
) },
1374 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD
) },
1375 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM
) },
1376 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_4
) },
1377 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2
) },
1378 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM
) },
1379 { USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_VOLAR_A868R
) },
1380 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2
) },
1381 { USB_DEVICE(USB_VID_CONEXANT
, USB_PID_CONEXANT_D680_DMB
) },
1382 { USB_DEVICE(USB_VID_CONEXANT
, USB_PID_MYGICA_D689
) },
1383 {} /* Terminating entry */
1385 MODULE_DEVICE_TABLE (usb
, cxusb_table
);
1387 static struct dvb_usb_device_properties cxusb_medion_properties
= {
1388 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1390 .usb_ctrl
= CYPRESS_FX2
,
1392 .size_of_priv
= sizeof(struct cxusb_state
),
1399 .streaming_ctrl
= cxusb_streaming_ctrl
,
1400 .frontend_attach
= cxusb_cx22702_frontend_attach
,
1401 .tuner_attach
= cxusb_fmd1216me_tuner_attach
,
1402 /* parameter for the MPEG2-data transfer */
1416 .power_ctrl
= cxusb_power_ctrl
,
1418 .i2c_algo
= &cxusb_i2c_algo
,
1420 .generic_bulk_ctrl_endpoint
= 0x01,
1422 .num_device_descs
= 1,
1424 { "Medion MD95700 (MDUSBTV-HYBRID)",
1426 { &cxusb_table
[0], NULL
},
1431 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties
= {
1432 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1434 .usb_ctrl
= DEVICE_SPECIFIC
,
1435 .firmware
= "dvb-usb-bluebird-01.fw",
1436 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1437 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1438 use usb alt setting 7 for EP2 transfer (atsc) */
1440 .size_of_priv
= sizeof(struct cxusb_state
),
1447 .streaming_ctrl
= cxusb_streaming_ctrl
,
1448 .frontend_attach
= cxusb_lgdt3303_frontend_attach
,
1449 .tuner_attach
= cxusb_lgh064f_tuner_attach
,
1451 /* parameter for the MPEG2-data transfer */
1466 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1468 .i2c_algo
= &cxusb_i2c_algo
,
1472 .rc_map_table
= rc_map_dvico_portable_table
,
1473 .rc_map_size
= ARRAY_SIZE(rc_map_dvico_portable_table
),
1474 .rc_query
= cxusb_rc_query
,
1477 .generic_bulk_ctrl_endpoint
= 0x01,
1479 .num_device_descs
= 1,
1481 { "DViCO FusionHDTV5 USB Gold",
1482 { &cxusb_table
[1], NULL
},
1483 { &cxusb_table
[2], NULL
},
1488 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties
= {
1489 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1491 .usb_ctrl
= DEVICE_SPECIFIC
,
1492 .firmware
= "dvb-usb-bluebird-01.fw",
1493 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1494 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1495 use usb alt setting 7 for EP2 transfer (atsc) */
1497 .size_of_priv
= sizeof(struct cxusb_state
),
1504 .streaming_ctrl
= cxusb_streaming_ctrl
,
1505 .frontend_attach
= cxusb_dee1601_frontend_attach
,
1506 .tuner_attach
= cxusb_dee1601_tuner_attach
,
1507 /* parameter for the MPEG2-data transfer */
1522 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1524 .i2c_algo
= &cxusb_i2c_algo
,
1528 .rc_map_table
= rc_map_dvico_mce_table
,
1529 .rc_map_size
= ARRAY_SIZE(rc_map_dvico_mce_table
),
1530 .rc_query
= cxusb_rc_query
,
1533 .generic_bulk_ctrl_endpoint
= 0x01,
1535 .num_device_descs
= 3,
1537 { "DViCO FusionHDTV DVB-T Dual USB",
1538 { &cxusb_table
[3], NULL
},
1539 { &cxusb_table
[4], NULL
},
1541 { "DigitalNow DVB-T Dual USB",
1542 { &cxusb_table
[9], NULL
},
1543 { &cxusb_table
[10], NULL
},
1545 { "DViCO FusionHDTV DVB-T Dual Digital 2",
1546 { &cxusb_table
[11], NULL
},
1547 { &cxusb_table
[12], NULL
},
1552 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties
= {
1553 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1555 .usb_ctrl
= DEVICE_SPECIFIC
,
1556 .firmware
= "dvb-usb-bluebird-01.fw",
1557 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1558 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1559 use usb alt setting 7 for EP2 transfer (atsc) */
1561 .size_of_priv
= sizeof(struct cxusb_state
),
1568 .streaming_ctrl
= cxusb_streaming_ctrl
,
1569 .frontend_attach
= cxusb_mt352_frontend_attach
,
1570 .tuner_attach
= cxusb_lgz201_tuner_attach
,
1572 /* parameter for the MPEG2-data transfer */
1586 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1588 .i2c_algo
= &cxusb_i2c_algo
,
1592 .rc_map_table
= rc_map_dvico_portable_table
,
1593 .rc_map_size
= ARRAY_SIZE(rc_map_dvico_portable_table
),
1594 .rc_query
= cxusb_rc_query
,
1597 .generic_bulk_ctrl_endpoint
= 0x01,
1598 .num_device_descs
= 1,
1600 { "DViCO FusionHDTV DVB-T USB (LGZ201)",
1601 { &cxusb_table
[5], NULL
},
1602 { &cxusb_table
[6], NULL
},
1607 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties
= {
1608 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1610 .usb_ctrl
= DEVICE_SPECIFIC
,
1611 .firmware
= "dvb-usb-bluebird-01.fw",
1612 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1613 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1614 use usb alt setting 7 for EP2 transfer (atsc) */
1616 .size_of_priv
= sizeof(struct cxusb_state
),
1623 .streaming_ctrl
= cxusb_streaming_ctrl
,
1624 .frontend_attach
= cxusb_mt352_frontend_attach
,
1625 .tuner_attach
= cxusb_dtt7579_tuner_attach
,
1627 /* parameter for the MPEG2-data transfer */
1641 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1643 .i2c_algo
= &cxusb_i2c_algo
,
1647 .rc_map_table
= rc_map_dvico_portable_table
,
1648 .rc_map_size
= ARRAY_SIZE(rc_map_dvico_portable_table
),
1649 .rc_query
= cxusb_rc_query
,
1652 .generic_bulk_ctrl_endpoint
= 0x01,
1654 .num_device_descs
= 1,
1656 { "DViCO FusionHDTV DVB-T USB (TH7579)",
1657 { &cxusb_table
[7], NULL
},
1658 { &cxusb_table
[8], NULL
},
1663 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties
= {
1664 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1666 .usb_ctrl
= CYPRESS_FX2
,
1668 .size_of_priv
= sizeof(struct cxusb_state
),
1675 .streaming_ctrl
= cxusb_streaming_ctrl
,
1676 .frontend_attach
= cxusb_dualdig4_frontend_attach
,
1677 .tuner_attach
= cxusb_dvico_xc3028_tuner_attach
,
1678 /* parameter for the MPEG2-data transfer */
1693 .power_ctrl
= cxusb_power_ctrl
,
1695 .i2c_algo
= &cxusb_i2c_algo
,
1697 .generic_bulk_ctrl_endpoint
= 0x01,
1701 .rc_map_table
= rc_map_dvico_mce_table
,
1702 .rc_map_size
= ARRAY_SIZE(rc_map_dvico_mce_table
),
1703 .rc_query
= cxusb_bluebird2_rc_query
,
1706 .num_device_descs
= 1,
1708 { "DViCO FusionHDTV DVB-T Dual Digital 4",
1710 { &cxusb_table
[13], NULL
},
1715 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties
= {
1716 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1718 .usb_ctrl
= CYPRESS_FX2
,
1719 .identify_state
= bluebird_fx2_identify_state
,
1721 .size_of_priv
= sizeof(struct cxusb_state
),
1728 .streaming_ctrl
= cxusb_streaming_ctrl
,
1729 .frontend_attach
= cxusb_nano2_frontend_attach
,
1730 .tuner_attach
= cxusb_dvico_xc3028_tuner_attach
,
1731 /* parameter for the MPEG2-data transfer */
1746 .power_ctrl
= cxusb_nano2_power_ctrl
,
1748 .i2c_algo
= &cxusb_i2c_algo
,
1750 .generic_bulk_ctrl_endpoint
= 0x01,
1754 .rc_map_table
= rc_map_dvico_portable_table
,
1755 .rc_map_size
= ARRAY_SIZE(rc_map_dvico_portable_table
),
1756 .rc_query
= cxusb_bluebird2_rc_query
,
1759 .num_device_descs
= 1,
1761 { "DViCO FusionHDTV DVB-T NANO2",
1763 { &cxusb_table
[14], NULL
},
1768 static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties
= {
1769 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1771 .usb_ctrl
= DEVICE_SPECIFIC
,
1772 .firmware
= "dvb-usb-bluebird-02.fw",
1773 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1774 .identify_state
= bluebird_fx2_identify_state
,
1776 .size_of_priv
= sizeof(struct cxusb_state
),
1783 .streaming_ctrl
= cxusb_streaming_ctrl
,
1784 .frontend_attach
= cxusb_nano2_frontend_attach
,
1785 .tuner_attach
= cxusb_dvico_xc3028_tuner_attach
,
1786 /* parameter for the MPEG2-data transfer */
1801 .power_ctrl
= cxusb_nano2_power_ctrl
,
1803 .i2c_algo
= &cxusb_i2c_algo
,
1805 .generic_bulk_ctrl_endpoint
= 0x01,
1809 .rc_map_table
= rc_map_dvico_portable_table
,
1810 .rc_map_size
= ARRAY_SIZE(rc_map_dvico_portable_table
),
1811 .rc_query
= cxusb_rc_query
,
1814 .num_device_descs
= 1,
1816 { "DViCO FusionHDTV DVB-T NANO2 w/o firmware",
1817 { &cxusb_table
[14], NULL
},
1818 { &cxusb_table
[15], NULL
},
1823 static struct dvb_usb_device_properties cxusb_aver_a868r_properties
= {
1824 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1826 .usb_ctrl
= CYPRESS_FX2
,
1828 .size_of_priv
= sizeof(struct cxusb_state
),
1835 .streaming_ctrl
= cxusb_aver_streaming_ctrl
,
1836 .frontend_attach
= cxusb_aver_lgdt3303_frontend_attach
,
1837 .tuner_attach
= cxusb_mxl5003s_tuner_attach
,
1838 /* parameter for the MPEG2-data transfer */
1852 .power_ctrl
= cxusb_aver_power_ctrl
,
1854 .i2c_algo
= &cxusb_i2c_algo
,
1856 .generic_bulk_ctrl_endpoint
= 0x01,
1858 .num_device_descs
= 1,
1860 { "AVerMedia AVerTVHD Volar (A868R)",
1862 { &cxusb_table
[16], NULL
},
1868 struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties
= {
1869 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1871 .usb_ctrl
= CYPRESS_FX2
,
1873 .size_of_priv
= sizeof(struct cxusb_state
),
1878 .size_of_priv
= sizeof(struct dib0700_adapter_state
),
1881 .streaming_ctrl
= cxusb_streaming_ctrl
,
1882 .frontend_attach
= cxusb_dualdig4_rev2_frontend_attach
,
1883 .tuner_attach
= cxusb_dualdig4_rev2_tuner_attach
,
1884 /* parameter for the MPEG2-data transfer */
1899 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1901 .i2c_algo
= &cxusb_i2c_algo
,
1903 .generic_bulk_ctrl_endpoint
= 0x01,
1907 .rc_map_table
= rc_map_dvico_mce_table
,
1908 .rc_map_size
= ARRAY_SIZE(rc_map_dvico_mce_table
),
1909 .rc_query
= cxusb_rc_query
,
1912 .num_device_descs
= 1,
1914 { "DViCO FusionHDTV DVB-T Dual Digital 4 (rev 2)",
1916 { &cxusb_table
[17], NULL
},
1921 static struct dvb_usb_device_properties cxusb_d680_dmb_properties
= {
1922 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1924 .usb_ctrl
= CYPRESS_FX2
,
1926 .size_of_priv
= sizeof(struct cxusb_state
),
1933 .streaming_ctrl
= cxusb_d680_dmb_streaming_ctrl
,
1934 .frontend_attach
= cxusb_d680_dmb_frontend_attach
,
1935 .tuner_attach
= cxusb_d680_dmb_tuner_attach
,
1937 /* parameter for the MPEG2-data transfer */
1952 .power_ctrl
= cxusb_d680_dmb_power_ctrl
,
1954 .i2c_algo
= &cxusb_i2c_algo
,
1956 .generic_bulk_ctrl_endpoint
= 0x01,
1960 .rc_map_table
= rc_map_d680_dmb_table
,
1961 .rc_map_size
= ARRAY_SIZE(rc_map_d680_dmb_table
),
1962 .rc_query
= cxusb_d680_dmb_rc_query
,
1965 .num_device_descs
= 1,
1968 "Conexant DMB-TH Stick",
1970 { &cxusb_table
[18], NULL
},
1975 static struct dvb_usb_device_properties cxusb_mygica_d689_properties
= {
1976 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1978 .usb_ctrl
= CYPRESS_FX2
,
1980 .size_of_priv
= sizeof(struct cxusb_state
),
1987 .streaming_ctrl
= cxusb_d680_dmb_streaming_ctrl
,
1988 .frontend_attach
= cxusb_mygica_d689_frontend_attach
,
1989 .tuner_attach
= cxusb_mygica_d689_tuner_attach
,
1991 /* parameter for the MPEG2-data transfer */
2006 .power_ctrl
= cxusb_d680_dmb_power_ctrl
,
2008 .i2c_algo
= &cxusb_i2c_algo
,
2010 .generic_bulk_ctrl_endpoint
= 0x01,
2014 .rc_map_table
= rc_map_d680_dmb_table
,
2015 .rc_map_size
= ARRAY_SIZE(rc_map_d680_dmb_table
),
2016 .rc_query
= cxusb_d680_dmb_rc_query
,
2019 .num_device_descs
= 1,
2022 "Mygica D689 DMB-TH",
2024 { &cxusb_table
[19], NULL
},
2029 static struct usb_driver cxusb_driver
= {
2030 .name
= "dvb_usb_cxusb",
2031 .probe
= cxusb_probe
,
2032 .disconnect
= dvb_usb_device_exit
,
2033 .id_table
= cxusb_table
,
2036 module_usb_driver(cxusb_driver
);
2038 MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
2039 MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
2040 MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
2041 MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
2042 MODULE_VERSION("1.0-alpha");
2043 MODULE_LICENSE("GPL");