Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Kernel & Hardware
  • Search

[Howto] Power Management for your laptop using ACPI

Kernel not recognizing your hardware? Problems with power management or PCMCIA? What hardware is compatible with Gentoo? See here. (Only for kernels supported by Gentoo.)
Post Reply
Advanced search
57 posts
  • 1
  • 2
  • 3
  • Next
Author
Message
Earthwings
Bodhisattva
Bodhisattva
User avatar
Posts: 7753
Joined: Mon Apr 14, 2003 8:13 pm
Location: Germany

[Howto] Power Management for your laptop using ACPI

  • Quote

Post by Earthwings » Thu Mar 11, 2004 11:38 pm

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.
Top
bombcar
Guru
Guru
User avatar
Posts: 453
Joined: Tue Apr 08, 2003 5:04 pm
Location: Wisconsin
Contact:
Contact bombcar
Website

  • Quote

Post by bombcar » Thu Mar 11, 2004 11:49 pm

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"
Top
dvc5
Guru
Guru
User avatar
Posts: 433
Joined: Sat Dec 06, 2003 6:45 pm
Location: Sunnyvale, California
Contact:
Contact dvc5
Website

  • Quote

Post by dvc5 » Thu Mar 11, 2004 11:51 pm

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
Top
Earthwings
Bodhisattva
Bodhisattva
User avatar
Posts: 7753
Joined: Mon Apr 14, 2003 8:13 pm
Location: Germany

  • Quote

Post by Earthwings » Fri Mar 12, 2004 12:00 am

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...
Top
Jefklak
l33t
l33t
Posts: 818
Joined: Sun Oct 26, 2003 10:47 am
Location: Belgium
Contact:
Contact Jefklak
Website

  • Quote

Post by Jefklak » Sat Mar 20, 2004 1:04 pm

Very nice guide, congrats! :)
I'm only having trouble with ACPID - he doesn't receive any events!
I tried watching my events with

Code: Select all

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?
Top
Earthwings
Bodhisattva
Bodhisattva
User avatar
Posts: 7753
Joined: Mon Apr 14, 2003 8:13 pm
Location: Germany

  • Quote

Post by Earthwings » Sat Mar 20, 2004 5:18 pm

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?
Top
Jefklak
l33t
l33t
Posts: 818
Joined: Sun Oct 26, 2003 10:47 am
Location: Belgium
Contact:
Contact Jefklak
Website

  • Quote

Post by Jefklak » Sat Mar 20, 2004 9:11 pm

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!
Top
jarealist
Apprentice
Apprentice
Posts: 228
Joined: Mon Oct 07, 2002 10:50 pm

  • Quote

Post by jarealist » Fri Mar 26, 2004 12:53 am

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.
Top
Kenja
n00b
n00b
Posts: 27
Joined: Sun Mar 21, 2004 7:08 am

  • Quote

Post by Kenja » Fri Mar 26, 2004 2:18 am

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?
Top
Earthwings
Bodhisattva
Bodhisattva
User avatar
Posts: 7753
Joined: Mon Apr 14, 2003 8:13 pm
Location: Germany

  • Quote

Post by Earthwings » Sat Apr 03, 2004 10:03 am

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.
Top
Jefklak
l33t
l33t
Posts: 818
Joined: Sun Oct 26, 2003 10:47 am
Location: Belgium
Contact:
Contact Jefklak
Website

  • Quote

Post by Jefklak » Sat Apr 03, 2004 12:07 pm

