1 // SPDX-License-Identifier: GPL-2.0-only 2 /* DVB USB compliant linux driver for Conexant USB reference design. 3 * 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. 9 * 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 13 * appear at all). 14 * 15 * 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) 20 * 21 * see Documentation/media/dvb-drivers/dvb-usb.rst for more information 22 */ 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> 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 /* debug */ 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); 54 55 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 56 57 #define deb_info(args...) dprintk(dvb_usb_cxusb_debug, CXUSB_DBG_MISC, args) 58 #define deb_i2c(args...) dprintk(dvb_usb_cxusb_debug, CXUSB_DBG_I2C, args) 59 60 enum cxusb_table_index { 61 MEDION_MD95700, 62 DVICO_BLUEBIRD_LG064F_COLD, 63 DVICO_BLUEBIRD_LG064F_WARM, 64 DVICO_BLUEBIRD_DUAL_1_COLD, 65 DVICO_BLUEBIRD_DUAL_1_WARM, 66 DVICO_BLUEBIRD_LGZ201_COLD, 67 DVICO_BLUEBIRD_LGZ201_WARM, 68 DVICO_BLUEBIRD_TH7579_COLD, 69 DVICO_BLUEBIRD_TH7579_WARM, 70 DIGITALNOW_BLUEBIRD_DUAL_1_COLD, 71 DIGITALNOW_BLUEBIRD_DUAL_1_WARM, 72 DVICO_BLUEBIRD_DUAL_2_COLD, 73 DVICO_BLUEBIRD_DUAL_2_WARM, 74 DVICO_BLUEBIRD_DUAL_4, 75 DVICO_BLUEBIRD_DVB_T_NANO_2, 76 DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM, 77 AVERMEDIA_VOLAR_A868R, 78 DVICO_BLUEBIRD_DUAL_4_REV_2, 79 CONEXANT_D680_DMB, 80 MYGICA_D689, 81 MYGICA_T230, 82 NR__cxusb_table_index 83 }; 84 85 static struct usb_device_id cxusb_table[]; 86 87 int cxusb_ctrl_msg(struct dvb_usb_device *d, 88 u8 cmd, const u8 *wbuf, int wlen, u8 *rbuf, int rlen) 89 { 90 struct cxusb_state *st = d->priv; 91 int ret; 92 93 if (1 + wlen > MAX_XFER_SIZE) { 94 warn("i2c wr: len=%d is too big!\n", wlen); 95 return -EOPNOTSUPP; 96 } 97 98 if (rlen > MAX_XFER_SIZE) { 99 warn("i2c rd: len=%d is too big!\n", rlen); 100 return -EOPNOTSUPP; 101 } 102 103 mutex_lock(&d->data_mutex); 104 st->data[0] = cmd; 105 memcpy(&st->data[1], wbuf, wlen); 106 ret = dvb_usb_generic_rw(d, st->data, 1 + wlen, st->data, rlen, 0); 107 if (!ret && rbuf && rlen) 108 memcpy(rbuf, st->data, rlen); 109 110 mutex_unlock(&d->data_mutex); 111 return ret; 112 } 113 114 /* GPIO */ 115 static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff) 116 { 117 struct cxusb_state *st = d->priv; 118 u8 o[2], i; 119 120 if (st->gpio_write_state[GPIO_TUNER] == onoff && 121 !st->gpio_write_refresh[GPIO_TUNER]) 122 return; 123 124 o[0] = GPIO_TUNER; 125 o[1] = onoff; 126 cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1); 127 128 if (i != 0x01) 129 deb_info("gpio_write failed.\n"); 130 131 st->gpio_write_state[GPIO_TUNER] = onoff; 132 st->gpio_write_refresh[GPIO_TUNER] = false; 133 } 134 135 static int cxusb_bluebird_gpio_rw(struct dvb_usb_device *d, u8 changemask, 136 u8 newval) 137 { 138 u8 o[2], gpio_state; 139 int rc; 140 141 o[0] = 0xff & ~changemask; /* mask of bits to keep */ 142 o[1] = newval & changemask; /* new values for bits */ 143 144 rc = cxusb_ctrl_msg(d, CMD_BLUEBIRD_GPIO_RW, o, 2, &gpio_state, 1); 145 if (rc < 0 || (gpio_state & changemask) != (newval & changemask)) 146 deb_info("bluebird_gpio_write failed.\n"); 147 148 return rc < 0 ? rc : gpio_state; 149 } 150 151 static void cxusb_bluebird_gpio_pulse(struct dvb_usb_device *d, u8 pin, int low) 152 { 153 cxusb_bluebird_gpio_rw(d, pin, low ? 0 : pin); 154 msleep(5); 155 cxusb_bluebird_gpio_rw(d, pin, low ? pin : 0); 156 } 157 158 static void cxusb_nano2_led(struct dvb_usb_device *d, int onoff) 159 { 160 cxusb_bluebird_gpio_rw(d, 0x40, onoff ? 0 : 0x40); 161 } 162 163 static int cxusb_d680_dmb_gpio_tuner(struct dvb_usb_device *d, 164 u8 addr, int onoff) 165 { 166 u8 o[2] = {addr, onoff}; 167 u8 i; 168 int rc; 169 170 rc = cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1); 171 172 if (rc < 0) 173 return rc; 174 175 if (i == 0x01) 176 return 0; 177 178 deb_info("gpio_write failed.\n"); 179 return -EIO; 180 } 181 182 /* I2C */ 183 static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], 184 int num) 185 { 186 struct dvb_usb_device *d = i2c_get_adapdata(adap); 187 int ret; 188 int i; 189 190 if (mutex_lock_interruptible(&d->i2c_mutex) < 0) 191 return -EAGAIN; 192 193 for (i = 0; i < num; i++) { 194 if (le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_MEDION) 195 switch (msg[i].addr) { 196 case 0x63: 197 cxusb_gpio_tuner(d, 0); 198 break; 199 default: 200 cxusb_gpio_tuner(d, 1); 201 break; 202 } 203 204 if (msg[i].flags & I2C_M_RD) { 205 /* read only */ 206 u8 obuf[3], ibuf[MAX_XFER_SIZE]; 207 208 if (1 + msg[i].len > sizeof(ibuf)) { 209 warn("i2c rd: len=%d is too big!\n", 210 msg[i].len); 211 ret = -EOPNOTSUPP; 212 goto unlock; 213 } 214 obuf[0] = 0; 215 obuf[1] = msg[i].len; 216 obuf[2] = msg[i].addr; 217 if (cxusb_ctrl_msg(d, CMD_I2C_READ, 218 obuf, 3, 219 ibuf, 1 + msg[i].len) < 0) { 220 warn("i2c read failed"); 221 break; 222 } 223 memcpy(msg[i].buf, &ibuf[1], msg[i].len); 224 } else if (i + 1 < num && (msg[i + 1].flags & I2C_M_RD) && 225 msg[i].addr == msg[i + 1].addr) { 226 /* write to then read from same address */ 227 u8 obuf[MAX_XFER_SIZE], ibuf[MAX_XFER_SIZE]; 228 229 if (3 + msg[i].len > sizeof(obuf)) { 230 warn("i2c wr: len=%d is too big!\n", 231 msg[i].len); 232 ret = -EOPNOTSUPP; 233 goto unlock; 234 } 235 if (1 + msg[i + 1].len > sizeof(ibuf)) { 236 warn("i2c rd: len=%d is too big!\n", 237 msg[i + 1].len); 238 ret = -EOPNOTSUPP; 239 goto unlock; 240 } 241 obuf[0] = msg[i].len; 242 obuf[1] = msg[i + 1].len; 243 obuf[2] = msg[i].addr; 244 memcpy(&obuf[3], msg[i].buf, msg[i].len); 245 246 if (cxusb_ctrl_msg(d, CMD_I2C_READ, 247 obuf, 3 + msg[i].len, 248 ibuf, 1 + msg[i + 1].len) < 0) 249 break; 250 251 if (ibuf[0] != 0x08) 252 deb_i2c("i2c read may have failed\n"); 253 254 memcpy(msg[i + 1].buf, &ibuf[1], msg[i + 1].len); 255 256 i++; 257 } else { 258 /* write only */ 259 u8 obuf[MAX_XFER_SIZE], ibuf; 260 261 if (2 + msg[i].len > sizeof(obuf)) { 262 warn("i2c wr: len=%d is too big!\n", 263 msg[i].len); 264 ret = -EOPNOTSUPP; 265 goto unlock; 266 } 267 obuf[0] = msg[i].addr; 268 obuf[1] = msg[i].len; 269 memcpy(&obuf[2], msg[i].buf, msg[i].len); 270 271 if (cxusb_ctrl_msg(d, CMD_I2C_WRITE, obuf, 272 2 + msg[i].len, &ibuf, 1) < 0) 273 break; 274 if (ibuf != 0x08) 275 deb_i2c("i2c write may have failed\n"); 276 } 277 } 278 279 if (i == num) 280 ret = num; 281 else 282 ret = -EREMOTEIO; 283 284 unlock: 285 mutex_unlock(&d->i2c_mutex); 286 return ret; 287 } 288 289 static u32 cxusb_i2c_func(struct i2c_adapter *adapter) 290 { 291 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; 292 } 293 294 static struct i2c_algorithm cxusb_i2c_algo = { 295 .master_xfer = cxusb_i2c_xfer, 296 .functionality = cxusb_i2c_func, 297 }; 298 299 static int _cxusb_power_ctrl(struct dvb_usb_device *d, int onoff) 300 { 301 u8 b = 0; 302 303 deb_info("setting power %s\n", onoff ? "ON" : "OFF"); 304 305 if (onoff) 306 return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0); 307 else 308 return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0); 309 } 310 311 static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff) 312 { 313 bool is_medion = d->props.devices[0].warm_ids[0] == &cxusb_table[MEDION_MD95700]; 314 int ret; 315 316 if (is_medion && !onoff) { 317 struct cxusb_medion_dev *cxdev = d->priv; 318 319 mutex_lock(&cxdev->open_lock); 320 321 if (cxdev->open_type == CXUSB_OPEN_ANALOG) { 322 deb_info("preventing DVB core from setting power OFF while we are in analog mode\n"); 323 ret = -EBUSY; 324 goto ret_unlock; 325 } 326 } 327 328 ret = _cxusb_power_ctrl(d, onoff); 329 330 ret_unlock: 331 if (is_medion && !onoff) { 332 struct cxusb_medion_dev *cxdev = d->priv; 333 334 mutex_unlock(&cxdev->open_lock); 335 } 336 337 return ret; 338 } 339 340 static int cxusb_aver_power_ctrl(struct dvb_usb_device *d, int onoff) 341 { 342 int ret; 343 344 if (!onoff) 345 return cxusb_ctrl_msg(d, CMD_POWER_OFF, NULL, 0, NULL, 0); 346 if (d->state == DVB_USB_STATE_INIT && 347 usb_set_interface(d->udev, 0, 0) < 0) 348 err("set interface failed"); 349 do { 350 /* Nothing */ 351 } while (!(ret = cxusb_ctrl_msg(d, CMD_POWER_ON, NULL, 0, NULL, 0)) && 352 !(ret = cxusb_ctrl_msg(d, 0x15, NULL, 0, NULL, 0)) && 353 !(ret = cxusb_ctrl_msg(d, 0x17, NULL, 0, NULL, 0)) && 0); 354 355 if (!ret) { 356 /* 357 * FIXME: We don't know why, but we need to configure the 358 * lgdt3303 with the register settings below on resume 359 */ 360 int i; 361 u8 buf; 362 static const u8 bufs[] = { 363 0x0e, 0x2, 0x00, 0x7f, 364 0x0e, 0x2, 0x02, 0xfe, 365 0x0e, 0x2, 0x02, 0x01, 366 0x0e, 0x2, 0x00, 0x03, 367 0x0e, 0x2, 0x0d, 0x40, 368 0x0e, 0x2, 0x0e, 0x87, 369 0x0e, 0x2, 0x0f, 0x8e, 370 0x0e, 0x2, 0x10, 0x01, 371 0x0e, 0x2, 0x14, 0xd7, 372 0x0e, 0x2, 0x47, 0x88, 373 }; 374 msleep(20); 375 for (i = 0; i < ARRAY_SIZE(bufs); i += 4 / sizeof(u8)) { 376 ret = cxusb_ctrl_msg(d, CMD_I2C_WRITE, 377 bufs + i, 4, &buf, 1); 378 if (ret) 379 break; 380 if (buf != 0x8) 381 return -EREMOTEIO; 382 } 383 } 384 return ret; 385 } 386 387 static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff) 388 { 389 u8 b = 0; 390 391 if (onoff) 392 return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0); 393 else 394 return 0; 395 } 396 397 static int cxusb_nano2_power_ctrl(struct dvb_usb_device *d, int onoff) 398 { 399 int rc = 0; 400 401 rc = cxusb_power_ctrl(d, onoff); 402 if (!onoff) 403 cxusb_nano2_led(d, 0); 404 405 return rc; 406 } 407 408 static int cxusb_d680_dmb_power_ctrl(struct dvb_usb_device *d, int onoff) 409 { 410 int ret; 411 u8 b; 412 413 ret = cxusb_power_ctrl(d, onoff); 414 if (!onoff) 415 return ret; 416 417 msleep(128); 418 cxusb_ctrl_msg(d, CMD_DIGITAL, NULL, 0, &b, 1); 419 msleep(100); 420 return ret; 421 } 422 423 static int cxusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) 424 { 425 struct dvb_usb_device *dvbdev = adap->dev; 426 bool is_medion = dvbdev->props.devices[0].warm_ids[0] == 427 &cxusb_table[MEDION_MD95700]; 428 u8 buf[2] = { 0x03, 0x00 }; 429 430 if (is_medion && onoff) { 431 int ret; 432 433 ret = cxusb_medion_get(dvbdev, CXUSB_OPEN_DIGITAL); 434 if (ret != 0) 435 return ret; 436 } 437 438 if (onoff) 439 cxusb_ctrl_msg(dvbdev, CMD_STREAMING_ON, buf, 2, NULL, 0); 440 else 441 cxusb_ctrl_msg(dvbdev, CMD_STREAMING_OFF, NULL, 0, NULL, 0); 442 443 if (is_medion && !onoff) 444 cxusb_medion_put(dvbdev); 445 446 return 0; 447 } 448 449 static int cxusb_aver_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) 450 { 451 if (onoff) 452 cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_ON, NULL, 0, NULL, 0); 453 else 454 cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_OFF, 455 NULL, 0, NULL, 0); 456 return 0; 457 } 458 459 static int cxusb_read_status(struct dvb_frontend *fe, 460 enum fe_status *status) 461 { 462 struct dvb_usb_adapter *adap = (struct dvb_usb_adapter *)fe->dvb->priv; 463 struct cxusb_state *state = (struct cxusb_state *)adap->dev->priv; 464 int ret; 465 466 ret = state->fe_read_status(fe, status); 467 468 /* it need resync slave fifo when signal change from unlock to lock.*/ 469 if ((*status & FE_HAS_LOCK) && (!state->last_lock)) { 470 mutex_lock(&state->stream_mutex); 471 cxusb_streaming_ctrl(adap, 1); 472 mutex_unlock(&state->stream_mutex); 473 } 474 475 state->last_lock = (*status & FE_HAS_LOCK) ? 1 : 0; 476 return ret; 477 } 478 479 static void cxusb_d680_dmb_drain_message(struct dvb_usb_device *d) 480 { 481 int ep = d->props.generic_bulk_ctrl_endpoint; 482 const int timeout = 100; 483 const int junk_len = 32; 484 u8 *junk; 485 int rd_count; 486 487 /* Discard remaining data in video pipe */ 488 junk = kmalloc(junk_len, GFP_KERNEL); 489 if (!junk) 490 return; 491 while (1) { 492 if (usb_bulk_msg(d->udev, 493 usb_rcvbulkpipe(d->udev, ep), 494 junk, junk_len, &rd_count, timeout) < 0) 495 break; 496 if (!rd_count) 497 break; 498 } 499 kfree(junk); 500 } 501 502 static void cxusb_d680_dmb_drain_video(struct dvb_usb_device *d) 503 { 504 struct usb_data_stream_properties *p = &d->props.adapter[0].fe[0].stream; 505 const int timeout = 100; 506 const int junk_len = p->u.bulk.buffersize; 507 u8 *junk; 508 int rd_count; 509 510 /* Discard remaining data in video pipe */ 511 junk = kmalloc(junk_len, GFP_KERNEL); 512 if (!junk) 513 return; 514 while (1) { 515 if (usb_bulk_msg(d->udev, 516 usb_rcvbulkpipe(d->udev, p->endpoint), 517 junk, junk_len, &rd_count, timeout) < 0) 518 break; 519 if (!rd_count) 520 break; 521 } 522 kfree(junk); 523 } 524 525 static int cxusb_d680_dmb_streaming_ctrl(struct dvb_usb_adapter *adap, 526 int onoff) 527 { 528 if (onoff) { 529 u8 buf[2] = { 0x03, 0x00 }; 530 531 cxusb_d680_dmb_drain_video(adap->dev); 532 return cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON, 533 buf, sizeof(buf), NULL, 0); 534 } else { 535 int ret = cxusb_ctrl_msg(adap->dev, 536 CMD_STREAMING_OFF, NULL, 0, NULL, 0); 537 return ret; 538 } 539 } 540 541 static int cxusb_rc_query(struct dvb_usb_device *d) 542 { 543 u8 ircode[4]; 544 545 cxusb_ctrl_msg(d, CMD_GET_IR_CODE, NULL, 0, ircode, 4); 546 547 if (ircode[2] || ircode[3]) 548 rc_keydown(d->rc_dev, RC_PROTO_NEC, 549 RC_SCANCODE_NEC(~ircode[2] & 0xff, ircode[3]), 0); 550 return 0; 551 } 552 553 static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d) 554 { 555 u8 ircode[4]; 556 struct i2c_msg msg = { 557 .addr = 0x6b, 558 .flags = I2C_M_RD, 559 .buf = ircode, 560 .len = 4 561 }; 562 563 if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1) 564 return 0; 565 566 if (ircode[1] || ircode[2]) 567 rc_keydown(d->rc_dev, RC_PROTO_NEC, 568 RC_SCANCODE_NEC(~ircode[1] & 0xff, ircode[2]), 0); 569 return 0; 570 } 571 572 static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d) 573 { 574 u8 ircode[2]; 575 576 if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0) 577 return 0; 578 579 if (ircode[0] || ircode[1]) 580 rc_keydown(d->rc_dev, RC_PROTO_UNKNOWN, 581 RC_SCANCODE_RC5(ircode[0], ircode[1]), 0); 582 return 0; 583 } 584 585 static int cxusb_dee1601_demod_init(struct dvb_frontend *fe) 586 { 587 static u8 clock_config[] = { CLOCK_CTL, 0x38, 0x28 }; 588 static u8 reset[] = { RESET, 0x80 }; 589 static u8 adc_ctl_1_cfg[] = { ADC_CTL_1, 0x40 }; 590 static u8 agc_cfg[] = { AGC_TARGET, 0x28, 0x20 }; 591 static u8 gpp_ctl_cfg[] = { GPP_CTL, 0x33 }; 592 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; 593 594 mt352_write(fe, clock_config, sizeof(clock_config)); 595 udelay(200); 596 mt352_write(fe, reset, sizeof(reset)); 597 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); 598 599 mt352_write(fe, agc_cfg, sizeof(agc_cfg)); 600 mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); 601 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); 602 603 return 0; 604 } 605 606 static int cxusb_mt352_demod_init(struct dvb_frontend *fe) 607 { 608 /* used in both lgz201 and th7579 */ 609 static u8 clock_config[] = { CLOCK_CTL, 0x38, 0x29 }; 610 static u8 reset[] = { RESET, 0x80 }; 611 static u8 adc_ctl_1_cfg[] = { ADC_CTL_1, 0x40 }; 612 static u8 agc_cfg[] = { AGC_TARGET, 0x24, 0x20 }; 613 static u8 gpp_ctl_cfg[] = { GPP_CTL, 0x33 }; 614 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; 615 616 mt352_write(fe, clock_config, sizeof(clock_config)); 617 udelay(200); 618 mt352_write(fe, reset, sizeof(reset)); 619 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); 620 621 mt352_write(fe, agc_cfg, sizeof(agc_cfg)); 622 mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); 623 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); 624 return 0; 625 } 626 627 static struct cx22702_config cxusb_cx22702_config = { 628 .demod_address = 0x63, 629 .output_mode = CX22702_PARALLEL_OUTPUT, 630 }; 631 632 static struct lgdt330x_config cxusb_lgdt3303_config = { 633 .demod_chip = LGDT3303, 634 }; 635 636 static struct lgdt330x_config cxusb_aver_lgdt3303_config = { 637 .demod_chip = LGDT3303, 638 .clock_polarity_flip = 2, 639 }; 640 641 static struct mt352_config cxusb_dee1601_config = { 642 .demod_address = 0x0f, 643 .demod_init = cxusb_dee1601_demod_init, 644 }; 645 646 static struct zl10353_config cxusb_zl10353_dee1601_config = { 647 .demod_address = 0x0f, 648 .parallel_ts = 1, 649 }; 650 651 static struct mt352_config cxusb_mt352_config = { 652 /* used in both lgz201 and th7579 */ 653 .demod_address = 0x0f, 654 .demod_init = cxusb_mt352_demod_init, 655 }; 656 657 static struct zl10353_config cxusb_zl10353_xc3028_config = { 658 .demod_address = 0x0f, 659 .if2 = 45600, 660 .no_tuner = 1, 661 .parallel_ts = 1, 662 }; 663 664 static struct zl10353_config cxusb_zl10353_xc3028_config_no_i2c_gate = { 665 .demod_address = 0x0f, 666 .if2 = 45600, 667 .no_tuner = 1, 668 .parallel_ts = 1, 669 .disable_i2c_gate_ctrl = 1, 670 }; 671 672 static struct mt352_config cxusb_mt352_xc3028_config = { 673 .demod_address = 0x0f, 674 .if2 = 4560, 675 .no_tuner = 1, 676 .demod_init = cxusb_mt352_demod_init, 677 }; 678 679 /* FIXME: needs tweaking */ 680 static struct mxl5005s_config aver_a868r_tuner = { 681 .i2c_address = 0x63, 682 .if_freq = 6000000UL, 683 .xtal_freq = CRYSTAL_FREQ_16000000HZ, 684 .agc_mode = MXL_SINGLE_AGC, 685 .tracking_filter = MXL_TF_C, 686 .rssi_enable = MXL_RSSI_ENABLE, 687 .cap_select = MXL_CAP_SEL_ENABLE, 688 .div_out = MXL_DIV_OUT_4, 689 .clock_out = MXL_CLOCK_OUT_DISABLE, 690 .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM, 691 .top = MXL5005S_TOP_25P2, 692 .mod_mode = MXL_DIGITAL_MODE, 693 .if_mode = MXL_ZERO_IF, 694 .AgcMasterByte = 0x00, 695 }; 696 697 /* FIXME: needs tweaking */ 698 static struct mxl5005s_config d680_dmb_tuner = { 699 .i2c_address = 0x63, 700 .if_freq = 36125000UL, 701 .xtal_freq = CRYSTAL_FREQ_16000000HZ, 702 .agc_mode = MXL_SINGLE_AGC, 703 .tracking_filter = MXL_TF_C, 704 .rssi_enable = MXL_RSSI_ENABLE, 705 .cap_select = MXL_CAP_SEL_ENABLE, 706 .div_out = MXL_DIV_OUT_4, 707 .clock_out = MXL_CLOCK_OUT_DISABLE, 708 .output_load = MXL5005S_IF_OUTPUT_LOAD_200_OHM, 709 .top = MXL5005S_TOP_25P2, 710 .mod_mode = MXL_DIGITAL_MODE, 711 .if_mode = MXL_ZERO_IF, 712 .AgcMasterByte = 0x00, 713 }; 714 715 static struct max2165_config mygica_d689_max2165_cfg = { 716 .i2c_address = 0x60, 717 .osc_clk = 20 718 }; 719 720 /* Callbacks for DVB USB */ 721 static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) 722 { 723 struct dvb_usb_device *dvbdev = adap->dev; 724 bool is_medion = dvbdev->props.devices[0].warm_ids[0] == 725 &cxusb_table[MEDION_MD95700]; 726 727 dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe, 728 &dvbdev->i2c_adap, 0x61, 729 TUNER_PHILIPS_FMD1216ME_MK3); 730 731 if (is_medion && adap->fe_adap[0].fe) 732 /* 733 * make sure that DVB core won't put to sleep (reset, really) 734 * tuner when we might be open in analog mode 735 */ 736 adap->fe_adap[0].fe->ops.tuner_ops.sleep = NULL; 737 738 return 0; 739 } 740 741 static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter *adap) 742 { 743 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61, 744 NULL, DVB_PLL_THOMSON_DTT7579); 745 return 0; 746 } 747 748 static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap) 749 { 750 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61, 751 NULL, DVB_PLL_LG_Z201); 752 return 0; 753 } 754 755 static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter *adap) 756 { 757 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60, 758 NULL, DVB_PLL_THOMSON_DTT7579); 759 return 0; 760 } 761 762 static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap) 763 { 764 dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe, 765 &adap->dev->i2c_adap, 0x61, TUNER_LG_TDVS_H06XF); 766 return 0; 767 } 768 769 static int dvico_bluebird_xc2028_callback(void *ptr, int component, 770 int command, int arg) 771 { 772 struct dvb_usb_adapter *adap = ptr; 773 struct dvb_usb_device *d = adap->dev; 774 775 switch (command) { 776 case XC2028_TUNER_RESET: 777 deb_info("%s: XC2028_TUNER_RESET %d\n", __func__, arg); 778 cxusb_bluebird_gpio_pulse(d, 0x01, 1); 779 break; 780 case XC2028_RESET_CLK: 781 deb_info("%s: XC2028_RESET_CLK %d\n", __func__, arg); 782 break; 783 case XC2028_I2C_FLUSH: 784 break; 785 default: 786 deb_info("%s: unknown command %d, arg %d\n", __func__, 787 command, arg); 788 return -EINVAL; 789 } 790 791 return 0; 792 } 793 794 static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap) 795 { 796 struct dvb_frontend *fe; 797 struct xc2028_config cfg = { 798 .i2c_adap = &adap->dev->i2c_adap, 799 .i2c_addr = 0x61, 800 }; 801 static struct xc2028_ctrl ctl = { 802 .fname = XC2028_DEFAULT_FIRMWARE, 803 .max_len = 64, 804 .demod = XC3028_FE_ZARLINK456, 805 }; 806 807 /* FIXME: generalize & move to common area */ 808 adap->fe_adap[0].fe->callback = dvico_bluebird_xc2028_callback; 809 810 fe = dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &cfg); 811 if (!fe || !fe->ops.tuner_ops.set_config) 812 return -EIO; 813 814 fe->ops.tuner_ops.set_config(fe, &ctl); 815 816 return 0; 817 } 818 819 static int cxusb_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap) 820 { 821 dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe, 822 &adap->dev->i2c_adap, &aver_a868r_tuner); 823 return 0; 824 } 825 826 static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter *adap) 827 { 828 struct dvb_frontend *fe; 829 830 fe = dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe, 831 &adap->dev->i2c_adap, &d680_dmb_tuner); 832 return (!fe) ? -EIO : 0; 833 } 834 835 static int cxusb_mygica_d689_tuner_attach(struct dvb_usb_adapter *adap) 836 { 837 struct dvb_frontend *fe; 838 839 fe = dvb_attach(max2165_attach, adap->fe_adap[0].fe, 840 &adap->dev->i2c_adap, &mygica_d689_max2165_cfg); 841 return (!fe) ? -EIO : 0; 842 } 843 844 static int cxusb_medion_fe_ts_bus_ctrl(struct dvb_frontend *fe, int acquire) 845 { 846 struct dvb_usb_adapter *adap = fe->dvb->priv; 847 struct dvb_usb_device *dvbdev = adap->dev; 848 849 if (acquire) 850 return cxusb_medion_get(dvbdev, CXUSB_OPEN_DIGITAL); 851 852 cxusb_medion_put(dvbdev); 853 854 return 0; 855 } 856 857 static int cxusb_medion_set_mode(struct dvb_usb_device *dvbdev, bool digital) 858 { 859 struct cxusb_state *st = dvbdev->priv; 860 int ret; 861 u8 b; 862 unsigned int i; 863 864 /* 865 * switching mode while doing an I2C transaction often causes 866 * the device to crash 867 */ 868 mutex_lock(&dvbdev->i2c_mutex); 869 870 if (digital) { 871 ret = usb_set_interface(dvbdev->udev, 0, 6); 872 if (ret != 0) { 873 dev_err(&dvbdev->udev->dev, 874 "digital interface selection failed (%d)\n", 875 ret); 876 goto ret_unlock; 877 } 878 } else { 879 ret = usb_set_interface(dvbdev->udev, 0, 1); 880 if (ret != 0) { 881 dev_err(&dvbdev->udev->dev, 882 "analog interface selection failed (%d)\n", 883 ret); 884 goto ret_unlock; 885 } 886 } 887 888 /* pipes need to be cleared after setting interface */ 889 ret = usb_clear_halt(dvbdev->udev, usb_rcvbulkpipe(dvbdev->udev, 1)); 890 if (ret != 0) 891 dev_warn(&dvbdev->udev->dev, 892 "clear halt on IN pipe failed (%d)\n", 893 ret); 894 895 ret = usb_clear_halt(dvbdev->udev, usb_sndbulkpipe(dvbdev->udev, 1)); 896 if (ret != 0) 897 dev_warn(&dvbdev->udev->dev, 898 "clear halt on OUT pipe failed (%d)\n", 899 ret); 900 901 ret = cxusb_ctrl_msg(dvbdev, digital ? CMD_DIGITAL : CMD_ANALOG, 902 NULL, 0, &b, 1); 903 if (ret != 0) { 904 dev_err(&dvbdev->udev->dev, "mode switch failed (%d)\n", 905 ret); 906 goto ret_unlock; 907 } 908 909 /* mode switch seems to reset GPIO states */ 910 for (i = 0; i < ARRAY_SIZE(st->gpio_write_refresh); i++) 911 st->gpio_write_refresh[i] = true; 912 913 ret_unlock: 914 mutex_unlock(&dvbdev->i2c_mutex); 915 916 return ret; 917 } 918 919 static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap) 920 { 921 struct dvb_usb_device *dvbdev = adap->dev; 922 bool is_medion = dvbdev->props.devices[0].warm_ids[0] == 923 &cxusb_table[MEDION_MD95700]; 924 925 if (is_medion) { 926 int ret; 927 928 ret = cxusb_medion_set_mode(dvbdev, true); 929 if (ret) 930 return ret; 931 } 932 933 adap->fe_adap[0].fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config, 934 &dvbdev->i2c_adap); 935 if (!adap->fe_adap[0].fe) 936 return -EIO; 937 938 if (is_medion) 939 adap->fe_adap[0].fe->ops.ts_bus_ctrl = 940 cxusb_medion_fe_ts_bus_ctrl; 941 942 return 0; 943 } 944 945 static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap) 946 { 947 if (usb_set_interface(adap->dev->udev, 0, 7) < 0) 948 err("set interface failed"); 949 950 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); 951 952 adap->fe_adap[0].fe = dvb_attach(lgdt330x_attach, 953 &cxusb_lgdt3303_config, 954 0x0e, 955 &adap->dev->i2c_adap); 956 if (adap->fe_adap[0].fe) 957 return 0; 958 959 return -EIO; 960 } 961 962 static int cxusb_aver_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap) 963 { 964 adap->fe_adap[0].fe = dvb_attach(lgdt330x_attach, 965 &cxusb_aver_lgdt3303_config, 966 0x0e, 967 &adap->dev->i2c_adap); 968 if (adap->fe_adap[0].fe) 969 return 0; 970 971 return -EIO; 972 } 973 974 static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap) 975 { 976 /* used in both lgz201 and th7579 */ 977 if (usb_set_interface(adap->dev->udev, 0, 0) < 0) 978 err("set interface failed"); 979 980 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); 981 982 adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_mt352_config, 983 &adap->dev->i2c_adap); 984 if (adap->fe_adap[0].fe) 985 return 0; 986 987 return -EIO; 988 } 989 990 static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter *adap) 991 { 992 if (usb_set_interface(adap->dev->udev, 0, 0) < 0) 993 err("set interface failed"); 994 995 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); 996 997 adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_dee1601_config, 998 &adap->dev->i2c_adap); 999 if (adap->fe_adap[0].fe) 1000 return 0; 1001 1002 adap->fe_adap[0].fe = dvb_attach(zl10353_attach, 1003 &cxusb_zl10353_dee1601_config, 1004 &adap->dev->i2c_adap); 1005 if (adap->fe_adap[0].fe) 1006 return 0; 1007 1008 return -EIO; 1009 } 1010 1011 static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap) 1012 { 1013 u8 ircode[4]; 1014 int i; 1015 struct i2c_msg msg = { 1016 .addr = 0x6b, 1017 .flags = I2C_M_RD, 1018 .buf = ircode, 1019 .len = 4 1020 }; 1021 1022 if (usb_set_interface(adap->dev->udev, 0, 1) < 0) 1023 err("set interface failed"); 1024 1025 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); 1026 1027 /* reset the tuner and demodulator */ 1028 cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0); 1029 cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1); 1030 cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); 1031 1032 adap->fe_adap[0].fe = 1033 dvb_attach(zl10353_attach, 1034 &cxusb_zl10353_xc3028_config_no_i2c_gate, 1035 &adap->dev->i2c_adap); 1036 if (!adap->fe_adap[0].fe) 1037 return -EIO; 1038 1039 /* try to determine if there is no IR decoder on the I2C bus */ 1040 for (i = 0; adap->dev->props.rc.core.rc_codes && i < 5; i++) { 1041 msleep(20); 1042 if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1) 1043 goto no_IR; 1044 if (ircode[0] == 0 && ircode[1] == 0) 1045 continue; 1046 if (ircode[2] + ircode[3] != 0xff) { 1047 no_IR: 1048 adap->dev->props.rc.core.rc_codes = NULL; 1049 info("No IR receiver detected on this device."); 1050 break; 1051 } 1052 } 1053 1054 return 0; 1055 } 1056 1057 static struct dibx000_agc_config dib7070_agc_config = { 1058 .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND, 1059 1060 /* 1061 * P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, 1062 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, 1063 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 1064 */ 1065 .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | 1066 (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), 1067 .inv_gain = 600, 1068 .time_stabiliz = 10, 1069 .alpha_level = 0, 1070 .thlock = 118, 1071 .wbd_inv = 0, 1072 .wbd_ref = 3530, 1073 .wbd_sel = 1, 1074 .wbd_alpha = 5, 1075 .agc1_max = 65535, 1076 .agc1_min = 0, 1077 .agc2_max = 65535, 1078 .agc2_min = 0, 1079 .agc1_pt1 = 0, 1080 .agc1_pt2 = 40, 1081 .agc1_pt3 = 183, 1082 .agc1_slope1 = 206, 1083 .agc1_slope2 = 255, 1084 .agc2_pt1 = 72, 1085 .agc2_pt2 = 152, 1086 .agc2_slope1 = 88, 1087 .agc2_slope2 = 90, 1088 .alpha_mant = 17, 1089 .alpha_exp = 27, 1090 .beta_mant = 23, 1091 .beta_exp = 51, 1092 .perform_agc_softsplit = 0, 1093 }; 1094 1095 static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = { 1096 .internal = 60000, 1097 .sampling = 15000, 1098 .pll_prediv = 1, 1099 .pll_ratio = 20, 1100 .pll_range = 3, 1101 .pll_reset = 1, 1102 .pll_bypass = 0, 1103 .enable_refdiv = 0, 1104 .bypclk_div = 0, 1105 .IO_CLK_en_core = 1, 1106 .ADClkSrc = 1, 1107 .modulo = 2, 1108 /* refsel, sel, freq_15k */ 1109 .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0), 1110 .ifreq = (0 << 25) | 0, 1111 .timf = 20452225, 1112 .xtal_hz = 12000000, 1113 }; 1114 1115 static struct dib7000p_config cxusb_dualdig4_rev2_config = { 1116 .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK, 1117 .output_mpeg2_in_188_bytes = 1, 1118 1119 .agc_config_count = 1, 1120 .agc = &dib7070_agc_config, 1121 .bw = &dib7070_bw_config_12_mhz, 1122 .tuner_is_baseband = 1, 1123 .spur_protect = 1, 1124 1125 .gpio_dir = 0xfcef, 1126 .gpio_val = 0x0110, 1127 1128 .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, 1129 1130 .hostbus_diversity = 1, 1131 }; 1132 1133 struct dib0700_adapter_state { 1134 int (*set_param_save)(struct dvb_frontend *fe); 1135 struct dib7000p_ops dib7000p_ops; 1136 }; 1137 1138 static int cxusb_dualdig4_rev2_frontend_attach(struct dvb_usb_adapter *adap) 1139 { 1140 struct dib0700_adapter_state *state = adap->priv; 1141 1142 if (usb_set_interface(adap->dev->udev, 0, 1) < 0) 1143 err("set interface failed"); 1144 1145 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); 1146 1147 cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); 1148 1149 if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops)) 1150 return -ENODEV; 1151 1152 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 1153 &cxusb_dualdig4_rev2_config) < 0) { 1154 pr_warn("Unable to enumerate dib7000p\n"); 1155 return -ENODEV; 1156 } 1157 1158 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 1159 0x80, 1160 &cxusb_dualdig4_rev2_config); 1161 if (!adap->fe_adap[0].fe) 1162 return -EIO; 1163 1164 return 0; 1165 } 1166 1167 static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff) 1168 { 1169 struct dvb_usb_adapter *adap = fe->dvb->priv; 1170 struct dib0700_adapter_state *state = adap->priv; 1171 1172 return state->dib7000p_ops.set_gpio(fe, 8, 0, !onoff); 1173 } 1174 1175 static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff) 1176 { 1177 return 0; 1178 } 1179 1180 static struct dib0070_config dib7070p_dib0070_config = { 1181 .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS, 1182 .reset = dib7070_tuner_reset, 1183 .sleep = dib7070_tuner_sleep, 1184 .clock_khz = 12000, 1185 }; 1186 1187 static int dib7070_set_param_override(struct dvb_frontend *fe) 1188 { 1189 struct dtv_frontend_properties *p = &fe->dtv_property_cache; 1190 struct dvb_usb_adapter *adap = fe->dvb->priv; 1191 struct dib0700_adapter_state *state = adap->priv; 1192 1193 u16 offset; 1194 u8 band = BAND_OF_FREQUENCY(p->frequency / 1000); 1195 1196 switch (band) { 1197 case BAND_VHF: 1198 offset = 950; 1199 break; 1200 default: 1201 case BAND_UHF: 1202 offset = 550; 1203 break; 1204 } 1205 1206 state->dib7000p_ops.set_wbd_ref(fe, offset + dib0070_wbd_offset(fe)); 1207 1208 return state->set_param_save(fe); 1209 } 1210 1211 static int cxusb_dualdig4_rev2_tuner_attach(struct dvb_usb_adapter *adap) 1212 { 1213 struct dib0700_adapter_state *st = adap->priv; 1214 struct i2c_adapter *tun_i2c; 1215 1216 /* 1217 * No need to call dvb7000p_attach here, as it was called 1218 * already, as frontend_attach method is called first, and 1219 * tuner_attach is only called on success. 1220 */ 1221 tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, 1222 DIBX000_I2C_INTERFACE_TUNER, 1); 1223 1224 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, 1225 &dib7070p_dib0070_config) == NULL) 1226 return -ENODEV; 1227 1228 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; 1229 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override; 1230 return 0; 1231 } 1232 1233 static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap) 1234 { 1235 if (usb_set_interface(adap->dev->udev, 0, 1) < 0) 1236 err("set interface failed"); 1237 1238 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); 1239 1240 /* reset the tuner and demodulator */ 1241 cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0); 1242 cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1); 1243 cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); 1244 1245 adap->fe_adap[0].fe = dvb_attach(zl10353_attach, 1246 &cxusb_zl10353_xc3028_config, 1247 &adap->dev->i2c_adap); 1248 if (adap->fe_adap[0].fe) 1249 return 0; 1250 1251 adap->fe_adap[0].fe = dvb_attach(mt352_attach, 1252 &cxusb_mt352_xc3028_config, 1253 &adap->dev->i2c_adap); 1254 if (adap->fe_adap[0].fe) 1255 return 0; 1256 1257 return -EIO; 1258 } 1259 1260 static struct lgs8gxx_config d680_lgs8gl5_cfg = { 1261 .prod = LGS8GXX_PROD_LGS8GL5, 1262 .demod_address = 0x19, 1263 .serial_ts = 0, 1264 .ts_clk_pol = 0, 1265 .ts_clk_gated = 1, 1266 .if_clk_freq = 30400, /* 30.4 MHz */ 1267 .if_freq = 5725, /* 5.725 MHz */ 1268 .if_neg_center = 0, 1269 .ext_adc = 0, 1270 .adc_signed = 0, 1271 .if_neg_edge = 0, 1272 }; 1273 1274 static int cxusb_d680_dmb_frontend_attach(struct dvb_usb_adapter *adap) 1275 { 1276 struct dvb_usb_device *d = adap->dev; 1277 int n; 1278 1279 /* Select required USB configuration */ 1280 if (usb_set_interface(d->udev, 0, 0) < 0) 1281 err("set interface failed"); 1282 1283 /* Unblock all USB pipes */ 1284 usb_clear_halt(d->udev, 1285 usb_sndbulkpipe(d->udev, 1286 d->props.generic_bulk_ctrl_endpoint)); 1287 usb_clear_halt(d->udev, 1288 usb_rcvbulkpipe(d->udev, 1289 d->props.generic_bulk_ctrl_endpoint)); 1290 usb_clear_halt(d->udev, 1291 usb_rcvbulkpipe(d->udev, 1292 d->props.adapter[0].fe[0].stream.endpoint)); 1293 1294 /* Drain USB pipes to avoid hang after reboot */ 1295 for (n = 0; n < 5; n++) { 1296 cxusb_d680_dmb_drain_message(d); 1297 cxusb_d680_dmb_drain_video(d); 1298 msleep(200); 1299 } 1300 1301 /* Reset the tuner */ 1302 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) { 1303 err("clear tuner gpio failed"); 1304 return -EIO; 1305 } 1306 msleep(100); 1307 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) { 1308 err("set tuner gpio failed"); 1309 return -EIO; 1310 } 1311 msleep(100); 1312 1313 /* Attach frontend */ 1314 adap->fe_adap[0].fe = dvb_attach(lgs8gxx_attach, 1315 &d680_lgs8gl5_cfg, &d->i2c_adap); 1316 if (!adap->fe_adap[0].fe) 1317 return -EIO; 1318 1319 return 0; 1320 } 1321 1322 static struct atbm8830_config mygica_d689_atbm8830_cfg = { 1323 .prod = ATBM8830_PROD_8830, 1324 .demod_address = 0x40, 1325 .serial_ts = 0, 1326 .ts_sampling_edge = 1, 1327 .ts_clk_gated = 0, 1328 .osc_clk_freq = 30400, /* in kHz */ 1329 .if_freq = 0, /* zero IF */ 1330 .zif_swap_iq = 1, 1331 .agc_min = 0x2E, 1332 .agc_max = 0x90, 1333 .agc_hold_loop = 0, 1334 }; 1335 1336 static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap) 1337 { 1338 struct dvb_usb_device *d = adap->dev; 1339 1340 /* Select required USB configuration */ 1341 if (usb_set_interface(d->udev, 0, 0) < 0) 1342 err("set interface failed"); 1343 1344 /* Unblock all USB pipes */ 1345 usb_clear_halt(d->udev, 1346 usb_sndbulkpipe(d->udev, 1347 d->props.generic_bulk_ctrl_endpoint)); 1348 usb_clear_halt(d->udev, 1349 usb_rcvbulkpipe(d->udev, 1350 d->props.generic_bulk_ctrl_endpoint)); 1351 usb_clear_halt(d->udev, 1352 usb_rcvbulkpipe(d->udev, 1353 d->props.adapter[0].fe[0].stream.endpoint)); 1354 1355 /* Reset the tuner */ 1356 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) { 1357 err("clear tuner gpio failed"); 1358 return -EIO; 1359 } 1360 msleep(100); 1361 if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) { 1362 err("set tuner gpio failed"); 1363 return -EIO; 1364 } 1365 msleep(100); 1366 1367 /* Attach frontend */ 1368 adap->fe_adap[0].fe = dvb_attach(atbm8830_attach, 1369 &mygica_d689_atbm8830_cfg, 1370 &d->i2c_adap); 1371 if (!adap->fe_adap[0].fe) 1372 return -EIO; 1373 1374 return 0; 1375 } 1376 1377 static int cxusb_mygica_t230_frontend_attach(struct dvb_usb_adapter *adap) 1378 { 1379 struct dvb_usb_device *d = adap->dev; 1380 struct cxusb_state *st = d->priv; 1381 struct i2c_adapter *adapter; 1382 struct i2c_client *client_demod; 1383 struct i2c_client *client_tuner; 1384 struct i2c_board_info info; 1385 struct si2168_config si2168_config; 1386 struct si2157_config si2157_config; 1387 1388 /* Select required USB configuration */ 1389 if (usb_set_interface(d->udev, 0, 0) < 0) 1390 err("set interface failed"); 1391 1392 /* Unblock all USB pipes */ 1393 usb_clear_halt(d->udev, 1394 usb_sndbulkpipe(d->udev, 1395 d->props.generic_bulk_ctrl_endpoint)); 1396 usb_clear_halt(d->udev, 1397 usb_rcvbulkpipe(d->udev, 1398 d->props.generic_bulk_ctrl_endpoint)); 1399 usb_clear_halt(d->udev, 1400 usb_rcvbulkpipe(d->udev, 1401 d->props.adapter[0].fe[0].stream.endpoint)); 1402 1403 /* attach frontend */ 1404 si2168_config.i2c_adapter = &adapter; 1405 si2168_config.fe = &adap->fe_adap[0].fe; 1406 si2168_config.ts_mode = SI2168_TS_PARALLEL; 1407 si2168_config.ts_clock_inv = 1; 1408 memset(&info, 0, sizeof(struct i2c_board_info)); 1409 strscpy(info.type, "si2168", I2C_NAME_SIZE); 1410 info.addr = 0x64; 1411 info.platform_data = &si2168_config; 1412 request_module(info.type); 1413 client_demod = i2c_new_device(&d->i2c_adap, &info); 1414 if (!client_demod || !client_demod->dev.driver) 1415 return -ENODEV; 1416 1417 if (!try_module_get(client_demod->dev.driver->owner)) { 1418 i2c_unregister_device(client_demod); 1419 return -ENODEV; 1420 } 1421 1422 st->i2c_client_demod = client_demod; 1423 1424 /* attach tuner */ 1425 memset(&si2157_config, 0, sizeof(si2157_config)); 1426 si2157_config.fe = adap->fe_adap[0].fe; 1427 si2157_config.if_port = 1; 1428 memset(&info, 0, sizeof(struct i2c_board_info)); 1429 strscpy(info.type, "si2157", I2C_NAME_SIZE); 1430 info.addr = 0x60; 1431 info.platform_data = &si2157_config; 1432 request_module(info.type); 1433 client_tuner = i2c_new_device(adapter, &info); 1434 if (!client_tuner || !client_tuner->dev.driver) { 1435 module_put(client_demod->dev.driver->owner); 1436 i2c_unregister_device(client_demod); 1437 return -ENODEV; 1438 } 1439 if (!try_module_get(client_tuner->dev.driver->owner)) { 1440 i2c_unregister_device(client_tuner); 1441 module_put(client_demod->dev.driver->owner); 1442 i2c_unregister_device(client_demod); 1443 return -ENODEV; 1444 } 1445 1446 st->i2c_client_tuner = client_tuner; 1447 1448 /* hook fe: need to resync the slave fifo when signal locks. */ 1449 mutex_init(&st->stream_mutex); 1450 st->last_lock = 0; 1451 st->fe_read_status = adap->fe_adap[0].fe->ops.read_status; 1452 adap->fe_adap[0].fe->ops.read_status = cxusb_read_status; 1453 1454 return 0; 1455 } 1456 1457 /* 1458 * DViCO has shipped two devices with the same USB ID, but only one of them 1459 * needs a firmware download. Check the device class details to see if they 1460 * have non-default values to decide whether the device is actually cold or 1461 * not, and forget a match if it turns out we selected the wrong device. 1462 */ 1463 static int bluebird_fx2_identify_state(struct usb_device *udev, 1464 struct dvb_usb_device_properties *props, 1465 struct dvb_usb_device_description **desc, 1466 int *cold) 1467 { 1468 int wascold = *cold; 1469 1470 *cold = udev->descriptor.bDeviceClass == 0xff && 1471 udev->descriptor.bDeviceSubClass == 0xff && 1472 udev->descriptor.bDeviceProtocol == 0xff; 1473 1474 if (*cold && !wascold) 1475 *desc = NULL; 1476 1477 return 0; 1478 } 1479 1480 /* 1481 * DViCO bluebird firmware needs the "warm" product ID to be patched into the 1482 * firmware file before download. 1483 */ 1484 1485 static const int dvico_firmware_id_offsets[] = { 6638, 3204 }; 1486 static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, 1487 const struct firmware *fw) 1488 { 1489 int pos; 1490 1491 for (pos = 0; pos < ARRAY_SIZE(dvico_firmware_id_offsets); pos++) { 1492 int idoff = dvico_firmware_id_offsets[pos]; 1493 1494 if (fw->size < idoff + 4) 1495 continue; 1496 1497 if (fw->data[idoff] == (USB_VID_DVICO & 0xff) && 1498 fw->data[idoff + 1] == USB_VID_DVICO >> 8) { 1499 struct firmware new_fw; 1500 u8 *new_fw_data = vmalloc(fw->size); 1501 int ret; 1502 1503 if (!new_fw_data) 1504 return -ENOMEM; 1505 1506 memcpy(new_fw_data, fw->data, fw->size); 1507 new_fw.size = fw->size; 1508 new_fw.data = new_fw_data; 1509 1510 new_fw_data[idoff + 2] = 1511 le16_to_cpu(udev->descriptor.idProduct) + 1; 1512 new_fw_data[idoff + 3] = 1513 le16_to_cpu(udev->descriptor.idProduct) >> 8; 1514 1515 ret = usb_cypress_load_firmware(udev, &new_fw, 1516 CYPRESS_FX2); 1517 vfree(new_fw_data); 1518 return ret; 1519 } 1520 } 1521 1522 return -EINVAL; 1523 } 1524 1525 int cxusb_medion_get(struct dvb_usb_device *dvbdev, 1526 enum cxusb_open_type open_type) 1527 { 1528 struct cxusb_medion_dev *cxdev = dvbdev->priv; 1529 int ret = 0; 1530 1531 mutex_lock(&cxdev->open_lock); 1532 1533 if (WARN_ON((cxdev->open_type == CXUSB_OPEN_INIT || 1534 cxdev->open_type == CXUSB_OPEN_NONE) && 1535 cxdev->open_ctr != 0)) { 1536 ret = -EINVAL; 1537 goto ret_unlock; 1538 } 1539 1540 if (cxdev->open_type == CXUSB_OPEN_INIT) { 1541 ret = -EAGAIN; 1542 goto ret_unlock; 1543 } 1544 1545 if (cxdev->open_ctr == 0) { 1546 if (cxdev->open_type != open_type) { 1547 deb_info("will acquire and switch to %s\n", 1548 open_type == CXUSB_OPEN_ANALOG ? 1549 "analog" : "digital"); 1550 1551 if (open_type == CXUSB_OPEN_ANALOG) { 1552 ret = _cxusb_power_ctrl(dvbdev, 1); 1553 if (ret != 0) 1554 dev_warn(&dvbdev->udev->dev, 1555 "powerup for analog switch failed (%d)\n", 1556 ret); 1557 1558 ret = cxusb_medion_set_mode(dvbdev, false); 1559 if (ret != 0) 1560 goto ret_unlock; 1561 1562 ret = cxusb_medion_analog_init(dvbdev); 1563 if (ret != 0) 1564 goto ret_unlock; 1565 } else { /* digital */ 1566 ret = _cxusb_power_ctrl(dvbdev, 1); 1567 if (ret != 0) 1568 dev_warn(&dvbdev->udev->dev, 1569 "powerup for digital switch failed (%d)\n", 1570 ret); 1571 1572 ret = cxusb_medion_set_mode(dvbdev, true); 1573 if (ret != 0) 1574 goto ret_unlock; 1575 } 1576 1577 cxdev->open_type = open_type; 1578 } else { 1579 deb_info("reacquired idle %s\n", 1580 open_type == CXUSB_OPEN_ANALOG ? 1581 "analog" : "digital"); 1582 } 1583 1584 cxdev->open_ctr = 1; 1585 } else if (cxdev->open_type == open_type) { 1586 cxdev->open_ctr++; 1587 deb_info("acquired %s\n", open_type == CXUSB_OPEN_ANALOG ? 1588 "analog" : "digital"); 1589 } else { 1590 ret = -EBUSY; 1591 } 1592 1593 ret_unlock: 1594 mutex_unlock(&cxdev->open_lock); 1595 1596 return ret; 1597 } 1598 1599 void cxusb_medion_put(struct dvb_usb_device *dvbdev) 1600 { 1601 struct cxusb_medion_dev *cxdev = dvbdev->priv; 1602 1603 mutex_lock(&cxdev->open_lock); 1604 1605 if (cxdev->open_type == CXUSB_OPEN_INIT) { 1606 WARN_ON(cxdev->open_ctr != 0); 1607 cxdev->open_type = CXUSB_OPEN_NONE; 1608 goto unlock; 1609 } 1610 1611 if (!WARN_ON(cxdev->open_ctr < 1)) { 1612 cxdev->open_ctr--; 1613 1614 deb_info("release %s\n", 1615 cxdev->open_type == CXUSB_OPEN_ANALOG ? 1616 "analog" : "digital"); 1617 } 1618 1619 unlock: 1620 mutex_unlock(&cxdev->open_lock); 1621 } 1622 1623 /* DVB USB Driver stuff */ 1624 static struct dvb_usb_device_properties cxusb_medion_properties; 1625 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties; 1626 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties; 1627 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties; 1628 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties; 1629 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties; 1630 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties; 1631 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties; 1632 static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_properties; 1633 static struct dvb_usb_device_properties cxusb_aver_a868r_properties; 1634 static struct dvb_usb_device_properties cxusb_d680_dmb_properties; 1635 static struct dvb_usb_device_properties cxusb_mygica_d689_properties; 1636 static struct dvb_usb_device_properties cxusb_mygica_t230_properties; 1637 1638 static int cxusb_medion_priv_init(struct dvb_usb_device *dvbdev) 1639 { 1640 struct cxusb_medion_dev *cxdev = dvbdev->priv; 1641 1642 cxdev->dvbdev = dvbdev; 1643 cxdev->open_type = CXUSB_OPEN_INIT; 1644 mutex_init(&cxdev->open_lock); 1645 1646 return 0; 1647 } 1648 1649 static void cxusb_medion_priv_destroy(struct dvb_usb_device *dvbdev) 1650 { 1651 struct cxusb_medion_dev *cxdev = dvbdev->priv; 1652 1653 mutex_destroy(&cxdev->open_lock); 1654 } 1655 1656 static bool cxusb_medion_check_altsetting(struct usb_host_interface *as) 1657 { 1658 unsigned int ctr; 1659 1660 for (ctr = 0; ctr < as->desc.bNumEndpoints; ctr++) { 1661 if ((as->endpoint[ctr].desc.bEndpointAddress & 1662 USB_ENDPOINT_NUMBER_MASK) != 2) 1663 continue; 1664 1665 if (as->endpoint[ctr].desc.bEndpointAddress & USB_DIR_IN && 1666 ((as->endpoint[ctr].desc.bmAttributes & 1667 USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_ISOC)) 1668 return true; 1669 1670 break; 1671 } 1672 1673 return false; 1674 } 1675 1676 static bool cxusb_medion_check_intf(struct usb_interface *intf) 1677 { 1678 unsigned int ctr; 1679 1680 if (intf->num_altsetting < 2) { 1681 dev_err(intf->usb_dev, "no alternate interface"); 1682 1683 return false; 1684 } 1685 1686 for (ctr = 0; ctr < intf->num_altsetting; ctr++) { 1687 if (intf->altsetting[ctr].desc.bAlternateSetting != 1) 1688 continue; 1689 1690 if (cxusb_medion_check_altsetting(&intf->altsetting[ctr])) 1691 return true; 1692 1693 break; 1694 } 1695 1696 dev_err(intf->usb_dev, "no iso interface"); 1697 1698 return false; 1699 } 1700 1701 static int cxusb_probe(struct usb_interface *intf, 1702 const struct usb_device_id *id) 1703 { 1704 struct dvb_usb_device *dvbdev; 1705 int ret; 1706 1707 /* Medion 95700 */ 1708 if (!dvb_usb_device_init(intf, &cxusb_medion_properties, 1709 THIS_MODULE, &dvbdev, adapter_nr)) { 1710 if (!cxusb_medion_check_intf(intf)) { 1711 ret = -ENODEV; 1712 goto ret_uninit; 1713 } 1714 1715 _cxusb_power_ctrl(dvbdev, 1); 1716 ret = cxusb_medion_set_mode(dvbdev, false); 1717 if (ret) 1718 goto ret_uninit; 1719 1720 ret = cxusb_medion_register_analog(dvbdev); 1721 1722 cxusb_medion_set_mode(dvbdev, true); 1723 _cxusb_power_ctrl(dvbdev, 0); 1724 1725 if (ret != 0) 1726 goto ret_uninit; 1727 1728 /* release device from INIT mode to normal operation */ 1729 cxusb_medion_put(dvbdev); 1730 1731 return 0; 1732 } else if (!dvb_usb_device_init(intf, 1733 &cxusb_bluebird_lgh064f_properties, 1734 THIS_MODULE, NULL, adapter_nr) || 1735 !dvb_usb_device_init(intf, 1736 &cxusb_bluebird_dee1601_properties, 1737 THIS_MODULE, NULL, adapter_nr) || 1738 !dvb_usb_device_init(intf, 1739 &cxusb_bluebird_lgz201_properties, 1740 THIS_MODULE, NULL, adapter_nr) || 1741 !dvb_usb_device_init(intf, 1742 &cxusb_bluebird_dtt7579_properties, 1743 THIS_MODULE, NULL, adapter_nr) || 1744 !dvb_usb_device_init(intf, 1745 &cxusb_bluebird_dualdig4_properties, 1746 THIS_MODULE, NULL, adapter_nr) || 1747 !dvb_usb_device_init(intf, 1748 &cxusb_bluebird_nano2_properties, 1749 THIS_MODULE, NULL, adapter_nr) || 1750 !dvb_usb_device_init(intf, 1751 &cxusb_bluebird_nano2_needsfirmware_properties, 1752 THIS_MODULE, NULL, adapter_nr) || 1753 !dvb_usb_device_init(intf, &cxusb_aver_a868r_properties, 1754 THIS_MODULE, NULL, adapter_nr) || 1755 !dvb_usb_device_init(intf, 1756 &cxusb_bluebird_dualdig4_rev2_properties, 1757 THIS_MODULE, NULL, adapter_nr) || 1758 !dvb_usb_device_init(intf, &cxusb_d680_dmb_properties, 1759 THIS_MODULE, NULL, adapter_nr) || 1760 !dvb_usb_device_init(intf, &cxusb_mygica_d689_properties, 1761 THIS_MODULE, NULL, adapter_nr) || 1762 !dvb_usb_device_init(intf, &cxusb_mygica_t230_properties, 1763 THIS_MODULE, NULL, adapter_nr) || 1764 0) 1765 return 0; 1766 1767 return -EINVAL; 1768 1769 ret_uninit: 1770 dvb_usb_device_exit(intf); 1771 1772 return ret; 1773 } 1774 1775 static void cxusb_disconnect(struct usb_interface *intf) 1776 { 1777 struct dvb_usb_device *d = usb_get_intfdata(intf); 1778 struct cxusb_state *st = d->priv; 1779 struct i2c_client *client; 1780 1781 if (d->props.devices[0].warm_ids[0] == &cxusb_table[MEDION_MD95700]) 1782 cxusb_medion_unregister_analog(d); 1783 1784 /* remove I2C client for tuner */ 1785 client = st->i2c_client_tuner; 1786 if (client) { 1787 module_put(client->dev.driver->owner); 1788 i2c_unregister_device(client); 1789 } 1790 1791 /* remove I2C client for demodulator */ 1792 client = st->i2c_client_demod; 1793 if (client) { 1794 module_put(client->dev.driver->owner); 1795 i2c_unregister_device(client); 1796 } 1797 1798 dvb_usb_device_exit(intf); 1799 } 1800 1801 static struct usb_device_id cxusb_table[NR__cxusb_table_index + 1] = { 1802 [MEDION_MD95700] = { 1803 USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) 1804 }, 1805 [DVICO_BLUEBIRD_LG064F_COLD] = { 1806 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) 1807 }, 1808 [DVICO_BLUEBIRD_LG064F_WARM] = { 1809 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) 1810 }, 1811 [DVICO_BLUEBIRD_DUAL_1_COLD] = { 1812 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD) 1813 }, 1814 [DVICO_BLUEBIRD_DUAL_1_WARM] = { 1815 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM) 1816 }, 1817 [DVICO_BLUEBIRD_LGZ201_COLD] = { 1818 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) 1819 }, 1820 [DVICO_BLUEBIRD_LGZ201_WARM] = { 1821 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) 1822 }, 1823 [DVICO_BLUEBIRD_TH7579_COLD] = { 1824 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) 1825 }, 1826 [DVICO_BLUEBIRD_TH7579_WARM] = { 1827 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) 1828 }, 1829 [DIGITALNOW_BLUEBIRD_DUAL_1_COLD] = { 1830 USB_DEVICE(USB_VID_DVICO, 1831 USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD) 1832 }, 1833 [DIGITALNOW_BLUEBIRD_DUAL_1_WARM] = { 1834 USB_DEVICE(USB_VID_DVICO, 1835 USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM) 1836 }, 1837 [DVICO_BLUEBIRD_DUAL_2_COLD] = { 1838 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD) 1839 }, 1840 [DVICO_BLUEBIRD_DUAL_2_WARM] = { 1841 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM) 1842 }, 1843 [DVICO_BLUEBIRD_DUAL_4] = { 1844 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4) 1845 }, 1846 [DVICO_BLUEBIRD_DVB_T_NANO_2] = { 1847 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2) 1848 }, 1849 [DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM] = { 1850 USB_DEVICE(USB_VID_DVICO, 1851 USB_PID_DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM) 1852 }, 1853 [AVERMEDIA_VOLAR_A868R] = { 1854 USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_A868R) 1855 }, 1856 [DVICO_BLUEBIRD_DUAL_4_REV_2] = { 1857 USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_4_REV_2) 1858 }, 1859 [CONEXANT_D680_DMB] = { 1860 USB_DEVICE(USB_VID_CONEXANT, USB_PID_CONEXANT_D680_DMB) 1861 }, 1862 [MYGICA_D689] = { 1863 USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_D689) 1864 }, 1865 [MYGICA_T230] = { 1866 USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230) 1867 }, 1868 {} /* Terminating entry */ 1869 }; 1870 MODULE_DEVICE_TABLE(usb, cxusb_table); 1871 1872 static struct dvb_usb_device_properties cxusb_medion_properties = { 1873 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 1874 1875 .usb_ctrl = CYPRESS_FX2, 1876 1877 .size_of_priv = sizeof(struct cxusb_medion_dev), 1878 .priv_init = cxusb_medion_priv_init, 1879 .priv_destroy = cxusb_medion_priv_destroy, 1880 1881 .num_adapters = 1, 1882 .adapter = { 1883 { 1884 .num_frontends = 1, 1885 .fe = {{ 1886 .streaming_ctrl = cxusb_streaming_ctrl, 1887 .frontend_attach = cxusb_cx22702_frontend_attach, 1888 .tuner_attach = cxusb_fmd1216me_tuner_attach, 1889 /* parameter for the MPEG2-data transfer */ 1890 .stream = { 1891 .type = USB_BULK, 1892 .count = 5, 1893 .endpoint = 0x02, 1894 .u = { 1895 .bulk = { 1896 .buffersize = 8192, 1897 } 1898 } 1899 }, 1900 } }, 1901 }, 1902 }, 1903 .power_ctrl = cxusb_power_ctrl, 1904 1905 .i2c_algo = &cxusb_i2c_algo, 1906 1907 .generic_bulk_ctrl_endpoint = 0x01, 1908 1909 .num_device_descs = 1, 1910 .devices = { 1911 { 1912 "Medion MD95700 (MDUSBTV-HYBRID)", 1913 { NULL }, 1914 { &cxusb_table[MEDION_MD95700], NULL }, 1915 }, 1916 } 1917 }; 1918 1919 static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = { 1920 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 1921 1922 .usb_ctrl = DEVICE_SPECIFIC, 1923 .firmware = "dvb-usb-bluebird-01.fw", 1924 .download_firmware = bluebird_patch_dvico_firmware_download, 1925 /* 1926 * use usb alt setting 0 for EP4 transfer (dvb-t), 1927 * use usb alt setting 7 for EP2 transfer (atsc) 1928 */ 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_streaming_ctrl, 1938 .frontend_attach = cxusb_lgdt3303_frontend_attach, 1939 .tuner_attach = cxusb_lgh064f_tuner_attach, 1940 1941 /* parameter for the MPEG2-data transfer */ 1942 .stream = { 1943 .type = USB_BULK, 1944 .count = 5, 1945 .endpoint = 0x02, 1946 .u = { 1947 .bulk = { 1948 .buffersize = 8192, 1949 } 1950 } 1951 }, 1952 } }, 1953 }, 1954 }, 1955 1956 .power_ctrl = cxusb_bluebird_power_ctrl, 1957 1958 .i2c_algo = &cxusb_i2c_algo, 1959 1960 .rc.core = { 1961 .rc_interval = 100, 1962 .rc_codes = RC_MAP_DVICO_PORTABLE, 1963 .module_name = KBUILD_MODNAME, 1964 .rc_query = cxusb_rc_query, 1965 .allowed_protos = RC_PROTO_BIT_NEC, 1966 }, 1967 1968 .generic_bulk_ctrl_endpoint = 0x01, 1969 1970 .num_device_descs = 1, 1971 .devices = { 1972 { "DViCO FusionHDTV5 USB Gold", 1973 { &cxusb_table[DVICO_BLUEBIRD_LG064F_COLD], NULL }, 1974 { &cxusb_table[DVICO_BLUEBIRD_LG064F_WARM], NULL }, 1975 }, 1976 } 1977 }; 1978 1979 static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = { 1980 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 1981 1982 .usb_ctrl = DEVICE_SPECIFIC, 1983 .firmware = "dvb-usb-bluebird-01.fw", 1984 .download_firmware = bluebird_patch_dvico_firmware_download, 1985 /* 1986 * use usb alt setting 0 for EP4 transfer (dvb-t), 1987 * use usb alt setting 7 for EP2 transfer (atsc) 1988 */ 1989 1990 .size_of_priv = sizeof(struct cxusb_state), 1991 1992 .num_adapters = 1, 1993 .adapter = { 1994 { 1995 .num_frontends = 1, 1996 .fe = {{ 1997 .streaming_ctrl = cxusb_streaming_ctrl, 1998 .frontend_attach = cxusb_dee1601_frontend_attach, 1999 .tuner_attach = cxusb_dee1601_tuner_attach, 2000 /* parameter for the MPEG2-data transfer */ 2001 .stream = { 2002 .type = USB_BULK, 2003 .count = 5, 2004 .endpoint = 0x04, 2005 .u = { 2006 .bulk = { 2007 .buffersize = 8192, 2008 } 2009 } 2010 }, 2011 } }, 2012 }, 2013 }, 2014 2015 .power_ctrl = cxusb_bluebird_power_ctrl, 2016 2017 .i2c_algo = &cxusb_i2c_algo, 2018 2019 .rc.core = { 2020 .rc_interval = 100, 2021 .rc_codes = RC_MAP_DVICO_MCE, 2022 .module_name = KBUILD_MODNAME, 2023 .rc_query = cxusb_rc_query, 2024 .allowed_protos = RC_PROTO_BIT_NEC, 2025 }, 2026 2027 .generic_bulk_ctrl_endpoint = 0x01, 2028 2029 .num_device_descs = 3, 2030 .devices = { 2031 { "DViCO FusionHDTV DVB-T Dual USB", 2032 { &cxusb_table[DVICO_BLUEBIRD_DUAL_1_COLD], NULL }, 2033 { &cxusb_table[DVICO_BLUEBIRD_DUAL_1_WARM], NULL }, 2034 }, 2035 { "DigitalNow DVB-T Dual USB", 2036 { &cxusb_table[DIGITALNOW_BLUEBIRD_DUAL_1_COLD], NULL }, 2037 { &cxusb_table[DIGITALNOW_BLUEBIRD_DUAL_1_WARM], NULL }, 2038 }, 2039 { "DViCO FusionHDTV DVB-T Dual Digital 2", 2040 { &cxusb_table[DVICO_BLUEBIRD_DUAL_2_COLD], NULL }, 2041 { &cxusb_table[DVICO_BLUEBIRD_DUAL_2_WARM], NULL }, 2042 }, 2043 } 2044 }; 2045 2046 static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = { 2047 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 2048 2049 .usb_ctrl = DEVICE_SPECIFIC, 2050 .firmware = "dvb-usb-bluebird-01.fw", 2051 .download_firmware = bluebird_patch_dvico_firmware_download, 2052 /* 2053 * use usb alt setting 0 for EP4 transfer (dvb-t), 2054 * use usb alt setting 7 for EP2 transfer (atsc) 2055 */ 2056 2057 .size_of_priv = sizeof(struct cxusb_state), 2058 2059 .num_adapters = 2, 2060 .adapter = { 2061 { 2062 .num_frontends = 1, 2063 .fe = {{ 2064 .streaming_ctrl = cxusb_streaming_ctrl, 2065 .frontend_attach = cxusb_mt352_frontend_attach, 2066 .tuner_attach = cxusb_lgz201_tuner_attach, 2067 2068 /* parameter for the MPEG2-data transfer */ 2069 .stream = { 2070 .type = USB_BULK, 2071 .count = 5, 2072 .endpoint = 0x04, 2073 .u = { 2074 .bulk = { 2075 .buffersize = 8192, 2076 } 2077 } 2078 }, 2079 } }, 2080 }, 2081 }, 2082 .power_ctrl = cxusb_bluebird_power_ctrl, 2083 2084 .i2c_algo = &cxusb_i2c_algo, 2085 2086 .rc.core = { 2087 .rc_interval = 100, 2088 .rc_codes = RC_MAP_DVICO_PORTABLE, 2089 .module_name = KBUILD_MODNAME, 2090 .rc_query = cxusb_rc_query, 2091 .allowed_protos = RC_PROTO_BIT_NEC, 2092 }, 2093 2094 .generic_bulk_ctrl_endpoint = 0x01, 2095 .num_device_descs = 1, 2096 .devices = { 2097 { "DViCO FusionHDTV DVB-T USB (LGZ201)", 2098 { &cxusb_table[DVICO_BLUEBIRD_LGZ201_COLD], NULL }, 2099 { &cxusb_table[DVICO_BLUEBIRD_LGZ201_WARM], NULL }, 2100 }, 2101 } 2102 }; 2103 2104 static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = { 2105 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 2106 2107 .usb_ctrl = DEVICE_SPECIFIC, 2108 .firmware = "dvb-usb-bluebird-01.fw", 2109 .download_firmware = bluebird_patch_dvico_firmware_download, 2110 2111 /* 2112 * use usb alt setting 0 for EP4 transfer (dvb-t), 2113 * use usb alt setting 7 for EP2 transfer (atsc) 2114 */ 2115 2116 .size_of_priv = sizeof(struct cxusb_state), 2117 2118 .num_adapters = 1, 2119 .adapter = { 2120 { 2121 .num_frontends = 1, 2122 .fe = {{ 2123 .streaming_ctrl = cxusb_streaming_ctrl, 2124 .frontend_attach = cxusb_mt352_frontend_attach, 2125 .tuner_attach = cxusb_dtt7579_tuner_attach, 2126 2127 /* parameter for the MPEG2-data transfer */ 2128 .stream = { 2129 .type = USB_BULK, 2130 .count = 5, 2131 .endpoint = 0x04, 2132 .u = { 2133 .bulk = { 2134 .buffersize = 8192, 2135 } 2136 } 2137 }, 2138 } }, 2139 }, 2140 }, 2141 .power_ctrl = cxusb_bluebird_power_ctrl, 2142 2143 .i2c_algo = &cxusb_i2c_algo, 2144 2145 .rc.core = { 2146 .rc_interval = 100, 2147 .rc_codes = RC_MAP_DVICO_PORTABLE, 2148 .module_name = KBUILD_MODNAME, 2149 .rc_query = cxusb_rc_query, 2150 .allowed_protos = RC_PROTO_BIT_NEC, 2151 }, 2152 2153 .generic_bulk_ctrl_endpoint = 0x01, 2154 2155 .num_device_descs = 1, 2156 .devices = { 2157 { "DViCO FusionHDTV DVB-T USB (TH7579)", 2158 { &cxusb_table[DVICO_BLUEBIRD_TH7579_COLD], NULL }, 2159 { &cxusb_table[DVICO_BLUEBIRD_TH7579_WARM], NULL }, 2160 }, 2161 } 2162 }; 2163 2164 static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = { 2165 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 2166 2167 .usb_ctrl = CYPRESS_FX2, 2168 2169 .size_of_priv = sizeof(struct cxusb_state), 2170 2171 .num_adapters = 1, 2172 .adapter = { 2173 { 2174 .num_frontends = 1, 2175 .fe = {{ 2176 .streaming_ctrl = cxusb_streaming_ctrl, 2177 .frontend_attach = cxusb_dualdig4_frontend_attach, 2178 .tuner_attach = cxusb_dvico_xc3028_tuner_attach, 2179 /* parameter for the MPEG2-data transfer */ 2180 .stream = { 2181 .type = USB_BULK, 2182 .count = 5, 2183 .endpoint = 0x02, 2184 .u = { 2185 .bulk = { 2186 .buffersize = 8192, 2187 } 2188 } 2189 }, 2190 } }, 2191 }, 2192 }, 2193 2194 .power_ctrl = cxusb_power_ctrl, 2195 2196 .i2c_algo = &cxusb_i2c_algo, 2197 2198 .generic_bulk_ctrl_endpoint = 0x01, 2199 2200 .rc.core = { 2201 .rc_interval = 100, 2202 .rc_codes = RC_MAP_DVICO_MCE, 2203 .module_name = KBUILD_MODNAME, 2204 .rc_query = cxusb_bluebird2_rc_query, 2205 .allowed_protos = RC_PROTO_BIT_NEC, 2206 }, 2207 2208 .num_device_descs = 1, 2209 .devices = { 2210 { "DViCO FusionHDTV DVB-T Dual Digital 4", 2211 { NULL }, 2212 { &cxusb_table[DVICO_BLUEBIRD_DUAL_4], NULL }, 2213 }, 2214 } 2215 }; 2216 2217 static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = { 2218 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 2219 2220 .usb_ctrl = CYPRESS_FX2, 2221 .identify_state = bluebird_fx2_identify_state, 2222 2223 .size_of_priv = sizeof(struct cxusb_state), 2224 2225 .num_adapters = 1, 2226 .adapter = { 2227 { 2228 .num_frontends = 1, 2229 .fe = {{ 2230 .streaming_ctrl = cxusb_streaming_ctrl, 2231 .frontend_attach = cxusb_nano2_frontend_attach, 2232 .tuner_attach = cxusb_dvico_xc3028_tuner_attach, 2233 /* parameter for the MPEG2-data transfer */ 2234 .stream = { 2235 .type = USB_BULK, 2236 .count = 5, 2237 .endpoint = 0x02, 2238 .u = { 2239 .bulk = { 2240 .buffersize = 8192, 2241 } 2242 } 2243 }, 2244 } }, 2245 }, 2246 }, 2247 2248 .power_ctrl = cxusb_nano2_power_ctrl, 2249 2250 .i2c_algo = &cxusb_i2c_algo, 2251 2252 .generic_bulk_ctrl_endpoint = 0x01, 2253 2254 .rc.core = { 2255 .rc_interval = 100, 2256 .rc_codes = RC_MAP_DVICO_PORTABLE, 2257 .module_name = KBUILD_MODNAME, 2258 .rc_query = cxusb_bluebird2_rc_query, 2259 .allowed_protos = RC_PROTO_BIT_NEC, 2260 }, 2261 2262 .num_device_descs = 1, 2263 .devices = { 2264 { "DViCO FusionHDTV DVB-T NANO2", 2265 { NULL }, 2266 { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2], NULL }, 2267 }, 2268 } 2269 }; 2270 2271 static struct dvb_usb_device_properties 2272 cxusb_bluebird_nano2_needsfirmware_properties = { 2273 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 2274 2275 .usb_ctrl = DEVICE_SPECIFIC, 2276 .firmware = "dvb-usb-bluebird-02.fw", 2277 .download_firmware = bluebird_patch_dvico_firmware_download, 2278 .identify_state = bluebird_fx2_identify_state, 2279 2280 .size_of_priv = sizeof(struct cxusb_state), 2281 2282 .num_adapters = 1, 2283 .adapter = { 2284 { 2285 .num_frontends = 1, 2286 .fe = {{ 2287 .streaming_ctrl = cxusb_streaming_ctrl, 2288 .frontend_attach = cxusb_nano2_frontend_attach, 2289 .tuner_attach = cxusb_dvico_xc3028_tuner_attach, 2290 /* parameter for the MPEG2-data transfer */ 2291 .stream = { 2292 .type = USB_BULK, 2293 .count = 5, 2294 .endpoint = 0x02, 2295 .u = { 2296 .bulk = { 2297 .buffersize = 8192, 2298 } 2299 } 2300 }, 2301 } }, 2302 }, 2303 }, 2304 2305 .power_ctrl = cxusb_nano2_power_ctrl, 2306 2307 .i2c_algo = &cxusb_i2c_algo, 2308 2309 .generic_bulk_ctrl_endpoint = 0x01, 2310 2311 .rc.core = { 2312 .rc_interval = 100, 2313 .rc_codes = RC_MAP_DVICO_PORTABLE, 2314 .module_name = KBUILD_MODNAME, 2315 .rc_query = cxusb_rc_query, 2316 .allowed_protos = RC_PROTO_BIT_NEC, 2317 }, 2318 2319 .num_device_descs = 1, 2320 .devices = { { 2321 "DViCO FusionHDTV DVB-T NANO2 w/o firmware", 2322 { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2], NULL }, 2323 { &cxusb_table[DVICO_BLUEBIRD_DVB_T_NANO_2_NFW_WARM], 2324 NULL }, 2325 }, 2326 } 2327 }; 2328 2329 static struct dvb_usb_device_properties cxusb_aver_a868r_properties = { 2330 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 2331 2332 .usb_ctrl = CYPRESS_FX2, 2333 2334 .size_of_priv = sizeof(struct cxusb_state), 2335 2336 .num_adapters = 1, 2337 .adapter = { 2338 { 2339 .num_frontends = 1, 2340 .fe = {{ 2341 .streaming_ctrl = cxusb_aver_streaming_ctrl, 2342 .frontend_attach = cxusb_aver_lgdt3303_frontend_attach, 2343 .tuner_attach = cxusb_mxl5003s_tuner_attach, 2344 /* parameter for the MPEG2-data transfer */ 2345 .stream = { 2346 .type = USB_BULK, 2347 .count = 5, 2348 .endpoint = 0x04, 2349 .u = { 2350 .bulk = { 2351 .buffersize = 8192, 2352 } 2353 } 2354 }, 2355 } }, 2356 }, 2357 }, 2358 .power_ctrl = cxusb_aver_power_ctrl, 2359 2360 .i2c_algo = &cxusb_i2c_algo, 2361 2362 .generic_bulk_ctrl_endpoint = 0x01, 2363 2364 .num_device_descs = 1, 2365 .devices = { 2366 { "AVerMedia AVerTVHD Volar (A868R)", 2367 { NULL }, 2368 { &cxusb_table[AVERMEDIA_VOLAR_A868R], NULL }, 2369 }, 2370 } 2371 }; 2372 2373 static 2374 struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = { 2375 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 2376 2377 .usb_ctrl = CYPRESS_FX2, 2378 2379 .size_of_priv = sizeof(struct cxusb_state), 2380 2381 .num_adapters = 1, 2382 .adapter = { 2383 { 2384 .size_of_priv = sizeof(struct dib0700_adapter_state), 2385 .num_frontends = 1, 2386 .fe = {{ 2387 .streaming_ctrl = cxusb_streaming_ctrl, 2388 .frontend_attach = cxusb_dualdig4_rev2_frontend_attach, 2389 .tuner_attach = cxusb_dualdig4_rev2_tuner_attach, 2390 /* parameter for the MPEG2-data transfer */ 2391 .stream = { 2392 .type = USB_BULK, 2393 .count = 7, 2394 .endpoint = 0x02, 2395 .u = { 2396 .bulk = { 2397 .buffersize = 4096, 2398 } 2399 } 2400 }, 2401 } }, 2402 }, 2403 }, 2404 2405 .power_ctrl = cxusb_bluebird_power_ctrl, 2406 2407 .i2c_algo = &cxusb_i2c_algo, 2408 2409 .generic_bulk_ctrl_endpoint = 0x01, 2410 2411 .rc.core = { 2412 .rc_interval = 100, 2413 .rc_codes = RC_MAP_DVICO_MCE, 2414 .module_name = KBUILD_MODNAME, 2415 .rc_query = cxusb_rc_query, 2416 .allowed_protos = RC_PROTO_BIT_NEC, 2417 }, 2418 2419 .num_device_descs = 1, 2420 .devices = { 2421 { "DViCO FusionHDTV DVB-T Dual Digital 4 (rev 2)", 2422 { NULL }, 2423 { &cxusb_table[DVICO_BLUEBIRD_DUAL_4_REV_2], NULL }, 2424 }, 2425 } 2426 }; 2427 2428 static struct dvb_usb_device_properties cxusb_d680_dmb_properties = { 2429 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 2430 2431 .usb_ctrl = CYPRESS_FX2, 2432 2433 .size_of_priv = sizeof(struct cxusb_state), 2434 2435 .num_adapters = 1, 2436 .adapter = { 2437 { 2438 .num_frontends = 1, 2439 .fe = {{ 2440 .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl, 2441 .frontend_attach = cxusb_d680_dmb_frontend_attach, 2442 .tuner_attach = cxusb_d680_dmb_tuner_attach, 2443 2444 /* parameter for the MPEG2-data transfer */ 2445 .stream = { 2446 .type = USB_BULK, 2447 .count = 5, 2448 .endpoint = 0x02, 2449 .u = { 2450 .bulk = { 2451 .buffersize = 8192, 2452 } 2453 } 2454 }, 2455 } }, 2456 }, 2457 }, 2458 2459 .power_ctrl = cxusb_d680_dmb_power_ctrl, 2460 2461 .i2c_algo = &cxusb_i2c_algo, 2462 2463 .generic_bulk_ctrl_endpoint = 0x01, 2464 2465 .rc.core = { 2466 .rc_interval = 100, 2467 .rc_codes = RC_MAP_TOTAL_MEDIA_IN_HAND_02, 2468 .module_name = KBUILD_MODNAME, 2469 .rc_query = cxusb_d680_dmb_rc_query, 2470 .allowed_protos = RC_PROTO_BIT_UNKNOWN, 2471 }, 2472 2473 .num_device_descs = 1, 2474 .devices = { 2475 { 2476 "Conexant DMB-TH Stick", 2477 { NULL }, 2478 { &cxusb_table[CONEXANT_D680_DMB], NULL }, 2479 }, 2480 } 2481 }; 2482 2483 static struct dvb_usb_device_properties cxusb_mygica_d689_properties = { 2484 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 2485 2486 .usb_ctrl = CYPRESS_FX2, 2487 2488 .size_of_priv = sizeof(struct cxusb_state), 2489 2490 .num_adapters = 1, 2491 .adapter = { 2492 { 2493 .num_frontends = 1, 2494 .fe = {{ 2495 .streaming_ctrl = cxusb_d680_dmb_streaming_ctrl, 2496 .frontend_attach = cxusb_mygica_d689_frontend_attach, 2497 .tuner_attach = cxusb_mygica_d689_tuner_attach, 2498 2499 /* parameter for the MPEG2-data transfer */ 2500 .stream = { 2501 .type = USB_BULK, 2502 .count = 5, 2503 .endpoint = 0x02, 2504 .u = { 2505 .bulk = { 2506 .buffersize = 8192, 2507 } 2508 } 2509 }, 2510 } }, 2511 }, 2512 }, 2513 2514 .power_ctrl = cxusb_d680_dmb_power_ctrl, 2515 2516 .i2c_algo = &cxusb_i2c_algo, 2517 2518 .generic_bulk_ctrl_endpoint = 0x01, 2519 2520 .rc.core = { 2521 .rc_interval = 100, 2522 .rc_codes = RC_MAP_D680_DMB, 2523 .module_name = KBUILD_MODNAME, 2524 .rc_query = cxusb_d680_dmb_rc_query, 2525 .allowed_protos = RC_PROTO_BIT_UNKNOWN, 2526 }, 2527 2528 .num_device_descs = 1, 2529 .devices = { 2530 { 2531 "Mygica D689 DMB-TH", 2532 { NULL }, 2533 { &cxusb_table[MYGICA_D689], NULL }, 2534 }, 2535 } 2536 }; 2537 2538 static struct dvb_usb_device_properties cxusb_mygica_t230_properties = { 2539 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 2540 2541 .usb_ctrl = CYPRESS_FX2, 2542 2543 .size_of_priv = sizeof(struct cxusb_state), 2544 2545 .num_adapters = 1, 2546 .adapter = { 2547 { 2548 .num_frontends = 1, 2549 .fe = {{ 2550 .streaming_ctrl = cxusb_streaming_ctrl, 2551 .frontend_attach = cxusb_mygica_t230_frontend_attach, 2552 2553 /* parameter for the MPEG2-data transfer */ 2554 .stream = { 2555 .type = USB_BULK, 2556 .count = 5, 2557 .endpoint = 0x02, 2558 .u = { 2559 .bulk = { 2560 .buffersize = 8192, 2561 } 2562 } 2563 }, 2564 } }, 2565 }, 2566 }, 2567 2568 .power_ctrl = cxusb_d680_dmb_power_ctrl, 2569 2570 .i2c_algo = &cxusb_i2c_algo, 2571 2572 .generic_bulk_ctrl_endpoint = 0x01, 2573 2574 .rc.core = { 2575 .rc_interval = 100, 2576 .rc_codes = RC_MAP_D680_DMB, 2577 .module_name = KBUILD_MODNAME, 2578 .rc_query = cxusb_d680_dmb_rc_query, 2579 .allowed_protos = RC_PROTO_BIT_UNKNOWN, 2580 }, 2581 2582 .num_device_descs = 1, 2583 .devices = { 2584 { 2585 "Mygica T230 DVB-T/T2/C", 2586 { NULL }, 2587 { &cxusb_table[MYGICA_T230], NULL }, 2588 }, 2589 } 2590 }; 2591 2592 static struct usb_driver cxusb_driver = { 2593 .name = "dvb_usb_cxusb", 2594 .probe = cxusb_probe, 2595 .disconnect = cxusb_disconnect, 2596 .id_table = cxusb_table, 2597 }; 2598 2599 module_usb_driver(cxusb_driver); 2600 2601 MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@posteo.de>"); 2602 MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>"); 2603 MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); 2604 MODULE_AUTHOR("Maciej S. Szmigiero <mail@maciej.szmigiero.name>"); 2605 MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design"); 2606 MODULE_LICENSE("GPL"); 2607