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