/[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.21 Revision 1.28
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.21 2006/08/17 00:45:29 rane Exp $ --> 3<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v 1.28 2007/07/08 07:48:12 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="earthwings@gentoo.org">Dennis Nienhüser</mail> 8 <mail link="earthwings@gentoo.org">Dennis Nienhüser</mail>
9</author> 9</author>
10<author title="Editor"> 10<author title="Editor">
11 <mail link="chriswhite@gentoo.org">Chris White</mail> 11 <mail link="chriswhite@gentoo.org">Chris White</mail>
12</author> 12</author>
13<author title="Editor">
14 <mail link="nightmorph@gentoo.org">Joshua Saddler</mail>
15</author>
13 16
14<abstract> 17<abstract>
15Power Management is the key to extend battery run time on mobile systems like 18Power Management is the key to extend battery run time on mobile systems like
16laptops. This guide assists you setting it up on your laptop. 19laptops. This guide assists you setting it up on your laptop.
17</abstract> 20</abstract>
18 21
19<!-- The content of this document is licensed under the CC-BY-SA license --> 22<!-- The content of this document is licensed under the CC-BY-SA license -->
20<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> 23<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
21<license/> 24<license/>
22 25
23<version>1.28</version> 26<version>1.34</version>
24<date>2006-07-26</date> 27<date>2007-07-08</date>
25 28
26<chapter> 29<chapter>
27<title>Introduction</title> 30<title>Introduction</title>
28<section> 31<section>
29<body> 32<body>
669</pre> 672</pre>
670 673
671<p> 674<p>
672<c>cpufreqd</c> can be configured by editing <path>/etc/cpufreqd.conf</path>. 675<c>cpufreqd</c> can be configured by editing <path>/etc/cpufreqd.conf</path>.
673The default one that ships with cpufreqd may look a bit confusing. I recommend 676The default one that ships with cpufreqd may look a bit confusing. I recommend
674replacing it with the one from Gentoo developer Henrik Brix Andersen (see 677replacing it with the one from former Gentoo developer Henrik Brix Andersen
675below). Please notice that you need cpufreqd-2.0.0 or later. Earlier versions 678(see below). Please notice that you need cpufreqd-2.0.0 or later. Earlier
676have a different syntax for the config file. 679versions have a different syntax for the config file.
677</p> 680</p>
678 681
679<pre caption="/etc/cpufreqd.conf (cpufreqd-2.0.0 and later)"> 682<pre caption="/etc/cpufreqd.conf (cpufreqd-2.0.0 and later)">
680[General] 683[General]
681pidfile=/var/run/cpufreqd.pid 684pidfile=/var/run/cpufreqd.pid
855Probably more important is the backlight dimming. If you have access to the 858Probably more important is the backlight dimming. If you have access to the
856dimming settings via a tool, write a small script that dims the backlight in 859dimming settings via a tool, write a small script that dims the backlight in
857battery mode and place it in your <c>battery</c> runlevel. The following script 860battery mode and place it in your <c>battery</c> runlevel. The following script
858should work on most IBM Thinkpads and Toshiba laptops. You've got to enable the 861should work on most IBM Thinkpads and Toshiba laptops. You've got to enable the
859appropriate option in your kernel (IBM Thinkpads only). For Toshiba laptops, 862appropriate option in your kernel (IBM Thinkpads only). For Toshiba laptops,
860install <c>app-laptop/acpitool</c> and skip configuration of <c>ibm_acpi</c> as 863install <c>sys-power/acpitool</c> and skip configuration of <c>ibm_acpi</c> as
861described below. 864described below.
862</p> 865</p>
863 866
864<warn> 867<warn>
865Support for setting brightness is marked experimental in ibm-acpi. It accesses 868Support for setting brightness is marked experimental in ibm-acpi. It accesses
873</p> 876</p>
874 877
875<pre caption="automatically loading the ibm_acpi module"> 878<pre caption="automatically loading the ibm_acpi module">
876<comment>(Please read the warnings above before doing this!)</comment> 879<comment>(Please read the warnings above before doing this!)</comment>
877# <i>echo "options ibm_acpi experimental=1" >> /etc/modules.d/ibm_acpi</i> 880# <i>echo "options ibm_acpi experimental=1" >> /etc/modules.d/ibm_acpi</i>
878# <i>/sbin/modules-update</i> 881# <i>/sbin/update-modules</i>
879# <i>echo ibm_acpi >> /etc/modules.autoload.d/kernel-2.6</i> 882# <i>echo ibm_acpi >> /etc/modules.autoload.d/kernel-2.6</i>
880# <i>modprobe ibm_acpi</i> 883# <i>modprobe ibm_acpi</i>
881</pre> 884</pre>
882 885
883<p> 886<p>
889 892
890<pre caption="/etc/conf.d/lcd-brightness"> 893<pre caption="/etc/conf.d/lcd-brightness">
891<comment># See /proc/acpi/ibm/brightness for available values</comment> 894<comment># See /proc/acpi/ibm/brightness for available values</comment>
892<comment># Please read /usr/src/linux/Documentation/ibm-acpi.txt</comment> 895<comment># Please read /usr/src/linux/Documentation/ibm-acpi.txt</comment>
893 896
894<comment># brigthness level in ac mode. Default is 7.</comment> 897<comment># brightness level in ac mode. Default is 7.</comment>
895BRIGHTNESS_AC=7 898BRIGHTNESS_AC=7
896 899
897<comment># brightness level in battery mode. Default is 4.</comment> 900<comment># brightness level in battery mode. Default is 4.</comment>
898BRIGHTNESS_BATTERY=4 901BRIGHTNESS_BATTERY=4
899</pre> 902</pre>
920 acpitool -l $LEVEL >/dev/null || ewarn "Unable to set lcd brightness" 923 acpitool -l $LEVEL >/dev/null || ewarn "Unable to set lcd brightness"
921 eend $? 924 eend $?
922 else 925 else
923 ewarn "Setting LCD brightness is not supported." 926 ewarn "Setting LCD brightness is not supported."
924 ewarn "For IBM Thinkpads, check that ibm_acpi is loaded into the kernel" 927 ewarn "For IBM Thinkpads, check that ibm_acpi is loaded into the kernel"
925 ewarn "For Toshiba laptops, you've got to install app-laptop/acpitool" 928 ewarn "For Toshiba laptops, you've got to install sys-power/acpitool"
926 fi 929 fi
927} 930}
928 931
929start() { 932start() {
930 set_brightness 933 set_brightness
972<section> 975<section>
973<title>Increasing idle time - laptop-mode</title> 976<title>Increasing idle time - laptop-mode</title>
974<body> 977<body>
975 978
976<p> 979<p>
977Recent kernels (2.6.6 and greater, recent 2.4 ones and others with patches)
978include the so-called <c>laptop-mode</c>. When activated, dirty buffers are 980Recent 2.6 kernels include the so-called <c>laptop-mode</c>. When activated,
979written to disk on read calls or after 10 minutes (instead of 30 seconds). This 981dirty buffers are written to disk on read calls or after 10 minutes (instead of
980minimizes the time the hard disk needs to be spun up. 98230 seconds). This minimizes the time the hard disk needs to be spun up.
981</p> 983</p>
982 984
983<pre caption="Automated start of laptop-mode"> 985<pre caption="Automated start of laptop-mode">
984# <i>emerge laptop-mode-tools</i> 986# <i>emerge laptop-mode-tools</i>
985</pre> 987</pre>
1065<section> 1067<section>
1066<title>hdparm</title> 1068<title>hdparm</title>
1067<body> 1069<body>
1068 1070
1069<p> 1071<p>
1070The second possibility is using a small script and <c>hdparm</c>. Skip this if 1072The second possibility is using <c>hdparm</c>. Skip this if
1071you are using laptop-mode. Otherwise, create <path>/etc/init.d/pmg_hda</path>: 1073you are using laptop-mode. Otherwise, edit <path>/etc/conf.d/hdparm</path> and
1074add the following values to your drive entries. This example assumes your hard
1075drive is called <b>hda</b>:
1072</p> 1076</p>
1073 1077
1074<pre caption="Using hdparm for disk standby"> 1078<pre caption="Using /etc/conf.d/hdparm for disk standby">
1075#!/sbin/runscript 1079hda_args="-q -S12"
1076
1077depend() {
1078after hdparm
1079}
1080
1081start() {
1082ebegin "Activating Power Management for Hard Drives"
1083hdparm -q -S12 /dev/hda
1084eend $?
1085}
1086
1087stop () {
1088ebegin "Deactivating Power Management for Hard Drives"
1089hdparm -q -S253 /dev/hda
1090eend $?
1091}
1092</pre> 1080</pre>
1093 1081
1082<p>
1083This will activate power management for your hard drive. If you ever want to
1084deactivate power management, you can edit <path>/etc/conf.d/hdparm</path> and
1085change the values to <c>-q -S0</c>, or just run <c>hdparm -q -S0 /dev/hda</c>.
1094<p> 1086</p>
1095See <c>man hdparm</c> for the options. If your script is ready, add it to the 1087
1096battery runlevel. 1088<p>
1089See <c>man hdparm</c> for the options. Though you can always start <c>hdparm</c>
1090manually when you are on battery power by running <c>/etc/init.d/hdparm
1091start</c>, it's much easier to automate its startup and shutdown. To do so, add
1092<c>hdparm</c> to the battery runlevel so that it will automatically enable power
1093management.
1097</p> 1094</p>
1098 1095
1099<pre caption="Automate disk standby settings"> 1096<pre caption="Automate disk standby settings">
1100# <i>chmod +x /etc/init.d/pmg_hda</i>
1101# <i>/sbin/depscan.sh</i>
1102# <i>rc-update add pmg_hda battery</i> 1097# <i>rc-update add hdparm battery</i>
1103</pre> 1098</pre>
1104 1099
1105<impo> 1100<impo>
1106Be careful with sleep/spin down settings of your hard drive. Setting it to 1101Be careful with sleep/spin down settings of your hard drive. Setting it to
1107small values might wear out your drive and lose warranty. 1102small values might wear out your drive and lose warranty.
1153<title>Graphics Cards</title> 1148<title>Graphics Cards</title>
1154<body> 1149<body>
1155 1150
1156<p> 1151<p>
1157In case you own an ATI graphics card supporting PowerPlay (dynamic clock 1152In case you own an ATI graphics card supporting PowerPlay (dynamic clock
1158scaling for the the graphics processing unit GPU), you can activate this 1153scaling for the graphics processing unit GPU), you can activate this
1159feature in X.org. Open <path>/etc/X11/xorg.conf</path> and add (or enable) the 1154feature in X.org. Open <path>/etc/X11/xorg.conf</path> and add (or enable) the
1160<c>DynamicClocks</c> option in the Device section. Please notice that this 1155<c>DynamicClocks</c> option in the Device section. Please notice that this
1161feature will lead to crashes on some systems. 1156feature will lead to crashes on some systems.
1162</p> 1157</p>
1163 1158
1174<title>Wireless Power Management</title> 1169<title>Wireless Power Management</title>
1175<body> 1170<body>
1176 1171
1177<p> 1172<p>
1178Wireless LAN cards consume quite a bit of energy. Put them in Power Management 1173Wireless LAN cards consume quite a bit of energy. Put them in Power Management
1179mode in analogy to the <c>pmg_hda</c> script. 1174mode just like your hard drives.
1180</p> 1175</p>
1181 1176
1182<note> 1177<note>
1183This script assumes your wireless interface is called <c>wlan0</c>; replace 1178This script assumes your wireless interface is called <c>wlan0</c>; replace
1184this with the actual name of your interface. 1179this with the actual name of your interface.
1185</note> 1180</note>
1186 1181
1187<pre caption="WLAN Power Management automated">
1188#!/sbin/runscript
1189start() {
1190 ebegin "Activating Power Management for Wireless LAN"
1191 iwconfig wlan0 power on
1192 eend $?
1193}
1194
1195stop () {
1196 ebegin "Deactivating Power Management for Wireless LAN"
1197 iwconfig wlan0 power off
1198 eend $?
1199}
1200</pre>
1201
1202<p>
1203Starting this script will activate power saving features for wlan0. Save it as
1204<path>/etc/init.d/pmg_wlan0</path> and add it to the battery runlevel like the
1205disk script above. See <c>man iwconfig</c> for details and more options like
1206the period between wakeups or timeout settings. If your driver and access point
1207support changing the beacon time, this is a good starting point to save even
1208more energy.
1209</p> 1182<p>
1210 1183Add the following script to <path>/etc/conf.d/net</path> to automatically enable
1211<pre caption="Power Management for WLAN"> 1184power management for your wireless card:
1212# <i>chmod +x /etc/init.d/pmg_wlan0</i>
1213# <i>/sbin/depscan.sh</i>
1214# <i>rc-update add pmg_wlan0 battery</i>
1215</pre> 1185</p>
1186
1187<pre caption="Automated WLAN Power Management">
1188iwconfig_wlan0="power on"
1189</pre>
1190
1191<p>
1192See <c>man iwconfig</c> for details and more options like the period between
1193wakeups or timeout settings. If your driver and access point support changing
1194the beacon time, this is a good starting point to save even more energy.
1195</p>
1216 1196
1217</body> 1197</body>
1218</section> 1198</section>
1219<section> 1199<section>
1220<title>USB Power Management</title> 1200<title>USB Power Management</title>
1291<pre caption="Installing the hibernate-script"> 1271<pre caption="Installing the hibernate-script">
1292# <i>emerge hibernate-script</i> 1272# <i>emerge hibernate-script</i>
1293</pre> 1273</pre>
1294 1274
1295<p> 1275<p>
1296Some configuration has to be done in <path>/etc/hibernate</path> The default 1276Some configuration has to be done in <path>/etc/hibernate</path>. The default
1297package introduces two configuration files <path>hibernate.conf</path> and 1277package introduces a few configuration files for each sleep state. Options that
1298<path>ram.conf</path>. 1278are common to all suspend methods are placed in <path>common.conf</path>; make
1299</p> 1279sure this file is properly set up for your system.
1300
1301<p> 1280</p>
1302To configure sleep, edit <path>ram.conf</path> in <path>/etc/hibernate</path>. 1281
1303<c>UseSysfsPowerState mem</c> is already setup correctly, but you have to go
1304through the rest of the configuration file and set it up for your system. The
1305comments and option names will guide you. If you use nfs or samba shares over
1306the network, make sure to shutdown the appropriate init scripts to avoid
1307timeouts.
1308</p> 1282<p>
1283To configure sleep, edit <path>sysfs-ram.conf</path> in
1284<path>/etc/hibernate</path>. <c>UseSysfsPowerState mem</c> is already setup
1285correctly, but if you need to make further changes to this particular sleep
1286state (or any other sleep state) you should add them to
1287<path>/etc/hibernate/hibernate.conf</path>. The comments and option names will
1288guide you. If you use nfs or samba shares over the network, make sure to
1289shutdown the appropriate init scripts to avoid timeouts.
1290</p>
1291
1292<note>
1293For more information on setting up sleep states, read <c>man
1294hibernate.conf</c>.
1295</note>
1309 1296
1310<p> 1297<p>
1311Ready? Now is the last chance to backup any data you want to keep after 1298Ready? Now is the last chance to backup any data you want to keep after
1312executing the next command. Notice that you probably have to hit a special key 1299executing the next command. Notice that you probably have to hit a special key
1313like <c>Fn</c> to resume from sleep. 1300like <c>Fn</c> to resume from sleep.
1317# <i>hibernate-ram</i> 1304# <i>hibernate-ram</i>
1318</pre> 1305</pre>
1319 1306
1320<p> 1307<p>
1321If you're still reading, it seems to work. You can also setup standby (S1) in a 1308If you're still reading, it seems to work. You can also setup standby (S1) in a
1322similar way by copying <path>ram.conf</path> to <path>standby.conf</path> and 1309similar way by editing <path>sysfs-ram.conf</path> and changing
1323creating a symlink <path>/usr/sbin/hibernate-standby</path> pointing to 1310"UseSysfsPowerState mem" to "UseSysfsPowerState standby". S3 and S4 are the more
1324<path>/usr/sbin/hibernate</path>. S3 and S4 are the more interesting sleep
1325states due to greater energy savings however. 1311interesting sleep states due to greater energy savings however.
1326</p> 1312</p>
1327 1313
1328</body> 1314</body>
1329</section> 1315</section>
1330<section> 1316<section>
1395# <i>rc-update add hibernate-cleanup boot</i> 1381# <i>rc-update add hibernate-cleanup boot</i>
1396</pre> 1382</pre>
1397 1383
1398<p> 1384<p>
1399To activate hibernate with swsusp, use the hibernate script and set 1385To activate hibernate with swsusp, use the hibernate script and set
1400<c>UseSysfsPowerState disk</c> in <path>/etc/hibernate/hibernate.conf</path>. 1386<c>UseSysfsPowerState disk</c> in <path>/etc/hibernate/sysfs-disk</path>.
1401</p> 1387</p>
1402 1388
1403<warn> 1389<warn>
1404Backup your data before doing this. Run <c>sync</c> before executing one of the 1390Backup your data before doing this. Run <c>sync</c> before executing one of the
1405commands to have cached data written to disk. First try it outside of X, then 1391commands to have cached data written to disk. First try it outside of X, then
1407</warn> 1393</warn>
1408 1394
1409<p> 1395<p>
1410If you experience kernel panics due to uhci or similar, try to compile USB 1396If you experience kernel panics due to uhci or similar, try to compile USB
1411support as module and unload the modules before sending your laptop to sleep 1397support as module and unload the modules before sending your laptop to sleep
1412mode. There are configuration options for this in <path>hibernate.conf</path> 1398mode. There are configuration options for this in <path>common.conf</path>
1413</p> 1399</p>
1414 1400
1415<pre caption="Hibernating with swsusp"> 1401<pre caption="Hibernating with swsusp">
1416# <i>nano -w /etc/hibernate.conf</i> 1402# <i>nano -w /etc/hibernate/common.conf</i>
1417<comment>(Make sure you have a backup of your data)</comment> 1403<comment>(Make sure you have a backup of your data)</comment>
1418# <i>hibernate</i> 1404# <i>hibernate</i>
1419</pre> 1405</pre>
1420 1406
1421<p> 1407<p>
1436<pre caption="Invalidating suspend2 images during the boot process"> 1422<pre caption="Invalidating suspend2 images during the boot process">
1437# <i>rc-update add hibernate-cleanup boot</i> 1423# <i>rc-update add hibernate-cleanup boot</i>
1438</pre> 1424</pre>
1439 1425
1440<p> 1426<p>
1441Now edit <path>/etc/hibernate/hibernate.conf</path>, enable the <c>suspend2</c> 1427Now edit <path>/etc/hibernate/suspend2.conf</path>, enable the <c>suspend2</c>
1442section and comment everything in the <c>sysfs_power_state</c> and 1428options you need. Do not enable the <c>fbsplash</c> options in
1443<c>acpi_sleep</c> sections. Do not enable the <c>fbsplash</c> part in global 1429<c>common.conf</c> just yet.
1444options yet.
1445</p> 1430</p>
1446 1431
1447<pre caption="Hibernating with suspend2"> 1432<pre caption="Hibernating with suspend2">
1448# <i>nano -w /etc/hibernate.conf</i> 1433# <i>nano -w /etc/hibernate/suspend2.conf</i>
1449<comment>(Make sure you have a backup of your data)</comment> 1434<comment>(Make sure you have a backup of your data)</comment>
1450# <i>hibernate</i> 1435# <i>hibernate</i>
1451</pre> 1436</pre>
1452 1437
1453<p> 1438<p>
1456package is needed. Additionally, you've got to enable the <c>fbsplash</c> USE 1441package is needed. Additionally, you've got to enable the <c>fbsplash</c> USE
1457flag. 1442flag.
1458</p> 1443</p>
1459 1444
1460<pre caption="Installing suspend2-userui"> 1445<pre caption="Installing suspend2-userui">
1461# <i>mkdir -p /etc/portage</i>
1462# <i>echo "sys-apps/suspend2-userui fbsplash" >> /etc/portage/package.use</i> 1446# <i>echo "sys-apps/suspend2-userui fbsplash" >> /etc/portage/package.use</i>
1447<comment>(It may be marked ~arch, so first it must be keyworded)</comment>
1448# <i>echo "sys-apps/suspend2-userui" >> /etc/portage/package.keywords</i>
1463# <i>emerge suspend2-userui</i> 1449# <i>emerge suspend2-userui</i>
1464</pre> 1450</pre>
1465 1451
1466<p> 1452<p>
1467The ebuild tells you to make a symlink to the theme you want to use. For 1453The ebuild tells you to make a symlink to the theme you want to use. For
1489# <i>cp /usr/sbin/suspend2ui_fbsplash sbin/</i> 1475# <i>cp /usr/sbin/suspend2ui_fbsplash sbin/</i>
1490# <i>find . | cpio --quiet --dereference -o -H newc | gzip -9 > /boot/fbsplash-suspend2-emergence-1024x768</i> 1476# <i>find . | cpio --quiet --dereference -o -H newc | gzip -9 > /boot/fbsplash-suspend2-emergence-1024x768</i>
1491</pre> 1477</pre>
1492 1478
1493<p> 1479<p>
1494Afterwards adjust <path>grub.conf</path> respectively <path>lilo.conf</path> so 1480Afterwards adjust <path>grub.conf</path> (or <path>lilo.conf</path>) so that
1495that your suspend2 kernel uses 1481your suspend2 kernel uses
1496<path>/boot/fbsplash-suspend2-emergence-1024x768</path> as initrd image. You 1482<path>/boot/fbsplash-suspend2-emergence-1024x768</path> as initrd image. You can
1497can now test a dry run to see if everything is setup correctly. 1483now test a dry run to see if everything is setup correctly.
1498</p> 1484</p>
1499 1485
1500<pre caption="Test run for fbsplash hibernation"> 1486<pre caption="Test run for fbsplash hibernation">
1501# <i>suspend2ui_fbsplash -t</i> 1487# <i>suspend2ui_fbsplash -t</i>
1502</pre> 1488</pre>
1503 1489
1504<p> 1490<p>
1505Afterwards open <path>/etc/hibernate/hibernate.conf</path> again and activate 1491Afterwards open <path>/etc/hibernate/common.conf</path> and activate the
1506the fbsplash options. Execute <c>hibernate</c> and enjoy. 1492fbsplash options. Execute <c>hibernate</c> and enjoy.
1507</p> 1493</p>
1508 1494
1509</body> 1495</body>
1510</section> 1496</section>
1511</chapter> 1497</chapter>

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.28

  ViewVC Help
Powered by ViewVC 1.1.20