1 /* DVB USB compliant linux driver for Conexant USB reference design.
3 * The Conexant reference design I saw on their website was only for analogue
4 * capturing (using the cx25842). The box I took to write this driver (reverse
5 * engineered) is the one labeled Medion MD95700. In addition to the cx25842
6 * for analogue capturing it also has a cx22702 DVB-T demodulator on the main
7 * board. Besides it has a atiremote (X10) and a USB2.0 hub onboard.
9 * Maybe it is a little bit premature to call this driver cxusb, but I assume
10 * the USB protocol is identical or at least inherited from the reference
11 * design, so it can be reused for the "analogue-only" device (if it will
14 * TODO: Use the cx25840-driver for the analogue part
16 * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de)
17 * Copyright (C) 2006 Michael Krufky (mkrufky@linuxtv.org)
18 * Copyright (C) 2006, 2007 Chris Pascoe (c.pascoe@itee.uq.edu.au)
20 * This program is free software; you can redistribute it and/or modify it
21 * under the terms of the GNU General Public License as published by the Free
22 * Software Foundation, version 2.
24 * see Documentation/dvb/README.dvb-usb for more information
26 #include <media/tuner.h>
27 #include <linux/vmalloc.h>
28 #include <linux/slab.h>
35 #include "mt352_priv.h"
37 #include "tuner-xc2028.h"
38 #include "tuner-simple.h"
46 /* Max transfer size done by I2C transfer functions */
47 #define MAX_XFER_SIZE 64
50 static int dvb_usb_cxusb_debug;
51 module_param_named(debug, dvb_usb_cxusb_debug, int, 0644);
52 MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
54 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
56 #define deb_info(args...) dprintk(dvb_usb_cxusb_debug, 0x03, args)
57 #define deb_i2c(args...) dprintk(dvb_usb_cxusb_debug, 0x02, args)
59 static int cxusb_ctrl_msg(struct dvb_usb_device *d,
60 u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
62 int wo = (rbuf == NULL || rlen == 0); /* write-only */
63 u8 sndbuf[MAX_XFER_SIZE];
65 if (1 + wlen > sizeof(sndbuf)) {
66 warn("i2c wr: len=%d is too big!\n",
71 memset(sndbuf, 0, 1+wlen);
74 memcpy(&sndbuf[1], wbuf, wlen);
76 return dvb_usb_generic_write(d, sndbuf, 1+wlen);
78 return dvb_usb_generic_rw(d, sndbuf, 1+wlen, rbuf, rlen, 0);
82 static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff)
84 struct cxusb_state *st = d->priv;
87 if (st->gpio_write_state[GPIO_TUNER] == onoff)
92 cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1);
95 deb_info("gpio_write failed.\n");
97 st->gpio_write_state[GPIO_TUNER] = onoff;
100 static int cxusb_bluebird_gpio_rw(struct dvb_usb_device *d, u8 changemask,
106 o[0] = 0xff & ~changemask; /* mask of bits to keep */
107 o[1] = newval & changemask; /* new values for bits */
109 rc = cxusb_ctrl_msg(d, CMD_BLUEBIRD_GPIO_RW, o, 2, &gpio_state, 1);
110 if (rc < 0 || (gpio_state & changemask) != (newval & changemask))
111 deb_info("bluebird_gpio_write failed.\n");
113 return rc < 0 ? rc : gpio_state;
116 static void cxusb_bluebird_gpio_pulse(struct dvb_usb_device *d, u8 pin, int low)
118 cxusb_bluebird_gpio_rw(d, pin, low ? 0 : pin);
120 cxusb_bluebird_gpio_rw(d, pin, low ? pin : 0);
123 static void cxusb_nano2_led(struct dvb_usb_device *d, int onoff)
125 cxusb_bluebird_gpio_rw(d, 0x40, onoff ? 0 : 0x40);
128 static int cxusb_d680_dmb_gpio_tuner(struct dvb_usb_device *d,
131 u8 o[2] = {addr, onoff};
135 rc = cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1);
142 deb_info("gpio_write failed.\n");
148 static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
151 struct dvb_usb_device *d = i2c_get_adapdata(adap);
154 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
157 for (i = 0; i < num; i++) {
159 if (d->udev->descriptor.idVendor == USB_VID_MEDION)
160 switch (msg[i].addr) {
162 cxusb_gpio_tuner(d, 0);
165 cxusb_gpio_tuner(d, 1);
169 if (msg[i].flags & I2C_M_RD) {
171 u8 obuf[3], ibuf[MAX_XFER_SIZE];
173 if (1 + msg[i].len > sizeof(ibuf)) {
174 warn("i2c rd: len=%d is too big!\n",
179 obuf[1] = msg[i].len;
180 obuf[2] = msg[i].addr;
181 if (cxusb_ctrl_msg(d, CMD_I2C_READ,
183 ibuf, 1+msg[i].len) < 0) {
184 warn("i2c read failed");
187 memcpy(msg[i].buf, &ibuf[1], msg[i].len);
188 } else if (i+1 < num && (msg[i+1].flags & I2C_M_RD) &&
189 msg[i].addr == msg[i+1].addr) {
190 /* write to then read from same address */
191 u8 obuf[MAX_XFER_SIZE], ibuf[MAX_XFER_SIZE];
193 if (3 + msg[i].len > sizeof(obuf)) {
194 warn("i2c wr: len=%d is too big!\n",
198 if (1 + msg[i + 1].len > sizeof(ibuf)) {
199 warn("i2c rd: len=%d is too big!\n",
203 obuf[0] = msg[i].len;
204 obuf[1] = msg[i+1].len;
205 obuf[2] = msg[i].addr;
206 memcpy(&obuf[3], msg[i].buf, msg[i].len);
208 if (cxusb_ctrl_msg(d, CMD_I2C_READ,
210 ibuf, 1+msg[i+1].len) < 0)
214 deb_i2c("i2c read may have failed\n");
216 memcpy(msg[i+1].buf, &ibuf[1], msg[i+1].len);
221 u8 obuf[MAX_XFER_SIZE], ibuf;
223 if (2 + msg[i].len > sizeof(obuf)) {
224 warn("i2c wr: len=%d is too big!\n",
228 obuf[0] = msg[i].addr;
229 obuf[1] = msg[i].len;
230 memcpy(&obuf[2], msg[i].buf, msg[i].len);
232 if (cxusb_ctrl_msg(d, CMD_I2C_WRITE, obuf,
233 2+msg[i].len, &ibuf,1) < 0)
236 deb_i2c("i2c write may have failed\n");
240 mutex_unlock(&d->i2c_mutex);
241 return i == num ? num : -EREMOTEIO;
244 static u32 cxusb_i2c_func(struct i2c_adapter *adapter)
249 static struct i2c_algorithm cxusb_i2c_algo = {
250 .master_xfer = cxusb_i2c_xfer,
251 .functionality = cxusb_i2c_func,
254 static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff)
258 return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0);
260 return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0);
263 static int cxusb_aver_power_ctrl(struct dvb_usb_device *d, int onoff)
267 return cxusb_ctrl_msg(d, CMD_POWER_OFF, NULL, 0, NULL, 0);
268 if (d->state == DVB_USB_STATE_INIT &&
269 usb_set_interface(d->udev, 0, 0) < 0)
270 err("set interface failed");
271 do {} while (!(ret = cxusb_ctrl_msg(d, CMD_POWER_ON, NULL, 0, NULL, 0)) &&
272 !(ret = cxusb_ctrl_msg(d, 0x15, NULL, 0, NULL, 0)) &&
273 !(ret = cxusb_ctrl_msg(d, 0x17, NULL, 0, NULL, 0)) && 0);
275 /* FIXME: We don't know why, but we need to configure the
276 * lgdt3303 with the register settings below on resume */
279 0x0e, 0x2, 0x00, 0x7f,
280 0x0e, 0x2, 0x02, 0xfe,
281 0x0e, 0x2, 0x02, 0x01,
282 0x0e, 0x2, 0x00, 0x03,
283 0x0e, 0x2, 0x0d, 0x40,
284 0x0e, 0x2, 0x0e, 0x87,
285 0x0e, 0x2, 0x0f, 0x8e,
286 0x0e, 0x2, 0x10, 0x01,
287 0x0e, 0x2, 0x14, 0xd7,
288 0x0e, 0x2, 0x47, 0x88,
291 for (i = 0; i < sizeof(bufs)/sizeof(u8); i += 4/sizeof(u8)) {
292 ret = cxusb_ctrl_msg(d, CMD_I2C_WRITE,
303 static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff)
307 return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0);
312 static int cxusb_nano2_power_ctrl(struct dvb_usb_device *d, int onoff)
316 rc = cxusb_power_ctrl(d, onoff);
318 cxusb_nano2_led(d, 0);
323 static int cxusb_d680_dmb_power_ctrl(struct dvb_usb_device *d, int onoff)
327 ret = cxusb_power_ctrl(d, onoff);
332 cxusb_ctrl_msg(d, CMD_DIGITAL, NULL, 0, &b, 1);
337 static int cxusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
339 u8 buf[2] = { 0x03, 0x00 };
341 cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON, buf, 2, NULL, 0);
343 cxusb_ctrl_msg(adap->dev, CMD_STREAMING_OFF, NULL, 0, NULL, 0);
348 static int cxusb_aver_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
351 cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_ON, NULL, 0, NULL, 0);
353 cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_OFF,
358 static void cxusb_d680_dmb_drain_message(struct dvb_usb_device *d)
360 int ep = d->props.generic_bulk_ctrl_endpoint;
361 const int timeout = 100;
362 const int junk_len = 32;
366 /* Discard remaining data in video pipe */
367 junk = kmalloc(junk_len, GFP_KERNEL);
371 if (usb_bulk_msg(d->udev,
372 usb_rcvbulkpipe(d->udev, ep),
373 junk, junk_len, &rd_count, timeout) < 0)
381 static void cxusb_d680_dmb_drain_video(struct dvb_usb_device *d)
383 struct usb_data_stream_properties *p = &d->props.adapter[0].fe[0].stream;
384 const int timeout = 100;
385 const int junk_len = p->u.bulk.buffersize;
389 /* Discard remaining data in video pipe */
390 junk = kmalloc(junk_len, GFP_KERNEL);
394 if (usb_bulk_msg(d->udev,
395 usb_rcvbulkpipe(d->udev, p->endpoint),
396 junk, junk_len, &rd_count, timeout) < 0)
404 static int cxusb_d680_dmb_streaming_ctrl(
405 struct dvb_usb_adapter *adap, int onoff)
408 u8 buf[2] = { 0x03, 0x00 };
409 cxusb_d680_dmb_drain_video(adap->dev);
410 return cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON,
411 buf, sizeof(buf), NULL, 0);
413 int ret = cxusb_ctrl_msg(adap->dev,
414 CMD_STREAMING_OFF, NULL, 0, NULL, 0);
419 static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
421 struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
425 cxusb_ctrl_msg(d, CMD_GET_IR_CODE, NULL, 0, ircode, 4);
428 *state = REMOTE_NO_KEY_PRESSED;
430 for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
431 if (rc5_custom(&keymap[i]) == ircode[2] &&
432 rc5_data(&keymap[i]) == ircode[3]) {
433 *event = keymap[i].keycode;
434 *state = REMOTE_KEY_PRESSED;
443 static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event,
446 struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
449 struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD,
450 .buf = ircode, .len = 4 };
453 *state = REMOTE_NO_KEY_PRESSED;
455 if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1)
458 for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
459 if (rc5_custom(&keymap[i]) == ircode[1] &&
460 rc5_data(&keymap[i]) == ircode[2]) {
461 *event = keymap[i].keycode;
462 *state = REMOTE_KEY_PRESSED;
471 static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event,
474 struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
479 *state = REMOTE_NO_KEY_PRESSED;
481 if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0)
484 for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
485 if (rc5_custom(&keymap[i]) == ircode[0] &&
486 rc5_data(&keymap[i]) == ircode[1]) {
487 *event = keymap[i].keycode;
488 *state = REMOTE_KEY_PRESSED;
497 static struct rc_map_table rc_map_dvico_mce_table[] = {
501 { 0xfe1e, KEY_FAVORITES },
502 { 0xfe16, KEY_SETUP },
503 { 0xfe46, KEY_POWER2 },
505 { 0xfe49, KEY_BACK },
506 { 0xfe4d, KEY_MENU },
508 { 0xfe5b, KEY_LEFT },
509 { 0xfe5f, KEY_RIGHT },
510 { 0xfe53, KEY_DOWN },
512 { 0xfe59, KEY_INFO },
514 { 0xfe0f, KEY_PREVIOUSSONG },/* Replay */
515 { 0xfe12, KEY_NEXTSONG }, /* Skip */
516 { 0xfe42, KEY_ENTER }, /* Windows/Start */
517 { 0xfe15, KEY_VOLUMEUP },
518 { 0xfe05, KEY_VOLUMEDOWN },
519 { 0xfe11, KEY_CHANNELUP },
520 { 0xfe09, KEY_CHANNELDOWN },
521 { 0xfe52, KEY_CAMERA },
522 { 0xfe5a, KEY_TUNER }, /* Live */
523 { 0xfe19, KEY_OPEN },
533 { 0xfe13, KEY_ANGLE }, /* Aspect */
535 { 0xfe1f, KEY_ZOOM },
536 { 0xfe43, KEY_REWIND },
537 { 0xfe47, KEY_PLAYPAUSE },
538 { 0xfe4f, KEY_FASTFORWARD },
539 { 0xfe57, KEY_MUTE },
540 { 0xfe0d, KEY_STOP },
541 { 0xfe01, KEY_RECORD },
542 { 0xfe4e, KEY_POWER },
545 static struct rc_map_table rc_map_dvico_portable_table[] = {
546 { 0xfc02, KEY_SETUP }, /* Profile */
547 { 0xfc43, KEY_POWER2 },
549 { 0xfc5a, KEY_BACK },
550 { 0xfc05, KEY_MENU },
551 { 0xfc47, KEY_INFO },
553 { 0xfc42, KEY_PREVIOUSSONG },/* Replay */
554 { 0xfc49, KEY_VOLUMEUP },
555 { 0xfc09, KEY_VOLUMEDOWN },
556 { 0xfc54, KEY_CHANNELUP },
557 { 0xfc0b, KEY_CHANNELDOWN },
558 { 0xfc16, KEY_CAMERA },
559 { 0xfc40, KEY_TUNER }, /* ATV/DTV */
560 { 0xfc45, KEY_OPEN },
570 { 0xfc44, KEY_ANGLE }, /* Aspect */
572 { 0xfc07, KEY_ZOOM },
573 { 0xfc0a, KEY_REWIND },
574 { 0xfc08, KEY_PLAYPAUSE },
575 { 0xfc4b, KEY_FASTFORWARD },
576 { 0xfc5b, KEY_MUTE },
577 { 0xfc04, KEY_STOP },
578 { 0xfc56, KEY_RECORD },
579 { 0xfc57, KEY_POWER },
580 { 0xfc41, KEY_UNKNOWN }, /* INPUT */
581 { 0xfc00, KEY_UNKNOWN }, /* HD */
584 static struct rc_map_table rc_map_d680_dmb_table[] = {
585 { 0x0038, KEY_UNKNOWN }, /* TV/AV */
586 { 0x080c, KEY_ZOOM },
597 { 0x000a, KEY_MUTE },
598 { 0x0829, KEY_BACK },
599 { 0x0012, KEY_CHANNELUP },
600 { 0x0813, KEY_CHANNELDOWN },
601 { 0x002b, KEY_VOLUMEUP },
602 { 0x082c, KEY_VOLUMEDOWN },
604 { 0x0821, KEY_DOWN },
605 { 0x0011, KEY_LEFT },
606 { 0x0810, KEY_RIGHT },
608 { 0x081f, KEY_RECORD },
609 { 0x0017, KEY_PLAYPAUSE },
610 { 0x0816, KEY_PLAYPAUSE },
611 { 0x000b, KEY_STOP },
612 { 0x0827, KEY_FASTFORWARD },
613 { 0x0026, KEY_REWIND },
614 { 0x081e, KEY_UNKNOWN }, /* Time Shift */
615 { 0x000e, KEY_UNKNOWN }, /* Snapshot */
616 { 0x082d, KEY_UNKNOWN }, /* Mouse Cursor */
617 { 0x000f, KEY_UNKNOWN }, /* Minimize/Maximize */
618 { 0x0814, KEY_UNKNOWN }, /* Shuffle */
619 { 0x0025, KEY_POWER },
622 static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
624 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x28 };
625 static u8 reset [] = { RESET, 0x80 };
626 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
627 static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 };
628 static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
629 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
631 mt352_write(fe, clock_config, sizeof(clock_config));
633 mt352_write(fe, reset, sizeof(reset));
634 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
636 mt352_write(fe, agc_cfg, sizeof(agc_cfg));
637 mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
638 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
643 static int cxusb_mt352_demod_init(struct dvb_frontend* fe)
644 { /* used in both lgz201 and th7579 */
645 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x29 };
646 static u8 reset [] = { RESET, 0x80 };
647 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
648 static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 };
649 static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
650 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
652 mt352_write(fe, clock_config, sizeof(clock_config));
654 mt352_write(fe, reset, sizeof(reset));
655 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
657 mt352_write(fe, agc_cfg, sizeof(agc_cfg));
658 mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
659 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
663 static struct cx22702_config cxusb_cx22702_config = {
664 .demod_address = 0x63,
665 .output_mode = CX22702_PARALLEL_OUTPUT,
668 static struct lgdt330x_config cxusb_lgdt3303_config = {
669 .demod_address = 0x0e,
670 .demod_chip = LGDT3303,
673 static struct lgdt330x_config cxusb_aver_lgdt3303_config = {
674 .demod_address = 0x0e,
675 .demod_chip = LGDT3303,
676 .clock_polarity_flip = 2,
679 static struct mt352_config cxusb_dee1601_config = {
680 .demod_address = 0x0f,
681 .demod_init = cxusb_dee1601_demod_init,
684 static struct zl10353_config cxusb_zl10353_dee1601_config = {
685 .demod_address = 0x0f,
689 static struct mt352_config cxusb_mt352_config = {
690 /* used in both lgz201 and th7579 */
691 .demod_address = 0x0f,
692 .demod_init = cxusb_mt352_demod_init,
695 static struct zl10353_config cxusb_zl10353_xc3028_config = {
696 .demod_address = 0x0f,
702 static struct zl10353_config cxusb_zl10353_xc3028_config_no_i2c_gate = {
703 .demod_address = 0x0f,
707 .disable_i2c_gate_ctrl = 1,
710 static struct mt352_config cxusb_mt352_xc3028_config = {
711 .demod_address = 0x0f,
714 .demod_init = cxusb_mt352_demod_init,
717 /* FIXME: needs tweaking */
718 static struct mxl5005s_config aver_a868r_tuner = {
720 .if_freq = 6000000UL,
721 .xtal_freq = CRYSTAL_FREQ_16000000HZ,
722 .agc_mode = MXL_SINGLE_AGC,
723 .tracking_filter = MXL_TF_C,
724 .rssi_enable = MXL_RSSI_ENABLE,
725 .cap_select = MXL_CAP_SEL_ENABLE,
726 .div_out = MXL_DIV_OUT_4,
727 .clock_out = MXL_CLOCK_OUT_DISABLE,
728 .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
729 .top = MXL5005S_TOP_25P2,
730 .mod_mode = MXL_DIGITAL_MODE,
731 .if_mode = MXL_ZERO_IF,
732 .AgcMasterByte = 0x00,
735 /* FIXME: needs tweaking */
736 static struct mxl5005s_config d680_dmb_tuner = {
738 .if_freq = 36125000UL,
739 .xtal_freq = CRYSTAL_FREQ_16000000HZ,
740 .agc_mode = MXL_SINGLE_AGC,
741 .tracking_filter = MXL_TF_C,
742 .rssi_enable = MXL_RSSI_ENABLE,
743 .cap_select = MXL_CAP_SEL_ENABLE,
744 .div_out = MXL_DIV_OUT_4,
745 .clock_out = MXL_CLOCK_OUT_DISABLE,
746 .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
747 .top = MXL5005S_TOP_25P2,
748 .mod_mode = MXL_DIGITAL_MODE,
749 .if_mode = MXL_ZERO_IF,
750 .AgcMasterByte = 0x00,
753 static struct max2165_config mygica_d689_max2165_cfg = {
758 /* Callbacks for DVB USB */
759 static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap)
761 dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe,
762 &adap->dev->i2c_adap, 0x61,
763 TUNER_PHILIPS_FMD1216ME_MK3);
767 static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter *adap)
769 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61,
770 NULL, DVB_PLL_THOMSON_DTT7579);
774 static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap)
776 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61, NULL, DVB_PLL_LG_Z201);
780 static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter *adap)
782 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60,
783 NULL, DVB_PLL_THOMSON_DTT7579);
787 static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap)
789 dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe,
790 &adap->dev->i2c_adap, 0x61, TUNER_LG_TDVS_H06XF);
794 static int dvico_bluebird_xc2028_callback(void *ptr, int component,
795 int command, int arg)
797 struct dvb_usb_adapter *adap = ptr;
798 struct dvb_usb_device *d = adap->dev;
801 case XC2028_TUNER_RESET:
802 deb_info("%s: XC2028_TUNER_RESET %d\n", __func__, arg);
803 cxusb_bluebird_gpio_pulse(d, 0x01, 1);
805 case XC2028_RESET_CLK:
806 deb_info("%s: XC2028_RESET_CLK %d\n", __func__, arg);
809 deb_info("%s: unknown command %d, arg %d\n", __func__,
817 static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
819 struct dvb_frontend *fe;
820 struct xc2028_config cfg = {
821 .i2c_adap = &adap->dev->i2c_adap,
824 static struct xc2028_ctrl ctl = {
825 .fname = XC2028_DEFAULT_FIRMWARE,
827 .demod = XC3028_FE_ZARLINK456,
830 /* FIXME: generalize & move to common area */
831 adap->fe_adap[0].fe->callback = dvico_bluebird_xc2028_callback;
833 fe = dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &cfg);
834 if (fe == NULL || fe->ops.tuner_ops.set_config == NULL)
837 fe->ops.tuner_ops.set_config(fe, &ctl);
842 static int cxusb_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap)
844 dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe,
845 &adap->dev->i2c_adap, &aver_a868r_tuner);
849 static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter *adap)
851 struct dvb_frontend *fe;
852 fe = dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe,
853 &adap->dev->i2c_adap, &d680_dmb_tuner);
854 return (fe == NULL) ? -EIO : 0;
857 static int cxusb_mygica_d689_tuner_attach(struct dvb_usb_adapter *adap)
859 struct dvb_frontend *fe;
860 fe = dvb_attach(max2165_attach, adap->fe_adap[0].fe,
861 &adap->dev->i2c_adap, &mygica_d689_max2165_cfg);
862 return (fe == NULL) ? -EIO : 0;
865 static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap)
868 if (usb_set_interface(adap->dev->udev, 0, 6) < 0)
869 err("set interface failed");
871 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, &b, 1);
873 adap->fe_adap[0].fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config,
874 &adap->dev->i2c_adap);
875 if ((adap->fe_adap[0].fe) != NULL)
881 static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap)
883 if (usb_set_interface(adap->dev->udev, 0, 7) < 0)
884 err("set interface failed");
886 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
888 adap->fe_adap[0].fe = dvb_attach(lgdt330x_attach,
889 &cxusb_lgdt3303_config,
890 &adap->dev->i2c_adap);
891 if ((adap->fe_adap[0].fe) != NULL)
897 static int cxusb_aver_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap)
899 adap->fe_adap[0].fe = dvb_attach(lgdt330x_attach, &cxusb_aver_lgdt3303_config,
900 &adap->dev->i2c_adap);
901 if (adap->fe_adap[0].fe != NULL)
907 static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap)
909 /* used in both lgz201 and th7579 */
910 if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
911 err("set interface failed");
913 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
915 adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_mt352_config,
916 &adap->dev->i2c_adap);
917 if ((adap->fe_adap[0].fe) != NULL)
923 static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter *adap)
925 if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
926 err("set interface failed");
928 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
930 adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_dee1601_config,
931 &adap->dev->i2c_adap);
932 if ((adap->fe_adap[0].fe) != NULL)
935 adap->fe_adap[0].fe = dvb_attach(zl10353_attach,
936 &cxusb_zl10353_dee1601_config,
937 &adap->dev->i2c_adap);
938 if ((adap->fe_adap[0].fe) != NULL)
944 static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap)
948 struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD,
949 .buf = ircode, .len = 4 };
951 if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
952 err("set interface failed");
954 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
956 /* reset the tuner and demodulator */
957 cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0);
958 cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1);
959 cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
961 adap->fe_adap[0].fe =
962 dvb_attach(zl10353_attach,
963 &cxusb_zl10353_xc3028_config_no_i2c_gate,
964 &adap->dev->i2c_adap);
965 if ((adap->fe_adap[0].fe) == NULL)
968 /* try to determine if there is no IR decoder on the I2C bus */
969 for (i = 0; adap->dev->props.rc.legacy.rc_map_table != NULL && i < 5; i++) {
971 if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1)
973 if (ircode[0] == 0 && ircode[1] == 0)
975 if (ircode[2] + ircode[3] != 0xff) {
977 adap->dev->props.rc.legacy.rc_map_table = NULL;
978 info("No IR receiver detected on this device.");
986 static struct dibx000_agc_config dib7070_agc_config = {
987 .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
990 * P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5,
991 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
992 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0
994 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) |
995 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1021 .perform_agc_softsplit = 0,
1024 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
1034 .IO_CLK_en_core = 1,
1037 /* refsel, sel, freq_15k */
1038 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
1039 .ifreq = (0 << 25) | 0,
1041 .xtal_hz = 12000000,
1044 static struct dib7000p_config cxusb_dualdig4_rev2_config = {
1045 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
1046 .output_mpeg2_in_188_bytes = 1,
1048 .agc_config_count = 1,
1049 .agc = &dib7070_agc_config,
1050 .bw = &dib7070_bw_config_12_mhz,
1051 .tuner_is_baseband = 1,
1057 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1059 .hostbus_diversity = 1,
1062 static int cxusb_dualdig4_rev2_frontend_attach(struct dvb_usb_adapter *adap)
1064 if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
1065 err("set interface failed");
1067 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
1069 cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
1071 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1072 &cxusb_dualdig4_rev2_config) < 0) {
1073 printk(KERN_WARNING "Unable to enumerate dib7000p\n");
1077 adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
1078 &cxusb_dualdig4_rev2_config);
1079 if (adap->fe_adap[0].fe == NULL)
1085 static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
1087 return dib7000p_set_gpio(fe, 8, 0, !onoff);
1090 static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
1095 static struct dib0070_config dib7070p_dib0070_config = {
1096 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1097 .reset = dib7070_tuner_reset,
1098 .sleep = dib7070_tuner_sleep,
1102 struct dib0700_adapter_state {
1103 int (*set_param_save) (struct dvb_frontend *);
1106 static int dib7070_set_param_override(struct dvb_frontend *fe)
1108 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1109 struct dvb_usb_adapter *adap = fe->dvb->priv;
1110 struct dib0700_adapter_state *state = adap->priv;
1113 u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
1115 case BAND_VHF: offset = 950; break;
1117 case BAND_UHF: offset = 550; break;
1120 dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1122 return state->set_param_save(fe);
1125 static int cxusb_dualdig4_rev2_tuner_attach(struct dvb_usb_adapter *adap)
1127 struct dib0700_adapter_state *st = adap->priv;
1128 struct i2c_adapter *tun_i2c =
1129 dib7000p_get_i2c_master(adap->fe_adap[0].fe,
1130 DIBX000_I2C_INTERFACE_TUNER, 1);
1132 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
1133 &dib7070p_dib0070_config) == NULL)
1136 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1137 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override;
1141 static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap)
1143 if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
1144 err("set interface failed");
1146 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
1148 /* reset the tuner and demodulator */
1149 cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0);
1150 cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1);
1151 cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
1153 adap->fe_adap[0].fe = dvb_attach(zl10353_attach,
1154 &cxusb_zl10353_xc3028_config,
1155 &adap->dev->i2c_adap);
1156 if ((adap->fe_adap[0].fe) != NULL)
1159 adap->fe_adap[0].fe = dvb_attach(mt352_attach,
1160 &cxusb_mt352_xc3028_config,
1161 &adap->dev->i2c_adap);
1162 if ((adap->fe_adap[0].fe) != NULL)
1168 static struct lgs8gxx_config d680_lgs8gl5_cfg = {
1169 .prod = LGS8GXX_PROD_LGS8GL5,
1170 .demod_address = 0x19,
1174 .if_clk_freq = 30400, /* 30.4 MHz */
1175 .if_freq = 5725, /* 5.725 MHz */
1182 static int cxusb_d680_dmb_frontend_attach(struct dvb_usb_adapter *adap)
1184 struct dvb_usb_device *d = adap->dev;
1187 /* Select required USB configuration */
1188 if (usb_set_interface(d->udev, 0, 0) < 0)
1189 err("set interface failed");
1191 /* Unblock all USB pipes */
1192 usb_clear_halt(d->udev,
1193 usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1194 usb_clear_halt(d->udev,
1195 usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1196 usb_clear_halt(d->udev,
1197 usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint));
1199 /* Drain USB pipes to avoid hang after reboot */
1200 for (n = 0; n < 5; n++) {
1201 cxusb_d680_dmb_drain_message(d);
1202 cxusb_d680_dmb_drain_video(d);
1206 /* Reset the tuner */
1207 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) {
1208 err("clear tuner gpio failed");
1212 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) {
1213 err("set tuner gpio failed");
1218 /* Attach frontend */
1219 adap->fe_adap[0].fe = dvb_attach(lgs8gxx_attach, &d680_lgs8gl5_cfg, &d->i2c_adap);
1220 if (adap->fe_adap[0].fe == NULL)
1226 static struct atbm8830_config mygica_d689_atbm8830_cfg = {
1227 .prod = ATBM8830_PROD_8830,
1228 .demod_address = 0x40,
1230 .ts_sampling_edge = 1,
1232 .osc_clk_freq = 30400, /* in kHz */
1233 .if_freq = 0, /* zero IF */
1240 static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap)
1242 struct dvb_usb_device *d = adap->dev;
1244 /* Select required USB configuration */
1245 if (usb_set_interface(d->udev, 0, 0) < 0)
1246 err("set interface failed");
1248 /* Unblock all USB pipes */
1249 usb_clear_halt(d->udev,
1250 usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1251 usb_clear_halt(d->udev,
1252 usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1253 usb_clear_halt(d->udev,
1254 usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint));
1257 /* Reset the tuner */
1258 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) {
1259 err("clear tuner gpio failed");
1263 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) {
1264 err("set tuner gpio failed");
1269 /* Attach frontend */
1270 adap->fe_adap[0].fe = dvb_attach(atbm8830_attach, &mygica_d689_atbm8830_cfg,
1272 if (adap->fe_adap[0].fe == NULL)
1279 * DViCO has shipped two devices with the same USB ID, but only one of them
1280 * needs a firmware download. Check the device class details to see if they
1281 * have non-default values to decide whether the device is actually cold or
1282 * not, and forget a match if it turns out we selected the wrong device.
1284 static int bluebird_fx2_identify_state(struct usb_device *udev,
1285 struct dvb_usb_device_properties *props,
1286 struct dvb_usb_device_description **desc,
1289 int wascold = *cold;
1291 *cold = udev->descriptor.bDeviceClass == 0xff &&
1292 udev->descriptor.bDeviceSubClass == 0xff &&
1293 udev->descriptor.bDeviceProtocol == 0xff;
1295 if (*cold && !wascold)
1302 * DViCO bluebird firmware needs the "warm" product ID to be patched into the
1303 * firmware file before download.
1306 static const int dvico_firmware_id_offsets[] = { 6638, 3204 };
1307 static int bluebird_patch_dvico_firmware_download(struct usb_device *udev,
1308 const struct firmware *fw)
1312 for (pos = 0; pos < ARRAY_SIZE(dvico_firmware_id_offsets); pos++) {
1313 int idoff = dvico_firmware_id_offsets[pos];
1315 if (fw->size < idoff + 4)
1318 if (fw->data[idoff] == (USB_VID_DVICO & 0xff) &&
1319 fw->data[idoff + 1] == USB_VID_DVICO >> 8) {
1320 struct firmware new_fw;
1321 u8 *new_fw_data = vmalloc(fw->size);
1327 memcpy(new_fw_data, fw->data, fw->size);
1328 new_fw.size = fw->size;
1329 new_fw.data = new_fw_data;
1331 new_fw_data[idoff + 2] =
1332 le16_to_cpu(udev->descriptor.idProduct) + 1;
1333 new_fw_data[idoff + 3] =
1334 le16_to_cpu(udev->descriptor.idProduct) >> 8;
1336 ret = usb_cypress_load_firmware(udev, &new_fw,
1346 /* DVB USB Driver stuff */
1347 static struct dvb_usb_device_properties cxusb_medion_properties;
1348 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties;
1349 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties;
1350 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties;
1351 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties;
1352 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties;
1353 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties;
1354 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties;
1355 static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties;
1356 static struct dvb_usb_device_properties cxusb_aver_a868r_properties;
1357 static struct dvb_usb_device_properties cxusb_d680_dmb_properties;
1358 static struct dvb_usb_device_properties cxusb_mygica_d689_properties;
1360 static int cxusb_probe(struct usb_interface *intf,
1361 const struct usb_device_id *id)
1363 if (0 == dvb_usb_device_init(intf, &cxusb_medion_properties,
1364 THIS_MODULE, NULL, adapter_nr) ||
1365 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgh064f_properties,
1366 THIS_MODULE, NULL, adapter_nr) ||
1367 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dee1601_properties,
1368 THIS_MODULE, NULL, adapter_nr) ||
1369 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgz201_properties,
1370 THIS_MODULE, NULL, adapter_nr) ||
1371 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dtt7579_properties,
1372 THIS_MODULE, NULL, adapter_nr) ||
1373 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dualdig4_properties,
1374 THIS_MODULE, NULL, adapter_nr) ||
1375 0 == dvb_usb_device_init(intf, &cxusb_bluebird_nano2_properties,
1376 THIS_MODULE, NULL, adapter_nr) ||
1377 0 == dvb_usb_device_init(intf,
1378 &cxusb_bluebird_nano2_needsfirmware_properties,
1379 THIS_MODULE, NULL, adapter_nr) ||
1380 0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties,
1381 THIS_MODULE, NULL, adapter_nr) ||
1382 0 == dvb_usb_device_init(intf,
1383 &cxusb_bluebird_dualdig4_rev2_properties,
1384 THIS_MODULE, NULL, adapter_nr) ||
1385 0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties,
1386 THIS_MODULE, NULL, adapter_nr) ||
1387 0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties,
1388 THIS_MODULE, NULL, adapter_nr) ||
1395 static struct usb_device_id cxusb_table [] = {
1396 { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) },
1397 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) },
1398 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) },
1399 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD) },
1400 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM) },
1401 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) },
1402 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) },
1403 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) },
1404 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) },
1405 { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD) },
1406 { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM) },
1407 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD) },
1408 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM) },
1409 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4) },
1410 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2) },
1411 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM) },
1412 { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R) },
1413 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2) },
1414 { USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB) },
1415 { USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689) },
1416 {} /* Terminating entry */
1418 MODULE_DEVICE_TABLE (usb, cxusb_table);
1420 static struct dvb_usb_device_properties cxusb_medion_properties = {
1421 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1423 .usb_ctrl = CYPRESS_FX2,
1425 .size_of_priv = sizeof(struct cxusb_state),
1432 .streaming_ctrl = cxusb_streaming_ctrl,
1433 .frontend_attach = cxusb_cx22702_frontend_attach,
1434 .tuner_attach = cxusb_fmd1216me_tuner_attach,
1435 /* parameter for the MPEG2-data transfer */
1449 .power_ctrl = cxusb_power_ctrl,
1451 .i2c_algo = &cxusb_i2c_algo,
1453 .generic_bulk_ctrl_endpoint = 0x01,
1455 .num_device_descs = 1,
1457 { "Medion MD95700 (MDUSBTV-HYBRID)",
1459 { &cxusb_table[0], NULL },
1464 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = {
1465 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1467 .usb_ctrl = DEVICE_SPECIFIC,
1468 .firmware = "dvb-usb-bluebird-01.fw",
1469 .download_firmware = bluebird_patch_dvico_firmware_download,
1470 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1471 use usb alt setting 7 for EP2 transfer (atsc) */
1473 .size_of_priv = sizeof(struct cxusb_state),
1480 .streaming_ctrl = cxusb_streaming_ctrl,
1481 .frontend_attach = cxusb_lgdt3303_frontend_attach,
1482 .tuner_attach = cxusb_lgh064f_tuner_attach,
1484 /* parameter for the MPEG2-data transfer */
1499 .power_ctrl = cxusb_bluebird_power_ctrl,
1501 .i2c_algo = &cxusb_i2c_algo,
1505 .rc_map_table = rc_map_dvico_portable_table,
1506 .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
1507 .rc_query = cxusb_rc_query,
1510 .generic_bulk_ctrl_endpoint = 0x01,
1512 .num_device_descs = 1,
1514 { "DViCO FusionHDTV5 USB Gold",
1515 { &cxusb_table[1], NULL },
1516 { &cxusb_table[2], NULL },
1521 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = {
1522 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1524 .usb_ctrl = DEVICE_SPECIFIC,
1525 .firmware = "dvb-usb-bluebird-01.fw",
1526 .download_firmware = bluebird_patch_dvico_firmware_download,
1527 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1528 use usb alt setting 7 for EP2 transfer (atsc) */
1530 .size_of_priv = sizeof(struct cxusb_state),
1537 .streaming_ctrl = cxusb_streaming_ctrl,
1538 .frontend_attach = cxusb_dee1601_frontend_attach,
1539 .tuner_attach = cxusb_dee1601_tuner_attach,
1540 /* parameter for the MPEG2-data transfer */
1555 .power_ctrl = cxusb_bluebird_power_ctrl,
1557 .i2c_algo = &cxusb_i2c_algo,
1561 .rc_map_table = rc_map_dvico_mce_table,
1562 .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table),
1563 .rc_query = cxusb_rc_query,
1566 .generic_bulk_ctrl_endpoint = 0x01,
1568 .num_device_descs = 3,
1570 { "DViCO FusionHDTV DVB-T Dual USB",
1571 { &cxusb_table[3], NULL },
1572 { &cxusb_table[4], NULL },
1574 { "DigitalNow DVB-T Dual USB",
1575 { &cxusb_table[9], NULL },
1576 { &cxusb_table[10], NULL },
1578 { "DViCO FusionHDTV DVB-T Dual Digital 2",
1579 { &cxusb_table[11], NULL },
1580 { &cxusb_table[12], NULL },
1585 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = {
1586 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1588 .usb_ctrl = DEVICE_SPECIFIC,
1589 .firmware = "dvb-usb-bluebird-01.fw",
1590 .download_firmware = bluebird_patch_dvico_firmware_download,
1591 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1592 use usb alt setting 7 for EP2 transfer (atsc) */
1594 .size_of_priv = sizeof(struct cxusb_state),
1601 .streaming_ctrl = cxusb_streaming_ctrl,
1602 .frontend_attach = cxusb_mt352_frontend_attach,
1603 .tuner_attach = cxusb_lgz201_tuner_attach,
1605 /* parameter for the MPEG2-data transfer */
1619 .power_ctrl = cxusb_bluebird_power_ctrl,
1621 .i2c_algo = &cxusb_i2c_algo,
1625 .rc_map_table = rc_map_dvico_portable_table,
1626 .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
1627 .rc_query = cxusb_rc_query,
1630 .generic_bulk_ctrl_endpoint = 0x01,
1631 .num_device_descs = 1,
1633 { "DViCO FusionHDTV DVB-T USB (LGZ201)",
1634 { &cxusb_table[5], NULL },
1635 { &cxusb_table[6], NULL },
1640 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = {
1641 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1643 .usb_ctrl = DEVICE_SPECIFIC,
1644 .firmware = "dvb-usb-bluebird-01.fw",
1645 .download_firmware = bluebird_patch_dvico_firmware_download,
1646 /* use usb alt setting 0 for EP4 transfer (dvb-t),
1647 use usb alt setting 7 for EP2 transfer (atsc) */
1649 .size_of_priv = sizeof(struct cxusb_state),
1656 .streaming_ctrl = cxusb_streaming_ctrl,
1657 .frontend_attach = cxusb_mt352_frontend_attach,
1658 .tuner_attach = cxusb_dtt7579_tuner_attach,
1660 /* parameter for the MPEG2-data transfer */
1674 .power_ctrl = cxusb_bluebird_power_ctrl,
1676 .i2c_algo = &cxusb_i2c_algo,
1680 .rc_map_table = rc_map_dvico_portable_table,
1681 .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
1682 .rc_query = cxusb_rc_query,
1685 .generic_bulk_ctrl_endpoint = 0x01,
1687 .num_device_descs = 1,
1689 { "DViCO FusionHDTV DVB-T USB (TH7579)",
1690 { &cxusb_table[7], NULL },
1691 { &cxusb_table[8], NULL },
1696 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = {
1697 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1699 .usb_ctrl = CYPRESS_FX2,
1701 .size_of_priv = sizeof(struct cxusb_state),
1708 .streaming_ctrl = cxusb_streaming_ctrl,
1709 .frontend_attach = cxusb_dualdig4_frontend_attach,
1710 .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
1711 /* parameter for the MPEG2-data transfer */
1726 .power_ctrl = cxusb_power_ctrl,
1728 .i2c_algo = &cxusb_i2c_algo,
1730 .generic_bulk_ctrl_endpoint = 0x01,
1734 .rc_map_table = rc_map_dvico_mce_table,
1735 .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table),
1736 .rc_query = cxusb_bluebird2_rc_query,
1739 .num_device_descs = 1,
1741 { "DViCO FusionHDTV DVB-T Dual Digital 4",
1743 { &cxusb_table[13], NULL },
1748 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = {
1749 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1751 .usb_ctrl = CYPRESS_FX2,
1752 .identify_state = bluebird_fx2_identify_state,
1754 .size_of_priv = sizeof(struct cxusb_state),
1761 .streaming_ctrl = cxusb_streaming_ctrl,
1762 .frontend_attach = cxusb_nano2_frontend_attach,
1763 .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
1764 /* parameter for the MPEG2-data transfer */
1779 .power_ctrl = cxusb_nano2_power_ctrl,
1781 .i2c_algo = &cxusb_i2c_algo,
1783 .generic_bulk_ctrl_endpoint = 0x01,
1787 .rc_map_table = rc_map_dvico_portable_table,
1788 .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
1789 .rc_query = cxusb_bluebird2_rc_query,
1792 .num_device_descs = 1,
1794 { "DViCO FusionHDTV DVB-T NANO2",
1796 { &cxusb_table[14], NULL },
1801 static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties = {
1802 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1804 .usb_ctrl = DEVICE_SPECIFIC,
1805 .firmware = "dvb-usb-bluebird-02.fw",
1806 .download_firmware = bluebird_patch_dvico_firmware_download,
1807 .identify_state = bluebird_fx2_identify_state,
1809 .size_of_priv = sizeof(struct cxusb_state),
1816 .streaming_ctrl = cxusb_streaming_ctrl,
1817 .frontend_attach = cxusb_nano2_frontend_attach,
1818 .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
1819 /* parameter for the MPEG2-data transfer */
1834 .power_ctrl = cxusb_nano2_power_ctrl,
1836 .i2c_algo = &cxusb_i2c_algo,
1838 .generic_bulk_ctrl_endpoint = 0x01,
1842 .rc_map_table = rc_map_dvico_portable_table,
1843 .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table),
1844 .rc_query = cxusb_rc_query,
1847 .num_device_descs = 1,
1849 { "DViCO FusionHDTV DVB-T NANO2 w/o firmware",
1850 { &cxusb_table[14], NULL },
1851 { &cxusb_table[15], NULL },
1856 static struct dvb_usb_device_properties cxusb_aver_a868r_properties = {
1857 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1859 .usb_ctrl = CYPRESS_FX2,
1861 .size_of_priv = sizeof(struct cxusb_state),
1868 .streaming_ctrl = cxusb_aver_streaming_ctrl,
1869 .frontend_attach = cxusb_aver_lgdt3303_frontend_attach,
1870 .tuner_attach = cxusb_mxl5003s_tuner_attach,
1871 /* parameter for the MPEG2-data transfer */
1885 .power_ctrl = cxusb_aver_power_ctrl,
1887 .i2c_algo = &cxusb_i2c_algo,
1889 .generic_bulk_ctrl_endpoint = 0x01,
1891 .num_device_descs = 1,
1893 { "AVerMedia AVerTVHD Volar (A868R)",
1895 { &cxusb_table[16], NULL },
1901 struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = {
1902 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1904 .usb_ctrl = CYPRESS_FX2,
1906 .size_of_priv = sizeof(struct cxusb_state),
1911 .size_of_priv = sizeof(struct dib0700_adapter_state),
1914 .streaming_ctrl = cxusb_streaming_ctrl,
1915 .frontend_attach = cxusb_dualdig4_rev2_frontend_attach,
1916 .tuner_attach = cxusb_dualdig4_rev2_tuner_attach,
1917 /* parameter for the MPEG2-data transfer */
1932 .power_ctrl = cxusb_bluebird_power_ctrl,
1934 .i2c_algo = &cxusb_i2c_algo,
1936 .generic_bulk_ctrl_endpoint = 0x01,
1940 .rc_map_table = rc_map_dvico_mce_table,
1941 .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table),
1942 .rc_query = cxusb_rc_query,
1945 .num_device_descs = 1,
1947 { "DViCO FusionHDTV DVB-T Dual Digital 4 (rev 2)",
1949 { &cxusb_table[17], NULL },
1954 static struct dvb_usb_device_properties cxusb_d680_dmb_properties = {
1955 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1957 .usb_ctrl = CYPRESS_FX2,
1959 .size_of_priv = sizeof(struct cxusb_state),
1966 .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl,
1967 .frontend_attach = cxusb_d680_dmb_frontend_attach,
1968 .tuner_attach = cxusb_d680_dmb_tuner_attach,
1970 /* parameter for the MPEG2-data transfer */
1985 .power_ctrl = cxusb_d680_dmb_power_ctrl,
1987 .i2c_algo = &cxusb_i2c_algo,
1989 .generic_bulk_ctrl_endpoint = 0x01,
1993 .rc_map_table = rc_map_d680_dmb_table,
1994 .rc_map_size = ARRAY_SIZE(rc_map_d680_dmb_table),
1995 .rc_query = cxusb_d680_dmb_rc_query,
1998 .num_device_descs = 1,
2001 "Conexant DMB-TH Stick",
2003 { &cxusb_table[18], NULL },
2008 static struct dvb_usb_device_properties cxusb_mygica_d689_properties = {
2009 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
2011 .usb_ctrl = CYPRESS_FX2,
2013 .size_of_priv = sizeof(struct cxusb_state),
2020 .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl,
2021 .frontend_attach = cxusb_mygica_d689_frontend_attach,
2022 .tuner_attach = cxusb_mygica_d689_tuner_attach,
2024 /* parameter for the MPEG2-data transfer */
2039 .power_ctrl = cxusb_d680_dmb_power_ctrl,
2041 .i2c_algo = &cxusb_i2c_algo,
2043 .generic_bulk_ctrl_endpoint = 0x01,
2047 .rc_map_table = rc_map_d680_dmb_table,
2048 .rc_map_size = ARRAY_SIZE(rc_map_d680_dmb_table),
2049 .rc_query = cxusb_d680_dmb_rc_query,
2052 .num_device_descs = 1,
2055 "Mygica D689 DMB-TH",
2057 { &cxusb_table[19], NULL },
2062 static struct usb_driver cxusb_driver = {
2063 .name = "dvb_usb_cxusb",
2064 .probe = cxusb_probe,
2065 .disconnect = dvb_usb_device_exit,
2066 .id_table = cxusb_table,
2069 module_usb_driver(cxusb_driver);
2071 MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
2072 MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
2073 MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
2074 MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
2075 MODULE_VERSION("1.0-alpha");
2076 MODULE_LICENSE("GPL");