| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * |
|---|
| 3 | | - * |
|---|
| 4 | 4 | * Copyright (C) 2007 Mike Isely <isely@pobox.com> |
|---|
| 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 |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | | - * |
|---|
| 15 | 5 | */ |
|---|
| 16 | 6 | |
|---|
| 17 | 7 | /* |
|---|
| .. | .. |
|---|
| 37 | 27 | #include "tda18271.h" |
|---|
| 38 | 28 | #include "tda8290.h" |
|---|
| 39 | 29 | #include "tuner-simple.h" |
|---|
| 30 | +#include "si2157.h" |
|---|
| 31 | +#include "lgdt3306a.h" |
|---|
| 32 | +#include "si2168.h" |
|---|
| 40 | 33 | #endif |
|---|
| 41 | 34 | |
|---|
| 42 | 35 | |
|---|
| .. | .. |
|---|
| 188 | 181 | |
|---|
| 189 | 182 | static int pvr2_lgdt3303_attach(struct pvr2_dvb_adapter *adap) |
|---|
| 190 | 183 | { |
|---|
| 191 | | - adap->fe = dvb_attach(lgdt330x_attach, &pvr2_lgdt3303_config, |
|---|
| 192 | | - 0x0e, |
|---|
| 193 | | - &adap->channel.hdw->i2c_adap); |
|---|
| 194 | | - if (adap->fe) |
|---|
| 184 | + adap->fe[0] = dvb_attach(lgdt330x_attach, &pvr2_lgdt3303_config, |
|---|
| 185 | + 0x0e, |
|---|
| 186 | + &adap->channel.hdw->i2c_adap); |
|---|
| 187 | + if (adap->fe[0]) |
|---|
| 195 | 188 | return 0; |
|---|
| 196 | 189 | |
|---|
| 197 | 190 | return -EIO; |
|---|
| .. | .. |
|---|
| 199 | 192 | |
|---|
| 200 | 193 | static int pvr2_lgh06xf_attach(struct pvr2_dvb_adapter *adap) |
|---|
| 201 | 194 | { |
|---|
| 202 | | - dvb_attach(simple_tuner_attach, adap->fe, |
|---|
| 195 | + dvb_attach(simple_tuner_attach, adap->fe[0], |
|---|
| 203 | 196 | &adap->channel.hdw->i2c_adap, 0x61, |
|---|
| 204 | 197 | TUNER_LG_TDVS_H06XF); |
|---|
| 205 | 198 | |
|---|
| .. | .. |
|---|
| 248 | 241 | |
|---|
| 249 | 242 | static int pvr2_lgdt3302_attach(struct pvr2_dvb_adapter *adap) |
|---|
| 250 | 243 | { |
|---|
| 251 | | - adap->fe = dvb_attach(lgdt330x_attach, &pvr2_lgdt3302_config, |
|---|
| 252 | | - 0x0e, |
|---|
| 253 | | - &adap->channel.hdw->i2c_adap); |
|---|
| 254 | | - if (adap->fe) |
|---|
| 244 | + adap->fe[0] = dvb_attach(lgdt330x_attach, &pvr2_lgdt3302_config, |
|---|
| 245 | + 0x0e, |
|---|
| 246 | + &adap->channel.hdw->i2c_adap); |
|---|
| 247 | + if (adap->fe[0]) |
|---|
| 255 | 248 | return 0; |
|---|
| 256 | 249 | |
|---|
| 257 | 250 | return -EIO; |
|---|
| .. | .. |
|---|
| 259 | 252 | |
|---|
| 260 | 253 | static int pvr2_fcv1236d_attach(struct pvr2_dvb_adapter *adap) |
|---|
| 261 | 254 | { |
|---|
| 262 | | - dvb_attach(simple_tuner_attach, adap->fe, |
|---|
| 255 | + dvb_attach(simple_tuner_attach, adap->fe[0], |
|---|
| 263 | 256 | &adap->channel.hdw->i2c_adap, 0x61, |
|---|
| 264 | 257 | TUNER_PHILIPS_FCV1236D); |
|---|
| 265 | 258 | |
|---|
| .. | .. |
|---|
| 335 | 328 | |
|---|
| 336 | 329 | static int pvr2_tda10048_attach(struct pvr2_dvb_adapter *adap) |
|---|
| 337 | 330 | { |
|---|
| 338 | | - adap->fe = dvb_attach(tda10048_attach, &hauppauge_tda10048_config, |
|---|
| 339 | | - &adap->channel.hdw->i2c_adap); |
|---|
| 340 | | - if (adap->fe) |
|---|
| 331 | + adap->fe[0] = dvb_attach(tda10048_attach, &hauppauge_tda10048_config, |
|---|
| 332 | + &adap->channel.hdw->i2c_adap); |
|---|
| 333 | + if (adap->fe[0]) |
|---|
| 341 | 334 | return 0; |
|---|
| 342 | 335 | |
|---|
| 343 | 336 | return -EIO; |
|---|
| .. | .. |
|---|
| 345 | 338 | |
|---|
| 346 | 339 | static int pvr2_73xxx_tda18271_8295_attach(struct pvr2_dvb_adapter *adap) |
|---|
| 347 | 340 | { |
|---|
| 348 | | - dvb_attach(tda829x_attach, adap->fe, |
|---|
| 341 | + dvb_attach(tda829x_attach, adap->fe[0], |
|---|
| 349 | 342 | &adap->channel.hdw->i2c_adap, 0x42, |
|---|
| 350 | 343 | &tda829x_no_probe); |
|---|
| 351 | | - dvb_attach(tda18271_attach, adap->fe, 0x60, |
|---|
| 344 | + dvb_attach(tda18271_attach, adap->fe[0], 0x60, |
|---|
| 352 | 345 | &adap->channel.hdw->i2c_adap, |
|---|
| 353 | 346 | &hauppauge_tda18271_dvb_config); |
|---|
| 354 | 347 | |
|---|
| .. | .. |
|---|
| 433 | 426 | |
|---|
| 434 | 427 | static int pvr2_s5h1409_attach(struct pvr2_dvb_adapter *adap) |
|---|
| 435 | 428 | { |
|---|
| 436 | | - adap->fe = dvb_attach(s5h1409_attach, &pvr2_s5h1409_config, |
|---|
| 437 | | - &adap->channel.hdw->i2c_adap); |
|---|
| 438 | | - if (adap->fe) |
|---|
| 429 | + adap->fe[0] = dvb_attach(s5h1409_attach, &pvr2_s5h1409_config, |
|---|
| 430 | + &adap->channel.hdw->i2c_adap); |
|---|
| 431 | + if (adap->fe[0]) |
|---|
| 439 | 432 | return 0; |
|---|
| 440 | 433 | |
|---|
| 441 | 434 | return -EIO; |
|---|
| .. | .. |
|---|
| 443 | 436 | |
|---|
| 444 | 437 | static int pvr2_s5h1411_attach(struct pvr2_dvb_adapter *adap) |
|---|
| 445 | 438 | { |
|---|
| 446 | | - adap->fe = dvb_attach(s5h1411_attach, &pvr2_s5h1411_config, |
|---|
| 447 | | - &adap->channel.hdw->i2c_adap); |
|---|
| 448 | | - if (adap->fe) |
|---|
| 439 | + adap->fe[0] = dvb_attach(s5h1411_attach, &pvr2_s5h1411_config, |
|---|
| 440 | + &adap->channel.hdw->i2c_adap); |
|---|
| 441 | + if (adap->fe[0]) |
|---|
| 449 | 442 | return 0; |
|---|
| 450 | 443 | |
|---|
| 451 | 444 | return -EIO; |
|---|
| .. | .. |
|---|
| 453 | 446 | |
|---|
| 454 | 447 | static int pvr2_tda18271_8295_attach(struct pvr2_dvb_adapter *adap) |
|---|
| 455 | 448 | { |
|---|
| 456 | | - dvb_attach(tda829x_attach, adap->fe, |
|---|
| 449 | + dvb_attach(tda829x_attach, adap->fe[0], |
|---|
| 457 | 450 | &adap->channel.hdw->i2c_adap, 0x42, |
|---|
| 458 | 451 | &tda829x_no_probe); |
|---|
| 459 | | - dvb_attach(tda18271_attach, adap->fe, 0x60, |
|---|
| 452 | + dvb_attach(tda18271_attach, adap->fe[0], 0x60, |
|---|
| 460 | 453 | &adap->channel.hdw->i2c_adap, |
|---|
| 461 | 454 | &hauppauge_tda18271_config); |
|---|
| 462 | 455 | |
|---|
| .. | .. |
|---|
| 525 | 518 | #endif |
|---|
| 526 | 519 | }; |
|---|
| 527 | 520 | |
|---|
| 521 | +/*------------------------------------------------------------------------*/ |
|---|
| 522 | +/* Hauppauge PVR-USB2 Model 160000 / 160111 -- HVR-1955 / HVR-1975 */ |
|---|
| 528 | 523 | |
|---|
| 524 | +#ifdef CONFIG_VIDEO_PVRUSB2_DVB |
|---|
| 525 | +static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap); |
|---|
| 526 | +static int pvr2_si2168_attach(struct pvr2_dvb_adapter *adap); |
|---|
| 527 | +static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap); |
|---|
| 528 | +static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap); |
|---|
| 529 | + |
|---|
| 530 | +static const struct pvr2_dvb_props pvr2_160000_dvb_props = { |
|---|
| 531 | + .frontend_attach = pvr2_dual_fe_attach, |
|---|
| 532 | + .tuner_attach = pvr2_si2157_attach, |
|---|
| 533 | +}; |
|---|
| 534 | + |
|---|
| 535 | +static const struct pvr2_dvb_props pvr2_160111_dvb_props = { |
|---|
| 536 | + .frontend_attach = pvr2_lgdt3306a_attach, |
|---|
| 537 | + .tuner_attach = pvr2_si2157_attach, |
|---|
| 538 | +}; |
|---|
| 539 | + |
|---|
| 540 | +static int pvr2_si2157_attach(struct pvr2_dvb_adapter *adap) |
|---|
| 541 | +{ |
|---|
| 542 | + struct si2157_config si2157_config = {}; |
|---|
| 543 | + |
|---|
| 544 | + si2157_config.inversion = 1; |
|---|
| 545 | + si2157_config.fe = adap->fe[0]; |
|---|
| 546 | + |
|---|
| 547 | + adap->i2c_client_tuner = dvb_module_probe("si2157", "si2177", |
|---|
| 548 | + &adap->channel.hdw->i2c_adap, |
|---|
| 549 | + 0x60, &si2157_config); |
|---|
| 550 | + |
|---|
| 551 | + if (!adap->i2c_client_tuner) |
|---|
| 552 | + return -ENODEV; |
|---|
| 553 | + |
|---|
| 554 | + return 0; |
|---|
| 555 | +} |
|---|
| 556 | + |
|---|
| 557 | +static int pvr2_si2168_attach(struct pvr2_dvb_adapter *adap) |
|---|
| 558 | +{ |
|---|
| 559 | + struct si2168_config si2168_config = {}; |
|---|
| 560 | + struct i2c_adapter *adapter; |
|---|
| 561 | + |
|---|
| 562 | + pr_debug("%s()\n", __func__); |
|---|
| 563 | + |
|---|
| 564 | + si2168_config.fe = &adap->fe[1]; |
|---|
| 565 | + si2168_config.i2c_adapter = &adapter; |
|---|
| 566 | + si2168_config.ts_mode = SI2168_TS_PARALLEL; /*2, 1-serial, 2-parallel.*/ |
|---|
| 567 | + si2168_config.ts_clock_gapped = 1; /*0-disabled, 1-enabled.*/ |
|---|
| 568 | + si2168_config.ts_clock_inv = 0; /*0-not-invert, 1-invert*/ |
|---|
| 569 | + si2168_config.spectral_inversion = 1; /*0-not-invert, 1-invert*/ |
|---|
| 570 | + |
|---|
| 571 | + adap->i2c_client_demod[1] = dvb_module_probe("si2168", NULL, |
|---|
| 572 | + &adap->channel.hdw->i2c_adap, |
|---|
| 573 | + 0x64, &si2168_config); |
|---|
| 574 | + |
|---|
| 575 | + if (!adap->i2c_client_demod[1]) |
|---|
| 576 | + return -ENODEV; |
|---|
| 577 | + |
|---|
| 578 | + return 0; |
|---|
| 579 | +} |
|---|
| 580 | + |
|---|
| 581 | +static int pvr2_lgdt3306a_attach(struct pvr2_dvb_adapter *adap) |
|---|
| 582 | +{ |
|---|
| 583 | + struct lgdt3306a_config lgdt3306a_config; |
|---|
| 584 | + struct i2c_adapter *adapter; |
|---|
| 585 | + |
|---|
| 586 | + pr_debug("%s()\n", __func__); |
|---|
| 587 | + |
|---|
| 588 | + lgdt3306a_config.fe = &adap->fe[0]; |
|---|
| 589 | + lgdt3306a_config.i2c_adapter = &adapter; |
|---|
| 590 | + lgdt3306a_config.deny_i2c_rptr = 1; |
|---|
| 591 | + lgdt3306a_config.spectral_inversion = 1; |
|---|
| 592 | + lgdt3306a_config.qam_if_khz = 4000; |
|---|
| 593 | + lgdt3306a_config.vsb_if_khz = 3250; |
|---|
| 594 | + lgdt3306a_config.mpeg_mode = LGDT3306A_MPEG_PARALLEL; |
|---|
| 595 | + lgdt3306a_config.tpclk_edge = LGDT3306A_TPCLK_FALLING_EDGE; |
|---|
| 596 | + lgdt3306a_config.tpvalid_polarity = LGDT3306A_TP_VALID_LOW; |
|---|
| 597 | + lgdt3306a_config.xtalMHz = 25, /* demod clock MHz; 24/25 supported */ |
|---|
| 598 | + |
|---|
| 599 | + adap->i2c_client_demod[0] = dvb_module_probe("lgdt3306a", NULL, |
|---|
| 600 | + &adap->channel.hdw->i2c_adap, |
|---|
| 601 | + 0x59, &lgdt3306a_config); |
|---|
| 602 | + |
|---|
| 603 | + if (!adap->i2c_client_demod[0]) |
|---|
| 604 | + return -ENODEV; |
|---|
| 605 | + |
|---|
| 606 | + return 0; |
|---|
| 607 | +} |
|---|
| 608 | + |
|---|
| 609 | +static int pvr2_dual_fe_attach(struct pvr2_dvb_adapter *adap) |
|---|
| 610 | +{ |
|---|
| 611 | + pr_debug("%s()\n", __func__); |
|---|
| 612 | + |
|---|
| 613 | + if (pvr2_lgdt3306a_attach(adap) != 0) |
|---|
| 614 | + return -ENODEV; |
|---|
| 615 | + |
|---|
| 616 | + if (pvr2_si2168_attach(adap) != 0) { |
|---|
| 617 | + dvb_module_release(adap->i2c_client_demod[0]); |
|---|
| 618 | + return -ENODEV; |
|---|
| 619 | + } |
|---|
| 620 | + |
|---|
| 621 | + return 0; |
|---|
| 622 | +} |
|---|
| 623 | +#endif |
|---|
| 624 | + |
|---|
| 625 | +#define PVR2_FIRMWARE_160xxx "v4l-pvrusb2-160xxx-01.fw" |
|---|
| 626 | +static const char *pvr2_fw1_names_160xxx[] = { |
|---|
| 627 | + PVR2_FIRMWARE_160xxx, |
|---|
| 628 | +}; |
|---|
| 629 | + |
|---|
| 630 | +static const struct pvr2_device_client_desc pvr2_cli_160xxx[] = { |
|---|
| 631 | + { .module_id = PVR2_CLIENT_ID_CX25840 }, |
|---|
| 632 | +}; |
|---|
| 633 | + |
|---|
| 634 | +static const struct pvr2_device_desc pvr2_device_160000 = { |
|---|
| 635 | + .description = "WinTV HVR-1975 Model 160000", |
|---|
| 636 | + .shortname = "160000", |
|---|
| 637 | + .client_table.lst = pvr2_cli_160xxx, |
|---|
| 638 | + .client_table.cnt = ARRAY_SIZE(pvr2_cli_160xxx), |
|---|
| 639 | + .fx2_firmware.lst = pvr2_fw1_names_160xxx, |
|---|
| 640 | + .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_160xxx), |
|---|
| 641 | + .default_tuner_type = TUNER_ABSENT, |
|---|
| 642 | + .flag_has_cx25840 = 1, |
|---|
| 643 | + .flag_has_hauppauge_rom = 1, |
|---|
| 644 | + .flag_has_analogtuner = 1, |
|---|
| 645 | + .flag_has_composite = 1, |
|---|
| 646 | + .flag_has_svideo = 1, |
|---|
| 647 | + .flag_fx2_16kb = 1, |
|---|
| 648 | + .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE, |
|---|
| 649 | + .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE, |
|---|
| 650 | + .default_std_mask = V4L2_STD_NTSC_M, |
|---|
| 651 | + .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE, |
|---|
| 652 | + .ir_scheme = PVR2_IR_SCHEME_ZILOG, |
|---|
| 653 | +#ifdef CONFIG_VIDEO_PVRUSB2_DVB |
|---|
| 654 | + .dvb_props = &pvr2_160000_dvb_props, |
|---|
| 655 | +#endif |
|---|
| 656 | +}; |
|---|
| 657 | + |
|---|
| 658 | +static const struct pvr2_device_desc pvr2_device_160111 = { |
|---|
| 659 | + .description = "WinTV HVR-1955 Model 160111", |
|---|
| 660 | + .shortname = "160111", |
|---|
| 661 | + .client_table.lst = pvr2_cli_160xxx, |
|---|
| 662 | + .client_table.cnt = ARRAY_SIZE(pvr2_cli_160xxx), |
|---|
| 663 | + .fx2_firmware.lst = pvr2_fw1_names_160xxx, |
|---|
| 664 | + .fx2_firmware.cnt = ARRAY_SIZE(pvr2_fw1_names_160xxx), |
|---|
| 665 | + .default_tuner_type = TUNER_ABSENT, |
|---|
| 666 | + .flag_has_cx25840 = 1, |
|---|
| 667 | + .flag_has_hauppauge_rom = 1, |
|---|
| 668 | + .flag_has_analogtuner = 1, |
|---|
| 669 | + .flag_has_composite = 1, |
|---|
| 670 | + .flag_has_svideo = 1, |
|---|
| 671 | + .flag_fx2_16kb = 1, |
|---|
| 672 | + .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE, |
|---|
| 673 | + .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE, |
|---|
| 674 | + .default_std_mask = V4L2_STD_NTSC_M, |
|---|
| 675 | + .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE, |
|---|
| 676 | + .ir_scheme = PVR2_IR_SCHEME_ZILOG, |
|---|
| 677 | +#ifdef CONFIG_VIDEO_PVRUSB2_DVB |
|---|
| 678 | + .dvb_props = &pvr2_160111_dvb_props, |
|---|
| 679 | +#endif |
|---|
| 680 | +}; |
|---|
| 529 | 681 | |
|---|
| 530 | 682 | /*------------------------------------------------------------------------*/ |
|---|
| 531 | 683 | |
|---|
| .. | .. |
|---|
| 552 | 704 | .driver_info = (kernel_ulong_t)&pvr2_device_751xx}, |
|---|
| 553 | 705 | { USB_DEVICE(0x0ccd, 0x0039), |
|---|
| 554 | 706 | .driver_info = (kernel_ulong_t)&pvr2_device_av400}, |
|---|
| 707 | + { USB_DEVICE(0x2040, 0x7502), |
|---|
| 708 | + .driver_info = (kernel_ulong_t)&pvr2_device_160111}, |
|---|
| 709 | + { USB_DEVICE(0x2040, 0x7510), |
|---|
| 710 | + .driver_info = (kernel_ulong_t)&pvr2_device_160000}, |
|---|
| 555 | 711 | { } |
|---|
| 556 | 712 | }; |
|---|
| 557 | 713 | |
|---|