Lines Matching full:policy
63 unsigned int cpu; /* cpu managing this policy, must be online */
74 unsigned int policy; /* see above */ member
75 unsigned int last_policy; /* policy before unplug */
96 * - Any routine that wants to read from the policy structure will
98 * - Any routine that will write to the policy structure and/or may take away
99 * the policy altogether (eg. CPU hotplug), will hold this lock in write
108 * policy and that the change will affect all of the policy CPUs then.
130 * the driver to set the frequency for this policy. To be set by the
144 /* Per policy boost enabled flag. */
171 * Used for passing new cpufreq policy data to the cpufreq driver's ->verify()
185 struct cpufreq_policy *policy; member
200 void cpufreq_cpu_put(struct cpufreq_policy *policy);
210 static inline void cpufreq_cpu_put(struct cpufreq_policy *policy) { } in cpufreq_cpu_put() argument
213 static inline bool policy_is_inactive(struct cpufreq_policy *policy) in policy_is_inactive() argument
215 return cpumask_empty(policy->cpus); in policy_is_inactive()
218 static inline bool policy_is_shared(struct cpufreq_policy *policy) in policy_is_shared() argument
220 return cpumask_weight(policy->cpus) > 1; in policy_is_shared()
233 void cpufreq_cpu_release(struct cpufreq_policy *policy);
234 int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
235 void refresh_frequency_limits(struct cpufreq_policy *policy);
240 struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
241 void cpufreq_enable_fast_switch(struct cpufreq_policy *policy);
242 void cpufreq_disable_fast_switch(struct cpufreq_policy *policy);
280 void cpufreq_stats_create_table(struct cpufreq_policy *policy);
281 void cpufreq_stats_free_table(struct cpufreq_policy *policy);
282 void cpufreq_stats_record_transition(struct cpufreq_policy *policy,
285 static inline void cpufreq_stats_create_table(struct cpufreq_policy *policy) { } in cpufreq_stats_create_table() argument
286 static inline void cpufreq_stats_free_table(struct cpufreq_policy *policy) { } in cpufreq_stats_free_table() argument
287 static inline void cpufreq_stats_record_transition(struct cpufreq_policy *policy, in cpufreq_stats_record_transition() argument
342 int (*init)(struct cpufreq_policy *policy);
343 int (*verify)(struct cpufreq_policy_data *policy);
346 int (*setpolicy)(struct cpufreq_policy *policy);
348 int (*target)(struct cpufreq_policy *policy,
351 int (*target_index)(struct cpufreq_policy *policy,
353 unsigned int (*fast_switch)(struct cpufreq_policy *policy,
383 unsigned int (*get_intermediate)(struct cpufreq_policy *policy,
385 int (*target_intermediate)(struct cpufreq_policy *policy,
391 /* Called to update policy limits on firmware notifications. */
397 int (*online)(struct cpufreq_policy *policy);
398 int (*offline)(struct cpufreq_policy *policy);
399 void (*exit)(struct cpufreq_policy *policy);
400 int (*suspend)(struct cpufreq_policy *policy);
401 int (*resume)(struct cpufreq_policy *policy);
404 void (*ready)(struct cpufreq_policy *policy);
410 int (*set_boost)(struct cpufreq_policy *policy, int state);
414 * policy is properly initialized, but before the governor is started.
416 void (*register_em)(struct cpufreq_policy *policy);
424 * the diver if the target frequency does not change, but the policy min or max
481 static inline void cpufreq_verify_within_limits(struct cpufreq_policy_data *policy, in cpufreq_verify_within_limits() argument
485 policy->max = clamp(policy->max, min, max); in cpufreq_verify_within_limits()
486 policy->min = clamp(policy->min, min, policy->max); in cpufreq_verify_within_limits()
490 cpufreq_verify_within_cpu_limits(struct cpufreq_policy_data *policy) in cpufreq_verify_within_cpu_limits() argument
492 cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, in cpufreq_verify_within_cpu_limits()
493 policy->cpuinfo.max_freq); in cpufreq_verify_within_cpu_limits()
499 int cpufreq_generic_suspend(struct cpufreq_policy *policy);
516 /* Policy Notifiers */
524 void cpufreq_freq_transition_begin(struct cpufreq_policy *policy,
526 void cpufreq_freq_transition_end(struct cpufreq_policy *policy,
582 int (*init)(struct cpufreq_policy *policy);
583 void (*exit)(struct cpufreq_policy *policy);
584 int (*start)(struct cpufreq_policy *policy);
585 void (*stop)(struct cpufreq_policy *policy);
586 void (*limits)(struct cpufreq_policy *policy);
587 ssize_t (*show_setspeed) (struct cpufreq_policy *policy,
589 int (*store_setspeed) (struct cpufreq_policy *policy,
606 unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,
613 int cpufreq_driver_target(struct cpufreq_policy *policy,
616 int __cpufreq_driver_target(struct cpufreq_policy *policy,
619 unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy,
621 unsigned int cpufreq_policy_transition_delay_us(struct cpufreq_policy *policy);
624 int cpufreq_start_governor(struct cpufreq_policy *policy);
625 void cpufreq_stop_governor(struct cpufreq_policy *policy);
644 static inline void cpufreq_policy_apply_limits(struct cpufreq_policy *policy) in cpufreq_policy_apply_limits() argument
646 if (policy->max < policy->cur) in cpufreq_policy_apply_limits()
647 __cpufreq_driver_target(policy, policy->max, in cpufreq_policy_apply_limits()
649 else if (policy->min > policy->cur) in cpufreq_policy_apply_limits()
650 __cpufreq_driver_target(policy, policy->min, in cpufreq_policy_apply_limits()
765 int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
768 int cpufreq_frequency_table_verify(struct cpufreq_policy_data *policy,
770 int cpufreq_generic_frequency_table_verify(struct cpufreq_policy_data *policy);
772 int cpufreq_table_index_unsorted(struct cpufreq_policy *policy,
775 int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy,
784 bool policy_has_boost_freq(struct cpufreq_policy *policy);
787 static inline int cpufreq_table_find_index_al(struct cpufreq_policy *policy, in cpufreq_table_find_index_al() argument
791 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_al()
809 static inline int cpufreq_table_find_index_dl(struct cpufreq_policy *policy, in cpufreq_table_find_index_dl() argument
813 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_dl()
840 static inline int cpufreq_table_find_index_l(struct cpufreq_policy *policy, in cpufreq_table_find_index_l() argument
844 target_freq = clamp_val(target_freq, policy->min, policy->max); in cpufreq_table_find_index_l()
846 if (policy->freq_table_sorted == CPUFREQ_TABLE_SORTED_ASCENDING) in cpufreq_table_find_index_l()
847 return cpufreq_table_find_index_al(policy, target_freq, in cpufreq_table_find_index_l()
850 return cpufreq_table_find_index_dl(policy, target_freq, in cpufreq_table_find_index_l()
855 static inline int cpufreq_table_find_index_ah(struct cpufreq_policy *policy, in cpufreq_table_find_index_ah() argument
859 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_ah()
886 static inline int cpufreq_table_find_index_dh(struct cpufreq_policy *policy, in cpufreq_table_find_index_dh() argument
890 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_dh()
908 static inline int cpufreq_table_find_index_h(struct cpufreq_policy *policy, in cpufreq_table_find_index_h() argument
912 target_freq = clamp_val(target_freq, policy->min, policy->max); in cpufreq_table_find_index_h()
914 if (policy->freq_table_sorted == CPUFREQ_TABLE_SORTED_ASCENDING) in cpufreq_table_find_index_h()
915 return cpufreq_table_find_index_ah(policy, target_freq, in cpufreq_table_find_index_h()
918 return cpufreq_table_find_index_dh(policy, target_freq, in cpufreq_table_find_index_h()
923 static inline int cpufreq_table_find_index_ac(struct cpufreq_policy *policy, in cpufreq_table_find_index_ac() argument
927 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_ac()
958 static inline int cpufreq_table_find_index_dc(struct cpufreq_policy *policy, in cpufreq_table_find_index_dc() argument
962 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_dc()
993 static inline int cpufreq_table_find_index_c(struct cpufreq_policy *policy, in cpufreq_table_find_index_c() argument
997 target_freq = clamp_val(target_freq, policy->min, policy->max); in cpufreq_table_find_index_c()
999 if (policy->freq_table_sorted == CPUFREQ_TABLE_SORTED_ASCENDING) in cpufreq_table_find_index_c()
1000 return cpufreq_table_find_index_ac(policy, target_freq, in cpufreq_table_find_index_c()
1003 return cpufreq_table_find_index_dc(policy, target_freq, in cpufreq_table_find_index_c()
1007 static inline bool cpufreq_is_in_limits(struct cpufreq_policy *policy, int idx) in cpufreq_is_in_limits() argument
1014 freq = policy->freq_table[idx].frequency; in cpufreq_is_in_limits()
1016 return freq == clamp_val(freq, policy->min, policy->max); in cpufreq_is_in_limits()
1019 static inline int cpufreq_frequency_table_target(struct cpufreq_policy *policy, in cpufreq_frequency_table_target() argument
1023 bool efficiencies = policy->efficiencies_available && in cpufreq_frequency_table_target()
1030 if (unlikely(policy->freq_table_sorted == CPUFREQ_TABLE_UNSORTED)) in cpufreq_frequency_table_target()
1031 return cpufreq_table_index_unsorted(policy, target_freq, in cpufreq_frequency_table_target()
1036 idx = cpufreq_table_find_index_l(policy, target_freq, in cpufreq_frequency_table_target()
1040 idx = cpufreq_table_find_index_h(policy, target_freq, in cpufreq_frequency_table_target()
1044 idx = cpufreq_table_find_index_c(policy, target_freq, in cpufreq_frequency_table_target()
1052 /* Limit frequency index to honor policy->min/max */ in cpufreq_frequency_table_target()
1053 if (!cpufreq_is_in_limits(policy, idx) && efficiencies) { in cpufreq_frequency_table_target()
1061 static inline int cpufreq_table_count_valid_entries(const struct cpufreq_policy *policy) in cpufreq_table_count_valid_entries() argument
1066 if (unlikely(!policy->freq_table)) in cpufreq_table_count_valid_entries()
1069 cpufreq_for_each_valid_entry(pos, policy->freq_table) in cpufreq_table_count_valid_entries()
1077 * @policy: the &struct cpufreq_policy containing the inefficient frequency
1086 cpufreq_table_set_inefficient(struct cpufreq_policy *policy, in cpufreq_table_set_inefficient() argument
1092 if (policy->freq_table_sorted == CPUFREQ_TABLE_UNSORTED) in cpufreq_table_set_inefficient()
1095 cpufreq_for_each_valid_entry(pos, policy->freq_table) { in cpufreq_table_set_inefficient()
1098 policy->efficiencies_available = true; in cpufreq_table_set_inefficient()
1167 static inline bool policy_has_boost_freq(struct cpufreq_policy *policy) in policy_has_boost_freq() argument
1173 cpufreq_table_set_inefficient(struct cpufreq_policy *policy, in cpufreq_table_set_inefficient() argument
1202 int cpufreq_table_validate_and_sort(struct cpufreq_policy *policy);
1205 void cpufreq_generic_init(struct cpufreq_policy *policy,
1209 static inline void cpufreq_register_em_with_opp(struct cpufreq_policy *policy) in cpufreq_register_em_with_opp() argument
1211 dev_pm_opp_of_register_em(get_cpu_device(policy->cpu), in cpufreq_register_em_with_opp()
1212 policy->related_cpus); in cpufreq_register_em_with_opp()