aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/cppc_acpi.c
diff options
context:
space:
mode:
authorPrakash, Prashanth <pprakash@codeaurora.org>2017-03-29 15:49:59 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-04-18 17:37:49 -0400
commit368520a6b2dd232ea5743a6acd9f056bc30e05b4 (patch)
treed756fc6eb194f7832f9f04cf1865aa49a89856bb /drivers/acpi/cppc_acpi.c
parent4f7d029b9bf009fbee76bb10c0c4351a1870d2f3 (diff)
ACPI / CPPC: Read lowest nonlinear perf in cppc_get_perf_caps()
Read lowest non linear perf in cppc_get_perf_caps so that it can be exposed via sysfs to the usespace. Lowest non linear perf is the lowest performance level at which nonlinear power savings are achieved. Signed-off-by: Prashanth Prakash <pprakash@codeaurora.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/cppc_acpi.c')
-rw-r--r--drivers/acpi/cppc_acpi.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index 3ca0729f7e0e..ee00a1c94ff6 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -972,9 +972,9 @@ static int cpc_write(int cpu, struct cpc_register_resource *reg_res, u64 val)
972int cppc_get_perf_caps(int cpunum, struct cppc_perf_caps *perf_caps) 972int cppc_get_perf_caps(int cpunum, struct cppc_perf_caps *perf_caps)
973{ 973{
974 struct cpc_desc *cpc_desc = per_cpu(cpc_desc_ptr, cpunum); 974 struct cpc_desc *cpc_desc = per_cpu(cpc_desc_ptr, cpunum);
975 struct cpc_register_resource *highest_reg, *lowest_reg, *ref_perf, 975 struct cpc_register_resource *highest_reg, *lowest_reg,
976 *nom_perf; 976 *lowest_non_linear_reg, *nominal_reg;
977 u64 high, low, nom; 977 u64 high, low, nom, min_nonlinear;
978 int ret = 0, regs_in_pcc = 0; 978 int ret = 0, regs_in_pcc = 0;
979 979
980 if (!cpc_desc) { 980 if (!cpc_desc) {
@@ -984,12 +984,12 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_caps *perf_caps)
984 984
985 highest_reg = &cpc_desc->cpc_regs[HIGHEST_PERF]; 985 highest_reg = &cpc_desc->cpc_regs[HIGHEST_PERF];
986 lowest_reg = &cpc_desc->cpc_regs[LOWEST_PERF]; 986 lowest_reg = &cpc_desc->cpc_regs[LOWEST_PERF];
987 ref_perf = &cpc_desc->cpc_regs[REFERENCE_PERF]; 987 lowest_non_linear_reg = &cpc_desc->cpc_regs[LOW_NON_LINEAR_PERF];
988 nom_perf = &cpc_desc->cpc_regs[NOMINAL_PERF]; 988 nominal_reg = &cpc_desc->cpc_regs[NOMINAL_PERF];
989 989
990 /* Are any of the regs PCC ?*/ 990 /* Are any of the regs PCC ?*/
991 if (CPC_IN_PCC(highest_reg) || CPC_IN_PCC(lowest_reg) || 991 if (CPC_IN_PCC(highest_reg) || CPC_IN_PCC(lowest_reg) ||
992 CPC_IN_PCC(ref_perf) || CPC_IN_PCC(nom_perf)) { 992 CPC_IN_PCC(lowest_non_linear_reg) || CPC_IN_PCC(nominal_reg)) {
993 regs_in_pcc = 1; 993 regs_in_pcc = 1;
994 down_write(&pcc_data.pcc_lock); 994 down_write(&pcc_data.pcc_lock);
995 /* Ring doorbell once to update PCC subspace */ 995 /* Ring doorbell once to update PCC subspace */
@@ -1005,10 +1005,13 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_caps *perf_caps)
1005 cpc_read(cpunum, lowest_reg, &low); 1005 cpc_read(cpunum, lowest_reg, &low);
1006 perf_caps->lowest_perf = low; 1006 perf_caps->lowest_perf = low;
1007 1007
1008 cpc_read(cpunum, nom_perf, &nom); 1008 cpc_read(cpunum, nominal_reg, &nom);
1009 perf_caps->nominal_perf = nom; 1009 perf_caps->nominal_perf = nom;
1010 1010
1011 if (!high || !low || !nom) 1011 cpc_read(cpunum, lowest_non_linear_reg, &min_nonlinear);
1012 perf_caps->lowest_nonlinear_perf = min_nonlinear;
1013
1014 if (!high || !low || !nom || !min_nonlinear)
1012 ret = -EFAULT; 1015 ret = -EFAULT;
1013 1016
1014out_err: 1017out_err: