Lines Matching +full:max +full:- +full:frequency

1 /* SPDX-License-Identifier: GPL-2.0-only */
6 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
24 * Frequency values here are CPU kHz
26 * Maximum transition latency is in nanoseconds - if it's unknown,
30 #define CPUFREQ_ETERNAL (-1)
47 /* in 10^(-9) s = nanoseconds */
65 unsigned int max; /* in kHz */ member
68 unsigned int restore_freq; /* = policy->cur before transition */
93 * - Any routine that wants to read from the policy structure will
95 * - Any routine that will write to the policy structure and/or may take away
103 * - fast_switch_possible should be set by the driver if it can
104 * guarantee that frequency can be changed on any CPU sharing the
106 * - fast_switch_enabled is to be set by governors that support fast
107 * frequency switching with the help of cpufreq_enable_fast_switch().
120 * the driver to set the frequency for this policy. To be set by the
134 /* Cached frequency lookup from cpufreq_driver_resolve_freq. */
138 /* Synchronization for frequency transitions */
144 /* cpufreq-stats */
158 * Used for passing new cpufreq policy data to the cpufreq driver's ->verify()
160 * and max values, if necessary, and specifically it must not update the
161 * frequency table.
168 unsigned int max; /* in kHz */ member
202 return cpumask_empty(policy->cpus); in policy_is_inactive()
207 return cpumask_weight(policy->cpus) > 1; in policy_is_shared()
270 #define CPUFREQ_RELATION_L 0 /* lowest frequency at or above target */
271 #define CPUFREQ_RELATION_H 1 /* highest frequency below or at target */
272 #define CPUFREQ_RELATION_C 2 /* closest frequency to target */
318 * On failure, should always restore frequency to policy->restore_freq
330 * Caches and returns the lowest driver-supported frequency greater than
331 * or equal to the target frequency, subject to any driver limitations.
332 * Does not set the frequency. Only to be implemented for drivers with
342 * get_intermediate should return a stable intermediate frequency
344 * to that frequency, before jumping to the frequency corresponding
350 * wish to switch to intermediate frequency for some target frequency.
351 * In that case core will directly call ->target_index().
386 /* driver isn't removed even if all ->init() calls failed */
389 /* loops_per_jiffy or other kernel "constants" aren't affected by frequency transitions */
396 * This should be set by platforms having multiple clock-domains, i.e.
404 * Driver will do POSTCHANGE notifications from outside of their ->target()
405 * routine and so must set cpufreq_driver->flags with this flag, so that core
412 * frequency present in freq-table exposed by the driver. For these drivers if
433 * with the target frequency and so the core and governors should also invoke
434 * the diver if the target frequency does not change, but the policy min or max
449 (drv->flags & CPUFREQ_IS_COOLING_DEV); in cpufreq_thermal_control_enabled()
454 unsigned int max) in cpufreq_verify_within_limits() argument
456 if (policy->min < min) in cpufreq_verify_within_limits()
457 policy->min = min; in cpufreq_verify_within_limits()
458 if (policy->max < min) in cpufreq_verify_within_limits()
459 policy->max = min; in cpufreq_verify_within_limits()
460 if (policy->min > max) in cpufreq_verify_within_limits()
461 policy->min = max; in cpufreq_verify_within_limits()
462 if (policy->max > max) in cpufreq_verify_within_limits()
463 policy->max = max; in cpufreq_verify_within_limits()
464 if (policy->min > policy->max) in cpufreq_verify_within_limits()
465 policy->min = policy->max; in cpufreq_verify_within_limits()
472 cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, in cpufreq_verify_within_cpu_limits()
473 policy->cpuinfo.max_freq); in cpufreq_verify_within_cpu_limits()
523 * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch
553 * If (cpufreq_driver->target) exists, the ->governor decides what frequency
554 * within the limits is used. If (cpufreq_driver->setpolicy> exists, these
561 * The polling frequency depends on the capability of the processor. Default
562 * polling frequency is 1000 times the transition latency of the processor. The
586 /* For governors which change frequency dynamically by themselves */
589 /* For governors wanting the target frequency to be set exactly */
629 if (policy->max < policy->cur) in cpufreq_policy_apply_limits()
630 __cpufreq_driver_target(policy, policy->max, CPUFREQ_RELATION_H); in cpufreq_policy_apply_limits()
631 else if (policy->min > policy->cur) in cpufreq_policy_apply_limits()
632 __cpufreq_driver_target(policy, policy->min, CPUFREQ_RELATION_L); in cpufreq_policy_apply_limits()
659 * FREQUENCY TABLE HELPERS *
662 /* Special Values of .frequency field */
671 unsigned int frequency; /* kHz - doesn't need to be in ascending member
685 return -EINVAL; in dev_pm_opp_init_cpufreq_table()
696 * cpufreq_for_each_entry - iterate over a cpufreq_frequency_table
702 for (pos = table; pos->frequency != CPUFREQ_TABLE_END; pos++)
705 * cpufreq_for_each_entry_idx - iterate over a cpufreq_frequency_table
713 for (pos = table, idx = 0; pos->frequency != CPUFREQ_TABLE_END; \
717 * cpufreq_for_each_valid_entry - iterate over a cpufreq_frequency_table
724 for (pos = table; pos->frequency != CPUFREQ_TABLE_END; pos++) \
725 if (pos->frequency == CPUFREQ_ENTRY_INVALID) \
730 * cpufreq_for_each_valid_entry_idx - iterate with index over a cpufreq
739 if (pos->frequency == CPUFREQ_ENTRY_INVALID) \
769 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_al()
772 int idx, best = -1; in cpufreq_table_find_index_al()
775 freq = pos->frequency; in cpufreq_table_find_index_al()
790 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_dl()
793 int idx, best = -1; in cpufreq_table_find_index_dl()
796 freq = pos->frequency; in cpufreq_table_find_index_dl()
807 if (best == -1) in cpufreq_table_find_index_dl()
816 /* Works only on sorted freq-tables */
820 target_freq = clamp_val(target_freq, policy->min, policy->max); in cpufreq_table_find_index_l()
822 if (policy->freq_table_sorted == CPUFREQ_TABLE_SORTED_ASCENDING) in cpufreq_table_find_index_l()
832 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_ah()
835 int idx, best = -1; in cpufreq_table_find_index_ah()
838 freq = pos->frequency; in cpufreq_table_find_index_ah()
849 if (best == -1) in cpufreq_table_find_index_ah()
862 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_dh()
865 int idx, best = -1; in cpufreq_table_find_index_dh()
868 freq = pos->frequency; in cpufreq_table_find_index_dh()
879 /* Works only on sorted freq-tables */
883 target_freq = clamp_val(target_freq, policy->min, policy->max); in cpufreq_table_find_index_h()
885 if (policy->freq_table_sorted == CPUFREQ_TABLE_SORTED_ASCENDING) in cpufreq_table_find_index_h()
895 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_ac()
898 int idx, best = -1; in cpufreq_table_find_index_ac()
901 freq = pos->frequency; in cpufreq_table_find_index_ac()
912 if (best == -1) in cpufreq_table_find_index_ac()
916 if (target_freq - table[best].frequency > freq - target_freq) in cpufreq_table_find_index_ac()
929 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_dc()
932 int idx, best = -1; in cpufreq_table_find_index_dc()
935 freq = pos->frequency; in cpufreq_table_find_index_dc()
946 if (best == -1) in cpufreq_table_find_index_dc()
950 if (table[best].frequency - target_freq > target_freq - freq) in cpufreq_table_find_index_dc()
959 /* Works only on sorted freq-tables */
963 target_freq = clamp_val(target_freq, policy->min, policy->max); in cpufreq_table_find_index_c()
965 if (policy->freq_table_sorted == CPUFREQ_TABLE_SORTED_ASCENDING) in cpufreq_table_find_index_c()
975 if (unlikely(policy->freq_table_sorted == CPUFREQ_TABLE_UNSORTED)) in cpufreq_frequency_table_target()
997 if (unlikely(!policy->freq_table)) in cpufreq_table_count_valid_entries()
1000 cpufreq_for_each_valid_entry(pos, policy->freq_table) in cpufreq_table_count_valid_entries()
1017 return -EINVAL; in cpufreq_enable_boost_support()