aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cppc_cpufreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/cppc_cpufreq.c')
-rw-r--r--drivers/cpufreq/cppc_cpufreq.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index e67e94b0ec14..3464580ac3ca 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -181,6 +181,49 @@ static void cppc_cpufreq_stop_cpu(struct cpufreq_policy *policy)
181 cpu->perf_caps.lowest_perf, cpu_num, ret); 181 cpu->perf_caps.lowest_perf, cpu_num, ret);
182} 182}
183 183
184/*
185 * The PCC subspace describes the rate at which platform can accept commands
186 * on the shared PCC channel (including READs which do not count towards freq
187 * trasition requests), so ideally we need to use the PCC values as a fallback
188 * if we don't have a platform specific transition_delay_us
189 */
190#ifdef CONFIG_ARM64
191#include <asm/cputype.h>
192
193static unsigned int cppc_cpufreq_get_transition_delay_us(int cpu)
194{
195 unsigned long implementor = read_cpuid_implementor();
196 unsigned long part_num = read_cpuid_part_number();
197 unsigned int delay_us = 0;
198
199 switch (implementor) {
200 case ARM_CPU_IMP_QCOM:
201 switch (part_num) {
202 case QCOM_CPU_PART_FALKOR_V1:
203 case QCOM_CPU_PART_FALKOR:
204 delay_us = 10000;
205 break;
206 default:
207 delay_us = cppc_get_transition_latency(cpu) / NSEC_PER_USEC;
208 break;
209 }
210 break;
211 default:
212 delay_us = cppc_get_transition_latency(cpu) / NSEC_PER_USEC;
213 break;
214 }
215
216 return delay_us;
217}
218
219#else
220
221static unsigned int cppc_cpufreq_get_transition_delay_us(int cpu)
222{
223 return cppc_get_transition_latency(cpu) / NSEC_PER_USEC;
224}
225#endif
226
184static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) 227static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
185{ 228{
186 struct cppc_cpudata *cpu; 229 struct cppc_cpudata *cpu;
@@ -217,8 +260,7 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
217 policy->cpuinfo.min_freq = cppc_cpufreq_perf_to_khz(cpu, cpu->perf_caps.lowest_perf); 260 policy->cpuinfo.min_freq = cppc_cpufreq_perf_to_khz(cpu, cpu->perf_caps.lowest_perf);
218 policy->cpuinfo.max_freq = cppc_cpufreq_perf_to_khz(cpu, cpu->perf_caps.highest_perf); 261 policy->cpuinfo.max_freq = cppc_cpufreq_perf_to_khz(cpu, cpu->perf_caps.highest_perf);
219 262
220 policy->transition_delay_us = cppc_get_transition_latency(cpu_num) / 263 policy->transition_delay_us = cppc_cpufreq_get_transition_delay_us(cpu_num);
221 NSEC_PER_USEC;
222 policy->shared_type = cpu->shared_type; 264 policy->shared_type = cpu->shared_type;
223 265
224 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { 266 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {