aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/cpu-freq/core.txt
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /Documentation/cpu-freq/core.txt
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'Documentation/cpu-freq/core.txt')
-rw-r--r--Documentation/cpu-freq/core.txt98
1 files changed, 98 insertions, 0 deletions
diff --git a/Documentation/cpu-freq/core.txt b/Documentation/cpu-freq/core.txt
new file mode 100644
index 000000000000..29b3f9ffc66c
--- /dev/null
+++ b/Documentation/cpu-freq/core.txt
@@ -0,0 +1,98 @@
1 CPU frequency and voltage scaling code in the Linux(TM) kernel
2
3
4 L i n u x C P U F r e q
5
6 C P U F r e q C o r e
7
8
9 Dominik Brodowski <linux@brodo.de>
10 David Kimdon <dwhedon@debian.org>
11
12
13
14 Clock scaling allows you to change the clock speed of the CPUs on the
15 fly. This is a nice method to save battery power, because the lower
16 the clock speed, the less power the CPU consumes.
17
18
19Contents:
20---------
211. CPUFreq core and interfaces
222. CPUFreq notifiers
23
241. General Information
25=======================
26
27The CPUFreq core code is located in linux/kernel/cpufreq.c. This
28cpufreq code offers a standardized interface for the CPUFreq
29architecture drivers (those pieces of code that do actual
30frequency transitions), as well as to "notifiers". These are device
31drivers or other part of the kernel that need to be informed of
32policy changes (ex. thermal modules like ACPI) or of all
33frequency changes (ex. timing code) or even need to force certain
34speed limits (like LCD drivers on ARM architecture). Additionally, the
35kernel "constant" loops_per_jiffy is updated on frequency changes
36here.
37
38Reference counting is done by cpufreq_get_cpu and cpufreq_put_cpu,
39which make sure that the cpufreq processor driver is correctly
40registered with the core, and will not be unloaded until
41cpufreq_put_cpu is called.
42
432. CPUFreq notifiers
44====================
45
46CPUFreq notifiers conform to the standard kernel notifier interface.
47See linux/include/linux/notifier.h for details on notifiers.
48
49There are two different CPUFreq notifiers - policy notifiers and
50transition notifiers.
51
52
532.1 CPUFreq policy notifiers
54----------------------------
55
56These are notified when a new policy is intended to be set. Each
57CPUFreq policy notifier is called three times for a policy transition:
58
591.) During CPUFREQ_ADJUST all CPUFreq notifiers may change the limit if
60 they see a need for this - may it be thermal considerations or
61 hardware limitations.
62
632.) During CPUFREQ_INCOMPATIBLE only changes may be done in order to avoid
64 hardware failure.
65
663.) And during CPUFREQ_NOTIFY all notifiers are informed of the new policy
67 - if two hardware drivers failed to agree on a new policy before this
68 stage, the incompatible hardware shall be shut down, and the user
69 informed of this.
70
71The phase is specified in the second argument to the notifier.
72
73The third argument, a void *pointer, points to a struct cpufreq_policy
74consisting of five values: cpu, min, max, policy and max_cpu_freq. min
75and max are the lower and upper frequencies (in kHz) of the new
76policy, policy the new policy, cpu the number of the affected CPU; and
77max_cpu_freq the maximum supported CPU frequency. This value is given
78for informational purposes only.
79
80
812.2 CPUFreq transition notifiers
82--------------------------------
83
84These are notified twice when the CPUfreq driver switches the CPU core
85frequency and this change has any external implications.
86
87The second argument specifies the phase - CPUFREQ_PRECHANGE or
88CPUFREQ_POSTCHANGE.
89
90The third argument is a struct cpufreq_freqs with the following
91values:
92cpu - number of the affected CPU
93old - old frequency
94new - new frequency
95
96If the cpufreq core detects the frequency has changed while the system
97was suspended, these notifiers are called with CPUFREQ_RESUMECHANGE as
98second argument.