diff options
author | Hoan Tran <hotran@apm.com> | 2016-10-13 13:33:35 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-10-13 17:10:41 -0400 |
commit | c197d758036d8c77923ae3f88571cf198283107e (patch) | |
tree | 9dea7912efc8aa2036eec6c157403643a3e07f5a /drivers/cpufreq | |
parent | abb6627910a1e783c8e034b35b7c80e5e7f98f41 (diff) |
cpufreq: CPPC: Correct desired_perf calculation
The desired_perf is an abstract performance number. Its value should
be in the range of [lowest perf, highest perf] of CPPC.
The correct calculation is
desired_perf = freq * cppc_highest_perf / cppc_dmi_max_khz
And cppc_cpufreq_set_target() returns if desired_perf is exactly
the same with the old perf.
Signed-off-by: Hoan Tran <hotran@apm.com>
Reviewed-by: Prashanth Prakash <pprakash@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/cppc_cpufreq.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c index 99db4227ae38..f7e98fc077c1 100644 --- a/drivers/cpufreq/cppc_cpufreq.c +++ b/drivers/cpufreq/cppc_cpufreq.c | |||
@@ -80,11 +80,17 @@ static int cppc_cpufreq_set_target(struct cpufreq_policy *policy, | |||
80 | { | 80 | { |
81 | struct cpudata *cpu; | 81 | struct cpudata *cpu; |
82 | struct cpufreq_freqs freqs; | 82 | struct cpufreq_freqs freqs; |
83 | u32 desired_perf; | ||
83 | int ret = 0; | 84 | int ret = 0; |
84 | 85 | ||
85 | cpu = all_cpu_data[policy->cpu]; | 86 | cpu = all_cpu_data[policy->cpu]; |
86 | 87 | ||
87 | cpu->perf_ctrls.desired_perf = (u64)target_freq * policy->max / cppc_dmi_max_khz; | 88 | desired_perf = (u64)target_freq * cpu->perf_caps.highest_perf / cppc_dmi_max_khz; |
89 | /* Return if it is exactly the same perf */ | ||
90 | if (desired_perf == cpu->perf_ctrls.desired_perf) | ||
91 | return ret; | ||
92 | |||
93 | cpu->perf_ctrls.desired_perf = desired_perf; | ||
88 | freqs.old = policy->cur; | 94 | freqs.old = policy->cur; |
89 | freqs.new = target_freq; | 95 | freqs.new = target_freq; |
90 | 96 | ||