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"
44 static int dvb_usb_cxusb_debug
;
45 module_param_named(debug
, dvb_usb_cxusb_debug
, int, 0644);
46 MODULE_PARM_DESC(debug
, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS
);
48 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr
);
50 #define deb_info(args...) dprintk(dvb_usb_cxusb_debug, 0x03, args)
51 #define deb_i2c(args...) dprintk(dvb_usb_cxusb_debug, 0x02, args)
53 static int cxusb_ctrl_msg(struct dvb_usb_device
*d
,
54 u8 cmd
, u8
*wbuf
, int wlen
, u8
*rbuf
, int rlen
)
56 int wo
= (rbuf
== NULL
|| rlen
== 0); /* write-only */
58 memset(sndbuf
, 0, 1+wlen
);
61 memcpy(&sndbuf
[1], wbuf
, wlen
);
63 return dvb_usb_generic_write(d
, sndbuf
, 1+wlen
);
65 return dvb_usb_generic_rw(d
, sndbuf
, 1+wlen
, rbuf
, rlen
, 0);
69 static void cxusb_gpio_tuner(struct dvb_usb_device
*d
, int onoff
)
71 struct cxusb_state
*st
= d
->priv
;
74 if (st
->gpio_write_state
[GPIO_TUNER
] == onoff
)
79 cxusb_ctrl_msg(d
, CMD_GPIO_WRITE
, o
, 2, &i
, 1);
82 deb_info("gpio_write failed.\n");
84 st
->gpio_write_state
[GPIO_TUNER
] = onoff
;
87 static int cxusb_bluebird_gpio_rw(struct dvb_usb_device
*d
, u8 changemask
,
93 o
[0] = 0xff & ~changemask
; /* mask of bits to keep */
94 o
[1] = newval
& changemask
; /* new values for bits */
96 rc
= cxusb_ctrl_msg(d
, CMD_BLUEBIRD_GPIO_RW
, o
, 2, &gpio_state
, 1);
97 if (rc
< 0 || (gpio_state
& changemask
) != (newval
& changemask
))
98 deb_info("bluebird_gpio_write failed.\n");
100 return rc
< 0 ? rc
: gpio_state
;
103 static void cxusb_bluebird_gpio_pulse(struct dvb_usb_device
*d
, u8 pin
, int low
)
105 cxusb_bluebird_gpio_rw(d
, pin
, low
? 0 : pin
);
107 cxusb_bluebird_gpio_rw(d
, pin
, low
? pin
: 0);
110 static void cxusb_nano2_led(struct dvb_usb_device
*d
, int onoff
)
112 cxusb_bluebird_gpio_rw(d
, 0x40, onoff
? 0 : 0x40);
115 static int cxusb_d680_dmb_gpio_tuner(struct dvb_usb_device
*d
,
118 u8 o
[2] = {addr
, onoff
};
122 rc
= cxusb_ctrl_msg(d
, CMD_GPIO_WRITE
, o
, 2, &i
, 1);
129 deb_info("gpio_write failed.\n");
135 static int cxusb_i2c_xfer(struct i2c_adapter
*adap
, struct i2c_msg msg
[],
138 struct dvb_usb_device
*d
= i2c_get_adapdata(adap
);
141 if (mutex_lock_interruptible(&d
->i2c_mutex
) < 0)
144 for (i
= 0; i
< num
; i
++) {
146 if (d
->udev
->descriptor
.idVendor
== USB_VID_MEDION
)
147 switch (msg
[i
].addr
) {
149 cxusb_gpio_tuner(d
, 0);
152 cxusb_gpio_tuner(d
, 1);
156 if (msg
[i
].flags
& I2C_M_RD
) {
158 u8 obuf
[3], ibuf
[1+msg
[i
].len
];
160 obuf
[1] = msg
[i
].len
;
161 obuf
[2] = msg
[i
].addr
;
162 if (cxusb_ctrl_msg(d
, CMD_I2C_READ
,
164 ibuf
, 1+msg
[i
].len
) < 0) {
165 warn("i2c read failed");
168 memcpy(msg
[i
].buf
, &ibuf
[1], msg
[i
].len
);
169 } else if (i
+1 < num
&& (msg
[i
+1].flags
& I2C_M_RD
) &&
170 msg
[i
].addr
== msg
[i
+1].addr
) {
171 /* write to then read from same address */
172 u8 obuf
[3+msg
[i
].len
], ibuf
[1+msg
[i
+1].len
];
173 obuf
[0] = msg
[i
].len
;
174 obuf
[1] = msg
[i
+1].len
;
175 obuf
[2] = msg
[i
].addr
;
176 memcpy(&obuf
[3], msg
[i
].buf
, msg
[i
].len
);
178 if (cxusb_ctrl_msg(d
, CMD_I2C_READ
,
180 ibuf
, 1+msg
[i
+1].len
) < 0)
184 deb_i2c("i2c read may have failed\n");
186 memcpy(msg
[i
+1].buf
, &ibuf
[1], msg
[i
+1].len
);
191 u8 obuf
[2+msg
[i
].len
], ibuf
;
192 obuf
[0] = msg
[i
].addr
;
193 obuf
[1] = msg
[i
].len
;
194 memcpy(&obuf
[2], msg
[i
].buf
, msg
[i
].len
);
196 if (cxusb_ctrl_msg(d
, CMD_I2C_WRITE
, obuf
,
197 2+msg
[i
].len
, &ibuf
,1) < 0)
200 deb_i2c("i2c write may have failed\n");
204 mutex_unlock(&d
->i2c_mutex
);
205 return i
== num
? num
: -EREMOTEIO
;
208 static u32
cxusb_i2c_func(struct i2c_adapter
*adapter
)
213 static struct i2c_algorithm cxusb_i2c_algo
= {
214 .master_xfer
= cxusb_i2c_xfer
,
215 .functionality
= cxusb_i2c_func
,
218 static int cxusb_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
222 return cxusb_ctrl_msg(d
, CMD_POWER_ON
, &b
, 1, NULL
, 0);
224 return cxusb_ctrl_msg(d
, CMD_POWER_OFF
, &b
, 1, NULL
, 0);
227 static int cxusb_aver_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
231 return cxusb_ctrl_msg(d
, CMD_POWER_OFF
, NULL
, 0, NULL
, 0);
232 if (d
->state
== DVB_USB_STATE_INIT
&&
233 usb_set_interface(d
->udev
, 0, 0) < 0)
234 err("set interface failed");
235 do {} while (!(ret
= cxusb_ctrl_msg(d
, CMD_POWER_ON
, NULL
, 0, NULL
, 0)) &&
236 !(ret
= cxusb_ctrl_msg(d
, 0x15, NULL
, 0, NULL
, 0)) &&
237 !(ret
= cxusb_ctrl_msg(d
, 0x17, NULL
, 0, NULL
, 0)) && 0);
239 /* FIXME: We don't know why, but we need to configure the
240 * lgdt3303 with the register settings below on resume */
243 0x0e, 0x2, 0x00, 0x7f,
244 0x0e, 0x2, 0x02, 0xfe,
245 0x0e, 0x2, 0x02, 0x01,
246 0x0e, 0x2, 0x00, 0x03,
247 0x0e, 0x2, 0x0d, 0x40,
248 0x0e, 0x2, 0x0e, 0x87,
249 0x0e, 0x2, 0x0f, 0x8e,
250 0x0e, 0x2, 0x10, 0x01,
251 0x0e, 0x2, 0x14, 0xd7,
252 0x0e, 0x2, 0x47, 0x88,
255 for (i
= 0; i
< sizeof(bufs
)/sizeof(u8
); i
+= 4/sizeof(u8
)) {
256 ret
= cxusb_ctrl_msg(d
, CMD_I2C_WRITE
,
267 static int cxusb_bluebird_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
271 return cxusb_ctrl_msg(d
, CMD_POWER_ON
, &b
, 1, NULL
, 0);
276 static int cxusb_nano2_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
280 rc
= cxusb_power_ctrl(d
, onoff
);
282 cxusb_nano2_led(d
, 0);
287 static int cxusb_d680_dmb_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
291 ret
= cxusb_power_ctrl(d
, onoff
);
296 cxusb_ctrl_msg(d
, CMD_DIGITAL
, NULL
, 0, &b
, 1);
301 static int cxusb_streaming_ctrl(struct dvb_usb_adapter
*adap
, int onoff
)
303 u8 buf
[2] = { 0x03, 0x00 };
305 cxusb_ctrl_msg(adap
->dev
, CMD_STREAMING_ON
, buf
, 2, NULL
, 0);
307 cxusb_ctrl_msg(adap
->dev
, CMD_STREAMING_OFF
, NULL
, 0, NULL
, 0);
312 static int cxusb_aver_streaming_ctrl(struct dvb_usb_adapter
*adap
, int onoff
)
315 cxusb_ctrl_msg(adap
->dev
, CMD_AVER_STREAM_ON
, NULL
, 0, NULL
, 0);
317 cxusb_ctrl_msg(adap
->dev
, CMD_AVER_STREAM_OFF
,
322 static void cxusb_d680_dmb_drain_message(struct dvb_usb_device
*d
)
324 int ep
= d
->props
.generic_bulk_ctrl_endpoint
;
325 const int timeout
= 100;
326 const int junk_len
= 32;
330 /* Discard remaining data in video pipe */
331 junk
= kmalloc(junk_len
, GFP_KERNEL
);
335 if (usb_bulk_msg(d
->udev
,
336 usb_rcvbulkpipe(d
->udev
, ep
),
337 junk
, junk_len
, &rd_count
, timeout
) < 0)
345 static void cxusb_d680_dmb_drain_video(struct dvb_usb_device
*d
)
347 struct usb_data_stream_properties
*p
= &d
->props
.adapter
[0].stream
;
348 const int timeout
= 100;
349 const int junk_len
= p
->u
.bulk
.buffersize
;
353 /* Discard remaining data in video pipe */
354 junk
= kmalloc(junk_len
, GFP_KERNEL
);
358 if (usb_bulk_msg(d
->udev
,
359 usb_rcvbulkpipe(d
->udev
, p
->endpoint
),
360 junk
, junk_len
, &rd_count
, timeout
) < 0)
368 static int cxusb_d680_dmb_streaming_ctrl(
369 struct dvb_usb_adapter
*adap
, int onoff
)
372 u8 buf
[2] = { 0x03, 0x00 };
373 cxusb_d680_dmb_drain_video(adap
->dev
);
374 return cxusb_ctrl_msg(adap
->dev
, CMD_STREAMING_ON
,
375 buf
, sizeof(buf
), NULL
, 0);
377 int ret
= cxusb_ctrl_msg(adap
->dev
,
378 CMD_STREAMING_OFF
, NULL
, 0, NULL
, 0);
383 static int cxusb_rc_query(struct dvb_usb_device
*d
, u32
*event
, int *state
)
385 struct dvb_usb_rc_key
*keymap
= d
->props
.rc_key_map
;
389 cxusb_ctrl_msg(d
, CMD_GET_IR_CODE
, NULL
, 0, ircode
, 4);
392 *state
= REMOTE_NO_KEY_PRESSED
;
394 for (i
= 0; i
< d
->props
.rc_key_map_size
; i
++) {
395 if (rc5_custom(&keymap
[i
]) == ircode
[2] &&
396 rc5_data(&keymap
[i
]) == ircode
[3]) {
397 *event
= keymap
[i
].event
;
398 *state
= REMOTE_KEY_PRESSED
;
407 static int cxusb_bluebird2_rc_query(struct dvb_usb_device
*d
, u32
*event
,
410 struct dvb_usb_rc_key
*keymap
= d
->props
.rc_key_map
;
413 struct i2c_msg msg
= { .addr
= 0x6b, .flags
= I2C_M_RD
,
414 .buf
= ircode
, .len
= 4 };
417 *state
= REMOTE_NO_KEY_PRESSED
;
419 if (cxusb_i2c_xfer(&d
->i2c_adap
, &msg
, 1) != 1)
422 for (i
= 0; i
< d
->props
.rc_key_map_size
; i
++) {
423 if (rc5_custom(&keymap
[i
]) == ircode
[1] &&
424 rc5_data(&keymap
[i
]) == ircode
[2]) {
425 *event
= keymap
[i
].event
;
426 *state
= REMOTE_KEY_PRESSED
;
435 static int cxusb_d680_dmb_rc_query(struct dvb_usb_device
*d
, u32
*event
,
438 struct dvb_usb_rc_key
*keymap
= d
->props
.rc_key_map
;
443 *state
= REMOTE_NO_KEY_PRESSED
;
445 if (cxusb_ctrl_msg(d
, 0x10, NULL
, 0, ircode
, 2) < 0)
448 for (i
= 0; i
< d
->props
.rc_key_map_size
; i
++) {
449 if (rc5_custom(&keymap
[i
]) == ircode
[0] &&
450 rc5_data(&keymap
[i
]) == ircode
[1]) {
451 *event
= keymap
[i
].event
;
452 *state
= REMOTE_KEY_PRESSED
;
461 static struct dvb_usb_rc_key dvico_mce_rc_keys
[] = {
465 { 0xfe1e, KEY_FAVORITES
},
466 { 0xfe16, KEY_SETUP
},
467 { 0xfe46, KEY_POWER2
},
469 { 0xfe49, KEY_BACK
},
470 { 0xfe4d, KEY_MENU
},
472 { 0xfe5b, KEY_LEFT
},
473 { 0xfe5f, KEY_RIGHT
},
474 { 0xfe53, KEY_DOWN
},
476 { 0xfe59, KEY_INFO
},
478 { 0xfe0f, KEY_PREVIOUSSONG
},/* Replay */
479 { 0xfe12, KEY_NEXTSONG
}, /* Skip */
480 { 0xfe42, KEY_ENTER
}, /* Windows/Start */
481 { 0xfe15, KEY_VOLUMEUP
},
482 { 0xfe05, KEY_VOLUMEDOWN
},
483 { 0xfe11, KEY_CHANNELUP
},
484 { 0xfe09, KEY_CHANNELDOWN
},
485 { 0xfe52, KEY_CAMERA
},
486 { 0xfe5a, KEY_TUNER
}, /* Live */
487 { 0xfe19, KEY_OPEN
},
497 { 0xfe13, KEY_ANGLE
}, /* Aspect */
499 { 0xfe1f, KEY_ZOOM
},
500 { 0xfe43, KEY_REWIND
},
501 { 0xfe47, KEY_PLAYPAUSE
},
502 { 0xfe4f, KEY_FASTFORWARD
},
503 { 0xfe57, KEY_MUTE
},
504 { 0xfe0d, KEY_STOP
},
505 { 0xfe01, KEY_RECORD
},
506 { 0xfe4e, KEY_POWER
},
509 static struct dvb_usb_rc_key dvico_portable_rc_keys
[] = {
510 { 0xfc02, KEY_SETUP
}, /* Profile */
511 { 0xfc43, KEY_POWER2
},
513 { 0xfc5a, KEY_BACK
},
514 { 0xfc05, KEY_MENU
},
515 { 0xfc47, KEY_INFO
},
517 { 0xfc42, KEY_PREVIOUSSONG
},/* Replay */
518 { 0xfc49, KEY_VOLUMEUP
},
519 { 0xfc09, KEY_VOLUMEDOWN
},
520 { 0xfc54, KEY_CHANNELUP
},
521 { 0xfc0b, KEY_CHANNELDOWN
},
522 { 0xfc16, KEY_CAMERA
},
523 { 0xfc40, KEY_TUNER
}, /* ATV/DTV */
524 { 0xfc45, KEY_OPEN
},
534 { 0xfc44, KEY_ANGLE
}, /* Aspect */
536 { 0xfc07, KEY_ZOOM
},
537 { 0xfc0a, KEY_REWIND
},
538 { 0xfc08, KEY_PLAYPAUSE
},
539 { 0xfc4b, KEY_FASTFORWARD
},
540 { 0xfc5b, KEY_MUTE
},
541 { 0xfc04, KEY_STOP
},
542 { 0xfc56, KEY_RECORD
},
543 { 0xfc57, KEY_POWER
},
544 { 0xfc41, KEY_UNKNOWN
}, /* INPUT */
545 { 0xfc00, KEY_UNKNOWN
}, /* HD */
548 static struct dvb_usb_rc_key d680_dmb_rc_keys
[] = {
549 { 0x0038, KEY_UNKNOWN
}, /* TV/AV */
550 { 0x080c, KEY_ZOOM
},
561 { 0x000a, KEY_MUTE
},
562 { 0x0829, KEY_BACK
},
563 { 0x0012, KEY_CHANNELUP
},
564 { 0x0813, KEY_CHANNELDOWN
},
565 { 0x002b, KEY_VOLUMEUP
},
566 { 0x082c, KEY_VOLUMEDOWN
},
568 { 0x0821, KEY_DOWN
},
569 { 0x0011, KEY_LEFT
},
570 { 0x0810, KEY_RIGHT
},
572 { 0x081f, KEY_RECORD
},
573 { 0x0017, KEY_PLAYPAUSE
},
574 { 0x0816, KEY_PLAYPAUSE
},
575 { 0x000b, KEY_STOP
},
576 { 0x0827, KEY_FASTFORWARD
},
577 { 0x0026, KEY_REWIND
},
578 { 0x081e, KEY_UNKNOWN
}, /* Time Shift */
579 { 0x000e, KEY_UNKNOWN
}, /* Snapshot */
580 { 0x082d, KEY_UNKNOWN
}, /* Mouse Cursor */
581 { 0x000f, KEY_UNKNOWN
}, /* Minimize/Maximize */
582 { 0x0814, KEY_UNKNOWN
}, /* Shuffle */
583 { 0x0025, KEY_POWER
},
586 static int cxusb_dee1601_demod_init(struct dvb_frontend
* fe
)
588 static u8 clock_config
[] = { CLOCK_CTL
, 0x38, 0x28 };
589 static u8 reset
[] = { RESET
, 0x80 };
590 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
591 static u8 agc_cfg
[] = { AGC_TARGET
, 0x28, 0x20 };
592 static u8 gpp_ctl_cfg
[] = { GPP_CTL
, 0x33 };
593 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x32 };
595 mt352_write(fe
, clock_config
, sizeof(clock_config
));
597 mt352_write(fe
, reset
, sizeof(reset
));
598 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
600 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
601 mt352_write(fe
, gpp_ctl_cfg
, sizeof(gpp_ctl_cfg
));
602 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
607 static int cxusb_mt352_demod_init(struct dvb_frontend
* fe
)
608 { /* used in both lgz201 and th7579 */
609 static u8 clock_config
[] = { CLOCK_CTL
, 0x38, 0x29 };
610 static u8 reset
[] = { RESET
, 0x80 };
611 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
612 static u8 agc_cfg
[] = { AGC_TARGET
, 0x24, 0x20 };
613 static u8 gpp_ctl_cfg
[] = { GPP_CTL
, 0x33 };
614 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x32 };
616 mt352_write(fe
, clock_config
, sizeof(clock_config
));
618 mt352_write(fe
, reset
, sizeof(reset
));
619 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
621 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
622 mt352_write(fe
, gpp_ctl_cfg
, sizeof(gpp_ctl_cfg
));
623 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
627 static struct cx22702_config cxusb_cx22702_config
= {
628 .demod_address
= 0x63,
629 .output_mode
= CX22702_PARALLEL_OUTPUT
,
632 static struct lgdt330x_config cxusb_lgdt3303_config
= {
633 .demod_address
= 0x0e,
634 .demod_chip
= LGDT3303
,
637 static struct lgdt330x_config cxusb_aver_lgdt3303_config
= {
638 .demod_address
= 0x0e,
639 .demod_chip
= LGDT3303
,
640 .clock_polarity_flip
= 2,
643 static struct mt352_config cxusb_dee1601_config
= {
644 .demod_address
= 0x0f,
645 .demod_init
= cxusb_dee1601_demod_init
,
648 static struct zl10353_config cxusb_zl10353_dee1601_config
= {
649 .demod_address
= 0x0f,
653 static struct mt352_config cxusb_mt352_config
= {
654 /* used in both lgz201 and th7579 */
655 .demod_address
= 0x0f,
656 .demod_init
= cxusb_mt352_demod_init
,
659 static struct zl10353_config cxusb_zl10353_xc3028_config
= {
660 .demod_address
= 0x0f,
666 static struct mt352_config cxusb_mt352_xc3028_config
= {
667 .demod_address
= 0x0f,
670 .demod_init
= cxusb_mt352_demod_init
,
673 /* FIXME: needs tweaking */
674 static struct mxl5005s_config aver_a868r_tuner
= {
676 .if_freq
= 6000000UL,
677 .xtal_freq
= CRYSTAL_FREQ_16000000HZ
,
678 .agc_mode
= MXL_SINGLE_AGC
,
679 .tracking_filter
= MXL_TF_C
,
680 .rssi_enable
= MXL_RSSI_ENABLE
,
681 .cap_select
= MXL_CAP_SEL_ENABLE
,
682 .div_out
= MXL_DIV_OUT_4
,
683 .clock_out
= MXL_CLOCK_OUT_DISABLE
,
684 .output_load
= MXL5005S_IF_OUTPUT_LOAD_200_OHM
,
685 .top
= MXL5005S_TOP_25P2
,
686 .mod_mode
= MXL_DIGITAL_MODE
,
687 .if_mode
= MXL_ZERO_IF
,
688 .AgcMasterByte
= 0x00,
691 /* FIXME: needs tweaking */
692 static struct mxl5005s_config d680_dmb_tuner
= {
694 .if_freq
= 36125000UL,
695 .xtal_freq
= CRYSTAL_FREQ_16000000HZ
,
696 .agc_mode
= MXL_SINGLE_AGC
,
697 .tracking_filter
= MXL_TF_C
,
698 .rssi_enable
= MXL_RSSI_ENABLE
,
699 .cap_select
= MXL_CAP_SEL_ENABLE
,
700 .div_out
= MXL_DIV_OUT_4
,
701 .clock_out
= MXL_CLOCK_OUT_DISABLE
,
702 .output_load
= MXL5005S_IF_OUTPUT_LOAD_200_OHM
,
703 .top
= MXL5005S_TOP_25P2
,
704 .mod_mode
= MXL_DIGITAL_MODE
,
705 .if_mode
= MXL_ZERO_IF
,
706 .AgcMasterByte
= 0x00,
709 /* Callbacks for DVB USB */
710 static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter
*adap
)
712 dvb_attach(simple_tuner_attach
, adap
->fe
,
713 &adap
->dev
->i2c_adap
, 0x61,
714 TUNER_PHILIPS_FMD1216ME_MK3
);
718 static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter
*adap
)
720 dvb_attach(dvb_pll_attach
, adap
->fe
, 0x61,
721 NULL
, DVB_PLL_THOMSON_DTT7579
);
725 static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter
*adap
)
727 dvb_attach(dvb_pll_attach
, adap
->fe
, 0x61, NULL
, DVB_PLL_LG_Z201
);
731 static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter
*adap
)
733 dvb_attach(dvb_pll_attach
, adap
->fe
, 0x60,
734 NULL
, DVB_PLL_THOMSON_DTT7579
);
738 static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter
*adap
)
740 dvb_attach(simple_tuner_attach
, adap
->fe
,
741 &adap
->dev
->i2c_adap
, 0x61, TUNER_LG_TDVS_H06XF
);
745 static int dvico_bluebird_xc2028_callback(void *ptr
, int component
,
746 int command
, int arg
)
748 struct dvb_usb_adapter
*adap
= ptr
;
749 struct dvb_usb_device
*d
= adap
->dev
;
752 case XC2028_TUNER_RESET
:
753 deb_info("%s: XC2028_TUNER_RESET %d\n", __func__
, arg
);
754 cxusb_bluebird_gpio_pulse(d
, 0x01, 1);
756 case XC2028_RESET_CLK
:
757 deb_info("%s: XC2028_RESET_CLK %d\n", __func__
, arg
);
760 deb_info("%s: unknown command %d, arg %d\n", __func__
,
768 static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter
*adap
)
770 struct dvb_frontend
*fe
;
771 struct xc2028_config cfg
= {
772 .i2c_adap
= &adap
->dev
->i2c_adap
,
775 static struct xc2028_ctrl ctl
= {
776 .fname
= XC2028_DEFAULT_FIRMWARE
,
778 .demod
= XC3028_FE_ZARLINK456
,
781 /* FIXME: generalize & move to common area */
782 adap
->fe
->callback
= dvico_bluebird_xc2028_callback
;
784 fe
= dvb_attach(xc2028_attach
, adap
->fe
, &cfg
);
785 if (fe
== NULL
|| fe
->ops
.tuner_ops
.set_config
== NULL
)
788 fe
->ops
.tuner_ops
.set_config(fe
, &ctl
);
793 static int cxusb_mxl5003s_tuner_attach(struct dvb_usb_adapter
*adap
)
795 dvb_attach(mxl5005s_attach
, adap
->fe
,
796 &adap
->dev
->i2c_adap
, &aver_a868r_tuner
);
800 static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter
*adap
)
802 struct dvb_frontend
*fe
;
803 fe
= dvb_attach(mxl5005s_attach
, adap
->fe
,
804 &adap
->dev
->i2c_adap
, &d680_dmb_tuner
);
805 return (fe
== NULL
) ? -EIO
: 0;
808 static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter
*adap
)
811 if (usb_set_interface(adap
->dev
->udev
, 0, 6) < 0)
812 err("set interface failed");
814 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, &b
, 1);
816 if ((adap
->fe
= dvb_attach(cx22702_attach
, &cxusb_cx22702_config
,
817 &adap
->dev
->i2c_adap
)) != NULL
)
823 static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter
*adap
)
825 if (usb_set_interface(adap
->dev
->udev
, 0, 7) < 0)
826 err("set interface failed");
828 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
830 if ((adap
->fe
= dvb_attach(lgdt330x_attach
, &cxusb_lgdt3303_config
,
831 &adap
->dev
->i2c_adap
)) != NULL
)
837 static int cxusb_aver_lgdt3303_frontend_attach(struct dvb_usb_adapter
*adap
)
839 adap
->fe
= dvb_attach(lgdt330x_attach
, &cxusb_aver_lgdt3303_config
,
840 &adap
->dev
->i2c_adap
);
841 if (adap
->fe
!= NULL
)
847 static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter
*adap
)
849 /* used in both lgz201 and th7579 */
850 if (usb_set_interface(adap
->dev
->udev
, 0, 0) < 0)
851 err("set interface failed");
853 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
855 if ((adap
->fe
= dvb_attach(mt352_attach
, &cxusb_mt352_config
,
856 &adap
->dev
->i2c_adap
)) != NULL
)
862 static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter
*adap
)
864 if (usb_set_interface(adap
->dev
->udev
, 0, 0) < 0)
865 err("set interface failed");
867 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
869 if (((adap
->fe
= dvb_attach(mt352_attach
, &cxusb_dee1601_config
,
870 &adap
->dev
->i2c_adap
)) != NULL
) ||
871 ((adap
->fe
= dvb_attach(zl10353_attach
,
872 &cxusb_zl10353_dee1601_config
,
873 &adap
->dev
->i2c_adap
)) != NULL
))
879 static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter
*adap
)
883 struct i2c_msg msg
= { .addr
= 0x6b, .flags
= I2C_M_RD
,
884 .buf
= ircode
, .len
= 4 };
886 if (usb_set_interface(adap
->dev
->udev
, 0, 1) < 0)
887 err("set interface failed");
889 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
891 /* reset the tuner and demodulator */
892 cxusb_bluebird_gpio_rw(adap
->dev
, 0x04, 0);
893 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x01, 1);
894 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x02, 1);
896 if ((adap
->fe
= dvb_attach(zl10353_attach
,
897 &cxusb_zl10353_xc3028_config
,
898 &adap
->dev
->i2c_adap
)) == NULL
)
901 /* try to determine if there is no IR decoder on the I2C bus */
902 for (i
= 0; adap
->dev
->props
.rc_key_map
!= NULL
&& i
< 5; i
++) {
904 if (cxusb_i2c_xfer(&adap
->dev
->i2c_adap
, &msg
, 1) != 1)
906 if (ircode
[0] == 0 && ircode
[1] == 0)
908 if (ircode
[2] + ircode
[3] != 0xff) {
910 adap
->dev
->props
.rc_key_map
= NULL
;
911 info("No IR receiver detected on this device.");
919 static struct dibx000_agc_config dib7070_agc_config
= {
920 .band_caps
= BAND_UHF
| BAND_VHF
| BAND_LBAND
| BAND_SBAND
,
923 * P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5,
924 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
925 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0
927 .setup
= (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) |
928 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
954 .perform_agc_softsplit
= 0,
957 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz
= {
970 /* refsel, sel, freq_15k */
971 .sad_cfg
= (3 << 14) | (1 << 12) | (524 << 0),
972 .ifreq
= (0 << 25) | 0,
977 static struct dib7000p_config cxusb_dualdig4_rev2_config
= {
978 .output_mode
= OUTMODE_MPEG2_PAR_GATED_CLK
,
979 .output_mpeg2_in_188_bytes
= 1,
981 .agc_config_count
= 1,
982 .agc
= &dib7070_agc_config
,
983 .bw
= &dib7070_bw_config_12_mhz
,
984 .tuner_is_baseband
= 1,
990 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
992 .hostbus_diversity
= 1,
995 static int cxusb_dualdig4_rev2_frontend_attach(struct dvb_usb_adapter
*adap
)
997 if (usb_set_interface(adap
->dev
->udev
, 0, 1) < 0)
998 err("set interface failed");
1000 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
1002 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x02, 1);
1004 dib7000p_i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
1005 &cxusb_dualdig4_rev2_config
);
1007 adap
->fe
= dvb_attach(dib7000p_attach
, &adap
->dev
->i2c_adap
, 0x80,
1008 &cxusb_dualdig4_rev2_config
);
1009 if (adap
->fe
== NULL
)
1015 static int dib7070_tuner_reset(struct dvb_frontend
*fe
, int onoff
)
1017 return dib7000p_set_gpio(fe
, 8, 0, !onoff
);
1020 static int dib7070_tuner_sleep(struct dvb_frontend
*fe
, int onoff
)
1025 static struct dib0070_config dib7070p_dib0070_config
= {
1026 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
1027 .reset
= dib7070_tuner_reset
,
1028 .sleep
= dib7070_tuner_sleep
,
1032 struct dib0700_adapter_state
{
1033 int (*set_param_save
) (struct dvb_frontend
*,
1034 struct dvb_frontend_parameters
*);
1037 static int dib7070_set_param_override(struct dvb_frontend
*fe
,
1038 struct dvb_frontend_parameters
*fep
)
1040 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
1041 struct dib0700_adapter_state
*state
= adap
->priv
;
1044 u8 band
= BAND_OF_FREQUENCY(fep
->frequency
/1000);
1046 case BAND_VHF
: offset
= 950; break;
1048 case BAND_UHF
: offset
= 550; break;
1051 dib7000p_set_wbd_ref(fe
, offset
+ dib0070_wbd_offset(fe
));
1053 return state
->set_param_save(fe
, fep
);
1056 static int cxusb_dualdig4_rev2_tuner_attach(struct dvb_usb_adapter
*adap
)
1058 struct dib0700_adapter_state
*st
= adap
->priv
;
1059 struct i2c_adapter
*tun_i2c
=
1060 dib7000p_get_i2c_master(adap
->fe
,
1061 DIBX000_I2C_INTERFACE_TUNER
, 1);
1063 if (dvb_attach(dib0070_attach
, adap
->fe
, tun_i2c
,
1064 &dib7070p_dib0070_config
) == NULL
)
1067 st
->set_param_save
= adap
->fe
->ops
.tuner_ops
.set_params
;
1068 adap
->fe
->ops
.tuner_ops
.set_params
= dib7070_set_param_override
;
1072 static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter
*adap
)
1074 if (usb_set_interface(adap
->dev
->udev
, 0, 1) < 0)
1075 err("set interface failed");
1077 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
1079 /* reset the tuner and demodulator */
1080 cxusb_bluebird_gpio_rw(adap
->dev
, 0x04, 0);
1081 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x01, 1);
1082 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x02, 1);
1084 if ((adap
->fe
= dvb_attach(zl10353_attach
,
1085 &cxusb_zl10353_xc3028_config
,
1086 &adap
->dev
->i2c_adap
)) != NULL
)
1089 if ((adap
->fe
= dvb_attach(mt352_attach
,
1090 &cxusb_mt352_xc3028_config
,
1091 &adap
->dev
->i2c_adap
)) != NULL
)
1097 static struct lgs8gxx_config d680_lgs8gl5_cfg
= {
1098 .prod
= LGS8GXX_PROD_LGS8GL5
,
1099 .demod_address
= 0x19,
1103 .if_clk_freq
= 30400, /* 30.4 MHz */
1104 .if_freq
= 5725, /* 5.725 MHz */
1111 static int cxusb_d680_dmb_frontend_attach(struct dvb_usb_adapter
*adap
)
1113 struct dvb_usb_device
*d
= adap
->dev
;
1116 /* Select required USB configuration */
1117 if (usb_set_interface(d
->udev
, 0, 0) < 0)
1118 err("set interface failed");
1120 /* Unblock all USB pipes */
1121 usb_clear_halt(d
->udev
,
1122 usb_sndbulkpipe(d
->udev
, d
->props
.generic_bulk_ctrl_endpoint
));
1123 usb_clear_halt(d
->udev
,
1124 usb_rcvbulkpipe(d
->udev
, d
->props
.generic_bulk_ctrl_endpoint
));
1125 usb_clear_halt(d
->udev
,
1126 usb_rcvbulkpipe(d
->udev
, d
->props
.adapter
[0].stream
.endpoint
));
1128 /* Drain USB pipes to avoid hang after reboot */
1129 for (n
= 0; n
< 5; n
++) {
1130 cxusb_d680_dmb_drain_message(d
);
1131 cxusb_d680_dmb_drain_video(d
);
1135 /* Reset the tuner */
1136 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 0) < 0) {
1137 err("clear tuner gpio failed");
1141 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 1) < 0) {
1142 err("set tuner gpio failed");
1147 /* Attach frontend */
1148 adap
->fe
= dvb_attach(lgs8gxx_attach
, &d680_lgs8gl5_cfg
, &d
->i2c_adap
);
1149 if (adap
->fe
== NULL
)
1156 * DViCO has shipped two devices with the same USB ID, but only one of them
1157 * needs a firmware download. Check the device class details to see if they
1158 * have non-default values to decide whether the device is actually cold or
1159 * not, and forget a match if it turns out we selected the wrong device.
1161 static int bluebird_fx2_identify_state(struct usb_device
*udev
,
1162 struct dvb_usb_device_properties
*props
,
1163 struct dvb_usb_device_description
**desc
,
1166 int wascold
= *cold
;
1168 *cold
= udev
->descriptor
.bDeviceClass
== 0xff &&
1169 udev
->descriptor
.bDeviceSubClass
== 0xff &&
1170 udev
->descriptor
.bDeviceProtocol
== 0xff;
1172 if (*cold
&& !wascold
)
1179 * DViCO bluebird firmware needs the "warm" product ID to be patched into the
1180 * firmware file before download.
1183 static const int dvico_firmware_id_offsets
[] = { 6638, 3204 };
1184 static int bluebird_patch_dvico_firmware_download(struct usb_device
*udev
,
1185 const struct firmware
*fw
)
1189 for (pos
= 0; pos
< ARRAY_SIZE(dvico_firmware_id_offsets
); pos
++) {
1190 int idoff
= dvico_firmware_id_offsets
[pos
];
1192 if (fw
->size
< idoff
+ 4)
1195 if (fw
->data
[idoff
] == (USB_VID_DVICO
& 0xff) &&
1196 fw
->data
[idoff
+ 1] == USB_VID_DVICO
>> 8) {
1197 struct firmware new_fw
;
1198 u8
*new_fw_data
= vmalloc(fw
->size
);
1204 memcpy(new_fw_data
, fw
->data
, fw
->size
);
1205 new_fw
.size
= fw
->size
;
1206 new_fw
.data
= new_fw_data
;
1208 new_fw_data
[idoff
+ 2] =
1209 le16_to_cpu(udev
->descriptor
.idProduct
) + 1;
1210 new_fw_data
[idoff
+ 3] =
1211 le16_to_cpu(udev
->descriptor
.idProduct
) >> 8;
1213 ret
= usb_cypress_load_firmware(udev
, &new_fw
,
1223 /* DVB USB Driver stuff */
1224 static struct dvb_usb_device_properties cxusb_medion_properties
;
1225 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties
;
1226 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties
;
1227 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties
;
1228 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties
;
1229 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties
;
1230 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties
;
1231 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties
;
1232 static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties
;
1233 static struct dvb_usb_device_properties cxusb_aver_a868r_properties
;
1234 static struct dvb_usb_device_properties cxusb_d680_dmb_properties
;
1236 static int cxusb_probe(struct usb_interface
*intf
,
1237 const struct usb_device_id
*id
)
1239 if (0 == dvb_usb_device_init(intf
, &cxusb_medion_properties
,
1240 THIS_MODULE
, NULL
, adapter_nr
) ||
1241 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_lgh064f_properties
,
1242 THIS_MODULE
, NULL
, adapter_nr
) ||
1243 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_dee1601_properties
,
1244 THIS_MODULE
, NULL
, adapter_nr
) ||
1245 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_lgz201_properties
,
1246 THIS_MODULE
, NULL
, adapter_nr
) ||
1247 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_dtt7579_properties
,
1248 THIS_MODULE
, NULL
, adapter_nr
) ||
1249 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_dualdig4_properties
,
1250 THIS_MODULE
, NULL
, adapter_nr
) ||
1251 0 == dvb_usb_device_init(intf
, &cxusb_bluebird_nano2_properties
,
1252 THIS_MODULE
, NULL
, adapter_nr
) ||
1253 0 == dvb_usb_device_init(intf
,
1254 &cxusb_bluebird_nano2_needsfirmware_properties
,
1255 THIS_MODULE
, NULL
, adapter_nr
) ||
1256 0 == dvb_usb_device_init(intf
, &cxusb_aver_a868r_properties
,
1257 THIS_MODULE
, NULL
, adapter_nr
) ||
1258 0 == dvb_usb_device_init(intf
,
1259 &cxusb_bluebird_dualdig4_rev2_properties
,
1260 THIS_MODULE
, NULL
, adapter_nr
) ||
1261 0 == dvb_usb_device_init(intf
, &cxusb_d680_dmb_properties
,
1262 THIS_MODULE
, NULL
, adapter_nr
) ||
1269 static struct usb_device_id cxusb_table
[] = {
1270 { USB_DEVICE(USB_VID_MEDION
, USB_PID_MEDION_MD95700
) },
1271 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LG064F_COLD
) },
1272 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LG064F_WARM
) },
1273 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD
) },
1274 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM
) },
1275 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD
) },
1276 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM
) },
1277 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_TH7579_COLD
) },
1278 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_TH7579_WARM
) },
1279 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD
) },
1280 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM
) },
1281 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD
) },
1282 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM
) },
1283 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_4
) },
1284 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2
) },
1285 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM
) },
1286 { USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_VOLAR_A868R
) },
1287 { USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2
) },
1288 { USB_DEVICE(USB_VID_CONEXANT
, USB_PID_CONEXANT_D680_DMB
) },
1289 {} /* Terminating entry */
1291 MODULE_DEVICE_TABLE (usb
, cxusb_table
);
1293 static struct dvb_usb_device_properties cxusb_medion_properties
= {
1294 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1296 .usb_ctrl
= CYPRESS_FX2
,
1298 .size_of_priv
= sizeof(struct cxusb_state
),
1303 .streaming_ctrl
= cxusb_streaming_ctrl
,
1304 .frontend_attach
= cxusb_cx22702_frontend_attach
,
1305 .tuner_attach
= cxusb_fmd1216me_tuner_attach
,
1306 /* parameter for the MPEG2-data transfer */
1320 .power_ctrl
= cxusb_power_ctrl
,
1322 .i2c_algo
= &cxusb_i2c_algo
,
1324 .generic_bulk_ctrl_endpoint
= 0x01,
1326 .num_device_descs
= 1,
1328 { "Medion MD95700 (MDUSBTV-HYBRID)",
1330 { &cxusb_table
[0], NULL
},
1335 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties
= {
1336 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1338 .usb_ctrl
= DEVICE_SPECIFIC
,
1339 .firmware
= "dvb-usb-bluebird-01.fw",
1340 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1341 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1342 use usb alt setting 7 for EP2 transfer (atsc) */
1344 .size_of_priv
= sizeof(struct cxusb_state
),
1349 .streaming_ctrl
= cxusb_streaming_ctrl
,
1350 .frontend_attach
= cxusb_lgdt3303_frontend_attach
,
1351 .tuner_attach
= cxusb_lgh064f_tuner_attach
,
1353 /* parameter for the MPEG2-data transfer */
1367 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1369 .i2c_algo
= &cxusb_i2c_algo
,
1372 .rc_key_map
= dvico_portable_rc_keys
,
1373 .rc_key_map_size
= ARRAY_SIZE(dvico_portable_rc_keys
),
1374 .rc_query
= cxusb_rc_query
,
1376 .generic_bulk_ctrl_endpoint
= 0x01,
1378 .num_device_descs
= 1,
1380 { "DViCO FusionHDTV5 USB Gold",
1381 { &cxusb_table
[1], NULL
},
1382 { &cxusb_table
[2], NULL
},
1387 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties
= {
1388 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1390 .usb_ctrl
= DEVICE_SPECIFIC
,
1391 .firmware
= "dvb-usb-bluebird-01.fw",
1392 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1393 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1394 use usb alt setting 7 for EP2 transfer (atsc) */
1396 .size_of_priv
= sizeof(struct cxusb_state
),
1401 .streaming_ctrl
= cxusb_streaming_ctrl
,
1402 .frontend_attach
= cxusb_dee1601_frontend_attach
,
1403 .tuner_attach
= cxusb_dee1601_tuner_attach
,
1404 /* parameter for the MPEG2-data transfer */
1418 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1420 .i2c_algo
= &cxusb_i2c_algo
,
1423 .rc_key_map
= dvico_mce_rc_keys
,
1424 .rc_key_map_size
= ARRAY_SIZE(dvico_mce_rc_keys
),
1425 .rc_query
= cxusb_rc_query
,
1427 .generic_bulk_ctrl_endpoint
= 0x01,
1429 .num_device_descs
= 3,
1431 { "DViCO FusionHDTV DVB-T Dual USB",
1432 { &cxusb_table
[3], NULL
},
1433 { &cxusb_table
[4], NULL
},
1435 { "DigitalNow DVB-T Dual USB",
1436 { &cxusb_table
[9], NULL
},
1437 { &cxusb_table
[10], NULL
},
1439 { "DViCO FusionHDTV DVB-T Dual Digital 2",
1440 { &cxusb_table
[11], NULL
},
1441 { &cxusb_table
[12], NULL
},
1446 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties
= {
1447 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1449 .usb_ctrl
= DEVICE_SPECIFIC
,
1450 .firmware
= "dvb-usb-bluebird-01.fw",
1451 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1452 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1453 use usb alt setting 7 for EP2 transfer (atsc) */
1455 .size_of_priv
= sizeof(struct cxusb_state
),
1460 .streaming_ctrl
= cxusb_streaming_ctrl
,
1461 .frontend_attach
= cxusb_mt352_frontend_attach
,
1462 .tuner_attach
= cxusb_lgz201_tuner_attach
,
1464 /* parameter for the MPEG2-data transfer */
1477 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1479 .i2c_algo
= &cxusb_i2c_algo
,
1482 .rc_key_map
= dvico_portable_rc_keys
,
1483 .rc_key_map_size
= ARRAY_SIZE(dvico_portable_rc_keys
),
1484 .rc_query
= cxusb_rc_query
,
1486 .generic_bulk_ctrl_endpoint
= 0x01,
1487 .num_device_descs
= 1,
1489 { "DViCO FusionHDTV DVB-T USB (LGZ201)",
1490 { &cxusb_table
[5], NULL
},
1491 { &cxusb_table
[6], NULL
},
1496 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties
= {
1497 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1499 .usb_ctrl
= DEVICE_SPECIFIC
,
1500 .firmware
= "dvb-usb-bluebird-01.fw",
1501 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1502 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1503 use usb alt setting 7 for EP2 transfer (atsc) */
1505 .size_of_priv
= sizeof(struct cxusb_state
),
1510 .streaming_ctrl
= cxusb_streaming_ctrl
,
1511 .frontend_attach
= cxusb_mt352_frontend_attach
,
1512 .tuner_attach
= cxusb_dtt7579_tuner_attach
,
1514 /* parameter for the MPEG2-data transfer */
1527 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1529 .i2c_algo
= &cxusb_i2c_algo
,
1532 .rc_key_map
= dvico_portable_rc_keys
,
1533 .rc_key_map_size
= ARRAY_SIZE(dvico_portable_rc_keys
),
1534 .rc_query
= cxusb_rc_query
,
1536 .generic_bulk_ctrl_endpoint
= 0x01,
1538 .num_device_descs
= 1,
1540 { "DViCO FusionHDTV DVB-T USB (TH7579)",
1541 { &cxusb_table
[7], NULL
},
1542 { &cxusb_table
[8], NULL
},
1547 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties
= {
1548 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1550 .usb_ctrl
= CYPRESS_FX2
,
1552 .size_of_priv
= sizeof(struct cxusb_state
),
1557 .streaming_ctrl
= cxusb_streaming_ctrl
,
1558 .frontend_attach
= cxusb_dualdig4_frontend_attach
,
1559 .tuner_attach
= cxusb_dvico_xc3028_tuner_attach
,
1560 /* parameter for the MPEG2-data transfer */
1574 .power_ctrl
= cxusb_power_ctrl
,
1576 .i2c_algo
= &cxusb_i2c_algo
,
1578 .generic_bulk_ctrl_endpoint
= 0x01,
1581 .rc_key_map
= dvico_mce_rc_keys
,
1582 .rc_key_map_size
= ARRAY_SIZE(dvico_mce_rc_keys
),
1583 .rc_query
= cxusb_bluebird2_rc_query
,
1585 .num_device_descs
= 1,
1587 { "DViCO FusionHDTV DVB-T Dual Digital 4",
1589 { &cxusb_table
[13], NULL
},
1594 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties
= {
1595 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1597 .usb_ctrl
= CYPRESS_FX2
,
1598 .identify_state
= bluebird_fx2_identify_state
,
1600 .size_of_priv
= sizeof(struct cxusb_state
),
1605 .streaming_ctrl
= cxusb_streaming_ctrl
,
1606 .frontend_attach
= cxusb_nano2_frontend_attach
,
1607 .tuner_attach
= cxusb_dvico_xc3028_tuner_attach
,
1608 /* parameter for the MPEG2-data transfer */
1622 .power_ctrl
= cxusb_nano2_power_ctrl
,
1624 .i2c_algo
= &cxusb_i2c_algo
,
1626 .generic_bulk_ctrl_endpoint
= 0x01,
1629 .rc_key_map
= dvico_portable_rc_keys
,
1630 .rc_key_map_size
= ARRAY_SIZE(dvico_portable_rc_keys
),
1631 .rc_query
= cxusb_bluebird2_rc_query
,
1633 .num_device_descs
= 1,
1635 { "DViCO FusionHDTV DVB-T NANO2",
1637 { &cxusb_table
[14], NULL
},
1642 static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties
= {
1643 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1645 .usb_ctrl
= DEVICE_SPECIFIC
,
1646 .firmware
= "dvb-usb-bluebird-02.fw",
1647 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1648 .identify_state
= bluebird_fx2_identify_state
,
1650 .size_of_priv
= sizeof(struct cxusb_state
),
1655 .streaming_ctrl
= cxusb_streaming_ctrl
,
1656 .frontend_attach
= cxusb_nano2_frontend_attach
,
1657 .tuner_attach
= cxusb_dvico_xc3028_tuner_attach
,
1658 /* parameter for the MPEG2-data transfer */
1672 .power_ctrl
= cxusb_nano2_power_ctrl
,
1674 .i2c_algo
= &cxusb_i2c_algo
,
1676 .generic_bulk_ctrl_endpoint
= 0x01,
1679 .rc_key_map
= dvico_portable_rc_keys
,
1680 .rc_key_map_size
= ARRAY_SIZE(dvico_portable_rc_keys
),
1681 .rc_query
= cxusb_rc_query
,
1683 .num_device_descs
= 1,
1685 { "DViCO FusionHDTV DVB-T NANO2 w/o firmware",
1686 { &cxusb_table
[14], NULL
},
1687 { &cxusb_table
[15], NULL
},
1692 static struct dvb_usb_device_properties cxusb_aver_a868r_properties
= {
1693 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1695 .usb_ctrl
= CYPRESS_FX2
,
1697 .size_of_priv
= sizeof(struct cxusb_state
),
1702 .streaming_ctrl
= cxusb_aver_streaming_ctrl
,
1703 .frontend_attach
= cxusb_aver_lgdt3303_frontend_attach
,
1704 .tuner_attach
= cxusb_mxl5003s_tuner_attach
,
1705 /* parameter for the MPEG2-data transfer */
1719 .power_ctrl
= cxusb_aver_power_ctrl
,
1721 .i2c_algo
= &cxusb_i2c_algo
,
1723 .generic_bulk_ctrl_endpoint
= 0x01,
1725 .num_device_descs
= 1,
1727 { "AVerMedia AVerTVHD Volar (A868R)",
1729 { &cxusb_table
[16], NULL
},
1735 struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties
= {
1736 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1738 .usb_ctrl
= CYPRESS_FX2
,
1740 .size_of_priv
= sizeof(struct cxusb_state
),
1745 .streaming_ctrl
= cxusb_streaming_ctrl
,
1746 .frontend_attach
= cxusb_dualdig4_rev2_frontend_attach
,
1747 .tuner_attach
= cxusb_dualdig4_rev2_tuner_attach
,
1748 .size_of_priv
= sizeof(struct dib0700_adapter_state
),
1749 /* parameter for the MPEG2-data transfer */
1763 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1765 .i2c_algo
= &cxusb_i2c_algo
,
1767 .generic_bulk_ctrl_endpoint
= 0x01,
1770 .rc_key_map
= dvico_mce_rc_keys
,
1771 .rc_key_map_size
= ARRAY_SIZE(dvico_mce_rc_keys
),
1772 .rc_query
= cxusb_rc_query
,
1774 .num_device_descs
= 1,
1776 { "DViCO FusionHDTV DVB-T Dual Digital 4 (rev 2)",
1778 { &cxusb_table
[17], NULL
},
1783 static struct dvb_usb_device_properties cxusb_d680_dmb_properties
= {
1784 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1786 .usb_ctrl
= CYPRESS_FX2
,
1788 .size_of_priv
= sizeof(struct cxusb_state
),
1793 .streaming_ctrl
= cxusb_d680_dmb_streaming_ctrl
,
1794 .frontend_attach
= cxusb_d680_dmb_frontend_attach
,
1795 .tuner_attach
= cxusb_d680_dmb_tuner_attach
,
1797 /* parameter for the MPEG2-data transfer */
1811 .power_ctrl
= cxusb_d680_dmb_power_ctrl
,
1813 .i2c_algo
= &cxusb_i2c_algo
,
1815 .generic_bulk_ctrl_endpoint
= 0x01,
1818 .rc_key_map
= d680_dmb_rc_keys
,
1819 .rc_key_map_size
= ARRAY_SIZE(d680_dmb_rc_keys
),
1820 .rc_query
= cxusb_d680_dmb_rc_query
,
1822 .num_device_descs
= 1,
1825 "Conexant DMB-TH Stick",
1827 { &cxusb_table
[18], NULL
},
1832 static struct usb_driver cxusb_driver
= {
1833 .name
= "dvb_usb_cxusb",
1834 .probe
= cxusb_probe
,
1835 .disconnect
= dvb_usb_device_exit
,
1836 .id_table
= cxusb_table
,
1840 static int __init
cxusb_module_init(void)
1843 if ((result
= usb_register(&cxusb_driver
))) {
1844 err("usb_register failed. Error number %d",result
);
1851 static void __exit
cxusb_module_exit(void)
1853 /* deregister this driver from the USB subsystem */
1854 usb_deregister(&cxusb_driver
);
1857 module_init (cxusb_module_init
);
1858 module_exit (cxusb_module_exit
);
1860 MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
1861 MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
1862 MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
1863 MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
1864 MODULE_VERSION("1.0-alpha");
1865 MODULE_LICENSE("GPL");