| View previous topic :: View next topic |
| Author |
Message |
Earthwings Administrator


Joined: 14 Apr 2003 Posts: 7731 Location: Karlsruhe, Germany
|
Posted: Thu Mar 11, 2004 11:38 pm Post subject: [Howto] Power Management for your laptop using ACPI |
|
|
Battery lifetime is too short? Your laptop is getting too hot? Want to hibernate like in Windows? This howto might help you. It's was getting too big to put it here in the forums, but it's still just one click away.
Edit: It's now available at http://www.gentoo.org/doc/en/power-management-guide.xml
I'd appreciate some comments, additions, suggestions etc. Have fun
For your convenience, here's a short outline of what is expecting you:
Power Management for Laptops in Gentoo Linux
Introduction
Prerequisites
--> The BIOS part
--> ACPI support for the kernel
--> Creating a "battery" runlevel
CPU Power Management
LCD Power Management
Disk Power Management
Power Management for other devices
--> Wireless Power Management
--> USB Power Management
Sleep states: sleep, standby, suspend to RAM, hibernate, suspend to disk
Extending with Profiles
FAQ / Troubleshooting
Last edited by Earthwings on Fri Mar 18, 2005 7:23 am; edited 6 times in total |
|
| Back to top |
|
 |
bombcar Guru


Joined: 08 Apr 2003 Posts: 446 Location: Lincoln Acres, CA
|
Posted: Thu Mar 11, 2004 11:49 pm Post subject: |
|
|
| One way to make Gentoo know what it is booting into is to make the default runlevel very empty, and then all it does is decide if AC power is available, then boot to "acpower", but if only battery, boot to "battery" |
|
| Back to top |
|
 |
dvc5 Guru


Joined: 06 Dec 2003 Posts: 433 Location: Sunnyvale, California
|
Posted: Thu Mar 11, 2004 11:51 pm Post subject: |
|
|
This is great! I've been looking for something like this for a long time. Now I just need a laptop w/ frequency scaling.  _________________ #define NULL rand() /*heh heh heh */
Green Is Good |
|
| Back to top |
|
 |
Earthwings Administrator


Joined: 14 Apr 2003 Posts: 7731 Location: Karlsruhe, Germany
|
Posted: Fri Mar 12, 2004 12:00 am Post subject: |
|
|
| bombcar wrote: | | One way to make Gentoo know what it is booting into is to make the default runlevel very empty, and then all it does is decide if AC power is available, then boot to "acpower", but if only battery, boot to "battery" |
This is indeed nicer then my first idea (modifying /sbin/rc). However, there'll be an even better solution, I hope... |
|
| Back to top |
|
 |
Jefklak l33t

Joined: 26 Oct 2003 Posts: 818 Location: Belgium
|
Posted: Sat Mar 20, 2004 1:04 pm Post subject: |
|
|
Very nice guide, congrats!
I'm only having trouble with ACPID - he doesn't receive any events!
I tried watching my events with
| Code: | | cat /proc/acpi/button/state |
But when I pressed power or closed/opened the lid nothing changed in that file... Is that normal? the module button is loaded... I don't know what to do, acpi seems to ignore my events... Does anyone have a clue? |
|
| Back to top |
|
 |
Earthwings Administrator


Joined: 14 Apr 2003 Posts: 7731 Location: Karlsruhe, Germany
|
Posted: Sat Mar 20, 2004 5:18 pm Post subject: |
|
|
I don't have a file /proc/acpi/button/state. Instead, there are directories like /proc/acpi/button/lid/LID/ with file "info" and "state" inside. What do you get in dmesg when inserting the button module? I get
| dmesg | grep ACPI wrote: |
ACPI: Battery Slot [BAT0] (battery present)
ACPI: Battery Slot [BAT1] (battery absent)
ACPI: Power Button (FF) [PWRF]
ACPI: Lid Switch [LID]
ACPI: Sleep Button (CM) [SLPB]
|
Does /proc/acpi/event exist? Is /etc/acpi/default.sh called when acpid is running? |
|
| Back to top |
|
 |
Jefklak l33t

Joined: 26 Oct 2003 Posts: 818 Location: Belgium
|
Posted: Sat Mar 20, 2004 9:11 pm Post subject: |
|
|
Duh, I meant the /proc/acpi/event file instead of the button/state file... I don't know if the .sh file is called when a button is pressed or a lid is opened or closed, how can I check this? Also, acpid seems t owork (same dmesg as you) but the state thing does not work... Yes, the files you mentionned excist but some way the events aren't passed or don't work correctly... Any idea?
Thanks! |
|
| Back to top |
|
 |
jarealist Apprentice

