Search by Tags

CPU Frequency (Linux)

 

Compare with Revision



Subscribe for this article updates

The Linux Kernel supports dynamic voltage and frequency switching (DVFS) in order to minimize power usage. Generally, the feature should remain enabled, however, if power consumption and heat dissipation aren't an issue and low latency is required, it might make sense to disable frequency scaling.

Maximum Frequency

The maximum frequency to be used depends on the SoC present in the module, see the table below:

Module Maximum frequency (Hz)
Colibri iMX6S/DL 996000
Colibri iMX6 IT 792000
Colibri IMX6ULL 792000
Colibri iMX7S 792000
Colibri iMX7DL 996000
Colibri T20/T20 IT 996000
Colibri T30 1400000
Colibri T30 IT 1000000
Apalis T30 1400000
Apalis iMX6 996000
Apalis iMX6 IT 792000
Apalis TK1 2070000

Note: Tegra modules can either have one or all cores enabled. This is controlled by the Linux kernel based on the CPU load. For instance, when the first CPU load goes to 100%, the other cores are enabled.

Note: For the Apalis T30 and Colibri T30 (non IT), the maximum CPU frequency depends on the number of cores enabled: 1 core 1.4GHz; 4 cores 1.3GHz. For the Colibri T30 IT, the the maximum frequency is 1 GHz independent of the number of cores enabled.

CPU Governor

CPU governors can be viewed as preconfigured power settings for the CPU, for detailed information about governors consult this article.

Available governors can be seen through "scaling_available_governors" file:

root@apalis-t30:~# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
conservative userspace powersave ondemand performance

Change CPU frequency behavior by using an appropriate governor:

root@apalis-t30:~# echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

CPU Frequency

Available frequencies values can be seen through "scaling_available_frequencies" file:

root@apalis-t30:~# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
51000 102000 204000 370000 475000 620000 760000 860000 1000000 1100000 1200000 1300000 1400000

Change CPU frequency value by setting the CPU frequency explicitly:

root@apalis-t30:~# echo 860000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed

Note: The userspace governor must be set to change frequency value.

The system will adjust to an appropriate voltage according to frequency. Please note that depending on the board/die temperature, thermal throttling might limit the current frequency in use.

CPUFreq Userspace Tools

The cpufreq userspace tools can be used to achieve the same results as above.

Check the current frequency information:

root@colibri-imx6:~# cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
driver: imx6-cpufreq
CPUs which run at the same hardware frequency: 0 1
CPUs which need to have their frequency coordinated by software: 0 1
maximum transition latency: 72.0 us.
hardware limits: 396 MHz - 792 MHz
available frequency steps: 396 MHz, 792 MHz
available cpufreq governors: interactive, conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 396 MHz and 792 MHz.
The governor "interactive" may decide which speed to use
within this range.
current CPU frequency is 396 MHz (asserted by call to hardware).
cpufreq stats: 396 MHz:46.32%, 792 MHz:53.68% (61)
analyzing CPU 1:
driver: imx6-cpufreq
CPUs which run at the same hardware frequency: 0 1
CPUs which need to have their frequency coordinated by software: 0 1
maximum transition latency: 72.0 us.
hardware limits: 396 MHz - 792 MHz
available frequency steps: 396 MHz, 792 MHz
available cpufreq governors: interactive, conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 396 MHz and 792 MHz.
The governor "interactive" may decide which speed to use
within this range.
current CPU frequency is 396 MHz (asserted by call to hardware).
cpufreq stats: 396 MHz:46.32%, 792 MHz:53.68% (61)

Change CPU frequency behavior to userspace:

root@colibri-imx6:~# cpufreq-set -g userspace

Change CPU frequency value by setting the CPU frequency explicitly:

root@colibri-imx6:~# cpufreq-set -f 396000000