| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Silicon Labs Si2168 DVB-T/T2/C demodulator driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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 | 6 | */ |
|---|
| 16 | 7 | |
|---|
| 17 | 8 | #include <linux/delay.h> |
|---|
| .. | .. |
|---|
| 19 | 10 | #include "si2168_priv.h" |
|---|
| 20 | 11 | |
|---|
| 21 | 12 | static const struct dvb_frontend_ops si2168_ops; |
|---|
| 13 | + |
|---|
| 14 | +static void cmd_init(struct si2168_cmd *cmd, const u8 *buf, int wlen, int rlen) |
|---|
| 15 | +{ |
|---|
| 16 | + memcpy(cmd->args, buf, wlen); |
|---|
| 17 | + cmd->wlen = wlen; |
|---|
| 18 | + cmd->rlen = rlen; |
|---|
| 19 | +} |
|---|
| 22 | 20 | |
|---|
| 23 | 21 | /* execute firmware command */ |
|---|
| 24 | 22 | static int si2168_cmd_execute(struct i2c_client *client, struct si2168_cmd *cmd) |
|---|
| .. | .. |
|---|
| 91 | 89 | |
|---|
| 92 | 90 | dev_dbg(&client->dev, "%s acquire: %d\n", __func__, acquire); |
|---|
| 93 | 91 | |
|---|
| 92 | + /* set manual value */ |
|---|
| 93 | + if (dev->ts_mode & SI2168_TS_CLK_MANUAL) { |
|---|
| 94 | + cmd_init(&cmd, "\x14\x00\x0d\x10\xe8\x03", 6, 4); |
|---|
| 95 | + ret = si2168_cmd_execute(client, &cmd); |
|---|
| 96 | + if (ret) |
|---|
| 97 | + return ret; |
|---|
| 98 | + } |
|---|
| 94 | 99 | /* set TS_MODE property */ |
|---|
| 95 | | - memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6); |
|---|
| 100 | + cmd_init(&cmd, "\x14\x00\x01\x10\x10\x00", 6, 4); |
|---|
| 101 | + if (dev->ts_mode & SI2168_TS_CLK_MANUAL) |
|---|
| 102 | + cmd.args[4] = SI2168_TS_CLK_MANUAL; |
|---|
| 96 | 103 | if (acquire) |
|---|
| 97 | 104 | cmd.args[4] |= dev->ts_mode; |
|---|
| 98 | 105 | else |
|---|
| 99 | 106 | cmd.args[4] |= SI2168_TS_TRISTATE; |
|---|
| 100 | 107 | if (dev->ts_clock_gapped) |
|---|
| 101 | 108 | cmd.args[4] |= 0x40; |
|---|
| 102 | | - cmd.wlen = 6; |
|---|
| 103 | | - cmd.rlen = 4; |
|---|
| 104 | 109 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 105 | 110 | |
|---|
| 106 | 111 | return ret; |
|---|
| .. | .. |
|---|
| 124 | 129 | |
|---|
| 125 | 130 | switch (c->delivery_system) { |
|---|
| 126 | 131 | case SYS_DVBT: |
|---|
| 127 | | - memcpy(cmd.args, "\xa0\x01", 2); |
|---|
| 128 | | - cmd.wlen = 2; |
|---|
| 129 | | - cmd.rlen = 13; |
|---|
| 132 | + cmd_init(&cmd, "\xa0\x01", 2, 13); |
|---|
| 130 | 133 | break; |
|---|
| 131 | 134 | case SYS_DVBC_ANNEX_A: |
|---|
| 132 | | - memcpy(cmd.args, "\x90\x01", 2); |
|---|
| 133 | | - cmd.wlen = 2; |
|---|
| 134 | | - cmd.rlen = 9; |
|---|
| 135 | + cmd_init(&cmd, "\x90\x01", 2, 9); |
|---|
| 135 | 136 | break; |
|---|
| 136 | 137 | case SYS_DVBT2: |
|---|
| 137 | | - memcpy(cmd.args, "\x50\x01", 2); |
|---|
| 138 | | - cmd.wlen = 2; |
|---|
| 139 | | - cmd.rlen = 14; |
|---|
| 138 | + cmd_init(&cmd, "\x50\x01", 2, 14); |
|---|
| 140 | 139 | break; |
|---|
| 141 | 140 | default: |
|---|
| 142 | 141 | ret = -EINVAL; |
|---|
| .. | .. |
|---|
| 173 | 172 | |
|---|
| 174 | 173 | /* BER */ |
|---|
| 175 | 174 | if (*status & FE_HAS_VITERBI) { |
|---|
| 176 | | - memcpy(cmd.args, "\x82\x00", 2); |
|---|
| 177 | | - cmd.wlen = 2; |
|---|
| 178 | | - cmd.rlen = 3; |
|---|
| 175 | + cmd_init(&cmd, "\x82\x00", 2, 3); |
|---|
| 179 | 176 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 180 | 177 | if (ret) |
|---|
| 181 | 178 | goto err; |
|---|
| .. | .. |
|---|
| 206 | 203 | |
|---|
| 207 | 204 | /* UCB */ |
|---|
| 208 | 205 | if (*status & FE_HAS_SYNC) { |
|---|
| 209 | | - memcpy(cmd.args, "\x84\x01", 2); |
|---|
| 210 | | - cmd.wlen = 2; |
|---|
| 211 | | - cmd.rlen = 3; |
|---|
| 206 | + cmd_init(&cmd, "\x84\x01", 2, 3); |
|---|
| 212 | 207 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 213 | 208 | if (ret) |
|---|
| 214 | 209 | goto err; |
|---|
| .. | .. |
|---|
| 294 | 289 | goto err; |
|---|
| 295 | 290 | } |
|---|
| 296 | 291 | |
|---|
| 297 | | - memcpy(cmd.args, "\x88\x02\x02\x02\x02", 5); |
|---|
| 298 | | - cmd.wlen = 5; |
|---|
| 299 | | - cmd.rlen = 5; |
|---|
| 292 | + cmd_init(&cmd, "\x88\x02\x02\x02\x02", 5, 5); |
|---|
| 300 | 293 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 301 | 294 | if (ret) |
|---|
| 302 | 295 | goto err; |
|---|
| 303 | 296 | |
|---|
| 304 | 297 | /* that has no big effect */ |
|---|
| 305 | 298 | if (c->delivery_system == SYS_DVBT) |
|---|
| 306 | | - memcpy(cmd.args, "\x89\x21\x06\x11\xff\x98", 6); |
|---|
| 299 | + cmd_init(&cmd, "\x89\x21\x06\x11\xff\x98", 6, 3); |
|---|
| 307 | 300 | else if (c->delivery_system == SYS_DVBC_ANNEX_A) |
|---|
| 308 | | - memcpy(cmd.args, "\x89\x21\x06\x11\x89\xf0", 6); |
|---|
| 301 | + cmd_init(&cmd, "\x89\x21\x06\x11\x89\xf0", 6, 3); |
|---|
| 309 | 302 | else if (c->delivery_system == SYS_DVBT2) |
|---|
| 310 | | - memcpy(cmd.args, "\x89\x21\x06\x11\x89\x20", 6); |
|---|
| 311 | | - cmd.wlen = 6; |
|---|
| 312 | | - cmd.rlen = 3; |
|---|
| 303 | + cmd_init(&cmd, "\x89\x21\x06\x11\x89\x20", 6, 3); |
|---|
| 313 | 304 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 314 | 305 | if (ret) |
|---|
| 315 | 306 | goto err; |
|---|
| .. | .. |
|---|
| 326 | 317 | goto err; |
|---|
| 327 | 318 | } |
|---|
| 328 | 319 | |
|---|
| 329 | | - memcpy(cmd.args, "\x51\x03", 2); |
|---|
| 330 | | - cmd.wlen = 2; |
|---|
| 331 | | - cmd.rlen = 12; |
|---|
| 320 | + cmd_init(&cmd, "\x51\x03", 2, 12); |
|---|
| 332 | 321 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 333 | 322 | if (ret) |
|---|
| 334 | 323 | goto err; |
|---|
| 335 | 324 | |
|---|
| 336 | | - memcpy(cmd.args, "\x12\x08\x04", 3); |
|---|
| 337 | | - cmd.wlen = 3; |
|---|
| 338 | | - cmd.rlen = 3; |
|---|
| 325 | + cmd_init(&cmd, "\x12\x08\x04", 3, 3); |
|---|
| 339 | 326 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 340 | 327 | if (ret) |
|---|
| 341 | 328 | goto err; |
|---|
| 342 | 329 | |
|---|
| 343 | | - memcpy(cmd.args, "\x14\x00\x0c\x10\x12\x00", 6); |
|---|
| 344 | | - cmd.wlen = 6; |
|---|
| 345 | | - cmd.rlen = 4; |
|---|
| 330 | + cmd_init(&cmd, "\x14\x00\x0c\x10\x12\x00", 6, 4); |
|---|
| 346 | 331 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 347 | 332 | if (ret) |
|---|
| 348 | 333 | goto err; |
|---|
| 349 | 334 | |
|---|
| 350 | | - memcpy(cmd.args, "\x14\x00\x06\x10\x24\x00", 6); |
|---|
| 351 | | - cmd.wlen = 6; |
|---|
| 352 | | - cmd.rlen = 4; |
|---|
| 335 | + cmd_init(&cmd, "\x14\x00\x06\x10\x24\x00", 6, 4); |
|---|
| 353 | 336 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 354 | 337 | if (ret) |
|---|
| 355 | 338 | goto err; |
|---|
| 356 | 339 | |
|---|
| 357 | | - memcpy(cmd.args, "\x14\x00\x07\x10\x00\x24", 6); |
|---|
| 358 | | - cmd.wlen = 6; |
|---|
| 359 | | - cmd.rlen = 4; |
|---|
| 340 | + cmd_init(&cmd, "\x14\x00\x07\x10\x00\x24", 6, 4); |
|---|
| 360 | 341 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 361 | 342 | if (ret) |
|---|
| 362 | 343 | goto err; |
|---|
| 363 | 344 | |
|---|
| 364 | | - memcpy(cmd.args, "\x14\x00\x0a\x10\x00\x00", 6); |
|---|
| 345 | + cmd_init(&cmd, "\x14\x00\x0a\x10\x00\x00", 6, 4); |
|---|
| 365 | 346 | cmd.args[4] = delivery_system | bandwidth; |
|---|
| 366 | 347 | if (dev->spectral_inversion) |
|---|
| 367 | 348 | cmd.args[5] |= 1; |
|---|
| 368 | | - cmd.wlen = 6; |
|---|
| 369 | | - cmd.rlen = 4; |
|---|
| 370 | 349 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 371 | 350 | if (ret) |
|---|
| 372 | 351 | goto err; |
|---|
| 373 | 352 | |
|---|
| 374 | 353 | /* set DVB-C symbol rate */ |
|---|
| 375 | 354 | if (c->delivery_system == SYS_DVBC_ANNEX_A) { |
|---|
| 376 | | - memcpy(cmd.args, "\x14\x00\x02\x11", 4); |
|---|
| 355 | + cmd_init(&cmd, "\x14\x00\x02\x11\x00\x00", 6, 4); |
|---|
| 377 | 356 | cmd.args[4] = ((c->symbol_rate / 1000) >> 0) & 0xff; |
|---|
| 378 | 357 | cmd.args[5] = ((c->symbol_rate / 1000) >> 8) & 0xff; |
|---|
| 379 | | - cmd.wlen = 6; |
|---|
| 380 | | - cmd.rlen = 4; |
|---|
| 381 | 358 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 382 | 359 | if (ret) |
|---|
| 383 | 360 | goto err; |
|---|
| 384 | 361 | } |
|---|
| 385 | 362 | |
|---|
| 386 | | - memcpy(cmd.args, "\x14\x00\x0f\x10\x10\x00", 6); |
|---|
| 387 | | - cmd.wlen = 6; |
|---|
| 388 | | - cmd.rlen = 4; |
|---|
| 363 | + cmd_init(&cmd, "\x14\x00\x0f\x10\x10\x00", 6, 4); |
|---|
| 389 | 364 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 390 | 365 | if (ret) |
|---|
| 391 | 366 | goto err; |
|---|
| 392 | 367 | |
|---|
| 393 | | - memcpy(cmd.args, "\x14\x00\x09\x10\xe3\x08", 6); |
|---|
| 368 | + cmd_init(&cmd, "\x14\x00\x09\x10\xe3\x08", 6, 4); |
|---|
| 394 | 369 | cmd.args[5] |= dev->ts_clock_inv ? 0x00 : 0x10; |
|---|
| 395 | | - cmd.wlen = 6; |
|---|
| 396 | | - cmd.rlen = 4; |
|---|
| 397 | 370 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 398 | 371 | if (ret) |
|---|
| 399 | 372 | goto err; |
|---|
| 400 | 373 | |
|---|
| 401 | | - memcpy(cmd.args, "\x14\x00\x08\x10\xd7\x05", 6); |
|---|
| 374 | + cmd_init(&cmd, "\x14\x00\x08\x10\xd7\x05", 6, 4); |
|---|
| 402 | 375 | cmd.args[5] |= dev->ts_clock_inv ? 0x00 : 0x10; |
|---|
| 403 | | - cmd.wlen = 6; |
|---|
| 404 | | - cmd.rlen = 4; |
|---|
| 405 | 376 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 406 | 377 | if (ret) |
|---|
| 407 | 378 | goto err; |
|---|
| 408 | 379 | |
|---|
| 409 | | - memcpy(cmd.args, "\x14\x00\x01\x12\x00\x00", 6); |
|---|
| 410 | | - cmd.wlen = 6; |
|---|
| 411 | | - cmd.rlen = 4; |
|---|
| 380 | + cmd_init(&cmd, "\x14\x00\x01\x12\x00\x00", 6, 4); |
|---|
| 412 | 381 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 413 | 382 | if (ret) |
|---|
| 414 | 383 | goto err; |
|---|
| 415 | 384 | |
|---|
| 416 | | - memcpy(cmd.args, "\x14\x00\x01\x03\x0c\x00", 6); |
|---|
| 417 | | - cmd.wlen = 6; |
|---|
| 418 | | - cmd.rlen = 4; |
|---|
| 385 | + cmd_init(&cmd, "\x14\x00\x01\x03\x0c\x00", 6, 4); |
|---|
| 419 | 386 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 420 | 387 | if (ret) |
|---|
| 421 | 388 | goto err; |
|---|
| 422 | 389 | |
|---|
| 423 | | - memcpy(cmd.args, "\x85", 1); |
|---|
| 424 | | - cmd.wlen = 1; |
|---|
| 425 | | - cmd.rlen = 1; |
|---|
| 390 | + cmd_init(&cmd, "\x85", 1, 1); |
|---|
| 426 | 391 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 427 | 392 | if (ret) |
|---|
| 428 | 393 | goto err; |
|---|
| .. | .. |
|---|
| 452 | 417 | dev_dbg(&client->dev, "\n"); |
|---|
| 453 | 418 | |
|---|
| 454 | 419 | /* initialize */ |
|---|
| 455 | | - memcpy(cmd.args, "\xc0\x12\x00\x0c\x00\x0d\x16\x00\x00\x00\x00\x00\x00", 13); |
|---|
| 456 | | - cmd.wlen = 13; |
|---|
| 457 | | - cmd.rlen = 0; |
|---|
| 420 | + cmd_init(&cmd, "\xc0\x12\x00\x0c\x00\x0d\x16\x00\x00\x00\x00\x00\x00", |
|---|
| 421 | + 13, 0); |
|---|
| 458 | 422 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 459 | 423 | if (ret) |
|---|
| 460 | 424 | goto err; |
|---|
| 461 | 425 | |
|---|
| 462 | 426 | if (dev->warm) { |
|---|
| 463 | 427 | /* resume */ |
|---|
| 464 | | - memcpy(cmd.args, "\xc0\x06\x08\x0f\x00\x20\x21\x01", 8); |
|---|
| 465 | | - cmd.wlen = 8; |
|---|
| 466 | | - cmd.rlen = 1; |
|---|
| 428 | + cmd_init(&cmd, "\xc0\x06\x08\x0f\x00\x20\x21\x01", 8, 1); |
|---|
| 467 | 429 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 468 | 430 | if (ret) |
|---|
| 469 | 431 | goto err; |
|---|
| 470 | 432 | |
|---|
| 471 | 433 | udelay(100); |
|---|
| 472 | | - memcpy(cmd.args, "\x85", 1); |
|---|
| 473 | | - cmd.wlen = 1; |
|---|
| 474 | | - cmd.rlen = 1; |
|---|
| 434 | + cmd_init(&cmd, "\x85", 1, 1); |
|---|
| 475 | 435 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 476 | 436 | if (ret) |
|---|
| 477 | 437 | goto err; |
|---|
| .. | .. |
|---|
| 480 | 440 | } |
|---|
| 481 | 441 | |
|---|
| 482 | 442 | /* power up */ |
|---|
| 483 | | - memcpy(cmd.args, "\xc0\x06\x01\x0f\x00\x20\x20\x01", 8); |
|---|
| 484 | | - cmd.wlen = 8; |
|---|
| 485 | | - cmd.rlen = 1; |
|---|
| 443 | + cmd_init(&cmd, "\xc0\x06\x01\x0f\x00\x20\x20\x01", 8, 1); |
|---|
| 486 | 444 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 487 | 445 | if (ret) |
|---|
| 488 | 446 | goto err; |
|---|
| .. | .. |
|---|
| 520 | 478 | ret = -EINVAL; |
|---|
| 521 | 479 | break; |
|---|
| 522 | 480 | } |
|---|
| 523 | | - memcpy(cmd.args, &fw->data[(fw->size - remaining) + 1], len); |
|---|
| 524 | | - cmd.wlen = len; |
|---|
| 525 | | - cmd.rlen = 1; |
|---|
| 481 | + cmd_init(&cmd, &fw->data[(fw->size - remaining) + 1], |
|---|
| 482 | + len, 1); |
|---|
| 526 | 483 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 527 | 484 | if (ret) |
|---|
| 528 | 485 | break; |
|---|
| .. | .. |
|---|
| 530 | 487 | } else if (fw->size % 8 == 0) { |
|---|
| 531 | 488 | /* firmware is in the old format */ |
|---|
| 532 | 489 | for (remaining = fw->size; remaining > 0; remaining -= 8) { |
|---|
| 533 | | - len = 8; |
|---|
| 534 | | - memcpy(cmd.args, &fw->data[fw->size - remaining], len); |
|---|
| 535 | | - cmd.wlen = len; |
|---|
| 536 | | - cmd.rlen = 1; |
|---|
| 490 | + cmd_init(&cmd, &fw->data[fw->size - remaining], 8, 1); |
|---|
| 537 | 491 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 538 | 492 | if (ret) |
|---|
| 539 | 493 | break; |
|---|
| .. | .. |
|---|
| 550 | 504 | |
|---|
| 551 | 505 | release_firmware(fw); |
|---|
| 552 | 506 | |
|---|
| 553 | | - memcpy(cmd.args, "\x01\x01", 2); |
|---|
| 554 | | - cmd.wlen = 2; |
|---|
| 555 | | - cmd.rlen = 1; |
|---|
| 507 | + cmd_init(&cmd, "\x01\x01", 2, 1); |
|---|
| 556 | 508 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 557 | 509 | if (ret) |
|---|
| 558 | 510 | goto err; |
|---|
| 559 | 511 | |
|---|
| 560 | 512 | /* query firmware version */ |
|---|
| 561 | | - memcpy(cmd.args, "\x11", 1); |
|---|
| 562 | | - cmd.wlen = 1; |
|---|
| 563 | | - cmd.rlen = 10; |
|---|
| 513 | + cmd_init(&cmd, "\x11", 1, 10); |
|---|
| 564 | 514 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 565 | 515 | if (ret) |
|---|
| 566 | 516 | goto err; |
|---|
| .. | .. |
|---|
| 618 | 568 | if (dev->version > ('B' << 24 | 4 << 16 | 0 << 8 | 11 << 0)) |
|---|
| 619 | 569 | dev->warm = false; |
|---|
| 620 | 570 | |
|---|
| 621 | | - memcpy(cmd.args, "\x13", 1); |
|---|
| 622 | | - cmd.wlen = 1; |
|---|
| 623 | | - cmd.rlen = 0; |
|---|
| 571 | + cmd_init(&cmd, "\x13", 1, 0); |
|---|
| 624 | 572 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 625 | 573 | if (ret) |
|---|
| 626 | 574 | goto err; |
|---|
| .. | .. |
|---|
| 646 | 594 | struct si2168_cmd cmd; |
|---|
| 647 | 595 | |
|---|
| 648 | 596 | /* open I2C gate */ |
|---|
| 649 | | - memcpy(cmd.args, "\xc0\x0d\x01", 3); |
|---|
| 650 | | - cmd.wlen = 3; |
|---|
| 651 | | - cmd.rlen = 0; |
|---|
| 597 | + cmd_init(&cmd, "\xc0\x0d\x01", 3, 0); |
|---|
| 652 | 598 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 653 | 599 | if (ret) |
|---|
| 654 | 600 | goto err; |
|---|
| .. | .. |
|---|
| 666 | 612 | struct si2168_cmd cmd; |
|---|
| 667 | 613 | |
|---|
| 668 | 614 | /* close I2C gate */ |
|---|
| 669 | | - memcpy(cmd.args, "\xc0\x0d\x00", 3); |
|---|
| 670 | | - cmd.wlen = 3; |
|---|
| 671 | | - cmd.rlen = 0; |
|---|
| 615 | + cmd_init(&cmd, "\xc0\x0d\x00", 3, 0); |
|---|
| 672 | 616 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 673 | 617 | if (ret) |
|---|
| 674 | 618 | goto err; |
|---|
| .. | .. |
|---|
| 683 | 627 | .delsys = {SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_A}, |
|---|
| 684 | 628 | .info = { |
|---|
| 685 | 629 | .name = "Silicon Labs Si2168", |
|---|
| 686 | | - .symbol_rate_min = 1000000, |
|---|
| 687 | | - .symbol_rate_max = 7200000, |
|---|
| 630 | + .frequency_min_hz = 48 * MHz, |
|---|
| 631 | + .frequency_max_hz = 870 * MHz, |
|---|
| 632 | + .frequency_stepsize_hz = 62500, |
|---|
| 633 | + .symbol_rate_min = 1000000, |
|---|
| 634 | + .symbol_rate_max = 7200000, |
|---|
| 688 | 635 | .caps = FE_CAN_FEC_1_2 | |
|---|
| 689 | 636 | FE_CAN_FEC_2_3 | |
|---|
| 690 | 637 | FE_CAN_FEC_3_4 | |
|---|
| .. | .. |
|---|
| 736 | 683 | mutex_init(&dev->i2c_mutex); |
|---|
| 737 | 684 | |
|---|
| 738 | 685 | /* Initialize */ |
|---|
| 739 | | - memcpy(cmd.args, "\xc0\x12\x00\x0c\x00\x0d\x16\x00\x00\x00\x00\x00\x00", 13); |
|---|
| 740 | | - cmd.wlen = 13; |
|---|
| 741 | | - cmd.rlen = 0; |
|---|
| 686 | + cmd_init(&cmd, "\xc0\x12\x00\x0c\x00\x0d\x16\x00\x00\x00\x00\x00\x00", |
|---|
| 687 | + 13, 0); |
|---|
| 742 | 688 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 743 | 689 | if (ret) |
|---|
| 744 | 690 | goto err_kfree; |
|---|
| 745 | 691 | |
|---|
| 746 | 692 | /* Power up */ |
|---|
| 747 | | - memcpy(cmd.args, "\xc0\x06\x01\x0f\x00\x20\x20\x01", 8); |
|---|
| 748 | | - cmd.wlen = 8; |
|---|
| 749 | | - cmd.rlen = 1; |
|---|
| 693 | + cmd_init(&cmd, "\xc0\x06\x01\x0f\x00\x20\x20\x01", 8, 1); |
|---|
| 750 | 694 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 751 | 695 | if (ret) |
|---|
| 752 | 696 | goto err_kfree; |
|---|
| 753 | 697 | |
|---|
| 754 | 698 | /* Query chip revision */ |
|---|
| 755 | | - memcpy(cmd.args, "\x02", 1); |
|---|
| 756 | | - cmd.wlen = 1; |
|---|
| 757 | | - cmd.rlen = 13; |
|---|
| 699 | + cmd_init(&cmd, "\x02", 1, 13); |
|---|
| 758 | 700 | ret = si2168_cmd_execute(client, &cmd); |
|---|
| 759 | 701 | if (ret) |
|---|
| 760 | 702 | goto err_kfree; |
|---|