Joined: 07 Oct 2002 Posts: 224
|
Posted: Fri Mar 26, 2004 12:53 am Post subject: |
|
|
Thanks for the howto. However, I'm having a problem getting the following module to load:
<M> ACPI Processor P-States driver
I get this from modprobe:
modprobe acpi
FATAL: Error inserting acpi (/lib/modules/2.6.4-gentoo-r1/kernel/arch/i386/kernel/cpu/cpufreq/acpi.ko): Device or resource busy
Any suggestions? All the other modules load OK. Here is my /etc/modules.autoload.d/kernel-2.6.
ac
battery
button
fan
processor
thermal
acpi
pcmcia_core
ds
yenta_socket
sonypi
fglrx
av5100
ipw2100
I have a Sony Viao PCG-V505DX and I'm using gentoo-dev-sources kernel ( 2.6.4-gentoo-r1.)
Will this work compiled in? Thanks. |
|
| Back to top |
|
 |
Kenja n00b

Joined: 21 Mar 2004 Posts: 27
|
Posted: Fri Mar 26, 2004 2:18 am Post subject: |
|
|
| Just a thought. I have an unlocked Athlon XP Mobile. The current Biostar I intend on using has multiplier settings in the BIOS. I don't expect it to work for my board, but MSI has a board that has software multiplier management. Currently they only have software for windows, but would this setup work for the MSI board as well. In theory would the MSI board use the same commands as a board in a laptop and in effect make for a quiet desktop PC? |
|
| Back to top |
|
 |
Earthwings Administrator


Joined: 14 Apr 2003 Posts: 7731 Location: Karlsruhe, Germany
|
Posted: Sat Apr 03, 2004 10:03 am Post subject: |
|
|
Sorry for the long delay.
Jefklak: What laptop do you have? I read a few other posts where the same happens.
jarealist: It's the same for me. I haven't yet figured out what the problem is, but if you did, please post here.
Kenja: Sorry, I don't have any experience with that.
I'm currently working on the next major update for the guide supporting laptop_mode and Power Management Profiles. It looks promising, but will take some time to finish. Stay tuned.
Edit: laptop-mode now included
Last edited by Earthwings on Tue Apr 06, 2004 6:45 pm; edited 1 time in total |
|
| Back to top |
|
 |
Jefklak l33t

