# Power Saving - CPU Scaling / APM&ACPI problem

## pear-i

I'm currently running on a Dell C640 Laptop( Pentium 4 Mobile 2.00 / 1.20) and i'm trying to configure the CPU Scaling for it -- i believe i have all the appropriate modules and what not installed, but the CPU Scaling indicator in gnome still shows that i'm running on 2.0 Ghz even when i'm not doing anything -- 

Another problem -- possibly related is that during the gnome install i was unable to emerge the apmd package so i'm unable to use the battery monitor... when i run the gnome applet it says 'Can't access ACPI events in /var/run/acpid.socket!) Make sure the acpi subsystem is working and the acpid daemon is running'

kinda lost in how to configure this properly... and i urgently need to get it up and ready for university

so if possible could you guys give me some pointers or steps i can take to debug / find the problem and fix it? 

thanks.

----------

## rukh

To use the CPU scaling govenor you have to start it every time you boot your pc. I don't know the correct term at the moment but just search the forum for it. You have to write it into the /etc/conf.d/local.start file.

----------

## feivelda

For your battery, emerge acpid and add it to the default runlevel.

Then should the applet work. For this you need to activate acpi support in your kernel.

For the frequency scaling. There are several ways. 

If you want the 2 GHz and the 1.2 Ghz, you need speedstep_ich to compile in your kernel or as module.

If you want steps from 200 Hz on AC and 150 Hz in DC, you need also the p4-clockmod module.

This should you compile as module, because you need to unload and reload it from kernel, when you plug-in or -out your power cable.

On other threads is already discussed, what method is better to save power, I prefer the p4-clockmod unload - reload ( done by acpi script ) because for my Inspiron 4150 it saves much more power.

As frequency daemon, use cpufreqd and add it also to runlevel default. It's standard parameters should work fine for you.

Also emerge laptop-mode-tools. This also saves a lot of power.

----------

## pear-i

wow thanks! i emerged acpid & laptop-mode-tools and added those things to the runlevel default and it worked fine  :Smile: 

haha thanks a lot guys!!

a question tho -- i had my laptop set up on ubuntu before and when it was plugged it detected what processes i was running and matched the amount of CPU power (e.g. if it was on idle it'd go to 1.2 Ghz... and when i started Open Office or something it'd shoot up to 2 until it was set) right now it seems to be set on whether i have it plugged or not could you shed a bit more light on how to set the cpu scaling thing up dependong on the system's demand? 

+interestingly enough -- the cpu scalign right now is shfiting from 1.2 - 1.32 instead of 2.0 ghz when i'm doing heavier tasks

ah wait i found it... seems to be the settings in /etc/cpufreqd.conf

thanks

----------

## feivelda

in /etc/cpufreqd.conf you can also set frequencies in kHz.

I have tuned my yesterday, I found it useless that the cpu is scaling on full power when I'm on battery.

I think, you should also add some code to your /etc/acpi/actions/lm_battery.sh and /etc/acpi/actions/lm_ac_adapter.sh or how they spell on your machine.

Add near the beginning a

modprobe -r p4-clockmod

modprobe p4-clockmod

This unloads the p4-clockmod driver and reloads it.

After that, look at cpufreq-info, plug your cable off and look again at cpufreq-info

----------

## pear-i

tried that -- results are still mostly the same --

for some reason the ondemand govenor doesn't really do mch except stay at teh default 2.0 Ghz even wen my system is inactive.. getting like 2 hours isntead of my 3 at full charge for battery life...

when i do cpufreq-info it only shows the performance govenor

'Available cpu freq govenors: performance'

----------

## feivelda

This is not ok.

So check:

Have you compiled speedlib_ich in your kernel and p4-clockmod as module ?

Have you recompiled your kernel after that ?

Do you load p4-clockmod with your /etc/modules.autoload.d/kernel-2.6 ?

After all these steps, please post you cpufreq-info output

----------

## pear-i

i think i had it set up compiled in the kernel

i just loaded it up as a module 

under powermanagement > cpu freq scaling > Intel Pentium 4 clock modulation  right?

cpufreq info yields 

```
analyzing CPU 0:

  driver: speedstep-ich

  CPUs which need to switch frequency at the same time: 0

  hardware limits: 1.20 GHz - 2.00 GHz

  available frequency steps: 2.00 GHz, 1.20 GHz

  available cpufreq governors: performance

  current policy: frequency should be within 1.20 GHz and 2.00 GHz.

                  The governor "performance" may decide which speed to use

                  within this range.

  current CPU frequency is 2.00 GHz (asserted by call to hardware).

```

my cpu scaling works --- when i unplug it goes to 1.20 Ghz

```

#/etc/cpufreqd.conf

[General]

pidfile=/var/run/cpufreqd.pid

poll_interval=2

pm_type=acpi

verbosity=5

[Profile]

name=ondemand

minfreq=1200000

maxfreq=2000000

policy=ondemand

[Profile]

name=powersave

minfreq=1200000 

maxfreq=13200000 

policy=powersave

[Profile]

name=performance

minfreq=1200000 

maxfreq=2000000

policy=performance

[Rule]

name=battery

ac=off

profile=powersave #ondemand

[Rule]

name=battery_low

ac=off

battery_interval=0-10

profile=powersave

[Rule]

name=ac

ac=on

profile=ondemand #performance

```

----------

## feivelda

When you look at your cpufreq-info, your driver is speedstep-ich

So try

echo "p4-clockmod" >> /etc/modules.autoload.d/kernel-2.6

and then reboot

After that, please repost you cpufreq-info if it differs

----------

## pear-i

hey feivelda,

sorry for the late replay -- been sorta busy prepping for school lately but yep

i am following your instructions as we speak and the output after reboot produces the exact same thing as i posted above.

I notice however that right now it says p4_clockmod fails to load at startup..

----------

## feivelda

But I think, you have a Pentium 4 Mobile? This is strange.

At my Pentium 4 Mobile 1.6 GHz it works like charm

----------

## pear-i

yah confuddling -- aiy i really need to set this up -- anyone have any ideas?

school is starting soon and 2 hours of battery life doesn't quite suit my fancy :p when i could be getting 3

+ubuntu works fine... tho i wanna stick w/ gentoo -- bla..

----------

