| 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 | 
|  | 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 | 
| 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 |  | 
|  | 95 | The following SuperH processors are supported by cpufreq: | 
|  | 96 |  | 
|  | 97 | SH-3 | 
|  | 98 | SH-4 | 
|  | 99 |  | 
|  | 100 |  | 
|  | 101 | 2. "Policy" / "Governor" ? | 
|  | 102 | ========================== | 
|  | 103 |  | 
|  | 104 | Some CPU frequency scaling-capable processor switch between various | 
|  | 105 | frequencies and operating voltages "on the fly" without any kernel or | 
|  | 106 | user involvement. This guarantees very fast switching to a frequency | 
|  | 107 | which is high enough to serve the user's needs, but low enough to save | 
|  | 108 | power. | 
|  | 109 |  | 
|  | 110 |  | 
|  | 111 | 2.1 Policy | 
|  | 112 | ---------- | 
|  | 113 |  | 
|  | 114 | On these systems, all you can do is select the lower and upper | 
|  | 115 | frequency limit as well as whether you want more aggressive | 
|  | 116 | power-saving or more instantly available processing power. | 
|  | 117 |  | 
|  | 118 |  | 
|  | 119 | 2.2 Governor | 
|  | 120 | ------------ | 
|  | 121 |  | 
|  | 122 | On all other cpufreq implementations, these boundaries still need to | 
|  | 123 | be set. Then, a "governor" must be selected. Such a "governor" decides | 
|  | 124 | what speed the processor shall run within the boundaries. One such | 
|  | 125 | "governor" is the "userspace" governor. This one allows the user - or | 
|  | 126 | a yet-to-implement userspace program - to decide what specific speed | 
|  | 127 | the processor shall run at. | 
|  | 128 |  | 
|  | 129 |  | 
|  | 130 | 3. How to change the CPU cpufreq policy and/or speed | 
|  | 131 | ==================================================== | 
|  | 132 |  | 
|  | 133 | 3.1 Preferred Interface: sysfs | 
|  | 134 | ------------------------------ | 
|  | 135 |  | 
|  | 136 | The preferred interface is located in the sysfs filesystem. If you | 
|  | 137 | mounted it at /sys, the cpufreq interface is located in a subdirectory | 
|  | 138 | "cpufreq" within the cpu-device directory | 
|  | 139 | (e.g. /sys/devices/system/cpu/cpu0/cpufreq/ for the first CPU). | 
|  | 140 |  | 
|  | 141 | cpuinfo_min_freq :		this file shows the minimum operating | 
|  | 142 | frequency the processor can run at(in kHz) | 
|  | 143 | cpuinfo_max_freq :		this file shows the maximum operating | 
|  | 144 | frequency the processor can run at(in kHz) | 
|  | 145 | scaling_driver :		this file shows what cpufreq driver is | 
|  | 146 | used to set the frequency on this CPU | 
|  | 147 |  | 
|  | 148 | scaling_available_governors :	this file shows the CPUfreq governors | 
|  | 149 | available in this kernel. You can see the | 
|  | 150 | currently activated governor in | 
|  | 151 |  | 
|  | 152 | scaling_governor,		and by "echoing" the name of another | 
|  | 153 | governor you can change it. Please note | 
|  | 154 | that some governors won't load - they only | 
|  | 155 | work on some specific architectures or | 
|  | 156 | processors. | 
| Darrick J. Wong | 605400a | 2008-04-18 13:31:13 -0700 | [diff] [blame] | 157 |  | 
|  | 158 | cpuinfo_cur_freq :		Current speed of the CPU, in KHz. | 
|  | 159 |  | 
|  | 160 | scaling_available_frequencies : List of available frequencies, in KHz. | 
|  | 161 |  | 
| Mattia Dongili | 9c9a43e | 2006-07-05 23:12:20 +0200 | [diff] [blame] | 162 | scaling_min_freq and | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | scaling_max_freq		show the current "policy limits" (in | 
|  | 164 | kHz). By echoing new values into these | 
|  | 165 | files, you can change these limits. | 
| Mattia Dongili | 9c9a43e | 2006-07-05 23:12:20 +0200 | [diff] [blame] | 166 | NOTE: when setting a policy you need to | 
|  | 167 | first set scaling_max_freq, then | 
|  | 168 | scaling_min_freq. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 |  | 
| Darrick J. Wong | 605400a | 2008-04-18 13:31:13 -0700 | [diff] [blame] | 170 | affected_cpus :			List of CPUs that require software coordination | 
|  | 171 | of frequency. | 
|  | 172 |  | 
|  | 173 | related_cpus :			List of CPUs that need some sort of frequency | 
|  | 174 | coordination, whether software or hardware. | 
|  | 175 |  | 
|  | 176 | scaling_driver :		Hardware driver for cpufreq. | 
|  | 177 |  | 
|  | 178 | scaling_cur_freq :		Current frequency of the CPU, in KHz. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 |  | 
|  | 180 | If you have selected the "userspace" governor which allows you to | 
|  | 181 | set the CPU operating frequency to a specific value, you can read out | 
|  | 182 | the current frequency in | 
|  | 183 |  | 
|  | 184 | scaling_setspeed.		By "echoing" a new frequency into this | 
|  | 185 | you can change the speed of the CPU, | 
|  | 186 | but only within the limits of | 
|  | 187 | scaling_min_freq and scaling_max_freq. | 
|  | 188 |  | 
|  | 189 |  | 
|  | 190 | 3.2 Deprecated Interfaces | 
|  | 191 | ------------------------- | 
|  | 192 |  | 
|  | 193 | Depending on your kernel configuration, you might find the following | 
|  | 194 | cpufreq-related files: | 
|  | 195 | /proc/cpufreq | 
|  | 196 | /proc/sys/cpu/*/speed | 
|  | 197 | /proc/sys/cpu/*/speed-min | 
|  | 198 | /proc/sys/cpu/*/speed-max | 
|  | 199 |  | 
|  | 200 | These are files for deprecated interfaces to cpufreq, which offer far | 
|  | 201 | less functionality. Because of this, these interfaces aren't described | 
|  | 202 | here. | 
|  | 203 |  |