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 enum cxusb_table_index
{
59 DVICO_BLUEBIRD_LG064F_COLD
,
60 DVICO_BLUEBIRD_LG064F_WARM
,
61 DVICO_BLUEBIRD_DUAL_1_COLD
,
62 DVICO_BLUEBIRD_DUAL_1_WARM
,
63 DVICO_BLUEBIRD_LGZ201_COLD
,
64 DVICO_BLUEBIRD_LGZ201_WARM
,
65 DVICO_BLUEBIRD_TH7579_COLD
,
66 DVICO_BLUEBIRD_TH7579_WARM
,
67 DIGITALNOW_BLUEBIRD_DUAL_1_COLD
,
68 DIGITALNOW_BLUEBIRD_DUAL_1_WARM
,
69 DVICO_BLUEBIRD_DUAL_2_COLD
,
70 DVICO_BLUEBIRD_DUAL_2_WARM
,
71 DVICO_BLUEBIRD_DUAL_4
,
72 DVICO_BLUEBIRD_DVB_T_NANO_2
,
73 DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM
,
74 AVERMEDIA_VOLAR_A868R
,
75 DVICO_BLUEBIRD_DUAL_4_REV_2
,
81 static struct usb_device_id cxusb_table
[];
83 int cxusb_ctrl_msg(struct dvb_usb_device
*d
,
84 u8 cmd
, const u8
*wbuf
, int wlen
, u8
*rbuf
, int rlen
)
86 struct cxusb_state
*st
= d
->priv
;
89 if (1 + wlen
> MAX_XFER_SIZE
) {
90 warn("i2c wr: len=%d is too big!\n", wlen
);
94 if (rlen
> MAX_XFER_SIZE
) {
95 warn("i2c rd: len=%d is too big!\n", rlen
);
99 mutex_lock(&d
->data_mutex
);
101 memcpy(&st
->data
[1], wbuf
, wlen
);
102 ret
= dvb_usb_generic_rw(d
, st
->data
, 1 + wlen
, st
->data
, rlen
, 0);
103 if (!ret
&& rbuf
&& rlen
)
104 memcpy(rbuf
, st
->data
, rlen
);
106 mutex_unlock(&d
->data_mutex
);
111 static void cxusb_gpio_tuner(struct dvb_usb_device
*d
, int onoff
)
113 struct cxusb_state
*st
= d
->priv
;
116 if (st
->gpio_write_state
[GPIO_TUNER
] == onoff
&&
117 !st
->gpio_write_refresh
[GPIO_TUNER
])
122 cxusb_ctrl_msg(d
, CMD_GPIO_WRITE
, o
, 2, &i
, 1);
125 dev_info(&d
->udev
->dev
, "gpio_write failed.\n");
127 st
->gpio_write_state
[GPIO_TUNER
] = onoff
;
128 st
->gpio_write_refresh
[GPIO_TUNER
] = false;
131 static int cxusb_bluebird_gpio_rw(struct dvb_usb_device
*d
, u8 changemask
,
137 o
[0] = 0xff & ~changemask
; /* mask of bits to keep */
138 o
[1] = newval
& changemask
; /* new values for bits */
140 rc
= cxusb_ctrl_msg(d
, CMD_BLUEBIRD_GPIO_RW
, o
, 2, &gpio_state
, 1);
141 if (rc
< 0 || (gpio_state
& changemask
) != (newval
& changemask
))
142 dev_info(&d
->udev
->dev
, "bluebird_gpio_write failed.\n");
144 return rc
< 0 ? rc
: gpio_state
;
147 static void cxusb_bluebird_gpio_pulse(struct dvb_usb_device
*d
, u8 pin
, int low
)
149 cxusb_bluebird_gpio_rw(d
, pin
, low
? 0 : pin
);
151 cxusb_bluebird_gpio_rw(d
, pin
, low
? pin
: 0);
154 static void cxusb_nano2_led(struct dvb_usb_device
*d
, int onoff
)
156 cxusb_bluebird_gpio_rw(d
, 0x40, onoff
? 0 : 0x40);
159 static int cxusb_d680_dmb_gpio_tuner(struct dvb_usb_device
*d
,
162 u8 o
[2] = {addr
, onoff
};
166 rc
= cxusb_ctrl_msg(d
, CMD_GPIO_WRITE
, o
, 2, &i
, 1);
174 dev_info(&d
->udev
->dev
, "gpio_write failed.\n");
179 static int cxusb_i2c_xfer(struct i2c_adapter
*adap
, struct i2c_msg msg
[],
182 struct dvb_usb_device
*d
= i2c_get_adapdata(adap
);
186 if (mutex_lock_interruptible(&d
->i2c_mutex
) < 0)
189 for (i
= 0; i
< num
; i
++) {
190 if (le16_to_cpu(d
->udev
->descriptor
.idVendor
) == USB_VID_MEDION
)
191 switch (msg
[i
].addr
) {
193 cxusb_gpio_tuner(d
, 0);
196 cxusb_gpio_tuner(d
, 1);
200 if (msg
[i
].flags
& I2C_M_RD
) {
202 u8 obuf
[3], ibuf
[MAX_XFER_SIZE
];
204 if (1 + msg
[i
].len
> sizeof(ibuf
)) {
205 warn("i2c rd: len=%d is too big!\n",
211 obuf
[1] = msg
[i
].len
;
212 obuf
[2] = msg
[i
].addr
;
213 if (cxusb_ctrl_msg(d
, CMD_I2C_READ
,
215 ibuf
, 1 + msg
[i
].len
) < 0) {
216 warn("i2c read failed");
219 memcpy(msg
[i
].buf
, &ibuf
[1], msg
[i
].len
);
220 } else if (i
+ 1 < num
&& (msg
[i
+ 1].flags
& I2C_M_RD
) &&
221 msg
[i
].addr
== msg
[i
+ 1].addr
) {
222 /* write to then read from same address */
223 u8 obuf
[MAX_XFER_SIZE
], ibuf
[MAX_XFER_SIZE
];
225 if (3 + msg
[i
].len
> sizeof(obuf
)) {
226 warn("i2c wr: len=%d is too big!\n",
231 if (1 + msg
[i
+ 1].len
> sizeof(ibuf
)) {
232 warn("i2c rd: len=%d is too big!\n",
237 obuf
[0] = msg
[i
].len
;
238 obuf
[1] = msg
[i
+ 1].len
;
239 obuf
[2] = msg
[i
].addr
;
240 memcpy(&obuf
[3], msg
[i
].buf
, msg
[i
].len
);
242 if (cxusb_ctrl_msg(d
, CMD_I2C_READ
,
243 obuf
, 3 + msg
[i
].len
,
244 ibuf
, 1 + msg
[i
+ 1].len
) < 0)
248 dev_info(&d
->udev
->dev
, "i2c read may have failed\n");
250 memcpy(msg
[i
+ 1].buf
, &ibuf
[1], msg
[i
+ 1].len
);
255 u8 obuf
[MAX_XFER_SIZE
], ibuf
;
257 if (2 + msg
[i
].len
> sizeof(obuf
)) {
258 warn("i2c wr: len=%d is too big!\n",
263 obuf
[0] = msg
[i
].addr
;
264 obuf
[1] = msg
[i
].len
;
265 memcpy(&obuf
[2], msg
[i
].buf
, msg
[i
].len
);
267 if (cxusb_ctrl_msg(d
, CMD_I2C_WRITE
, obuf
,
268 2 + msg
[i
].len
, &ibuf
, 1) < 0)
271 dev_info(&d
->udev
->dev
, "i2c write may have failed\n");
281 mutex_unlock(&d
->i2c_mutex
);
285 static u32
cxusb_i2c_func(struct i2c_adapter
*adapter
)
287 return I2C_FUNC_I2C
| I2C_FUNC_SMBUS_EMUL
;
290 static struct i2c_algorithm cxusb_i2c_algo
= {
291 .master_xfer
= cxusb_i2c_xfer
,
292 .functionality
= cxusb_i2c_func
,
295 static int _cxusb_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
299 dev_info(&d
->udev
->dev
, "setting power %s\n", onoff
? "ON" : "OFF");
302 return cxusb_ctrl_msg(d
, CMD_POWER_ON
, &b
, 1, NULL
, 0);
304 return cxusb_ctrl_msg(d
, CMD_POWER_OFF
, &b
, 1, NULL
, 0);
307 static int cxusb_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
309 bool is_medion
= d
->props
.devices
[0].warm_ids
[0] == &cxusb_table
[MEDION_MD95700
];
312 if (is_medion
&& !onoff
) {
313 struct cxusb_medion_dev
*cxdev
= d
->priv
;
315 mutex_lock(&cxdev
->open_lock
);
317 if (cxdev
->open_type
== CXUSB_OPEN_ANALOG
) {
318 dev_info(&d
->udev
->dev
, "preventing DVB core from setting power OFF while we are in analog mode\n");
324 ret
= _cxusb_power_ctrl(d
, onoff
);
327 if (is_medion
&& !onoff
) {
328 struct cxusb_medion_dev
*cxdev
= d
->priv
;
330 mutex_unlock(&cxdev
->open_lock
);
336 static int cxusb_aver_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
341 return cxusb_ctrl_msg(d
, CMD_POWER_OFF
, NULL
, 0, NULL
, 0);
342 if (d
->state
== DVB_USB_STATE_INIT
&&
343 usb_set_interface(d
->udev
, 0, 0) < 0)
344 err("set interface failed");
347 } while (!(ret
= cxusb_ctrl_msg(d
, CMD_POWER_ON
, NULL
, 0, NULL
, 0)) &&
348 !(ret
= cxusb_ctrl_msg(d
, 0x15, NULL
, 0, NULL
, 0)) &&
349 !(ret
= cxusb_ctrl_msg(d
, 0x17, NULL
, 0, NULL
, 0)) && 0);
353 * FIXME: We don't know why, but we need to configure the
354 * lgdt3303 with the register settings below on resume
358 static const u8 bufs
[] = {
359 0x0e, 0x2, 0x00, 0x7f,
360 0x0e, 0x2, 0x02, 0xfe,
361 0x0e, 0x2, 0x02, 0x01,
362 0x0e, 0x2, 0x00, 0x03,
363 0x0e, 0x2, 0x0d, 0x40,
364 0x0e, 0x2, 0x0e, 0x87,
365 0x0e, 0x2, 0x0f, 0x8e,
366 0x0e, 0x2, 0x10, 0x01,
367 0x0e, 0x2, 0x14, 0xd7,
368 0x0e, 0x2, 0x47, 0x88,
371 for (i
= 0; i
< ARRAY_SIZE(bufs
); i
+= 4 / sizeof(u8
)) {
372 ret
= cxusb_ctrl_msg(d
, CMD_I2C_WRITE
,
373 bufs
+ i
, 4, &buf
, 1);
383 static int cxusb_bluebird_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
388 return cxusb_ctrl_msg(d
, CMD_POWER_ON
, &b
, 1, NULL
, 0);
393 static int cxusb_nano2_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
397 rc
= cxusb_power_ctrl(d
, onoff
);
399 cxusb_nano2_led(d
, 0);
404 static int cxusb_d680_dmb_power_ctrl(struct dvb_usb_device
*d
, int onoff
)
409 ret
= cxusb_power_ctrl(d
, onoff
);
414 cxusb_ctrl_msg(d
, CMD_DIGITAL
, NULL
, 0, &b
, 1);
419 static int cxusb_streaming_ctrl(struct dvb_usb_adapter
*adap
, int onoff
)
421 struct dvb_usb_device
*dvbdev
= adap
->dev
;
422 bool is_medion
= dvbdev
->props
.devices
[0].warm_ids
[0] ==
423 &cxusb_table
[MEDION_MD95700
];
424 u8 buf
[2] = { 0x03, 0x00 };
426 if (is_medion
&& onoff
) {
429 ret
= cxusb_medion_get(dvbdev
, CXUSB_OPEN_DIGITAL
);
435 cxusb_ctrl_msg(dvbdev
, CMD_STREAMING_ON
, buf
, 2, NULL
, 0);
437 cxusb_ctrl_msg(dvbdev
, CMD_STREAMING_OFF
, NULL
, 0, NULL
, 0);
439 if (is_medion
&& !onoff
)
440 cxusb_medion_put(dvbdev
);
445 static int cxusb_aver_streaming_ctrl(struct dvb_usb_adapter
*adap
, int onoff
)
448 cxusb_ctrl_msg(adap
->dev
, CMD_AVER_STREAM_ON
, NULL
, 0, NULL
, 0);
450 cxusb_ctrl_msg(adap
->dev
, CMD_AVER_STREAM_OFF
,
455 static void cxusb_d680_dmb_drain_message(struct dvb_usb_device
*d
)
457 int ep
= d
->props
.generic_bulk_ctrl_endpoint
;
458 const int timeout
= 100;
459 const int junk_len
= 32;
463 /* Discard remaining data in video pipe */
464 junk
= kmalloc(junk_len
, GFP_KERNEL
);
468 if (usb_bulk_msg(d
->udev
,
469 usb_rcvbulkpipe(d
->udev
, ep
),
470 junk
, junk_len
, &rd_count
, timeout
) < 0)
478 static void cxusb_d680_dmb_drain_video(struct dvb_usb_device
*d
)
480 struct usb_data_stream_properties
*p
= &d
->props
.adapter
[0].fe
[0].stream
;
481 const int timeout
= 100;
482 const int junk_len
= p
->u
.bulk
.buffersize
;
486 /* Discard remaining data in video pipe */
487 junk
= kmalloc(junk_len
, GFP_KERNEL
);
491 if (usb_bulk_msg(d
->udev
,
492 usb_rcvbulkpipe(d
->udev
, p
->endpoint
),
493 junk
, junk_len
, &rd_count
, timeout
) < 0)
501 static int cxusb_d680_dmb_streaming_ctrl(struct dvb_usb_adapter
*adap
,
505 u8 buf
[2] = { 0x03, 0x00 };
507 cxusb_d680_dmb_drain_video(adap
->dev
);
508 return cxusb_ctrl_msg(adap
->dev
, CMD_STREAMING_ON
,
509 buf
, sizeof(buf
), NULL
, 0);
511 int ret
= cxusb_ctrl_msg(adap
->dev
,
512 CMD_STREAMING_OFF
, NULL
, 0, NULL
, 0);
517 static int cxusb_rc_query(struct dvb_usb_device
*d
)
521 if (cxusb_ctrl_msg(d
, CMD_GET_IR_CODE
, NULL
, 0, ircode
, 4) < 0)
524 if (ircode
[2] || ircode
[3])
525 rc_keydown(d
->rc_dev
, RC_PROTO_NEC
,
526 RC_SCANCODE_NEC(~ircode
[2] & 0xff, ircode
[3]), 0);
530 static int cxusb_bluebird2_rc_query(struct dvb_usb_device
*d
)
533 struct i2c_msg msg
= {
540 if (cxusb_i2c_xfer(&d
->i2c_adap
, &msg
, 1) != 1)
543 if (ircode
[1] || ircode
[2])
544 rc_keydown(d
->rc_dev
, RC_PROTO_NEC
,
545 RC_SCANCODE_NEC(~ircode
[1] & 0xff, ircode
[2]), 0);
549 static int cxusb_d680_dmb_rc_query(struct dvb_usb_device
*d
)
553 if (cxusb_ctrl_msg(d
, 0x10, NULL
, 0, ircode
, 2) < 0)
556 if (ircode
[0] || ircode
[1])
557 rc_keydown(d
->rc_dev
, RC_PROTO_UNKNOWN
,
558 RC_SCANCODE_RC5(ircode
[0], ircode
[1]), 0);
562 static int cxusb_dee1601_demod_init(struct dvb_frontend
*fe
)
564 static u8 clock_config
[] = { CLOCK_CTL
, 0x38, 0x28 };
565 static u8 reset
[] = { RESET
, 0x80 };
566 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
567 static u8 agc_cfg
[] = { AGC_TARGET
, 0x28, 0x20 };
568 static u8 gpp_ctl_cfg
[] = { GPP_CTL
, 0x33 };
569 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x32 };
571 mt352_write(fe
, clock_config
, sizeof(clock_config
));
573 mt352_write(fe
, reset
, sizeof(reset
));
574 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
576 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
577 mt352_write(fe
, gpp_ctl_cfg
, sizeof(gpp_ctl_cfg
));
578 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
583 static int cxusb_mt352_demod_init(struct dvb_frontend
*fe
)
585 /* used in both lgz201 and th7579 */
586 static u8 clock_config
[] = { CLOCK_CTL
, 0x38, 0x29 };
587 static u8 reset
[] = { RESET
, 0x80 };
588 static u8 adc_ctl_1_cfg
[] = { ADC_CTL_1
, 0x40 };
589 static u8 agc_cfg
[] = { AGC_TARGET
, 0x24, 0x20 };
590 static u8 gpp_ctl_cfg
[] = { GPP_CTL
, 0x33 };
591 static u8 capt_range_cfg
[] = { CAPT_RANGE
, 0x32 };
593 mt352_write(fe
, clock_config
, sizeof(clock_config
));
595 mt352_write(fe
, reset
, sizeof(reset
));
596 mt352_write(fe
, adc_ctl_1_cfg
, sizeof(adc_ctl_1_cfg
));
598 mt352_write(fe
, agc_cfg
, sizeof(agc_cfg
));
599 mt352_write(fe
, gpp_ctl_cfg
, sizeof(gpp_ctl_cfg
));
600 mt352_write(fe
, capt_range_cfg
, sizeof(capt_range_cfg
));
604 static struct cx22702_config cxusb_cx22702_config
= {
605 .demod_address
= 0x63,
606 .output_mode
= CX22702_PARALLEL_OUTPUT
,
609 static struct lgdt330x_config cxusb_lgdt3303_config
= {
610 .demod_chip
= LGDT3303
,
613 static struct lgdt330x_config cxusb_aver_lgdt3303_config
= {
614 .demod_chip
= LGDT3303
,
615 .clock_polarity_flip
= 2,
618 static struct mt352_config cxusb_dee1601_config
= {
619 .demod_address
= 0x0f,
620 .demod_init
= cxusb_dee1601_demod_init
,
623 static struct zl10353_config cxusb_zl10353_dee1601_config
= {
624 .demod_address
= 0x0f,
628 static struct mt352_config cxusb_mt352_config
= {
629 /* used in both lgz201 and th7579 */
630 .demod_address
= 0x0f,
631 .demod_init
= cxusb_mt352_demod_init
,
634 static struct zl10353_config cxusb_zl10353_xc3028_config
= {
635 .demod_address
= 0x0f,
641 static struct zl10353_config cxusb_zl10353_xc3028_config_no_i2c_gate
= {
642 .demod_address
= 0x0f,
646 .disable_i2c_gate_ctrl
= 1,
649 static struct mt352_config cxusb_mt352_xc3028_config
= {
650 .demod_address
= 0x0f,
653 .demod_init
= cxusb_mt352_demod_init
,
656 /* FIXME: needs tweaking */
657 static struct mxl5005s_config aver_a868r_tuner
= {
659 .if_freq
= 6000000UL,
660 .xtal_freq
= CRYSTAL_FREQ_16000000HZ
,
661 .agc_mode
= MXL_SINGLE_AGC
,
662 .tracking_filter
= MXL_TF_C
,
663 .rssi_enable
= MXL_RSSI_ENABLE
,
664 .cap_select
= MXL_CAP_SEL_ENABLE
,
665 .div_out
= MXL_DIV_OUT_4
,
666 .clock_out
= MXL_CLOCK_OUT_DISABLE
,
667 .output_load
= MXL5005S_IF_OUTPUT_LOAD_200_OHM
,
668 .top
= MXL5005S_TOP_25P2
,
669 .mod_mode
= MXL_DIGITAL_MODE
,
670 .if_mode
= MXL_ZERO_IF
,
671 .AgcMasterByte
= 0x00,
674 /* FIXME: needs tweaking */
675 static struct mxl5005s_config d680_dmb_tuner
= {
677 .if_freq
= 36125000UL,
678 .xtal_freq
= CRYSTAL_FREQ_16000000HZ
,
679 .agc_mode
= MXL_SINGLE_AGC
,
680 .tracking_filter
= MXL_TF_C
,
681 .rssi_enable
= MXL_RSSI_ENABLE
,
682 .cap_select
= MXL_CAP_SEL_ENABLE
,
683 .div_out
= MXL_DIV_OUT_4
,
684 .clock_out
= MXL_CLOCK_OUT_DISABLE
,
685 .output_load
= MXL5005S_IF_OUTPUT_LOAD_200_OHM
,
686 .top
= MXL5005S_TOP_25P2
,
687 .mod_mode
= MXL_DIGITAL_MODE
,
688 .if_mode
= MXL_ZERO_IF
,
689 .AgcMasterByte
= 0x00,
692 static struct max2165_config mygica_d689_max2165_cfg
= {
697 /* Callbacks for DVB USB */
698 static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter
*adap
)
700 struct dvb_usb_device
*dvbdev
= adap
->dev
;
701 bool is_medion
= dvbdev
->props
.devices
[0].warm_ids
[0] ==
702 &cxusb_table
[MEDION_MD95700
];
704 dvb_attach(simple_tuner_attach
, adap
->fe_adap
[0].fe
,
705 &dvbdev
->i2c_adap
, 0x61,
706 TUNER_PHILIPS_FMD1216ME_MK3
);
708 if (is_medion
&& adap
->fe_adap
[0].fe
)
710 * make sure that DVB core won't put to sleep (reset, really)
711 * tuner when we might be open in analog mode
713 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.sleep
= NULL
;
718 static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter
*adap
)
720 dvb_attach(dvb_pll_attach
, adap
->fe_adap
[0].fe
, 0x61,
721 NULL
, DVB_PLL_THOMSON_DTT7579
);
725 static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter
*adap
)
727 dvb_attach(dvb_pll_attach
, adap
->fe_adap
[0].fe
, 0x61,
728 NULL
, DVB_PLL_LG_Z201
);
732 static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter
*adap
)
734 dvb_attach(dvb_pll_attach
, adap
->fe_adap
[0].fe
, 0x60,
735 NULL
, DVB_PLL_THOMSON_DTT7579
);
739 static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter
*adap
)
741 dvb_attach(simple_tuner_attach
, adap
->fe_adap
[0].fe
,
742 &adap
->dev
->i2c_adap
, 0x61, TUNER_LG_TDVS_H06XF
);
746 static int dvico_bluebird_xc2028_callback(void *ptr
, int component
,
747 int command
, int arg
)
749 struct dvb_usb_adapter
*adap
= ptr
;
750 struct dvb_usb_device
*d
= adap
->dev
;
753 case XC2028_TUNER_RESET
:
754 dev_info(&d
->udev
->dev
, "XC2028_TUNER_RESET %d\n", arg
);
755 cxusb_bluebird_gpio_pulse(d
, 0x01, 1);
757 case XC2028_RESET_CLK
:
758 dev_info(&d
->udev
->dev
, "XC2028_RESET_CLK %d\n", arg
);
760 case XC2028_I2C_FLUSH
:
763 dev_info(&d
->udev
->dev
, "unknown command %d, arg %d\n",
771 static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter
*adap
)
773 struct dvb_frontend
*fe
;
774 struct xc2028_config cfg
= {
775 .i2c_adap
= &adap
->dev
->i2c_adap
,
778 static struct xc2028_ctrl ctl
= {
779 .fname
= XC2028_DEFAULT_FIRMWARE
,
781 .demod
= XC3028_FE_ZARLINK456
,
784 /* FIXME: generalize & move to common area */
785 adap
->fe_adap
[0].fe
->callback
= dvico_bluebird_xc2028_callback
;
787 fe
= dvb_attach(xc2028_attach
, adap
->fe_adap
[0].fe
, &cfg
);
788 if (!fe
|| !fe
->ops
.tuner_ops
.set_config
)
791 fe
->ops
.tuner_ops
.set_config(fe
, &ctl
);
796 static int cxusb_mxl5003s_tuner_attach(struct dvb_usb_adapter
*adap
)
798 dvb_attach(mxl5005s_attach
, adap
->fe_adap
[0].fe
,
799 &adap
->dev
->i2c_adap
, &aver_a868r_tuner
);
803 static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter
*adap
)
805 struct dvb_frontend
*fe
;
807 fe
= dvb_attach(mxl5005s_attach
, adap
->fe_adap
[0].fe
,
808 &adap
->dev
->i2c_adap
, &d680_dmb_tuner
);
809 return (!fe
) ? -EIO
: 0;
812 static int cxusb_mygica_d689_tuner_attach(struct dvb_usb_adapter
*adap
)
814 struct dvb_frontend
*fe
;
816 fe
= dvb_attach(max2165_attach
, adap
->fe_adap
[0].fe
,
817 &adap
->dev
->i2c_adap
, &mygica_d689_max2165_cfg
);
818 return (!fe
) ? -EIO
: 0;
821 static int cxusb_medion_fe_ts_bus_ctrl(struct dvb_frontend
*fe
, int acquire
)
823 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
824 struct dvb_usb_device
*dvbdev
= adap
->dev
;
827 return cxusb_medion_get(dvbdev
, CXUSB_OPEN_DIGITAL
);
829 cxusb_medion_put(dvbdev
);
834 static int cxusb_medion_set_mode(struct dvb_usb_device
*dvbdev
, bool digital
)
836 struct cxusb_state
*st
= dvbdev
->priv
;
842 * switching mode while doing an I2C transaction often causes
843 * the device to crash
845 mutex_lock(&dvbdev
->i2c_mutex
);
848 ret
= usb_set_interface(dvbdev
->udev
, 0, 6);
850 dev_err(&dvbdev
->udev
->dev
,
851 "digital interface selection failed (%d)\n",
856 ret
= usb_set_interface(dvbdev
->udev
, 0, 1);
858 dev_err(&dvbdev
->udev
->dev
,
859 "analog interface selection failed (%d)\n",
865 /* pipes need to be cleared after setting interface */
866 ret
= usb_clear_halt(dvbdev
->udev
, usb_rcvbulkpipe(dvbdev
->udev
, 1));
868 dev_warn(&dvbdev
->udev
->dev
,
869 "clear halt on IN pipe failed (%d)\n",
872 ret
= usb_clear_halt(dvbdev
->udev
, usb_sndbulkpipe(dvbdev
->udev
, 1));
874 dev_warn(&dvbdev
->udev
->dev
,
875 "clear halt on OUT pipe failed (%d)\n",
878 ret
= cxusb_ctrl_msg(dvbdev
, digital
? CMD_DIGITAL
: CMD_ANALOG
,
881 dev_err(&dvbdev
->udev
->dev
, "mode switch failed (%d)\n",
886 /* mode switch seems to reset GPIO states */
887 for (i
= 0; i
< ARRAY_SIZE(st
->gpio_write_refresh
); i
++)
888 st
->gpio_write_refresh
[i
] = true;
891 mutex_unlock(&dvbdev
->i2c_mutex
);
896 static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter
*adap
)
898 struct dvb_usb_device
*dvbdev
= adap
->dev
;
899 bool is_medion
= dvbdev
->props
.devices
[0].warm_ids
[0] ==
900 &cxusb_table
[MEDION_MD95700
];
905 ret
= cxusb_medion_set_mode(dvbdev
, true);
910 adap
->fe_adap
[0].fe
= dvb_attach(cx22702_attach
, &cxusb_cx22702_config
,
912 if (!adap
->fe_adap
[0].fe
)
916 adap
->fe_adap
[0].fe
->ops
.ts_bus_ctrl
=
917 cxusb_medion_fe_ts_bus_ctrl
;
922 static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter
*adap
)
924 if (usb_set_interface(adap
->dev
->udev
, 0, 7) < 0)
925 err("set interface failed");
927 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
929 adap
->fe_adap
[0].fe
= dvb_attach(lgdt330x_attach
,
930 &cxusb_lgdt3303_config
,
932 &adap
->dev
->i2c_adap
);
933 if (adap
->fe_adap
[0].fe
)
939 static int cxusb_aver_lgdt3303_frontend_attach(struct dvb_usb_adapter
*adap
)
941 adap
->fe_adap
[0].fe
= dvb_attach(lgdt330x_attach
,
942 &cxusb_aver_lgdt3303_config
,
944 &adap
->dev
->i2c_adap
);
945 if (adap
->fe_adap
[0].fe
)
951 static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter
*adap
)
953 /* used in both lgz201 and th7579 */
954 if (usb_set_interface(adap
->dev
->udev
, 0, 0) < 0)
955 err("set interface failed");
957 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
959 adap
->fe_adap
[0].fe
= dvb_attach(mt352_attach
, &cxusb_mt352_config
,
960 &adap
->dev
->i2c_adap
);
961 if (adap
->fe_adap
[0].fe
)
967 static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter
*adap
)
969 if (usb_set_interface(adap
->dev
->udev
, 0, 0) < 0)
970 err("set interface failed");
972 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
974 adap
->fe_adap
[0].fe
= dvb_attach(mt352_attach
, &cxusb_dee1601_config
,
975 &adap
->dev
->i2c_adap
);
976 if (adap
->fe_adap
[0].fe
)
979 adap
->fe_adap
[0].fe
= dvb_attach(zl10353_attach
,
980 &cxusb_zl10353_dee1601_config
,
981 &adap
->dev
->i2c_adap
);
982 if (adap
->fe_adap
[0].fe
)
988 static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter
*adap
)
992 struct i2c_msg msg
= {
999 if (usb_set_interface(adap
->dev
->udev
, 0, 1) < 0)
1000 err("set interface failed");
1002 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
1004 /* reset the tuner and demodulator */
1005 cxusb_bluebird_gpio_rw(adap
->dev
, 0x04, 0);
1006 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x01, 1);
1007 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x02, 1);
1009 adap
->fe_adap
[0].fe
=
1010 dvb_attach(zl10353_attach
,
1011 &cxusb_zl10353_xc3028_config_no_i2c_gate
,
1012 &adap
->dev
->i2c_adap
);
1013 if (!adap
->fe_adap
[0].fe
)
1016 /* try to determine if there is no IR decoder on the I2C bus */
1017 for (i
= 0; adap
->dev
->props
.rc
.core
.rc_codes
&& i
< 5; i
++) {
1019 if (cxusb_i2c_xfer(&adap
->dev
->i2c_adap
, &msg
, 1) != 1)
1021 if (ircode
[0] == 0 && ircode
[1] == 0)
1023 if (ircode
[2] + ircode
[3] != 0xff) {
1025 adap
->dev
->props
.rc
.core
.rc_codes
= NULL
;
1026 info("No IR receiver detected on this device.");
1034 static struct dibx000_agc_config dib7070_agc_config
= {
1035 .band_caps
= BAND_UHF
| BAND_VHF
| BAND_LBAND
| BAND_SBAND
,
1038 * P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5,
1039 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
1040 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0
1042 .setup
= (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) |
1043 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
1045 .time_stabiliz
= 10,
1069 .perform_agc_softsplit
= 0,
1072 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz
= {
1082 .IO_CLK_en_core
= 1,
1085 /* refsel, sel, freq_15k */
1086 .sad_cfg
= (3 << 14) | (1 << 12) | (524 << 0),
1087 .ifreq
= (0 << 25) | 0,
1089 .xtal_hz
= 12000000,
1092 static struct dib7000p_config cxusb_dualdig4_rev2_config
= {
1093 .output_mode
= OUTMODE_MPEG2_PAR_GATED_CLK
,
1094 .output_mpeg2_in_188_bytes
= 1,
1096 .agc_config_count
= 1,
1097 .agc
= &dib7070_agc_config
,
1098 .bw
= &dib7070_bw_config_12_mhz
,
1099 .tuner_is_baseband
= 1,
1105 .gpio_pwm_pos
= DIB7000P_GPIO_DEFAULT_PWM_POS
,
1107 .hostbus_diversity
= 1,
1110 struct dib0700_adapter_state
{
1111 int (*set_param_save
)(struct dvb_frontend
*fe
);
1112 struct dib7000p_ops dib7000p_ops
;
1115 static int cxusb_dualdig4_rev2_frontend_attach(struct dvb_usb_adapter
*adap
)
1117 struct dib0700_adapter_state
*state
= adap
->priv
;
1119 if (usb_set_interface(adap
->dev
->udev
, 0, 1) < 0)
1120 err("set interface failed");
1122 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
1124 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x02, 1);
1126 if (!dvb_attach(dib7000p_attach
, &state
->dib7000p_ops
))
1129 if (state
->dib7000p_ops
.i2c_enumeration(&adap
->dev
->i2c_adap
, 1, 18,
1130 &cxusb_dualdig4_rev2_config
) < 0) {
1131 pr_warn("Unable to enumerate dib7000p\n");
1135 adap
->fe_adap
[0].fe
= state
->dib7000p_ops
.init(&adap
->dev
->i2c_adap
,
1137 &cxusb_dualdig4_rev2_config
);
1138 if (!adap
->fe_adap
[0].fe
)
1144 static int dib7070_tuner_reset(struct dvb_frontend
*fe
, int onoff
)
1146 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
1147 struct dib0700_adapter_state
*state
= adap
->priv
;
1149 return state
->dib7000p_ops
.set_gpio(fe
, 8, 0, !onoff
);
1152 static int dib7070_tuner_sleep(struct dvb_frontend
*fe
, int onoff
)
1157 static struct dib0070_config dib7070p_dib0070_config
= {
1158 .i2c_address
= DEFAULT_DIB0070_I2C_ADDRESS
,
1159 .reset
= dib7070_tuner_reset
,
1160 .sleep
= dib7070_tuner_sleep
,
1164 static int dib7070_set_param_override(struct dvb_frontend
*fe
)
1166 struct dtv_frontend_properties
*p
= &fe
->dtv_property_cache
;
1167 struct dvb_usb_adapter
*adap
= fe
->dvb
->priv
;
1168 struct dib0700_adapter_state
*state
= adap
->priv
;
1171 u8 band
= BAND_OF_FREQUENCY(p
->frequency
/ 1000);
1183 state
->dib7000p_ops
.set_wbd_ref(fe
, offset
+ dib0070_wbd_offset(fe
));
1185 return state
->set_param_save(fe
);
1188 static int cxusb_dualdig4_rev2_tuner_attach(struct dvb_usb_adapter
*adap
)
1190 struct dib0700_adapter_state
*st
= adap
->priv
;
1191 struct i2c_adapter
*tun_i2c
;
1194 * No need to call dvb7000p_attach here, as it was called
1195 * already, as frontend_attach method is called first, and
1196 * tuner_attach is only called on success.
1198 tun_i2c
= st
->dib7000p_ops
.get_i2c_master(adap
->fe_adap
[0].fe
,
1199 DIBX000_I2C_INTERFACE_TUNER
, 1);
1201 if (dvb_attach(dib0070_attach
, adap
->fe_adap
[0].fe
, tun_i2c
,
1202 &dib7070p_dib0070_config
) == NULL
)
1205 st
->set_param_save
= adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
;
1206 adap
->fe_adap
[0].fe
->ops
.tuner_ops
.set_params
= dib7070_set_param_override
;
1210 static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter
*adap
)
1212 if (usb_set_interface(adap
->dev
->udev
, 0, 1) < 0)
1213 err("set interface failed");
1215 cxusb_ctrl_msg(adap
->dev
, CMD_DIGITAL
, NULL
, 0, NULL
, 0);
1217 /* reset the tuner and demodulator */
1218 cxusb_bluebird_gpio_rw(adap
->dev
, 0x04, 0);
1219 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x01, 1);
1220 cxusb_bluebird_gpio_pulse(adap
->dev
, 0x02, 1);
1222 adap
->fe_adap
[0].fe
= dvb_attach(zl10353_attach
,
1223 &cxusb_zl10353_xc3028_config
,
1224 &adap
->dev
->i2c_adap
);
1225 if (adap
->fe_adap
[0].fe
)
1228 adap
->fe_adap
[0].fe
= dvb_attach(mt352_attach
,
1229 &cxusb_mt352_xc3028_config
,
1230 &adap
->dev
->i2c_adap
);
1231 if (adap
->fe_adap
[0].fe
)
1237 static struct lgs8gxx_config d680_lgs8gl5_cfg
= {
1238 .prod
= LGS8GXX_PROD_LGS8GL5
,
1239 .demod_address
= 0x19,
1243 .if_clk_freq
= 30400, /* 30.4 MHz */
1244 .if_freq
= 5725, /* 5.725 MHz */
1251 static int cxusb_d680_dmb_frontend_attach(struct dvb_usb_adapter
*adap
)
1253 struct dvb_usb_device
*d
= adap
->dev
;
1256 /* Select required USB configuration */
1257 if (usb_set_interface(d
->udev
, 0, 0) < 0)
1258 err("set interface failed");
1260 /* Unblock all USB pipes */
1261 usb_clear_halt(d
->udev
,
1262 usb_sndbulkpipe(d
->udev
,
1263 d
->props
.generic_bulk_ctrl_endpoint
));
1264 usb_clear_halt(d
->udev
,
1265 usb_rcvbulkpipe(d
->udev
,
1266 d
->props
.generic_bulk_ctrl_endpoint
));
1267 usb_clear_halt(d
->udev
,
1268 usb_rcvbulkpipe(d
->udev
,
1269 d
->props
.adapter
[0].fe
[0].stream
.endpoint
));
1271 /* Drain USB pipes to avoid hang after reboot */
1272 for (n
= 0; n
< 5; n
++) {
1273 cxusb_d680_dmb_drain_message(d
);
1274 cxusb_d680_dmb_drain_video(d
);
1278 /* Reset the tuner */
1279 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 0) < 0) {
1280 err("clear tuner gpio failed");
1284 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 1) < 0) {
1285 err("set tuner gpio failed");
1290 /* Attach frontend */
1291 adap
->fe_adap
[0].fe
= dvb_attach(lgs8gxx_attach
,
1292 &d680_lgs8gl5_cfg
, &d
->i2c_adap
);
1293 if (!adap
->fe_adap
[0].fe
)
1299 static struct atbm8830_config mygica_d689_atbm8830_cfg
= {
1300 .prod
= ATBM8830_PROD_8830
,
1301 .demod_address
= 0x40,
1303 .ts_sampling_edge
= 1,
1305 .osc_clk_freq
= 30400, /* in kHz */
1306 .if_freq
= 0, /* zero IF */
1313 static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter
*adap
)
1315 struct dvb_usb_device
*d
= adap
->dev
;
1317 /* Select required USB configuration */
1318 if (usb_set_interface(d
->udev
, 0, 0) < 0)
1319 err("set interface failed");
1321 /* Unblock all USB pipes */
1322 usb_clear_halt(d
->udev
,
1323 usb_sndbulkpipe(d
->udev
,
1324 d
->props
.generic_bulk_ctrl_endpoint
));
1325 usb_clear_halt(d
->udev
,
1326 usb_rcvbulkpipe(d
->udev
,
1327 d
->props
.generic_bulk_ctrl_endpoint
));
1328 usb_clear_halt(d
->udev
,
1329 usb_rcvbulkpipe(d
->udev
,
1330 d
->props
.adapter
[0].fe
[0].stream
.endpoint
));
1332 /* Reset the tuner */
1333 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 0) < 0) {
1334 err("clear tuner gpio failed");
1338 if (cxusb_d680_dmb_gpio_tuner(d
, 0x07, 1) < 0) {
1339 err("set tuner gpio failed");
1344 /* Attach frontend */
1345 adap
->fe_adap
[0].fe
= dvb_attach(atbm8830_attach
,
1346 &mygica_d689_atbm8830_cfg
,
1348 if (!adap
->fe_adap
[0].fe
)
1355 * DViCO has shipped two devices with the same USB ID, but only one of them
1356 * needs a firmware download. Check the device class details to see if they
1357 * have non-default values to decide whether the device is actually cold or
1358 * not, and forget a match if it turns out we selected the wrong device.
1360 static int bluebird_fx2_identify_state(struct usb_device
*udev
,
1361 struct dvb_usb_device_properties
*props
,
1362 struct dvb_usb_device_description
**desc
,
1365 int wascold
= *cold
;
1367 *cold
= udev
->descriptor
.bDeviceClass
== 0xff &&
1368 udev
->descriptor
.bDeviceSubClass
== 0xff &&
1369 udev
->descriptor
.bDeviceProtocol
== 0xff;
1371 if (*cold
&& !wascold
)
1378 * DViCO bluebird firmware needs the "warm" product ID to be patched into the
1379 * firmware file before download.
1382 static const int dvico_firmware_id_offsets
[] = { 6638, 3204 };
1383 static int bluebird_patch_dvico_firmware_download(struct usb_device
*udev
,
1384 const struct firmware
*fw
)
1388 for (pos
= 0; pos
< ARRAY_SIZE(dvico_firmware_id_offsets
); pos
++) {
1389 int idoff
= dvico_firmware_id_offsets
[pos
];
1391 if (fw
->size
< idoff
+ 4)
1394 if (fw
->data
[idoff
] == (USB_VID_DVICO
& 0xff) &&
1395 fw
->data
[idoff
+ 1] == USB_VID_DVICO
>> 8) {
1396 struct firmware new_fw
;
1397 u8
*new_fw_data
= vmalloc(fw
->size
);
1403 memcpy(new_fw_data
, fw
->data
, fw
->size
);
1404 new_fw
.size
= fw
->size
;
1405 new_fw
.data
= new_fw_data
;
1407 new_fw_data
[idoff
+ 2] =
1408 le16_to_cpu(udev
->descriptor
.idProduct
) + 1;
1409 new_fw_data
[idoff
+ 3] =
1410 le16_to_cpu(udev
->descriptor
.idProduct
) >> 8;
1412 ret
= usb_cypress_load_firmware(udev
, &new_fw
,
1422 int cxusb_medion_get(struct dvb_usb_device
*dvbdev
,
1423 enum cxusb_open_type open_type
)
1425 struct cxusb_medion_dev
*cxdev
= dvbdev
->priv
;
1428 mutex_lock(&cxdev
->open_lock
);
1430 if (WARN_ON((cxdev
->open_type
== CXUSB_OPEN_INIT
||
1431 cxdev
->open_type
== CXUSB_OPEN_NONE
) &&
1432 cxdev
->open_ctr
!= 0)) {
1437 if (cxdev
->open_type
== CXUSB_OPEN_INIT
) {
1442 if (cxdev
->open_ctr
== 0) {
1443 if (cxdev
->open_type
!= open_type
) {
1444 dev_info(&dvbdev
->udev
->dev
, "will acquire and switch to %s\n",
1445 open_type
== CXUSB_OPEN_ANALOG
?
1446 "analog" : "digital");
1448 if (open_type
== CXUSB_OPEN_ANALOG
) {
1449 ret
= _cxusb_power_ctrl(dvbdev
, 1);
1451 dev_warn(&dvbdev
->udev
->dev
,
1452 "powerup for analog switch failed (%d)\n",
1455 ret
= cxusb_medion_set_mode(dvbdev
, false);
1459 ret
= cxusb_medion_analog_init(dvbdev
);
1462 } else { /* digital */
1463 ret
= _cxusb_power_ctrl(dvbdev
, 1);
1465 dev_warn(&dvbdev
->udev
->dev
,
1466 "powerup for digital switch failed (%d)\n",
1469 ret
= cxusb_medion_set_mode(dvbdev
, true);
1474 cxdev
->open_type
= open_type
;
1476 dev_info(&dvbdev
->udev
->dev
, "reacquired idle %s\n",
1477 open_type
== CXUSB_OPEN_ANALOG
?
1478 "analog" : "digital");
1481 cxdev
->open_ctr
= 1;
1482 } else if (cxdev
->open_type
== open_type
) {
1484 dev_info(&dvbdev
->udev
->dev
, "acquired %s\n",
1485 open_type
== CXUSB_OPEN_ANALOG
? "analog" : "digital");
1491 mutex_unlock(&cxdev
->open_lock
);
1496 void cxusb_medion_put(struct dvb_usb_device
*dvbdev
)
1498 struct cxusb_medion_dev
*cxdev
= dvbdev
->priv
;
1500 mutex_lock(&cxdev
->open_lock
);
1502 if (cxdev
->open_type
== CXUSB_OPEN_INIT
) {
1503 WARN_ON(cxdev
->open_ctr
!= 0);
1504 cxdev
->open_type
= CXUSB_OPEN_NONE
;
1508 if (!WARN_ON(cxdev
->open_ctr
< 1)) {
1511 dev_info(&dvbdev
->udev
->dev
, "release %s\n",
1512 cxdev
->open_type
== CXUSB_OPEN_ANALOG
?
1513 "analog" : "digital");
1517 mutex_unlock(&cxdev
->open_lock
);
1520 /* DVB USB Driver stuff */
1521 static struct dvb_usb_device_properties cxusb_medion_properties
;
1522 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties
;
1523 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties
;
1524 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties
;
1525 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties
;
1526 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties
;
1527 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties
;
1528 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties
;
1529 static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties
;
1530 static struct dvb_usb_device_properties cxusb_aver_a868r_properties
;
1531 static struct dvb_usb_device_properties cxusb_d680_dmb_properties
;
1532 static struct dvb_usb_device_properties cxusb_mygica_d689_properties
;
1534 static int cxusb_medion_priv_init(struct dvb_usb_device
*dvbdev
)
1536 struct cxusb_medion_dev
*cxdev
= dvbdev
->priv
;
1538 cxdev
->dvbdev
= dvbdev
;
1539 cxdev
->open_type
= CXUSB_OPEN_INIT
;
1540 mutex_init(&cxdev
->open_lock
);
1545 static void cxusb_medion_priv_destroy(struct dvb_usb_device
*dvbdev
)
1547 struct cxusb_medion_dev
*cxdev
= dvbdev
->priv
;
1549 mutex_destroy(&cxdev
->open_lock
);
1552 static bool cxusb_medion_check_altsetting(struct usb_host_interface
*as
)
1556 for (ctr
= 0; ctr
< as
->desc
.bNumEndpoints
; ctr
++) {
1557 if ((as
->endpoint
[ctr
].desc
.bEndpointAddress
&
1558 USB_ENDPOINT_NUMBER_MASK
) != 2)
1561 if (as
->endpoint
[ctr
].desc
.bEndpointAddress
& USB_DIR_IN
&&
1562 ((as
->endpoint
[ctr
].desc
.bmAttributes
&
1563 USB_ENDPOINT_XFERTYPE_MASK
) == USB_ENDPOINT_XFER_ISOC
))
1572 static bool cxusb_medion_check_intf(struct usb_interface
*intf
)
1576 if (intf
->num_altsetting
< 2) {
1577 dev_err(intf
->usb_dev
, "no alternate interface");
1582 for (ctr
= 0; ctr
< intf
->num_altsetting
; ctr
++) {
1583 if (intf
->altsetting
[ctr
].desc
.bAlternateSetting
!= 1)
1586 if (cxusb_medion_check_altsetting(&intf
->altsetting
[ctr
]))
1592 dev_err(intf
->usb_dev
, "no iso interface");
1597 static int cxusb_probe(struct usb_interface
*intf
,
1598 const struct usb_device_id
*id
)
1600 struct dvb_usb_device
*dvbdev
;
1604 if (!dvb_usb_device_init(intf
, &cxusb_medion_properties
,
1605 THIS_MODULE
, &dvbdev
, adapter_nr
)) {
1606 if (!cxusb_medion_check_intf(intf
)) {
1611 _cxusb_power_ctrl(dvbdev
, 1);
1612 ret
= cxusb_medion_set_mode(dvbdev
, false);
1616 ret
= cxusb_medion_register_analog(dvbdev
);
1618 cxusb_medion_set_mode(dvbdev
, true);
1619 _cxusb_power_ctrl(dvbdev
, 0);
1624 /* release device from INIT mode to normal operation */
1625 cxusb_medion_put(dvbdev
);
1628 } else if (!dvb_usb_device_init(intf
,
1629 &cxusb_bluebird_lgh064f_properties
,
1630 THIS_MODULE
, NULL
, adapter_nr
) ||
1631 !dvb_usb_device_init(intf
,
1632 &cxusb_bluebird_dee1601_properties
,
1633 THIS_MODULE
, NULL
, adapter_nr
) ||
1634 !dvb_usb_device_init(intf
,
1635 &cxusb_bluebird_lgz201_properties
,
1636 THIS_MODULE
, NULL
, adapter_nr
) ||
1637 !dvb_usb_device_init(intf
,
1638 &cxusb_bluebird_dtt7579_properties
,
1639 THIS_MODULE
, NULL
, adapter_nr
) ||
1640 !dvb_usb_device_init(intf
,
1641 &cxusb_bluebird_dualdig4_properties
,
1642 THIS_MODULE
, NULL
, adapter_nr
) ||
1643 !dvb_usb_device_init(intf
,
1644 &cxusb_bluebird_nano2_properties
,
1645 THIS_MODULE
, NULL
, adapter_nr
) ||
1646 !dvb_usb_device_init(intf
,
1647 &cxusb_bluebird_nano2_needsfirmware_properties
,
1648 THIS_MODULE
, NULL
, adapter_nr
) ||
1649 !dvb_usb_device_init(intf
, &cxusb_aver_a868r_properties
,
1650 THIS_MODULE
, NULL
, adapter_nr
) ||
1651 !dvb_usb_device_init(intf
,
1652 &cxusb_bluebird_dualdig4_rev2_properties
,
1653 THIS_MODULE
, NULL
, adapter_nr
) ||
1654 !dvb_usb_device_init(intf
, &cxusb_d680_dmb_properties
,
1655 THIS_MODULE
, NULL
, adapter_nr
) ||
1656 !dvb_usb_device_init(intf
, &cxusb_mygica_d689_properties
,
1657 THIS_MODULE
, NULL
, adapter_nr
) ||
1664 dvb_usb_device_exit(intf
);
1669 static void cxusb_disconnect(struct usb_interface
*intf
)
1671 struct dvb_usb_device
*d
= usb_get_intfdata(intf
);
1672 struct cxusb_state
*st
= d
->priv
;
1673 struct i2c_client
*client
;
1675 if (d
->props
.devices
[0].warm_ids
[0] == &cxusb_table
[MEDION_MD95700
])
1676 cxusb_medion_unregister_analog(d
);
1678 /* remove I2C client for tuner */
1679 client
= st
->i2c_client_tuner
;
1681 module_put(client
->dev
.driver
->owner
);
1682 i2c_unregister_device(client
);
1685 /* remove I2C client for demodulator */
1686 client
= st
->i2c_client_demod
;
1688 module_put(client
->dev
.driver
->owner
);
1689 i2c_unregister_device(client
);
1692 dvb_usb_device_exit(intf
);
1695 static struct usb_device_id cxusb_table
[NR__cxusb_table_index
+ 1] = {
1696 [MEDION_MD95700
] = {
1697 USB_DEVICE(USB_VID_MEDION
, USB_PID_MEDION_MD95700
)
1699 [DVICO_BLUEBIRD_LG064F_COLD
] = {
1700 USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LG064F_COLD
)
1702 [DVICO_BLUEBIRD_LG064F_WARM
] = {
1703 USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LG064F_WARM
)
1705 [DVICO_BLUEBIRD_DUAL_1_COLD
] = {
1706 USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD
)
1708 [DVICO_BLUEBIRD_DUAL_1_WARM
] = {
1709 USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM
)
1711 [DVICO_BLUEBIRD_LGZ201_COLD
] = {
1712 USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD
)
1714 [DVICO_BLUEBIRD_LGZ201_WARM
] = {
1715 USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM
)
1717 [DVICO_BLUEBIRD_TH7579_COLD
] = {
1718 USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_TH7579_COLD
)
1720 [DVICO_BLUEBIRD_TH7579_WARM
] = {
1721 USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_TH7579_WARM
)
1723 [DIGITALNOW_BLUEBIRD_DUAL_1_COLD
] = {
1724 USB_DEVICE(USB_VID_DVICO
,
1725 USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD
)
1727 [DIGITALNOW_BLUEBIRD_DUAL_1_WARM
] = {
1728 USB_DEVICE(USB_VID_DVICO
,
1729 USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM
)
1731 [DVICO_BLUEBIRD_DUAL_2_COLD
] = {
1732 USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD
)
1734 [DVICO_BLUEBIRD_DUAL_2_WARM
] = {
1735 USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM
)
1737 [DVICO_BLUEBIRD_DUAL_4
] = {
1738 USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_4
)
1740 [DVICO_BLUEBIRD_DVB_T_NANO_2
] = {
1741 USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2
)
1743 [DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM
] = {
1744 USB_DEVICE(USB_VID_DVICO
,
1745 USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM
)
1747 [AVERMEDIA_VOLAR_A868R
] = {
1748 USB_DEVICE(USB_VID_AVERMEDIA
, USB_PID_AVERMEDIA_VOLAR_A868R
)
1750 [DVICO_BLUEBIRD_DUAL_4_REV_2
] = {
1751 USB_DEVICE(USB_VID_DVICO
, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2
)
1753 [CONEXANT_D680_DMB
] = {
1754 USB_DEVICE(USB_VID_CONEXANT
, USB_PID_CONEXANT_D680_DMB
)
1757 USB_DEVICE(USB_VID_CONEXANT
, USB_PID_MYGICA_D689
)
1759 {} /* Terminating entry */
1761 MODULE_DEVICE_TABLE(usb
, cxusb_table
);
1763 static struct dvb_usb_device_properties cxusb_medion_properties
= {
1764 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1766 .usb_ctrl
= CYPRESS_FX2
,
1768 .size_of_priv
= sizeof(struct cxusb_medion_dev
),
1769 .priv_init
= cxusb_medion_priv_init
,
1770 .priv_destroy
= cxusb_medion_priv_destroy
,
1777 .streaming_ctrl
= cxusb_streaming_ctrl
,
1778 .frontend_attach
= cxusb_cx22702_frontend_attach
,
1779 .tuner_attach
= cxusb_fmd1216me_tuner_attach
,
1780 /* parameter for the MPEG2-data transfer */
1794 .power_ctrl
= cxusb_power_ctrl
,
1796 .i2c_algo
= &cxusb_i2c_algo
,
1798 .generic_bulk_ctrl_endpoint
= 0x01,
1800 .num_device_descs
= 1,
1803 "Medion MD95700 (MDUSBTV-HYBRID)",
1805 { &cxusb_table
[MEDION_MD95700
], NULL
},
1810 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties
= {
1811 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1813 .usb_ctrl
= DEVICE_SPECIFIC
,
1814 .firmware
= "dvb-usb-bluebird-01.fw",
1815 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1817 * use usb alt setting 0 for EP4 transfer (dvb-t),
1818 * use usb alt setting 7 for EP2 transfer (atsc)
1821 .size_of_priv
= sizeof(struct cxusb_state
),
1828 .streaming_ctrl
= cxusb_streaming_ctrl
,
1829 .frontend_attach
= cxusb_lgdt3303_frontend_attach
,
1830 .tuner_attach
= cxusb_lgh064f_tuner_attach
,
1832 /* parameter for the MPEG2-data transfer */
1847 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1849 .i2c_algo
= &cxusb_i2c_algo
,
1853 .rc_codes
= RC_MAP_DVICO_PORTABLE
,
1854 .module_name
= KBUILD_MODNAME
,
1855 .rc_query
= cxusb_rc_query
,
1856 .allowed_protos
= RC_PROTO_BIT_NEC
,
1859 .generic_bulk_ctrl_endpoint
= 0x01,
1861 .num_device_descs
= 1,
1863 { "DViCO FusionHDTV5 USB Gold",
1864 { &cxusb_table
[DVICO_BLUEBIRD_LG064F_COLD
], NULL
},
1865 { &cxusb_table
[DVICO_BLUEBIRD_LG064F_WARM
], NULL
},
1870 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties
= {
1871 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1873 .usb_ctrl
= DEVICE_SPECIFIC
,
1874 .firmware
= "dvb-usb-bluebird-01.fw",
1875 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1877 * use usb alt setting 0 for EP4 transfer (dvb-t),
1878 * use usb alt setting 7 for EP2 transfer (atsc)
1881 .size_of_priv
= sizeof(struct cxusb_state
),
1888 .streaming_ctrl
= cxusb_streaming_ctrl
,
1889 .frontend_attach
= cxusb_dee1601_frontend_attach
,
1890 .tuner_attach
= cxusb_dee1601_tuner_attach
,
1891 /* parameter for the MPEG2-data transfer */
1906 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1908 .i2c_algo
= &cxusb_i2c_algo
,
1912 .rc_codes
= RC_MAP_DVICO_MCE
,
1913 .module_name
= KBUILD_MODNAME
,
1914 .rc_query
= cxusb_rc_query
,
1915 .allowed_protos
= RC_PROTO_BIT_NEC
,
1918 .generic_bulk_ctrl_endpoint
= 0x01,
1920 .num_device_descs
= 3,
1922 { "DViCO FusionHDTV DVB-T Dual USB",
1923 { &cxusb_table
[DVICO_BLUEBIRD_DUAL_1_COLD
], NULL
},
1924 { &cxusb_table
[DVICO_BLUEBIRD_DUAL_1_WARM
], NULL
},
1926 { "DigitalNow DVB-T Dual USB",
1927 { &cxusb_table
[DIGITALNOW_BLUEBIRD_DUAL_1_COLD
], NULL
},
1928 { &cxusb_table
[DIGITALNOW_BLUEBIRD_DUAL_1_WARM
], NULL
},
1930 { "DViCO FusionHDTV DVB-T Dual Digital 2",
1931 { &cxusb_table
[DVICO_BLUEBIRD_DUAL_2_COLD
], NULL
},
1932 { &cxusb_table
[DVICO_BLUEBIRD_DUAL_2_WARM
], NULL
},
1937 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties
= {
1938 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1940 .usb_ctrl
= DEVICE_SPECIFIC
,
1941 .firmware
= "dvb-usb-bluebird-01.fw",
1942 .download_firmware
= bluebird_patch_dvico_firmware_download
,
1944 * use usb alt setting 0 for EP4 transfer (dvb-t),
1945 * use usb alt setting 7 for EP2 transfer (atsc)
1948 .size_of_priv
= sizeof(struct cxusb_state
),
1955 .streaming_ctrl
= cxusb_streaming_ctrl
,
1956 .frontend_attach
= cxusb_mt352_frontend_attach
,
1957 .tuner_attach
= cxusb_lgz201_tuner_attach
,
1959 /* parameter for the MPEG2-data transfer */
1973 .power_ctrl
= cxusb_bluebird_power_ctrl
,
1975 .i2c_algo
= &cxusb_i2c_algo
,
1979 .rc_codes
= RC_MAP_DVICO_PORTABLE
,
1980 .module_name
= KBUILD_MODNAME
,
1981 .rc_query
= cxusb_rc_query
,
1982 .allowed_protos
= RC_PROTO_BIT_NEC
,
1985 .generic_bulk_ctrl_endpoint
= 0x01,
1986 .num_device_descs
= 1,
1988 { "DViCO FusionHDTV DVB-T USB (LGZ201)",
1989 { &cxusb_table
[DVICO_BLUEBIRD_LGZ201_COLD
], NULL
},
1990 { &cxusb_table
[DVICO_BLUEBIRD_LGZ201_WARM
], NULL
},
1995 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties
= {
1996 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
1998 .usb_ctrl
= DEVICE_SPECIFIC
,
1999 .firmware
= "dvb-usb-bluebird-01.fw",
2000 .download_firmware
= bluebird_patch_dvico_firmware_download
,
2003 * use usb alt setting 0 for EP4 transfer (dvb-t),
2004 * use usb alt setting 7 for EP2 transfer (atsc)
2007 .size_of_priv
= sizeof(struct cxusb_state
),
2014 .streaming_ctrl
= cxusb_streaming_ctrl
,
2015 .frontend_attach
= cxusb_mt352_frontend_attach
,
2016 .tuner_attach
= cxusb_dtt7579_tuner_attach
,
2018 /* parameter for the MPEG2-data transfer */
2032 .power_ctrl
= cxusb_bluebird_power_ctrl
,
2034 .i2c_algo
= &cxusb_i2c_algo
,
2038 .rc_codes
= RC_MAP_DVICO_PORTABLE
,
2039 .module_name
= KBUILD_MODNAME
,
2040 .rc_query
= cxusb_rc_query
,
2041 .allowed_protos
= RC_PROTO_BIT_NEC
,
2044 .generic_bulk_ctrl_endpoint
= 0x01,
2046 .num_device_descs
= 1,
2048 { "DViCO FusionHDTV DVB-T USB (TH7579)",
2049 { &cxusb_table
[DVICO_BLUEBIRD_TH7579_COLD
], NULL
},
2050 { &cxusb_table
[DVICO_BLUEBIRD_TH7579_WARM
], NULL
},
2055 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties
= {
2056 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
2058 .usb_ctrl
= CYPRESS_FX2
,
2060 .size_of_priv
= sizeof(struct cxusb_state
),
2067 .streaming_ctrl
= cxusb_streaming_ctrl
,
2068 .frontend_attach
= cxusb_dualdig4_frontend_attach
,
2069 .tuner_attach
= cxusb_dvico_xc3028_tuner_attach
,
2070 /* parameter for the MPEG2-data transfer */
2085 .power_ctrl
= cxusb_power_ctrl
,
2087 .i2c_algo
= &cxusb_i2c_algo
,
2089 .generic_bulk_ctrl_endpoint
= 0x01,
2093 .rc_codes
= RC_MAP_DVICO_MCE
,
2094 .module_name
= KBUILD_MODNAME
,
2095 .rc_query
= cxusb_bluebird2_rc_query
,
2096 .allowed_protos
= RC_PROTO_BIT_NEC
,
2099 .num_device_descs
= 1,
2101 { "DViCO FusionHDTV DVB-T Dual Digital 4",
2103 { &cxusb_table
[DVICO_BLUEBIRD_DUAL_4
], NULL
},
2108 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties
= {
2109 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
2111 .usb_ctrl
= CYPRESS_FX2
,
2112 .identify_state
= bluebird_fx2_identify_state
,
2114 .size_of_priv
= sizeof(struct cxusb_state
),
2121 .streaming_ctrl
= cxusb_streaming_ctrl
,
2122 .frontend_attach
= cxusb_nano2_frontend_attach
,
2123 .tuner_attach
= cxusb_dvico_xc3028_tuner_attach
,
2124 /* parameter for the MPEG2-data transfer */
2139 .power_ctrl
= cxusb_nano2_power_ctrl
,
2141 .i2c_algo
= &cxusb_i2c_algo
,
2143 .generic_bulk_ctrl_endpoint
= 0x01,
2147 .rc_codes
= RC_MAP_DVICO_PORTABLE
,
2148 .module_name
= KBUILD_MODNAME
,
2149 .rc_query
= cxusb_bluebird2_rc_query
,
2150 .allowed_protos
= RC_PROTO_BIT_NEC
,
2153 .num_device_descs
= 1,
2155 { "DViCO FusionHDTV DVB-T NANO2",
2157 { &cxusb_table
[DVICO_BLUEBIRD_DVB_T_NANO_2
], NULL
},
2162 static struct dvb_usb_device_properties
2163 cxusb_bluebird_nano2_needsfirmware_properties
= {
2164 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
2166 .usb_ctrl
= DEVICE_SPECIFIC
,
2167 .firmware
= "dvb-usb-bluebird-02.fw",
2168 .download_firmware
= bluebird_patch_dvico_firmware_download
,
2169 .identify_state
= bluebird_fx2_identify_state
,
2171 .size_of_priv
= sizeof(struct cxusb_state
),
2178 .streaming_ctrl
= cxusb_streaming_ctrl
,
2179 .frontend_attach
= cxusb_nano2_frontend_attach
,
2180 .tuner_attach
= cxusb_dvico_xc3028_tuner_attach
,
2181 /* parameter for the MPEG2-data transfer */
2196 .power_ctrl
= cxusb_nano2_power_ctrl
,
2198 .i2c_algo
= &cxusb_i2c_algo
,
2200 .generic_bulk_ctrl_endpoint
= 0x01,
2204 .rc_codes
= RC_MAP_DVICO_PORTABLE
,
2205 .module_name
= KBUILD_MODNAME
,
2206 .rc_query
= cxusb_rc_query
,
2207 .allowed_protos
= RC_PROTO_BIT_NEC
,
2210 .num_device_descs
= 1,
2212 "DViCO FusionHDTV DVB-T NANO2 w/o firmware",
2213 { &cxusb_table
[DVICO_BLUEBIRD_DVB_T_NANO_2
], NULL
},
2214 { &cxusb_table
[DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM
],
2220 static struct dvb_usb_device_properties cxusb_aver_a868r_properties
= {
2221 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
2223 .usb_ctrl
= CYPRESS_FX2
,
2225 .size_of_priv
= sizeof(struct cxusb_state
),
2232 .streaming_ctrl
= cxusb_aver_streaming_ctrl
,
2233 .frontend_attach
= cxusb_aver_lgdt3303_frontend_attach
,
2234 .tuner_attach
= cxusb_mxl5003s_tuner_attach
,
2235 /* parameter for the MPEG2-data transfer */
2249 .power_ctrl
= cxusb_aver_power_ctrl
,
2251 .i2c_algo
= &cxusb_i2c_algo
,
2253 .generic_bulk_ctrl_endpoint
= 0x01,
2255 .num_device_descs
= 1,
2257 { "AVerMedia AVerTVHD Volar (A868R)",
2259 { &cxusb_table
[AVERMEDIA_VOLAR_A868R
], NULL
},
2265 struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties
= {
2266 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
2268 .usb_ctrl
= CYPRESS_FX2
,
2270 .size_of_priv
= sizeof(struct cxusb_state
),
2275 .size_of_priv
= sizeof(struct dib0700_adapter_state
),
2278 .streaming_ctrl
= cxusb_streaming_ctrl
,
2279 .frontend_attach
= cxusb_dualdig4_rev2_frontend_attach
,
2280 .tuner_attach
= cxusb_dualdig4_rev2_tuner_attach
,
2281 /* parameter for the MPEG2-data transfer */
2296 .power_ctrl
= cxusb_bluebird_power_ctrl
,
2298 .i2c_algo
= &cxusb_i2c_algo
,
2300 .generic_bulk_ctrl_endpoint
= 0x01,
2304 .rc_codes
= RC_MAP_DVICO_MCE
,
2305 .module_name
= KBUILD_MODNAME
,
2306 .rc_query
= cxusb_rc_query
,
2307 .allowed_protos
= RC_PROTO_BIT_NEC
,
2310 .num_device_descs
= 1,
2312 { "DViCO FusionHDTV DVB-T Dual Digital 4 (rev 2)",
2314 { &cxusb_table
[DVICO_BLUEBIRD_DUAL_4_REV_2
], NULL
},
2319 static struct dvb_usb_device_properties cxusb_d680_dmb_properties
= {
2320 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
2322 .usb_ctrl
= CYPRESS_FX2
,
2324 .size_of_priv
= sizeof(struct cxusb_state
),
2331 .streaming_ctrl
= cxusb_d680_dmb_streaming_ctrl
,
2332 .frontend_attach
= cxusb_d680_dmb_frontend_attach
,
2333 .tuner_attach
= cxusb_d680_dmb_tuner_attach
,
2335 /* parameter for the MPEG2-data transfer */
2350 .power_ctrl
= cxusb_d680_dmb_power_ctrl
,
2352 .i2c_algo
= &cxusb_i2c_algo
,
2354 .generic_bulk_ctrl_endpoint
= 0x01,
2358 .rc_codes
= RC_MAP_TOTAL_MEDIA_IN_HAND_02
,
2359 .module_name
= KBUILD_MODNAME
,
2360 .rc_query
= cxusb_d680_dmb_rc_query
,
2361 .allowed_protos
= RC_PROTO_BIT_UNKNOWN
,
2364 .num_device_descs
= 1,
2367 "Conexant DMB-TH Stick",
2369 { &cxusb_table
[CONEXANT_D680_DMB
], NULL
},
2374 static struct dvb_usb_device_properties cxusb_mygica_d689_properties
= {
2375 .caps
= DVB_USB_IS_AN_I2C_ADAPTER
,
2377 .usb_ctrl
= CYPRESS_FX2
,
2379 .size_of_priv
= sizeof(struct cxusb_state
),
2386 .streaming_ctrl
= cxusb_d680_dmb_streaming_ctrl
,
2387 .frontend_attach
= cxusb_mygica_d689_frontend_attach
,
2388 .tuner_attach
= cxusb_mygica_d689_tuner_attach
,
2390 /* parameter for the MPEG2-data transfer */
2405 .power_ctrl
= cxusb_d680_dmb_power_ctrl
,
2407 .i2c_algo
= &cxusb_i2c_algo
,
2409 .generic_bulk_ctrl_endpoint
= 0x01,
2413 .rc_codes
= RC_MAP_D680_DMB
,
2414 .module_name
= KBUILD_MODNAME
,
2415 .rc_query
= cxusb_d680_dmb_rc_query
,
2416 .allowed_protos
= RC_PROTO_BIT_UNKNOWN
,
2419 .num_device_descs
= 1,
2422 "Mygica D689 DMB-TH",
2424 { &cxusb_table
[MYGICA_D689
], NULL
},
2429 static struct usb_driver cxusb_driver
= {
2430 .name
= "dvb_usb_cxusb",
2431 .probe
= cxusb_probe
,
2432 .disconnect
= cxusb_disconnect
,
2433 .id_table
= cxusb_table
,
2436 module_usb_driver(cxusb_driver
);
2438 MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@posteo.de>");
2439 MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
2440 MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
2441 MODULE_AUTHOR("Maciej S. Szmigiero <mail@maciej.szmigiero.name>");
2442 MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
2443 MODULE_LICENSE("GPL");