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>
34 #include "mt352_priv.h"
36 #include "tuner-xc2028.h"
37 #include "tuner-simple.h"
46 static int dvb_usb_cxusb_debug
;
47 module_param_named(debug
, dvb_usb_cxusb_debug
, int, 0644);
48 MODULE_PARM_DESC(debug
, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS
);
50 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr
);
52 #define deb_info(args...) dprintk(dvb_usb_cxusb_debug, 0x03, args)
53 #define deb_i2c(args...) dprintk(dvb_usb_cxusb_debug, 0x02, args)
55 static int cxusb_ctrl_msg(struct dvb_usb_device
*d
,
56 u8 cmd
, u8
*wbuf
, int wlen
, u8
*rbuf
, int rlen
)
58 int wo
= (rbuf
== NULL
|| rlen
== 0); /* write-only */
60 memset(sndbuf
, 0, 1+wlen
);
63 memcpy(&sndbuf
[1], wbuf
, wlen
);
65 return dvb_usb_generic_write(d
, sndbuf
, 1+wlen
);
67 return dvb_usb_generic_rw(d
, sndbuf
, 1+wlen
, rbuf
, rlen
, 0);
71 static void cxusb_gpio_tuner(struct dvb_usb_device
*d
, int onoff
)
73 struct cxusb_state
*st
= d
->priv
;
76 if (st
->gpio_write_state
[GPIO_TUNER
] == onoff
)
81 cxusb_ctrl_msg(d
, CMD_GPIO_WRITE
, o
, 2, &i
, 1);
84 deb_info("gpio_write failed.\n");
86 st
->gpio_write_state
[GPIO_TUNER
] = onoff
;
89 static int cxusb_bluebird_gpio_rw(struct dvb_usb_device
*d
, u8 changemask
,
95 o
[0] = 0xff & ~changemask
; /* mask of bits to keep */
96 o
[1] = newval
& changemask
; /* new values for bits */
98 rc
= cxusb_ctrl_msg(d
, CMD_BLUEBIRD_GPIO_RW
, o
, 2, &gpio_state
, 1);
99 if (rc
< 0 || (gpio_state
& changemask
) != (newval
& changemask
))
100 deb_info("bluebird_gpio_write failed.\n");
102 return rc
< 0 ? rc
: gpio_state
;
105 static void cxusb_bluebird_gpio_pulse(struct dvb_usb_device
*d
, u8 pin
, int low
)
107 cxusb_bluebird_gpio_rw(d
, pin
, low
? 0 : pin
);
109 cxusb_bluebird_gpio_rw(d
, pin
, low
? pin
: 0);
112 static void cxusb_nano2_led(struct dvb_usb_device
*d
, int onoff
)
114 cxusb_bluebird_gpio_rw(d
, 0x40, onoff
? 0 : 0x40);
117 static int cxusb_d680_dmb_gpio_tuner(struct dvb_usb_device
*d
,
120 u8 o
[2] = {addr
, onoff
};
124 rc
= cxusb_ctrl_msg(d
, CMD_GPIO_WRITE
, o
, 2, &i
, 1);
131 deb_info("gpio_write failed.\n");
137 static int cxusb_i2c_xfer(struct i2c_adapter
*adap
, struct i2c_msg msg
[],
140 struct dvb_usb_device
*d
= i2c_get_adapdata(adap
);
143 if (mutex_lock_interruptible(&d
->i2c_mutex
) < 0)
146 for (i
= 0; i
< num
; i
++) {
148 if (d
->udev
->descriptor
.idVendor
== USB_VID_MEDION
)
149 switch (msg
[i
].addr
) {
151 cxusb_gpio_tuner(d
, 0);
154 cxusb_gpio_tuner(d
, 1);
158 if (msg
[i
].flags
& I2C_M_RD
) {
160 u8 obuf
[3], ibuf
[1+msg
[i
].len
];
162 obuf
[1] = msg
[i
].len
;
163 obuf
[2] = msg
[i
].addr
;
164 if (cxusb_ctrl_msg(d
, CMD_I2C_READ
,
166 ibuf
, 1+msg
[i
].len
) < 0) {
167 warn("i2c read failed");
170 memcpy(msg
[i
].buf
, &ibuf
[1], msg
[i
].len
);
171 } else if (i
+1 < num
&& (msg
[i
+1].flags
& I2C_M_RD
) &&
172 msg
[i
].addr
== msg
[i
+1].addr
) {
173 /* write to then read from same address */
174 u8 obuf
[3+msg
[i
].len
], ibuf
[1+msg
[i
+1].len
];
175 obuf
[0] = msg
[i
].len
;
176 obuf
[1] = msg
[i
+1].len
;
177 obuf
[2] = msg
[i
].addr
;
178 memcpy(&obuf
[3], msg
[i
].buf
, msg
[i
].len
);
180 if (cxusb_ctrl_msg(d
, CMD_I2C_READ
,
182 ibuf
, 1+msg
[i
+1].len
) < 0)
186 deb_i2c("i2c read may have failed\n");
188 memcpy(msg
[i
+1].buf
, &ibuf
[1], msg
[i
+1].len
);
193 u8 obuf
[2+msg
[i
].len
], ibuf
;
194 obuf
[0] = msg
[i
].addr
;
195 obuf
[1] = msg
[i
].len
;
196 memcpy(&obuf
[2], msg
[i
].buf
, msg
[i
].len
);
198 if (cxusb_ctrl_msg(d
, CMD_I2C_WRITE
, obuf
,
199 2+msg
[i
].len
, &ibuf
,1) < 0)
202 deb_i2c("i2c write may have failed\n");
206 mutex_unlock(&d
->i2c_mutex
);
207 return i
== num
? num
: -EREMOTEIO
;
210 static u32
cxusb_i2c_func(struct i2c_adapter
*adapter
)
215 static struct i2c_algorithm cxusb_i2c_algo
= {
216 .master_xfer
= cxusb_i2c_xfer
,
217 .functionality
= cxusb_i2c_func
,
220 static int cxusb_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
224 return cxusb_ctrl_msg(d
, CMD_POWER_ON
, &b
, 1, NULL
, 0);
226 return cxusb_ctrl_msg(d
, CMD_POWER_OFF
, &b
, 1, NULL
, 0);
229 static int cxusb_aver_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
233 return cxusb_ctrl_msg(d
, CMD_POWER_OFF
, NULL
, 0, NULL
, 0);
234 if (d
->state
== DVB_USB_STATE_INIT
&&
235 usb_set_interface(d
->udev
, 0, 0) < 0)
236 err("set interface failed");
237 do {} while (!(ret
= cxusb_ctrl_msg(d
, CMD_POWER_ON
, NULL
, 0, NULL
, 0)) &&
238 !(ret
= cxusb_ctrl_msg(d
, 0x15, NULL
, 0, NULL
, 0)) &&
239 !(ret
= cxusb_ctrl_msg(d
, 0x17, NULL
, 0, NULL
, 0)) && 0);
241 /* FIXME: We don't know why, but we need to configure the
242 * lgdt3303 with the register settings below on resume */
245 0x0e, 0x2, 0x00, 0x7f,
246 0x0e, 0x2, 0x02, 0xfe,
247 0x0e, 0x2, 0x02, 0x01,
248 0x0e, 0x2, 0x00, 0x03,
249 0x0e, 0x2, 0x0d, 0x40,
250 0x0e, 0x2, 0x0e, 0x87,
251 0x0e, 0x2, 0x0f, 0x8e,
252 0x0e, 0x2, 0x10, 0x01,
253 0x0e, 0x2, 0x14, 0xd7,
254 0x0e, 0x2, 0x47, 0x88,
257 for (i
= 0; i
< sizeof(bufs
)/sizeof(u8
); i
+= 4/sizeof(u8
)) {
258 ret
= cxusb_ctrl_msg(d
, CMD_I2C_WRITE
,
269 static int cxusb_bluebird_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
273 return cxusb_ctrl_msg(d
, CMD_POWER_ON
, &b
, 1, NULL
, 0);
278 static int cxusb_nano2_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
282 rc
= cxusb_power_ctrl(d
, onoff
);
284 cxusb_nano2_led(d
, 0);
289 static int cxusb_d680_dmb_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
293 ret
= cxusb_power_ctrl(d
, onoff
);
298 cxusb_ctrl_msg(d
, CMD_DIGITAL
, NULL
, 0, &b
, 1);
303 static int cxusb_streaming_ctrl(struct dvb_usb_adapter
*adap
, int onoff
)
305 u8 buf
[2] = { 0x03, 0x00 };
307 cxusb_ctrl_msg(adap
->dev
, CMD_STREAMING_ON
, buf
, 2, NULL
, 0);
309 cxusb_ctrl_msg(adap
->dev
, CMD_STREAMING_OFF
, NULL
, 0, NULL
, 0);
314 static int cxusb_aver_streaming_ctrl(struct dvb_usb_adapter
*adap
, int onoff
)
317 cxusb_ctrl_msg(adap
->dev
, CMD_AVER_STREAM_ON
, NULL
, 0, NULL
, 0);
319 cxusb_ctrl_msg(adap
->dev
, CMD_AVER_STREAM_OFF
,
324 static void cxusb_d680_dmb_drain_message(struct dvb_usb_device
*d
)
326 int ep
= d
->props
.generic_bulk_ctrl_endpoint
;
327 const int timeout
= 100;
328 const int junk_len
= 32;
332 /* Discard remaining data in video pipe */
333 junk
= kmalloc(junk_len
, GFP_KERNEL
);
337 if (usb_bulk_msg(d
->udev
,
338 usb_rcvbulkpipe(d
->udev
, ep
),
339 junk
, junk_len
, &rd_count
, timeout
) < 0)
347 static void cxusb_d680_dmb_drain_video(struct dvb_usb_device
*d
)
349 struct usb_data_stream_properties
*p
= &d
->props
.adapter
[0].stream
;
350 const int timeout
= 100;
351 const int junk_len
= p
->u
.bulk
.buffersize
;
355 /* Discard remaining data in video pipe */
356 junk
= kmalloc(junk_len
, GFP_KERNEL
);
360 if (usb_bulk_msg(d
->udev
,
361 usb_rcvbulkpipe(d
->udev
, p
->endpoint
),
362 junk
, junk_len
, &rd_count
, timeout
) < 0)
370 static int cxusb_d680_dmb_streaming_ctrl(
371 struct dvb_usb_adapter
*adap
, int onoff
)
374 u8 buf
[2] = { 0x03, 0x00 };
375 cxusb_d680_dmb_drain_video(adap
->dev
);
376 return cxusb_ctrl_msg(adap
->dev
, CMD_STREAMING_ON
,
377 buf
, sizeof(buf
), NULL
, 0);
379 int ret
= cxusb_ctrl_msg(adap
->dev
,
380 CMD_STREAMING_OFF
, NULL
, 0, NULL
, 0);
385 static int cxusb_rc_query(struct dvb_usb_device
*d
, u32
*event
, int *state
)
387 struct dvb_usb_rc_key
*keymap
= d
->props
.rc_key_map
;
391 cxusb_ctrl_msg(d
, CMD_GET_IR_CODE
, NULL
, 0, ircode
, 4);
394 *state
= REMOTE_NO_KEY_PRESSED
;
396 for (i
= 0; i
< d
->props
.rc_key_map_size
; i
++) {
397 if (rc5_custom(&keymap
[i
]) == ircode
[2] &&
398 rc5_data(&keymap
[i
]) == ircode
[3]) {
399 *event
= keymap
[i
].event
;
400 *state
= REMOTE_KEY_PRESSED
;
409 static int cxusb_bluebird2_rc_query(struct dvb_usb_device
*d
, u32
*event
,
412 struct dvb_usb_rc_key
*keymap
= d
->props
.rc_key_map
;
415 struct i2c_msg msg
= { .addr
= 0x6b, .flags
= I2C_M_RD
,
416 .buf
= ircode
, .len
= 4 };
419 *state
= REMOTE_NO_KEY_PRESSED
;
421 if (cxusb_i2c_xfer(&d
->i2c_adap
, &msg
, 1) != 1)
424 for (i
= 0; i
< d
->props
.rc_key_map_size
; i
++) {
425 if (rc5_custom(&keymap
[i
]) == ircode
[1] &&
426 rc5_data(&keymap
[i
]) == ircode
[2]) {
427 *event
= keymap
[i
].event
;
428 *state
= REMOTE_KEY_PRESSED
;
437 static int cxusb_d680_dmb_rc_query(struct dvb_usb_device
*d
, u32
*event
,
440 struct dvb_usb_rc_key
*keymap
= d
->props
.rc_key_map
;
445 *state
= REMOTE_NO_KEY_PRESSED
;
447 if (cxusb_ctrl_msg(d
, 0x10, NULL
, 0, ircode
, 2) < 0)
450 for (i
= 0; i
< d
->props
.rc_key_map_size
; i
++) {
451 if (rc5_custom(&keymap
[i
]) == ircode
[0] &&
452 rc5_data(&keymap
[i
]) == ircode
[1]) {
453 *event
= keymap
[i
].event
;
454 *state
= REMOTE_KEY_PRESSED
;
463 static struct dvb_usb_rc_key dvico_mce_rc_keys
[] = {
467 { 0xfe1e, KEY_FAVORITES
},
468 { 0xfe16, KEY_SETUP
},
469 { 0xfe46, KEY_POWER2
},
471 { 0xfe49, KEY_BACK
},
472 { 0xfe4d, KEY_MENU
},
474 { 0xfe5b, KEY_LEFT
},
475 { 0xfe5f, KEY_RIGHT
},
476 { 0xfe53, KEY_DOWN
},
478 { 0xfe59, KEY_INFO
},
480 { 0xfe0f, KEY_PREVIOUSSONG
},/* Replay */
481 { 0xfe12, KEY_NEXTSONG
}, /* Skip */
482 { 0xfe42, KEY_ENTER
}, /* Windows/Start */
483 { 0xfe15, KEY_VOLUMEUP
},
484 { 0xfe05, KEY_VOLUMEDOWN
},
485 { 0xfe11, KEY_CHANNELUP
},
486 { 0xfe09, KEY_CHANNELDOWN
},
487 { 0xfe52, KEY_CAMERA
},
488 { 0xfe5a, KEY_TUNER
}, /* Live */
489 { 0xfe19, KEY_OPEN
},
499 { 0xfe13, KEY_ANGLE
}, /* Aspect */
501 { 0xfe1f, KEY_ZOOM
},
502 { 0xfe43, KEY_REWIND
},
503 { 0xfe47, KEY_PLAYPAUSE
},
504 { 0xfe4f, KEY_FASTFORWARD
},
505 { 0xfe57, KEY_MUTE
},
506 { 0xfe0d, KEY_STOP
},
507 { 0xfe01, KEY_RECORD
},
508 { 0xfe4e, KEY_POWER
},
511 static struct dvb_usb_rc_key dvico_portable_rc_keys
[] = {
512 { 0xfc02, KEY_SETUP
}, /* Profile */
513 { 0xfc43, KEY_POWER2
},
515 { 0xfc5a, KEY_BACK
},
516 { 0xfc05, KEY_MENU
},
517 { 0xfc47, KEY_INFO
},
519 { 0xfc42, KEY_PREVIOUSSONG
},/* Replay */
520 { 0xfc49, KEY_VOLUMEUP
},
521 { 0xfc09, KEY_VOLUMEDOWN
},
522 { 0xfc54, KEY_CHANNELUP
},
523 { 0xfc0b, KEY_CHANNELDOWN
},
524 { 0xfc16, KEY_CAMERA
},
525 { 0xfc40, KEY_TUNER
}, /* ATV/DTV */
526 { 0xfc45, KEY_OPEN
},
536 { 0xfc44, KEY_ANGLE
}, /* Aspect */
538 { 0xfc07, KEY_ZOOM
},
539 { 0xfc0a, KEY_REWIND
},
540 { 0xfc08, KEY_PLAYPAUSE
},
541 { 0xfc4b, KEY_FASTFORWARD
},
542 { 0xfc5b, KEY_MUTE
},
543 { 0xfc04, KEY_STOP
},
544 { 0xfc56, KEY_RECORD
},
545 { 0xfc57, KEY_POWER
},
546 { 0xfc41, KEY_UNKNOWN
}, /* INPUT */
547 { 0xfc00, KEY_UNKNOWN
}, /* HD */
550 static struct dvb_usb_rc_key d680_dmb_rc_keys
[] = {
551 { 0x0038, KEY_UNKNOWN
}, /* TV/AV */
552 { 0x080c, KEY_ZOOM
},
563 { 0x000a, KEY_MUTE
},
564 { 0x0829, KEY_BACK
},
565 { 0x0012, KEY_CHANNELUP
},
566 { 0x0813, KEY_CHANNELDOWN
},
567 { 0x002b, KEY_VOLUMEUP
},
568 { 0x082c, KEY_VOLUMEDOWN
},
570 { 0x0821, KEY_DOWN
},
571 { 0x0011, KEY_LEFT
},
572 { 0x0810, KEY_RIGHT
},
574 { 0x081f, KEY_RECORD
},
575 { 0x0017, KEY_PLAYPAUSE
},
576 { 0x0816, KEY_PLAYPAUSE
},
577 { 0x000b, KEY_STOP
},
578 { 0x0827, KEY_FASTFORWARD
},
579 { 0x0026, KEY_REWIND
},
580 { 0x081e, KEY_UNKNOWN
}, /* Time Shift */
581 { 0x000e, KEY_UNKNOWN
}, /* Snapshot */
582 { 0x082d, KEY_UNKNOWN
}, /* Mouse Cursor */
583 { 0x000f, KEY_UNKNOWN
}, /* Minimize/Maximize */
584 { 0x0814, KEY_UNKNOWN
}, /* Shuffle */
585 { 0x0025, KEY_POWER
},
588 static int cxusb_dee1601_demod_init(struct dvb_frontend
* fe
)
590 static u8 clock_config
[] = { CLOCK_CTL
, 0x38, 0x28 };
591 static u8 reset
[] = { RESET
, 0x80 };
592 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
593 static u8 agc_cfg
[] = { AGC_TARGET
, 0x28, 0x20 };
594 static u8 gpp_ctl_cfg
[] = { GPP_CTL
, 0x33 };
595 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x32 };
597 mt352_write(fe
, clock_config
, sizeof(clock_config
));
599 mt352_write(fe
, reset
, sizeof(reset
));
600 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
602 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
603 mt352_write(fe
, gpp_ctl_cfg
, sizeof(gpp_ctl_cfg
));
604 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
609 static int cxusb_mt352_demod_init(struct dvb_frontend
* fe
)
610 { /* used in both lgz201 and th7579 */
611 static u8 clock_config
[] = { CLOCK_CTL
, 0x38, 0x29 };
612 static u8 reset
[] = { RESET
, 0x80 };
613 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
614 static u8 agc_cfg
[] = { AGC_TARGET
, 0x24, 0x20 };
615 static u8 gpp_ctl_cfg
[] = { GPP_CTL
, 0x33 };
616 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x32 };
618 mt352_write(fe
, clock_config
, sizeof(clock_config
));
620 mt352_write(fe
, reset
, sizeof(reset
));
621 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
623 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
624 mt352_write(fe
, gpp_ctl_cfg
, sizeof(gpp_ctl_cfg
));
625 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
629 static struct cx22702_config cxusb_cx22702_config
= {
630 .demod_address
= 0x63,
631 .output_mode
= CX22702_PARALLEL_OUTPUT
,
634 static struct lgdt330x_config cxusb_lgdt3303_config
= {
635 .demod_address
= 0x0e,
636 .demod_chip
= LGDT3303
,
639 static struct lgdt330x_config cxusb_aver_lgdt3303_config
= {
640 .demod_address
= 0x0e,
641 .demod_chip
= LGDT3303
,
642 .clock_polarity_flip
= 2,
645 static struct mt352_config cxusb_dee1601_config
= {
646 .demod_address
= 0x0f,
647 .demod_init
= cxusb_dee1601_demod_init
,
650 static struct zl10353_config cxusb_zl10353_dee1601_config
= {
651 .demod_address
= 0x0f,
655 static struct mt352_config cxusb_mt352_config
= {
656 /* used in both lgz201 and th7579 */
657 .demod_address
= 0x0f,
658 .demod_init
= cxusb_mt352_demod_init
,
661 static struct zl10353_config cxusb_zl10353_xc3028_config
= {
662 .demod_address
= 0x0f,
668 static struct zl10353_config cxusb_zl10353_xc3028_config_no_i2c_gate
= {
669 .demod_address
= 0x0f,
673 .disable_i2c_gate_ctrl
= 1,
676 static struct mt352_config cxusb_mt352_xc3028_config
= {
677 .demod_address
= 0x0f,
680 .demod_init
= cxusb_mt352_demod_init
,
683 /* FIXME: needs tweaking */
684 static struct mxl5005s_config aver_a868r_tuner
= {
686 .if_freq
= 6000000UL,
687 .xtal_freq
= CRYSTAL_FREQ_16000000HZ
,
688 .agc_mode
= MXL_SINGLE_AGC
,
689 .tracking_filter
= MXL_TF_C
,
690 .rssi_enable
= MXL_RSSI_ENABLE
,
691 .cap_select
= MXL_CAP_SEL_ENABLE
,
692 .div_out
= MXL_DIV_OUT_4
,
693 .clock_out
= MXL_CLOCK_OUT_DISABLE
,
694 .output_load
= MXL5005S_IF_OUTPUT_LOAD_200_OHM
,
695 .top
= MXL5005S_TOP_25P2
,
696 .mod_mode
= MXL_DIGITAL_MODE
,
697 .if_mode
= MXL_ZERO_IF
,
698 .AgcMasterByte
= 0x00,
701 /* FIXME: needs tweaking */
702 static struct mxl5005s_config d680_dmb_tuner
= {
704 .if_freq
= 36125000UL,
705 .xtal_freq
= CRYSTAL_FREQ_16000000HZ
,
706 .agc_mode
= MXL_SINGLE_AGC
,
707 .tracking_filter
= MXL_TF_C
,
708 .rssi_enable
= MXL_RSSI_ENABLE
,
709 .cap_select
= MXL_CAP_SEL_ENABLE
,
710 .div_out
= MXL_DIV_OUT_4
,
711 .clock_out
= MXL_CLOCK_OUT_DISABLE
,
712 .output_load
= MXL5005S_IF_OUTPUT_LOAD_200_OHM
,
713 .top
= MXL5005S_TOP_25P2
,
714 .mod_mode
= MXL_DIGITAL_MODE
,
715 .if_mode
= MXL_ZERO_IF
,
716 .AgcMasterByte
= 0x00,
719 static struct max2165_config mygica_d689_max2165_cfg
= {
724 /* Callbacks for DVB USB */
725 static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter
*adap
)
727 dvb_attach(simple_tuner_attach
, adap
->fe
,
728 &adap
->dev
->i2c_adap
, 0x61,
729 TUNER_PHILIPS_FMD1216ME_MK3
);
733 static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter
*adap
)
735 dvb_attach(dvb_pll_attach
, adap
->fe
, 0x61,
736 NULL
, DVB_PLL_THOMSON_DTT7579
);
740 static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter
*adap
)
742 dvb_attach(dvb_pll_attach
, adap
->fe
, 0x61, NULL
, DVB_PLL_LG_Z201
);
746 static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter
*adap
)
748 dvb_attach(dvb_pll_attach
, adap
->fe
, 0x60,
749 NULL
, DVB_PLL_THOMSON_DTT7579
);
753 static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter
*adap
)
755 dvb_attach(simple_tuner_attach
, adap
->fe
,
756 &adap
->dev
->i2c_adap
, 0x61, TUNER_LG_TDVS_H06XF
);
760 static int dvico_bluebird_xc2028_callback(void *ptr
, int component
,
761 int command
, int arg
)
763 struct dvb_usb_adapter
*adap
= ptr
;
764 struct dvb_usb_device
*d
= adap
->dev
;
767 case XC2028_TUNER_RESET
:
768 deb_info("%s: XC2028_TUNER_RESET %d\n", __func__
, arg
);
769 cxusb_bluebird_gpio_pulse(d
, 0x01, 1);
771 case XC2028_RESET_CLK
:
772 deb_info("%s: XC2028_RESET_CLK %d\n", __func__
, arg
);
775 deb_info("%s: unknown command %d, arg %d\n", __func__
,
783 static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter
*adap
)
785 struct dvb_frontend
*fe
;
786 struct xc2028_config cfg
= {
787 .i2c_adap
= &adap
->dev
->i2c_adap
,
790 static struct xc2028_ctrl ctl
= {
791 .fname
= XC2028_DEFAULT_FIRMWARE
,
793 .demod
= XC3028_FE_ZARLINK456
,
796 /* FIXME: generalize & move to common area */
797 adap
->fe
->callback
= dvico_bluebird_xc2028_callback
;
799 fe
= dvb_attach(xc2028_attach
, adap
->fe
, &cfg
);
800 if (fe
== NULL
|| fe
->ops
.tuner_ops
.set_config
== NULL
)
803 fe
->ops
.tuner_ops
.set_config(fe
, &ctl
);
808 static int cxusb_mxl5003s_tuner_attach(struct dvb_usb_adapter
*adap
)
810 dvb_attach(mxl5005s_attach
, adap
->fe
,
811 &adap
->dev
->i2c_adap
, &aver_a868r_tuner
);
815 static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter
*adap
)
817 struct dvb_frontend
*fe
;
818 fe
= dvb_attach(mxl5005s_attach
, adap
->fe
,
819 &adap
->dev
->i2c_adap
, &d680_dmb_tuner
);
820 return (fe
== NULL
) ? -EIO
: 0;
823 static int cxusb_mygica_d689_tuner_attach(struct dvb_usb_adapter
*adap
)
825 struct dvb_frontend
*fe
;
826 fe
= dvb_attach(max2165_attach
, adap
->fe
,
827 &adap
->dev
->i2c_adap
, &mygica_d689_max2165_cfg
);
828 return (fe
== NULL
) ? -EIO
: 0;
831 static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter
*adap
)
834 if (usb_set_interface(adap
->dev
->udev
, 0, 6) < 0)
835 err("set interface failed");
837 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, &b
, 1);
839 if ((adap
->fe
= dvb_attach(cx22702_attach
, &cxusb_cx22702_config
,
840 &adap
->dev
->i2c_adap
)) != NULL
)
846 static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter
*adap
)
848 if (usb_set_interface(adap
->dev
->udev
, 0, 7) < 0)
849 err("set interface failed");
851 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
853 if ((adap
->fe
= dvb_attach(lgdt330x_attach
, &cxusb_lgdt3303_config
,
854 &adap
->dev
->i2c_adap
)) != NULL
)
860 static int cxusb_aver_lgdt3303_frontend_attach(struct dvb_usb_adapter
*adap
)
862 adap
->fe
= dvb_attach(lgdt330x_attach
, &cxusb_aver_lgdt3303_config
,
863 &adap
->dev
->i2c_adap
);
864 if (adap
->fe
!= NULL
)
870 static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter
*adap
)
872 /* used in both lgz201 and th7579 */
873 if (usb_set_interface(adap
->dev
->udev
, 0, 0) < 0)
874 err("set interface failed");
876 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
878 if ((adap
->fe
= dvb_attach(mt352_attach
, &cxusb_mt352_config
,
879 &adap
->dev
->i2c_adap
)) != NULL
)
885 static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter
*adap
)
887 if (usb_set_interface(adap
->dev
->udev
, 0, 0) < 0)
888 err("set interface failed");
890 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
892 if (((adap
->fe
= dvb_attach(mt352_attach
, &cxusb_dee1601_config
,
893 &adap
->dev
->i2c_adap
)) != NULL
) ||
894 ((adap
->fe
= dvb_attach(zl10353_attach
,
895 &cxusb_zl10353_dee1601_config
,
896 &adap
->dev
->i2c_adap
)) != NULL
))
902 static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter
*adap
)
906 struct i2c_msg msg
= { .addr
= 0x6b, .flags
= I2C_M_RD
,
907 .buf
= ircode
, .len
= 4 };
909 if (usb_set_interface(adap
->dev
->udev
, 0, 1) < 0)
910 err("set interface failed");
912 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
914 /* reset the tuner and demodulator */
915 cxusb_bluebird_gpio_rw(adap
->dev
, 0x04, 0);
916 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x01, 1);
917 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x02, 1);
919 if ((adap
->fe
= dvb_attach(zl10353_attach
,
920 &cxusb_zl10353_xc3028_config_no_i2c_gate
,
921 &adap
->dev
->i2c_adap
)) == NULL
)
924 /* try to determine if there is no IR decoder on the I2C bus */
925 for (i
= 0; adap
->dev
->props
.rc_key_map
!= NULL
&& i
< 5; i
++) {
927 if (cxusb_i2c_xfer(&adap
->dev
->i2c_adap
, &msg
, 1) != 1)
929 if (ircode
[0] == 0 && ircode
[1] == 0)
931 if (ircode
[2] + ircode
[3] != 0xff) {
933 adap
->dev
->props
.rc_key_map
= NULL
;
934 info("No IR receiver detected on this device.");
942 static struct dibx000_agc_config dib7070_agc_config
= {
943 .band_caps
= BAND_UHF
| BAND_VHF
| BAND_LBAND
| BAND_SBAND
,
946 * P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5,
947 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
948 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0
950 .setup
= (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) |
951 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
977 .perform_agc_softsplit
= 0,
980 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz
= {
993 /* refsel, sel, freq_15k */
994 .sad_cfg
= (3 << 14) | (1 << 12) | (524 << 0),
995 .ifreq
= (0 << 25) | 0,
1000 static struct dib7000p_config cxusb_dualdig4_rev2_config
= {
1001 .output_mode
= OUTMODE_MPEG2_PAR_GATED_CLK
,
1002 .output_mpeg2_in_188_bytes
= 1,
1004 .agc_config_count
= 1,
1005 .agc
= &dib7070_agc_config
,
1006 .bw
= &dib7070_bw_config_12_mhz
,
1007 .tuner_is_baseband
= 1,
1013 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
1015 .hostbus_diversity
= 1,
1018 static int cxusb_dualdig4_rev2_frontend_attach(struct dvb_usb_adapter
*adap
)
1020 if (usb_set_interface(adap
->dev
->udev
, 0, 1) < 0)
1021 err("set interface failed");
1023 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
1025 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x02, 1);
1027 dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
1028 &cxusb_dualdig4_rev2_config
);
1030 adap
->fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x80,
1031 &cxusb_dualdig4_rev2_config
);
1032 if (adap
->fe
== NULL
)
1038 static int dib7070_tuner_reset(struct dvb_frontend
*fe
, int onoff
)
1040 return dib7000p_set_gpio(fe
, 8, 0, !onoff
);
1043 static int dib7070_tuner_sleep(struct dvb_frontend
*fe
, int onoff
)
1048 static struct dib0070_config dib7070p_dib0070_config
= {
1049 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
1050 .reset
= dib7070_tuner_reset
,
1051 .sleep
= dib7070_tuner_sleep
,
1055 struct dib0700_adapter_state
{
1056 int (*set_param_save
) (struct dvb_frontend
*,
1057 struct dvb_frontend_parameters
*);
1060 static int dib7070_set_param_override(struct dvb_frontend
*fe
,
1061 struct dvb_frontend_parameters
*fep
)
1063 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
1064 struct dib0700_adapter_state
*state
= adap
->priv
;
1067 u8 band
= BAND_OF_FREQUENCY(fep
->frequency
/1000);
1069 case BAND_VHF
: offset
= 950; break;
1071 case BAND_UHF
: offset
= 550; break;
1074 dib7000p_set_wbd_ref(fe
, offset
+ dib0070_wbd_offset(fe
));
1076 return state
->set_param_save(fe
, fep
);
1079 static int cxusb_dualdig4_rev2_tuner_attach(struct dvb_usb_adapter
*adap
)
1081 struct dib0700_adapter_state
*st
= adap
->priv
;
1082 struct i2c_adapter
*tun_i2c
=
1083 dib7000p_get_i2c_master(adap
->fe
,
1084 DIBX000_I2C_INTERFACE_TUNER
, 1);
1086 if (dvb_attach(dib0070_attach
, adap
->fe
, tun_i2c
,
1087 &dib7070p_dib0070_config
) == NULL
)
1090 st
->set_param_save
= adap
->fe
->ops
.tuner_ops
.set_params
;
1091 adap
->fe
->ops
.tuner_ops
.set_params
= dib7070_set_param_override
;
1095 static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter
*adap
)
1097 if (usb_set_interface(adap
->dev
->udev
, 0, 1) < 0)
1098 err("set interface failed");
1100 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
1102 /* reset the tuner and demodulator */
1103 cxusb_bluebird_gpio_rw(adap
->dev
, 0x04, 0);
1104 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x01, 1);
1105 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x02, 1);
1107 if ((adap
->fe
= dvb_attach(zl10353_attach
,
1108 &cxusb_zl10353_xc3028_config
,
1109 &adap
->dev
->i2c_adap
)) != NULL
)
1112 if ((adap
->fe
= dvb_attach(mt352_attach
,
1113 &cxusb_mt352_xc3028_config
,
1114 &adap
->dev
->i2c_adap
)) != NULL
)
1120 static struct lgs8gxx_config d680_lgs8gl5_cfg
= {
1121 .prod
= LGS8GXX_PROD_LGS8GL5
,
1122 .demod_address
= 0x19,
1126 .if_clk_freq
= 30400, /* 30.4 MHz */
1127 .if_freq
= 5725, /* 5.725 MHz */
1134 static int cxusb_d680_dmb_frontend_attach(struct dvb_usb_adapter
*adap
)
1136 struct dvb_usb_device
*d
= adap
->dev
;
1139 /* Select required USB configuration */
1140 if (usb_set_interface(d
->udev
, 0, 0) < 0)
1141 err("set interface failed");
1143 /* Unblock all USB pipes */
1144 usb_clear_halt(d
->udev
,
1145 usb_sndbulkpipe(d
->udev
, d
->props
.generic_bulk_ctrl_endpoint
));
1146 usb_clear_halt(d
->udev
,
1147 usb_rcvbulkpipe(d
->udev
, d
->props
.generic_bulk_ctrl_endpoint
));
1148 usb_clear_halt(d
->udev
,
1149 usb_rcvbulkpipe(d
->udev
, d
->props
.adapter
[0].stream
.endpoint
));
1151 /* Drain USB pipes to avoid hang after reboot */
1152 for (n
= 0; n
< 5; n
++) {
1153 cxusb_d680_dmb_drain_message(d
);
1154 cxusb_d680_dmb_drain_video(d
);
1158 /* Reset the tuner */
1159 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 0) < 0) {
1160 err("clear tuner gpio failed");
1164 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 1) < 0) {
1165 err("set tuner gpio failed");
1170 /* Attach frontend */
1171 adap
->fe
= dvb_attach(lgs8gxx_attach
, &d680_lgs8gl5_cfg
, &d
->i2c_adap
);
1172 if (adap
->fe
== NULL
)
1178 static struct atbm8830_config mygica_d689_atbm8830_cfg
= {
1179 .prod
= ATBM8830_PROD_8830
,
1180 .demod_address
= 0x40,
1182 .ts_sampling_edge
= 1,
1184 .osc_clk_freq
= 30400, /* in kHz */
1185 .if_freq
= 0, /* zero IF */
1192 static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter
*adap
)
1194 struct dvb_usb_device
*d
= adap
->dev
;
1196 /* Select required USB configuration */
1197 if (usb_set_interface(d
->udev
, 0, 0) < 0)
1198 err("set interface failed");
1200 /* Unblock all USB pipes */
1201 usb_clear_halt(d
->udev
,
1202 usb_sndbulkpipe(d
->udev
, d
->props
.generic_bulk_ctrl_endpoint
));
1203 usb_clear_halt(d
->udev
,
1204 usb_rcvbulkpipe(d
->udev
, d
->props
.generic_bulk_ctrl_endpoint
));
1205 usb_clear_halt(d
->udev
,
1206 usb_rcvbulkpipe(d
->udev
, d
->props
.adapter
[0].stream
.endpoint
));
1209 /* Reset the tuner */
1210 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 0) < 0) {
1211 err("clear tuner gpio failed");
1215 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 1) < 0) {
1216 err("set tuner gpio failed");
1221 /* Attach frontend */
1222 adap
->fe
= dvb_attach(atbm8830_attach
, &mygica_d689_atbm8830_cfg
,
1224 if (adap
->fe
== NULL
)
1231 * DViCO has shipped two devices with the same USB ID, but only one of them
1232 * needs a firmware download. Check the device class details to see if they
1233 * have non-default values to decide whether the device is actually cold or
1234 * not, and forget a match if it turns out we selected the wrong device.
1236 static int bluebird_fx2_identify_state(struct usb_device
*udev
,
1237 struct dvb_usb_device_properties
*props
,
1238 struct dvb_usb_device_description
**desc
,
1241 int wascold
= *cold
;
1243 *cold
= udev
->descriptor
.bDeviceClass
== 0xff &&
1244 udev
->descriptor
.bDeviceSubClass
== 0xff &&
1245 udev
->descriptor
.bDeviceProtocol
== 0xff;
1247 if (*cold
&& !wascold
)
1254 * DViCO bluebird firmware needs the "warm" product ID to be patched into the
1255 * firmware file before download.
1258 static const int dvico_firmware_id_offsets
[] = { 6638, 3204 };
1259 static int bluebird_patch_dvico_firmware_download(struct usb_device
*udev
,
1260 const struct firmware
*fw
)
1264 for (pos
= 0; pos
< ARRAY_SIZE(dvico_firmware_id_offsets
); pos
++) {
1265 int idoff
= dvico_firmware_id_offsets
[pos
];
1267 if (fw
->size
< idoff
+ 4)
1270 if (fw
->data
[idoff
] == (USB_VID_DVICO
& 0xff) &&
1271 fw
->data
[idoff
+ 1] == USB_VID_DVICO
>> 8) {
1272 struct firmware new_fw
;
1273 u8
*new_fw_data
= vmalloc(fw
->size
);
1279 memcpy(new_fw_data
, fw
->data
, fw
->size
);
1280 new_fw
.size
= fw
->size
;
1281 new_fw
.data
= new_fw_data
;
1283 new_fw_data
[idoff
+ 2] =
1284 le16_to_cpu(udev
->descriptor
.idProduct
) + 1;
1285 new_fw_data
[idoff
+ 3] =
1286 le16_to_cpu(udev
->descriptor
.idProduct
) >> 8;
1288 ret
= usb_cypress_load_firmware(udev
, &new_fw
,
1298 /* DVB USB Driver stuff */
1299 static struct dvb_usb_device_properties cxusb_medion_properties
;
1300 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties
;
1301 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties
;
1302 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties
;
1303 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties
;
1304 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties
;
1305 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties
;
1306 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties
;
1307 static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties
;
1308 static struct dvb_usb_device_properties cxusb_aver_a868r_properties
;
1309 static struct dvb_usb_device_properties cxusb_d680_dmb_properties
;
1310 static struct dvb_usb_device_properties cxusb_mygica_d689_properties
;
1312 static int cxusb_probe(struct usb_interface
*intf
,
1313 const struct usb_device_id
*id
)
1315 if (0 == dvb_usb_device_init(intf
, &cxusb_medion_properties
,
1316 THIS_MODULE
, NULL
, adapter_nr
) ||
1317 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_lgh064f_properties
,
1318 THIS_MODULE
, NULL
, adapter_nr
) ||
1319 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_dee1601_properties
,
1320 THIS_MODULE
, NULL
, adapter_nr
) ||
1321 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_lgz201_properties
,
1322 THIS_MODULE
, NULL
, adapter_nr
) ||
1323 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_dtt7579_properties
,
1324 THIS_MODULE
, NULL
, adapter_nr
) ||
1325 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_dualdig4_properties
,
1326 THIS_MODULE
, NULL
, adapter_nr
) ||
1327 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_nano2_properties
,
1328 THIS_MODULE
, NULL
, adapter_nr
) ||
1329 0 == dvb_usb_device_init(intf
,
1330 &cxusb_bluebird_nano2_needsfirmware_properties
,
1331 THIS_MODULE
, NULL
, adapter_nr
) ||
1332 0 == dvb_usb_device_init(intf
, &cxusb_aver_a868r_properties
,
1333 THIS_MODULE
, NULL
, adapter_nr
) ||
1334 0 == dvb_usb_device_init(intf
,
1335 &cxusb_bluebird_dualdig4_rev2_properties
,
1336 THIS_MODULE
, NULL
, adapter_nr
) ||
1337 0 == dvb_usb_device_init(intf
, &cxusb_d680_dmb_properties
,
1338 THIS_MODULE
, NULL
, adapter_nr
) ||
1339 0 == dvb_usb_device_init(intf
, &cxusb_mygica_d689_properties
,
1340 THIS_MODULE
, NULL
, adapter_nr
) ||
1347 static struct usb_device_id cxusb_table
[] = {
1348 { USB_DEVICE(USB_VID_MEDION
, USB_PID_MEDION_MD95700
) },
1349 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LG064F_COLD
) },
1350 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LG064F_WARM
) },
1351 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD
) },
1352 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM
) },
1353 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD
) },
1354 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM
) },
1355 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_TH7579_COLD
) },
1356 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_TH7579_WARM
) },
1357 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD
) },
1358 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM
) },
1359 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD
) },
1360 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM
) },
1361 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_4
) },
1362 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2
) },
1363 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM
) },
1364 { USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_VOLAR_A868R
) },
1365 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2
) },
1366 { USB_DEVICE(USB_VID_CONEXANT
, USB_PID_CONEXANT_D680_DMB
) },
1367 { USB_DEVICE(USB_VID_CONEXANT
, USB_PID_MYGICA_D689
) },
1368 {} /* Terminating entry */
1370 MODULE_DEVICE_TABLE (usb
, cxusb_table
);
1372 static struct dvb_usb_device_properties cxusb_medion_properties
= {
1373 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1375 .usb_ctrl
= CYPRESS_FX2
,
1377 .size_of_priv
= sizeof(struct cxusb_state
),
1382 .streaming_ctrl
= cxusb_streaming_ctrl
,
1383 .frontend_attach
= cxusb_cx22702_frontend_attach
,
1384 .tuner_attach
= cxusb_fmd1216me_tuner_attach
,
1385 /* parameter for the MPEG2-data transfer */
1399 .power_ctrl
= cxusb_power_ctrl
,
1401 .i2c_algo
= &cxusb_i2c_algo
,
1403 .generic_bulk_ctrl_endpoint
= 0x01,
1405 .num_device_descs
= 1,
1407 { "Medion MD95700 (MDUSBTV-HYBRID)",
1409 { &cxusb_table
[0], NULL
},
1414 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties
= {
1415 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1417 .usb_ctrl
= DEVICE_SPECIFIC
,
1418 .firmware
= "dvb-usb-bluebird-01.fw",
1419 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1420 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1421 use usb alt setting 7 for EP2 transfer (atsc) */
1423 .size_of_priv
= sizeof(struct cxusb_state
),
1428 .streaming_ctrl
= cxusb_streaming_ctrl
,
1429 .frontend_attach
= cxusb_lgdt3303_frontend_attach
,
1430 .tuner_attach
= cxusb_lgh064f_tuner_attach
,
1432 /* parameter for the MPEG2-data transfer */
1446 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1448 .i2c_algo
= &cxusb_i2c_algo
,
1451 .rc_key_map
= dvico_portable_rc_keys
,
1452 .rc_key_map_size
= ARRAY_SIZE(dvico_portable_rc_keys
),
1453 .rc_query
= cxusb_rc_query
,
1455 .generic_bulk_ctrl_endpoint
= 0x01,
1457 .num_device_descs
= 1,
1459 { "DViCO FusionHDTV5 USB Gold",
1460 { &cxusb_table
[1], NULL
},
1461 { &cxusb_table
[2], NULL
},
1466 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties
= {
1467 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1469 .usb_ctrl
= DEVICE_SPECIFIC
,
1470 .firmware
= "dvb-usb-bluebird-01.fw",
1471 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1472 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1473 use usb alt setting 7 for EP2 transfer (atsc) */
1475 .size_of_priv
= sizeof(struct cxusb_state
),
1480 .streaming_ctrl
= cxusb_streaming_ctrl
,
1481 .frontend_attach
= cxusb_dee1601_frontend_attach
,
1482 .tuner_attach
= cxusb_dee1601_tuner_attach
,
1483 /* parameter for the MPEG2-data transfer */
1497 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1499 .i2c_algo
= &cxusb_i2c_algo
,
1502 .rc_key_map
= dvico_mce_rc_keys
,
1503 .rc_key_map_size
= ARRAY_SIZE(dvico_mce_rc_keys
),
1504 .rc_query
= cxusb_rc_query
,
1506 .generic_bulk_ctrl_endpoint
= 0x01,
1508 .num_device_descs
= 3,
1510 { "DViCO FusionHDTV DVB-T Dual USB",
1511 { &cxusb_table
[3], NULL
},
1512 { &cxusb_table
[4], NULL
},
1514 { "DigitalNow DVB-T Dual USB",
1515 { &cxusb_table
[9], NULL
},
1516 { &cxusb_table
[10], NULL
},
1518 { "DViCO FusionHDTV DVB-T Dual Digital 2",
1519 { &cxusb_table
[11], NULL
},
1520 { &cxusb_table
[12], NULL
},
1525 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties
= {
1526 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1528 .usb_ctrl
= DEVICE_SPECIFIC
,
1529 .firmware
= "dvb-usb-bluebird-01.fw",
1530 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1531 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1532 use usb alt setting 7 for EP2 transfer (atsc) */
1534 .size_of_priv
= sizeof(struct cxusb_state
),
1539 .streaming_ctrl
= cxusb_streaming_ctrl
,
1540 .frontend_attach
= cxusb_mt352_frontend_attach
,
1541 .tuner_attach
= cxusb_lgz201_tuner_attach
,
1543 /* parameter for the MPEG2-data transfer */
1556 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1558 .i2c_algo
= &cxusb_i2c_algo
,
1561 .rc_key_map
= dvico_portable_rc_keys
,
1562 .rc_key_map_size
= ARRAY_SIZE(dvico_portable_rc_keys
),
1563 .rc_query
= cxusb_rc_query
,
1565 .generic_bulk_ctrl_endpoint
= 0x01,
1566 .num_device_descs
= 1,
1568 { "DViCO FusionHDTV DVB-T USB (LGZ201)",
1569 { &cxusb_table
[5], NULL
},
1570 { &cxusb_table
[6], NULL
},
1575 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties
= {
1576 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1578 .usb_ctrl
= DEVICE_SPECIFIC
,
1579 .firmware
= "dvb-usb-bluebird-01.fw",
1580 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1581 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1582 use usb alt setting 7 for EP2 transfer (atsc) */
1584 .size_of_priv
= sizeof(struct cxusb_state
),
1589 .streaming_ctrl
= cxusb_streaming_ctrl
,
1590 .frontend_attach
= cxusb_mt352_frontend_attach
,
1591 .tuner_attach
= cxusb_dtt7579_tuner_attach
,
1593 /* parameter for the MPEG2-data transfer */
1606 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1608 .i2c_algo
= &cxusb_i2c_algo
,
1611 .rc_key_map
= dvico_portable_rc_keys
,
1612 .rc_key_map_size
= ARRAY_SIZE(dvico_portable_rc_keys
),
1613 .rc_query
= cxusb_rc_query
,
1615 .generic_bulk_ctrl_endpoint
= 0x01,
1617 .num_device_descs
= 1,
1619 { "DViCO FusionHDTV DVB-T USB (TH7579)",
1620 { &cxusb_table
[7], NULL
},
1621 { &cxusb_table
[8], NULL
},
1626 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties
= {
1627 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1629 .usb_ctrl
= CYPRESS_FX2
,
1631 .size_of_priv
= sizeof(struct cxusb_state
),
1636 .streaming_ctrl
= cxusb_streaming_ctrl
,
1637 .frontend_attach
= cxusb_dualdig4_frontend_attach
,
1638 .tuner_attach
= cxusb_dvico_xc3028_tuner_attach
,
1639 /* parameter for the MPEG2-data transfer */
1653 .power_ctrl
= cxusb_power_ctrl
,
1655 .i2c_algo
= &cxusb_i2c_algo
,
1657 .generic_bulk_ctrl_endpoint
= 0x01,
1660 .rc_key_map
= dvico_mce_rc_keys
,
1661 .rc_key_map_size
= ARRAY_SIZE(dvico_mce_rc_keys
),
1662 .rc_query
= cxusb_bluebird2_rc_query
,
1664 .num_device_descs
= 1,
1666 { "DViCO FusionHDTV DVB-T Dual Digital 4",
1668 { &cxusb_table
[13], NULL
},
1673 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties
= {
1674 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1676 .usb_ctrl
= CYPRESS_FX2
,
1677 .identify_state
= bluebird_fx2_identify_state
,
1679 .size_of_priv
= sizeof(struct cxusb_state
),
1684 .streaming_ctrl
= cxusb_streaming_ctrl
,
1685 .frontend_attach
= cxusb_nano2_frontend_attach
,
1686 .tuner_attach
= cxusb_dvico_xc3028_tuner_attach
,
1687 /* parameter for the MPEG2-data transfer */
1701 .power_ctrl
= cxusb_nano2_power_ctrl
,
1703 .i2c_algo
= &cxusb_i2c_algo
,
1705 .generic_bulk_ctrl_endpoint
= 0x01,
1708 .rc_key_map
= dvico_portable_rc_keys
,
1709 .rc_key_map_size
= ARRAY_SIZE(dvico_portable_rc_keys
),
1710 .rc_query
= cxusb_bluebird2_rc_query
,
1712 .num_device_descs
= 1,
1714 { "DViCO FusionHDTV DVB-T NANO2",
1716 { &cxusb_table
[14], NULL
},
1721 static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties
= {
1722 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1724 .usb_ctrl
= DEVICE_SPECIFIC
,
1725 .firmware
= "dvb-usb-bluebird-02.fw",
1726 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1727 .identify_state
= bluebird_fx2_identify_state
,
1729 .size_of_priv
= sizeof(struct cxusb_state
),
1734 .streaming_ctrl
= cxusb_streaming_ctrl
,
1735 .frontend_attach
= cxusb_nano2_frontend_attach
,
1736 .tuner_attach
= cxusb_dvico_xc3028_tuner_attach
,
1737 /* parameter for the MPEG2-data transfer */
1751 .power_ctrl
= cxusb_nano2_power_ctrl
,
1753 .i2c_algo
= &cxusb_i2c_algo
,
1755 .generic_bulk_ctrl_endpoint
= 0x01,
1758 .rc_key_map
= dvico_portable_rc_keys
,
1759 .rc_key_map_size
= ARRAY_SIZE(dvico_portable_rc_keys
),
1760 .rc_query
= cxusb_rc_query
,
1762 .num_device_descs
= 1,
1764 { "DViCO FusionHDTV DVB-T NANO2 w/o firmware",
1765 { &cxusb_table
[14], NULL
},
1766 { &cxusb_table
[15], NULL
},
1771 static struct dvb_usb_device_properties cxusb_aver_a868r_properties
= {
1772 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1774 .usb_ctrl
= CYPRESS_FX2
,
1776 .size_of_priv
= sizeof(struct cxusb_state
),
1781 .streaming_ctrl
= cxusb_aver_streaming_ctrl
,
1782 .frontend_attach
= cxusb_aver_lgdt3303_frontend_attach
,
1783 .tuner_attach
= cxusb_mxl5003s_tuner_attach
,
1784 /* parameter for the MPEG2-data transfer */
1798 .power_ctrl
= cxusb_aver_power_ctrl
,
1800 .i2c_algo
= &cxusb_i2c_algo
,
1802 .generic_bulk_ctrl_endpoint
= 0x01,
1804 .num_device_descs
= 1,
1806 { "AVerMedia AVerTVHD Volar (A868R)",
1808 { &cxusb_table
[16], NULL
},
1814 struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties
= {
1815 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1817 .usb_ctrl
= CYPRESS_FX2
,
1819 .size_of_priv
= sizeof(struct cxusb_state
),
1824 .streaming_ctrl
= cxusb_streaming_ctrl
,
1825 .frontend_attach
= cxusb_dualdig4_rev2_frontend_attach
,
1826 .tuner_attach
= cxusb_dualdig4_rev2_tuner_attach
,
1827 .size_of_priv
= sizeof(struct dib0700_adapter_state
),
1828 /* parameter for the MPEG2-data transfer */
1842 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1844 .i2c_algo
= &cxusb_i2c_algo
,
1846 .generic_bulk_ctrl_endpoint
= 0x01,
1849 .rc_key_map
= dvico_mce_rc_keys
,
1850 .rc_key_map_size
= ARRAY_SIZE(dvico_mce_rc_keys
),
1851 .rc_query
= cxusb_rc_query
,
1853 .num_device_descs
= 1,
1855 { "DViCO FusionHDTV DVB-T Dual Digital 4 (rev 2)",
1857 { &cxusb_table
[17], NULL
},
1862 static struct dvb_usb_device_properties cxusb_d680_dmb_properties
= {
1863 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1865 .usb_ctrl
= CYPRESS_FX2
,
1867 .size_of_priv
= sizeof(struct cxusb_state
),
1872 .streaming_ctrl
= cxusb_d680_dmb_streaming_ctrl
,
1873 .frontend_attach
= cxusb_d680_dmb_frontend_attach
,
1874 .tuner_attach
= cxusb_d680_dmb_tuner_attach
,
1876 /* parameter for the MPEG2-data transfer */
1890 .power_ctrl
= cxusb_d680_dmb_power_ctrl
,
1892 .i2c_algo
= &cxusb_i2c_algo
,
1894 .generic_bulk_ctrl_endpoint
= 0x01,
1897 .rc_key_map
= d680_dmb_rc_keys
,
1898 .rc_key_map_size
= ARRAY_SIZE(d680_dmb_rc_keys
),
1899 .rc_query
= cxusb_d680_dmb_rc_query
,
1901 .num_device_descs
= 1,
1904 "Conexant DMB-TH Stick",
1906 { &cxusb_table
[18], NULL
},
1911 static struct dvb_usb_device_properties cxusb_mygica_d689_properties
= {
1912 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1914 .usb_ctrl
= CYPRESS_FX2
,
1916 .size_of_priv
= sizeof(struct cxusb_state
),
1921 .streaming_ctrl
= cxusb_d680_dmb_streaming_ctrl
,
1922 .frontend_attach
= cxusb_mygica_d689_frontend_attach
,
1923 .tuner_attach
= cxusb_mygica_d689_tuner_attach
,
1925 /* parameter for the MPEG2-data transfer */
1939 .power_ctrl
= cxusb_d680_dmb_power_ctrl
,
1941 .i2c_algo
= &cxusb_i2c_algo
,
1943 .generic_bulk_ctrl_endpoint
= 0x01,
1946 .rc_key_map
= d680_dmb_rc_keys
,
1947 .rc_key_map_size
= ARRAY_SIZE(d680_dmb_rc_keys
),
1948 .rc_query
= cxusb_d680_dmb_rc_query
,
1950 .num_device_descs
= 1,
1953 "Mygica D689 DMB-TH",
1955 { &cxusb_table
[19], NULL
},
1960 static struct usb_driver cxusb_driver
= {
1961 .name
= "dvb_usb_cxusb",
1962 .probe
= cxusb_probe
,
1963 .disconnect
= dvb_usb_device_exit
,
1964 .id_table
= cxusb_table
,
1968 static int __init
cxusb_module_init(void)
1971 if ((result
= usb_register(&cxusb_driver
))) {
1972 err("usb_register failed. Error number %d",result
);
1979 static void __exit
cxusb_module_exit(void)
1981 /* deregister this driver from the USB subsystem */
1982 usb_deregister(&cxusb_driver
);
1985 module_init (cxusb_module_init
);
1986 module_exit (cxusb_module_exit
);
1988 MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
1989 MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
1990 MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
1991 MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
1992 MODULE_VERSION("1.0-alpha");
1993 MODULE_LICENSE("GPL");