1 /* 2 * Silicon Labs Si2168 DVB-T/T2/C demodulator driver 3 * 4 * Copyright (C) 2014 Antti Palosaari <crope@iki.fi> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 */ 16 17 #include "si2168_priv.h" 18 19 static const struct dvb_frontend_ops si2168_ops; 20 21 /* execute firmware command */ 22 static int si2168_cmd_execute(struct i2c_client *client, struct si2168_cmd *cmd) 23 { 24 struct si2168_dev *dev = i2c_get_clientdata(client); 25 int ret; 26 unsigned long timeout; 27 28 mutex_lock(&dev->i2c_mutex); 29 30 if (cmd->wlen) { 31 /* write cmd and args for firmware */ 32 ret = i2c_master_send(client, cmd->args, cmd->wlen); 33 if (ret < 0) { 34 goto err_mutex_unlock; 35 } else if (ret != cmd->wlen) { 36 ret = -EREMOTEIO; 37 goto err_mutex_unlock; 38 } 39 } 40 41 if (cmd->rlen) { 42 /* wait cmd execution terminate */ 43 #define TIMEOUT 70 44 timeout = jiffies + msecs_to_jiffies(TIMEOUT); 45 while (!time_after(jiffies, timeout)) { 46 ret = i2c_master_recv(client, cmd->args, cmd->rlen); 47 if (ret < 0) { 48 goto err_mutex_unlock; 49 } else if (ret != cmd->rlen) { 50 ret = -EREMOTEIO; 51 goto err_mutex_unlock; 52 } 53 54 /* firmware ready? */ 55 if ((cmd->args[0] >> 7) & 0x01) 56 break; 57 } 58 59 dev_dbg(&client->dev, "cmd execution took %d ms\n", 60 jiffies_to_msecs(jiffies) - 61 (jiffies_to_msecs(timeout) - TIMEOUT)); 62 63 /* error bit set? */ 64 if ((cmd->args[0] >> 6) & 0x01) { 65 ret = -EREMOTEIO; 66 goto err_mutex_unlock; 67 } 68 69 if (!((cmd->args[0] >> 7) & 0x01)) { 70 ret = -ETIMEDOUT; 71 goto err_mutex_unlock; 72 } 73 } 74 75 mutex_unlock(&dev->i2c_mutex); 76 return 0; 77 err_mutex_unlock: 78 mutex_unlock(&dev->i2c_mutex); 79 dev_dbg(&client->dev, "failed=%d\n", ret); 80 return ret; 81 } 82 83 static int si2168_read_status(struct dvb_frontend *fe, enum fe_status *status) 84 { 85 struct i2c_client *client = fe->demodulator_priv; 86 struct si2168_dev *dev = i2c_get_clientdata(client); 87 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 88 int ret; 89 struct si2168_cmd cmd; 90 91 *status = 0; 92 93 if (!dev->active) { 94 ret = -EAGAIN; 95 goto err; 96 } 97 98 switch (c->delivery_system) { 99 case SYS_DVBT: 100 memcpy(cmd.args, "\xa0\x01", 2); 101 cmd.wlen = 2; 102 cmd.rlen = 13; 103 break; 104 case SYS_DVBC_ANNEX_A: 105 memcpy(cmd.args, "\x90\x01", 2); 106 cmd.wlen = 2; 107 cmd.rlen = 9; 108 break; 109 case SYS_DVBT2: 110 memcpy(cmd.args, "\x50\x01", 2); 111 cmd.wlen = 2; 112 cmd.rlen = 14; 113 break; 114 default: 115 ret = -EINVAL; 116 goto err; 117 } 118 119 ret = si2168_cmd_execute(client, &cmd); 120 if (ret) 121 goto err; 122 123 switch ((cmd.args[2] >> 1) & 0x03) { 124 case 0x01: 125 *status = FE_HAS_SIGNAL | FE_HAS_CARRIER; 126 break; 127 case 0x03: 128 *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | 129 FE_HAS_SYNC | FE_HAS_LOCK; 130 break; 131 } 132 133 dev->fe_status = *status; 134 135 if (*status & FE_HAS_LOCK) { 136 c->cnr.len = 1; 137 c->cnr.stat[0].scale = FE_SCALE_DECIBEL; 138 c->cnr.stat[0].svalue = cmd.args[3] * 1000 / 4; 139 } else { 140 c->cnr.len = 1; 141 c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; 142 } 143 144 dev_dbg(&client->dev, "status=%02x args=%*ph\n", 145 *status, cmd.rlen, cmd.args); 146 147 return 0; 148 err: 149 dev_dbg(&client->dev, "failed=%d\n", ret); 150 return ret; 151 } 152 153 static int si2168_set_frontend(struct dvb_frontend *fe) 154 { 155 struct i2c_client *client = fe->demodulator_priv; 156 struct si2168_dev *dev = i2c_get_clientdata(client); 157 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 158 int ret; 159 struct si2168_cmd cmd; 160 u8 bandwidth, delivery_system; 161 162 dev_dbg(&client->dev, 163 "delivery_system=%u modulation=%u frequency=%u bandwidth_hz=%u symbol_rate=%u inversion=%u stream_id=%u\n", 164 c->delivery_system, c->modulation, c->frequency, 165 c->bandwidth_hz, c->symbol_rate, c->inversion, 166 c->stream_id); 167 168 if (!dev->active) { 169 ret = -EAGAIN; 170 goto err; 171 } 172 173 switch (c->delivery_system) { 174 case SYS_DVBT: 175 delivery_system = 0x20; 176 break; 177 case SYS_DVBC_ANNEX_A: 178 delivery_system = 0x30; 179 break; 180 case SYS_DVBT2: 181 delivery_system = 0x70; 182 break; 183 default: 184 ret = -EINVAL; 185 goto err; 186 } 187 188 if (c->bandwidth_hz == 0) { 189 ret = -EINVAL; 190 goto err; 191 } else if (c->bandwidth_hz <= 2000000) 192 bandwidth = 0x02; 193 else if (c->bandwidth_hz <= 5000000) 194 bandwidth = 0x05; 195 else if (c->bandwidth_hz <= 6000000) 196 bandwidth = 0x06; 197 else if (c->bandwidth_hz <= 7000000) 198 bandwidth = 0x07; 199 else if (c->bandwidth_hz <= 8000000) 200 bandwidth = 0x08; 201 else if (c->bandwidth_hz <= 9000000) 202 bandwidth = 0x09; 203 else if (c->bandwidth_hz <= 10000000) 204 bandwidth = 0x0a; 205 else 206 bandwidth = 0x0f; 207 208 /* program tuner */ 209 if (fe->ops.tuner_ops.set_params) { 210 ret = fe->ops.tuner_ops.set_params(fe); 211 if (ret) 212 goto err; 213 } 214 215 memcpy(cmd.args, "\x88\x02\x02\x02\x02", 5); 216 cmd.wlen = 5; 217 cmd.rlen = 5; 218 ret = si2168_cmd_execute(client, &cmd); 219 if (ret) 220 goto err; 221 222 /* that has no big effect */ 223 if (c->delivery_system == SYS_DVBT) 224 memcpy(cmd.args, "\x89\x21\x06\x11\xff\x98", 6); 225 else if (c->delivery_system == SYS_DVBC_ANNEX_A) 226 memcpy(cmd.args, "\x89\x21\x06\x11\x89\xf0", 6); 227 else if (c->delivery_system == SYS_DVBT2) 228 memcpy(cmd.args, "\x89\x21\x06\x11\x89\x20", 6); 229 cmd.wlen = 6; 230 cmd.rlen = 3; 231 ret = si2168_cmd_execute(client, &cmd); 232 if (ret) 233 goto err; 234 235 if (c->delivery_system == SYS_DVBT2) { 236 /* select PLP */ 237 cmd.args[0] = 0x52; 238 cmd.args[1] = c->stream_id & 0xff; 239 cmd.args[2] = c->stream_id == NO_STREAM_ID_FILTER ? 0 : 1; 240 cmd.wlen = 3; 241 cmd.rlen = 1; 242 ret = si2168_cmd_execute(client, &cmd); 243 if (ret) 244 goto err; 245 } 246 247 memcpy(cmd.args, "\x51\x03", 2); 248 cmd.wlen = 2; 249 cmd.rlen = 12; 250 ret = si2168_cmd_execute(client, &cmd); 251 if (ret) 252 goto err; 253 254 memcpy(cmd.args, "\x12\x08\x04", 3); 255 cmd.wlen = 3; 256 cmd.rlen = 3; 257 ret = si2168_cmd_execute(client, &cmd); 258 if (ret) 259 goto err; 260 261 memcpy(cmd.args, "\x14\x00\x0c\x10\x12\x00", 6); 262 cmd.wlen = 6; 263 cmd.rlen = 4; 264 ret = si2168_cmd_execute(client, &cmd); 265 if (ret) 266 goto err; 267 268 memcpy(cmd.args, "\x14\x00\x06\x10\x24\x00", 6); 269 cmd.wlen = 6; 270 cmd.rlen = 4; 271 ret = si2168_cmd_execute(client, &cmd); 272 if (ret) 273 goto err; 274 275 memcpy(cmd.args, "\x14\x00\x07\x10\x00\x24", 6); 276 cmd.wlen = 6; 277 cmd.rlen = 4; 278 ret = si2168_cmd_execute(client, &cmd); 279 if (ret) 280 goto err; 281 282 memcpy(cmd.args, "\x14\x00\x0a\x10\x00\x00", 6); 283 cmd.args[4] = delivery_system | bandwidth; 284 cmd.wlen = 6; 285 cmd.rlen = 4; 286 ret = si2168_cmd_execute(client, &cmd); 287 if (ret) 288 goto err; 289 290 /* set DVB-C symbol rate */ 291 if (c->delivery_system == SYS_DVBC_ANNEX_A) { 292 memcpy(cmd.args, "\x14\x00\x02\x11", 4); 293 cmd.args[4] = ((c->symbol_rate / 1000) >> 0) & 0xff; 294 cmd.args[5] = ((c->symbol_rate / 1000) >> 8) & 0xff; 295 cmd.wlen = 6; 296 cmd.rlen = 4; 297 ret = si2168_cmd_execute(client, &cmd); 298 if (ret) 299 goto err; 300 } 301 302 memcpy(cmd.args, "\x14\x00\x0f\x10\x10\x00", 6); 303 cmd.wlen = 6; 304 cmd.rlen = 4; 305 ret = si2168_cmd_execute(client, &cmd); 306 if (ret) 307 goto err; 308 309 memcpy(cmd.args, "\x14\x00\x09\x10\xe3\x08", 6); 310 cmd.args[5] |= dev->ts_clock_inv ? 0x00 : 0x10; 311 cmd.wlen = 6; 312 cmd.rlen = 4; 313 ret = si2168_cmd_execute(client, &cmd); 314 if (ret) 315 goto err; 316 317 memcpy(cmd.args, "\x14\x00\x08\x10\xd7\x05", 6); 318 cmd.args[5] |= dev->ts_clock_inv ? 0x00 : 0x10; 319 cmd.wlen = 6; 320 cmd.rlen = 4; 321 ret = si2168_cmd_execute(client, &cmd); 322 if (ret) 323 goto err; 324 325 memcpy(cmd.args, "\x14\x00\x01\x12\x00\x00", 6); 326 cmd.wlen = 6; 327 cmd.rlen = 4; 328 ret = si2168_cmd_execute(client, &cmd); 329 if (ret) 330 goto err; 331 332 memcpy(cmd.args, "\x14\x00\x01\x03\x0c\x00", 6); 333 cmd.wlen = 6; 334 cmd.rlen = 4; 335 ret = si2168_cmd_execute(client, &cmd); 336 if (ret) 337 goto err; 338 339 memcpy(cmd.args, "\x85", 1); 340 cmd.wlen = 1; 341 cmd.rlen = 1; 342 ret = si2168_cmd_execute(client, &cmd); 343 if (ret) 344 goto err; 345 346 dev->delivery_system = c->delivery_system; 347 348 return 0; 349 err: 350 dev_dbg(&client->dev, "failed=%d\n", ret); 351 return ret; 352 } 353 354 static int si2168_init(struct dvb_frontend *fe) 355 { 356 struct i2c_client *client = fe->demodulator_priv; 357 struct si2168_dev *dev = i2c_get_clientdata(client); 358 int ret, len, remaining; 359 const struct firmware *fw; 360 const char *fw_name; 361 struct si2168_cmd cmd; 362 unsigned int chip_id; 363 364 dev_dbg(&client->dev, "\n"); 365 366 /* initialize */ 367 memcpy(cmd.args, "\xc0\x12\x00\x0c\x00\x0d\x16\x00\x00\x00\x00\x00\x00", 13); 368 cmd.wlen = 13; 369 cmd.rlen = 0; 370 ret = si2168_cmd_execute(client, &cmd); 371 if (ret) 372 goto err; 373 374 if (dev->fw_loaded) { 375 /* resume */ 376 memcpy(cmd.args, "\xc0\x06\x08\x0f\x00\x20\x21\x01", 8); 377 cmd.wlen = 8; 378 cmd.rlen = 1; 379 ret = si2168_cmd_execute(client, &cmd); 380 if (ret) 381 goto err; 382 383 memcpy(cmd.args, "\x85", 1); 384 cmd.wlen = 1; 385 cmd.rlen = 1; 386 ret = si2168_cmd_execute(client, &cmd); 387 if (ret) 388 goto err; 389 390 goto warm; 391 } 392 393 /* power up */ 394 memcpy(cmd.args, "\xc0\x06\x01\x0f\x00\x20\x20\x01", 8); 395 cmd.wlen = 8; 396 cmd.rlen = 1; 397 ret = si2168_cmd_execute(client, &cmd); 398 if (ret) 399 goto err; 400 401 /* query chip revision */ 402 memcpy(cmd.args, "\x02", 1); 403 cmd.wlen = 1; 404 cmd.rlen = 13; 405 ret = si2168_cmd_execute(client, &cmd); 406 if (ret) 407 goto err; 408 409 chip_id = cmd.args[1] << 24 | cmd.args[2] << 16 | cmd.args[3] << 8 | 410 cmd.args[4] << 0; 411 412 #define SI2168_A20 ('A' << 24 | 68 << 16 | '2' << 8 | '0' << 0) 413 #define SI2168_A30 ('A' << 24 | 68 << 16 | '3' << 8 | '0' << 0) 414 #define SI2168_B40 ('B' << 24 | 68 << 16 | '4' << 8 | '0' << 0) 415 416 switch (chip_id) { 417 case SI2168_A20: 418 fw_name = SI2168_A20_FIRMWARE; 419 break; 420 case SI2168_A30: 421 fw_name = SI2168_A30_FIRMWARE; 422 break; 423 case SI2168_B40: 424 fw_name = SI2168_B40_FIRMWARE; 425 break; 426 default: 427 dev_err(&client->dev, "unknown chip version Si21%d-%c%c%c\n", 428 cmd.args[2], cmd.args[1], 429 cmd.args[3], cmd.args[4]); 430 ret = -EINVAL; 431 goto err; 432 } 433 434 dev_info(&client->dev, "found a 'Silicon Labs Si21%d-%c%c%c'\n", 435 cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]); 436 437 /* request the firmware, this will block and timeout */ 438 ret = request_firmware(&fw, fw_name, &client->dev); 439 if (ret) { 440 /* fallback mechanism to handle old name for Si2168 B40 fw */ 441 if (chip_id == SI2168_B40) { 442 fw_name = SI2168_B40_FIRMWARE_FALLBACK; 443 ret = request_firmware(&fw, fw_name, &client->dev); 444 } 445 446 if (ret == 0) { 447 dev_notice(&client->dev, 448 "please install firmware file '%s'\n", 449 SI2168_B40_FIRMWARE); 450 } else { 451 dev_err(&client->dev, 452 "firmware file '%s' not found\n", 453 fw_name); 454 goto err_release_firmware; 455 } 456 } 457 458 dev_info(&client->dev, "downloading firmware from file '%s'\n", 459 fw_name); 460 461 if ((fw->size % 17 == 0) && (fw->data[0] > 5)) { 462 /* firmware is in the new format */ 463 for (remaining = fw->size; remaining > 0; remaining -= 17) { 464 len = fw->data[fw->size - remaining]; 465 if (len > SI2168_ARGLEN) { 466 ret = -EINVAL; 467 break; 468 } 469 memcpy(cmd.args, &fw->data[(fw->size - remaining) + 1], len); 470 cmd.wlen = len; 471 cmd.rlen = 1; 472 ret = si2168_cmd_execute(client, &cmd); 473 if (ret) 474 break; 475 } 476 } else if (fw->size % 8 == 0) { 477 /* firmware is in the old format */ 478 for (remaining = fw->size; remaining > 0; remaining -= 8) { 479 len = 8; 480 memcpy(cmd.args, &fw->data[fw->size - remaining], len); 481 cmd.wlen = len; 482 cmd.rlen = 1; 483 ret = si2168_cmd_execute(client, &cmd); 484 if (ret) 485 break; 486 } 487 } else { 488 /* bad or unknown firmware format */ 489 ret = -EINVAL; 490 } 491 492 if (ret) { 493 dev_err(&client->dev, "firmware download failed %d\n", ret); 494 goto err_release_firmware; 495 } 496 497 release_firmware(fw); 498 499 memcpy(cmd.args, "\x01\x01", 2); 500 cmd.wlen = 2; 501 cmd.rlen = 1; 502 ret = si2168_cmd_execute(client, &cmd); 503 if (ret) 504 goto err; 505 506 /* query firmware version */ 507 memcpy(cmd.args, "\x11", 1); 508 cmd.wlen = 1; 509 cmd.rlen = 10; 510 ret = si2168_cmd_execute(client, &cmd); 511 if (ret) 512 goto err; 513 514 dev_info(&client->dev, "firmware version: %c.%c.%d\n", 515 cmd.args[6], cmd.args[7], cmd.args[8]); 516 517 /* set ts mode */ 518 memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6); 519 cmd.args[4] |= dev->ts_mode; 520 if (dev->ts_clock_gapped) 521 cmd.args[4] |= 0x40; 522 cmd.wlen = 6; 523 cmd.rlen = 4; 524 ret = si2168_cmd_execute(client, &cmd); 525 if (ret) 526 goto err; 527 528 dev->fw_loaded = true; 529 warm: 530 dev->active = true; 531 532 return 0; 533 534 err_release_firmware: 535 release_firmware(fw); 536 err: 537 dev_dbg(&client->dev, "failed=%d\n", ret); 538 return ret; 539 } 540 541 static int si2168_sleep(struct dvb_frontend *fe) 542 { 543 struct i2c_client *client = fe->demodulator_priv; 544 struct si2168_dev *dev = i2c_get_clientdata(client); 545 int ret; 546 struct si2168_cmd cmd; 547 548 dev_dbg(&client->dev, "\n"); 549 550 dev->active = false; 551 552 memcpy(cmd.args, "\x13", 1); 553 cmd.wlen = 1; 554 cmd.rlen = 0; 555 ret = si2168_cmd_execute(client, &cmd); 556 if (ret) 557 goto err; 558 559 return 0; 560 err: 561 dev_dbg(&client->dev, "failed=%d\n", ret); 562 return ret; 563 } 564 565 static int si2168_get_tune_settings(struct dvb_frontend *fe, 566 struct dvb_frontend_tune_settings *s) 567 { 568 s->min_delay_ms = 900; 569 570 return 0; 571 } 572 573 static int si2168_select(struct i2c_mux_core *muxc, u32 chan) 574 { 575 struct i2c_client *client = i2c_mux_priv(muxc); 576 int ret; 577 struct si2168_cmd cmd; 578 579 /* open I2C gate */ 580 memcpy(cmd.args, "\xc0\x0d\x01", 3); 581 cmd.wlen = 3; 582 cmd.rlen = 0; 583 ret = si2168_cmd_execute(client, &cmd); 584 if (ret) 585 goto err; 586 587 return 0; 588 err: 589 dev_dbg(&client->dev, "failed=%d\n", ret); 590 return ret; 591 } 592 593 static int si2168_deselect(struct i2c_mux_core *muxc, u32 chan) 594 { 595 struct i2c_client *client = i2c_mux_priv(muxc); 596 int ret; 597 struct si2168_cmd cmd; 598 599 /* close I2C gate */ 600 memcpy(cmd.args, "\xc0\x0d\x00", 3); 601 cmd.wlen = 3; 602 cmd.rlen = 0; 603 ret = si2168_cmd_execute(client, &cmd); 604 if (ret) 605 goto err; 606 607 return 0; 608 err: 609 dev_dbg(&client->dev, "failed=%d\n", ret); 610 return ret; 611 } 612 613 static const struct dvb_frontend_ops si2168_ops = { 614 .delsys = {SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_A}, 615 .info = { 616 .name = "Silicon Labs Si2168", 617 .symbol_rate_min = 1000000, 618 .symbol_rate_max = 7200000, 619 .caps = FE_CAN_FEC_1_2 | 620 FE_CAN_FEC_2_3 | 621 FE_CAN_FEC_3_4 | 622 FE_CAN_FEC_5_6 | 623 FE_CAN_FEC_7_8 | 624 FE_CAN_FEC_AUTO | 625 FE_CAN_QPSK | 626 FE_CAN_QAM_16 | 627 FE_CAN_QAM_32 | 628 FE_CAN_QAM_64 | 629 FE_CAN_QAM_128 | 630 FE_CAN_QAM_256 | 631 FE_CAN_QAM_AUTO | 632 FE_CAN_TRANSMISSION_MODE_AUTO | 633 FE_CAN_GUARD_INTERVAL_AUTO | 634 FE_CAN_HIERARCHY_AUTO | 635 FE_CAN_MUTE_TS | 636 FE_CAN_2G_MODULATION | 637 FE_CAN_MULTISTREAM 638 }, 639 640 .get_tune_settings = si2168_get_tune_settings, 641 642 .init = si2168_init, 643 .sleep = si2168_sleep, 644 645 .set_frontend = si2168_set_frontend, 646 647 .read_status = si2168_read_status, 648 }; 649 650 static int si2168_probe(struct i2c_client *client, 651 const struct i2c_device_id *id) 652 { 653 struct si2168_config *config = client->dev.platform_data; 654 struct si2168_dev *dev; 655 int ret; 656 657 dev_dbg(&client->dev, "\n"); 658 659 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 660 if (!dev) { 661 ret = -ENOMEM; 662 dev_err(&client->dev, "kzalloc() failed\n"); 663 goto err; 664 } 665 666 mutex_init(&dev->i2c_mutex); 667 668 /* create mux i2c adapter for tuner */ 669 dev->muxc = i2c_mux_alloc(client->adapter, &client->dev, 670 1, 0, I2C_MUX_LOCKED, 671 si2168_select, si2168_deselect); 672 if (!dev->muxc) { 673 ret = -ENOMEM; 674 goto err_kfree; 675 } 676 dev->muxc->priv = client; 677 ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0); 678 if (ret) 679 goto err_kfree; 680 681 /* create dvb_frontend */ 682 memcpy(&dev->fe.ops, &si2168_ops, sizeof(struct dvb_frontend_ops)); 683 dev->fe.demodulator_priv = client; 684 *config->i2c_adapter = dev->muxc->adapter[0]; 685 *config->fe = &dev->fe; 686 dev->ts_mode = config->ts_mode; 687 dev->ts_clock_inv = config->ts_clock_inv; 688 dev->ts_clock_gapped = config->ts_clock_gapped; 689 dev->fw_loaded = false; 690 691 i2c_set_clientdata(client, dev); 692 693 dev_info(&client->dev, "Silicon Labs Si2168 successfully attached\n"); 694 return 0; 695 err_kfree: 696 kfree(dev); 697 err: 698 dev_dbg(&client->dev, "failed=%d\n", ret); 699 return ret; 700 } 701 702 static int si2168_remove(struct i2c_client *client) 703 { 704 struct si2168_dev *dev = i2c_get_clientdata(client); 705 706 dev_dbg(&client->dev, "\n"); 707 708 i2c_mux_del_adapters(dev->muxc); 709 710 dev->fe.ops.release = NULL; 711 dev->fe.demodulator_priv = NULL; 712 713 kfree(dev); 714 715 return 0; 716 } 717 718 static const struct i2c_device_id si2168_id_table[] = { 719 {"si2168", 0}, 720 {} 721 }; 722 MODULE_DEVICE_TABLE(i2c, si2168_id_table); 723 724 static struct i2c_driver si2168_driver = { 725 .driver = { 726 .name = "si2168", 727 }, 728 .probe = si2168_probe, 729 .remove = si2168_remove, 730 .id_table = si2168_id_table, 731 }; 732 733 module_i2c_driver(si2168_driver); 734 735 MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); 736 MODULE_DESCRIPTION("Silicon Labs Si2168 DVB-T/T2/C demodulator driver"); 737 MODULE_LICENSE("GPL"); 738 MODULE_FIRMWARE(SI2168_A20_FIRMWARE); 739 MODULE_FIRMWARE(SI2168_A30_FIRMWARE); 740 MODULE_FIRMWARE(SI2168_B40_FIRMWARE); 741