Difference between revisions of "Linux Dynamic Frequency Scaling"

From ArmadeusWiki
Jump to: navigation, search
m (removed modprobe commands, added current mesurement)
m (Introduction)
Line 6: Line 6:
 
You need to make a kernel with the CPUfreq drivers built inside :
 
You need to make a kernel with the CPUfreq drivers built inside :
 
<pre class="host">
 
<pre class="host">
$ make linux26-menuconfig
+
$ make linux-menuconfig
 
</pre>
 
</pre>
 +
 
==Linux configuration==
 
==Linux configuration==
 
<pre class="config">
 
<pre class="config">

Revision as of 19:41, 4 September 2013

Page under construction... Construction.png Informations on this page are not guaranteed !!

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 linux-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)

Note 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...

Links