Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |
Robin Getz | 121fe86 | 2008-10-17 01:36:43 +0800 | [diff] [blame] | 26 | 1.6 Blackfin |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | |
| 28 | 2. "Policy" / "Governor"? |
| 29 | 2.1 Policy |
| 30 | 2.2 Governor |
| 31 | |
| 32 | 3. How to change the CPU cpufreq policy and/or speed |
| 33 | 3.1 Preferred interface: sysfs |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |
Russell King | 9e2697f | 2007-12-14 13:30:14 +0000 | [diff] [blame] | 48 | Intel PXA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
| 50 | |
| 51 | 1.2 x86 |
| 52 | ------- |
| 53 | |
| 54 | The following processors for the x86 architecture are supported by cpufreq: |
| 55 | |
| 56 | AMD Elan - SC400, SC410 |
| 57 | AMD mobile K6-2+ |
| 58 | AMD mobile K6-3+ |
| 59 | AMD mobile Duron |
| 60 | AMD mobile Athlon |
| 61 | AMD Opteron |
| 62 | AMD Athlon 64 |
| 63 | Cyrix Media GXm |
| 64 | Intel mobile PIII and Intel mobile PIII-M on certain chipsets |
| 65 | Intel Pentium 4, Intel Xeon |
| 66 | Intel Pentium M (Centrino) |
| 67 | National Semiconductors Geode GX |
| 68 | Transmeta Crusoe |
| 69 | Transmeta Efficeon |
| 70 | VIA Cyrix 3 / C3 |
| 71 | various processors on some ACPI 2.0-compatible systems [*] |
| 72 | |
| 73 | [*] Only if "ACPI Processor Performance States" are available |
| 74 | to the ACPI<->BIOS interface. |
| 75 | |
| 76 | |
| 77 | 1.3 sparc64 |
| 78 | ----------- |
| 79 | |
| 80 | The following processors for the sparc64 architecture are supported by |
| 81 | cpufreq: |
| 82 | |
| 83 | UltraSPARC-III |
| 84 | |
| 85 | |
| 86 | 1.4 ppc |
| 87 | ------- |
| 88 | |
| 89 | Several "PowerBook" and "iBook2" notebooks are supported. |
| 90 | |
| 91 | |
| 92 | 1.5 SuperH |
| 93 | ---------- |
| 94 | |
Paul Mundt | 8a65505 | 2008-12-17 15:06:54 +0900 | [diff] [blame] | 95 | All SuperH processors supporting rate rounding through the clock |
| 96 | framework are supported by cpufreq. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | |
Robin Getz | 121fe86 | 2008-10-17 01:36:43 +0800 | [diff] [blame] | 98 | 1.6 Blackfin |
| 99 | ------------ |
| 100 | |
| 101 | The following Blackfin processors are supported by cpufreq: |
| 102 | |
| 103 | BF522, BF523, BF524, BF525, BF526, BF527, Rev 0.1 or higher |
| 104 | BF531, BF532, BF533, Rev 0.3 or higher |
| 105 | BF534, BF536, BF537, Rev 0.2 or higher |
| 106 | BF561, Rev 0.3 or higher |
| 107 | BF542, BF544, BF547, BF548, BF549, Rev 0.1 or higher |
| 108 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | |
| 110 | 2. "Policy" / "Governor" ? |
| 111 | ========================== |
| 112 | |
| 113 | Some CPU frequency scaling-capable processor switch between various |
| 114 | frequencies and operating voltages "on the fly" without any kernel or |
| 115 | user involvement. This guarantees very fast switching to a frequency |
| 116 | which is high enough to serve the user's needs, but low enough to save |
| 117 | power. |
| 118 | |
| 119 | |
| 120 | 2.1 Policy |
| 121 | ---------- |
| 122 | |
| 123 | On these systems, all you can do is select the lower and upper |
| 124 | frequency limit as well as whether you want more aggressive |
| 125 | power-saving or more instantly available processing power. |
| 126 | |
| 127 | |
| 128 | 2.2 Governor |
| 129 | ------------ |
| 130 | |
| 131 | On all other cpufreq implementations, these boundaries still need to |
| 132 | be set. Then, a "governor" must be selected. Such a "governor" decides |
| 133 | what speed the processor shall run within the boundaries. One such |
| 134 | "governor" is the "userspace" governor. This one allows the user - or |
| 135 | a yet-to-implement userspace program - to decide what specific speed |
| 136 | the processor shall run at. |
| 137 | |
| 138 | |
| 139 | 3. How to change the CPU cpufreq policy and/or speed |
| 140 | ==================================================== |
| 141 | |
| 142 | 3.1 Preferred Interface: sysfs |
| 143 | ------------------------------ |
| 144 | |
| 145 | The preferred interface is located in the sysfs filesystem. If you |
| 146 | mounted it at /sys, the cpufreq interface is located in a subdirectory |
| 147 | "cpufreq" within the cpu-device directory |
| 148 | (e.g. /sys/devices/system/cpu/cpu0/cpufreq/ for the first CPU). |
| 149 | |
| 150 | cpuinfo_min_freq : this file shows the minimum operating |
| 151 | frequency the processor can run at(in kHz) |
| 152 | cpuinfo_max_freq : this file shows the maximum operating |
| 153 | frequency the processor can run at(in kHz) |
Thomas Renninger | ed12978 | 2009-02-04 01:17:41 +0100 | [diff] [blame] | 154 | cpuinfo_transition_latency The time it takes on this CPU to |
| 155 | switch between two frequencies in nano |
| 156 | seconds. If unknown or known to be |
| 157 | that high that the driver does not |
| 158 | work with the ondemand governor, -1 |
| 159 | (CPUFREQ_ETERNAL) will be returned. |
| 160 | Using this information can be useful |
| 161 | to choose an appropriate polling |
| 162 | frequency for a kernel governor or |
| 163 | userspace daemon. Make sure to not |
| 164 | switch the frequency too often |
| 165 | resulting in performance loss. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | scaling_driver : this file shows what cpufreq driver is |
| 167 | used to set the frequency on this CPU |
| 168 | |
| 169 | scaling_available_governors : this file shows the CPUfreq governors |
| 170 | available in this kernel. You can see the |
| 171 | currently activated governor in |
| 172 | |
| 173 | scaling_governor, and by "echoing" the name of another |
| 174 | governor you can change it. Please note |
| 175 | that some governors won't load - they only |
| 176 | work on some specific architectures or |
| 177 | processors. |
Darrick J. Wong | 605400a | 2008-04-18 13:31:13 -0700 | [diff] [blame] | 178 | |
Naga Chumbalkar | da470db | 2009-06-29 19:53:41 +0000 | [diff] [blame] | 179 | cpuinfo_cur_freq : Current frequency of the CPU as obtained from |
| 180 | the hardware, in KHz. This is the frequency |
| 181 | the CPU actually runs at. |
Darrick J. Wong | 605400a | 2008-04-18 13:31:13 -0700 | [diff] [blame] | 182 | |
| 183 | scaling_available_frequencies : List of available frequencies, in KHz. |
| 184 | |
Mattia Dongili | 9c9a43e | 2006-07-05 23:12:20 +0200 | [diff] [blame] | 185 | scaling_min_freq and |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 186 | scaling_max_freq show the current "policy limits" (in |
| 187 | kHz). By echoing new values into these |
| 188 | files, you can change these limits. |
Mattia Dongili | 9c9a43e | 2006-07-05 23:12:20 +0200 | [diff] [blame] | 189 | NOTE: when setting a policy you need to |
| 190 | first set scaling_max_freq, then |
| 191 | scaling_min_freq. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | |
Viresh Kumar | 951fc5f | 2013-01-31 02:03:53 +0000 | [diff] [blame] | 193 | affected_cpus : List of Online CPUs that require software |
| 194 | coordination of frequency. |
Darrick J. Wong | 605400a | 2008-04-18 13:31:13 -0700 | [diff] [blame] | 195 | |
Viresh Kumar | 951fc5f | 2013-01-31 02:03:53 +0000 | [diff] [blame] | 196 | related_cpus : List of Online + Offline CPUs that need software |
| 197 | coordination of frequency. |
Darrick J. Wong | 605400a | 2008-04-18 13:31:13 -0700 | [diff] [blame] | 198 | |
| 199 | scaling_driver : Hardware driver for cpufreq. |
| 200 | |
Naga Chumbalkar | da470db | 2009-06-29 19:53:41 +0000 | [diff] [blame] | 201 | scaling_cur_freq : Current frequency of the CPU as determined by |
| 202 | the governor and cpufreq core, in KHz. This is |
| 203 | the frequency the kernel thinks the CPU runs |
| 204 | at. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | |
Thomas Renninger | e2f74f3 | 2009-11-19 12:31:01 +0100 | [diff] [blame] | 206 | bios_limit : If the BIOS tells the OS to limit a CPU to |
| 207 | lower frequencies, the user can read out the |
| 208 | maximum available frequency from this file. |
| 209 | This typically can happen through (often not |
| 210 | intended) BIOS settings, restrictions |
| 211 | triggered through a service processor or other |
| 212 | BIOS/HW based implementations. |
| 213 | This does not cover thermal ACPI limitations |
| 214 | which can be detected through the generic |
| 215 | thermal driver. |
| 216 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | If you have selected the "userspace" governor which allows you to |
| 218 | set the CPU operating frequency to a specific value, you can read out |
| 219 | the current frequency in |
| 220 | |
| 221 | scaling_setspeed. By "echoing" a new frequency into this |
| 222 | you can change the speed of the CPU, |
| 223 | but only within the limits of |
| 224 | scaling_min_freq and scaling_max_freq. |