diff options
Diffstat (limited to 'drivers/media/dvb/ttpci/budget-ci.c')
-rw-r--r-- | drivers/media/dvb/ttpci/budget-ci.c | 59 |
1 files changed, 39 insertions, 20 deletions
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index e64a609cf4ff..4b966eea3834 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c | |||
@@ -620,10 +620,10 @@ static int philips_su1278_tt_set_symbol_rate(struct dvb_frontend *fe, u32 srate, | |||
620 | return 0; | 620 | return 0; |
621 | } | 621 | } |
622 | 622 | ||
623 | static int philips_su1278_tt_pll_set(struct dvb_frontend *fe, | 623 | static int philips_su1278_tt_tuner_set_params(struct dvb_frontend *fe, |
624 | struct i2c_adapter *i2c, | 624 | struct dvb_frontend_parameters *params) |
625 | struct dvb_frontend_parameters *params) | ||
626 | { | 625 | { |
626 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; | ||
627 | u32 div; | 627 | u32 div; |
628 | u8 buf[4]; | 628 | u8 buf[4]; |
629 | struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) }; | 629 | struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) }; |
@@ -649,7 +649,9 @@ static int philips_su1278_tt_pll_set(struct dvb_frontend *fe, | |||
649 | else if (params->frequency < 2150000) | 649 | else if (params->frequency < 2150000) |
650 | buf[3] |= 0xC0; | 650 | buf[3] |= 0xC0; |
651 | 651 | ||
652 | if (i2c_transfer(i2c, &msg, 1) != 1) | 652 | if (fe->ops.i2c_gate_ctrl) |
653 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
654 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &msg, 1) != 1) | ||
653 | return -EIO; | 655 | return -EIO; |
654 | return 0; | 656 | return 0; |
655 | } | 657 | } |
@@ -665,12 +667,11 @@ static struct stv0299_config philips_su1278_tt_config = { | |||
665 | .volt13_op0_op1 = STV0299_VOLT13_OP1, | 667 | .volt13_op0_op1 = STV0299_VOLT13_OP1, |
666 | .min_delay_ms = 50, | 668 | .min_delay_ms = 50, |
667 | .set_symbol_rate = philips_su1278_tt_set_symbol_rate, | 669 | .set_symbol_rate = philips_su1278_tt_set_symbol_rate, |
668 | .pll_set = philips_su1278_tt_pll_set, | ||
669 | }; | 670 | }; |
670 | 671 | ||
671 | 672 | ||
672 | 673 | ||
673 | static int philips_tdm1316l_pll_init(struct dvb_frontend *fe) | 674 | static int philips_tdm1316l_tuner_init(struct dvb_frontend *fe) |
674 | { | 675 | { |
675 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; | 676 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; |
676 | static u8 td1316_init[] = { 0x0b, 0xf5, 0x85, 0xab }; | 677 | static u8 td1316_init[] = { 0x0b, 0xf5, 0x85, 0xab }; |
@@ -679,6 +680,8 @@ static int philips_tdm1316l_pll_init(struct dvb_frontend *fe) | |||
679 | sizeof(td1316_init) }; | 680 | sizeof(td1316_init) }; |
680 | 681 | ||
681 | // setup PLL configuration | 682 | // setup PLL configuration |
683 | if (fe->ops.i2c_gate_ctrl) | ||
684 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
682 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) | 685 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) |
683 | return -EIO; | 686 | return -EIO; |
684 | msleep(1); | 687 | msleep(1); |
@@ -687,14 +690,18 @@ static int philips_tdm1316l_pll_init(struct dvb_frontend *fe) | |||
687 | tuner_msg.addr = 0x65; | 690 | tuner_msg.addr = 0x65; |
688 | tuner_msg.buf = disable_mc44BC374c; | 691 | tuner_msg.buf = disable_mc44BC374c; |
689 | tuner_msg.len = sizeof(disable_mc44BC374c); | 692 | tuner_msg.len = sizeof(disable_mc44BC374c); |
693 | if (fe->ops.i2c_gate_ctrl) | ||
694 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
690 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) { | 695 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) { |
696 | if (fe->ops.i2c_gate_ctrl) | ||
697 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
691 | i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1); | 698 | i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1); |
692 | } | 699 | } |
693 | 700 | ||
694 | return 0; | 701 | return 0; |
695 | } | 702 | } |
696 | 703 | ||
697 | static int philips_tdm1316l_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 704 | static int philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
698 | { | 705 | { |
699 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; | 706 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; |
700 | u8 tuner_buf[4]; | 707 | u8 tuner_buf[4]; |
@@ -770,6 +777,8 @@ static int philips_tdm1316l_pll_set(struct dvb_frontend *fe, struct dvb_frontend | |||
770 | tuner_buf[2] = 0xca; | 777 | tuner_buf[2] = 0xca; |
771 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; | 778 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; |
772 | 779 | ||
780 | if (fe->ops.i2c_gate_ctrl) | ||
781 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
773 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) | 782 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) |
774 | return -EIO; | 783 | return -EIO; |
775 | 784 | ||
@@ -793,13 +802,10 @@ static struct tda1004x_config philips_tdm1316l_config = { | |||
793 | .xtal_freq = TDA10046_XTAL_4M, | 802 | .xtal_freq = TDA10046_XTAL_4M, |
794 | .agc_config = TDA10046_AGC_DEFAULT, | 803 | .agc_config = TDA10046_AGC_DEFAULT, |
795 | .if_freq = TDA10046_FREQ_3617, | 804 | .if_freq = TDA10046_FREQ_3617, |
796 | .pll_init = philips_tdm1316l_pll_init, | ||
797 | .pll_set = philips_tdm1316l_pll_set, | ||
798 | .pll_sleep = NULL, | ||
799 | .request_firmware = philips_tdm1316l_request_firmware, | 805 | .request_firmware = philips_tdm1316l_request_firmware, |
800 | }; | 806 | }; |
801 | 807 | ||
802 | static int dvbc_philips_tdm1316l_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 808 | static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
803 | { | 809 | { |
804 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; | 810 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; |
805 | u8 tuner_buf[5]; | 811 | u8 tuner_buf[5]; |
@@ -857,13 +863,15 @@ static int dvbc_philips_tdm1316l_pll_set(struct dvb_frontend *fe, struct dvb_fro | |||
857 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; | 863 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; |
858 | tuner_buf[4] = 0x80; | 864 | tuner_buf[4] = 0x80; |
859 | 865 | ||
860 | stv0297_enable_plli2c(fe); | 866 | if (fe->ops.i2c_gate_ctrl) |
867 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
861 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) | 868 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) |
862 | return -EIO; | 869 | return -EIO; |
863 | 870 | ||
864 | msleep(50); | 871 | msleep(50); |
865 | 872 | ||
866 | stv0297_enable_plli2c(fe); | 873 | if (fe->ops.i2c_gate_ctrl) |
874 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
867 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) | 875 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) |
868 | return -EIO; | 876 | return -EIO; |
869 | 877 | ||
@@ -969,7 +977,7 @@ static struct stv0297_config dvbc_philips_tdm1316l_config = { | |||
969 | .demod_address = 0x1c, | 977 | .demod_address = 0x1c, |
970 | .inittab = dvbc_philips_tdm1316l_inittab, | 978 | .inittab = dvbc_philips_tdm1316l_inittab, |
971 | .invert = 0, | 979 | .invert = 0, |
972 | .pll_set = dvbc_philips_tdm1316l_pll_set, | 980 | .stop_during_read = 1, |
973 | }; | 981 | }; |
974 | 982 | ||
975 | 983 | ||
@@ -982,6 +990,8 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
982 | budget_ci->budget.dvb_frontend = | 990 | budget_ci->budget.dvb_frontend = |
983 | stv0299_attach(&alps_bsru6_config, &budget_ci->budget.i2c_adap); | 991 | stv0299_attach(&alps_bsru6_config, &budget_ci->budget.i2c_adap); |
984 | if (budget_ci->budget.dvb_frontend) { | 992 | if (budget_ci->budget.dvb_frontend) { |
993 | budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; | ||
994 | budget_ci->budget.dvb_frontend->tuner_priv = &budget_ci->budget.i2c_adap; | ||
985 | break; | 995 | break; |
986 | } | 996 | } |
987 | break; | 997 | break; |
@@ -990,6 +1000,7 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
990 | budget_ci->budget.dvb_frontend = | 1000 | budget_ci->budget.dvb_frontend = |
991 | stv0299_attach(&philips_su1278_tt_config, &budget_ci->budget.i2c_adap); | 1001 | stv0299_attach(&philips_su1278_tt_config, &budget_ci->budget.i2c_adap); |
992 | if (budget_ci->budget.dvb_frontend) { | 1002 | if (budget_ci->budget.dvb_frontend) { |
1003 | budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = philips_su1278_tt_tuner_set_params; | ||
993 | break; | 1004 | break; |
994 | } | 1005 | } |
995 | break; | 1006 | break; |
@@ -999,6 +1010,7 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
999 | budget_ci->budget.dvb_frontend = | 1010 | budget_ci->budget.dvb_frontend = |
1000 | stv0297_attach(&dvbc_philips_tdm1316l_config, &budget_ci->budget.i2c_adap); | 1011 | stv0297_attach(&dvbc_philips_tdm1316l_config, &budget_ci->budget.i2c_adap); |
1001 | if (budget_ci->budget.dvb_frontend) { | 1012 | if (budget_ci->budget.dvb_frontend) { |
1013 | budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = dvbc_philips_tdm1316l_tuner_set_params; | ||
1002 | break; | 1014 | break; |
1003 | } | 1015 | } |
1004 | break; | 1016 | break; |
@@ -1008,6 +1020,8 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
1008 | budget_ci->budget.dvb_frontend = | 1020 | budget_ci->budget.dvb_frontend = |
1009 | tda10045_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); | 1021 | tda10045_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); |
1010 | if (budget_ci->budget.dvb_frontend) { | 1022 | if (budget_ci->budget.dvb_frontend) { |
1023 | budget_ci->budget.dvb_frontend->ops.tuner_ops.init = philips_tdm1316l_tuner_init; | ||
1024 | budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = philips_tdm1316l_tuner_set_params; | ||
1011 | break; | 1025 | break; |
1012 | } | 1026 | } |
1013 | break; | 1027 | break; |
@@ -1017,6 +1031,8 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
1017 | budget_ci->budget.dvb_frontend = | 1031 | budget_ci->budget.dvb_frontend = |
1018 | tda10046_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); | 1032 | tda10046_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); |
1019 | if (budget_ci->budget.dvb_frontend) { | 1033 | if (budget_ci->budget.dvb_frontend) { |
1034 | budget_ci->budget.dvb_frontend->ops.tuner_ops.init = philips_tdm1316l_tuner_init; | ||
1035 | budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = philips_tdm1316l_tuner_set_params; | ||
1020 | break; | 1036 | break; |
1021 | } | 1037 | } |
1022 | break; | 1038 | break; |
@@ -1024,11 +1040,14 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
1024 | case 0x1017: // TT S-1500 PCI | 1040 | case 0x1017: // TT S-1500 PCI |
1025 | budget_ci->budget.dvb_frontend = stv0299_attach(&alps_bsbe1_config, &budget_ci->budget.i2c_adap); | 1041 | budget_ci->budget.dvb_frontend = stv0299_attach(&alps_bsbe1_config, &budget_ci->budget.i2c_adap); |
1026 | if (budget_ci->budget.dvb_frontend) { | 1042 | if (budget_ci->budget.dvb_frontend) { |
1027 | budget_ci->budget.dvb_frontend->ops->dishnetwork_send_legacy_command = NULL; | 1043 | budget_ci->budget.dvb_frontend->ops.tuner_ops.set_params = alps_bsbe1_tuner_set_params; |
1028 | if (lnbp21_init(budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, LNBP21_LLC, 0)) { | 1044 | budget_ci->budget.dvb_frontend->tuner_priv = &budget_ci->budget.i2c_adap; |
1045 | |||
1046 | budget_ci->budget.dvb_frontend->ops.dishnetwork_send_legacy_command = NULL; | ||
1047 | if (lnbp21_attach(budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, LNBP21_LLC, 0)) { | ||
1029 | printk("%s: No LNBP21 found!\n", __FUNCTION__); | 1048 | printk("%s: No LNBP21 found!\n", __FUNCTION__); |
1030 | if (budget_ci->budget.dvb_frontend->ops->release) | 1049 | if (budget_ci->budget.dvb_frontend->ops.release) |
1031 | budget_ci->budget.dvb_frontend->ops->release(budget_ci->budget.dvb_frontend); | 1050 | budget_ci->budget.dvb_frontend->ops.release(budget_ci->budget.dvb_frontend); |
1032 | budget_ci->budget.dvb_frontend = NULL; | 1051 | budget_ci->budget.dvb_frontend = NULL; |
1033 | } | 1052 | } |
1034 | } | 1053 | } |
@@ -1046,8 +1065,8 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
1046 | if (dvb_register_frontend | 1065 | if (dvb_register_frontend |
1047 | (&budget_ci->budget.dvb_adapter, budget_ci->budget.dvb_frontend)) { | 1066 | (&budget_ci->budget.dvb_adapter, budget_ci->budget.dvb_frontend)) { |
1048 | printk("budget-ci: Frontend registration failed!\n"); | 1067 | printk("budget-ci: Frontend registration failed!\n"); |
1049 | if (budget_ci->budget.dvb_frontend->ops->release) | 1068 | if (budget_ci->budget.dvb_frontend->ops.release) |
1050 | budget_ci->budget.dvb_frontend->ops->release(budget_ci->budget.dvb_frontend); | 1069 | budget_ci->budget.dvb_frontend->ops.release(budget_ci->budget.dvb_frontend); |
1051 | budget_ci->budget.dvb_frontend = NULL; | 1070 | budget_ci->budget.dvb_frontend = NULL; |
1052 | } | 1071 | } |
1053 | } | 1072 | } |