comment on ACPI cpufreq apm powerd and patch for power_profile on 6.0

AT Matik asstec at matik.com.br
Sun Nov 20 15:40:51 GMT 2005


I just write this to share some info. I bought an Acer3002 with Sempron 2800 
some time ago and had a hard time to get this piece configured.

I had some very useful help from Bruno Ducrot to correct the DSDT, thanks 
again!

But anyway i didn't get it running for more than 35 minutes on battery. Now I 
have an hour and ten minutes, no big deal but more reasonable.

zzz is working but no wake up, no chance, but not so important to me.

Definitly the man pages for apm, powerd, cpufreq are buggy and controvers.


probably this page say it all: http://www.freebsd.org/projects/acpi/

powerd man page says to put Minimum Maximum an adaptive as mode string but 
that is  wrong, you need to set min | max | adaptive, that is what it knows

also in the man pages is not clear how to set economy_cx_lowest 
economy_cpu_freq only saying LOW and HIGH, but you can set the frequency rate 
your PC supports and the it works appearently.

Anyway, who wants to know, here is how I could double battery time

I queried sysctl dev.cpu.0.freq_levels and hw.acpi.cpu.cx_supported to see 
what my NB supports and set this in r,conf as:

performance_cx_lowest="C1"
performance_cpu_freq="1600"
economy_cx_lowest="C3"
economy_cpu_freq="800" 

Now I get power_profile: changed to 'economy' or 'performance"in messages and 
infact  dev.cpu.0.freq is set to 800 or 1600 correctly.

The power_profile script also does not query correctly hw.acpi.cpu.cx_lowest, 
getting "C4" what probably cause misfunction but read on

So funny is that when setting

performance_cx_lowest="none"
performance_cpu_freq="none"
economy_cx_lowest="none"
economy_cpu_freq="none" 

it wrongly states in messages changed to economy or performance but it does 
nothing, it is only a sript logic error in , if you like you may use the 
patch attached to correct this

what i "guess" (because not explained anywhere) using none means not to use 
power_profile at all and powerd should do the job if configured.

I set the above then to none and

apm_enable="YES" #only for getting Klapdaemon to work

powerd_enable="YES"
powerd_flags="-a adaptive -r 30 -i 80 -b min"

I needed to compile the kernel with the cpufreq device to get this work

taking the default adaptive settings I got an continous 800-1600 cpu frequency 
loop what did made no sense so I figured out the -r 30 -i 80 as reasonable 

but anyway powerd gave me 1h of battery and power_profile 1h10m

probably a better and similar tuning for -b adaptive would get me better 
results on battery, I will check this soon I have some time

the difference I saw that powerd did not set hw.acpi.cpu.cx_lowest to C3 as 
power_profile does

the other difference that powerd gave me better response from the PC as 
power_profile does, since the latter sometimes stucked response what was not 
so very my tast as I work lot with ssh connection

I need to say that I downgraded to 6.0RC1 for the atapicam and ndis problem I 
can not live with so I have not idea how 6.0-R is corrected or not

also I see a problem powerd and power_profile conflicting, overwriting 
eachother. I think an advice in the man pages or /etc/defaults/rc.conf would 
not do any bad. Better still if powerd set the power_profile parms to none if 
enabled.

João

Applying this patch you can now set HIGH or LOW as well as C1 to C3 or cpu 
frequency depending on what you PC supports
the patch works to correct 6.0R because power_profile of 6.0R is not ok either


##################
power_profile.patch
##################

--- power_profile       Sun Nov 20 13:16:45 2005
+++ power_profile.b     Sun Nov 20 13:27:59 2005
@@ -14,7 +14,7 @@
 . /etc/rc.subr

 name="power_profile"
-LOGGER="logger -t power_profile -p daemon.notice "
+LOGGER="logger -t power_profile -p daemon.notice"

 # Set a given sysctl node to a value.
 #
@@ -49,6 +49,7 @@

        # Set the desired value
        [ -n "${value}" ] && sysctl ${node}=${value}
+       ${LOGGER} "changed to ${profile}"
 }

 if [ $# -ne 1 ]; then
@@ -61,11 +62,9 @@
 case ${state} in
 0x01 | '')
        profile="performance"
-       ${LOGGER} "changed to 'performance'"
        ;;
 0x00)
        profile="economy"
-       ${LOGGER} "changed to 'economy'"
        ;;
 *)
        echo "Usage: $0 [0x00|0x01]"
@@ -76,7 +75,7 @@
 node="hw.acpi.cpu.cx_lowest"
 highest_value="C1"
 lowest_value="`(sysctl -n hw.acpi.cpu.cx_supported | \
-       awk '{ print "C" split($0, a) }' -) 2> /dev/null`"
+       awk '{ split($0, a, "[/ ]"); print a[length(a) - 1] }' -) 
2> /dev/null`"
 eval value=\$${profile}_cx_lowest
 sysctl_set


############################









A mensagem foi scaneada pelo sistema de e-mail e pode ser considerada segura.
Service fornecido pelo Datacenter Matik  https://datacenter.matik.com.br


More information about the freebsd-mobile mailing list