You are not logged in.

#1 2006-08-18 05:45:31

allucid
Member
Registered: 2006-01-06
Posts: 259

Automagically changing cpu governors

I want to use 'ondemand' when on battery power and 'performance' when on A/C. What is a good way to set this up? I saw the cpufreq(d) daemons but they don't seem to have this option (as far as I could tell).

Offline

#2 2006-08-18 14:43:24

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Automagically changing cpu governors

this should be easy to do by adding an acpi handler for battery/ac that simply does something like

if on_ac; then
   modprobe cpufreq_performance
   cpufreq-set -g performance
else
   modprobe cpufreq_ondemand
   cpufreq-set -g ondemand
fi

You don't need cpufreqd for this, as that is a userspace governor (it does not use ondemand/performance, it uses cpufreq_userspace)

Offline

#3 2006-08-18 15:45:57

Pierluigi
Member
Registered: 2004-04-10
Posts: 90
Website

Re: Automagically changing cpu governors

I use acpid (loaded in DAEMONS array), and

...
...
    ac_adapter)
                case "$2" in
                        AC0)
                                case "$4" in
                                        00000000)
                                                echo -n "powersave" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
                                                
                                        ;;
                                        00000001)
                                                echo -n "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
                                                
                                        ;;
                                esac
                                ;;
                        *) logger "ACPI action undefined: $2" ;;
                esac
...
...

in /etc/acpid/handler.sh

Offline

#4 2006-08-19 11:46:22

patroclo7
Member
From: Bassano del Grappa, ITALY
Registered: 2006-01-11
Posts: 913

Re: Automagically changing cpu governors

I agree with the suggestions above, but the mention of cpufreqd is actually unfair: it is not a mere userspace governor (as, e.g., powernowd); also in the default configuration, it changes governor in different situations. I do not like is over-complex configuration so I do not use it anymore, however I am pretty sure you can do what you want also with cpufreqd (please do not identify the cpufreqd package with the cpufreq daemon in the cpufrequtils package).


Mortuus in anima, curam gero cutis

Offline

#5 2006-08-19 14:14:32

karsten
Member
Registered: 2006-07-14
Posts: 261

Re: Automagically changing cpu governors

what if you don't have a powersave governor? my system just has ondemand and performance.

Offline

#6 2006-08-19 15:24:11

allucid
Member
Registered: 2006-01-06
Posts: 259

Re: Automagically changing cpu governors

karsten wrote:

what if you don't have a powersave governor? my system just has ondemand and performance.

You need to enable support in the kernel.

Offline

Board footer

Powered by FluxBB