1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#include <media/tuner.h>
27#include <linux/vmalloc.h>
28#include <linux/slab.h>
29#include <linux/kernel.h>
30
31#include "cxusb.h"
32
33#include "cx22702.h"
34#include "lgdt330x.h"
35#include "mt352.h"
36#include "mt352_priv.h"
37#include "zl10353.h"
38#include "tuner-xc2028.h"
39#include "tuner-simple.h"
40#include "mxl5005s.h"
41#include "max2165.h"
42#include "dib7000p.h"
43#include "dib0070.h"
44#include "lgs8gxx.h"
45#include "atbm8830.h"
46#include "si2168.h"
47#include "si2157.h"
48
49
50static int dvb_usb_cxusb_debug;
51module_param_named(debug, dvb_usb_cxusb_debug, int, 0644);
52MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
53
54DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
55
56#define deb_info(args...) dprintk(dvb_usb_cxusb_debug, 0x03, args)
57#define deb_i2c(args...) dprintk(dvb_usb_cxusb_debug, 0x02, args)
58
59static int cxusb_ctrl_msg(struct dvb_usb_device *d,
60 u8 cmd, const u8 *wbuf, int wlen, u8 *rbuf, int rlen)
61{
62 struct cxusb_state *st = d->priv;
63 int ret;
64
65 if (1 + wlen > MAX_XFER_SIZE) {
66 warn("i2c wr: len=%d is too big!\n", wlen);
67 return -EOPNOTSUPP;
68 }
69
70 if (rlen > MAX_XFER_SIZE) {
71 warn("i2c rd: len=%d is too big!\n", rlen);
72 return -EOPNOTSUPP;
73 }
74
75 mutex_lock(&d->data_mutex);
76 st->data[0] = cmd;
77 memcpy(&st->data[1], wbuf, wlen);
78 ret = dvb_usb_generic_rw(d, st->data, 1 + wlen, st->data, rlen, 0);
79 if (!ret && rbuf && rlen)
80 memcpy(rbuf, st->data, rlen);
81
82 mutex_unlock(&d->data_mutex);
83 return ret;
84}
85
86
87static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff)
88{
89 struct cxusb_state *st = d->priv;
90 u8 o[2], i;
91
92 if (st->gpio_write_state[GPIO_TUNER] == onoff)
93 return;
94
95 o[0] = GPIO_TUNER;
96 o[1] = onoff;
97 cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1);
98
99 if (i != 0x01)
100 deb_info("gpio_write failed.\n");
101
102 st->gpio_write_state[GPIO_TUNER] = onoff;
103}
104
105static int cxusb_bluebird_gpio_rw(struct dvb_usb_device *d, u8 changemask,
106 u8 newval)
107{
108 u8 o[2], gpio_state;
109 int rc;
110
111 o[0] = 0xff & ~changemask;
112 o[1] = newval & changemask;
113
114 rc = cxusb_ctrl_msg(d, CMD_BLUEBIRD_GPIO_RW, o, 2, &gpio_state, 1);
115 if (rc < 0 || (gpio_state & changemask) != (newval & changemask))
116 deb_info("bluebird_gpio_write failed.\n");
117
118 return rc < 0 ? rc : gpio_state;
119}
120
121static void cxusb_bluebird_gpio_pulse(struct dvb_usb_device *d, u8 pin, int low)
122{
123 cxusb_bluebird_gpio_rw(d, pin, low ? 0 : pin);
124 msleep(5);
125 cxusb_bluebird_gpio_rw(d, pin, low ? pin : 0);
126}
127
128static void cxusb_nano2_led(struct dvb_usb_device *d, int onoff)
129{
130 cxusb_bluebird_gpio_rw(d, 0x40, onoff ? 0 : 0x40);
131}
132
133static int cxusb_d680_dmb_gpio_tuner(struct dvb_usb_device *d,
134 u8 addr, int onoff)
135{
136 u8 o[2] = {addr, onoff};
137 u8 i;
138 int rc;
139
140 rc = cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1);
141
142 if (rc < 0)
143 return rc;
144 if (i == 0x01)
145 return 0;
146 else {
147 deb_info("gpio_write failed.\n");
148 return -EIO;
149 }
150}
151
152
153static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
154 int num)
155{
156 struct dvb_usb_device *d = i2c_get_adapdata(adap);
157 int ret;
158 int i;
159
160 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
161 return -EAGAIN;
162
163 for (i = 0; i < num; i++) {
164
165 if (le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_MEDION)
166 switch (msg[i].addr) {
167 case 0x63:
168 cxusb_gpio_tuner(d, 0);
169 break;
170 default:
171 cxusb_gpio_tuner(d, 1);
172 break;
173 }
174
175 if (msg[i].flags & I2C_M_RD) {
176
177 u8 obuf[3], ibuf[MAX_XFER_SIZE];
178
179 if (1 + msg[i].len > sizeof(ibuf)) {
180 warn("i2c rd: len=%d is too big!\n",
181 msg[i].len);
182 ret = -EOPNOTSUPP;
183 goto unlock;
184 }
185 obuf[0] = 0;
186 obuf[1] = msg[i].len;
187 obuf[2] = msg[i].addr;
188 if (cxusb_ctrl_msg(d, CMD_I2C_READ,
189 obuf, 3,
190 ibuf, 1+msg[i].len) < 0) {
191 warn("i2c read failed");
192 break;
193 }
194 memcpy(msg[i].buf, &ibuf[1], msg[i].len);
195 } else if (i+1 < num && (msg[i+1].flags & I2C_M_RD) &&
196 msg[i].addr == msg[i+1].addr) {
197
198 u8 obuf[MAX_XFER_SIZE], ibuf[MAX_XFER_SIZE];
199
200 if (3 + msg[i].len > sizeof(obuf)) {
201 warn("i2c wr: len=%d is too big!\n",
202 msg[i].len);
203 ret = -EOPNOTSUPP;
204 goto unlock;
205 }
206 if (1 + msg[i + 1].len > sizeof(ibuf)) {
207 warn("i2c rd: len=%d is too big!\n",
208 msg[i + 1].len);
209 ret = -EOPNOTSUPP;
210 goto unlock;
211 }
212 obuf[0] = msg[i].len;
213 obuf[1] = msg[i+1].len;
214 obuf[2] = msg[i].addr;
215 memcpy(&obuf[3], msg[i].buf, msg[i].len);
216
217 if (cxusb_ctrl_msg(d, CMD_I2C_READ,
218 obuf, 3+msg[i].len,
219 ibuf, 1+msg[i+1].len) < 0)
220 break;
221
222 if (ibuf[0] != 0x08)
223 deb_i2c("i2c read may have failed\n");
224
225 memcpy(msg[i+1].buf, &ibuf[1], msg[i+1].len);
226
227 i++;
228 } else {
229
230 u8 obuf[MAX_XFER_SIZE], ibuf;
231
232 if (2 + msg[i].len > sizeof(obuf)) {
233 warn("i2c wr: len=%d is too big!\n",
234 msg[i].len);
235 ret = -EOPNOTSUPP;
236 goto unlock;
237 }
238 obuf[0] = msg[i].addr;
239 obuf[1] = msg[i].len;
240 memcpy(&obuf[2], msg[i].buf, msg[i].len);
241
242 if (cxusb_ctrl_msg(d, CMD_I2C_WRITE, obuf,
243 2+msg[i].len, &ibuf,1) < 0)
244 break;
245 if (ibuf != 0x08)
246 deb_i2c("i2c write may have failed\n");
247 }
248 }
249
250 if (i == num)
251 ret = num;
252 else
253 ret = -EREMOTEIO;
254
255unlock:
256 mutex_unlock(&d->i2c_mutex);
257 return ret;
258}
259
260static u32 cxusb_i2c_func(struct i2c_adapter *adapter)
261{
262 return I2C_FUNC_I2C;
263}
264
265static struct i2c_algorithm cxusb_i2c_algo = {
266 .master_xfer = cxusb_i2c_xfer,
267 .functionality = cxusb_i2c_func,
268};
269
270static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff)
271{
272 u8 b = 0;
273 if (onoff)
274 return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0);
275 else
276 return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0);
277}
278
279static int cxusb_aver_power_ctrl(struct dvb_usb_device *d, int onoff)
280{
281 int ret;
282 if (!onoff)
283 return cxusb_ctrl_msg(d, CMD_POWER_OFF, NULL, 0, NULL, 0);
284 if (d->state == DVB_USB_STATE_INIT &&
285 usb_set_interface(d->udev, 0, 0) < 0)
286 err("set interface failed");
287 do {} while (!(ret = cxusb_ctrl_msg(d, CMD_POWER_ON, NULL, 0, NULL, 0)) &&
288 !(ret = cxusb_ctrl_msg(d, 0x15, NULL, 0, NULL, 0)) &&
289 !(ret = cxusb_ctrl_msg(d, 0x17, NULL, 0, NULL, 0)) && 0);
290 if (!ret) {
291
292
293 int i;
294 u8 buf;
295 static const u8 bufs[] = {
296 0x0e, 0x2, 0x00, 0x7f,
297 0x0e, 0x2, 0x02, 0xfe,
298 0x0e, 0x2, 0x02, 0x01,
299 0x0e, 0x2, 0x00, 0x03,
300 0x0e, 0x2, 0x0d, 0x40,
301 0x0e, 0x2, 0x0e, 0x87,
302 0x0e, 0x2, 0x0f, 0x8e,
303 0x0e, 0x2, 0x10, 0x01,
304 0x0e, 0x2, 0x14, 0xd7,
305 0x0e, 0x2, 0x47, 0x88,
306 };
307 msleep(20);
308 for (i = 0; i < ARRAY_SIZE(bufs); i += 4 / sizeof(u8)) {
309 ret = cxusb_ctrl_msg(d, CMD_I2C_WRITE,
310 bufs+i, 4, &buf, 1);
311 if (ret)
312 break;
313 if (buf != 0x8)
314 return -EREMOTEIO;
315 }
316 }
317 return ret;
318}
319
320static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff)
321{
322 u8 b = 0;
323 if (onoff)
324 return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0);
325 else
326 return 0;
327}
328
329static int cxusb_nano2_power_ctrl(struct dvb_usb_device *d, int onoff)
330{
331 int rc = 0;
332
333 rc = cxusb_power_ctrl(d, onoff);
334 if (!onoff)
335 cxusb_nano2_led(d, 0);
336
337 return rc;
338}
339
340static int cxusb_d680_dmb_power_ctrl(struct dvb_usb_device *d, int onoff)
341{
342 int ret;
343 u8 b;
344 ret = cxusb_power_ctrl(d, onoff);
345 if (!onoff)
346 return ret;
347
348 msleep(128);
349 cxusb_ctrl_msg(d, CMD_DIGITAL, NULL, 0, &b, 1);
350 msleep(100);
351 return ret;
352}
353
354static int cxusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
355{
356 u8 buf[2] = { 0x03, 0x00 };
357 if (onoff)
358 cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON, buf, 2, NULL, 0);
359 else
360 cxusb_ctrl_msg(adap->dev, CMD_STREAMING_OFF, NULL, 0, NULL, 0);
361
362 return 0;
363}
364
365static int cxusb_aver_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
366{
367 if (onoff)
368 cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_ON, NULL, 0, NULL, 0);
369 else
370 cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_OFF,
371 NULL, 0, NULL, 0);
372 return 0;
373}
374
375static int cxusb_read_status(struct dvb_frontend *fe,
376 enum fe_status *status)
377{
378 struct dvb_usb_adapter *adap = (struct dvb_usb_adapter *)fe->dvb->priv;
379 struct cxusb_state *state = (struct cxusb_state *)adap->dev->priv;
380 int ret;
381
382 ret = state->fe_read_status(fe, status);
383
384
385 if ((*status & FE_HAS_LOCK) && (!state->last_lock)) {
386 mutex_lock(&state->stream_mutex);
387 cxusb_streaming_ctrl(adap, 1);
388 mutex_unlock(&state->stream_mutex);
389 }
390
391 state->last_lock = (*status & FE_HAS_LOCK) ? 1 : 0;
392 return ret;
393}
394
395static void cxusb_d680_dmb_drain_message(struct dvb_usb_device *d)
396{
397 int ep = d->props.generic_bulk_ctrl_endpoint;
398 const int timeout = 100;
399 const int junk_len = 32;
400 u8 *junk;
401 int rd_count;
402
403
404 junk = kmalloc(junk_len, GFP_KERNEL);
405 if (!junk)
406 return;
407 while (1) {
408 if (usb_bulk_msg(d->udev,
409 usb_rcvbulkpipe(d->udev, ep),
410 junk, junk_len, &rd_count, timeout) < 0)
411 break;
412 if (!rd_count)
413 break;
414 }
415 kfree(junk);
416}
417
418static void cxusb_d680_dmb_drain_video(struct dvb_usb_device *d)
419{
420 struct usb_data_stream_properties *p = &d->props.adapter[0].fe[0].stream;
421 const int timeout = 100;
422 const int junk_len = p->u.bulk.buffersize;
423 u8 *junk;
424 int rd_count;
425
426
427 junk = kmalloc(junk_len, GFP_KERNEL);
428 if (!junk)
429 return;
430 while (1) {
431 if (usb_bulk_msg(d->udev,
432 usb_rcvbulkpipe(d->udev, p->endpoint),
433 junk, junk_len, &rd_count, timeout) < 0)
434 break;
435 if (!rd_count)
436 break;
437 }
438 kfree(junk);
439}
440
441static int cxusb_d680_dmb_streaming_ctrl(
442 struct dvb_usb_adapter *adap, int onoff)
443{
444 if (onoff) {
445 u8 buf[2] = { 0x03, 0x00 };
446 cxusb_d680_dmb_drain_video(adap->dev);
447 return cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON,
448 buf, sizeof(buf), NULL, 0);
449 } else {
450 int ret = cxusb_ctrl_msg(adap->dev,
451 CMD_STREAMING_OFF, NULL, 0, NULL, 0);
452 return ret;
453 }
454}
455
456static int cxusb_rc_query(struct dvb_usb_device *d)
457{
458 u8 ircode[4];
459
460 cxusb_ctrl_msg(d, CMD_GET_IR_CODE, NULL, 0, ircode, 4);
461
462 if (ircode[2] || ircode[3])
463 rc_keydown(d->rc_dev, RC_PROTO_NEC,
464 RC_SCANCODE_NEC(~ircode[2] & 0xff, ircode[3]), 0);
465 return 0;
466}
467
468static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d)
469{
470 u8 ircode[4];
471 struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD,
472 .buf = ircode, .len = 4 };
473
474 if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1)
475 return 0;
476
477 if (ircode[1] || ircode[2])
478 rc_keydown(d->rc_dev, RC_PROTO_NEC,
479 RC_SCANCODE_NEC(~ircode[1] & 0xff, ircode[2]), 0);
480 return 0;
481}
482
483static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d)
484{
485 u8 ircode[2];
486
487 if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0)
488 return 0;
489
490 if (ircode[0] || ircode[1])
491 rc_keydown(d->rc_dev, RC_PROTO_UNKNOWN,
492 RC_SCANCODE_RC5(ircode[0], ircode[1]), 0);
493 return 0;
494}
495
496static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
497{
498 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x28 };
499 static u8 reset [] = { RESET, 0x80 };
500 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
501 static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 };
502 static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
503 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
504
505 mt352_write(fe, clock_config, sizeof(clock_config));
506 udelay(200);
507 mt352_write(fe, reset, sizeof(reset));
508 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
509
510 mt352_write(fe, agc_cfg, sizeof(agc_cfg));
511 mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
512 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
513
514 return 0;
515}
516
517static int cxusb_mt352_demod_init(struct dvb_frontend* fe)
518{
519 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x29 };
520 static u8 reset [] = { RESET, 0x80 };
521 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
522 static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 };
523 static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
524 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
525
526 mt352_write(fe, clock_config, sizeof(clock_config));
527 udelay(200);
528 mt352_write(fe, reset, sizeof(reset));
529 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
530
531 mt352_write(fe, agc_cfg, sizeof(agc_cfg));
532 mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
533 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
534 return 0;
535}
536
537static struct cx22702_config cxusb_cx22702_config = {
538 .demod_address = 0x63,
539 .output_mode = CX22702_PARALLEL_OUTPUT,
540};
541
542static struct lgdt330x_config cxusb_lgdt3303_config = {
543 .demod_address = 0x0e,
544 .demod_chip = LGDT3303,
545};
546
547static struct lgdt330x_config cxusb_aver_lgdt3303_config = {
548 .demod_address = 0x0e,
549 .demod_chip = LGDT3303,
550 .clock_polarity_flip = 2,
551};
552
553static struct mt352_config cxusb_dee1601_config = {
554 .demod_address = 0x0f,
555 .demod_init = cxusb_dee1601_demod_init,
556};
557
558static struct zl10353_config cxusb_zl10353_dee1601_config = {
559 .demod_address = 0x0f,
560 .parallel_ts = 1,
561};
562
563static struct mt352_config cxusb_mt352_config = {
564
565 .demod_address = 0x0f,
566 .demod_init = cxusb_mt352_demod_init,
567};
568
569static struct zl10353_config cxusb_zl10353_xc3028_config = {
570 .demod_address = 0x0f,
571 .if2 = 45600,
572 .no_tuner = 1,
573 .parallel_ts = 1,
574};
575
576static struct zl10353_config cxusb_zl10353_xc3028_config_no_i2c_gate = {
577 .demod_address = 0x0f,
578 .if2 = 45600,
579 .no_tuner = 1,
580 .parallel_ts = 1,
581 .disable_i2c_gate_ctrl = 1,
582};
583
584static struct mt352_config cxusb_mt352_xc3028_config = {
585 .demod_address = 0x0f,
586 .if2 = 4560,
587 .no_tuner = 1,
588 .demod_init = cxusb_mt352_demod_init,
589};
590
591
592static struct mxl5005s_config aver_a868r_tuner = {
593 .i2c_address = 0x63,
594 .if_freq = 6000000UL,
595 .xtal_freq = CRYSTAL_FREQ_16000000HZ,
596 .agc_mode = MXL_SINGLE_AGC,
597 .tracking_filter = MXL_TF_C,
598 .rssi_enable = MXL_RSSI_ENABLE,
599 .cap_select = MXL_CAP_SEL_ENABLE,
600 .div_out = MXL_DIV_OUT_4,
601 .clock_out = MXL_CLOCK_OUT_DISABLE,
602 .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
603 .top = MXL5005S_TOP_25P2,
604 .mod_mode = MXL_DIGITAL_MODE,
605 .if_mode = MXL_ZERO_IF,
606 .AgcMasterByte = 0x00,
607};
608
609
610static struct mxl5005s_config d680_dmb_tuner = {
611 .i2c_address = 0x63,
612 .if_freq = 36125000UL,
613 .xtal_freq = CRYSTAL_FREQ_16000000HZ,
614 .agc_mode = MXL_SINGLE_AGC,
615 .tracking_filter = MXL_TF_C,
616 .rssi_enable = MXL_RSSI_ENABLE,
617 .cap_select = MXL_CAP_SEL_ENABLE,
618 .div_out = MXL_DIV_OUT_4,
619 .clock_out = MXL_CLOCK_OUT_DISABLE,
620 .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM,
621 .top = MXL5005S_TOP_25P2,
622 .mod_mode = MXL_DIGITAL_MODE,
623 .if_mode = MXL_ZERO_IF,
624 .AgcMasterByte = 0x00,
625};
626
627static struct max2165_config mygica_d689_max2165_cfg = {
628 .i2c_address = 0x60,
629 .osc_clk = 20
630};
631
632
633static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap)
634{
635 dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe,
636 &adap->dev->i2c_adap, 0x61,
637 TUNER_PHILIPS_FMD1216ME_MK3);
638 return 0;
639}
640
641static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter *adap)
642{
643 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61,
644 NULL, DVB_PLL_THOMSON_DTT7579);
645 return 0;
646}
647
648static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap)
649{
650 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61, NULL, DVB_PLL_LG_Z201);
651 return 0;
652}
653
654static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter *adap)
655{
656 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60,
657 NULL, DVB_PLL_THOMSON_DTT7579);
658 return 0;
659}
660
661static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap)
662{
663 dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe,
664 &adap->dev->i2c_adap, 0x61, TUNER_LG_TDVS_H06XF);
665 return 0;
666}
667
668static int dvico_bluebird_xc2028_callback(void *ptr, int component,
669 int command, int arg)
670{
671 struct dvb_usb_adapter *adap = ptr;
672 struct dvb_usb_device *d = adap->dev;
673
674 switch (command) {
675 case XC2028_TUNER_RESET:
676 deb_info("%s: XC2028_TUNER_RESET %d\n", __func__, arg);
677 cxusb_bluebird_gpio_pulse(d, 0x01, 1);
678 break;
679 case XC2028_RESET_CLK:
680 deb_info("%s: XC2028_RESET_CLK %d\n", __func__, arg);
681 break;
682 case XC2028_I2C_FLUSH:
683 break;
684 default:
685 deb_info("%s: unknown command %d, arg %d\n", __func__,
686 command, arg);
687 return -EINVAL;
688 }
689
690 return 0;
691}
692
693static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
694{
695 struct dvb_frontend *fe;
696 struct xc2028_config cfg = {
697 .i2c_adap = &adap->dev->i2c_adap,
698 .i2c_addr = 0x61,
699 };
700 static struct xc2028_ctrl ctl = {
701 .fname = XC2028_DEFAULT_FIRMWARE,
702 .max_len = 64,
703 .demod = XC3028_FE_ZARLINK456,
704 };
705
706
707 adap->fe_adap[0].fe->callback = dvico_bluebird_xc2028_callback;
708
709 fe = dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &cfg);
710 if (fe == NULL || fe->ops.tuner_ops.set_config == NULL)
711 return -EIO;
712
713 fe->ops.tuner_ops.set_config(fe, &ctl);
714
715 return 0;
716}
717
718static int cxusb_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap)
719{
720 dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe,
721 &adap->dev->i2c_adap, &aver_a868r_tuner);
722 return 0;
723}
724
725static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter *adap)
726{
727 struct dvb_frontend *fe;
728 fe = dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe,
729 &adap->dev->i2c_adap, &d680_dmb_tuner);
730 return (fe == NULL) ? -EIO : 0;
731}
732
733static int cxusb_mygica_d689_tuner_attach(struct dvb_usb_adapter *adap)
734{
735 struct dvb_frontend *fe;
736 fe = dvb_attach(max2165_attach, adap->fe_adap[0].fe,
737 &adap->dev->i2c_adap, &mygica_d689_max2165_cfg);
738 return (fe == NULL) ? -EIO : 0;
739}
740
741static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap)
742{
743 u8 b;
744 if (usb_set_interface(adap->dev->udev, 0, 6) < 0)
745 err("set interface failed");
746
747 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, &b, 1);
748
749 adap->fe_adap[0].fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config,
750 &adap->dev->i2c_adap);
751 if ((adap->fe_adap[0].fe) != NULL)
752 return 0;
753
754 return -EIO;
755}
756
757static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap)
758{
759 if (usb_set_interface(adap->dev->udev, 0, 7) < 0)
760 err("set interface failed");
761
762 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
763
764 adap->fe_adap[0].fe = dvb_attach(lgdt330x_attach,
765 &cxusb_lgdt3303_config,
766 &adap->dev->i2c_adap);
767 if ((adap->fe_adap[0].fe) != NULL)
768 return 0;
769
770 return -EIO;
771}
772
773static int cxusb_aver_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap)
774{
775 adap->fe_adap[0].fe = dvb_attach(lgdt330x_attach, &cxusb_aver_lgdt3303_config,
776 &adap->dev->i2c_adap);
777 if (adap->fe_adap[0].fe != NULL)
778 return 0;
779
780 return -EIO;
781}
782
783static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap)
784{
785
786 if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
787 err("set interface failed");
788
789 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
790
791 adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_mt352_config,
792 &adap->dev->i2c_adap);
793 if ((adap->fe_adap[0].fe) != NULL)
794 return 0;
795
796 return -EIO;
797}
798
799static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter *adap)
800{
801 if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
802 err("set interface failed");
803
804 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
805
806 adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_dee1601_config,
807 &adap->dev->i2c_adap);
808 if ((adap->fe_adap[0].fe) != NULL)
809 return 0;
810
811 adap->fe_adap[0].fe = dvb_attach(zl10353_attach,
812 &cxusb_zl10353_dee1601_config,
813 &adap->dev->i2c_adap);
814 if ((adap->fe_adap[0].fe) != NULL)
815 return 0;
816
817 return -EIO;
818}
819
820static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap)
821{
822 u8 ircode[4];
823 int i;
824 struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD,
825 .buf = ircode, .len = 4 };
826
827 if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
828 err("set interface failed");
829
830 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
831
832
833 cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0);
834 cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1);
835 cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
836
837 adap->fe_adap[0].fe =
838 dvb_attach(zl10353_attach,
839 &cxusb_zl10353_xc3028_config_no_i2c_gate,
840 &adap->dev->i2c_adap);
841 if ((adap->fe_adap[0].fe) == NULL)
842 return -EIO;
843
844
845 for (i = 0; adap->dev->props.rc.core.rc_codes && i < 5; i++) {
846 msleep(20);
847 if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1)
848 goto no_IR;
849 if (ircode[0] == 0 && ircode[1] == 0)
850 continue;
851 if (ircode[2] + ircode[3] != 0xff) {
852no_IR:
853 adap->dev->props.rc.core.rc_codes = NULL;
854 info("No IR receiver detected on this device.");
855 break;
856 }
857 }
858
859 return 0;
860}
861
862static struct dibx000_agc_config dib7070_agc_config = {
863 .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,
864
865
866
867
868
869
870 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) |
871 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),
872 .inv_gain = 600,
873 .time_stabiliz = 10,
874 .alpha_level = 0,
875 .thlock = 118,
876 .wbd_inv = 0,
877 .wbd_ref = 3530,
878 .wbd_sel = 1,
879 .wbd_alpha = 5,
880 .agc1_max = 65535,
881 .agc1_min = 0,
882 .agc2_max = 65535,
883 .agc2_min = 0,
884 .agc1_pt1 = 0,
885 .agc1_pt2 = 40,
886 .agc1_pt3 = 183,
887 .agc1_slope1 = 206,
888 .agc1_slope2 = 255,
889 .agc2_pt1 = 72,
890 .agc2_pt2 = 152,
891 .agc2_slope1 = 88,
892 .agc2_slope2 = 90,
893 .alpha_mant = 17,
894 .alpha_exp = 27,
895 .beta_mant = 23,
896 .beta_exp = 51,
897 .perform_agc_softsplit = 0,
898};
899
900static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {
901 .internal = 60000,
902 .sampling = 15000,
903 .pll_prediv = 1,
904 .pll_ratio = 20,
905 .pll_range = 3,
906 .pll_reset = 1,
907 .pll_bypass = 0,
908 .enable_refdiv = 0,
909 .bypclk_div = 0,
910 .IO_CLK_en_core = 1,
911 .ADClkSrc = 1,
912 .modulo = 2,
913
914 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
915 .ifreq = (0 << 25) | 0,
916 .timf = 20452225,
917 .xtal_hz = 12000000,
918};
919
920static struct dib7000p_config cxusb_dualdig4_rev2_config = {
921 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,
922 .output_mpeg2_in_188_bytes = 1,
923
924 .agc_config_count = 1,
925 .agc = &dib7070_agc_config,
926 .bw = &dib7070_bw_config_12_mhz,
927 .tuner_is_baseband = 1,
928 .spur_protect = 1,
929
930 .gpio_dir = 0xfcef,
931 .gpio_val = 0x0110,
932
933 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
934
935 .hostbus_diversity = 1,
936};
937
938struct dib0700_adapter_state {
939 int (*set_param_save)(struct dvb_frontend *);
940 struct dib7000p_ops dib7000p_ops;
941};
942
943static int cxusb_dualdig4_rev2_frontend_attach(struct dvb_usb_adapter *adap)
944{
945 struct dib0700_adapter_state *state = adap->priv;
946
947 if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
948 err("set interface failed");
949
950 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
951
952 cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
953
954 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
955 return -ENODEV;
956
957 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
958 &cxusb_dualdig4_rev2_config) < 0) {
959 printk(KERN_WARNING "Unable to enumerate dib7000p\n");
960 return -ENODEV;
961 }
962
963 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80,
964 &cxusb_dualdig4_rev2_config);
965 if (adap->fe_adap[0].fe == NULL)
966 return -EIO;
967
968 return 0;
969}
970
971static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
972{
973 struct dvb_usb_adapter *adap = fe->dvb->priv;
974 struct dib0700_adapter_state *state = adap->priv;
975
976 return state->dib7000p_ops.set_gpio(fe, 8, 0, !onoff);
977}
978
979static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
980{
981 return 0;
982}
983
984static struct dib0070_config dib7070p_dib0070_config = {
985 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
986 .reset = dib7070_tuner_reset,
987 .sleep = dib7070_tuner_sleep,
988 .clock_khz = 12000,
989};
990
991static int dib7070_set_param_override(struct dvb_frontend *fe)
992{
993 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
994 struct dvb_usb_adapter *adap = fe->dvb->priv;
995 struct dib0700_adapter_state *state = adap->priv;
996
997 u16 offset;
998 u8 band = BAND_OF_FREQUENCY(p->frequency/1000);
999 switch (band) {
1000 case BAND_VHF: offset = 950; break;
1001 default:
1002 case BAND_UHF: offset = 550; break;
1003 }
1004
1005 state->dib7000p_ops.set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
1006
1007 return state->set_param_save(fe);
1008}
1009
1010static int cxusb_dualdig4_rev2_tuner_attach(struct dvb_usb_adapter *adap)
1011{
1012 struct dib0700_adapter_state *st = adap->priv;
1013 struct i2c_adapter *tun_i2c;
1014
1015
1016
1017
1018
1019
1020 tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
1021 DIBX000_I2C_INTERFACE_TUNER, 1);
1022
1023 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c,
1024 &dib7070p_dib0070_config) == NULL)
1025 return -ENODEV;
1026
1027 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
1028 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override;
1029 return 0;
1030}
1031
1032static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap)
1033{
1034 if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
1035 err("set interface failed");
1036
1037 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
1038
1039
1040 cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0);
1041 cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1);
1042 cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
1043
1044 adap->fe_adap[0].fe = dvb_attach(zl10353_attach,
1045 &cxusb_zl10353_xc3028_config,
1046 &adap->dev->i2c_adap);
1047 if ((adap->fe_adap[0].fe) != NULL)
1048 return 0;
1049
1050 adap->fe_adap[0].fe = dvb_attach(mt352_attach,
1051 &cxusb_mt352_xc3028_config,
1052 &adap->dev->i2c_adap);
1053 if ((adap->fe_adap[0].fe) != NULL)
1054 return 0;
1055
1056 return -EIO;
1057}
1058
1059static struct lgs8gxx_config d680_lgs8gl5_cfg = {
1060 .prod = LGS8GXX_PROD_LGS8GL5,
1061 .demod_address = 0x19,
1062 .serial_ts = 0,
1063 .ts_clk_pol = 0,
1064 .ts_clk_gated = 1,
1065 .if_clk_freq = 30400,
1066 .if_freq = 5725,
1067 .if_neg_center = 0,
1068 .ext_adc = 0,
1069 .adc_signed = 0,
1070 .if_neg_edge = 0,
1071};
1072
1073static int cxusb_d680_dmb_frontend_attach(struct dvb_usb_adapter *adap)
1074{
1075 struct dvb_usb_device *d = adap->dev;
1076 int n;
1077
1078
1079 if (usb_set_interface(d->udev, 0, 0) < 0)
1080 err("set interface failed");
1081
1082
1083 usb_clear_halt(d->udev,
1084 usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1085 usb_clear_halt(d->udev,
1086 usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1087 usb_clear_halt(d->udev,
1088 usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint));
1089
1090
1091 for (n = 0; n < 5; n++) {
1092 cxusb_d680_dmb_drain_message(d);
1093 cxusb_d680_dmb_drain_video(d);
1094 msleep(200);
1095 }
1096
1097
1098 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) {
1099 err("clear tuner gpio failed");
1100 return -EIO;
1101 }
1102 msleep(100);
1103 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) {
1104 err("set tuner gpio failed");
1105 return -EIO;
1106 }
1107 msleep(100);
1108
1109
1110 adap->fe_adap[0].fe = dvb_attach(lgs8gxx_attach, &d680_lgs8gl5_cfg, &d->i2c_adap);
1111 if (adap->fe_adap[0].fe == NULL)
1112 return -EIO;
1113
1114 return 0;
1115}
1116
1117static struct atbm8830_config mygica_d689_atbm8830_cfg = {
1118 .prod = ATBM8830_PROD_8830,
1119 .demod_address = 0x40,
1120 .serial_ts = 0,
1121 .ts_sampling_edge = 1,
1122 .ts_clk_gated = 0,
1123 .osc_clk_freq = 30400,
1124 .if_freq = 0,
1125 .zif_swap_iq = 1,
1126 .agc_min = 0x2E,
1127 .agc_max = 0x90,
1128 .agc_hold_loop = 0,
1129};
1130
1131static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap)
1132{
1133 struct dvb_usb_device *d = adap->dev;
1134
1135
1136 if (usb_set_interface(d->udev, 0, 0) < 0)
1137 err("set interface failed");
1138
1139
1140 usb_clear_halt(d->udev,
1141 usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1142 usb_clear_halt(d->udev,
1143 usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1144 usb_clear_halt(d->udev,
1145 usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint));
1146
1147
1148
1149 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) {
1150 err("clear tuner gpio failed");
1151 return -EIO;
1152 }
1153 msleep(100);
1154 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) {
1155 err("set tuner gpio failed");
1156 return -EIO;
1157 }
1158 msleep(100);
1159
1160
1161 adap->fe_adap[0].fe = dvb_attach(atbm8830_attach, &mygica_d689_atbm8830_cfg,
1162 &d->i2c_adap);
1163 if (adap->fe_adap[0].fe == NULL)
1164 return -EIO;
1165
1166 return 0;
1167}
1168
1169static int cxusb_mygica_t230_frontend_attach(struct dvb_usb_adapter *adap)
1170{
1171 struct dvb_usb_device *d = adap->dev;
1172 struct cxusb_state *st = d->priv;
1173 struct i2c_adapter *adapter;
1174 struct i2c_client *client_demod;
1175 struct i2c_client *client_tuner;
1176 struct i2c_board_info info;
1177 struct si2168_config si2168_config;
1178 struct si2157_config si2157_config;
1179
1180
1181 if (usb_set_interface(d->udev, 0, 0) < 0)
1182 err("set interface failed");
1183
1184
1185 usb_clear_halt(d->udev,
1186 usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1187 usb_clear_halt(d->udev,
1188 usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
1189 usb_clear_halt(d->udev,
1190 usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint));
1191
1192
1193 si2168_config.i2c_adapter = &adapter;
1194 si2168_config.fe = &adap->fe_adap[0].fe;
1195 si2168_config.ts_mode = SI2168_TS_PARALLEL;
1196 si2168_config.ts_clock_inv = 1;
1197 memset(&info, 0, sizeof(struct i2c_board_info));
1198 strlcpy(info.type, "si2168", I2C_NAME_SIZE);
1199 info.addr = 0x64;
1200 info.platform_data = &si2168_config;
1201 request_module(info.type);
1202 client_demod = i2c_new_device(&d->i2c_adap, &info);
1203 if (client_demod == NULL || client_demod->dev.driver == NULL)
1204 return -ENODEV;
1205
1206 if (!try_module_get(client_demod->dev.driver->owner)) {
1207 i2c_unregister_device(client_demod);
1208 return -ENODEV;
1209 }
1210
1211 st->i2c_client_demod = client_demod;
1212
1213
1214 memset(&si2157_config, 0, sizeof(si2157_config));
1215 si2157_config.fe = adap->fe_adap[0].fe;
1216 si2157_config.if_port = 1;
1217 memset(&info, 0, sizeof(struct i2c_board_info));
1218 strlcpy(info.type, "si2157", I2C_NAME_SIZE);
1219 info.addr = 0x60;
1220 info.platform_data = &si2157_config;
1221 request_module(info.type);
1222 client_tuner = i2c_new_device(adapter, &info);
1223 if (client_tuner == NULL || client_tuner->dev.driver == NULL) {
1224 module_put(client_demod->dev.driver->owner);
1225 i2c_unregister_device(client_demod);
1226 return -ENODEV;
1227 }
1228 if (!try_module_get(client_tuner->dev.driver->owner)) {
1229 i2c_unregister_device(client_tuner);
1230 module_put(client_demod->dev.driver->owner);
1231 i2c_unregister_device(client_demod);
1232 return -ENODEV;
1233 }
1234
1235 st->i2c_client_tuner = client_tuner;
1236
1237
1238 mutex_init(&st->stream_mutex);
1239 st->last_lock = 0;
1240 st->fe_read_status = adap->fe_adap[0].fe->ops.read_status;
1241 adap->fe_adap[0].fe->ops.read_status = cxusb_read_status;
1242
1243 return 0;
1244}
1245
1246
1247
1248
1249
1250
1251
1252static int bluebird_fx2_identify_state(struct usb_device *udev,
1253 struct dvb_usb_device_properties *props,
1254 struct dvb_usb_device_description **desc,
1255 int *cold)
1256{
1257 int wascold = *cold;
1258
1259 *cold = udev->descriptor.bDeviceClass == 0xff &&
1260 udev->descriptor.bDeviceSubClass == 0xff &&
1261 udev->descriptor.bDeviceProtocol == 0xff;
1262
1263 if (*cold && !wascold)
1264 *desc = NULL;
1265
1266 return 0;
1267}
1268
1269
1270
1271
1272
1273
1274static const int dvico_firmware_id_offsets[] = { 6638, 3204 };
1275static int bluebird_patch_dvico_firmware_download(struct usb_device *udev,
1276 const struct firmware *fw)
1277{
1278 int pos;
1279
1280 for (pos = 0; pos < ARRAY_SIZE(dvico_firmware_id_offsets); pos++) {
1281 int idoff = dvico_firmware_id_offsets[pos];
1282
1283 if (fw->size < idoff + 4)
1284 continue;
1285
1286 if (fw->data[idoff] == (USB_VID_DVICO & 0xff) &&
1287 fw->data[idoff + 1] == USB_VID_DVICO >> 8) {
1288 struct firmware new_fw;
1289 u8 *new_fw_data = vmalloc(fw->size);
1290 int ret;
1291
1292 if (!new_fw_data)
1293 return -ENOMEM;
1294
1295 memcpy(new_fw_data, fw->data, fw->size);
1296 new_fw.size = fw->size;
1297 new_fw.data = new_fw_data;
1298
1299 new_fw_data[idoff + 2] =
1300 le16_to_cpu(udev->descriptor.idProduct) + 1;
1301 new_fw_data[idoff + 3] =
1302 le16_to_cpu(udev->descriptor.idProduct) >> 8;
1303
1304 ret = usb_cypress_load_firmware(udev, &new_fw,
1305 CYPRESS_FX2);
1306 vfree(new_fw_data);
1307 return ret;
1308 }
1309 }
1310
1311 return -EINVAL;
1312}
1313
1314
1315static struct dvb_usb_device_properties cxusb_medion_properties;
1316static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties;
1317static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties;
1318static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties;
1319static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties;
1320static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties;
1321static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties;
1322static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties;
1323static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties;
1324static struct dvb_usb_device_properties cxusb_aver_a868r_properties;
1325static struct dvb_usb_device_properties cxusb_d680_dmb_properties;
1326static struct dvb_usb_device_properties cxusb_mygica_d689_properties;
1327static struct dvb_usb_device_properties cxusb_mygica_t230_properties;
1328
1329static int cxusb_probe(struct usb_interface *intf,
1330 const struct usb_device_id *id)
1331{
1332 if (0 == dvb_usb_device_init(intf, &cxusb_medion_properties,
1333 THIS_MODULE, NULL, adapter_nr) ||
1334 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgh064f_properties,
1335 THIS_MODULE, NULL, adapter_nr) ||
1336 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dee1601_properties,
1337 THIS_MODULE, NULL, adapter_nr) ||
1338 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgz201_properties,
1339 THIS_MODULE, NULL, adapter_nr) ||
1340 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dtt7579_properties,
1341 THIS_MODULE, NULL, adapter_nr) ||
1342 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dualdig4_properties,
1343 THIS_MODULE, NULL, adapter_nr) ||
1344 0 == dvb_usb_device_init(intf, &cxusb_bluebird_nano2_properties,
1345 THIS_MODULE, NULL, adapter_nr) ||
1346 0 == dvb_usb_device_init(intf,
1347 &cxusb_bluebird_nano2_needsfirmware_properties,
1348 THIS_MODULE, NULL, adapter_nr) ||
1349 0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties,
1350 THIS_MODULE, NULL, adapter_nr) ||
1351 0 == dvb_usb_device_init(intf,
1352 &cxusb_bluebird_dualdig4_rev2_properties,
1353 THIS_MODULE, NULL, adapter_nr) ||
1354 0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties,
1355 THIS_MODULE, NULL, adapter_nr) ||
1356 0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties,
1357 THIS_MODULE, NULL, adapter_nr) ||
1358 0 == dvb_usb_device_init(intf, &cxusb_mygica_t230_properties,
1359 THIS_MODULE, NULL, adapter_nr) ||
1360 0)
1361 return 0;
1362
1363 return -EINVAL;
1364}
1365
1366static void cxusb_disconnect(struct usb_interface *intf)
1367{
1368 struct dvb_usb_device *d = usb_get_intfdata(intf);
1369 struct cxusb_state *st = d->priv;
1370 struct i2c_client *client;
1371
1372
1373 client = st->i2c_client_tuner;
1374 if (client) {
1375 module_put(client->dev.driver->owner);
1376 i2c_unregister_device(client);
1377 }
1378
1379
1380 client = st->i2c_client_demod;
1381 if (client) {
1382 module_put(client->dev.driver->owner);
1383 i2c_unregister_device(client);
1384 }
1385
1386 dvb_usb_device_exit(intf);
1387}
1388
1389enum cxusb_table_index {
1390 MEDION_MD95700,
1391 DVICO_BLUEBIRD_LG064F_COLD,
1392 DVICO_BLUEBIRD_LG064F_WARM,
1393 DVICO_BLUEBIRD_DUAL_1_COLD,
1394 DVICO_BLUEBIRD_DUAL_1_WARM,
1395 DVICO_BLUEBIRD_LGZ201_COLD,
1396 DVICO_BLUEBIRD_LGZ201_WARM,
1397 DVICO_BLUEBIRD_TH7579_COLD,
1398 DVICO_BLUEBIRD_TH7579_WARM,
1399 DIGITALNOW_BLUEBIRD_DUAL_1_COLD,
1400 DIGITALNOW_BLUEBIRD_DUAL_1_WARM,
1401 DVICO_BLUEBIRD_DUAL_2_COLD,
1402 DVICO_BLUEBIRD_DUAL_2_WARM,
1403 DVICO_BLUEBIRD_DUAL_4,
1404 DVICO_BLUEBIRD_DVB_T_NANO_2,
1405 DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM,
1406 AVERMEDIA_VOLAR_A868R,
1407 DVICO_BLUEBIRD_DUAL_4_REV_2,
1408 CONEXANT_D680_DMB,
1409 MYGICA_D689,
1410 MYGICA_T230,
1411 NR__cxusb_table_index
1412};
1413
1414static struct usb_device_id cxusb_table[NR__cxusb_table_index + 1] = {
1415 [MEDION_MD95700] = {
1416 USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700)
1417 },
1418 [DVICO_BLUEBIRD_LG064F_COLD] = {
1419 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD)
1420 },
1421 [DVICO_BLUEBIRD_LG064F_WARM] = {
1422 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM)
1423 },
1424 [DVICO_BLUEBIRD_DUAL_1_COLD] = {
1425 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD)
1426 },
1427 [DVICO_BLUEBIRD_DUAL_1_WARM] = {
1428 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM)
1429 },
1430 [DVICO_BLUEBIRD_LGZ201_COLD] = {
1431 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD)
1432 },
1433 [DVICO_BLUEBIRD_LGZ201_WARM] = {
1434 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM)
1435 },
1436 [DVICO_BLUEBIRD_TH7579_COLD] = {
1437 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD)
1438 },
1439 [DVICO_BLUEBIRD_TH7579_WARM] = {
1440 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM)
1441 },
1442 [DIGITALNOW_BLUEBIRD_DUAL_1_COLD] = {
1443 USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD)
1444 },
1445 [DIGITALNOW_BLUEBIRD_DUAL_1_WARM] = {
1446 USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM)
1447 },
1448 [DVICO_BLUEBIRD_DUAL_2_COLD] = {
1449 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD)
1450 },
1451 [DVICO_BLUEBIRD_DUAL_2_WARM] = {
1452 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM)
1453 },
1454 [DVICO_BLUEBIRD_DUAL_4] = {
1455 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4)
1456 },
1457 [DVICO_BLUEBIRD_DVB_T_NANO_2] = {
1458 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2)
1459 },
1460 [DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM] = {
1461 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM)
1462 },
1463 [AVERMEDIA_VOLAR_A868R] = {
1464 USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R)
1465 },
1466 [DVICO_BLUEBIRD_DUAL_4_REV_2] = {
1467 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2)
1468 },
1469 [CONEXANT_D680_DMB] = {
1470 USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB)
1471 },
1472 [MYGICA_D689] = {
1473 USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689)
1474 },
1475 [MYGICA_T230] = {
1476 USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230)
1477 },
1478 {}
1479};
1480MODULE_DEVICE_TABLE (usb, cxusb_table);
1481
1482static struct dvb_usb_device_properties cxusb_medion_properties = {
1483 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1484
1485 .usb_ctrl = CYPRESS_FX2,
1486
1487 .size_of_priv = sizeof(struct cxusb_state),
1488
1489 .num_adapters = 1,
1490 .adapter = {
1491 {
1492 .num_frontends = 1,
1493 .fe = {{
1494 .streaming_ctrl = cxusb_streaming_ctrl,
1495 .frontend_attach = cxusb_cx22702_frontend_attach,
1496 .tuner_attach = cxusb_fmd1216me_tuner_attach,
1497
1498 .stream = {
1499 .type = USB_BULK,
1500 .count = 5,
1501 .endpoint = 0x02,
1502 .u = {
1503 .bulk = {
1504 .buffersize = 8192,
1505 }
1506 }
1507 },
1508 }},
1509 },
1510 },
1511 .power_ctrl = cxusb_power_ctrl,
1512
1513 .i2c_algo = &cxusb_i2c_algo,
1514
1515 .generic_bulk_ctrl_endpoint = 0x01,
1516
1517 .num_device_descs = 1,
1518 .devices = {
1519 { "Medion MD95700 (MDUSBTV-HYBRID)",
1520 { NULL },
1521 { &cxusb_table[MEDION_MD95700], NULL },
1522 },
1523 }
1524};
1525
1526static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = {
1527 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1528
1529 .usb_ctrl = DEVICE_SPECIFIC,
1530 .firmware = "dvb-usb-bluebird-01.fw",
1531 .download_firmware = bluebird_patch_dvico_firmware_download,
1532
1533
1534
1535 .size_of_priv = sizeof(struct cxusb_state),
1536
1537 .num_adapters = 1,
1538 .adapter = {
1539 {
1540 .num_frontends = 1,
1541 .fe = {{
1542 .streaming_ctrl = cxusb_streaming_ctrl,
1543 .frontend_attach = cxusb_lgdt3303_frontend_attach,
1544 .tuner_attach = cxusb_lgh064f_tuner_attach,
1545
1546
1547 .stream = {
1548 .type = USB_BULK,
1549 .count = 5,
1550 .endpoint = 0x02,
1551 .u = {
1552 .bulk = {
1553 .buffersize = 8192,
1554 }
1555 }
1556 },
1557 }},
1558 },
1559 },
1560
1561 .power_ctrl = cxusb_bluebird_power_ctrl,
1562
1563 .i2c_algo = &cxusb_i2c_algo,
1564
1565 .rc.core = {
1566 .rc_interval = 100,
1567 .rc_codes = RC_MAP_DVICO_PORTABLE,
1568 .module_name = KBUILD_MODNAME,
1569 .rc_query = cxusb_rc_query,
1570 .allowed_protos = RC_PROTO_BIT_NEC,
1571 },
1572
1573 .generic_bulk_ctrl_endpoint = 0x01,
1574
1575 .num_device_descs = 1,
1576 .devices = {
1577 { "DViCO FusionHDTV5 USB Gold",
1578 { &cxusb_table[DVICO_BLUEBIRD_LG064F_COLD], NULL },
1579 { &cxusb_table[DVICO_BLUEBIRD_LG064F_WARM], NULL },
1580 },
1581 }
1582};
1583
1584static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = {
1585 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1586
1587 .usb_ctrl = DEVICE_SPECIFIC,
1588 .firmware = "dvb-usb-bluebird-01.fw",
1589 .download_firmware = bluebird_patch_dvico_firmware_download,
1590
1591
1592
1593 .size_of_priv = sizeof(struct cxusb_state),
1594
1595 .num_adapters = 1,
1596 .adapter = {
1597 {
1598 .num_frontends = 1,
1599 .fe = {{
1600 .streaming_ctrl = cxusb_streaming_ctrl,
1601 .frontend_attach = cxusb_dee1601_frontend_attach,
1602 .tuner_attach = cxusb_dee1601_tuner_attach,
1603
1604 .stream = {
1605 .type = USB_BULK,
1606 .count = 5,
1607 .endpoint = 0x04,
1608 .u = {
1609 .bulk = {
1610 .buffersize = 8192,
1611 }
1612 }
1613 },
1614 }},
1615 },
1616 },
1617
1618 .power_ctrl = cxusb_bluebird_power_ctrl,
1619
1620 .i2c_algo = &cxusb_i2c_algo,
1621
1622 .rc.core = {
1623 .rc_interval = 100,
1624 .rc_codes = RC_MAP_DVICO_MCE,
1625 .module_name = KBUILD_MODNAME,
1626 .rc_query = cxusb_rc_query,
1627 .allowed_protos = RC_PROTO_BIT_NEC,
1628 },
1629
1630 .generic_bulk_ctrl_endpoint = 0x01,
1631
1632 .num_device_descs = 3,
1633 .devices = {
1634 { "DViCO FusionHDTV DVB-T Dual USB",
1635 { &cxusb_table[DVICO_BLUEBIRD_DUAL_1_COLD], NULL },
1636 { &cxusb_table[DVICO_BLUEBIRD_DUAL_1_WARM], NULL },
1637 },
1638 { "DigitalNow DVB-T Dual USB",
1639 { &cxusb_table[DIGITALNOW_BLUEBIRD_DUAL_1_COLD], NULL },
1640 { &cxusb_table[DIGITALNOW_BLUEBIRD_DUAL_1_WARM], NULL },
1641 },
1642 { "DViCO FusionHDTV DVB-T Dual Digital 2",
1643 { &cxusb_table[DVICO_BLUEBIRD_DUAL_2_COLD], NULL },
1644 { &cxusb_table[DVICO_BLUEBIRD_DUAL_2_WARM], NULL },
1645 },
1646 }
1647};
1648
1649static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = {
1650 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1651
1652 .usb_ctrl = DEVICE_SPECIFIC,
1653 .firmware = "dvb-usb-bluebird-01.fw",
1654 .download_firmware = bluebird_patch_dvico_firmware_download,
1655
1656
1657
1658 .size_of_priv = sizeof(struct cxusb_state),
1659
1660 .num_adapters = 2,
1661 .adapter = {
1662 {
1663 .num_frontends = 1,
1664 .fe = {{
1665 .streaming_ctrl = cxusb_streaming_ctrl,
1666 .frontend_attach = cxusb_mt352_frontend_attach,
1667 .tuner_attach = cxusb_lgz201_tuner_attach,
1668
1669
1670 .stream = {
1671 .type = USB_BULK,
1672 .count = 5,
1673 .endpoint = 0x04,
1674 .u = {
1675 .bulk = {
1676 .buffersize = 8192,
1677 }
1678 }
1679 },
1680 }},
1681 },
1682 },
1683 .power_ctrl = cxusb_bluebird_power_ctrl,
1684
1685 .i2c_algo = &cxusb_i2c_algo,
1686
1687 .rc.core = {
1688 .rc_interval = 100,
1689 .rc_codes = RC_MAP_DVICO_PORTABLE,
1690 .module_name = KBUILD_MODNAME,
1691 .rc_query = cxusb_rc_query,
1692 .allowed_protos = RC_PROTO_BIT_NEC,
1693 },
1694
1695 .generic_bulk_ctrl_endpoint = 0x01,
1696 .num_device_descs = 1,
1697 .devices = {
1698 { "DViCO FusionHDTV DVB-T USB (LGZ201)",
1699 { &cxusb_table[DVICO_BLUEBIRD_LGZ201_COLD], NULL },
1700 { &cxusb_table[DVICO_BLUEBIRD_LGZ201_WARM], NULL },
1701 },
1702 }
1703};
1704
1705static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = {
1706 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1707
1708 .usb_ctrl = DEVICE_SPECIFIC,
1709 .firmware = "dvb-usb-bluebird-01.fw",
1710 .download_firmware = bluebird_patch_dvico_firmware_download,
1711
1712
1713
1714 .size_of_priv = sizeof(struct cxusb_state),
1715
1716 .num_adapters = 1,
1717 .adapter = {
1718 {
1719 .num_frontends = 1,
1720 .fe = {{
1721 .streaming_ctrl = cxusb_streaming_ctrl,
1722 .frontend_attach = cxusb_mt352_frontend_attach,
1723 .tuner_attach = cxusb_dtt7579_tuner_attach,
1724
1725
1726 .stream = {
1727 .type = USB_BULK,
1728 .count = 5,
1729 .endpoint = 0x04,
1730 .u = {
1731 .bulk = {
1732 .buffersize = 8192,
1733 }
1734 }
1735 },
1736 }},
1737 },
1738 },
1739 .power_ctrl = cxusb_bluebird_power_ctrl,
1740
1741 .i2c_algo = &cxusb_i2c_algo,
1742
1743 .rc.core = {
1744 .rc_interval = 100,
1745 .rc_codes = RC_MAP_DVICO_PORTABLE,
1746 .module_name = KBUILD_MODNAME,
1747 .rc_query = cxusb_rc_query,
1748 .allowed_protos = RC_PROTO_BIT_NEC,
1749 },
1750
1751 .generic_bulk_ctrl_endpoint = 0x01,
1752
1753 .num_device_descs = 1,
1754 .devices = {
1755 { "DViCO FusionHDTV DVB-T USB (TH7579)",
1756 { &cxusb_table[DVICO_BLUEBIRD_TH7579_COLD], NULL },
1757 { &cxusb_table[DVICO_BLUEBIRD_TH7579_WARM], NULL },
1758 },
1759 }
1760};
1761
1762static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = {
1763 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1764
1765 .usb_ctrl = CYPRESS_FX2,
1766
1767 .size_of_priv = sizeof(struct cxusb_state),
1768
1769 .num_adapters = 1,
1770 .adapter = {
1771 {
1772 .num_frontends = 1,
1773 .fe = {{
1774 .streaming_ctrl = cxusb_streaming_ctrl,
1775 .frontend_attach = cxusb_dualdig4_frontend_attach,
1776 .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
1777
1778 .stream = {
1779 .type = USB_BULK,
1780 .count = 5,
1781 .endpoint = 0x02,
1782 .u = {
1783 .bulk = {
1784 .buffersize = 8192,
1785 }
1786 }
1787 },
1788 }},
1789 },
1790 },
1791
1792 .power_ctrl = cxusb_power_ctrl,
1793
1794 .i2c_algo = &cxusb_i2c_algo,
1795
1796 .generic_bulk_ctrl_endpoint = 0x01,
1797
1798 .rc.core = {
1799 .rc_interval = 100,
1800 .rc_codes = RC_MAP_DVICO_MCE,
1801 .module_name = KBUILD_MODNAME,
1802 .rc_query = cxusb_bluebird2_rc_query,
1803 .allowed_protos = RC_PROTO_BIT_NEC,
1804 },
1805
1806 .num_device_descs = 1,
1807 .devices = {
1808 { "DViCO FusionHDTV DVB-T Dual Digital 4",
1809 { NULL },
1810 { &cxusb_table[DVICO_BLUEBIRD_DUAL_4], NULL },
1811 },
1812 }
1813};
1814
1815static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = {
1816 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1817
1818 .usb_ctrl = CYPRESS_FX2,
1819 .identify_state = bluebird_fx2_identify_state,
1820
1821 .size_of_priv = sizeof(struct cxusb_state),
1822
1823 .num_adapters = 1,
1824 .adapter = {
1825 {
1826 .num_frontends = 1,
1827 .fe = {{
1828 .streaming_ctrl = cxusb_streaming_ctrl,
1829 .frontend_attach = cxusb_nano2_frontend_attach,
1830 .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
1831
1832 .stream = {
1833 .type = USB_BULK,
1834 .count = 5,
1835 .endpoint = 0x02,
1836 .u = {
1837 .bulk = {
1838 .buffersize = 8192,
1839 }
1840 }
1841 },
1842 }},
1843 },
1844 },
1845
1846 .power_ctrl = cxusb_nano2_power_ctrl,
1847
1848 .i2c_algo = &cxusb_i2c_algo,
1849
1850 .generic_bulk_ctrl_endpoint = 0x01,
1851
1852 .rc.core = {
1853 .rc_interval = 100,
1854 .rc_codes = RC_MAP_DVICO_PORTABLE,
1855 .module_name = KBUILD_MODNAME,
1856 .rc_query = cxusb_bluebird2_rc_query,
1857 .allowed_protos = RC_PROTO_BIT_NEC,
1858 },
1859
1860 .num_device_descs = 1,
1861 .devices = {
1862 { "DViCO FusionHDTV DVB-T NANO2",
1863 { NULL },
1864 { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2], NULL },
1865 },
1866 }
1867};
1868
1869static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties = {
1870 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1871
1872 .usb_ctrl = DEVICE_SPECIFIC,
1873 .firmware = "dvb-usb-bluebird-02.fw",
1874 .download_firmware = bluebird_patch_dvico_firmware_download,
1875 .identify_state = bluebird_fx2_identify_state,
1876
1877 .size_of_priv = sizeof(struct cxusb_state),
1878
1879 .num_adapters = 1,
1880 .adapter = {
1881 {
1882 .num_frontends = 1,
1883 .fe = {{
1884 .streaming_ctrl = cxusb_streaming_ctrl,
1885 .frontend_attach = cxusb_nano2_frontend_attach,
1886 .tuner_attach = cxusb_dvico_xc3028_tuner_attach,
1887
1888 .stream = {
1889 .type = USB_BULK,
1890 .count = 5,
1891 .endpoint = 0x02,
1892 .u = {
1893 .bulk = {
1894 .buffersize = 8192,
1895 }
1896 }
1897 },
1898 }},
1899 },
1900 },
1901
1902 .power_ctrl = cxusb_nano2_power_ctrl,
1903
1904 .i2c_algo = &cxusb_i2c_algo,
1905
1906 .generic_bulk_ctrl_endpoint = 0x01,
1907
1908 .rc.core = {
1909 .rc_interval = 100,
1910 .rc_codes = RC_MAP_DVICO_PORTABLE,
1911 .module_name = KBUILD_MODNAME,
1912 .rc_query = cxusb_rc_query,
1913 .allowed_protos = RC_PROTO_BIT_NEC,
1914 },
1915
1916 .num_device_descs = 1,
1917 .devices = {
1918 { "DViCO FusionHDTV DVB-T NANO2 w/o firmware",
1919 { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2], NULL },
1920 { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM], NULL },
1921 },
1922 }
1923};
1924
1925static struct dvb_usb_device_properties cxusb_aver_a868r_properties = {
1926 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1927
1928 .usb_ctrl = CYPRESS_FX2,
1929
1930 .size_of_priv = sizeof(struct cxusb_state),
1931
1932 .num_adapters = 1,
1933 .adapter = {
1934 {
1935 .num_frontends = 1,
1936 .fe = {{
1937 .streaming_ctrl = cxusb_aver_streaming_ctrl,
1938 .frontend_attach = cxusb_aver_lgdt3303_frontend_attach,
1939 .tuner_attach = cxusb_mxl5003s_tuner_attach,
1940
1941 .stream = {
1942 .type = USB_BULK,
1943 .count = 5,
1944 .endpoint = 0x04,
1945 .u = {
1946 .bulk = {
1947 .buffersize = 8192,
1948 }
1949 }
1950 },
1951 }},
1952 },
1953 },
1954 .power_ctrl = cxusb_aver_power_ctrl,
1955
1956 .i2c_algo = &cxusb_i2c_algo,
1957
1958 .generic_bulk_ctrl_endpoint = 0x01,
1959
1960 .num_device_descs = 1,
1961 .devices = {
1962 { "AVerMedia AVerTVHD Volar (A868R)",
1963 { NULL },
1964 { &cxusb_table[AVERMEDIA_VOLAR_A868R], NULL },
1965 },
1966 }
1967};
1968
1969static
1970struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = {
1971 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1972
1973 .usb_ctrl = CYPRESS_FX2,
1974
1975 .size_of_priv = sizeof(struct cxusb_state),
1976
1977 .num_adapters = 1,
1978 .adapter = {
1979 {
1980 .size_of_priv = sizeof(struct dib0700_adapter_state),
1981 .num_frontends = 1,
1982 .fe = {{
1983 .streaming_ctrl = cxusb_streaming_ctrl,
1984 .frontend_attach = cxusb_dualdig4_rev2_frontend_attach,
1985 .tuner_attach = cxusb_dualdig4_rev2_tuner_attach,
1986
1987 .stream = {
1988 .type = USB_BULK,
1989 .count = 7,
1990 .endpoint = 0x02,
1991 .u = {
1992 .bulk = {
1993 .buffersize = 4096,
1994 }
1995 }
1996 },
1997 }},
1998 },
1999 },
2000
2001 .power_ctrl = cxusb_bluebird_power_ctrl,
2002
2003 .i2c_algo = &cxusb_i2c_algo,
2004
2005 .generic_bulk_ctrl_endpoint = 0x01,
2006
2007 .rc.core = {
2008 .rc_interval = 100,
2009 .rc_codes = RC_MAP_DVICO_MCE,
2010 .module_name = KBUILD_MODNAME,
2011 .rc_query = cxusb_rc_query,
2012 .allowed_protos = RC_PROTO_BIT_NEC,
2013 },
2014
2015 .num_device_descs = 1,
2016 .devices = {
2017 { "DViCO FusionHDTV DVB-T Dual Digital 4 (rev 2)",
2018 { NULL },
2019 { &cxusb_table[DVICO_BLUEBIRD_DUAL_4_REV_2], NULL },
2020 },
2021 }
2022};
2023
2024static struct dvb_usb_device_properties cxusb_d680_dmb_properties = {
2025 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
2026
2027 .usb_ctrl = CYPRESS_FX2,
2028
2029 .size_of_priv = sizeof(struct cxusb_state),
2030
2031 .num_adapters = 1,
2032 .adapter = {
2033 {
2034 .num_frontends = 1,
2035 .fe = {{
2036 .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl,
2037 .frontend_attach = cxusb_d680_dmb_frontend_attach,
2038 .tuner_attach = cxusb_d680_dmb_tuner_attach,
2039
2040
2041 .stream = {
2042 .type = USB_BULK,
2043 .count = 5,
2044 .endpoint = 0x02,
2045 .u = {
2046 .bulk = {
2047 .buffersize = 8192,
2048 }
2049 }
2050 },
2051 }},
2052 },
2053 },
2054
2055 .power_ctrl = cxusb_d680_dmb_power_ctrl,
2056
2057 .i2c_algo = &cxusb_i2c_algo,
2058
2059 .generic_bulk_ctrl_endpoint = 0x01,
2060
2061 .rc.core = {
2062 .rc_interval = 100,
2063 .rc_codes = RC_MAP_TOTAL_MEDIA_IN_HAND_02,
2064 .module_name = KBUILD_MODNAME,
2065 .rc_query = cxusb_d680_dmb_rc_query,
2066 .allowed_protos = RC_PROTO_BIT_UNKNOWN,
2067 },
2068
2069 .num_device_descs = 1,
2070 .devices = {
2071 {
2072 "Conexant DMB-TH Stick",
2073 { NULL },
2074 { &cxusb_table[CONEXANT_D680_DMB], NULL },
2075 },
2076 }
2077};
2078
2079static struct dvb_usb_device_properties cxusb_mygica_d689_properties = {
2080 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
2081
2082 .usb_ctrl = CYPRESS_FX2,
2083
2084 .size_of_priv = sizeof(struct cxusb_state),
2085
2086 .num_adapters = 1,
2087 .adapter = {
2088 {
2089 .num_frontends = 1,
2090 .fe = {{
2091 .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl,
2092 .frontend_attach = cxusb_mygica_d689_frontend_attach,
2093 .tuner_attach = cxusb_mygica_d689_tuner_attach,
2094
2095
2096 .stream = {
2097 .type = USB_BULK,
2098 .count = 5,
2099 .endpoint = 0x02,
2100 .u = {
2101 .bulk = {
2102 .buffersize = 8192,
2103 }
2104 }
2105 },
2106 }},
2107 },
2108 },
2109
2110 .power_ctrl = cxusb_d680_dmb_power_ctrl,
2111
2112 .i2c_algo = &cxusb_i2c_algo,
2113
2114 .generic_bulk_ctrl_endpoint = 0x01,
2115
2116 .rc.core = {
2117 .rc_interval = 100,
2118 .rc_codes = RC_MAP_D680_DMB,
2119 .module_name = KBUILD_MODNAME,
2120 .rc_query = cxusb_d680_dmb_rc_query,
2121 .allowed_protos = RC_PROTO_BIT_UNKNOWN,
2122 },
2123
2124 .num_device_descs = 1,
2125 .devices = {
2126 {
2127 "Mygica D689 DMB-TH",
2128 { NULL },
2129 { &cxusb_table[MYGICA_D689], NULL },
2130 },
2131 }
2132};
2133
2134static struct dvb_usb_device_properties cxusb_mygica_t230_properties = {
2135 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
2136
2137 .usb_ctrl = CYPRESS_FX2,
2138
2139 .size_of_priv = sizeof(struct cxusb_state),
2140
2141 .num_adapters = 1,
2142 .adapter = {
2143 {
2144 .num_frontends = 1,
2145 .fe = {{
2146 .streaming_ctrl = cxusb_streaming_ctrl,
2147 .frontend_attach = cxusb_mygica_t230_frontend_attach,
2148
2149
2150 .stream = {
2151 .type = USB_BULK,
2152 .count = 5,
2153 .endpoint = 0x02,
2154 .u = {
2155 .bulk = {
2156 .buffersize = 8192,
2157 }
2158 }
2159 },
2160 } },
2161 },
2162 },
2163
2164 .power_ctrl = cxusb_d680_dmb_power_ctrl,
2165
2166 .i2c_algo = &cxusb_i2c_algo,
2167
2168 .generic_bulk_ctrl_endpoint = 0x01,
2169
2170 .rc.core = {
2171 .rc_interval = 100,
2172 .rc_codes = RC_MAP_D680_DMB,
2173 .module_name = KBUILD_MODNAME,
2174 .rc_query = cxusb_d680_dmb_rc_query,
2175 .allowed_protos = RC_PROTO_BIT_UNKNOWN,
2176 },
2177
2178 .num_device_descs = 1,
2179 .devices = {
2180 {
2181 "Mygica T230 DVB-T/T2/C",
2182 { NULL },
2183 { &cxusb_table[MYGICA_T230], NULL },
2184 },
2185 }
2186};
2187
2188static struct usb_driver cxusb_driver = {
2189 .name = "dvb_usb_cxusb",
2190 .probe = cxusb_probe,
2191 .disconnect = cxusb_disconnect,
2192 .id_table = cxusb_table,
2193};
2194
2195module_usb_driver(cxusb_driver);
2196
2197MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@posteo.de>");
2198MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
2199MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
2200MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
2201MODULE_VERSION("1.0-alpha");
2202MODULE_LICENSE("GPL");
2203