Lines Matching refs:cpu
84 static unsigned int cppc_cpufreq_perf_to_khz(struct cppc_cpudata *cpu, in cppc_cpufreq_perf_to_khz() argument
88 struct cppc_perf_caps *caps = &cpu->perf_caps; in cppc_cpufreq_perf_to_khz()
103 div = cpu->perf_caps.highest_perf; in cppc_cpufreq_perf_to_khz()
108 static unsigned int cppc_cpufreq_khz_to_perf(struct cppc_cpudata *cpu, in cppc_cpufreq_khz_to_perf() argument
112 struct cppc_perf_caps *caps = &cpu->perf_caps; in cppc_cpufreq_khz_to_perf()
126 mul = cpu->perf_caps.highest_perf; in cppc_cpufreq_khz_to_perf()
137 struct cppc_cpudata *cpu; in cppc_cpufreq_set_target() local
142 cpu = all_cpu_data[policy->cpu]; in cppc_cpufreq_set_target()
144 desired_perf = cppc_cpufreq_khz_to_perf(cpu, target_freq); in cppc_cpufreq_set_target()
146 if (desired_perf == cpu->perf_ctrls.desired_perf) in cppc_cpufreq_set_target()
149 cpu->perf_ctrls.desired_perf = desired_perf; in cppc_cpufreq_set_target()
154 ret = cppc_set_perf(cpu->cpu, &cpu->perf_ctrls); in cppc_cpufreq_set_target()
159 cpu->cpu, ret); in cppc_cpufreq_set_target()
172 int cpu_num = policy->cpu; in cppc_cpufreq_stop_cpu()
173 struct cppc_cpudata *cpu = all_cpu_data[cpu_num]; in cppc_cpufreq_stop_cpu() local
176 cpu->perf_ctrls.desired_perf = cpu->perf_caps.lowest_perf; in cppc_cpufreq_stop_cpu()
178 ret = cppc_set_perf(cpu_num, &cpu->perf_ctrls); in cppc_cpufreq_stop_cpu()
181 cpu->perf_caps.lowest_perf, cpu_num, ret); in cppc_cpufreq_stop_cpu()
193 static unsigned int cppc_cpufreq_get_transition_delay_us(int cpu) in cppc_cpufreq_get_transition_delay_us() argument
207 delay_us = cppc_get_transition_latency(cpu) / NSEC_PER_USEC; in cppc_cpufreq_get_transition_delay_us()
212 delay_us = cppc_get_transition_latency(cpu) / NSEC_PER_USEC; in cppc_cpufreq_get_transition_delay_us()
221 static unsigned int cppc_cpufreq_get_transition_delay_us(int cpu) in cppc_cpufreq_get_transition_delay_us() argument
223 return cppc_get_transition_latency(cpu) / NSEC_PER_USEC; in cppc_cpufreq_get_transition_delay_us()
229 struct cppc_cpudata *cpu; in cppc_cpufreq_cpu_init() local
230 unsigned int cpu_num = policy->cpu; in cppc_cpufreq_cpu_init()
233 cpu = all_cpu_data[policy->cpu]; in cppc_cpufreq_cpu_init()
235 cpu->cpu = cpu_num; in cppc_cpufreq_cpu_init()
236 ret = cppc_get_perf_caps(policy->cpu, &cpu->perf_caps); in cppc_cpufreq_cpu_init()
245 cpu->perf_caps.lowest_freq *= 1000; in cppc_cpufreq_cpu_init()
246 cpu->perf_caps.nominal_freq *= 1000; in cppc_cpufreq_cpu_init()
252 policy->min = cppc_cpufreq_perf_to_khz(cpu, cpu->perf_caps.lowest_nonlinear_perf); in cppc_cpufreq_cpu_init()
253 policy->max = cppc_cpufreq_perf_to_khz(cpu, cpu->perf_caps.highest_perf); in cppc_cpufreq_cpu_init()
260 policy->cpuinfo.min_freq = cppc_cpufreq_perf_to_khz(cpu, cpu->perf_caps.lowest_perf); in cppc_cpufreq_cpu_init()
261 policy->cpuinfo.max_freq = cppc_cpufreq_perf_to_khz(cpu, cpu->perf_caps.highest_perf); in cppc_cpufreq_cpu_init()
264 policy->shared_type = cpu->shared_type; in cppc_cpufreq_cpu_init()
269 cpumask_copy(policy->cpus, cpu->shared_cpu_map); in cppc_cpufreq_cpu_init()
272 if (unlikely(i == policy->cpu)) in cppc_cpufreq_cpu_init()
275 memcpy(&all_cpu_data[i]->perf_caps, &cpu->perf_caps, in cppc_cpufreq_cpu_init()
276 sizeof(cpu->perf_caps)); in cppc_cpufreq_cpu_init()
284 cpu->cur_policy = policy; in cppc_cpufreq_cpu_init()
287 policy->cur = cppc_cpufreq_perf_to_khz(cpu, in cppc_cpufreq_cpu_init()
288 cpu->perf_caps.highest_perf); in cppc_cpufreq_cpu_init()
289 cpu->perf_ctrls.desired_perf = cpu->perf_caps.highest_perf; in cppc_cpufreq_cpu_init()
291 ret = cppc_set_perf(cpu_num, &cpu->perf_ctrls); in cppc_cpufreq_cpu_init()
294 cpu->perf_caps.highest_perf, cpu_num, ret); in cppc_cpufreq_cpu_init()
307 static int cppc_get_rate_from_fbctrs(struct cppc_cpudata *cpu, in cppc_get_rate_from_fbctrs() argument
326 delivered_perf = cpu->perf_ctrls.desired_perf; in cppc_get_rate_from_fbctrs()
328 return cppc_cpufreq_perf_to_khz(cpu, delivered_perf); in cppc_get_rate_from_fbctrs()
334 struct cppc_cpudata *cpu = all_cpu_data[cpunum]; in cppc_cpufreq_get_rate() local
347 return cppc_get_rate_from_fbctrs(cpu, fb_ctrs_t0, fb_ctrs_t1); in cppc_cpufreq_get_rate()
363 struct cppc_cpudata *cpu; in cppc_cpufreq_init() local
378 cpu = all_cpu_data[i]; in cppc_cpufreq_init()
379 if (!zalloc_cpumask_var(&cpu->shared_cpu_map, GFP_KERNEL)) in cppc_cpufreq_init()
397 cpu = all_cpu_data[i]; in cppc_cpufreq_init()
398 if (!cpu) in cppc_cpufreq_init()
400 free_cpumask_var(cpu->shared_cpu_map); in cppc_cpufreq_init()
401 kfree(cpu); in cppc_cpufreq_init()
410 struct cppc_cpudata *cpu; in cppc_cpufreq_exit() local
416 cpu = all_cpu_data[i]; in cppc_cpufreq_exit()
417 free_cpumask_var(cpu->shared_cpu_map); in cppc_cpufreq_exit()
418 kfree(cpu); in cppc_cpufreq_exit()