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