From 1013687edc383b0f2912b0b5bc87331dd22a24e5 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Thu, 9 Jan 2003 22:01:31 -0800 Subject: [PATCH] cpufreq: frequency table helpers This patch adds "frequency table helpers" to kernel/cpufreq.c and updates some drivers to use them. Most CPU frequency scaling methods only support a few static frequencies. In these drivers a lot of duplicated code existed in the ->setpolicy and ->verify calls. Please note that this in no way changes the behaviour of cpufreq or of the ->setpolicy or ->verify calls. These "frequency table helpers" aren't for drivers which either only support policies (longrun) or really many frequency states (ARM, gx-suspmod). --- include/linux/cpufreq.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'include/linux') diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index ab2890b619d0..0e008ba3618c 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -241,4 +241,27 @@ enum { #endif /* CONFIG_CPU_FREQ_24_API */ +/********************************************************************* + * FREQUENCY TABLE HELPERS * + *********************************************************************/ + +#define CPUFREQ_ENTRY_INVALID ~0 +#define CPUFREQ_TABLE_END ~1 + +struct cpufreq_frequency_table { + unsigned int index; /* any */ + unsigned int frequency; /* kHz - doesn't need to be in ascending + * order */ +}; + +int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, + struct cpufreq_frequency_table *table); + +int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, + struct cpufreq_frequency_table *table); + +int cpufreq_frequency_table_setpolicy(struct cpufreq_policy *policy, + struct cpufreq_frequency_table *table, + unsigned int *index); + #endif /* _LINUX_CPUFREQ_H */ -- cgit v1.2.3