diff options
author | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-04-18 16:47:11 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-25 00:59:04 -0400 |
commit | 0f591d409b63999ee8053df9cfbedd77bfbf3b22 (patch) | |
tree | 207fa0412cf5c1ca2e95cf86083206e9dd134ff0 /drivers/media/dvb/ttpci/budget-ci.c | |
parent | 067145bdd41bcb090510c73cc6ecd7b09213f038 (diff) |
V4L/DVB (3876): Convert ttpci/budget-ci to refactored tuner code
Rename pll calls to appropriate tuner calls.
Remove pll functions from demod structures.
Hook tuner call into tuner_ops.
Add pll gate control calls where appropriate.
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/ttpci/budget-ci.c')
-rw-r--r-- | drivers/media/dvb/ttpci/budget-ci.c | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index e64a609cf4ff..ed610e56b91e 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,6 @@ 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, | ||
973 | }; | 980 | }; |
974 | 981 | ||
975 | 982 | ||
@@ -982,6 +989,8 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
982 | budget_ci->budget.dvb_frontend = | 989 | budget_ci->budget.dvb_frontend = |
983 | stv0299_attach(&alps_bsru6_config, &budget_ci->budget.i2c_adap); | 990 | stv0299_attach(&alps_bsru6_config, &budget_ci->budget.i2c_adap); |
984 | if (budget_ci->budget.dvb_frontend) { | 991 | if (budget_ci->budget.dvb_frontend) { |
992 | budget_ci->budget.dvb_frontend->ops->tuner_ops.set_params = alps_bsru6_tuner_set_params; | ||
993 | budget_ci->budget.dvb_frontend->tuner_priv = &budget_ci->budget.i2c_adap; | ||
985 | break; | 994 | break; |
986 | } | 995 | } |
987 | break; | 996 | break; |
@@ -990,6 +999,7 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
990 | budget_ci->budget.dvb_frontend = | 999 | budget_ci->budget.dvb_frontend = |
991 | stv0299_attach(&philips_su1278_tt_config, &budget_ci->budget.i2c_adap); | 1000 | stv0299_attach(&philips_su1278_tt_config, &budget_ci->budget.i2c_adap); |
992 | if (budget_ci->budget.dvb_frontend) { | 1001 | if (budget_ci->budget.dvb_frontend) { |
1002 | budget_ci->budget.dvb_frontend->ops->tuner_ops.set_params = philips_su1278_tt_tuner_set_params; | ||
993 | break; | 1003 | break; |
994 | } | 1004 | } |
995 | break; | 1005 | break; |
@@ -999,6 +1009,7 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
999 | budget_ci->budget.dvb_frontend = | 1009 | budget_ci->budget.dvb_frontend = |
1000 | stv0297_attach(&dvbc_philips_tdm1316l_config, &budget_ci->budget.i2c_adap); | 1010 | stv0297_attach(&dvbc_philips_tdm1316l_config, &budget_ci->budget.i2c_adap); |
1001 | if (budget_ci->budget.dvb_frontend) { | 1011 | if (budget_ci->budget.dvb_frontend) { |
1012 | budget_ci->budget.dvb_frontend->ops->tuner_ops.set_params = dvbc_philips_tdm1316l_tuner_set_params; | ||
1002 | break; | 1013 | break; |
1003 | } | 1014 | } |
1004 | break; | 1015 | break; |
@@ -1008,6 +1019,8 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
1008 | budget_ci->budget.dvb_frontend = | 1019 | budget_ci->budget.dvb_frontend = |
1009 | tda10045_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); | 1020 | tda10045_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); |
1010 | if (budget_ci->budget.dvb_frontend) { | 1021 | if (budget_ci->budget.dvb_frontend) { |
1022 | budget_ci->budget.dvb_frontend->ops->tuner_ops.init = philips_tdm1316l_tuner_init; | ||
1023 | budget_ci->budget.dvb_frontend->ops->tuner_ops.set_params = philips_tdm1316l_tuner_set_params; | ||
1011 | break; | 1024 | break; |
1012 | } | 1025 | } |
1013 | break; | 1026 | break; |
@@ -1017,6 +1030,8 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
1017 | budget_ci->budget.dvb_frontend = | 1030 | budget_ci->budget.dvb_frontend = |
1018 | tda10046_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); | 1031 | tda10046_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); |
1019 | if (budget_ci->budget.dvb_frontend) { | 1032 | if (budget_ci->budget.dvb_frontend) { |
1033 | budget_ci->budget.dvb_frontend->ops->tuner_ops.init = philips_tdm1316l_tuner_init; | ||
1034 | budget_ci->budget.dvb_frontend->ops->tuner_ops.set_params = philips_tdm1316l_tuner_set_params; | ||
1020 | break; | 1035 | break; |
1021 | } | 1036 | } |
1022 | break; | 1037 | break; |
@@ -1024,6 +1039,9 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
1024 | case 0x1017: // TT S-1500 PCI | 1039 | case 0x1017: // TT S-1500 PCI |
1025 | budget_ci->budget.dvb_frontend = stv0299_attach(&alps_bsbe1_config, &budget_ci->budget.i2c_adap); | 1040 | budget_ci->budget.dvb_frontend = stv0299_attach(&alps_bsbe1_config, &budget_ci->budget.i2c_adap); |
1026 | if (budget_ci->budget.dvb_frontend) { | 1041 | if (budget_ci->budget.dvb_frontend) { |
1042 | budget_ci->budget.dvb_frontend->ops->tuner_ops.set_params = alps_bsbe1_tuner_set_params; | ||
1043 | budget_ci->budget.dvb_frontend->tuner_priv = &budget_ci->budget.i2c_adap; | ||
1044 | |||
1027 | budget_ci->budget.dvb_frontend->ops->dishnetwork_send_legacy_command = NULL; | 1045 | budget_ci->budget.dvb_frontend->ops->dishnetwork_send_legacy_command = NULL; |
1028 | if (lnbp21_init(budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, LNBP21_LLC, 0)) { | 1046 | if (lnbp21_init(budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, LNBP21_LLC, 0)) { |
1029 | printk("%s: No LNBP21 found!\n", __FUNCTION__); | 1047 | printk("%s: No LNBP21 found!\n", __FUNCTION__); |