Lines Matching refs:policy
157 static void cppc_cpufreq_cpu_fie_init(struct cpufreq_policy *policy) in cppc_cpufreq_cpu_fie_init() argument
165 for_each_cpu(cpu, policy->cpus) { in cppc_cpufreq_cpu_fie_init()
168 cppc_fi->cpu_data = policy->driver_data; in cppc_cpufreq_cpu_fie_init()
187 topology_set_scale_freq_source(&cppc_sftd, policy->cpus); in cppc_cpufreq_cpu_fie_init()
198 static void cppc_cpufreq_cpu_fie_exit(struct cpufreq_policy *policy) in cppc_cpufreq_cpu_fie_exit() argument
207 topology_clear_scale_freq_source(SCALE_FREQ_SOURCE_CPPC, policy->related_cpus); in cppc_cpufreq_cpu_fie_exit()
209 for_each_cpu(cpu, policy->related_cpus) { in cppc_cpufreq_cpu_fie_exit()
270 static inline void cppc_cpufreq_cpu_fie_init(struct cpufreq_policy *policy) in cppc_cpufreq_cpu_fie_init() argument
274 static inline void cppc_cpufreq_cpu_fie_exit(struct cpufreq_policy *policy) in cppc_cpufreq_cpu_fie_exit() argument
287 static int cppc_cpufreq_set_target(struct cpufreq_policy *policy, in cppc_cpufreq_set_target() argument
291 struct cppc_cpudata *cpu_data = policy->driver_data; in cppc_cpufreq_set_target()
292 unsigned int cpu = policy->cpu; in cppc_cpufreq_set_target()
298 freqs.old = policy->cur; in cppc_cpufreq_set_target()
301 cpufreq_freq_transition_begin(policy, &freqs); in cppc_cpufreq_set_target()
303 cpufreq_freq_transition_end(policy, &freqs, ret != 0); in cppc_cpufreq_set_target()
312 static unsigned int cppc_cpufreq_fast_switch(struct cpufreq_policy *policy, in cppc_cpufreq_fast_switch() argument
315 struct cppc_cpudata *cpu_data = policy->driver_data; in cppc_cpufreq_fast_switch()
316 unsigned int cpu = policy->cpu; in cppc_cpufreq_fast_switch()
333 static int cppc_verify_policy(struct cpufreq_policy_data *policy) in cppc_verify_policy() argument
335 cpufreq_verify_within_cpu_limits(policy); in cppc_verify_policy()
373 static void cppc_cpufreq_register_em(struct cpufreq_policy *policy);
383 static unsigned int get_perf_level_count(struct cpufreq_policy *policy) in get_perf_level_count() argument
388 int cpu = policy->cpu; in get_perf_level_count()
390 cpu_data = policy->driver_data; in get_perf_level_count()
417 struct cpufreq_policy *policy; in cppc_get_cpu_power() local
422 policy = cpufreq_cpu_get_raw(cpu_dev->id); in cppc_get_cpu_power()
423 cpu_data = policy->driver_data; in cppc_get_cpu_power()
484 struct cpufreq_policy *policy; in cppc_get_cpu_cost() local
489 policy = cpufreq_cpu_get_raw(cpu_dev->id); in cppc_get_cpu_cost()
490 cpu_data = policy->driver_data; in cppc_get_cpu_cost()
539 static void cppc_cpufreq_register_em(struct cpufreq_policy *policy) in cppc_cpufreq_register_em() argument
545 cpu_data = policy->driver_data; in cppc_cpufreq_register_em()
546 em_dev_register_perf_domain(get_cpu_device(policy->cpu), in cppc_cpufreq_register_em()
547 get_perf_level_count(policy), &em_cb, in cppc_cpufreq_register_em()
594 static void cppc_cpufreq_put_cpu_data(struct cpufreq_policy *policy) in cppc_cpufreq_put_cpu_data() argument
596 struct cppc_cpudata *cpu_data = policy->driver_data; in cppc_cpufreq_put_cpu_data()
601 policy->driver_data = NULL; in cppc_cpufreq_put_cpu_data()
604 static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) in cppc_cpufreq_cpu_init() argument
606 unsigned int cpu = policy->cpu; in cppc_cpufreq_cpu_init()
617 policy->driver_data = cpu_data; in cppc_cpufreq_cpu_init()
623 policy->min = cppc_perf_to_khz(caps, caps->lowest_nonlinear_perf); in cppc_cpufreq_cpu_init()
624 policy->max = cppc_perf_to_khz(caps, caps->nominal_perf); in cppc_cpufreq_cpu_init()
631 policy->cpuinfo.min_freq = cppc_perf_to_khz(caps, caps->lowest_perf); in cppc_cpufreq_cpu_init()
632 policy->cpuinfo.max_freq = cppc_perf_to_khz(caps, caps->nominal_perf); in cppc_cpufreq_cpu_init()
634 policy->transition_delay_us = cppc_cpufreq_get_transition_delay_us(cpu); in cppc_cpufreq_cpu_init()
635 policy->shared_type = cpu_data->shared_type; in cppc_cpufreq_cpu_init()
637 switch (policy->shared_type) { in cppc_cpufreq_cpu_init()
648 cpumask_copy(policy->cpus, cpu_data->shared_cpu_map); in cppc_cpufreq_cpu_init()
652 policy->shared_type); in cppc_cpufreq_cpu_init()
657 policy->fast_switch_possible = cppc_allow_fast_switch(); in cppc_cpufreq_cpu_init()
658 policy->dvfs_possible_from_any_cpu = true; in cppc_cpufreq_cpu_init()
668 policy->cur = cppc_perf_to_khz(caps, caps->highest_perf); in cppc_cpufreq_cpu_init()
678 cppc_cpufreq_cpu_fie_init(policy); in cppc_cpufreq_cpu_init()
682 cppc_cpufreq_put_cpu_data(policy); in cppc_cpufreq_cpu_init()
686 static void cppc_cpufreq_cpu_exit(struct cpufreq_policy *policy) in cppc_cpufreq_cpu_exit() argument
688 struct cppc_cpudata *cpu_data = policy->driver_data; in cppc_cpufreq_cpu_exit()
690 unsigned int cpu = policy->cpu; in cppc_cpufreq_cpu_exit()
693 cppc_cpufreq_cpu_fie_exit(policy); in cppc_cpufreq_cpu_exit()
702 cppc_cpufreq_put_cpu_data(policy); in cppc_cpufreq_cpu_exit()
737 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); in cppc_cpufreq_get_rate() local
742 if (!policy) in cppc_cpufreq_get_rate()
745 cpu_data = policy->driver_data; in cppc_cpufreq_get_rate()
747 cpufreq_cpu_put(policy); in cppc_cpufreq_get_rate()
765 static int cppc_cpufreq_set_boost(struct cpufreq_policy *policy, int state) in cppc_cpufreq_set_boost() argument
767 struct cppc_cpudata *cpu_data = policy->driver_data; in cppc_cpufreq_set_boost()
777 policy->max = cppc_perf_to_khz(caps, caps->highest_perf); in cppc_cpufreq_set_boost()
779 policy->max = cppc_perf_to_khz(caps, caps->nominal_perf); in cppc_cpufreq_set_boost()
780 policy->cpuinfo.max_freq = policy->max; in cppc_cpufreq_set_boost()
782 ret = freq_qos_update_request(policy->max_freq_req, policy->max); in cppc_cpufreq_set_boost()
789 static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf) in show_freqdomain_cpus() argument
791 struct cppc_cpudata *cpu_data = policy->driver_data; in show_freqdomain_cpus()
823 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); in hisi_cppc_cpufreq_get_rate() local
828 if (!policy) in hisi_cppc_cpufreq_get_rate()
831 cpu_data = policy->driver_data; in hisi_cppc_cpufreq_get_rate()
833 cpufreq_cpu_put(policy); in hisi_cppc_cpufreq_get_rate()