Dell Inspiron 5150.
I reinstalled my whole box -- still no go... :(
{Linux User #333296}
Kernel 2.6.9-nitro4!
<< hurrah
Top
Earthwings
Bodhisattva
Bodhisattva
User avatar
Posts: 7753
Joined: Mon Apr 14, 2003 8:13 pm
Location: Germany

  • Quote

Post by Earthwings » Sat Apr 03, 2004 12:22 pm

Have a look here, seems to be a common problem for the Dell 5100 serie.
http://forums.gentoo.org/viewtopic.php?t=154996
Top
Jefklak
l33t
l33t
Posts: 818
Joined: Sun Oct 26, 2003 10:47 am
Location: Belgium
Contact:
Contact Jefklak
Website

  • Quote

Post by Jefklak » Sun Apr 04, 2004 9:16 am

Thanks for the link, it seems common indeed, that sucks :(
I already recompiled my DSDT and I was able to solve 1 WARNING (no error) but there are still 4 left (see http://forums.gentoo.org/viewtopic.php? ... 5&start=75 ...)

I already flashed my bios to A29, ill check if there's a newer version...
{Linux User #333296}
Kernel 2.6.9-nitro4!
<< hurrah
Top
Earthwings
Bodhisattva
Bodhisattva
User avatar
Posts: 7753
Joined: Mon Apr 14, 2003 8:13 pm
Location: Germany

  • Quote

Post by Earthwings » Thu Apr 08, 2004 8:15 pm

Just stumbled over this
http://bugme.osdl.org/show_bug.cgi?id=1752
Top
angagon
n00b
n00b
User avatar
Posts: 21
Joined: Wed Mar 19, 2003 1:35 am
Location: Colorado Springs, CO

  • Quote

Post by angagon » Sun Apr 18, 2004 3:41 pm

I am using a program called hprofile at hprofile.sf.net. 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"
Top
TinheadNed
Guru
Guru
User avatar
Posts: 339
Joined: Sat Apr 05, 2003 5:12 pm
Location: Farnborough, UK
Contact:
Contact TinheadNed
Website

  • Quote

Post by TinheadNed » Sun Apr 18, 2004 10:51 pm

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: Select all

echo -n X >/proc/acpi/sleep
activates swsusp code and

Code: Select all

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 :D
Top
Kuartzer
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 81
Joined: Tue Jul 15, 2003 5:47 pm
Location: in front of the keyboard @ Lx - PT

  • Quote

Post by Kuartzer » Tue May 04, 2004 6:39 pm

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..."
Top
Earthwings
Bodhisattva
Bodhisattva
User avatar
Posts: 7753
Joined: Mon Apr 14, 2003 8:13 pm
Location: Germany

  • Quote

Post by Earthwings » Tue May 04, 2004 7:15 pm

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: Select all

# 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.
Top
Kuartzer
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 81
Joined: Tue Jul 15, 2003 5:47 pm
Location: in front of the keyboard @ Lx - PT

  • Quote

Post by Kuartzer » Tue May 04, 2004 7:33 pm

I belive that the batery runlevel it´s a full copy of the default one plus the energie savings settings.

Code: Select all

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..."
Top
Earthwings
Bodhisattva
Bodhisattva
User avatar
Posts: 7753
Joined: Mon Apr 14, 2003 8:13 pm
Location: Germany

  • Quote

Post by Earthwings » Sun May 16, 2004 6:02 pm

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.
Top
Earthwings
Bodhisattva
Bodhisattva
User avatar
Posts: 7753
Joined: Mon Apr 14, 2003 8:13 pm
Location: Germany

  • Quote

Post by Earthwings » Sun May 16, 2004 6:03 pm

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 :wink:
Top
codedmart
l33t
l33t
Posts: 647
Joined: Tue Nov 18, 2003 5:27 am
Location: Not Quite Sure

  • Quote

Post by codedmart » Mon May 17, 2004 9:08 pm

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
Top
codedmart
l33t
l33t
Posts: 647
Joined: Tue Nov 18, 2003 5:27 am
Location: Not Quite Sure

  • Quote

Post by codedmart » Tue May 18, 2004 8:22 pm

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.
Top
Earthwings
Bodhisattva
Bodhisattva
User avatar
Posts: 7753
Joined: Mon Apr 14, 2003 8:13 pm
Location: Germany

  • Quote

Post by Earthwings » Tue May 18, 2004 8:52 pm

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.
Top
codedmart
l33t
l33t
Posts: 647
Joined: Tue Nov 18, 2003 5:27 am
Location: Not Quite Sure

  • Quote

Post by codedmart » Tue May 18, 2004 9:23 pm

I have a gentoo system up and running. I was following your how-to and it got to the part where you said to
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.
Top
Post Reply

57 posts
  • 1
  • 2
  • 3
  • Next

Return to “Kernel & Hardware”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic