diff options
Diffstat (limited to 'drivers/media/dvb/b2c2/flexcop-fe-tuner.c')
| -rw-r--r-- | drivers/media/dvb/b2c2/flexcop-fe-tuner.c | 67 |
1 files changed, 37 insertions, 30 deletions
diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c index efb4a6c2b57a..9a6307a347b2 100644 --- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c +++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c | |||
| @@ -20,8 +20,14 @@ | |||
| 20 | #include "tuner-simple.h" | 20 | #include "tuner-simple.h" |
| 21 | #include "stv0297.h" | 21 | #include "stv0297.h" |
| 22 | 22 | ||
| 23 | |||
| 24 | /* Can we use the specified front-end? Remember that if we are compiled | ||
| 25 | * into the kernel we can't call code that's in modules. */ | ||
| 26 | #define FE_SUPPORTED(fe) (defined(CONFIG_DVB_##fe) || \ | ||
| 27 | (defined(CONFIG_DVB_##fe##_MODULE) && defined(MODULE))) | ||
| 28 | |||
| 23 | /* lnb control */ | 29 | /* lnb control */ |
| 24 | #if defined(CONFIG_DVB_MT312_MODULE) || defined(CONFIG_DVB_STV0299_MODULE) | 30 | #if FE_SUPPORTED(MT312) || FE_SUPPORTED(STV0299) |
| 25 | static int flexcop_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) | 31 | static int flexcop_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) |
| 26 | { | 32 | { |
| 27 | struct flexcop_device *fc = fe->dvb->priv; | 33 | struct flexcop_device *fc = fe->dvb->priv; |
| @@ -49,8 +55,7 @@ static int flexcop_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage | |||
| 49 | } | 55 | } |
| 50 | #endif | 56 | #endif |
| 51 | 57 | ||
| 52 | #if defined(CONFIG_DVB_S5H1420_MODULE) || defined(CONFIG_DVB_STV0299_MODULE) \ | 58 | #if FE_SUPPORTED(S5H1420) || FE_SUPPORTED(STV0299) || FE_SUPPORTED(MT312) |
| 53 | || defined(CONFIG_DVB_MT312_MODULE) | ||
| 54 | static int flexcop_sleep(struct dvb_frontend* fe) | 59 | static int flexcop_sleep(struct dvb_frontend* fe) |
| 55 | { | 60 | { |
| 56 | struct flexcop_device *fc = fe->dvb->priv; | 61 | struct flexcop_device *fc = fe->dvb->priv; |
| @@ -61,7 +66,7 @@ static int flexcop_sleep(struct dvb_frontend* fe) | |||
| 61 | #endif | 66 | #endif |
| 62 | 67 | ||
| 63 | /* SkyStar2 DVB-S rev 2.3 */ | 68 | /* SkyStar2 DVB-S rev 2.3 */ |
| 64 | #if defined(CONFIG_DVB_MT312_MODULE) | 69 | #if FE_SUPPORTED(MT312) |
| 65 | static int flexcop_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone) | 70 | static int flexcop_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone) |
| 66 | { | 71 | { |
| 67 | /* u16 wz_half_period_for_45_mhz[] = { 0x01ff, 0x0154, 0x00ff, 0x00cc }; */ | 72 | /* u16 wz_half_period_for_45_mhz[] = { 0x01ff, 0x0154, 0x00ff, 0x00cc }; */ |
| @@ -193,10 +198,12 @@ static int skystar2_rev23_attach(struct flexcop_device *fc, | |||
| 193 | } | 198 | } |
| 194 | return 0; | 199 | return 0; |
| 195 | } | 200 | } |
| 201 | #else | ||
| 202 | #define skystar2_rev23_attach NULL | ||
| 196 | #endif | 203 | #endif |
| 197 | 204 | ||
| 198 | /* SkyStar2 DVB-S rev 2.6 */ | 205 | /* SkyStar2 DVB-S rev 2.6 */ |
| 199 | #if defined(CONFIG_DVB_STV0299_MODULE) | 206 | #if FE_SUPPORTED(STV0299) |
| 200 | static int samsung_tbmu24112_set_symbol_rate(struct dvb_frontend *fe, | 207 | static int samsung_tbmu24112_set_symbol_rate(struct dvb_frontend *fe, |
| 201 | u32 srate, u32 ratio) | 208 | u32 srate, u32 ratio) |
| 202 | { | 209 | { |
| @@ -321,10 +328,12 @@ static int skystar2_rev26_attach(struct flexcop_device *fc, | |||
| 321 | } | 328 | } |
| 322 | return 0; | 329 | return 0; |
| 323 | } | 330 | } |
| 331 | #else | ||
| 332 | #define skystar2_rev26_attach NULL | ||
| 324 | #endif | 333 | #endif |
| 325 | 334 | ||
| 326 | /* SkyStar2 DVB-S rev 2.7 */ | 335 | /* SkyStar2 DVB-S rev 2.7 */ |
| 327 | #if defined(CONFIG_DVB_S5H1420_MODULE) | 336 | #if FE_SUPPORTED(S5H1420) && FE_SUPPORTED(ISL6421) && FE_SUPPORTED(TUNER_ITD1000) |
| 328 | static struct s5h1420_config skystar2_rev2_7_s5h1420_config = { | 337 | static struct s5h1420_config skystar2_rev2_7_s5h1420_config = { |
| 329 | .demod_address = 0x53, | 338 | .demod_address = 0x53, |
| 330 | .invert = 1, | 339 | .invert = 1, |
| @@ -385,10 +394,12 @@ fail: | |||
| 385 | fc->fc_i2c_adap[0].no_base_addr = 0; | 394 | fc->fc_i2c_adap[0].no_base_addr = 0; |
| 386 | return 0; | 395 | return 0; |
| 387 | } | 396 | } |
| 397 | #else | ||
| 398 | #define skystar2_rev27_attach NULL | ||
| 388 | #endif | 399 | #endif |
| 389 | 400 | ||
| 390 | /* SkyStar2 rev 2.8 */ | 401 | /* SkyStar2 rev 2.8 */ |
| 391 | #if defined(CONFIG_DVB_CX24123_MODULE) | 402 | #if FE_SUPPORTED(CX24123) && FE_SUPPORTED(ISL6421) && FE_SUPPORTED(TUNER_CX24113) |
| 392 | static struct cx24123_config skystar2_rev2_8_cx24123_config = { | 403 | static struct cx24123_config skystar2_rev2_8_cx24123_config = { |
| 393 | .demod_address = 0x55, | 404 | .demod_address = 0x55, |
| 394 | .dont_use_pll = 1, | 405 | .dont_use_pll = 1, |
| @@ -433,10 +444,12 @@ static int skystar2_rev28_attach(struct flexcop_device *fc, | |||
| 433 | * IR-receiver (PIC16F818) - but the card has no input for that ??? */ | 444 | * IR-receiver (PIC16F818) - but the card has no input for that ??? */ |
| 434 | return 1; | 445 | return 1; |
| 435 | } | 446 | } |
| 447 | #else | ||
| 448 | #define skystar2_rev28_attach NULL | ||
| 436 | #endif | 449 | #endif |
| 437 | 450 | ||
| 438 | /* AirStar DVB-T */ | 451 | /* AirStar DVB-T */ |
| 439 | #if defined(CONFIG_DVB_MT352_MODULE) | 452 | #if FE_SUPPORTED(MT352) |
| 440 | static int samsung_tdtc9251dh0_demod_init(struct dvb_frontend *fe) | 453 | static int samsung_tdtc9251dh0_demod_init(struct dvb_frontend *fe) |
| 441 | { | 454 | { |
| 442 | static u8 mt352_clock_config[] = { 0x89, 0x18, 0x2d }; | 455 | static u8 mt352_clock_config[] = { 0x89, 0x18, 0x2d }; |
| @@ -495,10 +508,12 @@ static int airstar_dvbt_attach(struct flexcop_device *fc, | |||
| 495 | } | 508 | } |
| 496 | return 0; | 509 | return 0; |
| 497 | } | 510 | } |
| 511 | #else | ||
| 512 | #define airstar_dvbt_attach NULL | ||
| 498 | #endif | 513 | #endif |
| 499 | 514 | ||
| 500 | /* AirStar ATSC 1st generation */ | 515 | /* AirStar ATSC 1st generation */ |
| 501 | #if defined(CONFIG_DVB_BCM3510_MODULE) | 516 | #if FE_SUPPORTED(BCM3510) |
| 502 | static int flexcop_fe_request_firmware(struct dvb_frontend *fe, | 517 | static int flexcop_fe_request_firmware(struct dvb_frontend *fe, |
| 503 | const struct firmware **fw, char* name) | 518 | const struct firmware **fw, char* name) |
| 504 | { | 519 | { |
| @@ -517,10 +532,12 @@ static int airstar_atsc1_attach(struct flexcop_device *fc, | |||
| 517 | fc->fe = dvb_attach(bcm3510_attach, &air2pc_atsc_first_gen_config, i2c); | 532 | fc->fe = dvb_attach(bcm3510_attach, &air2pc_atsc_first_gen_config, i2c); |
| 518 | return fc->fe != NULL; | 533 | return fc->fe != NULL; |
| 519 | } | 534 | } |
| 535 | #else | ||
| 536 | #define airstar_atsc1_attach NULL | ||
| 520 | #endif | 537 | #endif |
| 521 | 538 | ||
| 522 | /* AirStar ATSC 2nd generation */ | 539 | /* AirStar ATSC 2nd generation */ |
| 523 | #if defined(CONFIG_DVB_NXT200X_MODULE) | 540 | #if FE_SUPPORTED(NXT200X) && FE_SUPPORTED(PLL) |
| 524 | static struct nxt200x_config samsung_tbmv_config = { | 541 | static struct nxt200x_config samsung_tbmv_config = { |
| 525 | .demod_address = 0x0a, | 542 | .demod_address = 0x0a, |
| 526 | }; | 543 | }; |
| @@ -535,10 +552,12 @@ static int airstar_atsc2_attach(struct flexcop_device *fc, | |||
| 535 | return !!dvb_attach(dvb_pll_attach, fc->fe, 0x61, NULL, | 552 | return !!dvb_attach(dvb_pll_attach, fc->fe, 0x61, NULL, |
| 536 | DVB_PLL_SAMSUNG_TBMV); | 553 | DVB_PLL_SAMSUNG_TBMV); |
| 537 | } | 554 | } |
| 555 | #else | ||
| 556 | #define airstar_atsc2_attach NULL | ||
| 538 | #endif | 557 | #endif |
| 539 | 558 | ||
| 540 | /* AirStar ATSC 3rd generation */ | 559 | /* AirStar ATSC 3rd generation */ |
| 541 | #if defined(CONFIG_DVB_LGDT330X_MODULE) | 560 | #if FE_SUPPORTED(LGDT330X) |
| 542 | static struct lgdt330x_config air2pc_atsc_hd5000_config = { | 561 | static struct lgdt330x_config air2pc_atsc_hd5000_config = { |
| 543 | .demod_address = 0x59, | 562 | .demod_address = 0x59, |
| 544 | .demod_chip = LGDT3303, | 563 | .demod_chip = LGDT3303, |
| @@ -556,10 +575,12 @@ static int airstar_atsc3_attach(struct flexcop_device *fc, | |||
| 556 | return !!dvb_attach(simple_tuner_attach, fc->fe, i2c, 0x61, | 575 | return !!dvb_attach(simple_tuner_attach, fc->fe, i2c, 0x61, |
| 557 | TUNER_LG_TDVS_H06XF); | 576 | TUNER_LG_TDVS_H06XF); |
| 558 | } | 577 | } |
| 578 | #else | ||
| 579 | #define airstar_atsc3_attach NULL | ||
| 559 | #endif | 580 | #endif |
| 560 | 581 | ||
| 561 | /* CableStar2 DVB-C */ | 582 | /* CableStar2 DVB-C */ |
| 562 | #if defined(CONFIG_DVB_STV0297_MODULE) | 583 | #if FE_SUPPORTED(STV0297) |
| 563 | static int alps_tdee4_stv0297_tuner_set_params(struct dvb_frontend* fe, | 584 | static int alps_tdee4_stv0297_tuner_set_params(struct dvb_frontend* fe, |
| 564 | struct dvb_frontend_parameters *fep) | 585 | struct dvb_frontend_parameters *fep) |
| 565 | { | 586 | { |
| @@ -698,39 +719,23 @@ static int cablestar2_attach(struct flexcop_device *fc, | |||
| 698 | fc->fe->ops.tuner_ops.set_params = alps_tdee4_stv0297_tuner_set_params; | 719 | fc->fe->ops.tuner_ops.set_params = alps_tdee4_stv0297_tuner_set_params; |
| 699 | return 1; | 720 | return 1; |
| 700 | } | 721 | } |
| 722 | #else | ||
| 723 | #define cablestar2_attach NULL | ||
| 701 | #endif | 724 | #endif |
| 702 | 725 | ||
| 703 | static struct { | 726 | static struct { |
| 704 | flexcop_device_type_t type; | 727 | flexcop_device_type_t type; |
| 705 | int (*attach)(struct flexcop_device *, struct i2c_adapter *); | 728 | int (*attach)(struct flexcop_device *, struct i2c_adapter *); |
| 706 | } flexcop_frontends[] = { | 729 | } flexcop_frontends[] = { |
| 707 | #if defined(CONFIG_DVB_S5H1420_MODULE) | ||
| 708 | { FC_SKY_REV27, skystar2_rev27_attach }, | 730 | { FC_SKY_REV27, skystar2_rev27_attach }, |
| 709 | #endif | ||
| 710 | #if defined(CONFIG_DVB_CX24123_MODULE) | ||
| 711 | { FC_SKY_REV28, skystar2_rev28_attach }, | 731 | { FC_SKY_REV28, skystar2_rev28_attach }, |
| 712 | #endif | ||
| 713 | #if defined(CONFIG_DVB_STV0299_MODULE) | ||
| 714 | { FC_SKY_REV26, skystar2_rev26_attach }, | 732 | { FC_SKY_REV26, skystar2_rev26_attach }, |
| 715 | #endif | ||
| 716 | #if defined(CONFIG_DVB_MT352_MODULE) | ||
| 717 | { FC_AIR_DVBT, airstar_dvbt_attach }, | 733 | { FC_AIR_DVBT, airstar_dvbt_attach }, |
| 718 | #endif | ||
| 719 | #if defined(CONFIG_DVB_NXT200X_MODULE) | ||
| 720 | { FC_AIR_ATSC2, airstar_atsc2_attach }, | 734 | { FC_AIR_ATSC2, airstar_atsc2_attach }, |
| 721 | #endif | ||
| 722 | #if defined(CONFIG_DVB_LGDT330X_MODULE) | ||
| 723 | { FC_AIR_ATSC3, airstar_atsc3_attach }, | 735 | { FC_AIR_ATSC3, airstar_atsc3_attach }, |
| 724 | #endif | ||
| 725 | #if defined(CONFIG_DVB_BCM3510_MODULE) | ||
| 726 | { FC_AIR_ATSC1, airstar_atsc1_attach }, | 736 | { FC_AIR_ATSC1, airstar_atsc1_attach }, |
| 727 | #endif | ||
| 728 | #if defined(CONFIG_DVB_STV0297_MODULE) | ||
| 729 | { FC_CABLE, cablestar2_attach }, | 737 | { FC_CABLE, cablestar2_attach }, |
| 730 | #endif | ||
| 731 | #if defined(CONFIG_DVB_MT312_MODULE) | ||
| 732 | { FC_SKY_REV23, skystar2_rev23_attach }, | 738 | { FC_SKY_REV23, skystar2_rev23_attach }, |
| 733 | #endif | ||
| 734 | }; | 739 | }; |
| 735 | 740 | ||
| 736 | /* try to figure out the frontend */ | 741 | /* try to figure out the frontend */ |
| @@ -738,6 +743,8 @@ int flexcop_frontend_init(struct flexcop_device *fc) | |||
| 738 | { | 743 | { |
| 739 | int i; | 744 | int i; |
| 740 | for (i = 0; i < ARRAY_SIZE(flexcop_frontends); i++) { | 745 | for (i = 0; i < ARRAY_SIZE(flexcop_frontends); i++) { |
| 746 | if (!flexcop_frontends[i].attach) | ||
| 747 | continue; | ||
| 741 | /* type needs to be set before, because of some workarounds | 748 | /* type needs to be set before, because of some workarounds |
| 742 | * done based on the probed card type */ | 749 | * done based on the probed card type */ |
| 743 | fc->dev_type = flexcop_frontends[i].type; | 750 | fc->dev_type = flexcop_frontends[i].type; |
