/[gentoo]/xml/htdocs/doc/en/power-management-guide.xml
Gentoo

Diff of /xml/htdocs/doc/en/power-management-guide.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.19 Revision 1.20
1<?xml version='1.0' encoding="UTF-8"?> 1<?xml version='1.0' encoding="UTF-8"?>
2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v 1.19 2006/07/27 08:13:32 rane Exp $ --> 3<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v 1.20 2006/07/27 08:23:01 rane Exp $ -->
4<guide link="/doc/en/power-management-guide.xml"> 4<guide link="/doc/en/power-management-guide.xml">
5<title>Power Management Guide</title> 5<title>Power Management Guide</title>
6 6
7<author title="Author"> 7<author title="Author">
8 <mail link="earthwings@gentoo.org">Dennis Nienhüser</mail> 8 <mail link="earthwings@gentoo.org">Dennis Nienhüser</mail>
64can be configured seperately. <uri link="#doc_chap3">CPU Power Management</uri> 64can be configured seperately. <uri link="#doc_chap3">CPU Power Management</uri>
65shows how to adjust the processor's frequency to save a maximum of energy 65shows how to adjust the processor's frequency to save a maximum of energy
66whithout losing too much performance. A few different tricks prevent your hard 66whithout losing too much performance. A few different tricks prevent your hard
67drive from working unnecessarily often in <uri link="#doc_chap5">Disk Power 67drive from working unnecessarily often in <uri link="#doc_chap5">Disk Power
68Management</uri> (decreasing noise level as a nice side effect). Some notes on 68Management</uri> (decreasing noise level as a nice side effect). Some notes on
69graphics cards, Wireless LAN and USB finish the device section in 69graphics cards, Wireless LAN and USB finish the device section in <uri
70<uri link="#doc_chap6">Power Management For Other Devices</uri> while another 70link="#doc_chap6">Power Management For Other Devices</uri> while another
71chapter is dedicated to the (rather experimental) <uri link="#doc_chap7">sleep 71chapter is dedicated to the (rather experimental) <uri link="#doc_chap7">sleep
72states</uri>. Last not least <uri link="#doc_chap8">Troubleshooting</uri> 72states</uri>. Last not least <uri link="#doc_chap8">Troubleshooting</uri> lists
73lists common pitfalls. 73common pitfalls.
74</p> 74</p>
75 75
76</body> 76</body>
77</section> 77</section>
78<section> 78<section>
99<section> 99<section>
100<body> 100<body>
101 101
102<p> 102<p>
103Before discussing the details of making individual devices Power Management 103Before discussing the details of making individual devices Power Management
104aware, make sure certain requirements are met. After controlling BIOS 104aware, make sure certain requirements are met. After controlling BIOS settings,
105settings, some kernel options want to be enabled - these are in short ACPI, 105some kernel options want to be enabled - these are in short ACPI, sleep states
106sleep states and CPU frequency scaling. As power saving most of the time comes 106and CPU frequency scaling. As power saving most of the time comes along with
107along with performance loss or increased latency, it should only be enabled 107performance loss or increased latency, it should only be enabled when running
108when running on batteries. That's where a new runlevel <e>battery</e> comes in 108on batteries. That's where a new runlevel <e>battery</e> comes in handy.
109handy.
110</p> 109</p>
111 110
112</body> 111</body>
113</section> 112</section>
114<section> 113<section>
149still work in progress. Using a recent kernel will make sure you'll get the 148still work in progress. Using a recent kernel will make sure you'll get the
150most out of it. 149most out of it.
151</p> 150</p>
152 151
153<p> 152<p>
154There are different kernel sources in Portage. I'd recommend using 153There are different kernel sources in Portage. I'd recommend using
155<c>gentoo-sources</c> or <c>suspend2-sources</c>. The latter contains patches 154<c>gentoo-sources</c> or <c>suspend2-sources</c>. The latter contains patches
156for Software Suspend 2, see the chapter about <uri link="#doc_chap7">sleep 155for Software Suspend 2, see the chapter about <uri link="#doc_chap7">sleep
157states</uri> for more details. When configuring the kernel, activate at least 156states</uri> for more details. When configuring the kernel, activate at least
158these options: 157these options:
159</p> 158</p>
180 &lt; &gt; Toshiba Laptop Extras 179 &lt; &gt; Toshiba Laptop Extras
181 (0) Disable ACPI for systems before Jan 1st this year 180 (0) Disable ACPI for systems before Jan 1st this year
182 [ ] Debug Statements 181 [ ] Debug Statements
183 [*] Power Management Timer Support 182 [*] Power Management Timer Support
184 &lt; &gt; ACPI0004,PNP0A05 and PNP0A06 Container Driver (EXPERIMENTAL) 183 &lt; &gt; ACPI0004,PNP0A05 and PNP0A06 Container Driver (EXPERIMENTAL)
185 184
186 CPU Frequency Scaling ---&gt; 185 CPU Frequency Scaling ---&gt;
187 [*] CPU Frequency scaling 186 [*] CPU Frequency scaling
188 [ ] Enable CPUfreq debugging 187 [ ] Enable CPUfreq debugging
189 &lt; &gt; CPU frequency translation statistics 188 &lt; &gt; CPU frequency translation statistics
190 [ ] CPU frequency translation statistics details 189 [ ] CPU frequency translation statistics details
203(see below). If you own an ASUS, Medion, IBM Thinkpad or Toshiba laptop, enable 202(see below). If you own an ASUS, Medion, IBM Thinkpad or Toshiba laptop, enable
204the appropriate section. 203the appropriate section.
205</p> 204</p>
206 205
207<p> 206<p>
208The kernel has to know how to enable CPU frequency scaling on your processor. As 207The kernel has to know how to enable CPU frequency scaling on your processor.
209each type of CPU has a different interface, you've got to choose the right 208As each type of CPU has a different interface, you've got to choose the right
210driver for your processor. Be careful here - enabling <c>Intel Pentium 4 clock 209driver for your processor. Be careful here - enabling <c>Intel Pentium 4 clock
211modulation</c> on a Pentium M system will lead to strange results for example. 210modulation</c> on a Pentium M system will lead to strange results for example.
212Consult the kernel documentation if you're unsure which one to take. 211Consult the kernel documentation if you're unsure which one to take.
213</p> 212</p>
214 213
215<p> 214<p>
216Compile your kernel, make sure the right modules get loaded at startup and boot 215Compile your kernel, make sure the right modules get loaded at startup and boot
217into your new ACPI-enabled kernel. Next run <c>emerge sys-power/acpid</c> to get 216into your new ACPI-enabled kernel. Next run <c>emerge sys-power/acpid</c> to
218the acpi daemon. This one informs you about events like switching from AC to 217get the acpi daemon. This one informs you about events like switching from AC
219battery or closing the lid. Make sure the modules are loaded if you didn't 218to battery or closing the lid. Make sure the modules are loaded if you didn't
220compile them into the kernel and start acpid by executing 219compile them into the kernel and start acpid by executing <c>/etc/init.d/acpid
221<c>/etc/init.d/acpid start</c>. Run <c>rc-update add acpid default</c> to load 220start</c>. Run <c>rc-update add acpid default</c> to load it on startup. You'll
222it on startup. You'll soon see how to use it. 221soon see how to use it.
223</p> 222</p>
224 223
225<pre caption="Installing acpid"> 224<pre caption="Installing acpid">
226# <i>emerge sys-power/acpid</i> 225# <i>emerge sys-power/acpid</i>
227# <i>/etc/init.d/acpid start</i> 226# <i>/etc/init.d/acpid start</i>
280<pre caption="Installing powermgt-base"> 279<pre caption="Installing powermgt-base">
281# <i>emerge powermgmt-base</i> 280# <i>emerge powermgmt-base</i>
282</pre> 281</pre>
283 282
284<p> 283<p>
285You are now able to determine the power source by executing 284You are now able to determine the power source by executing <c>on_ac_power
286<c>on_ac_power &amp;&amp; echo AC available || echo Running on batteries</c> in 285&amp;&amp; echo AC available || echo Running on batteries</c> in a shell. The
287a shell. The script below is responsible for changing runlevels. Save it as 286script below is responsible for changing runlevels. Save it as
288<path>/etc/acpi/actions/pmg_switch_runlevel.sh</path>. 287<path>/etc/acpi/actions/pmg_switch_runlevel.sh</path>.
289</p> 288</p>
290 289
291<pre caption="/etc/acpi/actions/pmg_switch_runlevel.sh"> 290<pre caption="/etc/acpi/actions/pmg_switch_runlevel.sh">
292#!/bin/bash 291#!/bin/bash
336<pre caption="Determining ACPI events for changing the power source"> 335<pre caption="Determining ACPI events for changing the power source">
337# <i>tail -f /var/log/acpid | grep "received event"</i> 336# <i>tail -f /var/log/acpid | grep "received event"</i>
338</pre> 337</pre>
339 338
340<p> 339<p>
341Run the command above and pull the power cable. You should see something 340Run the command above and pull the power cable. You should see something like
342like this: 341this:
343</p> 342</p>
344 343
345<pre caption="Sample output for power source changes"> 344<pre caption="Sample output for power source changes">
346[Tue Sep 20 17:39:06 2005] received event "ac_adapter AC 00000080 00000000" 345[Tue Sep 20 17:39:06 2005] received event "ac_adapter AC 00000080 00000000"
347[Tue Sep 20 17:39:06 2005] received event "battery BAT0 00000080 00000001" 346[Tue Sep 20 17:39:06 2005] received event "battery BAT0 00000080 00000001"
376# <i>/etc/init.d/acpid restart</i> 375# <i>/etc/init.d/acpid restart</i>
377</pre> 376</pre>
378 377
379<p> 378<p>
380Give it a try: Plug AC in and out and watch syslog for the "Switching to AC 379Give it a try: Plug AC in and out and watch syslog for the "Switching to AC
381mode" or "Switching to battery mode" messages. See the 380mode" or "Switching to battery mode" messages. See the <uri
382<uri link="#doc_chap8">Troubleshooting section</uri> if the script is not 381link="#doc_chap8">Troubleshooting section</uri> if the script is not able to
383able to detect the power source correctly. 382detect the power source correctly.
384</p> 383</p>
385 384
386<p> 385<p>
387Due to the nature of the event mechanism, your laptop will boot into runlevel 386Due to the nature of the event mechanism, your laptop will boot into runlevel
388<c>default</c> regardless of the AC/battery state. This is fine when running 387<c>default</c> regardless of the AC/battery state. This is fine when running
389from AC, but we'd like to boot into the battery runlevel otherwise. One 388from AC, but we'd like to boot into the battery runlevel otherwise. One
390solution would be to add another entry to the boot loader with the parameter 389solution would be to add another entry to the boot loader with the parameter
391<c>softlevel=battery</c>, but it's likely to forget choosing it. A better way 390<c>softlevel=battery</c>, but it's likely to forget choosing it. A better way
392is faking an ACPI event in the end of the boot process and letting 391is faking an ACPI event in the end of the boot process and letting
393<path>pmg_switch_runlevel.sh</path> script decide whether a 392<path>pmg_switch_runlevel.sh</path> script decide whether a runlevel change is
394runlevel change is necessary. Open <path>/etc/conf.d/local.start</path> in your 393necessary. Open <path>/etc/conf.d/local.start</path> in your favourite editor
395favourite editor and add these lines: 394and add these lines:
396</p> 395</p>
397 396
398<pre caption="Runlevel adjustment at boot time by editing local.start"> 397<pre caption="Runlevel adjustment at boot time by editing local.start">
399<comment># Fake acpi event to switch runlevel if running on batteries</comment> 398<comment># Fake acpi event to switch runlevel if running on batteries</comment>
400/etc/acpi/actions/pmg_switch_runlevel.sh "battery/battery" 399/etc/acpi/actions/pmg_switch_runlevel.sh "battery/battery"
401</pre> 400</pre>
402 401
403<p> 402<p>
404Prepared like this you can activate Power Management policies for individual 403Prepared like this you can activate Power Management policies for individual
405devices. 404devices.
406</p> 405</p>
407 406
408</body> 407</body>
409</section> 408</section>
421decrease. 420decrease.
422</p> 421</p>
423 422
424</body> 423</body>
425</section> 424</section>
426
427<section> 425<section>
428<title>Some Technical Terms</title> 426<title>Some Technical Terms</title>
429<body> 427<body>
430 428
431<p> 429<p>
434</p> 432</p>
435 433
436<p> 434<p>
437First of all, the kernel has to be able to change the processor's frequency. 435First of all, the kernel has to be able to change the processor's frequency.
438The <b>CPUfreq processor driver</b> knows the commands to do it on your CPU. 436The <b>CPUfreq processor driver</b> knows the commands to do it on your CPU.
439Thus it's important to choose the right one in your kernel. You should 437Thus it's important to choose the right one in your kernel. You should already
440already have done it above. Once the kernel knows how to change frequencies, 438have done it above. Once the kernel knows how to change frequencies, it has to
441it has to know which frequency it should set. This is done according to the 439know which frequency it should set. This is done according to the <b>policy</b>
442<b>policy</b> which consists of a <b>CPUfreq policy</b> and a 440which consists of a <b>CPUfreq policy</b> and a <b>governor</b>. A CPUfreq
443<b>governor</b>. A CPUfreq policy are just two numbers which define a range 441policy are just two numbers which define a range the frequency has to stay
444the frequency has to stay between - minimal and maximal frequency. The 442between - minimal and maximal frequency. The governor now decides which of the
445governor now decides which of the available frequencies in between minimal 443available frequencies in between minimal and maximal frequency to choose. For
446and maximal frequency to choose. For example, the <b>powersave governor</b> 444example, the <b>powersave governor</b> always chooses the lowest frequency
447always chooses the lowest frequency available, the <b>performance 445available, the <b>performance governor</b> the highest one. The <b>userspace
448governor</b> the highest one. The <b>userspace governor</b> makes no decision 446governor</b> makes no decision but chooses whatever the user (or a program in
449but chooses whatever the user (or a program in userspace) wants - which means 447userspace) wants - which means it reads the frequency from
450it reads the frequency from
451<path>/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed</path>. 448<path>/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed</path>.
452</p> 449</p>
453 450
454<p> 451<p>
455This doesn't sound like dynamic frequency changes yet and in fact it isn't. 452This doesn't sound like dynamic frequency changes yet and in fact it isn't.
456Dynamics however can be accomplished with various approaches. For example, 453Dynamics however can be accomplished with various approaches. For example, the
457the <b>ondemand governor</b> makes its decisions depending on the current CPU 454<b>ondemand governor</b> makes its decisions depending on the current CPU load.
458load. The same is done by various userland tools like <c>cpudyn</c>, 455The same is done by various userland tools like <c>cpudyn</c>, <c>cpufreqd</c>,
459<c>cpufreqd</c>, <c>powernowd</c> and many more. ACPI events can be used to 456<c>powernowd</c> and many more. ACPI events can be used to enable or disable
460enable or disable dynamic frequency changes depending on power source. 457dynamic frequency changes depending on power source.
461</p> 458</p>
462 459
463</body> 460</body>
464</section> 461</section>
465<section> 462<section>
511 508
512<p> 509<p>
513Now play around with <c>cpufreq-set</c> to make sure frequency switching works. 510Now play around with <c>cpufreq-set</c> to make sure frequency switching works.
514Run <c>cpufreq-set -g ondemand</c> for example to activate the ondemand 511Run <c>cpufreq-set -g ondemand</c> for example to activate the ondemand
515governor and verify the change with <c>cpufreq-info</c>. If it doesn't work as 512governor and verify the change with <c>cpufreq-info</c>. If it doesn't work as
516expected, you might find help in the <uri link="#doc_chap8">Troubleshooting section</uri> 513expected, you might find help in the <uri link="#doc_chap8">Troubleshooting
517in the end of this guide. 514section</uri> in the end of this guide.
518</p> 515</p>
519 516
520</body> 517</body>
521</section> 518</section>
522<section> 519<section>
525 522
526<p> 523<p>
527The above is quite nice, but not doable in daily life. Better let your system 524The above is quite nice, but not doable in daily life. Better let your system
528set the appropriate frequency automatically. There are many different 525set the appropriate frequency automatically. There are many different
529approaches to do this. The following table gives a quick overview to help you 526approaches to do this. The following table gives a quick overview to help you
530decide on one of them. It's roughly seperated in three categories 527decide on one of them. It's roughly seperated in three categories <b>kernel</b>
531<b>kernel</b> for approaches that only need kernel support, <b>daemon</b> for 528for approaches that only need kernel support, <b>daemon</b> for programs that
532programs that run in the background and <b>graphical</b> for programs that 529run in the background and <b>graphical</b> for programs that provide a GUI for
533provide a GUI for easy configuration and changes. 530easy configuration and changes.
534</p> 531</p>
535 532
536<table> 533<table>
537<tr> 534<tr>
538 <th>Name</th> 535 <th>Name</th>
607 Supports SMP. 604 Supports SMP.
608 </ti> 605 </ti>
609</tr> 606</tr>
610<tr> 607<tr>
611 <ti> 608 <ti>
609 <uri
612 <uri link="http://fatcat.ftj.agh.edu.pl/~nelchael/index.php?cat=projs&amp;subcat=ncpufreqd&amp;language=en">ncpufreqd</uri> 610 link="http://fatcat.ftj.agh.edu.pl/~nelchael/index.php?cat=projs&amp;subcat=ncpufreqd&amp;language=en">ncpufreqd</uri>
613 </ti> 611 </ti>
614 <ti>Daemon</ti> 612 <ti>Daemon</ti>
615 <ti>Temperature</ti> 613 <ti>Temperature</ti>
616 <ti>None</ti> 614 <ti>None</ti>
617 <ti>Powersave, performance</ti> 615 <ti>Powersave, performance</ti>
657 655
658<p> 656<p>
659While adjusting the frequency to the current load looks simple at a first 657While adjusting the frequency to the current load looks simple at a first
660glance, it's not such a trivial task. A bad algorithm can cause switching 658glance, it's not such a trivial task. A bad algorithm can cause switching
661between two frequencies all the time or wasting energy when setting frequency 659between two frequencies all the time or wasting energy when setting frequency
662to an unnecessary high level. 660to an unnecessary high level.
663</p> 661</p>
664 662
665<p> 663<p>
666Which one to choose? If you have no idea about it, try <c>cpufreqd</c>: 664Which one to choose? If you have no idea about it, try <c>cpufreqd</c>:
667</p> 665</p>
747</pre> 745</pre>
748 746
749<p> 747<p>
750Sometimes it can be desirable to select another policy than the daemon chooses, 748Sometimes it can be desirable to select another policy than the daemon chooses,
751for example when battery power is low, but you know that AC will be available 749for example when battery power is low, but you know that AC will be available
752soon. In that case you can turn on cpufreqd's manual mode with 750soon. In that case you can turn on cpufreqd's manual mode with <c>cpufreqd-set
753<c>cpufreqd-set manual</c> and select one of your configured policies (as 751manual</c> and select one of your configured policies (as listed by
754listed by <c>cpufreqd-get</c>). You can leave manual mode by executing 752<c>cpufreqd-get</c>). You can leave manual mode by executing <c>cpufreqd-set
755<c>cpufreqd-set dynamic</c>. 753dynamic</c>.
756</p> 754</p>
757 755
758<warn> 756<warn>
759Do not run more than one of the above programs at the same time. It may cause 757Do not run more than one of the above programs at the same time. It may cause
760confusion like switching between two frequencies all the time. 758confusion like switching between two frequencies all the time.
774<pre caption="Monitoring CPU speed"> 772<pre caption="Monitoring CPU speed">
775# <i>watch grep \"cpu MHz\" /proc/cpuinfo</i> 773# <i>watch grep \"cpu MHz\" /proc/cpuinfo</i>
776</pre> 774</pre>
777 775
778<p> 776<p>
779If <path>/proc/cpuinfo</path> doesn't get updated (see 777If <path>/proc/cpuinfo</path> doesn't get updated (see <uri
780<uri link="#doc_chap8">Troubleshooting</uri>), monitor the CPU frequency with: 778link="#doc_chap8">Troubleshooting</uri>), monitor the CPU frequency with:
781</p> 779</p>
782 780
783<pre caption="Alternative CPU speed monitoring"> 781<pre caption="Alternative CPU speed monitoring">
784# <i>watch x86info -mhz</i> 782# <i>watch x86info -mhz</i>
785</pre> 783</pre>
786 784
787<p> 785<p>
788Depending on your setup, CPU speed should increase on heavy load, decrease on 786Depending on your setup, CPU speed should increase on heavy load, decrease on
789no activity or just stay at the same level. When using <c>cpufreqd</c> and 787no activity or just stay at the same level. When using <c>cpufreqd</c> and
790verbosity set to 5 or higher in <path>cpufreqd.conf</path> you'll get additional 788verbosity set to 5 or higher in <path>cpufreqd.conf</path> you'll get
791information about what's happening reported to <c>syslog</c>. 789additional information about what's happening reported to <c>syslog</c>.
792</p> 790</p>
793 791
794</body> 792</body>
795</section> 793</section>
796</chapter> 794</chapter>
799<title>LCD Power Management</title> 797<title>LCD Power Management</title>
800<section> 798<section>
801<body> 799<body>
802 800
803<p> 801<p>
804As you can see in <uri link="#doc_chap1_fig1">figure 1.1</uri>, the LCD display 802As you can see in <uri link="#doc_chap1_fig1">figure 1.1</uri>, the LCD
805consumes the biggest part of energy (might not be the case for non-mobile 803display consumes the biggest part of energy (might not be the case for
806CPU's). Thus it's quite important not only to shut the display off when not 804non-mobile CPU's). Thus it's quite important not only to shut the display off
807needed, but also to reduce it's backlight if possible. Most laptops offer the 805when not needed, but also to reduce it's backlight if possible. Most laptops
808possibility to control the backlight dimming. 806offer the possibility to control the backlight dimming.
809</p> 807</p>
810 808
811</body> 809</body>
812</section> 810</section>
813<section> 811<section>
815<body> 813<body>
816 814
817<p> 815<p>
818The first thing to check is the standby/suspend/off timings of the display. As 816The first thing to check is the standby/suspend/off timings of the display. As
819this depends heavily on your windowmanager, I'll let you figure it out 817this depends heavily on your windowmanager, I'll let you figure it out
820yourself. Just two common places: Blanking the terminal can be done with 818yourself. Just two common places: Blanking the terminal can be done with
821<c>setterm -blank &lt;number-of-minutesM&gt;</c>, <c>setterm -powersave on</c> 819<c>setterm -blank &lt;number-of-minutesM&gt;</c>, <c>setterm -powersave on</c>
822and <c>setterm -powerdown &lt;number-of-minutesM&gt;</c>. For X.org, modify 820and <c>setterm -powerdown &lt;number-of-minutesM&gt;</c>. For X.org, modify
823<path>/etc/X11/xorg.conf</path> similar to this: 821<path>/etc/X11/xorg.conf</path> similar to this:
824</p> 822</p>
825 823
856<p> 854<p>
857Probably more important is the backlight dimming. If you have access to the 855Probably more important is the backlight dimming. If you have access to the
858dimming settings via a tool, write a small script that dims the backlight in 856dimming settings via a tool, write a small script that dims the backlight in
859battery mode and place it in your <c>battery</c> runlevel. The following script 857battery mode and place it in your <c>battery</c> runlevel. The following script
860should work on most IBM Thinkpads and Toshiba laptops. You've got to enable the 858should work on most IBM Thinkpads and Toshiba laptops. You've got to enable the
861appropriate option in your kernel (IBM Thinkpads only). For Toshiba laptops, install 859appropriate option in your kernel (IBM Thinkpads only). For Toshiba laptops,
862<c>app-laptop/acpitool</c> and skip configuration of <c>ibm_acpi</c> as described below. 860install <c>app-laptop/acpitool</c> and skip configuration of <c>ibm_acpi</c> as
861described below.
863</p> 862</p>
864 863
865<warn> 864<warn>
866Support for setting brightness is marked experimental in ibm-acpi. It accesses 865Support for setting brightness is marked experimental in ibm-acpi. It accesses
867hardware directly and may cause severe harm to your system. Please read the 866hardware directly and may cause severe harm to your system. Please read the
882</pre> 881</pre>
883 882
884<p> 883<p>
885This should work without error messages and a file 884This should work without error messages and a file
886<path>/proc/acpi/ibm/brightness</path> should be created after loading the 885<path>/proc/acpi/ibm/brightness</path> should be created after loading the
887module. An init script will take care of choosing the brightness according 886module. An init script will take care of choosing the brightness according to
888to the power source. 887the power source.
889</p> 888</p>
890 889
891<pre caption="/etc/conf.d/lcd-brightness"> 890<pre caption="/etc/conf.d/lcd-brightness">
892<comment># See /proc/acpi/ibm/brightness for available values</comment> 891<comment># See /proc/acpi/ibm/brightness for available values</comment>
893<comment># Please read /usr/src/linux/Documentation/ibm-acpi.txt</comment> 892<comment># Please read /usr/src/linux/Documentation/ibm-acpi.txt</comment>
1028</pre> 1027</pre>
1029 1028
1030<p> 1029<p>
1031To disable atd as suggested in the example above, you would run <c>rc-update 1030To disable atd as suggested in the example above, you would run <c>rc-update
1032del atd battery</c>. Be careful not to disable services that are needed for 1031del atd battery</c>. Be careful not to disable services that are needed for
1033your system to run properly - <c>lm-profiler</c> is likely to generate some false 1032your system to run properly - <c>lm-profiler</c> is likely to generate some
1034positives. Do not disable a service if you are unsure whether it's needed. 1033false positives. Do not disable a service if you are unsure whether it's
1034needed.
1035</p> 1035</p>
1036 1036
1037</body> 1037</body>
1038</section> 1038</section>
1039<section> 1039<section>
1043<p> 1043<p>
1044If you don't want to use laptop-mode, you must take special care to disable 1044If you don't want to use laptop-mode, you must take special care to disable
1045services that write to your disk frequently - <c>syslogd</c> is a good 1045services that write to your disk frequently - <c>syslogd</c> is a good
1046candidate, for example. You probably don't want to shut it down completely, but 1046candidate, for example. You probably don't want to shut it down completely, but
1047it's possible to modify the config file so that "unnecessary" things don't get 1047it's possible to modify the config file so that "unnecessary" things don't get
1048logged and thus don't create disk traffic. <c>Cups</c> writes to disk periodically, 1048logged and thus don't create disk traffic. <c>Cups</c> writes to disk
1049so consider shutting it down and only enable it manually when needed. 1049periodically, so consider shutting it down and only enable it manually when
1050needed.
1050</p> 1051</p>
1051 1052
1052<pre caption="Disabling cups in battery mode"> 1053<pre caption="Disabling cups in battery mode">
1053# <i>rc-update del cupsd battery</i> 1054# <i>rc-update del cupsd battery</i>
1054</pre> 1055</pre>
1064<section> 1065<section>
1065<title>hdparm</title> 1066<title>hdparm</title>
1066<body> 1067<body>
1067 1068
1068<p> 1069<p>
1069The second possibility is using a small script and <c>hdparm</c>. Skip this if you 1070The second possibility is using a small script and <c>hdparm</c>. Skip this if
1070are using laptop-mode. Otherwise, create <path>/etc/init.d/pmg_hda</path>: 1071you are using laptop-mode. Otherwise, create <path>/etc/init.d/pmg_hda</path>:
1071</p> 1072</p>
1072 1073
1073<pre caption="Using hdparm for disk standby"> 1074<pre caption="Using hdparm for disk standby">
1074#!/sbin/runscript 1075#!/sbin/runscript
1075 1076
1153<body> 1154<body>
1154 1155
1155<p> 1156<p>
1156In case you own an ATI graphics card supporting PowerPlay (dynamic clock 1157In case you own an ATI graphics card supporting PowerPlay (dynamic clock
1157scaling for the the graphics processing unit GPU), you can activate this 1158scaling for the the graphics processing unit GPU), you can activate this
1158feature in X.org. Open <path>/etc/X11/xorg.conf</path> and add (or enable) 1159feature in X.org. Open <path>/etc/X11/xorg.conf</path> and add (or enable) the
1159the <c>DynamicClocks</c> option in the Device section. Please notice that 1160<c>DynamicClocks</c> option in the Device section. Please notice that this
1160this feature will lead to crashes on some systems. 1161feature will lead to crashes on some systems.
1161</p> 1162</p>
1162 1163
1163<pre caption="Enabling ATI PowerPlay support in X.org"> 1164<pre caption="Enabling ATI PowerPlay support in X.org">
1164Section "Device" 1165Section "Device"
1165[...] 1166[...]
1223There are two problems with USB devices regarding energy consumption: First, 1224There are two problems with USB devices regarding energy consumption: First,
1224devices like USB mice, digital cameras or USB sticks consume energy while 1225devices like USB mice, digital cameras or USB sticks consume energy while
1225plugged in. You cannot avoid this (nevertheless remove them in case they're not 1226plugged in. You cannot avoid this (nevertheless remove them in case they're not
1226needed). Second, when there are USB devices plugged in, the USB host controller 1227needed). Second, when there are USB devices plugged in, the USB host controller
1227periodically accesses the bus which in turn prevents the CPU from going into 1228periodically accesses the bus which in turn prevents the CPU from going into
1228sleep mode. The kernel offers an experimental option to enable suspension of 1229sleep mode. The kernel offers an experimental option to enable suspension of
1229USB devices through driver calls or one of the <path>power/state</path> files 1230USB devices through driver calls or one of the <path>power/state</path> files
1230in <path>/sys</path>. 1231in <path>/sys</path>.
1231</p> 1232</p>
1232 1233
1233<pre caption="Enabling USB suspend support in the kernel"> 1234<pre caption="Enabling USB suspend support in the kernel">
1248 1249
1249<p> 1250<p>
1250ACPI defines different sleep states. The more important ones are 1251ACPI defines different sleep states. The more important ones are
1251</p> 1252</p>
1252 1253
1253<ul> 1254<ul>
1254 <li>S1 aka Standby</li> 1255 <li>S1 aka Standby</li>
1255 <li>S3 aka Suspend to RAM aka Sleep</li> 1256 <li>S3 aka Suspend to RAM aka Sleep</li>
1256 <li>S4 aka Suspend to Disk aka Hibernate</li> 1257 <li>S4 aka Suspend to Disk aka Hibernate</li>
1257</ul> 1258</ul>
1258 1259
1315<pre caption="Calling sleep"> 1316<pre caption="Calling sleep">
1316# <i>hibernate-ram</i> 1317# <i>hibernate-ram</i>
1317</pre> 1318</pre>
1318 1319
1319<p> 1320<p>
1320If you're still reading, it seems to work. You can also setup standby (S1) in 1321If you're still reading, it seems to work. You can also setup standby (S1) in a
1321a similar way by copying <path>ram.conf</path> to <path>standby.conf</path> 1322similar way by copying <path>ram.conf</path> to <path>standby.conf</path> and
1322and creating a symlink <path>/usr/sbin/hibernate-standby</path> pointing to 1323creating a symlink <path>/usr/sbin/hibernate-standby</path> pointing to
1323<path>/usr/sbin/hibernate</path>. S3 and S4 are the more interesting sleep 1324<path>/usr/sbin/hibernate</path>. S3 and S4 are the more interesting sleep
1324states due to greater energy savings however. 1325states due to greater energy savings however.
1325</p> 1326</p>
1326 1327
1327</body> 1328</body>
1342Shutdown any NFS or samba server/client before hibernating. 1343Shutdown any NFS or samba server/client before hibernating.
1343</warn> 1344</warn>
1344 1345
1345<p> 1346<p>
1346There are two different implementations for S4. The original one is swsusp, 1347There are two different implementations for S4. The original one is swsusp,
1347then there is the newer suspend2 with a nicer interface (including 1348then there is the newer suspend2 with a nicer interface (including fbsplash
1348fbsplash support). A <uri link="http://suspend2.net/features.html#compare"> 1349support). A <uri link="http://suspend2.net/features.html#compare"> feature
1349feature comparison</uri> is available at the <uri link="http://suspend2.net"> 1350comparison</uri> is available at the <uri link="http://suspend2.net"> suspend2
1350suspend2 Homepage</uri>. There used to be Suspend-to-Disk (pmdisk), a fork of 1351Homepage</uri>. There used to be Suspend-to-Disk (pmdisk), a fork of swsusp,
1351swsusp, but it has been merged back. 1352but it has been merged back.
1352</p> 1353</p>
1353 1354
1354<p> 1355<p>
1355Suspend2 is not included in the mainline kernel yet, therefore you either have 1356Suspend2 is not included in the mainline kernel yet, therefore you either have
1356to patch your kernel sources with the patches provided by 1357to patch your kernel sources with the patches provided by <uri
1357<uri link="http://suspend2.net">suspend2.net</uri> or use 1358link="http://suspend2.net">suspend2.net</uri> or use
1358<c>sys-kernel/suspend2-sources</c>. 1359<c>sys-kernel/suspend2-sources</c>.
1359</p> 1360</p>
1360 1361
1361<p> 1362<p>
1362The kernel part for both swusp and suspend2 is as follows: 1363The kernel part for both swusp and suspend2 is as follows:
1366Power Management Options ---&gt; 1367Power Management Options ---&gt;
1367 <comment>(hibernate with swsusp)</comment> 1368 <comment>(hibernate with swsusp)</comment>
1368 [*] Software Suspend 1369 [*] Software Suspend
1369 <comment>(replace /dev/SWAP with your swap partition)</comment> 1370 <comment>(replace /dev/SWAP with your swap partition)</comment>
1370 (/dev/SWAP) Default resume partition 1371 (/dev/SWAP) Default resume partition
1371 1372
1372 <comment>(hibernate with suspend2)</comment> 1373 <comment>(hibernate with suspend2)</comment>
1373 Software Suspend 2 1374 Software Suspend 2
1374 --- Image Storage (you need at least one writer) 1375 --- Image Storage (you need at least one writer)
1375 [*] File Writer 1376 [*] File Writer
1376 [*] Swap Writer 1377 [*] Swap Writer
1384<p> 1385<p>
1385The configuration for swsusp is rather easy. If you didn't store the location 1386The configuration for swsusp is rather easy. If you didn't store the location
1386of your swap partition in the kernel config, you can also pass it as a 1387of your swap partition in the kernel config, you can also pass it as a
1387parameter with the <c>resume=/dev/SWAP</c> directive. If booting is not 1388parameter with the <c>resume=/dev/SWAP</c> directive. If booting is not
1388possible due to a broken image, use the <c>noresume</c> kernel parameter. The 1389possible due to a broken image, use the <c>noresume</c> kernel parameter. The
1389<c>hibernate-cleanup</c> init script invalidates swsusp images during the 1390<c>hibernate-cleanup</c> init script invalidates swsusp images during the boot
1390boot process. 1391process.
1391</p> 1392</p>
1392 1393
1393<pre caption="Invalidating swsusp images during the boot process"> 1394<pre caption="Invalidating swsusp images during the boot process">
1394# <i>rc-update add hibernate-cleanup boot</i> 1395# <i>rc-update add hibernate-cleanup boot</i>
1395</pre> 1396</pre>
1402<warn> 1403<warn>
1403Backup your data before doing this. Run <c>sync</c> before executing one of the 1404Backup your data before doing this. Run <c>sync</c> before executing one of the
1404commands to have cached data written to disk. First try it outside of X, then 1405commands to have cached data written to disk. First try it outside of X, then
1405with X running, but not logged in. 1406with X running, but not logged in.
1406</warn> 1407</warn>
1407 1408
1408<p> 1409<p>
1409If you experience kernel panics due to uhci or similar, try to compile USB 1410If you experience kernel panics due to uhci or similar, try to compile USB
1410support as module and unload the modules before sending your laptop to sleep 1411support as module and unload the modules before sending your laptop to sleep
1411mode. There are configuration options for this in <path>hibernate.conf</path> 1412mode. There are configuration options for this in <path>hibernate.conf</path>
1412</p> 1413</p>
1421The following section discusses the setup of suspend2 including fbsplash 1422The following section discusses the setup of suspend2 including fbsplash
1422support for a nice graphical progress bar during suspend and resume. 1423support for a nice graphical progress bar during suspend and resume.
1423</p> 1424</p>
1424 1425
1425<p> 1426<p>
1426The first part of the configuration is similar to the configuration of 1427The first part of the configuration is similar to the configuration of swsusp.
1427swsusp. In case you didn't store the location of your swap partition in the 1428In case you didn't store the location of your swap partition in the kernel
1428kernel config, you have to pass it as a kernel parameter with the 1429config, you have to pass it as a kernel parameter with the
1429<c>resume2=swap:/dev/SWAP</c> directive. If booting is not possible due to a 1430<c>resume2=swap:/dev/SWAP</c> directive. If booting is not possible due to a
1430broken image, append the <c>noresume2</c> parameter. Additionally, the 1431broken image, append the <c>noresume2</c> parameter. Additionally, the
1431<c>hibernate-cleanup</c> init script invalidates suspend2 images during the 1432<c>hibernate-cleanup</c> init script invalidates suspend2 images during the
1432boot process. 1433boot process.
1433</p> 1434</p>
1434 1435
1435<pre caption="Invalidating suspend2 images during the boot process"> 1436<pre caption="Invalidating suspend2 images during the boot process">
1436# <i>rc-update add hibernate-cleanup boot</i> 1437# <i>rc-update add hibernate-cleanup boot</i>
1437</pre> 1438</pre>
1438 1439
1440<p>
1439<p>Now edit <path>/etc/hibernate/hibernate.conf</path>, enable the 1441Now edit <path>/etc/hibernate/hibernate.conf</path>, enable the <c>suspend2</c>
1440<c>suspend2</c> section and comment everything in the <c>sysfs_power_state</c> 1442section and comment everything in the <c>sysfs_power_state</c> and
1441and <c>acpi_sleep</c> sections. Do not enable the <c>fbsplash</c> part in global 1443<c>acpi_sleep</c> sections. Do not enable the <c>fbsplash</c> part in global
1442options yet. 1444options yet.
1443</p> 1445</p>
1444 1446
1445<pre caption="Hibernating with suspend2"> 1447<pre caption="Hibernating with suspend2">
1446# <i>nano -w /etc/hibernate.conf</i> 1448# <i>nano -w /etc/hibernate.conf</i>
1447<comment>(Make sure you have a backup of your data)</comment> 1449<comment>(Make sure you have a backup of your data)</comment>
1448# <i>hibernate</i> 1450# <i>hibernate</i>
1449</pre> 1451</pre>
1450 1452
1451<p> 1453<p>
1452Please configure <c>fbsplash</c> now if you didn't do already. To enable fbsplash 1454Please configure <c>fbsplash</c> now if you didn't do already. To enable
1453support during hibernation, the <c>sys-apps/suspend2-userui</c> package is 1455fbsplash support during hibernation, the <c>sys-apps/suspend2-userui</c>
1454needed. Additionally, you've got to enable the <c>fbsplash</c> USE flag. 1456package is needed. Additionally, you've got to enable the <c>fbsplash</c> USE
1457flag.
1455</p> 1458</p>
1456 1459
1457<pre caption="Installing suspend2-userui"> 1460<pre caption="Installing suspend2-userui">
1458# <i>mkdir -p /etc/portage</i> 1461# <i>mkdir -p /etc/portage</i>
1459# <i>echo "sys-apps/suspend2-userui fbsplash" >> /etc/portage/package.use</i> 1462# <i>echo "sys-apps/suspend2-userui fbsplash" >> /etc/portage/package.use</i>
1471 1474
1472<p> 1475<p>
1473If you don't want a black screen in the first part of the resume process, you 1476If you don't want a black screen in the first part of the resume process, you
1474have to add the <c>suspend2ui_fbsplash</c> tool to your initrd image. Assuming 1477have to add the <c>suspend2ui_fbsplash</c> tool to your initrd image. Assuming
1475you created the initrd image with <c>splash_geninitramfs</c> and saved it as 1478you created the initrd image with <c>splash_geninitramfs</c> and saved it as
1476<path>/boot/fbsplash-emergence-1024x768</path>, here's how to do 1479<path>/boot/fbsplash-emergence-1024x768</path>, here's how to do that.
1477that.
1478</p> 1480</p>
1479 1481
1480<pre caption="Adding suspend2ui_fbsplash to an initrd image"> 1482<pre caption="Adding suspend2ui_fbsplash to an initrd image">
1481# <i>mount /boot</i> 1483# <i>mount /boot</i>
1482# <i>mkdir ~/initrd.d</i> 1484# <i>mkdir ~/initrd.d</i>
1487# <i>cp /usr/sbin/suspend2ui_fbsplash sbin/</i> 1489# <i>cp /usr/sbin/suspend2ui_fbsplash sbin/</i>
1488# <i>find . | cpio --quiet --dereference -o -H newc | gzip -9 > /boot/fbsplash-suspend2-emergence-1024x768</i> 1490# <i>find . | cpio --quiet --dereference -o -H newc | gzip -9 > /boot/fbsplash-suspend2-emergence-1024x768</i>
1489</pre> 1491</pre>
1490 1492
1491<p> 1493<p>
1492Afterwards adjust <path>grub.conf</path> respectively <path>lilo.conf</path> 1494Afterwards adjust <path>grub.conf</path> respectively <path>lilo.conf</path> so
1493so that your suspend2 kernel uses 1495that your suspend2 kernel uses
1494<path>/boot/fbsplash-suspend2-emergence-1024x768</path> as initrd image. You 1496<path>/boot/fbsplash-suspend2-emergence-1024x768</path> as initrd image. You
1495can now test a dry run to see if everything is setup correctly. 1497can now test a dry run to see if everything is setup correctly.
1496</p> 1498</p>
1497 1499
1498<pre caption="Test run for fbsplash hibernation"> 1500<pre caption="Test run for fbsplash hibernation">
1550</p> 1552</p>
1551 1553
1552<p> 1554<p>
1553<e>A:</e> Probably you have activated symmetric multiprocessing support 1555<e>A:</e> Probably you have activated symmetric multiprocessing support
1554(CONFIG_SMP) in your kernel. Deactivate it and it should work. Some older 1556(CONFIG_SMP) in your kernel. Deactivate it and it should work. Some older
1555kernels had a bug causing this. In that case, run <c>emerge x86info</c>, 1557kernels had a bug causing this. In that case, run <c>emerge x86info</c>, update
1556update your kernel as asked and check the current frequency with 1558your kernel as asked and check the current frequency with
1557<c>x86info -mhz</c>. 1559<c>x86info -mhz</c>.
1558</p> 1560</p>
1559 1561
1560<p> 1562<p>
1561<e>Q:</e> I can change the CPU frequency, but the range is not as wide as in 1563<e>Q:</e> I can change the CPU frequency, but the range is not as wide as in
1600<e>A:</e> Check that battery support is compiled into your kernel. If you use 1602<e>A:</e> Check that battery support is compiled into your kernel. If you use
1601it as a module, make sure the module is loaded. 1603it as a module, make sure the module is loaded.
1602</p> 1604</p>
1603 1605
1604<p> 1606<p>
1605<e>Q:</e> My system logger reports things like "logger: ACPI group battery / action 1607<e>Q:</e> My system logger reports things like "logger: ACPI group battery /
1606battery is not defined". 1608action battery is not defined".
1607</p>
1608
1609<p> 1609</p>
1610
1611<p>
1610<e>A:</e> This message is generated by the <path>/etc/acpi/default.sh</path> script 1612<e>A:</e> This message is generated by the <path>/etc/acpi/default.sh</path>
1611that is shipped with acpid. You can safely ignore it. If you like to get rid of it, 1613script that is shipped with acpid. You can safely ignore it. If you like to get
1612you can comment the appropriate line in <path>/etc/acpi/default.sh</path> as shown 1614rid of it, you can comment the appropriate line in
1613below: 1615<path>/etc/acpi/default.sh</path> as shown below:
1614</p> 1616</p>
1615 1617
1616<pre caption="Disabling warnings about unknown acpi events"> 1618<pre caption="Disabling warnings about unknown acpi events">
1617 *) # logger "ACPI action $action is not defined" 1619 *) # logger "ACPI action $action is not defined"
1618</pre> 1620</pre>
1625<e>A:</e> This seems to be a kernel bug. Read on <uri 1627<e>A:</e> This seems to be a kernel bug. Read on <uri
1626link="http://bugme.osdl.org/show_bug.cgi?id=1752">here</uri>. 1628link="http://bugme.osdl.org/show_bug.cgi?id=1752">here</uri>.
1627</p> 1629</p>
1628 1630
1629<p> 1631<p>
1630<e>Q:</e> I activated the <c>DynamicClocks</c> option in <path>xorg.conf</path> and 1632<e>Q:</e> I activated the <c>DynamicClocks</c> option in <path>xorg.conf</path>
1631now X.org crashes / the screen stays black / my laptop doesn't shutdown 1633and now X.org crashes / the screen stays black / my laptop doesn't shutdown
1632properly. 1634properly.
1633</p> 1635</p>
1634 1636
1635<p> 1637<p>
1636<e>A:</e> This happens on some systems. You have to disable <c>DynamicClocks</c>. 1638<e>A:</e> This happens on some systems. You have to disable
1639<c>DynamicClocks</c>.
1637</p> 1640</p>
1638 1641
1639<p> 1642<p>
1640<e>Q:</e> I want to use suspend2, but it tells me my swap partition is too 1643<e>Q:</e> I want to use suspend2, but it tells me my swap partition is too
1641small. Resizing is not an option. 1644small. Resizing is not an option.
1642</p> 1645</p>
1643 1646
1644<p> 1647<p>
1645<e>A:</e> If there is enough free space on your system, you can use the 1648<e>A:</e> If there is enough free space on your system, you can use the
1646filewriter instead of the swapwriter. The <c>hibernate-script</c> supports it 1649filewriter instead of the swapwriter. The <c>hibernate-script</c> supports it
1647as well. More information can be found in 1650as well. More information can be found in
1648<path>/usr/src/linux/Documentation/power/suspend2.txt</path>. 1651<path>/usr/src/linux/Documentation/power/suspend2.txt</path>.
1649</p> 1652</p>
1650 1653
1653minutes! What am I doing wrong? 1656minutes! What am I doing wrong?
1654</p> 1657</p>
1655 1658
1656<p> 1659<p>
1657<e>A:</e> First follow your manufacturer's advice on how to charge the battery 1660<e>A:</e> First follow your manufacturer's advice on how to charge the battery
1658correctly. 1661correctly.
1659</p> 1662</p>
1660 1663
1661<p> 1664<p>
1662<e>Q:</e> The above didn't help. What should I do then? 1665<e>Q:</e> The above didn't help. What should I do then?
1663</p> 1666</p>
1681<e>Q:</e> My problem is not listed above. Where should I go next? 1684<e>Q:</e> My problem is not listed above. Where should I go next?
1682</p> 1685</p>
1683 1686
1684<p> 1687<p>
1685<e>A:</e> Don't fear to contact me, <mail link="earthwings@gentoo.org">Dennis 1688<e>A:</e> Don't fear to contact me, <mail link="earthwings@gentoo.org">Dennis
1686Nienhüser</mail>, directly. The 1689Nienhüser</mail>, directly. The <uri link="http://forums.gentoo.org">Gentoo
1687<uri link="http://forums.gentoo.org">Gentoo Forums</uri> are a good place to 1690Forums</uri> are a good place to get help as well. If you prefer IRC, try the
1688get help as well. If you prefer IRC, try the <c>#gentoo-laptop</c> channel at 1691<c>#gentoo-laptop</c> channel at <uri
1689<uri link="irc://irc.freenode.net">irc.freenode.net</uri>. 1692link="irc://irc.freenode.net">irc.freenode.net</uri>.
1690</p> 1693</p>
1691 1694
1692</body> 1695</body>
1693</section> 1696</section>
1694</chapter> 1697</chapter>

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

  ViewVC Help
Powered by ViewVC 1.1.20