Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Nov 2005 13:40:52 -0200
From:      AT Matik <asstec@matik.com.br>
To:        freebsd-mobile@freebsd.org
Subject:   comment on ACPI cpufreq apm powerd and patch for power_profile on 6.0
Message-ID:  <200511201340.52641.asstec@matik.com.br>

next in thread | raw e-mail | index | archive | help
I just write this to share some info. I bought an Acer3002 with Sempron 280=
0=20
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=20
again!

But anyway i didn't get it running for more than 35 minutes on battery. Now=
 I=20
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=
=20
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=20
economy_cpu_freq only saying LOW and HIGH, but you can set the frequency ra=
te=20
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=
=20
what my NB supports and set this in r,conf as:

performance_cx_lowest=3D"C1"
performance_cpu_freq=3D"1600"
economy_cx_lowest=3D"C3"
economy_cpu_freq=3D"800"=20

Now I get power_profile: changed to 'economy' or 'performance"in messages a=
nd=20
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_lowes=
t,=20
getting "C4" what probably cause misfunction but read on

So funny is that when setting

performance_cx_lowest=3D"none"
performance_cpu_freq=3D"none"
economy_cx_lowest=3D"none"
economy_cpu_freq=3D"none"=20

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

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

I set the above then to none and

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

powerd_enable=3D"YES"
powerd_flags=3D"-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 freque=
ncy=20
loop what did made no sense so I figured out the -r 30 -i 80 as reasonable=
=20

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=20
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=
=20
power_profile does

the other difference that powerd gave me better response from the PC as=20
power_profile does, since the latter sometimes stucked response what was no=
t=20
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=20
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=20
eachother. I think an advice in the man pages or /etc/defaults/rc.conf woul=
d=20
not do any bad. Better still if powerd set the power_profile parms to none =
if=20
enabled.

Jo=E3o

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


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

=2D-- 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=3D"power_profile"
=2DLOGGER=3D"logger -t power_profile -p daemon.notice "
+LOGGER=3D"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}=3D${value}
+       ${LOGGER} "changed to ${profile}"
 }

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200511201340.52641.asstec>