Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpufreq: expose a cpufreq_quick_get_max routine

This allows drivers and other code to get the max reported CPU frequency.
Initial use is for scaling ring frequency with GPU frequency in the i915
driver.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Keith Packard <keithp@keithp.com>

authored by

Jesse Barnes and committed by
Keith Packard
3d737108 6ae77e6b

+25
+20
drivers/cpufreq/cpufreq.c
··· 1199 1199 } 1200 1200 EXPORT_SYMBOL(cpufreq_quick_get); 1201 1201 1202 + /** 1203 + * cpufreq_quick_get_max - get the max reported CPU frequency for this CPU 1204 + * @cpu: CPU number 1205 + * 1206 + * Just return the max possible frequency for a given CPU. 1207 + */ 1208 + unsigned int cpufreq_quick_get_max(unsigned int cpu) 1209 + { 1210 + struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); 1211 + unsigned int ret_freq = 0; 1212 + 1213 + if (policy) { 1214 + ret_freq = policy->max; 1215 + cpufreq_cpu_put(policy); 1216 + } 1217 + 1218 + return ret_freq; 1219 + } 1220 + EXPORT_SYMBOL(cpufreq_quick_get_max); 1221 + 1202 1222 1203 1223 static unsigned int __cpufreq_get(unsigned int cpu) 1204 1224 {
+5
include/linux/cpufreq.h
··· 324 324 /* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */ 325 325 #ifdef CONFIG_CPU_FREQ 326 326 unsigned int cpufreq_quick_get(unsigned int cpu); 327 + unsigned int cpufreq_quick_get_max(unsigned int cpu); 327 328 #else 328 329 static inline unsigned int cpufreq_quick_get(unsigned int cpu) 330 + { 331 + return 0; 332 + } 333 + static inline unsigned int cpufreq_quick_get_max(unsigned int cpu) 329 334 { 330 335 return 0; 331 336 }