Lines Matching full:policy
160 static void cppc_cpufreq_cpu_fie_init(struct cpufreq_policy *policy) in cppc_cpufreq_cpu_fie_init() argument
168 for_each_cpu(cpu, policy->cpus) { in cppc_cpufreq_cpu_fie_init()
171 cppc_fi->cpu_data = policy->driver_data; in cppc_cpufreq_cpu_fie_init()
190 topology_set_scale_freq_source(&cppc_sftd, policy->cpus); in cppc_cpufreq_cpu_fie_init()
194 * We free all the resources on policy's removal and not on CPU removal as the
199 * We just need to make sure to remove them all on policy->exit().
201 static void cppc_cpufreq_cpu_fie_exit(struct cpufreq_policy *policy) in cppc_cpufreq_cpu_fie_exit() argument
209 /* policy->cpus will be empty here, use related_cpus instead */ in cppc_cpufreq_cpu_fie_exit()
210 topology_clear_scale_freq_source(SCALE_FREQ_SOURCE_CPPC, policy->related_cpus); in cppc_cpufreq_cpu_fie_exit()
212 for_each_cpu(cpu, policy->related_cpus) { in cppc_cpufreq_cpu_fie_exit()
273 static inline void cppc_cpufreq_cpu_fie_init(struct cpufreq_policy *policy) in cppc_cpufreq_cpu_fie_init() argument
277 static inline void cppc_cpufreq_cpu_fie_exit(struct cpufreq_policy *policy) in cppc_cpufreq_cpu_fie_exit() argument
290 static int cppc_cpufreq_set_target(struct cpufreq_policy *policy, in cppc_cpufreq_set_target() argument
294 struct cppc_cpudata *cpu_data = policy->driver_data; in cppc_cpufreq_set_target()
295 unsigned int cpu = policy->cpu; in cppc_cpufreq_set_target()
306 freqs.old = policy->cur; in cppc_cpufreq_set_target()
309 cpufreq_freq_transition_begin(policy, &freqs); in cppc_cpufreq_set_target()
311 cpufreq_freq_transition_end(policy, &freqs, ret != 0); in cppc_cpufreq_set_target()
320 static unsigned int cppc_cpufreq_fast_switch(struct cpufreq_policy *policy, in cppc_cpufreq_fast_switch() argument
323 struct cppc_cpudata *cpu_data = policy->driver_data; in cppc_cpufreq_fast_switch()
324 unsigned int cpu = policy->cpu; in cppc_cpufreq_fast_switch()
341 static int cppc_verify_policy(struct cpufreq_policy_data *policy) in cppc_verify_policy() argument
343 cpufreq_verify_within_cpu_limits(policy); in cppc_verify_policy()
381 static void cppc_cpufreq_register_em(struct cpufreq_policy *policy);
391 static unsigned int get_perf_level_count(struct cpufreq_policy *policy) in get_perf_level_count() argument
396 int cpu = policy->cpu; in get_perf_level_count()
398 cpu_data = policy->driver_data; in get_perf_level_count()
425 struct cpufreq_policy *policy; in cppc_get_cpu_power() local
430 policy = cpufreq_cpu_get_raw(cpu_dev->id); in cppc_get_cpu_power()
431 if (!policy) in cppc_get_cpu_power()
434 cpu_data = policy->driver_data; in cppc_get_cpu_power()
495 struct cpufreq_policy *policy; in cppc_get_cpu_cost() local
500 policy = cpufreq_cpu_get_raw(cpu_dev->id); in cppc_get_cpu_cost()
501 if (!policy) in cppc_get_cpu_cost()
504 cpu_data = policy->driver_data; in cppc_get_cpu_cost()
553 static void cppc_cpufreq_register_em(struct cpufreq_policy *policy) in cppc_cpufreq_register_em() argument
559 cpu_data = policy->driver_data; in cppc_cpufreq_register_em()
560 em_dev_register_perf_domain(get_cpu_device(policy->cpu), in cppc_cpufreq_register_em()
561 get_perf_level_count(policy), &em_cb, in cppc_cpufreq_register_em()
608 static void cppc_cpufreq_put_cpu_data(struct cpufreq_policy *policy) in cppc_cpufreq_put_cpu_data() argument
610 struct cppc_cpudata *cpu_data = policy->driver_data; in cppc_cpufreq_put_cpu_data()
615 policy->driver_data = NULL; in cppc_cpufreq_put_cpu_data()
618 static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) in cppc_cpufreq_cpu_init() argument
620 unsigned int cpu = policy->cpu; in cppc_cpufreq_cpu_init()
631 policy->driver_data = cpu_data; in cppc_cpufreq_cpu_init()
637 policy->min = cppc_perf_to_khz(caps, caps->lowest_nonlinear_perf); in cppc_cpufreq_cpu_init()
638 policy->max = cppc_perf_to_khz(caps, caps->nominal_perf); in cppc_cpufreq_cpu_init()
645 policy->cpuinfo.min_freq = cppc_perf_to_khz(caps, caps->lowest_perf); in cppc_cpufreq_cpu_init()
646 policy->cpuinfo.max_freq = cppc_perf_to_khz(caps, caps->nominal_perf); in cppc_cpufreq_cpu_init()
648 policy->transition_delay_us = cppc_cpufreq_get_transition_delay_us(cpu); in cppc_cpufreq_cpu_init()
649 policy->shared_type = cpu_data->shared_type; in cppc_cpufreq_cpu_init()
651 switch (policy->shared_type) { in cppc_cpufreq_cpu_init()
654 /* Nothing to be done - we'll have a policy for each CPU */ in cppc_cpufreq_cpu_init()
658 * All CPUs in the domain will share a policy and all cpufreq in cppc_cpufreq_cpu_init()
660 * in policy->driver_data. in cppc_cpufreq_cpu_init()
662 cpumask_copy(policy->cpus, cpu_data->shared_cpu_map); in cppc_cpufreq_cpu_init()
666 policy->shared_type); in cppc_cpufreq_cpu_init()
671 policy->fast_switch_possible = cppc_allow_fast_switch(); in cppc_cpufreq_cpu_init()
672 policy->dvfs_possible_from_any_cpu = true; in cppc_cpufreq_cpu_init()
681 /* Set policy->cur to max now. The governors will adjust later. */ in cppc_cpufreq_cpu_init()
682 policy->cur = cppc_perf_to_khz(caps, caps->highest_perf); in cppc_cpufreq_cpu_init()
692 cppc_cpufreq_cpu_fie_init(policy); in cppc_cpufreq_cpu_init()
696 cppc_cpufreq_put_cpu_data(policy); in cppc_cpufreq_cpu_init()
700 static int cppc_cpufreq_cpu_exit(struct cpufreq_policy *policy) in cppc_cpufreq_cpu_exit() argument
702 struct cppc_cpudata *cpu_data = policy->driver_data; in cppc_cpufreq_cpu_exit()
704 unsigned int cpu = policy->cpu; in cppc_cpufreq_cpu_exit()
707 cppc_cpufreq_cpu_fie_exit(policy); in cppc_cpufreq_cpu_exit()
716 cppc_cpufreq_put_cpu_data(policy); in cppc_cpufreq_cpu_exit()
770 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); in cppc_cpufreq_get_rate() local
775 if (!policy) in cppc_cpufreq_get_rate()
778 cpu_data = policy->driver_data; in cppc_cpufreq_get_rate()
780 cpufreq_cpu_put(policy); in cppc_cpufreq_get_rate()
812 static int cppc_cpufreq_set_boost(struct cpufreq_policy *policy, int state) in cppc_cpufreq_set_boost() argument
814 struct cppc_cpudata *cpu_data = policy->driver_data; in cppc_cpufreq_set_boost()
824 policy->max = cppc_perf_to_khz(caps, caps->highest_perf); in cppc_cpufreq_set_boost()
826 policy->max = cppc_perf_to_khz(caps, caps->nominal_perf); in cppc_cpufreq_set_boost()
827 policy->cpuinfo.max_freq = policy->max; in cppc_cpufreq_set_boost()
829 ret = freq_qos_update_request(policy->max_freq_req, policy->max); in cppc_cpufreq_set_boost()
836 static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf) in show_freqdomain_cpus() argument
838 struct cppc_cpudata *cpu_data = policy->driver_data; in show_freqdomain_cpus()
870 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); in hisi_cppc_cpufreq_get_rate() local
875 if (!policy) in hisi_cppc_cpufreq_get_rate()
878 cpu_data = policy->driver_data; in hisi_cppc_cpufreq_get_rate()
880 cpufreq_cpu_put(policy); in hisi_cppc_cpufreq_get_rate()