aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/cpu-freq
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2013-10-25 10:15:48 -0400
committerRafael J. Wysocki <rjw@rjwysocki.net>2013-10-25 16:42:24 -0400
commit9c0ebcf78fde0ffa348a95a544c6d3f2dac5af65 (patch)
tree0aa1814b3cdbd6900a6494d8f0c56551d90cf693 /Documentation/cpu-freq
parent6ddee424fea2d269c2f402278d93165c7b92dc58 (diff)
cpufreq: Implement light weight ->target_index() routine
Currently, the prototype of cpufreq_drivers target routines is: int target(struct cpufreq_policy *policy, unsigned int target_freq, unsigned int relation); And most of the drivers call cpufreq_frequency_table_target() to get a valid index of their frequency table which is closest to the target_freq. And they don't use target_freq and relation after that. So, it makes sense to just do this work in cpufreq core before calling cpufreq_frequency_table_target() and simply pass index instead. But this can be done only with drivers which expose their frequency table with cpufreq core. For others we need to stick with the old prototype of target() until those drivers are converted to expose frequency tables. This patch implements the new light weight prototype for target_index() routine. It looks like this: int target_index(struct cpufreq_policy *policy, unsigned int index); CPUFreq core will call cpufreq_frequency_table_target() before calling this routine and pass index to it. Because CPUFreq core now requires to call routines present in freq_table.c CONFIG_CPU_FREQ_TABLE must be enabled all the time. This also marks target() interface as deprecated. So, that new drivers avoid using it. And Documentation is updated accordingly. It also converts existing .target() to newly defined light weight .target_index() routine for many driver. Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no> Acked-by: Jesper Nilsson <jesper.nilsson@axis.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Russell King <linux@arm.linux.org.uk> Acked-by: David S. Miller <davem@davemloft.net> Tested-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rjw@rjwysocki.net>
Diffstat (limited to 'Documentation/cpu-freq')
-rw-r--r--Documentation/cpu-freq/cpu-drivers.txt27
-rw-r--r--Documentation/cpu-freq/governors.txt4
2 files changed, 20 insertions, 11 deletions
diff --git a/Documentation/cpu-freq/cpu-drivers.txt b/Documentation/cpu-freq/cpu-drivers.txt
index 40282e617913..8b1a4451422e 100644
--- a/Documentation/cpu-freq/cpu-drivers.txt
+++ b/Documentation/cpu-freq/cpu-drivers.txt
@@ -23,8 +23,8 @@ Contents:
231.1 Initialization 231.1 Initialization
241.2 Per-CPU Initialization 241.2 Per-CPU Initialization
251.3 verify 251.3 verify
261.4 target or setpolicy? 261.4 target/target_index or setpolicy?
271.5 target 271.5 target/target_index
281.6 setpolicy 281.6 setpolicy
292. Frequency Table Helpers 292. Frequency Table Helpers
30 30
@@ -56,7 +56,8 @@ cpufreq_driver.init - A pointer to the per-CPU initialization
56cpufreq_driver.verify - A pointer to a "verification" function. 56cpufreq_driver.verify - A pointer to a "verification" function.
57 57
58cpufreq_driver.setpolicy _or_ 58cpufreq_driver.setpolicy _or_
59cpufreq_driver.target - See below on the differences. 59cpufreq_driver.target/
60target_index - See below on the differences.
60 61
61And optionally 62And optionally
62 63
@@ -66,7 +67,7 @@ cpufreq_driver.resume - A pointer to a per-CPU resume function
66 which is called with interrupts disabled 67 which is called with interrupts disabled
67 and _before_ the pre-suspend frequency 68 and _before_ the pre-suspend frequency
68 and/or policy is restored by a call to 69 and/or policy is restored by a call to
69 ->target or ->setpolicy. 70 ->target/target_index or ->setpolicy.
70 71
71cpufreq_driver.attr - A pointer to a NULL-terminated list of 72cpufreq_driver.attr - A pointer to a NULL-terminated list of
72 "struct freq_attr" which allow to 73 "struct freq_attr" which allow to
@@ -103,8 +104,8 @@ policy->governor must contain the "default policy" for
103 this CPU. A few moments later, 104 this CPU. A few moments later,
104 cpufreq_driver.verify and either 105 cpufreq_driver.verify and either
105 cpufreq_driver.setpolicy or 106 cpufreq_driver.setpolicy or
106 cpufreq_driver.target is called with 107 cpufreq_driver.target/target_index is called
107 these values. 108 with these values.
108 109
109For setting some of these values (cpuinfo.min[max]_freq, policy->min[max]), the 110For setting some of these values (cpuinfo.min[max]_freq, policy->min[max]), the
110frequency table helpers might be helpful. See the section 2 for more information 111frequency table helpers might be helpful. See the section 2 for more information
@@ -133,20 +134,28 @@ range) is within policy->min and policy->max. If necessary, increase
133policy->max first, and only if this is no solution, decrease policy->min. 134policy->max first, and only if this is no solution, decrease policy->min.
134 135
135 136
1361.4 target or setpolicy? 1371.4 target/target_index or setpolicy?
137---------------------------- 138----------------------------
138 139
139Most cpufreq drivers or even most cpu frequency scaling algorithms 140Most cpufreq drivers or even most cpu frequency scaling algorithms
140only allow the CPU to be set to one frequency. For these, you use the 141only allow the CPU to be set to one frequency. For these, you use the
141->target call. 142->target/target_index call.
142 143
143Some cpufreq-capable processors switch the frequency between certain 144Some cpufreq-capable processors switch the frequency between certain
144limits on their own. These shall use the ->setpolicy call 145limits on their own. These shall use the ->setpolicy call
145 146
146 147
1471.4. target 1481.4. target/target_index
148------------- 149-------------
149 150
151The target_index call has two arguments: struct cpufreq_policy *policy,
152and unsigned int index (into the exposed frequency table).
153
154The CPUfreq driver must set the new frequency when called here. The
155actual frequency must be determined by freq_table[index].frequency.
156
157Deprecated:
158----------
150The target call has three arguments: struct cpufreq_policy *policy, 159The target call has three arguments: struct cpufreq_policy *policy,
151unsigned int target_frequency, unsigned int relation. 160unsigned int target_frequency, unsigned int relation.
152 161
diff --git a/Documentation/cpu-freq/governors.txt b/Documentation/cpu-freq/governors.txt
index 219970ba54b7..77ec21574fb1 100644
--- a/Documentation/cpu-freq/governors.txt
+++ b/Documentation/cpu-freq/governors.txt
@@ -40,7 +40,7 @@ Most cpufreq drivers (in fact, all except one, longrun) or even most
40cpu frequency scaling algorithms only offer the CPU to be set to one 40cpu frequency scaling algorithms only offer the CPU to be set to one
41frequency. In order to offer dynamic frequency scaling, the cpufreq 41frequency. In order to offer dynamic frequency scaling, the cpufreq
42core must be able to tell these drivers of a "target frequency". So 42core must be able to tell these drivers of a "target frequency". So
43these specific drivers will be transformed to offer a "->target" 43these specific drivers will be transformed to offer a "->target/target_index"
44call instead of the existing "->setpolicy" call. For "longrun", all 44call instead of the existing "->setpolicy" call. For "longrun", all
45stays the same, though. 45stays the same, though.
46 46
@@ -71,7 +71,7 @@ CPU can be set to switch independently | CPU can only be set
71 / the limits of policy->{min,max} 71 / the limits of policy->{min,max}
72 / \ 72 / \
73 / \ 73 / \
74 Using the ->setpolicy call, Using the ->target call, 74 Using the ->setpolicy call, Using the ->target/target_index call,
75 the limits and the the frequency closest 75 the limits and the the frequency closest
76 "policy" is set. to target_freq is set. 76 "policy" is set. to target_freq is set.
77 It is assured that it 77 It is assured that it