/[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.16 Revision 1.17
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.16 2006/01/01 11:51:43 neysx Exp $ --> 3<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v 1.17 2006/02/12 11:53:08 nightmorph 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="fragfred@gmx.de">Dennis Nienhüser</mail> 8 <mail link="earthwings@gentoo.org">Dennis Nienhüser</mail>
9</author> 9</author>
10 10
11<abstract> 11<abstract>
12Power Management is the key to extend battery run time on mobile systems like 12Power Management is the key to extend battery run time on mobile systems like
13laptops. This guide assists you setting it up on your laptop. 13laptops. This guide assists you setting it up on your laptop.
15 15
16<!-- The content of this document is licensed under the CC-BY-SA license --> 16<!-- The content of this document is licensed under the CC-BY-SA license -->
17<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> 17<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
18<license/> 18<license/>
19 19
20<version>1.25</version> 20<version>1.26</version>
21<date>2005-10-02</date> 21<date>2006-02-12</date>
22 22
23<chapter> 23<chapter>
24<title>Introduction</title> 24<title>Introduction</title>
25<section> 25<section>
26<title>Why Power Management?</title>
27<body> 26<body>
28 27
29<p> 28<p>
30Capacity and lifetime of laptop batteries have improved much in the last years. 29Capacity and lifetime of laptop batteries have improved much in the last years.
31Nevertheless modern processors consume much more energy than older ones and 30Nevertheless modern processors consume much more energy than older ones and
93</chapter> 92</chapter>
94 93
95<chapter> 94<chapter>
96<title>Prerequisites</title> 95<title>Prerequisites</title>
97<section> 96<section>
98<title>What has to be done first</title>
99<body> 97<body>
100 98
101<p> 99<p>
102Before going into the details on making individual devices Power Management 100Before discussing the details of making individual devices Power Management
103aware, make sure certain requirements are met. After controlling the BIOS 101aware, make sure certain requirements are met. After controlling BIOS
104settings, some kernel options want to be enabled - these are in short ACPI, 102settings, some kernel options want to be enabled - these are in short ACPI,
105sleep states and CPU frequency scaling. As power saving most of the time comes 103sleep states and CPU frequency scaling. As power saving most of the time comes
106along with performance loss or increased latency, it should only be enabled 104along with performance loss or increased latency, it should only be enabled
107when running on batteries. That's where a new runlevel <e>battery</e> comes in 105when running on batteries. That's where a new runlevel <e>battery</e> comes in
108handy. 106handy.
118First have a look into your BIOS Power Management settings. The best way is to 116First have a look into your BIOS Power Management settings. The best way is to
119combine BIOS and operating system policies, but for the moment it's better to 117combine BIOS and operating system policies, but for the moment it's better to
120disable most of the BIOS part. This makes sure it doesn't interfere with your 118disable most of the BIOS part. This makes sure it doesn't interfere with your
121policies. Don't forget to re-check BIOS settings after you configured 119policies. Don't forget to re-check BIOS settings after you configured
122everything else. 120everything else.
121</p>
122
123</body>
124</section>
125<section>
126<title>Setting USE flags</title>
127<body>
128
129<p>
130Please check that the <c>acpi</c> USE flag is set in
131<path>/etc/make.conf</path>. Other USE flags that might be interesting for your
132system are <c>apm</c>, <c>lm_sensors</c>, <c>nforce2</c>, <c>nvidia</c>,
133<c>pmu</c>. See <path>/usr/portage/profiles/use*.desc</path> for details. If
134you forgot to set one of these flags, you can recompile affected packages using
135the <c>--newuse</c> flag in <c>emerge</c>, see <c>man 1 emerge</c>.
123</p> 136</p>
124 137
125</body> 138</body>
126</section> 139</section>
127<section> 140<section>
280<comment># END configuration</comment> 293<comment># END configuration</comment>
281 294
282 295
283if [ ! -d "/etc/runlevels/${RUNLEVEL_AC}" ] 296if [ ! -d "/etc/runlevels/${RUNLEVEL_AC}" ]
284then 297then
285 logger "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting." 298 logger "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting."
286 exit 1 299 exit 1
287fi 300fi
288 301
289if [ ! -d "/etc/runlevels/${RUNLEVEL_BATTERY}" ] 302if [ ! -d "/etc/runlevels/${RUNLEVEL_BATTERY}" ]
290then 303then
291 logger "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting." 304 logger "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting."
292 exit 1 305 exit 1
293fi 306fi
294 307
295if on_ac_power 308if on_ac_power
296then 309then
297 if [[ "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_AC}" ]] 310 if [[ "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_AC}" ]]
298 then 311 then
299 logger "Switching to ${RUNLEVEL_AC} runlevel" 312 logger "Switching to ${RUNLEVEL_AC} runlevel"
300 /sbin/rc ${RUNLEVEL_AC} 313 /sbin/rc ${RUNLEVEL_AC}
301 fi 314 fi
302elif [[ "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_BATTERY}" ]] 315elif [[ "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_BATTERY}" ]]
303then 316then
304 logger "Switching to ${RUNLEVEL_BATTERY} runlevel" 317 logger "Switching to ${RUNLEVEL_BATTERY} runlevel"
305 /sbin/rc ${RUNLEVEL_BATTERY} 318 /sbin/rc ${RUNLEVEL_BATTERY}
306fi 319fi
307</pre> 320</pre>
308 321
309<p> 322<p>
310Dont forget to run <c>chmod +x /etc/acpi/actions/pmg_switch_runlevel.sh</c> to 323Dont forget to run <c>chmod +x /etc/acpi/actions/pmg_switch_runlevel.sh</c> to
391</section> 404</section>
392</chapter> 405</chapter>
393 406
394<chapter> 407<chapter>
395<title>CPU Power Management</title> 408<title>CPU Power Management</title>
409<section>
410<body>
411
412<p>
413Mobile processors can operate at different frequencies. Some allow changing
414voltage as well. Most of the time your CPU doesn't need to run at full speed
415and scaling it down will save much energy - often without any performance
416decrease.
417</p>
418
419</body>
420</section>
421
396<section> 422<section>
397<title>Some technical terms</title> 423<title>Some technical terms</title>
398<body> 424<body>
399 425
400<p> 426<p>
552 </ti> 578 </ti>
553</tr> 579</tr>
554<tr> 580<tr>
555 <ti><uri link="http://sourceforge.net/projects/cpufreqd/">cpufreqd</uri></ti> 581 <ti><uri link="http://sourceforge.net/projects/cpufreqd/">cpufreqd</uri></ti>
556 <ti>Daemon</ti> 582 <ti>Daemon</ti>
557 <ti>Battery state, CPU load, temperature, running programs</ti> 583 <ti>Battery state, CPU load, temperature, running programs and more</ti>
558 <ti>All available</ti> 584 <ti>All available</ti>
559 <ti>None</ti> 585 <ti>None</ti>
560 <ti> 586 <ti>
561 Sophisticated (but also complicated) setup. 587 Sophisticated (but somewhat complicated) setup. Extendible through plugins
588 like sensor monitoring (lm_sensors) or coordinating some NVidia based
589 graphics card memory and core. Cpufreqd is SMP aware and can optionally be
590 controlled manually at runtime.
562 </ti> 591 </ti>
563</tr> 592</tr>
564<tr> 593<tr>
565 <ti> 594 <ti>
566 <uri link="http://www.deater.net/john/powernowd.html">powernowd</uri> 595 <uri link="http://www.deater.net/john/powernowd.html">powernowd</uri>
638 667
639<p> 668<p>
640<c>cpufreqd</c> can be configured by editing <path>/etc/cpufreqd.conf</path>. 669<c>cpufreqd</c> can be configured by editing <path>/etc/cpufreqd.conf</path>.
641The default one that ships with cpufreqd may look a bit confusing. I recommend 670The default one that ships with cpufreqd may look a bit confusing. I recommend
642replacing it with the one from Gentoo developer Henrik Brix Andersen (see 671replacing it with the one from Gentoo developer Henrik Brix Andersen (see
643below). 672below). Please notice that you need cpufreqd-2.0.0 or later. Earlier versions
673have a different syntax for the config file.
644</p> 674</p>
645 675
646<pre caption="/etc/cpufreqd.conf"> 676<pre caption="/etc/cpufreqd.conf (cpufreqd-2.0.0 and later)">
647[General] 677[General]
648pidfile=/var/run/cpufreqd.pid 678pidfile=/var/run/cpufreqd.pid
649poll_interval=2 679poll_interval=3
650pm_type=acpi 680enable_plugins=acpi_ac, acpi_battery
651verbosity=5 681verbosity=5
682[/General]
652 683
653[Profile] 684[Profile]
654name=ondemand 685name=ondemand
655minfreq=0% 686minfreq=0%
656maxfreq=100% 687maxfreq=100%
657policy=ondemand 688policy=ondemand
689[/Profile]
658 690
659[Profile] 691[Profile]
660name=conservative 692name=conservative
661minfreq=0% 693minfreq=0%
662maxfreq=100% 694maxfreq=100%
663policy=conservative 695policy=conservative
696[/Profile]
664 697
665[Profile] 698[Profile]
666name=powersave 699name=powersave
667minfreq=0% 700minfreq=0%
668maxfreq=100% 701maxfreq=100%
669policy=powersave 702policy=powersave
703[/Profile]
670 704
671[Profile] 705[Profile]
672name=performance 706name=performance
673minfreq=0% 707minfreq=0%
674maxfreq=100% 708maxfreq=100%
675policy=performance 709policy=performance
710[/Profile]
676 711
677[Rule] 712[Rule]
678name=battery 713name=battery
679ac=off 714ac=off
680profile=conservative 715profile=conservative
716[/Rule]
681 717
682[Rule] 718[Rule]
683name=battery_low 719name=battery_low
684ac=off 720ac=off
685battery_interval=0-10 721battery_interval=0-10
686profile=powersave 722profile=powersave
723[/Rule]
687 724
688[Rule] 725[Rule]
689name=ac 726name=ac
690ac=on 727ac=on
691profile=ondemand 728profile=ondemand
729[/Rule]
692</pre> 730</pre>
693 731
694<p> 732<p>
695Now you can start the cpufreqd daemon. Add it to the <e>default</e> and 733Now you can start the cpufreqd daemon. Add it to the <e>default</e> and
696<e>battery</e> runlevel as well. 734<e>battery</e> runlevel as well.
698 736
699<pre caption="Starting cpufreqd"> 737<pre caption="Starting cpufreqd">
700# <i>rc-update add cpufreqd default battery</i> 738# <i>rc-update add cpufreqd default battery</i>
701# <i>rc</i> 739# <i>rc</i>
702</pre> 740</pre>
741
742<p>
743Sometimes it can be desirable to select another policy than the daemon chooses,
744for example when battery power is low, but you know that AC will be available
745soon. In that case you can turn on cpufreqd's manual mode with
746<c>cpufreqd-set manual</c> and select one of your configured policies (as
747listed by <c>cpufreqd-get</c>). You can leave manual mode by executing
748<c>cpufreqd-set dynamic</c>.
749</p>
703 750
704<warn> 751<warn>
705Do not run more than one of the above programs at the same time. It may cause 752Do not run more than one of the above programs at the same time. It may cause
706confusion like switching between two frequencies all the time. 753confusion like switching between two frequencies all the time.
707</warn> 754</warn>
744</chapter> 791</chapter>
745 792
746<chapter> 793<chapter>
747<title>LCD Power Management</title> 794<title>LCD Power Management</title>
748<section> 795<section>
749<title>Energy consumer no. 1</title>
750<body> 796<body>
751 797
752<p> 798<p>
753As you can see in <uri link="#doc_chap1_fig1">figure 1.1</uri>, the LCD display 799As you can see in <uri link="#doc_chap1_fig1">figure 1.1</uri>, the LCD display
754consumes the biggest part of energy (might not be the case for non-mobile 800consumes the biggest part of energy (might not be the case for non-mobile
755CPU's). Thus it's quite important not only to shut the display off when not 801CPU's). Thus it's quite important not only to shut the display off when not
756needed, but also to reduce it's backlight if possible. Most laptops offer the 802needed, but also to reduce it's backlight if possible. Most laptops offer the
757possibility to control the backlight dimming. 803possibility to control the backlight dimming.
758</p> 804</p>
759 805
806</body>
807</section>
808<section>
809<title>Standby settings</title>
810<body>
811
760<p> 812<p>
761First thing to check is the standby/suspend/off timings of the display. As this 813The first thing to check is the standby/suspend/off timings of the display. As
762depends heavily on your windowmanager, I'll let you figure it out yourself. 814this depends heavily on your windowmanager, I'll let you figure it out
763Just two common places: Blanking the terminal can be done with <c>setterm 815yourself. Just two common places: Blanking the terminal can be done with
764-blank &lt;number-of-minutesM&gt;</c>, <c>setterm -powersave on</c> and 816<c>setterm -blank &lt;number-of-minutesM&gt;</c>, <c>setterm -powersave on</c>
765<c>setterm -powerdown &lt;number-of-minutesM&gt;</c>. 817and <c>setterm -powerdown &lt;number-of-minutesM&gt;</c>. For X.org, modify
766For X.org, modify <path>/etc/X11/xorg.conf</path> similar to this: 818<path>/etc/X11/xorg.conf</path> similar to this:
767</p> 819</p>
768 820
769<pre caption="LCD suspend settings in X.org and XFree86"> 821<pre caption="LCD suspend settings in X.org and XFree86">
770Section "ServerLayout" 822Section "ServerLayout"
771 Identifier [...] 823 Identifier [...]
788 840
789<p> 841<p>
790This is the same for XFree86 and <path>/etc/X11/XF86Config</path>. 842This is the same for XFree86 and <path>/etc/X11/XF86Config</path>.
791</p> 843</p>
792 844
845</body>
846</section>
847<section>
848<title>Backlight dimming</title>
849<body>
850
793<p> 851<p>
794Probably more important is the backlight dimming. If you have access to the 852Probably more important is the backlight dimming. If you have access to the
795dimming settings via a tool, write a small script that dims the backlight in 853dimming settings via a tool, write a small script that dims the backlight in
796battery mode and place it in your <e>battery</e> runlevel. The following script 854battery mode and place it in your <e>battery</e> runlevel. The following script
797should work on most IBM Thinkpads. It needs the <c>app-laptop/ibm-acpi</c> 855should work on most IBM Thinkpads and Toshiba laptops. You've got to enable the
798package or the appropriate option in your kernel has to be enabled. 856appropriate option in your kernel (IBM Thinkpads only). For Toshiba laptops, install
857<c>app-laptop/acpitool</c> and skip configuration of ibm_acpi as described below.
799</p> 858</p>
800 859
801<warn> 860<warn>
802Support for setting brightness is marked experimental in ibm-acpi. It accesses 861Support for setting brightness is marked experimental in ibm-acpi. It accesses
803hardware directly and may cause severe harm to your system. Please read the 862hardware directly and may cause severe harm to your system. Please read the
809with the experimental parameter. 868with the experimental parameter.
810</p> 869</p>
811 870
812<pre caption="automatically loading the ibm_acpi module"> 871<pre caption="automatically loading the ibm_acpi module">
813<comment>(Please read the warnings above before doing this!)</comment> 872<comment>(Please read the warnings above before doing this!)</comment>
814<i># emerge ibm-acpi</i>
815<i># echo "options ibm_acpi experimental=1" >> /etc/modules.d/ibm_acpi</i> 873<i># echo "options ibm_acpi experimental=1" >> /etc/modules.d/ibm_acpi</i>
816<i># /sbin/modules-update</i> 874<i># /sbin/modules-update</i>
817<i># echo ibm_acpi >> /etc/modules.autoload.d/kernel-2.6</i> 875<i># echo ibm_acpi >> /etc/modules.autoload.d/kernel-2.6</i>
818<i># modprobe ibm_acpi</i> 876<i># modprobe ibm_acpi</i>
819</pre> 877</pre>
825to the power source. 883to the power source.
826</p> 884</p>
827 885
828<pre caption="/etc/conf.d/lcd-brightness"> 886<pre caption="/etc/conf.d/lcd-brightness">
829<comment># See /proc/acpi/ibm/brightness for available values</comment> 887<comment># See /proc/acpi/ibm/brightness for available values</comment>
830<comment># Please read /usr/share/doc/ibm-acpi-*/README.gz</comment> 888<comment># Please read /usr/src/linux/Documentation/ibm-acpi.txt</comment>
831 889
832<comment># brigthness level in ac mode. Default is 7.</comment> 890<comment># brigthness level in ac mode. Default is 7.</comment>
833BRIGHTNESS_AC=7 891BRIGHTNESS_AC=7
834 892
835<comment># brightness level in battery mode. Default is 4.</comment> 893<comment># brightness level in battery mode. Default is 4.</comment>
850 if [ -f /proc/acpi/ibm/brightness ] 908 if [ -f /proc/acpi/ibm/brightness ]
851 then 909 then
852 ebegin "Setting LCD brightness" 910 ebegin "Setting LCD brightness"
853 echo "level ${LEVEL}" > /proc/acpi/ibm/brightness 911 echo "level ${LEVEL}" > /proc/acpi/ibm/brightness
854 eend $? 912 eend $?
913 elif [[ -e /usr/bin/acpitool &amp;&amp; -n $(acpitool -T | grep "LCD brightness") ]]
914 then
915 ebegin "Setting LCD brightness"
916 acpitool -l $LEVEL >/dev/null || ewarn "Unable to set lcd brightness"
917 eend $?
855 else 918 else
856 ewarn "Setting LCD brightness is not supported." 919 ewarn "Setting LCD brightness is not supported."
857 ewarn "Check that ibm_acpi is loaded into the kernel" 920 ewarn "For IBM Thinkpads, check that ibm_acpi is loaded into the kernel"
921 ewarn "For Toshiba laptops, you've got to install app-laptop/acpitool"
858 fi 922 fi
859} 923}
860 924
861start() { 925start() {
862 set_brightness 926 set_brightness
883</chapter> 947</chapter>
884 948
885<chapter> 949<chapter>
886<title>Disk Power Management</title> 950<title>Disk Power Management</title>
887<section> 951<section>
888<title>Sleep when idle</title> 952<body>
953<p>
954Hard disks consume less energy in sleep mode. Therefore it makes sense to
955activate power saving features whenever the hard disk is not used for a certain
956amount of time. I'll show you two alternative possibilities to do it. First,
957laptop-mode will save most energy due to several measures which prevent or at
958least delay write accesses. The drawback is that due to the delayed write
959accesses a power outage or kernel crash will be more dangerous for data loss.
960If you don't like this, you have to make sure that there are no processes which
961write to your hard disk frequently. Afterwards you can enable power saving
962features of your hard disk with hdparm as the second alternative.
963</p>
964
889<body> 965</body>
966</section>
890 967
891<p> 968<section>
892Let's bring the hard disk to sleep as early as possible whenever it is not 969<title>Increasing idle time - laptop-mode</title>
893needed. I'll show you two possibilities to do it. First <c>cpudyn</c> supports 970<body>
894Disk Power Management. Uncomment the lines in the "Disk Options" section in 971
895<path>/etc/conf.d/cpudyn</path>. To put your first disk to sleep after 60
896seconds of no activity, you would modify it like this:
897</p> 972<p>
898 973Recent kernels (2.6.6 and greater, recent 2.4 ones and others with patches)
899<pre caption="Using cpudyn for disk standby"> 974include the so-called <e>laptop-mode</e>. When activated, dirty buffers are
900<comment>################################################ 975written to disk on read calls or after 10 minutes (instead of 30 seconds). This
901# DISK OPTIONS 976minimizes the time the hard disk needs to be spun up.
902# (disabled by default)
903################################################
904
905#
906# Timeout to put the disk in standby mode if there was no
907# io during that period (in seconds)
908#
909</comment>
910TIMEOUT=60
911<comment>
912#
913# Specified disks to spindown (comma separated devices)
914#
915</comment>
916DISKS=/dev/hda
917</pre>
918
919<p> 977</p>
978
979<pre caption="Automated start of laptop-mode">
980# <i>emerge laptop-mode-tools</i>
981</pre>
982
983<p>
984<c>laptop-mode-tools</c> has its configuration file in
985<path>/etc/laptop-mode/laptop-mode.conf</path>. Adjust it the way you like it,
986it's well commented. Run <c>rc-update add laptop_mode battery</c> to start it
987automatically.
988</p>
989
990<p>
991Recent versions (1.11 and later) of laptop-mode-tools include a new tool
992<c>lm-profiler</c>. It will monitor your system's disk usage and running
993network services and suggests to disable unneeded ones. You can either disable
994them through laptop-mode-tools builtin runlevel support (which will be reverted
995by Gentoo's <c>/sbin/rc</c>) or use your <e>default</e>/<e>battery</e>
996runlevels (recommended).
997</p>
998
999<pre caption="Sample output from running lm-profiler">
1000# lm-profiler
1001Profiling session started.
1002Time remaining: 600 seconds
1003[4296896.602000] amarokapp
1004Time remaining: 599 seconds
1005[4296897.714000] sort
1006[4296897.970000] mv
1007Time remaining: 598 seconds
1008Time remaining: 597 seconds
1009[4296900.482000] reiserfs/0
1010</pre>
1011
1012<p>
1013After profiling your system for ten minutes, lm-profiler will present a list of
1014services which might have caused disk accesses during that time.
1015</p>
1016
1017<pre caption="lm-profiler suggests to disable some services">
1018Program: "atd"
1019Reason: standard recommendation (program may not be running)
1020Init script: /etc/init.d/atd (GUESSED)
1021
1022Do you want to disable this service in battery mode? [y/N]: n
1023</pre>
1024
1025<p>
1026To disable atd as suggested in the example above, you would run <c>rc-update
1027del atd battery</c>. Be careful not to disable services that are needed for
1028your system to run properly - lm-profiler is likely to generate some false
1029positives. Do not disable a service if you are unsure whether it's needed.
1030</p>
1031
1032</body>
1033</section>
1034
1035<section>
1036<title>Limiting write accesses</title>
1037<body>
1038
1039<p>
1040If you don't want to use laptop-mode, you must take special care to disable
1041services that write to your disk frequently - <c>syslogd</c> is a good
1042candidate, for example. You probably don't want to shut it down completely, but
1043it's possible to modify the config file so that "unnecessary" things don't get
1044logged and thus don't create disk traffic. Cups writes to disk periodically, so
1045consider shutting it down and only enable it manually when needed.
1046</p>
1047
1048<pre caption="Disabling cups in battery mode">
1049# <i>rc-update del cupsd battery</i>
1050</pre>
1051
1052<p>
1053You can also use <c>lm-profiler</c> from laptop-mode-tools (see above) to find
1054services to disable. Once you eliminated all of them, go on with configuring
1055hdparm.
1056</p>
1057
1058</body>
1059</section>
1060
1061<section>
1062<title>hdparm</title>
1063<body>
1064
1065<p>
920The second possibility is using a small script and hdparm. Create 1066The second possibility is using a small script and hdparm. Skip this if you
921<path>/etc/init.d/pm.hda</path> like this: 1067are using laptop-mode. Otherwise, create <path>/etc/init.d/pmg_hda</path>:
922</p> 1068</p>
923 1069
924<pre caption="Using hdparm for disk standby"> 1070<pre caption="Using hdparm for disk standby">
925#!/sbin/runscript 1071#!/sbin/runscript
926 1072
927depend() { 1073depend() {
928 after hdparm 1074after hdparm
929} 1075}
930 1076
931start() { 1077start() {
932 ebegin "Activating Power Management for Hard Drives" 1078ebegin "Activating Power Management for Hard Drives"
933 hdparm -q -S12 /dev/hda 1079hdparm -q -S12 /dev/hda
934 eend $? 1080eend $?
935} 1081}
936 1082
937stop () { 1083stop () {
938 ebegin "Deactivating Power Management for Hard Drives" 1084ebegin "Deactivating Power Management for Hard Drives"
939 hdparm -q -S253 /dev/hda 1085hdparm -q -S253 /dev/hda
940 eend $? 1086eend $?
941} 1087}
942</pre> 1088</pre>
943 1089
944<p> 1090<p>
945See <c>man hdparm</c> for the options. If your script is ready, add it to the 1091See <c>man hdparm</c> for the options. If your script is ready, add it to the
946battery runlevel. 1092battery runlevel.
947</p> 1093</p>
948 1094
949<pre caption="Automate disk standby settings"> 1095<pre caption="Automate disk standby settings">
950# <i>chmod +x /etc/init.d/pm.hda</i> 1096# <i>chmod +x /etc/init.d/pmg_hda</i>
951# <i>/sbin/depscan.sh</i> 1097# <i>/sbin/depscan.sh</i>
952# <i>rc-update add pm.hda battery</i> 1098# <i>rc-update add pmg_hda battery</i>
953</pre> 1099</pre>
954 1100
955<impo> 1101<impo>
956Be careful with sleep/spin down settings of your hard drive. Setting it to 1102Be careful with sleep/spin down settings of your hard drive. Setting it to
957small values might wear out your drive and lose warranty. 1103small values might wear out your drive and lose warranty.
958</impo> 1104</impo>
959 1105
960</body> 1106</body>
961</section> 1107</section>
962<section>
963<title>Increasing idle time - laptop-mode</title>
964<body>
965 1108
966<p>
967Recent kernels (2.6.6 and greater, recent 2.4 ones and others with patches)
968include the so-called <e>laptop-mode</e>. When activated, dirty buffers are
969written to disk on read calls or after 10 minutes (instead of 30 seconds). This
970minimizes the time the hard disk needs to be spun up.
971</p>
972
973<pre caption="Automated start of laptop-mode">
974# <i>emerge laptop-mode-tools</i>
975</pre>
976
977<p>
978<c>laptop-mode-tools</c> has it's configuration file in
979<path>/etc/laptop-mode/laptop-mode.conf</path>. Adjust it the way you like it,
980it's well commented. Run <c>rc-update add laptop_mode battery</c> to start it
981automatically.
982</p>
983
984</body>
985</section>
986<section> 1109<section>
987<title>Other tricks</title> 1110<title>Other tricks</title>
988<body> 1111<body>
989
990<p>
991Besides putting your disk to sleep state as early as possible, it is a good
992idea to minimize disk accesses. Have a look at processes that write to your
993disk frequently - the syslogd is a good candidate. You probably don't want to
994shut it down completely, but it's possible to modify the config file so that
995"unnecessary" things don't get logged and thus don't create disk traffic. Cups
996writes to disk periodically, so consider shutting it down and only enable it
997manually when needed.
998</p>
999
1000<pre caption="Disabling cups in battery mode">
1001# <i>rc-update del cupsd battery</i>
1002</pre>
1003 1112
1004<p> 1113<p>
1005Another possibility is to deactivate swap in battery mode. Before writing a 1114Another possibility is to deactivate swap in battery mode. Before writing a
1006swapon/swapoff switcher, make sure there is enough RAM and swap isn't used 1115swapon/swapoff switcher, make sure there is enough RAM and swap isn't used
1007heavily, otherwise you'll be in big problems. 1116heavily, otherwise you'll be in big problems.
1061<section> 1170<section>
1062<title>Wireless Power Management</title> 1171<title>Wireless Power Management</title>
1063<body> 1172<body>
1064 1173
1065<p> 1174<p>
1066Wireless LAN cards consume quite a few energy. Put them in Power Management 1175Wireless LAN cards consume quite a bit of energy. Put them in Power Management
1067mode in analogy to the pm.hda script. 1176mode in analogy to the pmg_hda script.
1068</p> 1177</p>
1178
1179<note>
1180This script assumes your wireless interface is called <c>wlan0</c>; replace
1181this with the actual name of your interface.
1182</note>
1069 1183
1070<pre caption="WLAN Power Management automated"> 1184<pre caption="WLAN Power Management automated">
1071#!/sbin/runscript 1185#!/sbin/runscript
1072start() { 1186start() {
1073 ebegin "Activating Power Management for Wireless LAN" 1187 ebegin "Activating Power Management for Wireless LAN"
1074 iwconfig wlan0 power on power max period 3 1188 iwconfig wlan0 power on
1075 eend $? 1189 eend $?
1076} 1190}
1077 1191
1078stop () { 1192stop () {
1079 ebegin "Deactivating Power Management for Wireless LAN" 1193 ebegin "Deactivating Power Management for Wireless LAN"
1081 eend $? 1195 eend $?
1082} 1196}
1083</pre> 1197</pre>
1084 1198
1085<p> 1199<p>
1086Starting this script will put wlan0 in Power Management mode, going to sleep at 1200Starting this script will activate power saving features for wlan0. Save it as
1087the latest three seconds after no traffic.
1088Save it as <path>/etc/init.d/pm.wlan0</path> and add it to the battery runlevel 1201<path>/etc/init.d/pmg_wlan0</path> and add it to the battery runlevel like the
1089like the disk script above. See <c>man iwconfig</c> for details and more 1202disk script above. See <c>man iwconfig</c> for details and more options like
1090options. If your driver and access point support changing the beacon time, this 1203the period between wakeups or timeout settings. If your driver and access point
1091is a good starting point to save even more energy. 1204support changing the beacon time, this is a good starting point to save even
1205more energy.
1092</p> 1206</p>
1093 1207
1094<pre caption="Power Management for WLAN"> 1208<pre caption="Power Management for WLAN">
1095# <i>chmod +x /etc/init.d/pm.wlan0</i> 1209# <i>chmod +x /etc/init.d/pmg_wlan0</i>
1096# <i>/sbin/depscan.sh</i> 1210# <i>/sbin/depscan.sh</i>
1097# <i>rc-update add pm.wlan0 battery</i> 1211# <i>rc-update add pmg_wlan0 battery</i>
1098</pre> 1212</pre>
1099 1213
1100</body> 1214</body>
1101</section> 1215</section>
1102<section> 1216<section>
1126</chapter> 1240</chapter>
1127 1241
1128<chapter> 1242<chapter>
1129<title>Sleep states: sleep, standby, suspend to disk</title> 1243<title>Sleep states: sleep, standby, suspend to disk</title>
1130<section> 1244<section>
1131<title>Overview</title>
1132<body> 1245<body>
1133 1246
1134<p> 1247<p>
1135ACPI defines different sleep states. The more important ones are 1248ACPI defines different sleep states. The more important ones are
1136</p> 1249</p>
1165 [*] ACPI Support 1278 [*] ACPI Support
1166 [*] Sleep States 1279 [*] Sleep States
1167</pre> 1280</pre>
1168 1281
1169<p> 1282<p>
1170Once your kernel is prepared like above, you can use the 1283Once your kernel is properly configured, you can use the
1171<c>hibernate-script</c> to activate suspend or sleep mode. Let's install that 1284<c>hibernate-script</c> to activate suspend or sleep mode. Let's install that
1172first. 1285first.
1173</p> 1286</p>
1174 1287
1175<pre caption="Installing the hibernate-script"> 1288<pre caption="Installing the hibernate-script">
1394</chapter> 1507</chapter>
1395 1508
1396<chapter> 1509<chapter>
1397<title>Troubleshooting</title> 1510<title>Troubleshooting</title>
1398<section> 1511<section>
1399<title>If things go wrong...</title>
1400<body> 1512<body>
1401 1513
1402<p> 1514<p>
1403<e>Q:</e> I'm trying to change the CPU frequency, but 1515<e>Q:</e> I'm trying to change the CPU frequency, but
1404<path>/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor</path> does not 1516<path>/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor</path> does not
1486<e>A:</e> Check that battery support is compiled into your kernel. If you use 1598<e>A:</e> Check that battery support is compiled into your kernel. If you use
1487it as a module, make sure the module is loaded. 1599it as a module, make sure the module is loaded.
1488</p> 1600</p>
1489 1601
1490<p> 1602<p>
1603<e>Q:</e> My system logger reports things like "logger: ACPI group battery / action
1604battery is not defined".
1605</p>
1606
1607<p>
1608<e>A:</e> This message is generated by the /etc/acpi/default.sh script that is
1609shipped with acpid. You can safely ignore it. If you like to get rid of it, you
1610can comment the appropriate line in /etc/acpi/default.sh as shown below:
1611</p>
1612
1613<pre caption="Disabling warnings about unknown acpi events">
1614 *) # logger "ACPI action $action is not defined"
1615</pre>
1616
1617<p>
1491<e>Q:</e> I have a Dell Inspiron 51XX and I don't get any ACPI events. 1618<e>Q:</e> I have a Dell Inspiron 51XX and I don't get any ACPI events.
1492</p> 1619</p>
1493 1620
1494<p> 1621<p>
1495<e>A:</e> This seems to be a kernel bug. Read on <uri 1622<e>A:</e> This seems to be a kernel bug. Read on <uri
1550<p> 1677<p>
1551<e>Q:</e> My problem is not listed above. Where should I go next? 1678<e>Q:</e> My problem is not listed above. Where should I go next?
1552</p> 1679</p>
1553 1680
1554<p> 1681<p>
1555<e>A:</e> Don't fear to contact me, <mail link="fragfred@gmx.de">Dennis 1682<e>A:</e> Don't fear to contact me, <mail link="earthwings@gentoo.org">Dennis
1556Nienhüser</mail>, directly. 1683Nienhüser</mail>, directly. The
1684<uri link="http://forums.gentoo.org">Gentoo Forums</uri> are a good place to
1685get help as well. If you prefer IRC, try the <e>#gentoo-laptop</e> channel at
1686<e>irc.freenode.net</e>.
1557</p> 1687</p>
1558 1688
1559</body> 1689</body>
1560</section> 1690</section>
1561</chapter> 1691</chapter>

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.20