diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /Documentation/cpu-freq |
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')
-rw-r--r-- | Documentation/cpu-freq/amd-powernow.txt | 38 | ||||
-rw-r--r-- | Documentation/cpu-freq/core.txt | 98 | ||||
-rw-r--r-- | Documentation/cpu-freq/cpu-drivers.txt | 216 | ||||
-rw-r--r-- | Documentation/cpu-freq/cpufreq-nforce2.txt | 19 | ||||
-rw-r--r-- | Documentation/cpu-freq/governors.txt | 155 | ||||
-rw-r--r-- | Documentation/cpu-freq/index.txt | 56 | ||||
-rw-r--r-- | Documentation/cpu-freq/user-guide.txt | 185 |
7 files changed, 767 insertions, 0 deletions
diff --git a/Documentation/cpu-freq/amd-powernow.txt b/Documentation/cpu-freq/amd-powernow.txt new file mode 100644 index 000000000000..254da155fa47 --- /dev/null +++ b/Documentation/cpu-freq/amd-powernow.txt | |||
@@ -0,0 +1,38 @@ | |||
1 | |||
2 | PowerNow! and Cool'n'Quiet are AMD names for frequency | ||
3 | management capabilities in AMD processors. As the hardware | ||
4 | implementation changes in new generations of the processors, | ||
5 | there is a different cpu-freq driver for each generation. | ||
6 | |||
7 | Note that the driver's will not load on the "wrong" hardware, | ||
8 | so it is safe to try each driver in turn when in doubt as to | ||
9 | which is the correct driver. | ||
10 | |||
11 | Note that the functionality to change frequency (and voltage) | ||
12 | is not available in all processors. The drivers will refuse | ||
13 | to load on processors without this capability. The capability | ||
14 | is detected with the cpuid instruction. | ||
15 | |||
16 | The drivers use BIOS supplied tables to obtain frequency and | ||
17 | voltage information appropriate for a particular platform. | ||
18 | Frequency transitions will be unavailable if the BIOS does | ||
19 | not supply these tables. | ||
20 | |||
21 | 6th Generation: powernow-k6 | ||
22 | |||
23 | 7th Generation: powernow-k7: Athlon, Duron, Geode. | ||
24 | |||
25 | 8th Generation: powernow-k8: Athlon, Athlon 64, Opteron, Sempron. | ||
26 | Documentation on this functionality in 8th generation processors | ||
27 | is available in the "BIOS and Kernel Developer's Guide", publication | ||
28 | 26094, in chapter 9, available for download from www.amd.com. | ||
29 | |||
30 | BIOS supplied data, for powernow-k7 and for powernow-k8, may be | ||
31 | from either the PSB table or from ACPI objects. The ACPI support | ||
32 | is only available if the kernel config sets CONFIG_ACPI_PROCESSOR. | ||
33 | The powernow-k8 driver will attempt to use ACPI if so configured, | ||
34 | and fall back to PST if that fails. | ||
35 | The powernow-k7 driver will try to use the PSB support first, and | ||
36 | fall back to ACPI if the PSB support fails. A module parameter, | ||
37 | acpi_force, is provided to force ACPI support to be used instead | ||
38 | of PSB support. | ||
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 | |||
19 | Contents: | ||
20 | --------- | ||
21 | 1. CPUFreq core and interfaces | ||
22 | 2. CPUFreq notifiers | ||
23 | |||
24 | 1. General Information | ||
25 | ======================= | ||
26 | |||
27 | The CPUFreq core code is located in linux/kernel/cpufreq.c. This | ||
28 | cpufreq code offers a standardized interface for the CPUFreq | ||
29 | architecture drivers (those pieces of code that do actual | ||
30 | frequency transitions), as well as to "notifiers". These are device | ||
31 | drivers or other part of the kernel that need to be informed of | ||
32 | policy changes (ex. thermal modules like ACPI) or of all | ||
33 | frequency changes (ex. timing code) or even need to force certain | ||
34 | speed limits (like LCD drivers on ARM architecture). Additionally, the | ||
35 | kernel "constant" loops_per_jiffy is updated on frequency changes | ||
36 | here. | ||
37 | |||
38 | Reference counting is done by cpufreq_get_cpu and cpufreq_put_cpu, | ||
39 | which make sure that the cpufreq processor driver is correctly | ||
40 | registered with the core, and will not be unloaded until | ||
41 | cpufreq_put_cpu is called. | ||
42 | |||
43 | 2. CPUFreq notifiers | ||
44 | ==================== | ||
45 | |||
46 | CPUFreq notifiers conform to the standard kernel notifier interface. | ||
47 | See linux/include/linux/notifier.h for details on notifiers. | ||
48 | |||
49 | There are two different CPUFreq notifiers - policy notifiers and | ||
50 | transition notifiers. | ||
51 | |||
52 | |||
53 | 2.1 CPUFreq policy notifiers | ||
54 | ---------------------------- | ||
55 | |||
56 | These are notified when a new policy is intended to be set. Each | ||
57 | CPUFreq policy notifier is called three times for a policy transition: | ||
58 | |||
59 | 1.) 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 | |||
63 | 2.) During CPUFREQ_INCOMPATIBLE only changes may be done in order to avoid | ||
64 | hardware failure. | ||
65 | |||
66 | 3.) 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 | |||
71 | The phase is specified in the second argument to the notifier. | ||
72 | |||
73 | The third argument, a void *pointer, points to a struct cpufreq_policy | ||
74 | consisting of five values: cpu, min, max, policy and max_cpu_freq. min | ||
75 | and max are the lower and upper frequencies (in kHz) of the new | ||
76 | policy, policy the new policy, cpu the number of the affected CPU; and | ||
77 | max_cpu_freq the maximum supported CPU frequency. This value is given | ||
78 | for informational purposes only. | ||
79 | |||
80 | |||
81 | 2.2 CPUFreq transition notifiers | ||
82 | -------------------------------- | ||
83 | |||
84 | These are notified twice when the CPUfreq driver switches the CPU core | ||
85 | frequency and this change has any external implications. | ||
86 | |||
87 | The second argument specifies the phase - CPUFREQ_PRECHANGE or | ||
88 | CPUFREQ_POSTCHANGE. | ||
89 | |||
90 | The third argument is a struct cpufreq_freqs with the following | ||
91 | values: | ||
92 | cpu - number of the affected CPU | ||
93 | old - old frequency | ||
94 | new - new frequency | ||
95 | |||
96 | If the cpufreq core detects the frequency has changed while the system | ||
97 | was suspended, these notifiers are called with CPUFREQ_RESUMECHANGE as | ||
98 | second argument. | ||
diff --git a/Documentation/cpu-freq/cpu-drivers.txt b/Documentation/cpu-freq/cpu-drivers.txt new file mode 100644 index 000000000000..43c743903dd7 --- /dev/null +++ b/Documentation/cpu-freq/cpu-drivers.txt | |||
@@ -0,0 +1,216 @@ | |||
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 D r i v e r s | ||
7 | |||
8 | - information for developers - | ||
9 | |||
10 | |||
11 | Dominik Brodowski <linux@brodo.de> | ||
12 | |||
13 | |||
14 | |||
15 | Clock scaling allows you to change the clock speed of the CPUs on the | ||
16 | fly. This is a nice method to save battery power, because the lower | ||
17 | the clock speed, the less power the CPU consumes. | ||
18 | |||
19 | |||
20 | Contents: | ||
21 | --------- | ||
22 | 1. What To Do? | ||
23 | 1.1 Initialization | ||
24 | 1.2 Per-CPU Initialization | ||
25 | 1.3 verify | ||
26 | 1.4 target or setpolicy? | ||
27 | 1.5 target | ||
28 | 1.6 setpolicy | ||
29 | 2. Frequency Table Helpers | ||
30 | |||
31 | |||
32 | |||
33 | 1. What To Do? | ||
34 | ============== | ||
35 | |||
36 | So, you just got a brand-new CPU / chipset with datasheets and want to | ||
37 | add cpufreq support for this CPU / chipset? Great. Here are some hints | ||
38 | on what is necessary: | ||
39 | |||
40 | |||
41 | 1.1 Initialization | ||
42 | ------------------ | ||
43 | |||
44 | First of all, in an __initcall level 7 (module_init()) or later | ||
45 | function check whether this kernel runs on the right CPU and the right | ||
46 | chipset. If so, register a struct cpufreq_driver with the CPUfreq core | ||
47 | using cpufreq_register_driver() | ||
48 | |||
49 | What shall this struct cpufreq_driver contain? | ||
50 | |||
51 | cpufreq_driver.name - The name of this driver. | ||
52 | |||
53 | cpufreq_driver.owner - THIS_MODULE; | ||
54 | |||
55 | cpufreq_driver.init - A pointer to the per-CPU initialization | ||
56 | function. | ||
57 | |||
58 | cpufreq_driver.verify - A pointer to a "verification" function. | ||
59 | |||
60 | cpufreq_driver.setpolicy _or_ | ||
61 | cpufreq_driver.target - See below on the differences. | ||
62 | |||
63 | And optionally | ||
64 | |||
65 | cpufreq_driver.exit - A pointer to a per-CPU cleanup function. | ||
66 | |||
67 | cpufreq_driver.resume - A pointer to a per-CPU resume function | ||
68 | which is called with interrupts disabled | ||
69 | and _before_ the pre-suspend frequency | ||
70 | and/or policy is restored by a call to | ||
71 | ->target or ->setpolicy. | ||
72 | |||
73 | cpufreq_driver.attr - A pointer to a NULL-terminated list of | ||
74 | "struct freq_attr" which allow to | ||
75 | export values to sysfs. | ||
76 | |||
77 | |||
78 | 1.2 Per-CPU Initialization | ||
79 | -------------------------- | ||
80 | |||
81 | Whenever a new CPU is registered with the device model, or after the | ||
82 | cpufreq driver registers itself, the per-CPU initialization function | ||
83 | cpufreq_driver.init is called. It takes a struct cpufreq_policy | ||
84 | *policy as argument. What to do now? | ||
85 | |||
86 | If necessary, activate the CPUfreq support on your CPU. | ||
87 | |||
88 | Then, the driver must fill in the following values: | ||
89 | |||
90 | policy->cpuinfo.min_freq _and_ | ||
91 | policy->cpuinfo.max_freq - the minimum and maximum frequency | ||
92 | (in kHz) which is supported by | ||
93 | this CPU | ||
94 | policy->cpuinfo.transition_latency the time it takes on this CPU to | ||
95 | switch between two frequencies (if | ||
96 | appropriate, else specify | ||
97 | CPUFREQ_ETERNAL) | ||
98 | |||
99 | policy->cur The current operating frequency of | ||
100 | this CPU (if appropriate) | ||
101 | policy->min, | ||
102 | policy->max, | ||
103 | policy->policy and, if necessary, | ||
104 | policy->governor must contain the "default policy" for | ||
105 | this CPU. A few moments later, | ||
106 | cpufreq_driver.verify and either | ||
107 | cpufreq_driver.setpolicy or | ||
108 | cpufreq_driver.target is called with | ||
109 | these values. | ||
110 | |||
111 | For setting some of these values, the frequency table helpers might be | ||
112 | helpful. See the section 2 for more information on them. | ||
113 | |||
114 | |||
115 | 1.3 verify | ||
116 | ------------ | ||
117 | |||
118 | When the user decides a new policy (consisting of | ||
119 | "policy,governor,min,max") shall be set, this policy must be validated | ||
120 | so that incompatible values can be corrected. For verifying these | ||
121 | values, a frequency table helper and/or the | ||
122 | cpufreq_verify_within_limits(struct cpufreq_policy *policy, unsigned | ||
123 | int min_freq, unsigned int max_freq) function might be helpful. See | ||
124 | section 2 for details on frequency table helpers. | ||
125 | |||
126 | You need to make sure that at least one valid frequency (or operating | ||
127 | range) is within policy->min and policy->max. If necessary, increase | ||
128 | policy->max first, and only if this is no solution, decrease policy->min. | ||
129 | |||
130 | |||
131 | 1.4 target or setpolicy? | ||
132 | ---------------------------- | ||
133 | |||
134 | Most cpufreq drivers or even most cpu frequency scaling algorithms | ||
135 | only allow the CPU to be set to one frequency. For these, you use the | ||
136 | ->target call. | ||
137 | |||
138 | Some cpufreq-capable processors switch the frequency between certain | ||
139 | limits on their own. These shall use the ->setpolicy call | ||
140 | |||
141 | |||
142 | 1.4. target | ||
143 | ------------- | ||
144 | |||
145 | The target call has three arguments: struct cpufreq_policy *policy, | ||
146 | unsigned int target_frequency, unsigned int relation. | ||
147 | |||
148 | The CPUfreq driver must set the new frequency when called here. The | ||
149 | actual frequency must be determined using the following rules: | ||
150 | |||
151 | - keep close to "target_freq" | ||
152 | - policy->min <= new_freq <= policy->max (THIS MUST BE VALID!!!) | ||
153 | - if relation==CPUFREQ_REL_L, try to select a new_freq higher than or equal | ||
154 | target_freq. ("L for lowest, but no lower than") | ||
155 | - if relation==CPUFREQ_REL_H, try to select a new_freq lower than or equal | ||
156 | target_freq. ("H for highest, but no higher than") | ||
157 | |||
158 | Here again the frequency table helper might assist you - see section 3 | ||
159 | for details. | ||
160 | |||
161 | |||
162 | 1.5 setpolicy | ||
163 | --------------- | ||
164 | |||
165 | The setpolicy call only takes a struct cpufreq_policy *policy as | ||
166 | argument. You need to set the lower limit of the in-processor or | ||
167 | in-chipset dynamic frequency switching to policy->min, the upper limit | ||
168 | to policy->max, and -if supported- select a performance-oriented | ||
169 | setting when policy->policy is CPUFREQ_POLICY_PERFORMANCE, and a | ||
170 | powersaving-oriented setting when CPUFREQ_POLICY_POWERSAVE. Also check | ||
171 | the reference implementation in arch/i386/kernel/cpu/cpufreq/longrun.c | ||
172 | |||
173 | |||
174 | |||
175 | 2. Frequency Table Helpers | ||
176 | ========================== | ||
177 | |||
178 | As most cpufreq processors only allow for being set to a few specific | ||
179 | frequencies, a "frequency table" with some functions might assist in | ||
180 | some work of the processor driver. Such a "frequency table" consists | ||
181 | of an array of struct cpufreq_freq_table entries, with any value in | ||
182 | "index" you want to use, and the corresponding frequency in | ||
183 | "frequency". At the end of the table, you need to add a | ||
184 | cpufreq_freq_table entry with frequency set to CPUFREQ_TABLE_END. And | ||
185 | if you want to skip one entry in the table, set the frequency to | ||
186 | CPUFREQ_ENTRY_INVALID. The entries don't need to be in ascending | ||
187 | order. | ||
188 | |||
189 | By calling cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, | ||
190 | struct cpufreq_frequency_table *table); | ||
191 | the cpuinfo.min_freq and cpuinfo.max_freq values are detected, and | ||
192 | policy->min and policy->max are set to the same values. This is | ||
193 | helpful for the per-CPU initialization stage. | ||
194 | |||
195 | int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, | ||
196 | struct cpufreq_frequency_table *table); | ||
197 | assures that at least one valid frequency is within policy->min and | ||
198 | policy->max, and all other criteria are met. This is helpful for the | ||
199 | ->verify call. | ||
200 | |||
201 | int cpufreq_frequency_table_target(struct cpufreq_policy *policy, | ||
202 | struct cpufreq_frequency_table *table, | ||
203 | unsigned int target_freq, | ||
204 | unsigned int relation, | ||
205 | unsigned int *index); | ||
206 | |||
207 | is the corresponding frequency table helper for the ->target | ||
208 | stage. Just pass the values to this function, and the unsigned int | ||
209 | index returns the number of the frequency table entry which contains | ||
210 | the frequency the CPU shall be set to. PLEASE NOTE: This is not the | ||
211 | "index" which is in this cpufreq_table_entry.index, but instead | ||
212 | cpufreq_table[index]. So, the new frequency is | ||
213 | cpufreq_table[index].frequency, and the value you stored into the | ||
214 | frequency table "index" field is | ||
215 | cpufreq_table[index].index. | ||
216 | |||
diff --git a/Documentation/cpu-freq/cpufreq-nforce2.txt b/Documentation/cpu-freq/cpufreq-nforce2.txt new file mode 100644 index 000000000000..9188337d8f6b --- /dev/null +++ b/Documentation/cpu-freq/cpufreq-nforce2.txt | |||
@@ -0,0 +1,19 @@ | |||
1 | |||
2 | The cpufreq-nforce2 driver changes the FSB on nVidia nForce2 plattforms. | ||
3 | |||
4 | This works better than on other plattforms, because the FSB of the CPU | ||
5 | can be controlled independently from the PCI/AGP clock. | ||
6 | |||
7 | The module has two options: | ||
8 | |||
9 | fid: multiplier * 10 (for example 8.5 = 85) | ||
10 | min_fsb: minimum FSB | ||
11 | |||
12 | If not set, fid is calculated from the current CPU speed and the FSB. | ||
13 | min_fsb defaults to FSB at boot time - 50 MHz. | ||
14 | |||
15 | IMPORTANT: The available range is limited downwards! | ||
16 | Also the minimum available FSB can differ, for systems | ||
17 | booting with 200 MHz, 150 should always work. | ||
18 | |||
19 | |||
diff --git a/Documentation/cpu-freq/governors.txt b/Documentation/cpu-freq/governors.txt new file mode 100644 index 000000000000..b85481acd0ca --- /dev/null +++ b/Documentation/cpu-freq/governors.txt | |||
@@ -0,0 +1,155 @@ | |||
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 G o v e r n o r s | ||
7 | |||
8 | - information for users and developers - | ||
9 | |||
10 | |||
11 | Dominik Brodowski <linux@brodo.de> | ||
12 | |||
13 | |||
14 | |||
15 | Clock scaling allows you to change the clock speed of the CPUs on the | ||
16 | fly. This is a nice method to save battery power, because the lower | ||
17 | the clock speed, the less power the CPU consumes. | ||
18 | |||
19 | |||
20 | Contents: | ||
21 | --------- | ||
22 | 1. What is a CPUFreq Governor? | ||
23 | |||
24 | 2. Governors In the Linux Kernel | ||
25 | 2.1 Performance | ||
26 | 2.2 Powersave | ||
27 | 2.3 Userspace | ||
28 | |||
29 | 3. The Governor Interface in the CPUfreq Core | ||
30 | |||
31 | |||
32 | |||
33 | 1. What Is A CPUFreq Governor? | ||
34 | ============================== | ||
35 | |||
36 | Most cpufreq drivers (in fact, all except one, longrun) or even most | ||
37 | cpu frequency scaling algorithms only offer the CPU to be set to one | ||
38 | frequency. In order to offer dynamic frequency scaling, the cpufreq | ||
39 | core must be able to tell these drivers of a "target frequency". So | ||
40 | these specific drivers will be transformed to offer a "->target" | ||
41 | call instead of the existing "->setpolicy" call. For "longrun", all | ||
42 | stays the same, though. | ||
43 | |||
44 | How to decide what frequency within the CPUfreq policy should be used? | ||
45 | That's done using "cpufreq governors". Two are already in this patch | ||
46 | -- they're the already existing "powersave" and "performance" which | ||
47 | set the frequency statically to the lowest or highest frequency, | ||
48 | respectively. At least two more such governors will be ready for | ||
49 | addition in the near future, but likely many more as there are various | ||
50 | different theories and models about dynamic frequency scaling | ||
51 | around. Using such a generic interface as cpufreq offers to scaling | ||
52 | governors, these can be tested extensively, and the best one can be | ||
53 | selected for each specific use. | ||
54 | |||
55 | Basically, it's the following flow graph: | ||
56 | |||
57 | CPU can be set to switch independetly | CPU can only be set | ||
58 | within specific "limits" | to specific frequencies | ||
59 | |||
60 | "CPUfreq policy" | ||
61 | consists of frequency limits (policy->{min,max}) | ||
62 | and CPUfreq governor to be used | ||
63 | / \ | ||
64 | / \ | ||
65 | / the cpufreq governor decides | ||
66 | / (dynamically or statically) | ||
67 | / what target_freq to set within | ||
68 | / the limits of policy->{min,max} | ||
69 | / \ | ||
70 | / \ | ||
71 | Using the ->setpolicy call, Using the ->target call, | ||
72 | the limits and the the frequency closest | ||
73 | "policy" is set. to target_freq is set. | ||
74 | It is assured that it | ||
75 | is within policy->{min,max} | ||
76 | |||
77 | |||
78 | 2. Governors In the Linux Kernel | ||
79 | ================================ | ||
80 | |||
81 | 2.1 Performance | ||
82 | --------------- | ||
83 | |||
84 | The CPUfreq governor "performance" sets the CPU statically to the | ||
85 | highest frequency within the borders of scaling_min_freq and | ||
86 | scaling_max_freq. | ||
87 | |||
88 | |||
89 | 2.1 Powersave | ||
90 | ------------- | ||
91 | |||
92 | The CPUfreq governor "powersave" sets the CPU statically to the | ||
93 | lowest frequency within the borders of scaling_min_freq and | ||
94 | scaling_max_freq. | ||
95 | |||
96 | |||
97 | 2.2 Userspace | ||
98 | ------------- | ||
99 | |||
100 | The CPUfreq governor "userspace" allows the user, or any userspace | ||
101 | program running with UID "root", to set the CPU to a specific frequency | ||
102 | by making a sysfs file "scaling_setspeed" available in the CPU-device | ||
103 | directory. | ||
104 | |||
105 | |||
106 | |||
107 | 3. The Governor Interface in the CPUfreq Core | ||
108 | ============================================= | ||
109 | |||
110 | A new governor must register itself with the CPUfreq core using | ||
111 | "cpufreq_register_governor". The struct cpufreq_governor, which has to | ||
112 | be passed to that function, must contain the following values: | ||
113 | |||
114 | governor->name - A unique name for this governor | ||
115 | governor->governor - The governor callback function | ||
116 | governor->owner - .THIS_MODULE for the governor module (if | ||
117 | appropriate) | ||
118 | |||
119 | The governor->governor callback is called with the current (or to-be-set) | ||
120 | cpufreq_policy struct for that CPU, and an unsigned int event. The | ||
121 | following events are currently defined: | ||
122 | |||
123 | CPUFREQ_GOV_START: This governor shall start its duty for the CPU | ||
124 | policy->cpu | ||
125 | CPUFREQ_GOV_STOP: This governor shall end its duty for the CPU | ||
126 | policy->cpu | ||
127 | CPUFREQ_GOV_LIMITS: The limits for CPU policy->cpu have changed to | ||
128 | policy->min and policy->max. | ||
129 | |||
130 | If you need other "events" externally of your driver, _only_ use the | ||
131 | cpufreq_governor_l(unsigned int cpu, unsigned int event) call to the | ||
132 | CPUfreq core to ensure proper locking. | ||
133 | |||
134 | |||
135 | The CPUfreq governor may call the CPU processor driver using one of | ||
136 | these two functions: | ||
137 | |||
138 | int cpufreq_driver_target(struct cpufreq_policy *policy, | ||
139 | unsigned int target_freq, | ||
140 | unsigned int relation); | ||
141 | |||
142 | int __cpufreq_driver_target(struct cpufreq_policy *policy, | ||
143 | unsigned int target_freq, | ||
144 | unsigned int relation); | ||
145 | |||
146 | target_freq must be within policy->min and policy->max, of course. | ||
147 | What's the difference between these two functions? When your governor | ||
148 | still is in a direct code path of a call to governor->governor, the | ||
149 | per-CPU cpufreq lock is still held in the cpufreq core, and there's | ||
150 | no need to lock it again (in fact, this would cause a deadlock). So | ||
151 | use __cpufreq_driver_target only in these cases. In all other cases | ||
152 | (for example, when there's a "daemonized" function that wakes up | ||
153 | every second), use cpufreq_driver_target to lock the cpufreq per-CPU | ||
154 | lock before the command is passed to the cpufreq processor driver. | ||
155 | |||
diff --git a/Documentation/cpu-freq/index.txt b/Documentation/cpu-freq/index.txt new file mode 100644 index 000000000000..5009805f9378 --- /dev/null +++ b/Documentation/cpu-freq/index.txt | |||
@@ -0,0 +1,56 @@ | |||
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 | |||
7 | |||
8 | |||
9 | Dominik Brodowski <linux@brodo.de> | ||
10 | |||
11 | |||
12 | |||
13 | Clock scaling allows you to change the clock speed of the CPUs on the | ||
14 | fly. This is a nice method to save battery power, because the lower | ||
15 | the clock speed, the less power the CPU consumes. | ||
16 | |||
17 | |||
18 | |||
19 | Documents in this directory: | ||
20 | ---------------------------- | ||
21 | core.txt - General description of the CPUFreq core and | ||
22 | of CPUFreq notifiers | ||
23 | |||
24 | cpu-drivers.txt - How to implement a new cpufreq processor driver | ||
25 | |||
26 | governors.txt - What are cpufreq governors and how to | ||
27 | implement them? | ||
28 | |||
29 | index.txt - File index, Mailing list and Links (this document) | ||
30 | |||
31 | user-guide.txt - User Guide to CPUFreq | ||
32 | |||
33 | |||
34 | Mailing List | ||
35 | ------------ | ||
36 | There is a CPU frequency changing CVS commit and general list where | ||
37 | you can report bugs, problems or submit patches. To post a message, | ||
38 | send an email to cpufreq@lists.linux.org.uk, to subscribe go to | ||
39 | http://lists.linux.org.uk/mailman/listinfo/cpufreq. Previous post to the | ||
40 | mailing list are available to subscribers at | ||
41 | http://lists.linux.org.uk/mailman/private/cpufreq/. | ||
42 | |||
43 | |||
44 | Links | ||
45 | ----- | ||
46 | the FTP archives: | ||
47 | * ftp://ftp.linux.org.uk/pub/linux/cpufreq/ | ||
48 | |||
49 | how to access the CVS repository: | ||
50 | * http://cvs.arm.linux.org.uk/ | ||
51 | |||
52 | the CPUFreq Mailing list: | ||
53 | * http://lists.linux.org.uk/mailman/listinfo/cpufreq | ||
54 | |||
55 | Clock and voltage scaling for the SA-1100: | ||
56 | * http://www.lart.tudelft.nl/projects/scaling | ||
diff --git a/Documentation/cpu-freq/user-guide.txt b/Documentation/cpu-freq/user-guide.txt new file mode 100644 index 000000000000..7fedc00c3d30 --- /dev/null +++ b/Documentation/cpu-freq/user-guide.txt | |||
@@ -0,0 +1,185 @@ | |||
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 | U S E R G U I D E | ||
7 | |||
8 | |||
9 | Dominik Brodowski <linux@brodo.de> | ||
10 | |||
11 | |||
12 | |||
13 | Clock scaling allows you to change the clock speed of the CPUs on the | ||
14 | fly. This is a nice method to save battery power, because the lower | ||
15 | the clock speed, the less power the CPU consumes. | ||
16 | |||
17 | |||
18 | Contents: | ||
19 | --------- | ||
20 | 1. Supported Architectures and Processors | ||
21 | 1.1 ARM | ||
22 | 1.2 x86 | ||
23 | 1.3 sparc64 | ||
24 | 1.4 ppc | ||
25 | 1.5 SuperH | ||
26 | |||
27 | 2. "Policy" / "Governor"? | ||
28 | 2.1 Policy | ||
29 | 2.2 Governor | ||
30 | |||
31 | 3. How to change the CPU cpufreq policy and/or speed | ||
32 | 3.1 Preferred interface: sysfs | ||
33 | 3.2 Deprecated interfaces | ||
34 | |||
35 | |||
36 | |||
37 | 1. Supported Architectures and Processors | ||
38 | ========================================= | ||
39 | |||
40 | 1.1 ARM | ||
41 | ------- | ||
42 | |||
43 | The following ARM processors are supported by cpufreq: | ||
44 | |||
45 | ARM Integrator | ||
46 | ARM-SA1100 | ||
47 | ARM-SA1110 | ||
48 | |||
49 | |||
50 | 1.2 x86 | ||
51 | ------- | ||
52 | |||
53 | The following processors for the x86 architecture are supported by cpufreq: | ||
54 | |||
55 | AMD Elan - SC400, SC410 | ||
56 | AMD mobile K6-2+ | ||
57 | AMD mobile K6-3+ | ||
58 | AMD mobile Duron | ||
59 | AMD mobile Athlon | ||
60 | AMD Opteron | ||
61 | AMD Athlon 64 | ||
62 | Cyrix Media GXm | ||
63 | Intel mobile PIII and Intel mobile PIII-M on certain chipsets | ||
64 | Intel Pentium 4, Intel Xeon | ||
65 | Intel Pentium M (Centrino) | ||
66 | National Semiconductors Geode GX | ||
67 | Transmeta Crusoe | ||
68 | Transmeta Efficeon | ||
69 | VIA Cyrix 3 / C3 | ||
70 | various processors on some ACPI 2.0-compatible systems [*] | ||
71 | |||
72 | [*] Only if "ACPI Processor Performance States" are available | ||
73 | to the ACPI<->BIOS interface. | ||
74 | |||
75 | |||
76 | 1.3 sparc64 | ||
77 | ----------- | ||
78 | |||
79 | The following processors for the sparc64 architecture are supported by | ||
80 | cpufreq: | ||
81 | |||
82 | UltraSPARC-III | ||
83 | |||
84 | |||
85 | 1.4 ppc | ||
86 | ------- | ||
87 | |||
88 | Several "PowerBook" and "iBook2" notebooks are supported. | ||
89 | |||
90 | |||
91 | 1.5 SuperH | ||
92 | ---------- | ||
93 | |||
94 | The following SuperH processors are supported by cpufreq: | ||
95 | |||
96 | SH-3 | ||
97 | SH-4 | ||
98 | |||
99 | |||
100 | 2. "Policy" / "Governor" ? | ||
101 | ========================== | ||
102 | |||
103 | Some CPU frequency scaling-capable processor switch between various | ||
104 | frequencies and operating voltages "on the fly" without any kernel or | ||
105 | user involvement. This guarantees very fast switching to a frequency | ||
106 | which is high enough to serve the user's needs, but low enough to save | ||
107 | power. | ||
108 | |||
109 | |||
110 | 2.1 Policy | ||
111 | ---------- | ||
112 | |||
113 | On these systems, all you can do is select the lower and upper | ||
114 | frequency limit as well as whether you want more aggressive | ||
115 | power-saving or more instantly available processing power. | ||
116 | |||
117 | |||
118 | 2.2 Governor | ||
119 | ------------ | ||
120 | |||
121 | On all other cpufreq implementations, these boundaries still need to | ||
122 | be set. Then, a "governor" must be selected. Such a "governor" decides | ||
123 | what speed the processor shall run within the boundaries. One such | ||
124 | "governor" is the "userspace" governor. This one allows the user - or | ||
125 | a yet-to-implement userspace program - to decide what specific speed | ||
126 | the processor shall run at. | ||
127 | |||
128 | |||
129 | 3. How to change the CPU cpufreq policy and/or speed | ||
130 | ==================================================== | ||
131 | |||
132 | 3.1 Preferred Interface: sysfs | ||
133 | ------------------------------ | ||
134 | |||
135 | The preferred interface is located in the sysfs filesystem. If you | ||
136 | mounted it at /sys, the cpufreq interface is located in a subdirectory | ||
137 | "cpufreq" within the cpu-device directory | ||
138 | (e.g. /sys/devices/system/cpu/cpu0/cpufreq/ for the first CPU). | ||
139 | |||
140 | cpuinfo_min_freq : this file shows the minimum operating | ||
141 | frequency the processor can run at(in kHz) | ||
142 | cpuinfo_max_freq : this file shows the maximum operating | ||
143 | frequency the processor can run at(in kHz) | ||
144 | scaling_driver : this file shows what cpufreq driver is | ||
145 | used to set the frequency on this CPU | ||
146 | |||
147 | scaling_available_governors : this file shows the CPUfreq governors | ||
148 | available in this kernel. You can see the | ||
149 | currently activated governor in | ||
150 | |||
151 | scaling_governor, and by "echoing" the name of another | ||
152 | governor you can change it. Please note | ||
153 | that some governors won't load - they only | ||
154 | work on some specific architectures or | ||
155 | processors. | ||
156 | scaling_min_freq and | ||
157 | scaling_max_freq show the current "policy limits" (in | ||
158 | kHz). By echoing new values into these | ||
159 | files, you can change these limits. | ||
160 | |||
161 | |||
162 | If you have selected the "userspace" governor which allows you to | ||
163 | set the CPU operating frequency to a specific value, you can read out | ||
164 | the current frequency in | ||
165 | |||
166 | scaling_setspeed. By "echoing" a new frequency into this | ||
167 | you can change the speed of the CPU, | ||
168 | but only within the limits of | ||
169 | scaling_min_freq and scaling_max_freq. | ||
170 | |||
171 | |||
172 | 3.2 Deprecated Interfaces | ||
173 | ------------------------- | ||
174 | |||
175 | Depending on your kernel configuration, you might find the following | ||
176 | cpufreq-related files: | ||
177 | /proc/cpufreq | ||
178 | /proc/sys/cpu/*/speed | ||
179 | /proc/sys/cpu/*/speed-min | ||
180 | /proc/sys/cpu/*/speed-max | ||
181 | |||
182 | These are files for deprecated interfaces to cpufreq, which offer far | ||
183 | less functionality. Because of this, these interfaces aren't described | ||
184 | here. | ||
185 | |||