Joined: 26 Oct 2003 Posts: 818 Location: Belgium
|
Posted: Sat Apr 03, 2004 12:07 pm Post subject: |
|
|
Dell Inspiron 5150.
I reinstalled my whole box -- still no go...  _________________ {Linux User #333296}
Kernel 2.6.9-nitro4! << hurrah |
|
| Back to top |
|
 |
Earthwings Administrator


Joined: 14 Apr 2003 Posts: 7731 Location: Karlsruhe, Germany
|
|
| Back to top |
|
 |
Jefklak l33t

Joined: 26 Oct 2003 Posts: 818 Location: Belgium
|
|
| Back to top |
|
 |
Earthwings Administrator


Joined: 14 Apr 2003 Posts: 7731 Location: Karlsruhe, Germany
|
|
| Back to top |
|
 |
angagon n00b


Joined: 19 Mar 2003 Posts: 21 Location: Colorado Springs, CO
|
Posted: Sun Apr 18, 2004 3:41 pm Post subject: |
|
|
I am using a program called hprofile at [url]hprofile.sf.net[/url]. It allows changing files anywhere (like /etc) so you can set it up for different power configurations and using ACPI change confs on plugging the power in or out. Or other things. _________________ "Not everyone knows Josiah Royce's definition of a liar as a man who willfully misplaces his ontological predicates, but everyone who has ever told a lie will recognize its accuracy."
Ch. 94: Truth - "The Great Ideas" |
|
| Back to top |
|
 |
TinheadNed Guru


Joined: 05 Apr 2003 Posts: 337 Location: Farnborough, UK
|
Posted: Sun Apr 18, 2004 10:51 pm Post subject: |
|
|
Just to be picky, your suspend/hibernate section is slightly wrong. There are two different sets of suspend code in the 2.6 kernel, hence the two different suspend options. There is the original Software Suspend (swsusp) that requires a resume= command line to your swap space, and the new PM code (which is the config option that requires a hardcoded partition).
If both are compiled in the kernel then
| Code: | | echo -n X >/proc/acpi/sleep | activates swsusp code and | Code: | | echo -n {standby|mem|disk} >/sys/power/state | activates the new code.
I prefer the second option. Disk == hibernate and appears to work well, mem == suspend and doesn't work, my (shitty) laptop just suspends but won't stop. standby doesn't seem to do anything permanent on my laptop, it enters standby and then immediately returns from it (without ANY problem) thus negating its use. If anyone has fixed that I'd be interested  |
|
| Back to top |
|
 |
Kuartzer Tux's lil' helper


Joined: 15 Jul 2003 Posts: 81 Location: in front of the keyboard @ Lx - PT
|
Posted: Tue May 04, 2004 6:39 pm Post subject: |
|
|
| Quote: | | Note: One thing is missing: Gentoo will boot into runlevel default regardless of AC or battery plugged in. One way to get round this is to add a "softlevel=battery" boot parameter, but there has to be a more automatic way. I'll have a deeper look into this and update this document appropriatly. |
Can´t we put acpid on boot runlevel?? maybe there it will no go to default on boot, only starting it on acpower...
I belive that it starts runlevel default on boot only becouse acpid is included in that runlevel and becouse it´s the logical and inicial boot sequence. _________________ "Não existe nada completamente errado no mundo, até mesmo um relógio parado consegue estar certo duas vezes por dia..." |
|
| Back to top |
|
 |
Earthwings Administrator


Joined: 14 Apr 2003 Posts: 7731 Location: Karlsruhe, Germany
|
Posted: Tue May 04, 2004 7:15 pm Post subject: |
|
|
Putting acpid in boot runlevel is not sufficient because it doesn't generate an event. However, the idea to decide which runlevel to start in the end of the boot runlevel sounds good. I'm not sure if the current battery runlevel satisfies everything a proper default runlevel has to provide (list of critical services etc).
The workaround I did right now is putting this code in /etc/conf.d/local.start:
| Code: |
# Fake acpi event to switch runlevel if running on batteries
/etc/acpi/default.sh "battery/battery"
|
This leads to the runlevel sequence boot -> default -> battery if booted on batteries, what is not optimal, but at least working.
@TinheadNed: Thanks for reporting, I think you're right - I'll update the howto when I've got a little more time (next week). I'm also going to update the profiles section and add a FAQ/Troubleshooting like chapter. |
|
| Back to top |
|
 |
Kuartzer Tux's lil' helper


Joined: 15 Jul 2003 Posts: 81 Location: in front of the keyboard @ Lx - PT
|
Posted: Tue May 04, 2004 7:33 pm Post subject: |
|
|
I belive that the batery runlevel it´s a full copy of the default one plus the energie savings settings.
| Quote: | | Code: |
cd /etc/runlevels
cp -r default battery
|
|
If that is true, can it work??
If not, why not creat one more runlevel, the acpower. or the critical, an we separate the critical servicies from others!
BTW: thanks for the howto! i´m not currently using it becouse my laptop is lended to my dad, but i will use it as soon as i can  _________________ "Não existe nada completamente errado no mundo, até mesmo um relógio parado consegue estar certo duas vezes por dia..." |
|
| Back to top |
|
 |
Earthwings Administrator


Joined: 14 Apr 2003 Posts: 7731 Location: Karlsruhe, Germany
|
Posted: Sun May 16, 2004 6:02 pm Post subject: |
|
|
| IIRC the main problem is that /sbin/rc reads out the SOFTLEVEL value too early to update it. You are right that creating another runlevel would be a solution however. |
|
| Back to top |
|
 |
Earthwings Administrator


Joined: 14 Apr 2003 Posts: 7731 Location: Karlsruhe, Germany
|
Posted: Sun May 16, 2004 6:03 pm Post subject: |
|
|
I made another major update right now. Beneath some minor fixes I added a FAQ chapter and updated the suspend/hibernate section. It now mentions swsusp2, which is the first implementation for hibernation that works for me. It looks really promising, has a nice interface and even supports bootsplash. You definitely want to try it  |
|
| Back to top |
|
 |
blmartin777 l33t


Joined: 18 Nov 2003 Posts: 646 Location: Not Quite Sure
|
Posted: Mon May 17, 2004 9:08 pm Post subject: |
|
|
I didn't have the directory
/sys/devices/system/cpu/cpu0/cpufreq/
and it wouldn't let me create one not sure what to do.
thanks |
|
| Back to top |
|
 |
blmartin777 l33t


Joined: 18 Nov 2003 Posts: 646 Location: Not Quite Sure
|
Posted: Tue May 18, 2004 8:22 pm Post subject: |
|
|
I still haven't been able to resolve my problem
NO: /sys/devices/system/cpu/cpu0/cpufreq/ and I can't create one
Any ideas on what I should do. |
|
| Back to top |
|
 |
Earthwings Administrator


Joined: 14 Apr 2003 Posts: 7731 Location: Karlsruhe, Germany
|
Posted: Tue May 18, 2004 8:52 pm Post subject: |
|
|
| Can you give some more details? Some hardware specs. and the relevant parts of the kernel config. Also make sure there's no "dumb" mistake like forgetting to mount /boot before copying the kernel etc. |
|
| Back to top |
|
 |
blmartin777 l33t


Joined: 18 Nov 2003 Posts: 646 Location: Not Quite Sure
|
Posted: Tue May 18, 2004 9:23 pm Post subject: |
|
|
I have a gentoo system up and running. I was following your how-to and it got to the part where you said to | Quote: | cat /proc/cpuinfo | grep "cpu MHz"
cd /sys/devices/system/cpu/cpu0/cpufreq/
echo -n userspace > scaling_governor
echo -n 1000000 > scaling_setspeed
cat /proc/cpuinfo | grep "cpu MHz" |
When I tried to cd /sys/devices/system/cpu/cpu0/cpufreq I don't have that. I have everything up to /sys/devices/system/cpu/cpu0 but no cpufreq so I tried to create one (as normal user and as root) but it wouldn't let me. So I am not sure where to go or what to do from here.
I have a HP ze4145 laptop w/ Athlon-XP 1800+ 512mb ram
running kde 3.2.2 and 2.6.6-love1 kernel. |
|
| Back to top |
|
 |
|