Difference between revisions of "Linux Dynamic Frequency Scaling"
(→Linux configuration) |
JeanLouisN (Talk | contribs) m (removed modprobe commands, added current mesurement) |
||
Line 4: | Line 4: | ||
Dynamic Frequency Scaling aka DFS is only available on [[APF27]] and [[APF51]] based systems. | Dynamic Frequency Scaling aka DFS is only available on [[APF27]] and [[APF51]] based systems. | ||
+ | You need to make a kernel with the CPUfreq drivers built inside : | ||
+ | <pre class="host"> | ||
+ | $ make linux26-menuconfig | ||
+ | </pre> | ||
==Linux configuration== | ==Linux configuration== | ||
<pre class="config"> | <pre class="config"> | ||
Line 22: | Line 26: | ||
frequency scaling handling is done in ''arch/arm/plat-mxc/cpufreq.c'' or ''arch/arm/mach-mx2/cpufreq_imx27.c'' | frequency scaling handling is done in ''arch/arm/plat-mxc/cpufreq.c'' or ''arch/arm/mach-mx2/cpufreq_imx27.c'' | ||
− | ==To know | + | ==To know whether the driver is working== |
<pre class="apf"> | <pre class="apf"> | ||
# dmesg | grep freq | # dmesg | grep freq | ||
Line 34: | Line 38: | ||
# ls | # ls | ||
</pre> | </pre> | ||
− | * | + | * identify the current governor: |
<pre class="apf"> | <pre class="apf"> | ||
# cat scaling_governor | # cat scaling_governor | ||
Line 42: | Line 46: | ||
<pre class="apf"> | <pre class="apf"> | ||
# cat scaling_available_governors | # cat scaling_available_governors | ||
− | + | conservative ondemand userspace powersave performance | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | conservative powersave performance | + | |
</pre> | </pre> | ||
* change governor: | * change governor: | ||
Line 70: | Line 67: | ||
800000 585 | 800000 585 | ||
</pre> | </pre> | ||
+ | ==Effect on current consumption== | ||
+ | When there is little activity, the CPU frequency has nearly no visible effect on the current consumed. | ||
+ | |||
+ | This is caused by the "doze mode" : when all processes are sleeping, the kernel turns off the CPU clock until the next IO or timer event. | ||
+ | |||
+ | When there is a 100% CPU activity, the effect of the CPU frequency can be observed with a ammeter. | ||
+ | |||
+ | The % CPU activity per process can be checked with the '''top''' command, which is supported by Busybox (but it may be necessary to configure and rebuild busybox to have it) | ||
+ | {{Note| If you make current measurements using a development board like APF27dev or APF51dev, take care of making all the measurement with the '''same supply voltage'''. | ||
+ | Unlike linear regulators, the switching regulator of the board reduces the current consumed when the input voltage is increased (to keep the power constant)}} | ||
* To Be Continued... | * To Be Continued... |
Revision as of 18:20, 26 November 2011
Page under construction... Informations on this page are not guaranteed !!
Contents
Introduction
Dynamic Frequency Scaling aka DFS is only available on APF27 and APF51 based systems.
You need to make a kernel with the CPUfreq drivers built inside :
$ make linux26-menuconfig
Linux configuration
CPU Power Management ---> [*] CPU Frequency scaling [*] Enable CPUfreq debugging <*> CPU frequency translation statistics [ ] CPU frequency translation statistics details Default CPUFreq governor (performance) ---> -*- 'performance' governor <*> 'powersave' governor <*> 'userspace' governor for userspace frequency scaling <*> 'ondemand' cpufreq policy governor <*> 'conservative' cpufreq governor <*> CPUfreq driver for i.MX CPUs or <*> i.MX27 frequency driver
frequency scaling handling is done in arch/arm/plat-mxc/cpufreq.c or arch/arm/mach-mx2/cpufreq_imx27.c
To know whether the driver is working
# dmesg | grep freq i.MXC CPU frequency driver
Usage (sysfs)
- all is here:
# cd /sys/devices/system/cpu/cpu0/cpufreq/ # ls
- identify the current governor:
# cat scaling_governor performance
- list available governors:
# cat scaling_available_governors conservative ondemand userspace powersave performance
- change governor:
# echo powersave > scaling_governor
- change frequency manually (here 133MHz). Requires userspace governor ! :
# echo 133000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
- To know current CPU frequency (here 160MHz):
# cat cpuinfo_cur_freq 160000
- To know how much time CPU has spent in its different state (here 160MHz and 800MHz):
# cat stats/time_in_state 160000 243595 800000 585
Effect on current consumption
When there is little activity, the CPU frequency has nearly no visible effect on the current consumed.
This is caused by the "doze mode" : when all processes are sleeping, the kernel turns off the CPU clock until the next IO or timer event.
When there is a 100% CPU activity, the effect of the CPU frequency can be observed with a ammeter.
The % CPU activity per process can be checked with the top command, which is supported by Busybox (but it may be necessary to configure and rebuild busybox to have it)
- To Be Continued...