aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/cpu-freq
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2014-06-02 13:19:28 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-06-05 17:32:29 -0400
commit1c03a2d04d7ab6d27c1fef8614f08187d974bd21 (patch)
tree3d0ad7be510d75f6b3a9caa91d027e4e31e35300 /Documentation/cpu-freq
parent5ece2399181a5abaf42a4cb607463770686778e6 (diff)
cpufreq: add support for intermediate (stable) frequencies
Douglas Anderson, recently pointed out an interesting problem due to which udelay() was expiring earlier than it should. While transitioning between frequencies few platforms may temporarily switch to a stable frequency, waiting for the main PLL to stabilize. For example: When we transition between very low frequencies on exynos, like between 200MHz and 300MHz, we may temporarily switch to a PLL running at 800MHz. No CPUFREQ notification is sent for that. That means there's a period of time when we're running at 800MHz but loops_per_jiffy is calibrated at between 200MHz and 300MHz. And so udelay behaves badly. To get this fixed in a generic way, introduce another set of callbacks get_intermediate() and target_intermediate(), only for drivers with target_index() and CPUFREQ_ASYNC_NOTIFICATION unset. get_intermediate() should return a stable intermediate frequency platform wants to switch to, and target_intermediate() should set CPU to that frequency, before jumping to the frequency corresponding to 'index'. Core will take care of sending notifications and driver doesn't have to handle them in target_intermediate() or target_index(). NOTE: ->target_index() should restore to policy->restore_freq in case of failures as core would send notifications for that. Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'Documentation/cpu-freq')
-rw-r--r--Documentation/cpu-freq/cpu-drivers.txt29
1 files changed, 27 insertions, 2 deletions
diff --git a/Documentation/cpu-freq/cpu-drivers.txt b/Documentation/cpu-freq/cpu-drivers.txt
index b045fe54986a..14f4e6336d88 100644
--- a/Documentation/cpu-freq/cpu-drivers.txt
+++ b/Documentation/cpu-freq/cpu-drivers.txt
@@ -26,6 +26,7 @@ Contents:
261.4 target/target_index or setpolicy? 261.4 target/target_index or setpolicy?
271.5 target/target_index 271.5 target/target_index
281.6 setpolicy 281.6 setpolicy
291.7 get_intermediate and target_intermediate
292. Frequency Table Helpers 302. Frequency Table Helpers
30 31
31 32
@@ -79,6 +80,10 @@ cpufreq_driver.attr - A pointer to a NULL-terminated list of
79 "struct freq_attr" which allow to 80 "struct freq_attr" which allow to
80 export values to sysfs. 81 export values to sysfs.
81 82
83cpufreq_driver.get_intermediate
84and target_intermediate Used to switch to stable frequency while
85 changing CPU frequency.
86
82 87
831.2 Per-CPU Initialization 881.2 Per-CPU Initialization
84-------------------------- 89--------------------------
@@ -151,7 +156,7 @@ Some cpufreq-capable processors switch the frequency between certain
151limits on their own. These shall use the ->setpolicy call 156limits on their own. These shall use the ->setpolicy call
152 157
153 158
1541.4. target/target_index 1591.5. target/target_index
155------------- 160-------------
156 161
157The target_index call has two arguments: struct cpufreq_policy *policy, 162The target_index call has two arguments: struct cpufreq_policy *policy,
@@ -160,6 +165,9 @@ and unsigned int index (into the exposed frequency table).
160The CPUfreq driver must set the new frequency when called here. The 165The CPUfreq driver must set the new frequency when called here. The
161actual frequency must be determined by freq_table[index].frequency. 166actual frequency must be determined by freq_table[index].frequency.
162 167
168It should always restore to earlier frequency (i.e. policy->restore_freq) in
169case of errors, even if we switched to intermediate frequency earlier.
170
163Deprecated: 171Deprecated:
164---------- 172----------
165The target call has three arguments: struct cpufreq_policy *policy, 173The target call has three arguments: struct cpufreq_policy *policy,
@@ -179,7 +187,7 @@ Here again the frequency table helper might assist you - see section 2
179for details. 187for details.
180 188
181 189
1821.5 setpolicy 1901.6 setpolicy
183--------------- 191---------------
184 192
185The setpolicy call only takes a struct cpufreq_policy *policy as 193The setpolicy call only takes a struct cpufreq_policy *policy as
@@ -190,6 +198,23 @@ setting when policy->policy is CPUFREQ_POLICY_PERFORMANCE, and a
190powersaving-oriented setting when CPUFREQ_POLICY_POWERSAVE. Also check 198powersaving-oriented setting when CPUFREQ_POLICY_POWERSAVE. Also check
191the reference implementation in drivers/cpufreq/longrun.c 199the reference implementation in drivers/cpufreq/longrun.c
192 200
2011.7 get_intermediate and target_intermediate
202--------------------------------------------
203
204Only for drivers with target_index() and CPUFREQ_ASYNC_NOTIFICATION unset.
205
206get_intermediate should return a stable intermediate frequency platform wants to
207switch to, and target_intermediate() should set CPU to to that frequency, before
208jumping to the frequency corresponding to 'index'. Core will take care of
209sending notifications and driver doesn't have to handle them in
210target_intermediate() or target_index().
211
212Drivers can return '0' from get_intermediate() in case they don't wish to switch
213to intermediate frequency for some target frequency. In that case core will
214directly call ->target_index().
215
216NOTE: ->target_index() should restore to policy->restore_freq in case of
217failures as core would send notifications for that.
193 218
194 219
1952. Frequency Table Helpers 2202. Frequency Table Helpers