diff options
Diffstat (limited to 'recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq-hotplug/0001-cpufreq-helpers-for-walking-the-frequency-table.patch')
-rw-r--r-- | recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq-hotplug/0001-cpufreq-helpers-for-walking-the-frequency-table.patch | 134 |
1 files changed, 0 insertions, 134 deletions
diff --git a/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq-hotplug/0001-cpufreq-helpers-for-walking-the-frequency-table.patch b/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq-hotplug/0001-cpufreq-helpers-for-walking-the-frequency-table.patch deleted file mode 100644 index 576cd08f..00000000 --- a/recipes-kernel/linux/linux-omap-2.6.39/pm/linux-omap-2.6.39-ti-pm-wip-cpufreq-hotplug/0001-cpufreq-helpers-for-walking-the-frequency-table.patch +++ /dev/null | |||
@@ -1,134 +0,0 @@ | |||
1 | From 8726f3a7218b72a1003904a24bb000b3e4f9b4d1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Mike Turquette <mturquette@ti.com> | ||
3 | Date: Tue, 17 May 2011 09:35:54 -0500 | ||
4 | Subject: [PATCH 1/2] cpufreq: helpers for walking the frequency table | ||
5 | |||
6 | Two new functions for getting the next higher and next lower frequencies | ||
7 | in the cpufreq table, based upon a frequency supplied in kHz. | ||
8 | |||
9 | This is useful for cpufreq governors that do not target frequencies | ||
10 | based upon a percentage or a pre-determined value, but instead access | ||
11 | the cpufreq table directly. | ||
12 | |||
13 | Signed-off-by: Mike Turquette <mturquette@ti.com> | ||
14 | Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
15 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | ||
16 | --- | ||
17 | drivers/cpufreq/freq_table.c | 73 ++++++++++++++++++++++++++++++++++++++++++ | ||
18 | include/linux/cpufreq.h | 9 +++++ | ||
19 | 2 files changed, 82 insertions(+), 0 deletions(-) | ||
20 | |||
21 | diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c | ||
22 | index 0543221..11a307b 100644 | ||
23 | --- a/drivers/cpufreq/freq_table.c | ||
24 | +++ b/drivers/cpufreq/freq_table.c | ||
25 | @@ -13,6 +13,7 @@ | ||
26 | #include <linux/module.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/cpufreq.h> | ||
29 | +#include <linux/err.h> | ||
30 | |||
31 | #define dprintk(msg...) \ | ||
32 | cpufreq_debug_printk(CPUFREQ_DEBUG_CORE, "freq-table", msg) | ||
33 | @@ -174,6 +175,78 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy, | ||
34 | } | ||
35 | EXPORT_SYMBOL_GPL(cpufreq_frequency_table_target); | ||
36 | |||
37 | +int cpufreq_frequency_table_next_lowest(struct cpufreq_policy *policy, | ||
38 | + struct cpufreq_frequency_table *table, int *index) | ||
39 | +{ | ||
40 | + unsigned int cur_freq; | ||
41 | + unsigned int next_lowest_freq; | ||
42 | + int optimal_index = -1; | ||
43 | + int i = 0; | ||
44 | + | ||
45 | + if (!policy || IS_ERR(policy) || !table || IS_ERR(table) || | ||
46 | + !index || IS_ERR(index)) | ||
47 | + return -ENOMEM; | ||
48 | + | ||
49 | + cur_freq = policy->cur; | ||
50 | + next_lowest_freq = policy->min; | ||
51 | + | ||
52 | + /* we're at the lowest frequency in the table already, bail out */ | ||
53 | + if (cur_freq == policy->min) | ||
54 | + return -EINVAL; | ||
55 | + | ||
56 | + /* walk the list, find closest freq to cur_freq that is below it */ | ||
57 | + while(table[i].frequency != CPUFREQ_TABLE_END) { | ||
58 | + if (table[i].frequency < cur_freq && | ||
59 | + table[i].frequency >= next_lowest_freq) { | ||
60 | + next_lowest_freq = table[i].frequency; | ||
61 | + optimal_index = table[i].index; | ||
62 | + } | ||
63 | + | ||
64 | + i++; | ||
65 | + } | ||
66 | + | ||
67 | + *index = optimal_index; | ||
68 | + | ||
69 | + return 0; | ||
70 | +} | ||
71 | +EXPORT_SYMBOL_GPL(cpufreq_frequency_table_next_lowest); | ||
72 | + | ||
73 | +int cpufreq_frequency_table_next_highest(struct cpufreq_policy *policy, | ||
74 | + struct cpufreq_frequency_table *table, int *index) | ||
75 | +{ | ||
76 | + unsigned int cur_freq; | ||
77 | + unsigned int next_higher_freq; | ||
78 | + int optimal_index = -1; | ||
79 | + int i = 0; | ||
80 | + | ||
81 | + if (!policy || IS_ERR(policy) || !table || IS_ERR(table) || | ||
82 | + !index || IS_ERR(index)) | ||
83 | + return -ENOMEM; | ||
84 | + | ||
85 | + cur_freq = policy->cur; | ||
86 | + next_higher_freq = policy->max; | ||
87 | + | ||
88 | + /* we're at the highest frequency in the table already, bail out */ | ||
89 | + if (cur_freq == policy->max) | ||
90 | + return -EINVAL; | ||
91 | + | ||
92 | + /* walk the list, find closest freq to cur_freq that is above it */ | ||
93 | + while(table[i].frequency != CPUFREQ_TABLE_END) { | ||
94 | + if (table[i].frequency > cur_freq && | ||
95 | + table[i].frequency <= next_higher_freq) { | ||
96 | + next_higher_freq = table[i].frequency; | ||
97 | + optimal_index = table[i].index; | ||
98 | + } | ||
99 | + | ||
100 | + i++; | ||
101 | + } | ||
102 | + | ||
103 | + *index = optimal_index; | ||
104 | + | ||
105 | + return 0; | ||
106 | +} | ||
107 | +EXPORT_SYMBOL_GPL(cpufreq_frequency_table_next_highest); | ||
108 | + | ||
109 | static DEFINE_PER_CPU(struct cpufreq_frequency_table *, cpufreq_show_table); | ||
110 | /** | ||
111 | * show_available_freqs - show available frequencies for the specified CPU | ||
112 | diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h | ||
113 | index 9343dd3..a38fca8 100644 | ||
114 | --- a/include/linux/cpufreq.h | ||
115 | +++ b/include/linux/cpufreq.h | ||
116 | @@ -396,6 +396,15 @@ void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, | ||
117 | |||
118 | void cpufreq_frequency_table_put_attr(unsigned int cpu); | ||
119 | |||
120 | +/* the following are for use in governors, or anywhere else */ | ||
121 | +extern int cpufreq_frequency_table_next_lowest(struct cpufreq_policy *policy, | ||
122 | + struct cpufreq_frequency_table *table, | ||
123 | + int *index); | ||
124 | + | ||
125 | +extern int cpufreq_frequency_table_next_highest(struct cpufreq_policy *policy, | ||
126 | + struct cpufreq_frequency_table *table, | ||
127 | + int *index); | ||
128 | + | ||
129 | |||
130 | /********************************************************************* | ||
131 | * UNIFIED DEBUG HELPERS * | ||
132 | -- | ||
133 | 1.6.6.1 | ||
134 | |||