Lines Matching +full:max +full:- +full:frequency
1 /* SPDX-License-Identifier: GPL-2.0-only */
6 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
28 * Frequency values here are CPU kHz
30 * Maximum transition latency is in nanoseconds - if it's unknown,
34 #define CPUFREQ_ETERNAL (-1)
51 /* in 10^(-9) s = nanoseconds */
69 unsigned int max; /* in kHz */ member
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
106 * - fast_switch_possible should be set by the driver if it can
107 * guarantee that frequency can be changed on any CPU sharing the
109 * - fast_switch_enabled is to be set by governors that support fast
110 * frequency switching with the help of cpufreq_enable_fast_switch().
123 * the driver to set the frequency for this policy. To be set by the
137 /* Cached frequency lookup from cpufreq_driver_resolve_freq. */
141 /* Synchronization for frequency transitions */
147 /* cpufreq-stats */
161 * Used for passing new cpufreq policy data to the cpufreq driver's ->verify()
163 * and max values, if necessary, and specifically it must not update the
164 * frequency table.
171 unsigned int max; /* in kHz */ member
205 return cpumask_empty(policy->cpus); in policy_is_inactive()
210 return cpumask_weight(policy->cpus) > 1; in policy_is_shared()
273 #define CPUFREQ_RELATION_L 0 /* lowest frequency at or above target */
274 #define CPUFREQ_RELATION_H 1 /* highest frequency below or at target */
275 #define CPUFREQ_RELATION_C 2 /* closest frequency to target */
328 * ->fast_switch() replacement for drivers that use an internal
341 * get_intermediate should return a stable intermediate frequency
343 * to that frequency, before jumping to the frequency corresponding
349 * wish to switch to intermediate frequency for some target frequency.
350 * In that case core will directly call ->target_index().
389 * with the target frequency and so the core and governors should also invoke
390 * the diver if the target frequency does not change, but the policy min or max
395 /* loops_per_jiffy or other kernel "constants" aren't affected by frequency transitions */
405 * This should be set by platforms having multiple clock-domains, i.e.
413 * Driver will do POSTCHANGE notifications from outside of their ->target()
414 * routine and so must set cpufreq_driver->flags with this flag, so that core
421 * frequency present in freq-table exposed by the driver. For these drivers if
444 (drv->flags & CPUFREQ_IS_COOLING_DEV); in cpufreq_thermal_control_enabled()
449 unsigned int max) in cpufreq_verify_within_limits() argument
451 if (policy->min < min) in cpufreq_verify_within_limits()
452 policy->min = min; in cpufreq_verify_within_limits()
453 if (policy->max < min) in cpufreq_verify_within_limits()
454 policy->max = min; in cpufreq_verify_within_limits()
455 if (policy->min > max) in cpufreq_verify_within_limits()
456 policy->min = max; in cpufreq_verify_within_limits()
457 if (policy->max > max) in cpufreq_verify_within_limits()
458 policy->max = max; in cpufreq_verify_within_limits()
459 if (policy->min > policy->max) in cpufreq_verify_within_limits()
460 policy->min = policy->max; in cpufreq_verify_within_limits()
467 cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, in cpufreq_verify_within_cpu_limits()
468 policy->cpuinfo.max_freq); in cpufreq_verify_within_cpu_limits()
518 * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch
548 * If (cpufreq_driver->target) exists, the ->governor decides what frequency
549 * within the limits is used. If (cpufreq_driver->setpolicy> exists, these
556 * The polling frequency depends on the capability of the processor. Default
557 * polling frequency is 1000 times the transition latency of the processor. The
581 /* For governors which change frequency dynamically by themselves */
584 /* 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()
1015 return -ENODEV; in parse_perf_domain()
1066 return -EINVAL; in cpufreq_enable_boost_support()
1077 return -EOPNOTSUPP; in of_perf_domain_get_sharing_cpumask()
1113 dev_pm_opp_of_register_em(get_cpu_device(policy->cpu), in cpufreq_register_em_with_opp()
1114 policy->related_cpus); in cpufreq_register_em_with_opp()