1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * Driver for DVBSky USB2.0 receiver 4 * 5 * Copyright (C) 2013 Max nibble <nibble.max@gmail.com> 6 */ 7 8 #include "dvb_usb.h" 9 #include "m88ds3103.h" 10 #include "ts2020.h" 11 #include "sp2.h" 12 #include "si2168.h" 13 #include "si2157.h" 14 15 #define DVBSKY_MSG_DELAY 0/*2000*/ 16 #define DVBSKY_BUF_LEN 64 17 18 static int dvb_usb_dvbsky_disable_rc; 19 module_param_named(disable_rc, dvb_usb_dvbsky_disable_rc, int, 0644); 20 MODULE_PARM_DESC(disable_rc, "Disable inbuilt IR receiver."); 21 22 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 23 24 struct dvbsky_state { 25 struct mutex stream_mutex; 26 u8 ibuf[DVBSKY_BUF_LEN]; 27 u8 obuf[DVBSKY_BUF_LEN]; 28 u8 last_lock; 29 struct i2c_client *i2c_client_demod; 30 struct i2c_client *i2c_client_tuner; 31 struct i2c_client *i2c_client_ci; 32 33 /* fe hook functions*/ 34 int (*fe_set_voltage)(struct dvb_frontend *fe, 35 enum fe_sec_voltage voltage); 36 int (*fe_read_status)(struct dvb_frontend *fe, 37 enum fe_status *status); 38 }; 39 40 static int dvbsky_usb_generic_rw(struct dvb_usb_device *d, 41 u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) 42 { 43 int ret; 44 struct dvbsky_state *state = d_to_priv(d); 45 46 mutex_lock(&d->usb_mutex); 47 if (wlen != 0) 48 memcpy(state->obuf, wbuf, wlen); 49 50 ret = dvb_usbv2_generic_rw_locked(d, state->obuf, wlen, 51 state->ibuf, rlen); 52 53 if (!ret && (rlen != 0)) 54 memcpy(rbuf, state->ibuf, rlen); 55 56 mutex_unlock(&d->usb_mutex); 57 return ret; 58 } 59 60 static int dvbsky_stream_ctrl(struct dvb_usb_device *d, u8 onoff) 61 { 62 struct dvbsky_state *state = d_to_priv(d); 63 int ret; 64 u8 obuf_pre[3] = { 0x37, 0, 0 }; 65 u8 obuf_post[3] = { 0x36, 3, 0 }; 66 67 mutex_lock(&state->stream_mutex); 68 ret = dvbsky_usb_generic_rw(d, obuf_pre, 3, NULL, 0); 69 if (!ret && onoff) { 70 msleep(20); 71 ret = dvbsky_usb_generic_rw(d, obuf_post, 3, NULL, 0); 72 } 73 mutex_unlock(&state->stream_mutex); 74 return ret; 75 } 76 77 static int dvbsky_streaming_ctrl(struct dvb_frontend *fe, int onoff) 78 { 79 struct dvb_usb_device *d = fe_to_d(fe); 80 81 return dvbsky_stream_ctrl(d, (onoff == 0) ? 0 : 1); 82 } 83 84 /* GPIO */ 85 static int dvbsky_gpio_ctrl(struct dvb_usb_device *d, u8 gport, u8 value) 86 { 87 int ret; 88 u8 obuf[3], ibuf[2]; 89 90 obuf[0] = 0x0e; 91 obuf[1] = gport; 92 obuf[2] = value; 93 ret = dvbsky_usb_generic_rw(d, obuf, 3, ibuf, 1); 94 return ret; 95 } 96 97 /* I2C */ 98 static int dvbsky_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], 99 int num) 100 { 101 struct dvb_usb_device *d = i2c_get_adapdata(adap); 102 int ret = 0; 103 u8 ibuf[64], obuf[64]; 104 105 if (mutex_lock_interruptible(&d->i2c_mutex) < 0) 106 return -EAGAIN; 107 108 if (num > 2) { 109 dev_err(&d->udev->dev, 110 "too many i2c messages[%d], max 2.", num); 111 ret = -EOPNOTSUPP; 112 goto i2c_error; 113 } 114 115 if (num == 1) { 116 if (msg[0].len > 60) { 117 dev_err(&d->udev->dev, 118 "too many i2c bytes[%d], max 60.", 119 msg[0].len); 120 ret = -EOPNOTSUPP; 121 goto i2c_error; 122 } 123 if (msg[0].flags & I2C_M_RD) { 124 /* single read */ 125 obuf[0] = 0x09; 126 obuf[1] = 0; 127 obuf[2] = msg[0].len; 128 obuf[3] = msg[0].addr; 129 ret = dvbsky_usb_generic_rw(d, obuf, 4, 130 ibuf, msg[0].len + 1); 131 if (!ret) 132 memcpy(msg[0].buf, &ibuf[1], msg[0].len); 133 } else { 134 /* write */ 135 obuf[0] = 0x08; 136 obuf[1] = msg[0].addr; 137 obuf[2] = msg[0].len; 138 memcpy(&obuf[3], msg[0].buf, msg[0].len); 139 ret = dvbsky_usb_generic_rw(d, obuf, 140 msg[0].len + 3, ibuf, 1); 141 } 142 } else { 143 if ((msg[0].len > 60) || (msg[1].len > 60)) { 144 dev_err(&d->udev->dev, 145 "too many i2c bytes[w-%d][r-%d], max 60.", 146 msg[0].len, msg[1].len); 147 ret = -EOPNOTSUPP; 148 goto i2c_error; 149 } 150 /* write then read */ 151 obuf[0] = 0x09; 152 obuf[1] = msg[0].len; 153 obuf[2] = msg[1].len; 154 obuf[3] = msg[0].addr; 155 memcpy(&obuf[4], msg[0].buf, msg[0].len); 156 ret = dvbsky_usb_generic_rw(d, obuf, 157 msg[0].len + 4, ibuf, msg[1].len + 1); 158 if (!ret) 159 memcpy(msg[1].buf, &ibuf[1], msg[1].len); 160 } 161 i2c_error: 162 mutex_unlock(&d->i2c_mutex); 163 return (ret) ? ret : num; 164 } 165 166 static u32 dvbsky_i2c_func(struct i2c_adapter *adapter) 167 { 168 return I2C_FUNC_I2C; 169 } 170 171 static struct i2c_algorithm dvbsky_i2c_algo = { 172 .master_xfer = dvbsky_i2c_xfer, 173 .functionality = dvbsky_i2c_func, 174 }; 175 176 #if IS_ENABLED(CONFIG_RC_CORE) 177 static int dvbsky_rc_query(struct dvb_usb_device *d) 178 { 179 u32 code = 0xffff, scancode; 180 u8 rc5_command, rc5_system; 181 u8 obuf[2], ibuf[2], toggle; 182 int ret; 183 184 obuf[0] = 0x10; 185 ret = dvbsky_usb_generic_rw(d, obuf, 1, ibuf, 2); 186 if (ret == 0) 187 code = (ibuf[0] << 8) | ibuf[1]; 188 if (code != 0xffff) { 189 dev_dbg(&d->udev->dev, "rc code: %x\n", code); 190 rc5_command = code & 0x3F; 191 rc5_system = (code & 0x7C0) >> 6; 192 toggle = (code & 0x800) ? 1 : 0; 193 scancode = rc5_system << 8 | rc5_command; 194 rc_keydown(d->rc_dev, RC_PROTO_RC5, scancode, toggle); 195 } 196 return 0; 197 } 198 199 static int dvbsky_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) 200 { 201 if (dvb_usb_dvbsky_disable_rc) { 202 rc->map_name = NULL; 203 return 0; 204 } 205 206 rc->allowed_protos = RC_PROTO_BIT_RC5; 207 rc->query = dvbsky_rc_query; 208 rc->interval = 300; 209 return 0; 210 } 211 #else 212 #define dvbsky_get_rc_config NULL 213 #endif 214 215 static int dvbsky_usb_set_voltage(struct dvb_frontend *fe, 216 enum fe_sec_voltage voltage) 217 { 218 struct dvb_usb_device *d = fe_to_d(fe); 219 struct dvbsky_state *state = d_to_priv(d); 220 u8 value; 221 222 if (voltage == SEC_VOLTAGE_OFF) 223 value = 0; 224 else 225 value = 1; 226 dvbsky_gpio_ctrl(d, 0x80, value); 227 228 return state->fe_set_voltage(fe, voltage); 229 } 230 231 static int dvbsky_read_mac_addr(struct dvb_usb_adapter *adap, u8 mac[6]) 232 { 233 struct dvb_usb_device *d = adap_to_d(adap); 234 u8 obuf[] = { 0x1e, 0x00 }; 235 u8 ibuf[6] = { 0 }; 236 struct i2c_msg msg[] = { 237 { 238 .addr = 0x51, 239 .flags = 0, 240 .buf = obuf, 241 .len = 2, 242 }, { 243 .addr = 0x51, 244 .flags = I2C_M_RD, 245 .buf = ibuf, 246 .len = 6, 247 } 248 }; 249 250 if (i2c_transfer(&d->i2c_adap, msg, 2) == 2) 251 memcpy(mac, ibuf, 6); 252 253 return 0; 254 } 255 256 static int dvbsky_usb_read_status(struct dvb_frontend *fe, 257 enum fe_status *status) 258 { 259 struct dvb_usb_device *d = fe_to_d(fe); 260 struct dvbsky_state *state = d_to_priv(d); 261 int ret; 262 263 ret = state->fe_read_status(fe, status); 264 265 /* it need resync slave fifo when signal change from unlock to lock.*/ 266 if ((*status & FE_HAS_LOCK) && (!state->last_lock)) 267 dvbsky_stream_ctrl(d, 1); 268 269 state->last_lock = (*status & FE_HAS_LOCK) ? 1 : 0; 270 return ret; 271 } 272 273 static int dvbsky_s960_attach(struct dvb_usb_adapter *adap) 274 { 275 struct dvbsky_state *state = adap_to_priv(adap); 276 struct dvb_usb_device *d = adap_to_d(adap); 277 struct i2c_adapter *i2c_adapter; 278 struct m88ds3103_platform_data m88ds3103_pdata = {}; 279 struct ts2020_config ts2020_config = {}; 280 281 /* attach demod */ 282 m88ds3103_pdata.clk = 27000000; 283 m88ds3103_pdata.i2c_wr_max = 33; 284 m88ds3103_pdata.clk_out = 0; 285 m88ds3103_pdata.ts_mode = M88DS3103_TS_CI; 286 m88ds3103_pdata.ts_clk = 16000; 287 m88ds3103_pdata.ts_clk_pol = 0; 288 m88ds3103_pdata.agc = 0x99; 289 m88ds3103_pdata.lnb_hv_pol = 1, 290 m88ds3103_pdata.lnb_en_pol = 1, 291 292 state->i2c_client_demod = dvb_module_probe("m88ds3103", NULL, 293 &d->i2c_adap, 294 0x68, &m88ds3103_pdata); 295 if (!state->i2c_client_demod) 296 return -ENODEV; 297 298 adap->fe[0] = m88ds3103_pdata.get_dvb_frontend(state->i2c_client_demod); 299 i2c_adapter = m88ds3103_pdata.get_i2c_adapter(state->i2c_client_demod); 300 301 /* attach tuner */ 302 ts2020_config.fe = adap->fe[0]; 303 ts2020_config.get_agc_pwm = m88ds3103_get_agc_pwm; 304 305 state->i2c_client_tuner = dvb_module_probe("ts2020", NULL, 306 i2c_adapter, 307 0x60, &ts2020_config); 308 if (!state->i2c_client_tuner) { 309 dvb_module_release(state->i2c_client_demod); 310 return -ENODEV; 311 } 312 313 /* delegate signal strength measurement to tuner */ 314 adap->fe[0]->ops.read_signal_strength = 315 adap->fe[0]->ops.tuner_ops.get_rf_strength; 316 317 /* hook fe: need to resync the slave fifo when signal locks. */ 318 state->fe_read_status = adap->fe[0]->ops.read_status; 319 adap->fe[0]->ops.read_status = dvbsky_usb_read_status; 320 321 /* hook fe: LNB off/on is control by Cypress usb chip. */ 322 state->fe_set_voltage = adap->fe[0]->ops.set_voltage; 323 adap->fe[0]->ops.set_voltage = dvbsky_usb_set_voltage; 324 325 return 0; 326 } 327 328 static int dvbsky_usb_ci_set_voltage(struct dvb_frontend *fe, 329 enum fe_sec_voltage voltage) 330 { 331 struct dvb_usb_device *d = fe_to_d(fe); 332 struct dvbsky_state *state = d_to_priv(d); 333 u8 value; 334 335 if (voltage == SEC_VOLTAGE_OFF) 336 value = 0; 337 else 338 value = 1; 339 dvbsky_gpio_ctrl(d, 0x00, value); 340 341 return state->fe_set_voltage(fe, voltage); 342 } 343 344 static int dvbsky_ci_ctrl(void *priv, u8 read, int addr, 345 u8 data, int *mem) 346 { 347 struct dvb_usb_device *d = priv; 348 int ret = 0; 349 u8 command[4], respond[2], command_size, respond_size; 350 351 command[1] = (u8)((addr >> 8) & 0xff); /*high part of address*/ 352 command[2] = (u8)(addr & 0xff); /*low part of address*/ 353 if (read) { 354 command[0] = 0x71; 355 command_size = 3; 356 respond_size = 2; 357 } else { 358 command[0] = 0x70; 359 command[3] = data; 360 command_size = 4; 361 respond_size = 1; 362 } 363 ret = dvbsky_usb_generic_rw(d, command, command_size, 364 respond, respond_size); 365 if (ret) 366 goto err; 367 if (read) 368 *mem = respond[1]; 369 return ret; 370 err: 371 dev_err(&d->udev->dev, "ci control failed=%d\n", ret); 372 return ret; 373 } 374 375 static int dvbsky_s960c_attach(struct dvb_usb_adapter *adap) 376 { 377 struct dvbsky_state *state = adap_to_priv(adap); 378 struct dvb_usb_device *d = adap_to_d(adap); 379 struct i2c_adapter *i2c_adapter; 380 struct m88ds3103_platform_data m88ds3103_pdata = {}; 381 struct ts2020_config ts2020_config = {}; 382 struct sp2_config sp2_config = {}; 383 384 /* attach demod */ 385 m88ds3103_pdata.clk = 27000000, 386 m88ds3103_pdata.i2c_wr_max = 33, 387 m88ds3103_pdata.clk_out = 0, 388 m88ds3103_pdata.ts_mode = M88DS3103_TS_CI, 389 m88ds3103_pdata.ts_clk = 10000, 390 m88ds3103_pdata.ts_clk_pol = 1, 391 m88ds3103_pdata.agc = 0x99, 392 m88ds3103_pdata.lnb_hv_pol = 0, 393 m88ds3103_pdata.lnb_en_pol = 1, 394 395 state->i2c_client_demod = dvb_module_probe("m88ds3103", NULL, 396 &d->i2c_adap, 397 0x68, &m88ds3103_pdata); 398 if (!state->i2c_client_demod) 399 return -ENODEV; 400 401 adap->fe[0] = m88ds3103_pdata.get_dvb_frontend(state->i2c_client_demod); 402 i2c_adapter = m88ds3103_pdata.get_i2c_adapter(state->i2c_client_demod); 403 404 /* attach tuner */ 405 ts2020_config.fe = adap->fe[0]; 406 ts2020_config.get_agc_pwm = m88ds3103_get_agc_pwm; 407 408 state->i2c_client_tuner = dvb_module_probe("ts2020", NULL, 409 i2c_adapter, 410 0x60, &ts2020_config); 411 if (!state->i2c_client_tuner) { 412 dvb_module_release(state->i2c_client_demod); 413 return -ENODEV; 414 } 415 416 /* attach ci controller */ 417 sp2_config.dvb_adap = &adap->dvb_adap; 418 sp2_config.priv = d; 419 sp2_config.ci_control = dvbsky_ci_ctrl; 420 421 state->i2c_client_ci = dvb_module_probe("sp2", NULL, 422 &d->i2c_adap, 423 0x40, &sp2_config); 424 425 if (!state->i2c_client_ci) { 426 dvb_module_release(state->i2c_client_tuner); 427 dvb_module_release(state->i2c_client_demod); 428 return -ENODEV; 429 } 430 431 /* delegate signal strength measurement to tuner */ 432 adap->fe[0]->ops.read_signal_strength = 433 adap->fe[0]->ops.tuner_ops.get_rf_strength; 434 435 /* hook fe: need to resync the slave fifo when signal locks. */ 436 state->fe_read_status = adap->fe[0]->ops.read_status; 437 adap->fe[0]->ops.read_status = dvbsky_usb_read_status; 438 439 /* hook fe: LNB off/on is control by Cypress usb chip. */ 440 state->fe_set_voltage = adap->fe[0]->ops.set_voltage; 441 adap->fe[0]->ops.set_voltage = dvbsky_usb_ci_set_voltage; 442 443 return 0; 444 } 445 446 static int dvbsky_t680c_attach(struct dvb_usb_adapter *adap) 447 { 448 struct dvbsky_state *state = adap_to_priv(adap); 449 struct dvb_usb_device *d = adap_to_d(adap); 450 struct i2c_adapter *i2c_adapter; 451 struct si2168_config si2168_config = {}; 452 struct si2157_config si2157_config = {}; 453 struct sp2_config sp2_config = {}; 454 455 /* attach demod */ 456 si2168_config.i2c_adapter = &i2c_adapter; 457 si2168_config.fe = &adap->fe[0]; 458 si2168_config.ts_mode = SI2168_TS_PARALLEL; 459 460 state->i2c_client_demod = dvb_module_probe("si2168", NULL, 461 &d->i2c_adap, 462 0x64, &si2168_config); 463 if (!state->i2c_client_demod) 464 return -ENODEV; 465 466 /* attach tuner */ 467 si2157_config.fe = adap->fe[0]; 468 si2157_config.if_port = 1; 469 470 state->i2c_client_tuner = dvb_module_probe("si2157", NULL, 471 i2c_adapter, 472 0x60, &si2157_config); 473 if (!state->i2c_client_tuner) { 474 dvb_module_release(state->i2c_client_demod); 475 return -ENODEV; 476 } 477 478 /* attach ci controller */ 479 sp2_config.dvb_adap = &adap->dvb_adap; 480 sp2_config.priv = d; 481 sp2_config.ci_control = dvbsky_ci_ctrl; 482 483 state->i2c_client_ci = dvb_module_probe("sp2", NULL, 484 &d->i2c_adap, 485 0x40, &sp2_config); 486 487 if (!state->i2c_client_ci) { 488 dvb_module_release(state->i2c_client_tuner); 489 dvb_module_release(state->i2c_client_demod); 490 return -ENODEV; 491 } 492 493 return 0; 494 } 495 496 static int dvbsky_t330_attach(struct dvb_usb_adapter *adap) 497 { 498 struct dvbsky_state *state = adap_to_priv(adap); 499 struct dvb_usb_device *d = adap_to_d(adap); 500 struct i2c_adapter *i2c_adapter; 501 struct si2168_config si2168_config = {}; 502 struct si2157_config si2157_config = {}; 503 504 /* attach demod */ 505 si2168_config.i2c_adapter = &i2c_adapter; 506 si2168_config.fe = &adap->fe[0]; 507 si2168_config.ts_mode = SI2168_TS_PARALLEL; 508 si2168_config.ts_clock_gapped = true; 509 510 state->i2c_client_demod = dvb_module_probe("si2168", NULL, 511 &d->i2c_adap, 512 0x64, &si2168_config); 513 if (!state->i2c_client_demod) 514 return -ENODEV; 515 516 /* attach tuner */ 517 si2157_config.fe = adap->fe[0]; 518 si2157_config.if_port = 1; 519 520 state->i2c_client_tuner = dvb_module_probe("si2157", NULL, 521 i2c_adapter, 522 0x60, &si2157_config); 523 if (!state->i2c_client_tuner) { 524 dvb_module_release(state->i2c_client_demod); 525 return -ENODEV; 526 } 527 528 return 0; 529 } 530 531 static int dvbsky_mygica_t230c_attach(struct dvb_usb_adapter *adap) 532 { 533 struct dvbsky_state *state = adap_to_priv(adap); 534 struct dvb_usb_device *d = adap_to_d(adap); 535 struct i2c_adapter *i2c_adapter; 536 struct si2168_config si2168_config = {}; 537 struct si2157_config si2157_config = {}; 538 539 /* attach demod */ 540 si2168_config.i2c_adapter = &i2c_adapter; 541 si2168_config.fe = &adap->fe[0]; 542 si2168_config.ts_mode = SI2168_TS_PARALLEL; 543 si2168_config.ts_clock_inv = 1; 544 545 state->i2c_client_demod = dvb_module_probe("si2168", NULL, 546 &d->i2c_adap, 547 0x64, &si2168_config); 548 if (!state->i2c_client_demod) 549 return -ENODEV; 550 551 /* attach tuner */ 552 si2157_config.fe = adap->fe[0]; 553 si2157_config.if_port = 0; 554 555 state->i2c_client_tuner = dvb_module_probe("si2157", "si2141", 556 i2c_adapter, 557 0x60, &si2157_config); 558 if (!state->i2c_client_tuner) { 559 dvb_module_release(state->i2c_client_demod); 560 return -ENODEV; 561 } 562 563 return 0; 564 } 565 566 567 static int dvbsky_identify_state(struct dvb_usb_device *d, const char **name) 568 { 569 dvbsky_gpio_ctrl(d, 0x04, 1); 570 msleep(20); 571 dvbsky_gpio_ctrl(d, 0x83, 0); 572 dvbsky_gpio_ctrl(d, 0xc0, 1); 573 msleep(100); 574 dvbsky_gpio_ctrl(d, 0x83, 1); 575 dvbsky_gpio_ctrl(d, 0xc0, 0); 576 msleep(50); 577 578 return WARM; 579 } 580 581 static int dvbsky_init(struct dvb_usb_device *d) 582 { 583 struct dvbsky_state *state = d_to_priv(d); 584 585 /* use default interface */ 586 /* 587 ret = usb_set_interface(d->udev, 0, 0); 588 if (ret) 589 return ret; 590 */ 591 mutex_init(&state->stream_mutex); 592 593 state->last_lock = 0; 594 595 return 0; 596 } 597 598 static int dvbsky_frontend_detach(struct dvb_usb_adapter *adap) 599 { 600 struct dvb_usb_device *d = adap_to_d(adap); 601 struct dvbsky_state *state = d_to_priv(d); 602 603 dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, adap->id); 604 605 dvb_module_release(state->i2c_client_tuner); 606 dvb_module_release(state->i2c_client_demod); 607 dvb_module_release(state->i2c_client_ci); 608 609 return 0; 610 } 611 612 /* DVB USB Driver stuff */ 613 static struct dvb_usb_device_properties dvbsky_s960_props = { 614 .driver_name = KBUILD_MODNAME, 615 .owner = THIS_MODULE, 616 .adapter_nr = adapter_nr, 617 .size_of_priv = sizeof(struct dvbsky_state), 618 619 .generic_bulk_ctrl_endpoint = 0x01, 620 .generic_bulk_ctrl_endpoint_response = 0x81, 621 .generic_bulk_ctrl_delay = DVBSKY_MSG_DELAY, 622 623 .i2c_algo = &dvbsky_i2c_algo, 624 .frontend_attach = dvbsky_s960_attach, 625 .frontend_detach = dvbsky_frontend_detach, 626 .init = dvbsky_init, 627 .get_rc_config = dvbsky_get_rc_config, 628 .streaming_ctrl = dvbsky_streaming_ctrl, 629 .identify_state = dvbsky_identify_state, 630 .read_mac_address = dvbsky_read_mac_addr, 631 632 .num_adapters = 1, 633 .adapter = { 634 { 635 .stream = DVB_USB_STREAM_BULK(0x82, 8, 4096), 636 } 637 } 638 }; 639 640 static struct dvb_usb_device_properties dvbsky_s960c_props = { 641 .driver_name = KBUILD_MODNAME, 642 .owner = THIS_MODULE, 643 .adapter_nr = adapter_nr, 644 .size_of_priv = sizeof(struct dvbsky_state), 645 646 .generic_bulk_ctrl_endpoint = 0x01, 647 .generic_bulk_ctrl_endpoint_response = 0x81, 648 .generic_bulk_ctrl_delay = DVBSKY_MSG_DELAY, 649 650 .i2c_algo = &dvbsky_i2c_algo, 651 .frontend_attach = dvbsky_s960c_attach, 652 .frontend_detach = dvbsky_frontend_detach, 653 .init = dvbsky_init, 654 .get_rc_config = dvbsky_get_rc_config, 655 .streaming_ctrl = dvbsky_streaming_ctrl, 656 .identify_state = dvbsky_identify_state, 657 .read_mac_address = dvbsky_read_mac_addr, 658 659 .num_adapters = 1, 660 .adapter = { 661 { 662 .stream = DVB_USB_STREAM_BULK(0x82, 8, 4096), 663 } 664 } 665 }; 666 667 static struct dvb_usb_device_properties dvbsky_t680c_props = { 668 .driver_name = KBUILD_MODNAME, 669 .owner = THIS_MODULE, 670 .adapter_nr = adapter_nr, 671 .size_of_priv = sizeof(struct dvbsky_state), 672 673 .generic_bulk_ctrl_endpoint = 0x01, 674 .generic_bulk_ctrl_endpoint_response = 0x81, 675 .generic_bulk_ctrl_delay = DVBSKY_MSG_DELAY, 676 677 .i2c_algo = &dvbsky_i2c_algo, 678 .frontend_attach = dvbsky_t680c_attach, 679 .frontend_detach = dvbsky_frontend_detach, 680 .init = dvbsky_init, 681 .get_rc_config = dvbsky_get_rc_config, 682 .streaming_ctrl = dvbsky_streaming_ctrl, 683 .identify_state = dvbsky_identify_state, 684 .read_mac_address = dvbsky_read_mac_addr, 685 686 .num_adapters = 1, 687 .adapter = { 688 { 689 .stream = DVB_USB_STREAM_BULK(0x82, 8, 4096), 690 } 691 } 692 }; 693 694 static struct dvb_usb_device_properties dvbsky_t330_props = { 695 .driver_name = KBUILD_MODNAME, 696 .owner = THIS_MODULE, 697 .adapter_nr = adapter_nr, 698 .size_of_priv = sizeof(struct dvbsky_state), 699 700 .generic_bulk_ctrl_endpoint = 0x01, 701 .generic_bulk_ctrl_endpoint_response = 0x81, 702 .generic_bulk_ctrl_delay = DVBSKY_MSG_DELAY, 703 704 .i2c_algo = &dvbsky_i2c_algo, 705 .frontend_attach = dvbsky_t330_attach, 706 .frontend_detach = dvbsky_frontend_detach, 707 .init = dvbsky_init, 708 .get_rc_config = dvbsky_get_rc_config, 709 .streaming_ctrl = dvbsky_streaming_ctrl, 710 .identify_state = dvbsky_identify_state, 711 .read_mac_address = dvbsky_read_mac_addr, 712 713 .num_adapters = 1, 714 .adapter = { 715 { 716 .stream = DVB_USB_STREAM_BULK(0x82, 8, 4096), 717 } 718 } 719 }; 720 721 static struct dvb_usb_device_properties mygica_t230c_props = { 722 .driver_name = KBUILD_MODNAME, 723 .owner = THIS_MODULE, 724 .adapter_nr = adapter_nr, 725 .size_of_priv = sizeof(struct dvbsky_state), 726 727 .generic_bulk_ctrl_endpoint = 0x01, 728 .generic_bulk_ctrl_endpoint_response = 0x81, 729 .generic_bulk_ctrl_delay = DVBSKY_MSG_DELAY, 730 731 .i2c_algo = &dvbsky_i2c_algo, 732 .frontend_attach = dvbsky_mygica_t230c_attach, 733 .frontend_detach = dvbsky_frontend_detach, 734 .init = dvbsky_init, 735 .get_rc_config = dvbsky_get_rc_config, 736 .streaming_ctrl = dvbsky_streaming_ctrl, 737 .identify_state = dvbsky_identify_state, 738 739 .num_adapters = 1, 740 .adapter = { 741 { 742 .stream = DVB_USB_STREAM_BULK(0x82, 8, 4096), 743 } 744 } 745 }; 746 747 static const struct usb_device_id dvbsky_id_table[] = { 748 { DVB_USB_DEVICE(0x0572, 0x6831, 749 &dvbsky_s960_props, "DVBSky S960/S860", RC_MAP_DVBSKY) }, 750 { DVB_USB_DEVICE(0x0572, 0x960c, 751 &dvbsky_s960c_props, "DVBSky S960CI", RC_MAP_DVBSKY) }, 752 { DVB_USB_DEVICE(0x0572, 0x680c, 753 &dvbsky_t680c_props, "DVBSky T680CI", RC_MAP_DVBSKY) }, 754 { DVB_USB_DEVICE(0x0572, 0x0320, 755 &dvbsky_t330_props, "DVBSky T330", RC_MAP_DVBSKY) }, 756 { DVB_USB_DEVICE(USB_VID_TECHNOTREND, 757 USB_PID_TECHNOTREND_TVSTICK_CT2_4400, 758 &dvbsky_t330_props, "TechnoTrend TVStick CT2-4400", 759 RC_MAP_TT_1500) }, 760 { DVB_USB_DEVICE(USB_VID_TECHNOTREND, 761 USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI, 762 &dvbsky_t680c_props, "TechnoTrend TT-connect CT2-4650 CI", 763 RC_MAP_TT_1500) }, 764 { DVB_USB_DEVICE(USB_VID_TECHNOTREND, 765 USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI_2, 766 &dvbsky_t680c_props, "TechnoTrend TT-connect CT2-4650 CI v1.1", 767 RC_MAP_TT_1500) }, 768 { DVB_USB_DEVICE(USB_VID_TECHNOTREND, 769 USB_PID_TECHNOTREND_CONNECT_S2_4650_CI, 770 &dvbsky_s960c_props, "TechnoTrend TT-connect S2-4650 CI", 771 RC_MAP_TT_1500) }, 772 { DVB_USB_DEVICE(USB_VID_TERRATEC, 773 USB_PID_TERRATEC_H7_3, 774 &dvbsky_t680c_props, "Terratec H7 Rev.4", 775 RC_MAP_TT_1500) }, 776 { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_S2_R4, 777 &dvbsky_s960_props, "Terratec Cinergy S2 Rev.4", 778 RC_MAP_DVBSKY) }, 779 { DVB_USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230C, 780 &mygica_t230c_props, "MyGica Mini DVB-T2 USB Stick T230C", 781 RC_MAP_TOTAL_MEDIA_IN_HAND_02) }, 782 { } 783 }; 784 MODULE_DEVICE_TABLE(usb, dvbsky_id_table); 785 786 static struct usb_driver dvbsky_usb_driver = { 787 .name = KBUILD_MODNAME, 788 .id_table = dvbsky_id_table, 789 .probe = dvb_usbv2_probe, 790 .disconnect = dvb_usbv2_disconnect, 791 .suspend = dvb_usbv2_suspend, 792 .resume = dvb_usbv2_resume, 793 .reset_resume = dvb_usbv2_reset_resume, 794 .no_dynamic_id = 1, 795 .soft_unbind = 1, 796 }; 797 798 module_usb_driver(dvbsky_usb_driver); 799 800 MODULE_AUTHOR("Max nibble <nibble.max@gmail.com>"); 801 MODULE_DESCRIPTION("Driver for DVBSky USB"); 802 MODULE_LICENSE("GPL"); 803