1 // SPDX-License-Identifier: GPL-2.0-only
2 /* DVB USB compliant linux driver for Conexant USB reference design.
4 * The Conexant reference design I saw on their website was only for analogue
5 * capturing (using the cx25842). The box I took to write this driver (reverse
6 * engineered) is the one labeled Medion MD95700. In addition to the cx25842
7 * for analogue capturing it also has a cx22702 DVB-T demodulator on the main
8 * board. Besides it has a atiremote (X10) and a USB2.0 hub onboard.
10 * Maybe it is a little bit premature to call this driver cxusb, but I assume
11 * the USB protocol is identical or at least inherited from the reference
12 * design, so it can be reused for the "analogue-only" device (if it will
16 * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@posteo.de)
17 * Copyright (C) 2006 Michael Krufky (mkrufky@linuxtv.org)
18 * Copyright (C) 2006, 2007 Chris Pascoe (c.pascoe@itee.uq.edu.au)
19 * Copyright (C) 2011, 2017 Maciej S. Szmigiero (mail@maciej.szmigiero.name)
21 * see Documentation/media/dvb-drivers/dvb-usb.rst for more information
23 #include <media/tuner.h>
24 #include <linux/delay.h>
25 #include <linux/device.h>
26 #include <linux/kernel.h>
27 #include <linux/slab.h>
28 #include <linux/string.h>
29 #include <linux/vmalloc.h>
36 #include "mt352_priv.h"
38 #include "tuner-xc2028.h"
39 #include "tuner-simple.h"
50 int dvb_usb_cxusb_debug;
51 module_param_named(debug, dvb_usb_cxusb_debug, int, 0644);
52 MODULE_PARM_DESC(debug, "set debugging level (see cxusb.h)."
53 DVB_USB_DEBUG_STATUS);
55 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
57 #define deb_info(args...) dprintk(dvb_usb_cxusb_debug, CXUSB_DBG_MISC, args)
58 #define deb_i2c(args...) dprintk(dvb_usb_cxusb_debug, CXUSB_DBG_I2C, args)
60 enum cxusb_table_index {
62 DVICO_BLUEBIRD_LG064F_COLD,
63 DVICO_BLUEBIRD_LG064F_WARM,
64 DVICO_BLUEBIRD_DUAL_1_COLD,
65 DVICO_BLUEBIRD_DUAL_1_WARM,
66 DVICO_BLUEBIRD_LGZ201_COLD,
67 DVICO_BLUEBIRD_LGZ201_WARM,
68 DVICO_BLUEBIRD_TH7579_COLD,
69 DVICO_BLUEBIRD_TH7579_WARM,
70 DIGITALNOW_BLUEBIRD_DUAL_1_COLD,
71 DIGITALNOW_BLUEBIRD_DUAL_1_WARM,
72 DVICO_BLUEBIRD_DUAL_2_COLD,
73 DVICO_BLUEBIRD_DUAL_2_WARM,
74 DVICO_BLUEBIRD_DUAL_4,
75 DVICO_BLUEBIRD_DVB_T_NANO_2,
76 DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM,
77 AVERMEDIA_VOLAR_A868R,
78 DVICO_BLUEBIRD_DUAL_4_REV_2,
85 static struct usb_device_id cxusb_table[];
87 int cxusb_ctrl_msg(struct dvb_usb_device *d,
88 u8 cmd, const u8 *wbuf, int wlen, u8 *rbuf, int rlen)
90 struct cxusb_state *st = d->priv;
93 if (1 + wlen > MAX_XFER_SIZE) {
94 warn("i2c wr: len=%d is too big!\n", wlen);
98 if (rlen > MAX_XFER_SIZE) {
99 warn("i2c rd: len=%d is too big!\n", rlen);
103 mutex_lock(&d->data_mutex);
105 memcpy(&st->data[1], wbuf, wlen);
106 ret = dvb_usb_generic_rw(d, st->data, 1 + wlen, st->data, rlen, 0);
107 if (!ret && rbuf && rlen)
108 memcpy(rbuf, st->data, rlen);
110 mutex_unlock(&d->data_mutex);
115 static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff)
117 struct cxusb_state *st = d->priv;
120 if (st->gpio_write_state[GPIO_TUNER] == onoff &&
121 !st->gpio_write_refresh[GPIO_TUNER])
126 cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1);
129 deb_info("gpio_write failed.\n");
131 st->gpio_write_state[GPIO_TUNER] = onoff;
132 st->gpio_write_refresh[GPIO_TUNER] = false;
135 static int cxusb_bluebird_gpio_rw(struct dvb_usb_device *d, u8 changemask,
141 o[0] = 0xff & ~changemask; /* mask of bits to keep */
142 o[1] = newval & changemask; /* new values for bits */
144 rc = cxusb_ctrl_msg(d, CMD_BLUEBIRD_GPIO_RW, o, 2, &gpio_state, 1);
145 if (rc < 0 || (gpio_state & changemask) != (newval & changemask))
146 deb_info("bluebird_gpio_write failed.\n");
148 return rc < 0 ? rc : gpio_state;
151 static void cxusb_bluebird_gpio_pulse(struct dvb_usb_device *d, u8 pin, int low)
153 cxusb_bluebird_gpio_rw(d, pin, low ? 0 : pin);
155 cxusb_bluebird_gpio_rw(d, pin, low ? pin : 0);
158 static void cxusb_nano2_led(struct dvb_usb_device *d, int onoff)
160 cxusb_bluebird_gpio_rw(d, 0x40, onoff ? 0 : 0x40);
163 static int cxusb_d680_dmb_gpio_tuner(struct dvb_usb_device *d,
166 u8 o[2] = {addr, onoff};
170 rc = cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1);
178 deb_info("gpio_write failed.\n");
183 static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
186 struct dvb_usb_device *d = i2c_get_adapdata(adap);
190 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
193 for (i = 0; i < num; i++) {
194 if (le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_MEDION)
195 switch (msg[i].addr) {
197 cxusb_gpio_tuner(d, 0);
200 cxusb_gpio_tuner(d, 1);
204 if (msg[i].flags & I2C_M_RD) {
206 u8 obuf[3], ibuf[MAX_XFER_SIZE];
208 if (1 + msg[i].len > sizeof(ibuf)) {
209 warn("i2c rd: len=%d is too big!\n",
215 obuf[1] = msg[i].len;
216 obuf[2] = msg[i].addr;
217 if (cxusb_ctrl_msg(d, CMD_I2C_READ,
219 ibuf, 1 + msg[i].len) < 0) {
220 warn("i2c read failed");
223 memcpy(msg[i].buf, &ibuf[1], msg[i].len);
224 } else if (i + 1 < num && (msg[i + 1].flags & I2C_M_RD) &&
225 msg[i].addr == msg[i + 1].addr) {
226 /* write to then read from same address */
227 u8 obuf[MAX_XFER_SIZE], ibuf[MAX_XFER_SIZE];
229 if (3 + msg[i].len > sizeof(obuf)) {
230 warn("i2c wr: len=%d is too big!\n",
235 if (1 + msg[i + 1].len > sizeof(ibuf)) {
236 warn("i2c rd: len=%d is too big!\n",
241 obuf[0] = msg[i].len;
242 obuf[1] = msg[i + 1].len;
243 obuf[2] = msg[i].addr;
244 memcpy(&obuf[3], msg[i].buf, msg[i].len);
246 if (cxusb_ctrl_msg(d, CMD_I2C_READ,
247 obuf, 3 + msg[i].len,
248 ibuf, 1 + msg[i + 1].len) < 0)
252 deb_i2c("i2c read may have failed\n");
254 memcpy(msg[i + 1].buf, &ibuf[1], msg[i + 1].len);
259 u8 obuf[MAX_XFER_SIZE], ibuf;
261 if (2 + msg[i].len > sizeof(obuf)) {
262 warn("i2c wr: len=%d is too big!\n",
267 obuf[0] = msg[i].addr;
268 obuf[1] = msg[i].len;
269 memcpy(&obuf[2], msg[i].buf, msg[i].len);
271 if (cxusb_ctrl_msg(d, CMD_I2C_WRITE, obuf,
272 2 + msg[i].len, &ibuf, 1) < 0)
275 deb_i2c("i2c write may have failed\n");
285 mutex_unlock(&d->i2c_mutex);
289 static u32 cxusb_i2c_func(struct i2c_adapter *adapter)
291 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
294 static struct i2c_algorithm cxusb_i2c_algo = {
295 .master_xfer = cxusb_i2c_xfer,
296 .functionality = cxusb_i2c_func,
299 static int _cxusb_power_ctrl(struct dvb_usb_device *d, int onoff)
303 deb_info("setting power %s\n", onoff ? "ON" : "OFF");
306 return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0);
308 return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0);
311 static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff)
313 bool is_medion = d->props.devices[0].warm_ids[0] == &cxusb_table[MEDION_MD95700];
316 if (is_medion && !onoff) {
317 struct cxusb_medion_dev *cxdev = d->priv;
319 mutex_lock(&cxdev->open_lock);
321 if (cxdev->open_type == CXUSB_OPEN_ANALOG) {
322 deb_info("preventing DVB core from setting power OFF while we are in analog mode\n");
328 ret = _cxusb_power_ctrl(d, onoff);
331 if (is_medion && !onoff) {
332 struct cxusb_medion_dev *cxdev = d->priv;
334 mutex_unlock(&cxdev->open_lock);
340 static int cxusb_aver_power_ctrl(struct dvb_usb_device *d, int onoff)
345 return cxusb_ctrl_msg(d, CMD_POWER_OFF, NULL, 0, NULL, 0);
346 if (d->state == DVB_USB_STATE_INIT &&
347 usb_set_interface(d->udev, 0, 0) < 0)
348 err("set interface failed");
351 } while (!(ret = cxusb_ctrl_msg(d, CMD_POWER_ON, NULL, 0, NULL, 0)) &&
352 !(ret = cxusb_ctrl_msg(d, 0x15, NULL, 0, NULL, 0)) &&
353 !(ret = cxusb_ctrl_msg(d, 0x17, NULL, 0, NULL, 0)) && 0);
357 * FIXME: We don't know why, but we need to configure the
358 * lgdt3303 with the register settings below on resume
362 static const u8 bufs[] = {
363 0x0e, 0x2, 0x00, 0x7f,
364 0x0e, 0x2, 0x02, 0xfe,
365 0x0e, 0x2, 0x02, 0x01,
366 0x0e, 0x2, 0x00, 0x03,
367 0x0e, 0x2, 0x0d, 0x40,
368 0x0e, 0x2, 0x0e, 0x87,
369 0x0e, 0x2, 0x0f, 0x8e,
370 0x0e, 0x2, 0x10, 0x01,
371 0x0e, 0x2, 0x14, 0xd7,
372 0x0e, 0x2, 0x47, 0x88,
375 for (i = 0; i < ARRAY_SIZE(bufs); i += 4 / sizeof(u8)) {
376 ret = cxusb_ctrl_msg(d, CMD_I2C_WRITE,
377 bufs + i, 4, &buf, 1);
387 static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff)
392 return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0);
397 static int cxusb_nano2_power_ctrl(struct dvb_usb_device *d, int onoff)
401 rc = cxusb_power_ctrl(d, onoff);
403 cxusb_nano2_led(d, 0);
408 static int cxusb_d680_dmb_power_ctrl(struct dvb_usb_device *d, int onoff)
413 ret = cxusb_power_ctrl(d, onoff);
418 cxusb_ctrl_msg(d, CMD_DIGITAL, NULL, 0, &b, 1);
423 static int cxusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
425 struct dvb_usb_device *dvbdev = adap->dev;
426 bool is_medion = dvbdev->props.devices[0].warm_ids[0] ==
427 &cxusb_table[MEDION_MD95700];
428 u8 buf[2] = { 0x03, 0x00 };
430 if (is_medion && onoff) {
433 ret = cxusb_medion_get(dvbdev, CXUSB_OPEN_DIGITAL);
439 cxusb_ctrl_msg(dvbdev, CMD_STREAMING_ON, buf, 2, NULL, 0);
441 cxusb_ctrl_msg(dvbdev, CMD_STREAMING_OFF, NULL, 0, NULL, 0);
443 if (is_medion && !onoff)
444 cxusb_medion_put(dvbdev);
449 static int cxusb_aver_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
452 cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_ON, NULL, 0, NULL, 0);
454 cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_OFF,
459 static int cxusb_read_status(struct dvb_frontend *fe,
460 enum fe_status *status)
462 struct dvb_usb_adapter *adap = (struct dvb_usb_adapter *)fe->dvb->priv;
463 struct cxusb_state *state = (struct cxusb_state *)adap->dev->priv;
466 ret = state->fe_read_status(fe, status);
468 /* it need resync slave fifo when signal change from unlock to lock.*/
469 if ((*status & FE_HAS_LOCK) && (!state->last_lock)) {
470 mutex_lock(&state->stream_mutex);
471 cxusb_streaming_ctrl(adap, 1);
472 mutex_unlock(&state->stream_mutex);
475 state->last_lock = (*status & FE_HAS_LOCK) ? 1 : 0;
479 static void cxusb_d680_dmb_drain_message(struct dvb_usb_device *d)
481 int ep = d->props.generic_bulk_ctrl_endpoint;
482 const int timeout = 100;
483 const int junk_len = 32;
487 /* Discard remaining data in video pipe */
488 junk = kmalloc(junk_len, GFP_KERNEL);
492 if (usb_bulk_msg(d->udev,
493 usb_rcvbulkpipe(d->udev, ep),
494 junk, junk_len, &rd_count, timeout) < 0)
502 static void cxusb_d680_dmb_drain_video(struct dvb_usb_device *d)
504 struct usb_data_stream_properties *p = &d->props.adapter[0].fe[0].stream;
505 const int timeout = 100;
506 const int junk_len = p->u.bulk.buffersize;
510 /* Discard remaining data in video pipe */
511 junk = kmalloc(junk_len, GFP_KERNEL);
515 if (usb_bulk_msg(d->udev,
516 usb_rcvbulkpipe(d->udev, p->endpoint),
517 junk, junk_len, &rd_count, timeout) < 0)
525 static int cxusb_d680_dmb_streaming_ctrl(struct dvb_usb_adapter *adap,
529 u8 buf[2] = { 0x03, 0x00 };
531 cxusb_d680_dmb_drain_video(adap->dev);
532 return cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON,
533 buf, sizeof(buf), NULL, 0);
535 int ret = cxusb_ctrl_msg(adap->dev,
536 CMD_STREAMING_OFF, NULL, 0, NULL, 0);
541 static int cxusb_rc_query(struct dvb_usb_device *d)
545 cxusb_ctrl_msg(d, CMD_GET_IR_CODE, NULL, 0, ircode, 4);
547 if (ircode[2] || ircode[3])
548 rc_keydown(d->rc_dev, RC_PROTO_NEC,
549 RC_SCANCODE_NEC(~ircode[2] & 0xff, ircode[3]), 0);
553 static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d)
556 struct i2c_msg msg = {
563 if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1)
566 if (ircode[1] || ircode[2])
567 rc_keydown(d->rc_dev, RC_PROTO_NEC,
568 RC_SCANCODE_NEC(~ircode[1] & 0xff, ircode[2]), 0);
572 static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d)
576 if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0)
579 if (ircode[0] || ircode[1])
580 rc_keydown(d->rc_dev, RC_PROTO_UNKNOWN,
581 RC_SCANCODE_RC5(ircode[0], ircode[1]), 0);
585 static int cxusb_dee1601_demod_init(struct dvb_frontend *fe)
587 static u8 clock_config[] = { CLOCK_CTL, 0x38, 0x28 };
588 static u8 reset[] = { RESET, 0x80 };
589 static u8 adc_ctl_1_cfg[] = { ADC_CTL_1, 0x40 };
590 static u8 agc_cfg[] = { AGC_TARGET, 0x28, 0x20 };
591 static u8 gpp_ctl_cfg[] = { GPP_CTL, 0x33 };
592 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
594 mt352_write(fe, clock_config, sizeof(clock_config));
596 mt352_write(fe, reset, sizeof(reset));
597 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
599 mt352_write(fe, agc_cfg, sizeof(agc_cfg));
600 mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
601 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
606 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_chip = LGDT3303,
636 static struct lgdt330x_config cxusb_aver_lgdt3303_config = {
637 .demod_chip = LGDT3303,
638 .clock_polarity_flip = 2,
641 static struct mt352_config cxusb_dee1601_config = {
642 .demod_address = 0x0f,
643 .demod_init = cxusb_dee1601_demod_init,
646 static struct zl10353_config cxusb_zl10353_dee1601_config = {
647 .demod_address = 0x0f,
651 static struct mt352_config cxusb_mt352_config = {
652 /* used in both lgz201 and th7579 */
653 .demod_address = 0x0f,
654 .demod_init = cxusb_mt352_demod_init,
657 static struct zl10353_config cxusb_zl10353_xc3028_config = {
658 .demod_address = 0x0f,
664 static struct zl10353_config cxusb_zl10353_xc3028_config_no_i2c_gate = {
665 .demod_address = 0x0f,
669 .disable_i2c_gate_ctrl = 1,
672 static struct mt352_config cxusb_mt352_xc3028_config = {
673 .demod_address = 0x0f,
676 .demod_init = cxusb_mt352_demod_init,
679 /* FIXME: needs tweaking */
680 static struct mxl5005s_config aver_a868r_tuner = {
682 .if_freq = 6000000UL,
683 .xtal_freq = CRYSTAL_FREQ_16000000HZ,
684 .agc_mode = MXL_SINGLE_AGC,
685 .tracking_filter = MXL_TF_C,
686 .rssi_enable = MXL_RSSI_ENABLE,
687 .cap_select = MXL_CAP_SEL_ENABLE,
688 .div_out = MXL_DIV_OUT_4,
689 .clock_out = MXL_CLOCK_OUT_DISABLE,
690 .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
691 .top = MXL5005S_TOP_25P2,
692 .mod_mode = MXL_DIGITAL_MODE,
693 .if_mode = MXL_ZERO_IF,
694 .AgcMasterByte = 0x00,
697 /* FIXME: needs tweaking */
698 static struct mxl5005s_config d680_dmb_tuner = {
700 .if_freq = 36125000UL,
701 .xtal_freq = CRYSTAL_FREQ_16000000HZ,
702 .agc_mode = MXL_SINGLE_AGC,
703 .tracking_filter = MXL_TF_C,
704 .rssi_enable = MXL_RSSI_ENABLE,
705 .cap_select = MXL_CAP_SEL_ENABLE,
706 .div_out = MXL_DIV_OUT_4,
707 .clock_out = MXL_CLOCK_OUT_DISABLE,
708 .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
709 .top = MXL5005S_TOP_25P2,
710 .mod_mode = MXL_DIGITAL_MODE,
711 .if_mode = MXL_ZERO_IF,
712 .AgcMasterByte = 0x00,
715 static struct max2165_config mygica_d689_max2165_cfg = {
720 /* Callbacks for DVB USB */
721 static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap)
723 struct dvb_usb_device *dvbdev = adap->dev;
724 bool is_medion = dvbdev->props.devices[0].warm_ids[0] ==
725 &cxusb_table[MEDION_MD95700];
727 dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe,
728 &dvbdev->i2c_adap, 0x61,
729 TUNER_PHILIPS_FMD1216ME_MK3);
731 if (is_medion && adap->fe_adap[0].fe)
733 * make sure that DVB core won't put to sleep (reset, really)
734 * tuner when we might be open in analog mode
736 adap->fe_adap[0].fe->ops.tuner_ops.sleep = NULL;
741 static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter *adap)
743 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61,
744 NULL, DVB_PLL_THOMSON_DTT7579);
748 static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap)
750 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61,
751 NULL, DVB_PLL_LG_Z201);
755 static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter *adap)
757 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60,
758 NULL, DVB_PLL_THOMSON_DTT7579);
762 static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap)
764 dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe,
765 &adap->dev->i2c_adap, 0x61, TUNER_LG_TDVS_H06XF);
769 static int dvico_bluebird_xc2028_callback(void *ptr, int component,
770 int command, int arg)
772 struct dvb_usb_adapter *adap = ptr;
773 struct dvb_usb_device *d = adap->dev;
776 case XC2028_TUNER_RESET:
777 deb_info("%s: XC2028_TUNER_RESET %d\n", __func__, arg);
778 cxusb_bluebird_gpio_pulse(d, 0x01, 1);
780 case XC2028_RESET_CLK:
781 deb_info("%s: XC2028_RESET_CLK %d\n", __func__, arg);
783 case XC2028_I2C_FLUSH:
786 deb_info("%s: unknown command %d, arg %d\n", __func__,
794 static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
796 struct dvb_frontend *fe;
797 struct xc2028_config cfg = {
798 .i2c_adap = &adap->dev->i2c_adap,
801 static struct xc2028_ctrl ctl = {
802 .fname = "/*(DEBLOBBED)*/",
804 .demod = XC3028_FE_ZARLINK456,
807 /* FIXME: generalize & move to common area */
808 adap->fe_adap[0].fe->callback = dvico_bluebird_xc2028_callback;
810 fe = dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &cfg);
811 if (!fe || !fe->ops.tuner_ops.set_config)
814 fe->ops.tuner_ops.set_config(fe, &ctl);
819 static int cxusb_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap)
821 dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe,
822 &adap->dev->i2c_adap, &aver_a868r_tuner);
826 static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter *adap)
828 struct dvb_frontend *fe;
830 fe = dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe,
831 &adap->dev->i2c_adap, &d680_dmb_tuner);
832 return (!fe) ? -EIO : 0;
835 static int cxusb_mygica_d689_tuner_attach(struct dvb_usb_adapter *adap)
837 struct dvb_frontend *fe;
839 fe = dvb_attach(max2165_attach, adap->fe_adap[0].fe,
840 &adap->dev->i2c_adap, &mygica_d689_max2165_cfg);
841 return (!fe) ? -EIO : 0;
844 static int cxusb_medion_fe_ts_bus_ctrl(struct dvb_frontend *fe, int acquire)
846 struct dvb_usb_adapter *adap = fe->dvb->priv;
847 struct dvb_usb_device *dvbdev = adap->dev;
850 return cxusb_medion_get(dvbdev, CXUSB_OPEN_DIGITAL);
852 cxusb_medion_put(dvbdev);
857 static int cxusb_medion_set_mode(struct dvb_usb_device *dvbdev, bool digital)
859 struct cxusb_state *st = dvbdev->priv;
865 * switching mode while doing an I2C transaction often causes
866 * the device to crash
868 mutex_lock(&dvbdev->i2c_mutex);
871 ret = usb_set_interface(dvbdev->udev, 0, 6);
873 dev_err(&dvbdev->udev->dev,
874 "digital interface selection failed (%d)\n",
879 ret = usb_set_interface(dvbdev->udev, 0, 1);
881 dev_err(&dvbdev->udev->dev,
882 "analog interface selection failed (%d)\n",
888 /* pipes need to be cleared after setting interface */
889 ret = usb_clear_halt(dvbdev->udev, usb_rcvbulkpipe(dvbdev->udev, 1));
891 dev_warn(&dvbdev->udev->dev,
892 "clear halt on IN pipe failed (%d)\n",
895 ret = usb_clear_halt(dvbdev->udev, usb_sndbulkpipe(dvbdev->udev, 1));
897 dev_warn(&dvbdev->udev->dev,
898 "clear halt on OUT pipe failed (%d)\n",
901 ret = cxusb_ctrl_msg(dvbdev, digital ? CMD_DIGITAL : CMD_ANALOG,
904 dev_err(&dvbdev->udev->dev, "mode switch failed (%d)\n",
909 /* mode switch seems to reset GPIO states */
910 for (i = 0; i < ARRAY_SIZE(st->gpio_write_refresh); i++)
911 st->gpio_write_refresh[i] = true;
914 mutex_unlock(&dvbdev->i2c_mutex);
919 static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap)
921 struct dvb_usb_device *dvbdev = adap->dev;
922 bool is_medion = dvbdev->props.devices[0].warm_ids[0] ==
923 &cxusb_table[MEDION_MD95700];
928 ret = cxusb_medion_set_mode(dvbdev, true);
933 adap->fe_adap[0].fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config,
935 if (!adap->fe_adap[0].fe)
939 adap->fe_adap[0].fe->ops.ts_bus_ctrl =
940 cxusb_medion_fe_ts_bus_ctrl;
945 static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap)
947 if (usb_set_interface(adap->dev->udev, 0, 7) < 0)
948 err("set interface failed");
950 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
952 adap->fe_adap[0].fe = dvb_attach(lgdt330x_attach,
953 &cxusb_lgdt3303_config,
955 &adap->dev->i2c_adap);
956 if (adap->fe_adap[0].fe)
962 static int cxusb_aver_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap)
964 adap->fe_adap[0].fe = dvb_attach(lgdt330x_attach,
965 &cxusb_aver_lgdt3303_config,
967 &adap->dev->i2c_adap);
968 if (adap->fe_adap[0].fe)
974 static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap)
976 /* used in both lgz201 and th7579 */
977 if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
978 err("set interface failed");
980 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
982 adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_mt352_config,
983 &adap->dev->i2c_adap);
984 if (adap->fe_adap[0].fe)
990 static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter *adap)
992 if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
993 err("set interface failed");
995 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
997 adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_dee1601_config,
998 &adap->dev->i2c_adap);
999 if (adap->fe_adap[0].fe)
1002 adap->fe_adap[0].fe = dvb_attach(zl10353_attach,
1003 &cxusb_zl10353_dee1601_config,
1004 &adap->dev->i2c_adap);
1005 if (adap->fe_adap[0].fe)
1011 static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap)
1015 struct i2c_msg msg = {
1022 if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
1023 err("set interface failed");
1025 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
1027 /* reset the tuner and demodulator */
1028 cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0);
1029 cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1);
1030 cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
1032 adap->fe_adap[0].fe =
1033 dvb_attach(zl10353_attach,
1034 &cxusb_zl10353_xc3028_config_no_i2c_gate,
1035 &adap->dev->i2c_adap);
1036 if (!adap->fe_adap[0].fe)
1039 /* try to determine if there is no IR decoder on the I2C bus */
1040 for (i = 0; adap->dev->props.rc.core.rc_codes && i < 5; i++) {
1042 if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1)
1044 if (ircode[0] == 0 && ircode[1] == 0)
1046 if (ircode[2] + ircode[3] != 0xff) {
1048 adap->dev->props.rc.core.rc_codes = NULL;
1049 info("No IR receiver detected on this device.");
1057 static struct dibx000_agc_config dib7070_agc_config = {
1058 .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
1061 * P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5,
1062 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1063 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0
1065 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) |
1066 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1068 .time_stabiliz = 10,
1092 .perform_agc_softsplit = 0,
1095 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
1105 .IO_CLK_en_core = 1,
1108 /* refsel, sel, freq_15k */
1109 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
1110 .ifreq = (0 << 25) | 0,
1112 .xtal_hz = 12000000,
1115 static struct dib7000p_config cxusb_dualdig4_rev2_config = {
1116 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
1117 .output_mpeg2_in_188_bytes = 1,
1119 .agc_config_count = 1,
1120 .agc = &dib7070_agc_config,
1121 .bw = &dib7070_bw_config_12_mhz,
1122 .tuner_is_baseband = 1,
1128 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
1130 .hostbus_diversity = 1,
1133 struct dib0700_adapter_state {
1134 int (*set_param_save)(struct dvb_frontend *fe);
1135 struct dib7000p_ops dib7000p_ops;
1138 static int cxusb_dualdig4_rev2_frontend_attach(struct dvb_usb_adapter *adap)
1140 struct dib0700_adapter_state *state = adap->priv;
1142 if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
1143 err("set interface failed");
1145 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
1147 cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
1149 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
1152 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
1153 &cxusb_dualdig4_rev2_config) < 0) {
1154 pr_warn("Unable to enumerate dib7000p\n");
1158 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap,
1160 &cxusb_dualdig4_rev2_config);
1161 if (!adap->fe_adap[0].fe)
1167 static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
1169 struct dvb_usb_adapter *adap = fe->dvb->priv;
1170 struct dib0700_adapter_state *state = adap->priv;
1172 return state->dib7000p_ops.set_gpio(fe, 8, 0, !onoff);
1175 static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
1180 static struct dib0070_config dib7070p_dib0070_config = {
1181 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
1182 .reset = dib7070_tuner_reset,
1183 .sleep = dib7070_tuner_sleep,
1187 static int dib7070_set_param_override(struct dvb_frontend *fe)
1189 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
1190 struct dvb_usb_adapter *adap = fe->dvb->priv;
1191 struct dib0700_adapter_state *state = adap->priv;
1194 u8 band = BAND_OF_FREQUENCY(p->frequency / 1000);
1206 state->dib7000p_ops.set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1208 return state->set_param_save(fe);
1211 static int cxusb_dualdig4_rev2_tuner_attach(struct dvb_usb_adapter *adap)
1213 struct dib0700_adapter_state *st = adap->priv;
1214 struct i2c_adapter *tun_i2c;
1217 * No need to call dvb7000p_attach here, as it was called
1218 * already, as frontend_attach method is called first, and
1219 * tuner_attach is only called on success.
1221 tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
1222 DIBX000_I2C_INTERFACE_TUNER, 1);
1224 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
1225 &dib7070p_dib0070_config) == NULL)
1228 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1229 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override;
1233 static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap)
1235 if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
1236 err("set interface failed");
1238 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
1240 /* reset the tuner and demodulator */
1241 cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0);
1242 cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1);
1243 cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
1245 adap->fe_adap[0].fe = dvb_attach(zl10353_attach,
1246 &cxusb_zl10353_xc3028_config,
1247 &adap->dev->i2c_adap);
1248 if (adap->fe_adap[0].fe)
1251 adap->fe_adap[0].fe = dvb_attach(mt352_attach,
1252 &cxusb_mt352_xc3028_config,
1253 &adap->dev->i2c_adap);
1254 if (adap->fe_adap[0].fe)
1260 static struct lgs8gxx_config d680_lgs8gl5_cfg = {
1261 .prod = LGS8GXX_PROD_LGS8GL5,
1262 .demod_address = 0x19,
1266 .if_clk_freq = 30400, /* 30.4 MHz */
1267 .if_freq = 5725, /* 5.725 MHz */
1274 static int cxusb_d680_dmb_frontend_attach(struct dvb_usb_adapter *adap)
1276 struct dvb_usb_device *d = adap->dev;
1279 /* Select required USB configuration */
1280 if (usb_set_interface(d->udev, 0, 0) < 0)
1281 err("set interface failed");
1283 /* Unblock all USB pipes */
1284 usb_clear_halt(d->udev,
1285 usb_sndbulkpipe(d->udev,
1286 d->props.generic_bulk_ctrl_endpoint));
1287 usb_clear_halt(d->udev,
1288 usb_rcvbulkpipe(d->udev,
1289 d->props.generic_bulk_ctrl_endpoint));
1290 usb_clear_halt(d->udev,
1291 usb_rcvbulkpipe(d->udev,
1292 d->props.adapter[0].fe[0].stream.endpoint));
1294 /* Drain USB pipes to avoid hang after reboot */
1295 for (n = 0; n < 5; n++) {
1296 cxusb_d680_dmb_drain_message(d);
1297 cxusb_d680_dmb_drain_video(d);
1301 /* Reset the tuner */
1302 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) {
1303 err("clear tuner gpio failed");
1307 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) {
1308 err("set tuner gpio failed");
1313 /* Attach frontend */
1314 adap->fe_adap[0].fe = dvb_attach(lgs8gxx_attach,
1315 &d680_lgs8gl5_cfg, &d->i2c_adap);
1316 if (!adap->fe_adap[0].fe)
1322 static struct atbm8830_config mygica_d689_atbm8830_cfg = {
1323 .prod = ATBM8830_PROD_8830,
1324 .demod_address = 0x40,
1326 .ts_sampling_edge = 1,
1328 .osc_clk_freq = 30400, /* in kHz */
1329 .if_freq = 0, /* zero IF */
1336 static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap)
1338 struct dvb_usb_device *d = adap->dev;
1340 /* Select required USB configuration */
1341 if (usb_set_interface(d->udev, 0, 0) < 0)
1342 err("set interface failed");
1344 /* Unblock all USB pipes */
1345 usb_clear_halt(d->udev,
1346 usb_sndbulkpipe(d->udev,
1347 d->props.generic_bulk_ctrl_endpoint));
1348 usb_clear_halt(d->udev,
1349 usb_rcvbulkpipe(d->udev,
1350 d->props.generic_bulk_ctrl_endpoint));
1351 usb_clear_halt(d->udev,
1352 usb_rcvbulkpipe(d->udev,
1353 d->props.adapter[0].fe[0].stream.endpoint));
1355 /* Reset the tuner */
1356 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) {
1357 err("clear tuner gpio failed");
1361 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) {
1362 err("set tuner gpio failed");
1367 /* Attach frontend */
1368 adap->fe_adap[0].fe = dvb_attach(atbm8830_attach,
1369 &mygica_d689_atbm8830_cfg,
1371 if (!adap->fe_adap[0].fe)
1377 static int cxusb_mygica_t230_frontend_attach(struct dvb_usb_adapter *adap)
1379 struct dvb_usb_device *d = adap->dev;
1380 struct cxusb_state *st = d->priv;
1381 struct i2c_adapter *adapter;
1382 struct i2c_client *client_demod;
1383 struct i2c_client *client_tuner;
1384 struct i2c_board_info info;
1385 struct si2168_config si2168_config;
1386 struct si2157_config si2157_config;
1388 /* Select required USB configuration */
1389 if (usb_set_interface(d->udev, 0, 0) < 0)
1390 err("set interface failed");
1392 /* Unblock all USB pipes */
1393 usb_clear_halt(d->udev,
1394 usb_sndbulkpipe(d->udev,
1395 d->props.generic_bulk_ctrl_endpoint));
1396 usb_clear_halt(d->udev,
1397 usb_rcvbulkpipe(d->udev,
1398 d->props.generic_bulk_ctrl_endpoint));
1399 usb_clear_halt(d->udev,
1400 usb_rcvbulkpipe(d->udev,
1401 d->props.adapter[0].fe[0].stream.endpoint));
1403 /* attach frontend */
1404 si2168_config.i2c_adapter = &adapter;
1405 si2168_config.fe = &adap->fe_adap[0].fe;
1406 si2168_config.ts_mode = SI2168_TS_PARALLEL;
1407 si2168_config.ts_clock_inv = 1;
1408 memset(&info, 0, sizeof(struct i2c_board_info));
1409 strscpy(info.type, "si2168", I2C_NAME_SIZE);
1411 info.platform_data = &si2168_config;
1412 request_module(info.type);
1413 client_demod = i2c_new_device(&d->i2c_adap, &info);
1414 if (!client_demod || !client_demod->dev.driver)
1417 if (!try_module_get(client_demod->dev.driver->owner)) {
1418 i2c_unregister_device(client_demod);
1422 st->i2c_client_demod = client_demod;
1425 memset(&si2157_config, 0, sizeof(si2157_config));
1426 si2157_config.fe = adap->fe_adap[0].fe;
1427 si2157_config.if_port = 1;
1428 memset(&info, 0, sizeof(struct i2c_board_info));
1429 strscpy(info.type, "si2157", I2C_NAME_SIZE);
1431 info.platform_data = &si2157_config;
1432 request_module(info.type);
1433 client_tuner = i2c_new_device(adapter, &info);
1434 if (!client_tuner || !client_tuner->dev.driver) {
1435 module_put(client_demod->dev.driver->owner);
1436 i2c_unregister_device(client_demod);
1439 if (!try_module_get(client_tuner->dev.driver->owner)) {
1440 i2c_unregister_device(client_tuner);
1441 module_put(client_demod->dev.driver->owner);
1442 i2c_unregister_device(client_demod);
1446 st->i2c_client_tuner = client_tuner;
1448 /* hook fe: need to resync the slave fifo when signal locks. */
1449 mutex_init(&st->stream_mutex);
1451 st->fe_read_status = adap->fe_adap[0].fe->ops.read_status;
1452 adap->fe_adap[0].fe->ops.read_status = cxusb_read_status;
1458 * DViCO has shipped two devices with the same USB ID, but only one of them
1459 * needs a firmware download. Check the device class details to see if they
1460 * have non-default values to decide whether the device is actually cold or
1461 * not, and forget a match if it turns out we selected the wrong device.
1463 static int bluebird_fx2_identify_state(struct usb_device *udev,
1464 struct dvb_usb_device_properties *props,
1465 struct dvb_usb_device_description **desc,
1468 int wascold = *cold;
1470 *cold = udev->descriptor.bDeviceClass == 0xff &&
1471 udev->descriptor.bDeviceSubClass == 0xff &&
1472 udev->descriptor.bDeviceProtocol == 0xff;
1474 if (*cold && !wascold)
1481 * DViCO bluebird firmware needs the "warm" product ID to be patched into the
1482 * firmware file before download.
1485 static const int dvico_firmware_id_offsets[] = { 6638, 3204 };
1486 static int bluebird_patch_dvico_firmware_download(struct usb_device *udev,
1487 const struct firmware *fw)
1491 for (pos = 0; pos < ARRAY_SIZE(dvico_firmware_id_offsets); pos++) {
1492 int idoff = dvico_firmware_id_offsets[pos];
1494 if (fw->size < idoff + 4)
1497 if (fw->data[idoff] == (USB_VID_DVICO & 0xff) &&
1498 fw->data[idoff + 1] == USB_VID_DVICO >> 8) {
1499 struct firmware new_fw;
1500 u8 *new_fw_data = vmalloc(fw->size);
1506 memcpy(new_fw_data, fw->data, fw->size);
1507 new_fw.size = fw->size;
1508 new_fw.data = new_fw_data;
1510 new_fw_data[idoff + 2] =
1511 le16_to_cpu(udev->descriptor.idProduct) + 1;
1512 new_fw_data[idoff + 3] =
1513 le16_to_cpu(udev->descriptor.idProduct) >> 8;
1515 ret = usb_cypress_load_firmware(udev, &new_fw,
1525 int cxusb_medion_get(struct dvb_usb_device *dvbdev,
1526 enum cxusb_open_type open_type)
1528 struct cxusb_medion_dev *cxdev = dvbdev->priv;
1531 mutex_lock(&cxdev->open_lock);
1533 if (WARN_ON((cxdev->open_type == CXUSB_OPEN_INIT ||
1534 cxdev->open_type == CXUSB_OPEN_NONE) &&
1535 cxdev->open_ctr != 0)) {
1540 if (cxdev->open_type == CXUSB_OPEN_INIT) {
1545 if (cxdev->open_ctr == 0) {
1546 if (cxdev->open_type != open_type) {
1547 deb_info("will acquire and switch to %s\n",
1548 open_type == CXUSB_OPEN_ANALOG ?
1549 "analog" : "digital");
1551 if (open_type == CXUSB_OPEN_ANALOG) {
1552 ret = _cxusb_power_ctrl(dvbdev, 1);
1554 dev_warn(&dvbdev->udev->dev,
1555 "powerup for analog switch failed (%d)\n",
1558 ret = cxusb_medion_set_mode(dvbdev, false);
1562 ret = cxusb_medion_analog_init(dvbdev);
1565 } else { /* digital */
1566 ret = _cxusb_power_ctrl(dvbdev, 1);
1568 dev_warn(&dvbdev->udev->dev,
1569 "powerup for digital switch failed (%d)\n",
1572 ret = cxusb_medion_set_mode(dvbdev, true);
1577 cxdev->open_type = open_type;
1579 deb_info("reacquired idle %s\n",
1580 open_type == CXUSB_OPEN_ANALOG ?
1581 "analog" : "digital");
1584 cxdev->open_ctr = 1;
1585 } else if (cxdev->open_type == open_type) {
1587 deb_info("acquired %s\n", open_type == CXUSB_OPEN_ANALOG ?
1588 "analog" : "digital");
1594 mutex_unlock(&cxdev->open_lock);
1599 void cxusb_medion_put(struct dvb_usb_device *dvbdev)
1601 struct cxusb_medion_dev *cxdev = dvbdev->priv;
1603 mutex_lock(&cxdev->open_lock);
1605 if (cxdev->open_type == CXUSB_OPEN_INIT) {
1606 WARN_ON(cxdev->open_ctr != 0);
1607 cxdev->open_type = CXUSB_OPEN_NONE;
1611 if (!WARN_ON(cxdev->open_ctr < 1)) {
1614 deb_info("release %s\n",
1615 cxdev->open_type == CXUSB_OPEN_ANALOG ?
1616 "analog" : "digital");
1620 mutex_unlock(&cxdev->open_lock);
1623 /* DVB USB Driver stuff */
1624 static struct dvb_usb_device_properties cxusb_medion_properties;
1625 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties;
1626 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties;
1627 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties;
1628 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties;
1629 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties;
1630 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties;
1631 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties;
1632 static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties;
1633 static struct dvb_usb_device_properties cxusb_aver_a868r_properties;
1634 static struct dvb_usb_device_properties cxusb_d680_dmb_properties;
1635 static struct dvb_usb_device_properties cxusb_mygica_d689_properties;
1636 static struct dvb_usb_device_properties cxusb_mygica_t230_properties;
1638 static int cxusb_medion_priv_init(struct dvb_usb_device *dvbdev)
1640 struct cxusb_medion_dev *cxdev = dvbdev->priv;
1642 cxdev->dvbdev = dvbdev;
1643 cxdev->open_type = CXUSB_OPEN_INIT;
1644 mutex_init(&cxdev->open_lock);
1649 static void cxusb_medion_priv_destroy(struct dvb_usb_device *dvbdev)
1651 struct cxusb_medion_dev *cxdev = dvbdev->priv;
1653 mutex_destroy(&cxdev->open_lock);
1656 static bool cxusb_medion_check_altsetting(struct usb_host_interface *as)
1660 for (ctr = 0; ctr < as->desc.bNumEndpoints; ctr++) {
1661 if ((as->endpoint[ctr].desc.bEndpointAddress &
1662 USB_ENDPOINT_NUMBER_MASK) != 2)
1665 if (as->endpoint[ctr].desc.bEndpointAddress & USB_DIR_IN &&
1666 ((as->endpoint[ctr].desc.bmAttributes &
1667 USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_ISOC))
1676 static bool cxusb_medion_check_intf(struct usb_interface *intf)
1680 if (intf->num_altsetting < 2) {
1681 dev_err(intf->usb_dev, "no alternate interface");
1686 for (ctr = 0; ctr < intf->num_altsetting; ctr++) {
1687 if (intf->altsetting[ctr].desc.bAlternateSetting != 1)
1690 if (cxusb_medion_check_altsetting(&intf->altsetting[ctr]))
1696 dev_err(intf->usb_dev, "no iso interface");
1701 static int cxusb_probe(struct usb_interface *intf,
1702 const struct usb_device_id *id)
1704 struct dvb_usb_device *dvbdev;
1708 if (!dvb_usb_device_init(intf, &cxusb_medion_properties,
1709 THIS_MODULE, &dvbdev, adapter_nr)) {
1710 if (!cxusb_medion_check_intf(intf)) {
1715 _cxusb_power_ctrl(dvbdev, 1);
1716 ret = cxusb_medion_set_mode(dvbdev, false);
1720 ret = cxusb_medion_register_analog(dvbdev);
1722 cxusb_medion_set_mode(dvbdev, true);
1723 _cxusb_power_ctrl(dvbdev, 0);
1728 /* release device from INIT mode to normal operation */
1729 cxusb_medion_put(dvbdev);
1732 } else if (!dvb_usb_device_init(intf,
1733 &cxusb_bluebird_lgh064f_properties,
1734 THIS_MODULE, NULL, adapter_nr) ||
1735 !dvb_usb_device_init(intf,
1736 &cxusb_bluebird_dee1601_properties,
1737 THIS_MODULE, NULL, adapter_nr) ||
1738 !dvb_usb_device_init(intf,
1739 &cxusb_bluebird_lgz201_properties,
1740 THIS_MODULE, NULL, adapter_nr) ||
1741 !dvb_usb_device_init(intf,
1742 &cxusb_bluebird_dtt7579_properties,
1743 THIS_MODULE, NULL, adapter_nr) ||
1744 !dvb_usb_device_init(intf,
1745 &cxusb_bluebird_dualdig4_properties,
1746 THIS_MODULE, NULL, adapter_nr) ||
1747 !dvb_usb_device_init(intf,
1748 &cxusb_bluebird_nano2_properties,
1749 THIS_MODULE, NULL, adapter_nr) ||
1750 !dvb_usb_device_init(intf,
1751 &cxusb_bluebird_nano2_needsfirmware_properties,
1752 THIS_MODULE, NULL, adapter_nr) ||
1753 !dvb_usb_device_init(intf, &cxusb_aver_a868r_properties,
1754 THIS_MODULE, NULL, adapter_nr) ||
1755 !dvb_usb_device_init(intf,
1756 &cxusb_bluebird_dualdig4_rev2_properties,
1757 THIS_MODULE, NULL, adapter_nr) ||
1758 !dvb_usb_device_init(intf, &cxusb_d680_dmb_properties,
1759 THIS_MODULE, NULL, adapter_nr) ||
1760 !dvb_usb_device_init(intf, &cxusb_mygica_d689_properties,
1761 THIS_MODULE, NULL, adapter_nr) ||
1762 !dvb_usb_device_init(intf, &cxusb_mygica_t230_properties,
1763 THIS_MODULE, NULL, adapter_nr) ||
1770 dvb_usb_device_exit(intf);
1775 static void cxusb_disconnect(struct usb_interface *intf)
1777 struct dvb_usb_device *d = usb_get_intfdata(intf);
1778 struct cxusb_state *st = d->priv;
1779 struct i2c_client *client;
1781 if (d->props.devices[0].warm_ids[0] == &cxusb_table[MEDION_MD95700])
1782 cxusb_medion_unregister_analog(d);
1784 /* remove I2C client for tuner */
1785 client = st->i2c_client_tuner;
1787 module_put(client->dev.driver->owner);
1788 i2c_unregister_device(client);
1791 /* remove I2C client for demodulator */
1792 client = st->i2c_client_demod;
1794 module_put(client->dev.driver->owner);
1795 i2c_unregister_device(client);
1798 dvb_usb_device_exit(intf);
1801 static struct usb_device_id cxusb_table[NR__cxusb_table_index + 1] = {
1802 [MEDION_MD95700] = {
1803 USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700)
1805 [DVICO_BLUEBIRD_LG064F_COLD] = {
1806 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD)
1808 [DVICO_BLUEBIRD_LG064F_WARM] = {
1809 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM)
1811 [DVICO_BLUEBIRD_DUAL_1_COLD] = {
1812 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD)
1814 [DVICO_BLUEBIRD_DUAL_1_WARM] = {
1815 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM)
1817 [DVICO_BLUEBIRD_LGZ201_COLD] = {
1818 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD)
1820 [DVICO_BLUEBIRD_LGZ201_WARM] = {
1821 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM)
1823 [DVICO_BLUEBIRD_TH7579_COLD] = {
1824 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD)
1826 [DVICO_BLUEBIRD_TH7579_WARM] = {
1827 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM)
1829 [DIGITALNOW_BLUEBIRD_DUAL_1_COLD] = {
1830 USB_DEVICE(USB_VID_DVICO,
1831 USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD)
1833 [DIGITALNOW_BLUEBIRD_DUAL_1_WARM] = {
1834 USB_DEVICE(USB_VID_DVICO,
1835 USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM)
1837 [DVICO_BLUEBIRD_DUAL_2_COLD] = {
1838 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD)
1840 [DVICO_BLUEBIRD_DUAL_2_WARM] = {
1841 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM)
1843 [DVICO_BLUEBIRD_DUAL_4] = {
1844 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4)
1846 [DVICO_BLUEBIRD_DVB_T_NANO_2] = {
1847 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2)
1849 [DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM] = {
1850 USB_DEVICE(USB_VID_DVICO,
1851 USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM)
1853 [AVERMEDIA_VOLAR_A868R] = {
1854 USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R)
1856 [DVICO_BLUEBIRD_DUAL_4_REV_2] = {
1857 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2)
1859 [CONEXANT_D680_DMB] = {
1860 USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB)
1863 USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689)
1866 USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230)
1868 {} /* Terminating entry */
1870 MODULE_DEVICE_TABLE(usb, cxusb_table);
1872 static struct dvb_usb_device_properties cxusb_medion_properties = {
1873 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1875 .usb_ctrl = CYPRESS_FX2,
1877 .size_of_priv = sizeof(struct cxusb_medion_dev),
1878 .priv_init = cxusb_medion_priv_init,
1879 .priv_destroy = cxusb_medion_priv_destroy,
1886 .streaming_ctrl = cxusb_streaming_ctrl,
1887 .frontend_attach = cxusb_cx22702_frontend_attach,
1888 .tuner_attach = cxusb_fmd1216me_tuner_attach,
1889 /* parameter for the MPEG2-data transfer */
1903 .power_ctrl = cxusb_power_ctrl,
1905 .i2c_algo = &cxusb_i2c_algo,
1907 .generic_bulk_ctrl_endpoint = 0x01,
1909 .num_device_descs = 1,
1912 "Medion MD95700 (MDUSBTV-HYBRID)",
1914 { &cxusb_table[MEDION_MD95700], NULL },
1919 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = {
1920 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1922 .usb_ctrl = DEVICE_SPECIFIC,
1923 .firmware = "/*(DEBLOBBED)*/",
1924 .download_firmware = bluebird_patch_dvico_firmware_download,
1926 * use usb alt setting 0 for EP4 transfer (dvb-t),
1927 * use usb alt setting 7 for EP2 transfer (atsc)
1930 .size_of_priv = sizeof(struct cxusb_state),
1937 .streaming_ctrl = cxusb_streaming_ctrl,
1938 .frontend_attach = cxusb_lgdt3303_frontend_attach,
1939 .tuner_attach = cxusb_lgh064f_tuner_attach,
1941 /* parameter for the MPEG2-data transfer */
1956 .power_ctrl = cxusb_bluebird_power_ctrl,
1958 .i2c_algo = &cxusb_i2c_algo,
1962 .rc_codes = RC_MAP_DVICO_PORTABLE,
1963 .module_name = KBUILD_MODNAME,
1964 .rc_query = cxusb_rc_query,
1965 .allowed_protos = RC_PROTO_BIT_NEC,
1968 .generic_bulk_ctrl_endpoint = 0x01,
1970 .num_device_descs = 1,
1972 { "DViCO FusionHDTV5 USB Gold",
1973 { &cxusb_table[DVICO_BLUEBIRD_LG064F_COLD], NULL },
1974 { &cxusb_table[DVICO_BLUEBIRD_LG064F_WARM], NULL },
1979 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = {
1980 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1982 .usb_ctrl = DEVICE_SPECIFIC,
1983 .firmware = "/*(DEBLOBBED)*/",
1984 .download_firmware = bluebird_patch_dvico_firmware_download,
1986 * use usb alt setting 0 for EP4 transfer (dvb-t),
1987 * use usb alt setting 7 for EP2 transfer (atsc)
1990 .size_of_priv = sizeof(struct cxusb_state),
1997 .streaming_ctrl = cxusb_streaming_ctrl,
1998 .frontend_attach = cxusb_dee1601_frontend_attach,
1999 .tuner_attach = cxusb_dee1601_tuner_attach,
2000 /* parameter for the MPEG2-data transfer */
2015 .power_ctrl = cxusb_bluebird_power_ctrl,
2017 .i2c_algo = &cxusb_i2c_algo,
2021 .rc_codes = RC_MAP_DVICO_MCE,
2022 .module_name = KBUILD_MODNAME,
2023 .rc_query = cxusb_rc_query,
2024 .allowed_protos = RC_PROTO_BIT_NEC,
2027 .generic_bulk_ctrl_endpoint = 0x01,
2029 .num_device_descs = 3,
2031 { "DViCO FusionHDTV DVB-T Dual USB",
2032 { &cxusb_table[DVICO_BLUEBIRD_DUAL_1_COLD], NULL },
2033 { &cxusb_table[DVICO_BLUEBIRD_DUAL_1_WARM], NULL },
2035 { "DigitalNow DVB-T Dual USB",
2036 { &cxusb_table[DIGITALNOW_BLUEBIRD_DUAL_1_COLD], NULL },
2037 { &cxusb_table[DIGITALNOW_BLUEBIRD_DUAL_1_WARM], NULL },
2039 { "DViCO FusionHDTV DVB-T Dual Digital 2",
2040 { &cxusb_table[DVICO_BLUEBIRD_DUAL_2_COLD], NULL },
2041 { &cxusb_table[DVICO_BLUEBIRD_DUAL_2_WARM], NULL },
2046 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = {
2047 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
2049 .usb_ctrl = DEVICE_SPECIFIC,
2050 .firmware = "/*(DEBLOBBED)*/",
2051 .download_firmware = bluebird_patch_dvico_firmware_download,
2053 * use usb alt setting 0 for EP4 transfer (dvb-t),
2054 * use usb alt setting 7 for EP2 transfer (atsc)
2057 .size_of_priv = sizeof(struct cxusb_state),
2064 .streaming_ctrl = cxusb_streaming_ctrl,
2065 .frontend_attach = cxusb_mt352_frontend_attach,
2066 .tuner_attach = cxusb_lgz201_tuner_attach,
2068 /* parameter for the MPEG2-data transfer */
2082 .power_ctrl = cxusb_bluebird_power_ctrl,
2084 .i2c_algo = &cxusb_i2c_algo,
2088 .rc_codes = RC_MAP_DVICO_PORTABLE,
2089 .module_name = KBUILD_MODNAME,
2090 .rc_query = cxusb_rc_query,
2091 .allowed_protos = RC_PROTO_BIT_NEC,
2094 .generic_bulk_ctrl_endpoint = 0x01,
2095 .num_device_descs = 1,
2097 { "DViCO FusionHDTV DVB-T USB (LGZ201)",
2098 { &cxusb_table[DVICO_BLUEBIRD_LGZ201_COLD], NULL },
2099 { &cxusb_table[DVICO_BLUEBIRD_LGZ201_WARM], NULL },
2104 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = {
2105 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
2107 .usb_ctrl = DEVICE_SPECIFIC,
2108 .firmware = "/*(DEBLOBBED)*/",
2109 .download_firmware = bluebird_patch_dvico_firmware_download,
2112 * use usb alt setting 0 for EP4 transfer (dvb-t),
2113 * use usb alt setting 7 for EP2 transfer (atsc)
2116 .size_of_priv = sizeof(struct cxusb_state),
2123 .streaming_ctrl = cxusb_streaming_ctrl,
2124 .frontend_attach = cxusb_mt352_frontend_attach,
2125 .tuner_attach = cxusb_dtt7579_tuner_attach,
2127 /* parameter for the MPEG2-data transfer */
2141 .power_ctrl = cxusb_bluebird_power_ctrl,
2143 .i2c_algo = &cxusb_i2c_algo,
2147 .rc_codes = RC_MAP_DVICO_PORTABLE,
2148 .module_name = KBUILD_MODNAME,
2149 .rc_query = cxusb_rc_query,
2150 .allowed_protos = RC_PROTO_BIT_NEC,
2153 .generic_bulk_ctrl_endpoint = 0x01,
2155 .num_device_descs = 1,
2157 { "DViCO FusionHDTV DVB-T USB (TH7579)",
2158 { &cxusb_table[DVICO_BLUEBIRD_TH7579_COLD], NULL },
2159 { &cxusb_table[DVICO_BLUEBIRD_TH7579_WARM], NULL },
2164 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = {
2165 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
2167 .usb_ctrl = CYPRESS_FX2,
2169 .size_of_priv = sizeof(struct cxusb_state),
2176 .streaming_ctrl = cxusb_streaming_ctrl,
2177 .frontend_attach = cxusb_dualdig4_frontend_attach,
2178 .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
2179 /* parameter for the MPEG2-data transfer */
2194 .power_ctrl = cxusb_power_ctrl,
2196 .i2c_algo = &cxusb_i2c_algo,
2198 .generic_bulk_ctrl_endpoint = 0x01,
2202 .rc_codes = RC_MAP_DVICO_MCE,
2203 .module_name = KBUILD_MODNAME,
2204 .rc_query = cxusb_bluebird2_rc_query,
2205 .allowed_protos = RC_PROTO_BIT_NEC,
2208 .num_device_descs = 1,
2210 { "DViCO FusionHDTV DVB-T Dual Digital 4",
2212 { &cxusb_table[DVICO_BLUEBIRD_DUAL_4], NULL },
2217 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = {
2218 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
2220 .usb_ctrl = CYPRESS_FX2,
2221 .identify_state = bluebird_fx2_identify_state,
2223 .size_of_priv = sizeof(struct cxusb_state),
2230 .streaming_ctrl = cxusb_streaming_ctrl,
2231 .frontend_attach = cxusb_nano2_frontend_attach,
2232 .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
2233 /* parameter for the MPEG2-data transfer */
2248 .power_ctrl = cxusb_nano2_power_ctrl,
2250 .i2c_algo = &cxusb_i2c_algo,
2252 .generic_bulk_ctrl_endpoint = 0x01,
2256 .rc_codes = RC_MAP_DVICO_PORTABLE,
2257 .module_name = KBUILD_MODNAME,
2258 .rc_query = cxusb_bluebird2_rc_query,
2259 .allowed_protos = RC_PROTO_BIT_NEC,
2262 .num_device_descs = 1,
2264 { "DViCO FusionHDTV DVB-T NANO2",
2266 { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2], NULL },
2271 static struct dvb_usb_device_properties
2272 cxusb_bluebird_nano2_needsfirmware_properties = {
2273 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
2275 .usb_ctrl = DEVICE_SPECIFIC,
2276 .firmware = "/*(DEBLOBBED)*/",
2277 .download_firmware = bluebird_patch_dvico_firmware_download,
2278 .identify_state = bluebird_fx2_identify_state,
2280 .size_of_priv = sizeof(struct cxusb_state),
2287 .streaming_ctrl = cxusb_streaming_ctrl,
2288 .frontend_attach = cxusb_nano2_frontend_attach,
2289 .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
2290 /* parameter for the MPEG2-data transfer */
2305 .power_ctrl = cxusb_nano2_power_ctrl,
2307 .i2c_algo = &cxusb_i2c_algo,
2309 .generic_bulk_ctrl_endpoint = 0x01,
2313 .rc_codes = RC_MAP_DVICO_PORTABLE,
2314 .module_name = KBUILD_MODNAME,
2315 .rc_query = cxusb_rc_query,
2316 .allowed_protos = RC_PROTO_BIT_NEC,
2319 .num_device_descs = 1,
2321 "DViCO FusionHDTV DVB-T NANO2 w/o firmware",
2322 { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2], NULL },
2323 { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM],
2329 static struct dvb_usb_device_properties cxusb_aver_a868r_properties = {
2330 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
2332 .usb_ctrl = CYPRESS_FX2,
2334 .size_of_priv = sizeof(struct cxusb_state),
2341 .streaming_ctrl = cxusb_aver_streaming_ctrl,
2342 .frontend_attach = cxusb_aver_lgdt3303_frontend_attach,
2343 .tuner_attach = cxusb_mxl5003s_tuner_attach,
2344 /* parameter for the MPEG2-data transfer */
2358 .power_ctrl = cxusb_aver_power_ctrl,
2360 .i2c_algo = &cxusb_i2c_algo,
2362 .generic_bulk_ctrl_endpoint = 0x01,
2364 .num_device_descs = 1,
2366 { "AVerMedia AVerTVHD Volar (A868R)",
2368 { &cxusb_table[AVERMEDIA_VOLAR_A868R], NULL },
2374 struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = {
2375 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
2377 .usb_ctrl = CYPRESS_FX2,
2379 .size_of_priv = sizeof(struct cxusb_state),
2384 .size_of_priv = sizeof(struct dib0700_adapter_state),
2387 .streaming_ctrl = cxusb_streaming_ctrl,
2388 .frontend_attach = cxusb_dualdig4_rev2_frontend_attach,
2389 .tuner_attach = cxusb_dualdig4_rev2_tuner_attach,
2390 /* parameter for the MPEG2-data transfer */
2405 .power_ctrl = cxusb_bluebird_power_ctrl,
2407 .i2c_algo = &cxusb_i2c_algo,
2409 .generic_bulk_ctrl_endpoint = 0x01,
2413 .rc_codes = RC_MAP_DVICO_MCE,
2414 .module_name = KBUILD_MODNAME,
2415 .rc_query = cxusb_rc_query,
2416 .allowed_protos = RC_PROTO_BIT_NEC,
2419 .num_device_descs = 1,
2421 { "DViCO FusionHDTV DVB-T Dual Digital 4 (rev 2)",
2423 { &cxusb_table[DVICO_BLUEBIRD_DUAL_4_REV_2], NULL },
2428 static struct dvb_usb_device_properties cxusb_d680_dmb_properties = {
2429 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
2431 .usb_ctrl = CYPRESS_FX2,
2433 .size_of_priv = sizeof(struct cxusb_state),
2440 .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl,
2441 .frontend_attach = cxusb_d680_dmb_frontend_attach,
2442 .tuner_attach = cxusb_d680_dmb_tuner_attach,
2444 /* parameter for the MPEG2-data transfer */
2459 .power_ctrl = cxusb_d680_dmb_power_ctrl,
2461 .i2c_algo = &cxusb_i2c_algo,
2463 .generic_bulk_ctrl_endpoint = 0x01,
2467 .rc_codes = RC_MAP_TOTAL_MEDIA_IN_HAND_02,
2468 .module_name = KBUILD_MODNAME,
2469 .rc_query = cxusb_d680_dmb_rc_query,
2470 .allowed_protos = RC_PROTO_BIT_UNKNOWN,
2473 .num_device_descs = 1,
2476 "Conexant DMB-TH Stick",
2478 { &cxusb_table[CONEXANT_D680_DMB], NULL },
2483 static struct dvb_usb_device_properties cxusb_mygica_d689_properties = {
2484 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
2486 .usb_ctrl = CYPRESS_FX2,
2488 .size_of_priv = sizeof(struct cxusb_state),
2495 .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl,
2496 .frontend_attach = cxusb_mygica_d689_frontend_attach,
2497 .tuner_attach = cxusb_mygica_d689_tuner_attach,
2499 /* parameter for the MPEG2-data transfer */
2514 .power_ctrl = cxusb_d680_dmb_power_ctrl,
2516 .i2c_algo = &cxusb_i2c_algo,
2518 .generic_bulk_ctrl_endpoint = 0x01,
2522 .rc_codes = RC_MAP_D680_DMB,
2523 .module_name = KBUILD_MODNAME,
2524 .rc_query = cxusb_d680_dmb_rc_query,
2525 .allowed_protos = RC_PROTO_BIT_UNKNOWN,
2528 .num_device_descs = 1,
2531 "Mygica D689 DMB-TH",
2533 { &cxusb_table[MYGICA_D689], NULL },
2538 static struct dvb_usb_device_properties cxusb_mygica_t230_properties = {
2539 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
2541 .usb_ctrl = CYPRESS_FX2,
2543 .size_of_priv = sizeof(struct cxusb_state),
2550 .streaming_ctrl = cxusb_streaming_ctrl,
2551 .frontend_attach = cxusb_mygica_t230_frontend_attach,
2553 /* parameter for the MPEG2-data transfer */
2568 .power_ctrl = cxusb_d680_dmb_power_ctrl,
2570 .i2c_algo = &cxusb_i2c_algo,
2572 .generic_bulk_ctrl_endpoint = 0x01,
2576 .rc_codes = RC_MAP_D680_DMB,
2577 .module_name = KBUILD_MODNAME,
2578 .rc_query = cxusb_d680_dmb_rc_query,
2579 .allowed_protos = RC_PROTO_BIT_UNKNOWN,
2582 .num_device_descs = 1,
2585 "Mygica T230 DVB-T/T2/C",
2587 { &cxusb_table[MYGICA_T230], NULL },
2592 static struct usb_driver cxusb_driver = {
2593 .name = "dvb_usb_cxusb",
2594 .probe = cxusb_probe,
2595 .disconnect = cxusb_disconnect,
2596 .id_table = cxusb_table,
2599 module_usb_driver(cxusb_driver);
2601 MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@posteo.de>");
2602 MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
2603 MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
2604 MODULE_AUTHOR("Maciej S. Szmigiero <mail@maciej.szmigiero.name>");
2605 MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
2606 MODULE_LICENSE("GPL");