Lines Matching +full:max +full:- +full:freq

1 /* SPDX-License-Identifier: GPL-2.0-only */
6 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
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
72 unsigned int suspend_freq; /* freq to set during suspend */
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
109 * - fast_switch_enabled is to be set by governors that support fast
157 /* cpufreq-stats */
171 * Used for passing new cpufreq policy data to the cpufreq driver's ->verify()
173 * and max values, if necessary, and specifically it must not update the
181 unsigned int max; /* in kHz */ member
194 #define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */
195 #define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/
215 return cpumask_empty(policy->cpus); in policy_is_inactive()
220 return cpumask_weight(policy->cpus) > 1; in policy_is_shared()
356 * ->fast_switch() replacement for drivers that use an internal
359 * if ->fast_switch is set too, because in those cases (under specific
381 * In that case core will directly call ->target_index().
424 * the diver if the target frequency does not change, but the policy min or max
439 * This should be set by platforms having multiple clock-domains, i.e.
447 * Driver will do POSTCHANGE notifications from outside of their ->target()
448 * routine and so must set cpufreq_driver->flags with this flag, so that core
455 * frequency present in freq-table exposed by the driver. For these drivers if
456 * CPU is found running at an out of table freq, we will try to set it to a freq
478 (drv->flags & CPUFREQ_IS_COOLING_DEV); in cpufreq_thermal_control_enabled()
483 unsigned int max) 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()
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()
543 * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch
573 * If (cpufreq_driver->target) exists, the ->governor decides what frequency
574 * within the limits is used. If (cpufreq_driver->setpolicy> exists, these
590 unsigned int freq);
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()
696 unsigned int frequency; /* kHz - doesn't need to be in ascending
701 * cpufreq_for_each_entry - iterate over a cpufreq_frequency_table
707 for (pos = table; pos->frequency != CPUFREQ_TABLE_END; pos++)
710 * cpufreq_for_each_entry_idx - iterate over a cpufreq_frequency_table
718 for (pos = table, idx = 0; pos->frequency != CPUFREQ_TABLE_END; \
722 * cpufreq_for_each_valid_entry - iterate over a cpufreq_frequency_table
729 for (pos = table; pos->frequency != CPUFREQ_TABLE_END; pos++) \
730 if (pos->frequency == CPUFREQ_ENTRY_INVALID) \
735 * cpufreq_for_each_valid_entry_idx - iterate with index over a cpufreq
744 if (pos->frequency == CPUFREQ_ENTRY_INVALID) \
749 * cpufreq_for_each_efficient_entry_idx - iterate with index over a cpufreq
760 if (efficiencies && (pos->flags & CPUFREQ_INEFFICIENT_FREQ)) \
776 unsigned int freq);
786 /* Find lowest freq at or above target in a table in ascending order */
791 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_al()
793 unsigned int freq; in cpufreq_table_find_index_al() local
794 int idx, best = -1; in cpufreq_table_find_index_al()
797 freq = pos->frequency; in cpufreq_table_find_index_al()
799 if (freq >= target_freq) in cpufreq_table_find_index_al()
808 /* Find lowest freq at or above target in a table in descending order */
813 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_dl()
815 unsigned int freq; in cpufreq_table_find_index_dl() local
816 int idx, best = -1; in cpufreq_table_find_index_dl()
819 freq = pos->frequency; in cpufreq_table_find_index_dl()
821 if (freq == target_freq) in cpufreq_table_find_index_dl()
824 if (freq > target_freq) { in cpufreq_table_find_index_dl()
829 /* No freq found above target_freq */ in cpufreq_table_find_index_dl()
830 if (best == -1) in cpufreq_table_find_index_dl()
839 /* Works only on sorted freq-tables */
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()
854 /* Find highest freq at or below target in a table in ascending order */
859 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_ah()
861 unsigned int freq; in cpufreq_table_find_index_ah() local
862 int idx, best = -1; in cpufreq_table_find_index_ah()
865 freq = pos->frequency; in cpufreq_table_find_index_ah()
867 if (freq == target_freq) in cpufreq_table_find_index_ah()
870 if (freq < target_freq) { in cpufreq_table_find_index_ah()
875 /* No freq found below target_freq */ in cpufreq_table_find_index_ah()
876 if (best == -1) in cpufreq_table_find_index_ah()
885 /* Find highest freq at or below target in a table in descending order */
890 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_dh()
892 unsigned int freq; in cpufreq_table_find_index_dh() local
893 int idx, best = -1; in cpufreq_table_find_index_dh()
896 freq = pos->frequency; in cpufreq_table_find_index_dh()
898 if (freq <= target_freq) in cpufreq_table_find_index_dh()
907 /* Works only on sorted freq-tables */
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()
922 /* Find closest freq to target in a table in ascending order */
927 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_ac()
929 unsigned int freq; in cpufreq_table_find_index_ac() local
930 int idx, best = -1; in cpufreq_table_find_index_ac()
933 freq = pos->frequency; in cpufreq_table_find_index_ac()
935 if (freq == target_freq) in cpufreq_table_find_index_ac()
938 if (freq < target_freq) { in cpufreq_table_find_index_ac()
943 /* No freq found below target_freq */ in cpufreq_table_find_index_ac()
944 if (best == -1) in cpufreq_table_find_index_ac()
947 /* Choose the closest freq */ in cpufreq_table_find_index_ac()
948 if (target_freq - table[best].frequency > freq - target_freq) in cpufreq_table_find_index_ac()
957 /* Find closest freq to target in a table in descending order */
962 struct cpufreq_frequency_table *table = policy->freq_table; in cpufreq_table_find_index_dc()
964 unsigned int freq; in cpufreq_table_find_index_dc() local
965 int idx, best = -1; in cpufreq_table_find_index_dc()
968 freq = pos->frequency; in cpufreq_table_find_index_dc()
970 if (freq == target_freq) in cpufreq_table_find_index_dc()
973 if (freq > target_freq) { in cpufreq_table_find_index_dc()
978 /* No freq found above target_freq */ in cpufreq_table_find_index_dc()
979 if (best == -1) in cpufreq_table_find_index_dc()
982 /* Choose the closest freq */ in cpufreq_table_find_index_dc()
983 if (table[best].frequency - target_freq > target_freq - freq) in cpufreq_table_find_index_dc()
992 /* Works only on sorted freq-tables */
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()
1009 unsigned int freq; in cpufreq_is_in_limits() local
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()
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()
1052 /* Limit frequency index to honor policy->min/max */ in cpufreq_frequency_table_target()
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()
1076 * cpufreq_table_set_inefficient() - Mark a frequency as inefficient
1092 if (policy->freq_table_sorted == CPUFREQ_TABLE_UNSORTED) in cpufreq_table_set_inefficient()
1093 return -EINVAL; in cpufreq_table_set_inefficient()
1095 cpufreq_for_each_valid_entry(pos, policy->freq_table) { in cpufreq_table_set_inefficient()
1096 if (pos->frequency == frequency) { in cpufreq_table_set_inefficient()
1097 pos->flags |= CPUFREQ_INEFFICIENT_FREQ; in cpufreq_table_set_inefficient()
1098 policy->efficiencies_available = true; in cpufreq_table_set_inefficient()
1103 return -EINVAL; in cpufreq_table_set_inefficient()
1114 return -ENODEV; in parse_perf_domain()
1164 return -EINVAL; in cpufreq_enable_boost_support()
1176 return -EINVAL; in cpufreq_table_set_inefficient()
1183 return -EOPNOTSUPP; in of_perf_domain_get_sharing_cpumask()
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()