/[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.52
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.52 2013/01/14 06:19:27 nightmorph Exp $ -->
4<guide link="/doc/en/power-management-guide.xml"> 4
5<guide>
5<title>Power Management Guide</title> 6<title>Power Management Guide</title>
6 7
7<author title="Author"> 8<author title="Author">
8 <mail link="earthwings@gentoo.org">Dennis Nienhüser</mail> 9 <mail link="swift"/>
9</author> 10</author>
10<author title="Editor">
11 <mail link="chriswhite@gentoo.org">Chris White</mail>
12</author>
13 11
14<abstract> 12<abstract>
15Power Management is the key to extend battery run time on mobile systems like 13In recent years, power management has become one of the differentiating
16laptops. This guide assists you setting it up on your laptop. 14features in the quest for finding the perfect laptop. Yet, the operating system
15must support the various power saving functionalities too. In this guide, we
16cover how to setup your Gentoo installation so it manages power-hungry resources
17in a flexible yet automated manner.
17</abstract> 18</abstract>
18 19
19<!-- The content of this document is licensed under the CC-BY-SA license --> 20<!-- The content of this document is licensed under the CC-BY-SA license -->
20<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> 21<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
21<license/> 22<license/>
22 23
23<version>1.28</version> 24<version>7</version>
24<date>2006-07-26</date> 25<date>2013-01-13</date>
25 26
26<chapter> 27<chapter>
27<title>Introduction</title> 28<title>Introduction</title>
28<section> 29<section>
29<body> 30<title>About this document...</title>
30
31<p>
32Capacity and lifetime of laptop batteries have improved much in the last years.
33Nevertheless modern processors consume much more energy than older ones and
34each laptop generation introduces more devices hungry for energy. That's why
35Power Management is more important than ever. Increasing battery run time
36doesn't necessarily mean buying another battery. Much can be achieved applying
37intelligent Power Management policies.
38</p>
39
40</body> 31<body>
41</section> 32
33<p>
34This document describes the setup of power management features on your laptop.
35Although some of the information in this guide can be applied to power
36management for servers, it is not the intention of this document to go that
37route. Please be careful when applying this on a non-laptop system.
38</p>
39
40<p>
41Within this document, we will focus primarily on the laptop mode tools since it
42offers a complete set of functionalities. However, we will also refer to other
43tools that might offer a more detailed approach on individual settings. In such
44cases, you will need to disable the feature from the laptop mode tools so that
45both tools do not fight over the same resource control.
46</p>
47
48</body>
42<section> 49</section>
43<title>A Quick Overview</title>
44<body>
45
46<p>
47Please notice that this guide describes Power Management for <e>laptops</e>.
48While some sections might also suite for <e>servers</e>, others do not and may
49even cause harm. Please do not apply anything from this guide to a server
50unless you really know what you are doing.
51</p>
52
53<p>
54As this guide has become rather long, here's a short overview helping you to
55find your way through it.
56</p>
57
58<p>
59The <uri link="#doc_chap2">Prerequisites</uri> chapter talks about some
60requirements that should be met before any of the following device individual
61sections will work. This includes BIOS settings, kernel configuration and some
62simplifications in user land. The following three chapters focus on devices
63that typically consume most energy - processor, display and hard drive. Each
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
66without losing too much performance. A few different tricks prevent your hard
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
69graphics cards, Wireless LAN and USB finish the device section in <uri
70link="#doc_chap6">Power Management For Other Devices</uri> while another
71chapter is dedicated to the (rather experimental) <uri link="#doc_chap7">sleep
72states</uri>. Last not least <uri link="#doc_chap8">Troubleshooting</uri> lists
73common pitfalls.
74</p>
75
76</body>
77</section> 50<section>
51<title>About laptop_mode</title>
52<body>
53
54<p>
55The <c>laptop_mode</c> setting is an in-kernel configuration setting that
56optimizes I/O, allowing disks to spin down properly (and not be woken up
57immediately afterwards for queued operations).
58</p>
59
60</body>
78<section> 61</section>
79<title>Power Budget For Each Component</title> 62<section>
63<title>About laptop-mode-tools</title>
80<body> 64<body>
81 65
82<figure link="/images/energy-budget.png" short="Which component consumes how
83much energy?" caption="Power budget for each component"/>
84
85<p> 66<p>
86Nearly every component can operate in different states - off, sleep, idle, 67The <e>Laptop Mode Tools</e> is a software package
87active to name a few - consuming a different amount of energy. Major parts are 68(<c>app-laptop/laptop-mode-tools</c>) which allows the user to optimize power
88consumed by the LCD display, CPU, chipset and hard drives. Often one is able to 69saving functions. It allows managing the <c>laptop_mode</c> setting in the Linux
89activate OS-independent Power Management in the BIOS, but an intelligent setup 70kernel, but has additional features allowing you to tweak other power-related
90in the operating system adapting to different situations can achieve much more. 71settings on the system.
91</p> 72</p>
92 73
93</body> 74</body>
94</section> 75</section>
95</chapter> 76</chapter>
96 77
97<chapter> 78<chapter>
98<title>Prerequisites</title> 79<title>Linux Kernel Configuration</title>
99<section>
100<body>
101
102<p>
103Before discussing the details of making individual devices Power Management
104aware, make sure certain requirements are met. After controlling BIOS settings,
105some kernel options want to be enabled - these are in short ACPI, sleep states
106and CPU frequency scaling. As power saving most of the time comes along with
107performance loss or increased latency, it should only be enabled when running
108on batteries. That's where a new runlevel <e>battery</e> comes in handy.
109</p>
110
111</body>
112</section> 80<section>
113<section> 81<title>Minimum kernel setup</title>
114<title>The BIOS Part</title>
115<body>
116
117<p>
118First 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
120disable 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
122everything else.
123</p>
124
125</body> 82<body>
126</section>
127<section>
128<title>Setting USE Flags</title>
129<body>
130 83
131<p>
132Please check that the <c>acpi</c> USE flag is set in
133<path>/etc/make.conf</path>. Other USE flags that might be interesting for your
134system are <c>apm</c>, <c>lm_sensors</c>, <c>nforce2</c>, <c>nvidia</c>,
135<c>pmu</c>. See <path>/usr/portage/profiles/use*.desc</path> for details. If
136you forgot to set one of these flags, you can recompile affected packages using
137the <c>--newuse</c> flag in <c>emerge</c>, see <c>man emerge</c>.
138</p> 84<p>
139
140</body>
141</section>
142<section>
143<title>Configuring The Kernel</title>
144<body>
145
146<p>
147ACPI (Advanced Configuration and Power Interface) support in the kernel is
148still work in progress. Using a recent kernel will make sure you'll get the
149most out of it.
150</p>
151
152<p>
153There are different kernel sources in Portage. I'd recommend using 85There are different kernel sources in Portage. We recommend using
154<c>gentoo-sources</c> or <c>suspend2-sources</c>. The latter contains patches 86<c>gentoo-sources</c>, but if you want advanced hibernation support you might
155for Software Suspend 2, see the chapter about <uri link="#doc_chap7">sleep 87need <c>tuxonice-sources</c>. To enable proper power management features in the
156states</uri> for more details. When configuring the kernel, activate at least 88Linux kernel, enable at least the following settings:
157these options:
158</p> 89</p>
159 90
160<pre caption="Minimum kernel setup for Power Management (Kernel 2.6)"> 91<pre caption="Minimum kernel setup for Power Management">
161Power Management Options ---&gt; 92<![CDATA[
162 [*] Power Management Support 93General setup --->
163 [ ] Software Suspend 94 [*] Configure standard kernel features (expert users) --->
164 95
96Power management and ACPI options --->
97 [*] Run-time PM core functionality
165 ACPI( Advanced Configuration and Power Interface ) Support ---&gt; 98 [*] ACPI (Advanced Configuration and Power Interface) Support --->
166 [*] ACPI Support
167 [ ] Sleep States
168 [ ] /proc/acpi/sleep (deprecated)
169 [*] AC Adapter 99 <*> AC Adapter
170 [*] Battery 100 <*> Battery
171 &lt;M&gt; Button 101 -*- Button
172 &lt;M&gt; Video 102 -*- Video
173 [ ] Generic Hotkey 103 <*> Fan
174 &lt;M&gt; Fan 104 <*> Processor
175 &lt;M&gt; Processor 105 <*> Thermal Zone
176 &lt;M&gt; Thermal Zone
177 &lt; &gt; ASUS/Medion Laptop Extras
178 &lt; &gt; IBM ThinkPad Laptop Extras
179 &lt; &gt; Toshiba Laptop Extras
180 (0) Disable ACPI for systems before Jan 1st this year
181 [ ] Debug Statements
182 [*] Power Management Timer Support 106 [*] Power Management Timer Support
183 &lt; &gt; ACPI0004,PNP0A05 and PNP0A06 Container Driver (EXPERIMENTAL)
184 107
185 CPU Frequency Scaling ---&gt; 108 [*] CPU Frequency scaling --->
186 [*] CPU Frequency scaling 109 [*] CPU Frequency scaling
187 [ ] Enable CPUfreq debugging
188 &lt; &gt; CPU frequency translation statistics
189 [ ] CPU frequency translation statistics details
190 Default CPUFreq governor (userspace)
191 &lt;*&gt; 'performance' governor 110 <*> 'performance' governor
192 &lt;*&gt; 'powersave' governor 111 <*> 'powersave' governor
193 &lt;*&gt; 'ondemand' cpufreq policy governor 112 <*> 'userspace' governor
113 <*> 'ondemand' governor
194 &lt;*&gt; 'conservative' cpufreq governor 114 <*> 'conservative' governor
195 &lt;*&gt; CPU frequency table helpers
196 &lt;M&gt; ACPI Processor P-States driver 115 <*> ACPI Processor P-States driver
197 &lt;*&gt; <i>CPUFreq driver for your processor</i> 116]]>
198</pre> 117</pre>
199 118
200<p>
201Decide yourself whether you want to enable Software Suspend, and Sleep States
202(see below). If you own an ASUS, Medion, IBM Thinkpad or Toshiba laptop, enable
203the appropriate section.
204</p> 119<p>
205 120Don't forget to enable the CPU frequency scaling driver for your CPU, located
121right after the <e>ACPI Processor P-States driver</e> mentioned above.
206<p> 122</p>
207The kernel has to know how to enable CPU frequency scaling on your processor. 123
208As each type of CPU has a different interface, you've got to choose the right
209driver for your processor. Be careful here - enabling <c>Intel Pentium 4 clock
210modulation</c> on a Pentium M system will lead to strange results for example.
211Consult the kernel documentation if you're unsure which one to take.
212</p> 124<p>
213 125Build and install the new kernel (if necessary) and reboot.
214<p> 126</p>
215Compile your kernel, make sure the right modules get loaded at startup and boot
216into your new ACPI-enabled kernel. Next run <c>emerge sys-power/acpid</c> to
217get the acpi daemon. This one informs you about events like switching from AC
218to battery or closing the lid. Make sure the modules are loaded if you didn't
219compile them into the kernel and start acpid by executing <c>/etc/init.d/acpid
220start</c>. Run <c>rc-update add acpid default</c> to load it on startup. You'll
221soon see how to use it.
222</p>
223 127
224<pre caption="Installing acpid">
225# <i>emerge sys-power/acpid</i>
226# <i>/etc/init.d/acpid start</i>
227# <i>rc-update add acpid default</i>
228</pre>
229
230</body> 128</body>
231</section>
232<section> 129</section>
233<title>Creating A "battery" Runlevel</title> 130<!--
131<section id="kernelconfig">
132<title>Additional kernel configuration entries</title>
133<body>
134
135<p>
136Further down this guide, additional kernel settings might be suggested. To
137lessen the effort to maintain the guide, and to make sure settings are correctly
138identified, we will use the kernel configuration short-hand notations. These
139notations are simple strings, like <c>CONFIG_USB_SUSPEND</c>. But how to read
140this?
141</p>
142
143<p>
144Well, then you configure your kernel (through <c>make menuconfig</c>), you can
145search through the configuration settings for a particular entry. Press <c>/</c>
146while configuring the Linux kernel and type the setting
147(<c>CONFIG_USB_SUSPEND</c>). The software will tell you what the setting is,
148what it is for, when you can select it (i.e. on which settings it depends before
149you can see it) but most importantly, where you can find it.
150</p>
151
152<pre caption="Result of a search operation during menuconfig">
153<![CDATA[Symbol: USB_SUSPEND [=n]
154Type : boolean
155Prompt: USB runtime power management (autosuspend) and wakeup
156 Defined at drivers/usb/core/Kconfig:93
157 Depends on: USB_SUPPORT [=y] && USB [=y] && PM_RUNTIME [=n]
158 Location:
159 -> Device Drivers
160 -> USB support (USB_SUPPORT [=y])
161 -> Support for Host-side USB (USB [=y]) ]]>
162</pre>
163
234<body> 164</body>
165</section>
166-->
167</chapter>
235 168
169<chapter>
170<title>Using Laptop Mode Tools</title>
171<section>
172<title>Installation</title>
173<body>
174
175<p>
176It comes to no surprise that installation of the <e>Laptop Mode Tools</e>
177software is easily done through <c>emerge laptop-mode-tools</c>. However, this
178package takes on additional, optional settings through USE flag configuration.
179So let's first take a look at the supported USE flags and what they mean to the
180package.
236<p> 181</p>
237The default policy will be to enable Power Management only when needed - 182
238running on batteries. To make the switch between AC and battery convenient, 183<table>
239create a runlevel <c>battery</c> that holds all the scripts starting and 184<tr>
240stopping Power Management. 185 <th>USE flag</th>
186 <th>Description</th>
187 <th>Suggested when...</th>
188</tr>
189<tr>
190 <ti>acpi</ti>
191 <ti>
192 Depend on <c>sys-power/acpid</c> so that changes in the system are
193 captured and power saving features are automatically enabled/disabled.
194 </ti>
195 <ti>your laptop is not too old (~ year 2003 and later)</ti>
196</tr>
197<tr>
198 <ti>apm</ti>
199 <ti>
200 Depend on <c>sys-apps/apmd</c> so that changes in the system are captured
201 and power saving features are automatically enabled/disabled.
202 </ti>
203 <ti>your laptop is very old</ti>
204</tr>
205<tr>
206 <ti>bluetooth</ti>
207 <ti>
208 Depend on <c>net-wireless/bluez</c>, enabling the <c>laptop-mode-tools</c>
209 to manage bluetooth settings (enabling/disabling the service based on
210 battery availability)
211 </ti>
212 <ti>your laptop (and kernel) supports bluetooth</ti>
213</tr>
214<tr>
215 <ti>scsi</ti>
216 <ti>
217 Depend on <c>sys-apps/sdparm</c>, enabling the <c>laptop-mode-tools</c> to
218 manage SCSI (<e>and not</e> SATA) disk parameters.
219 </ti>
220 <ti>your laptop uses SCSI disks</ti>
221</tr>
222</table>
223
224<p>
225As you can see, there are two USE flags that seem to collide: <c>acpi</c> and
226<c>apm</c>. So what's the deal there?
227</p>
228
229<ul>
230 <li>
231 The <c>apm</c> USE flag enables support for <e>Advanced Power
232 Management</e>, an older (before year 2000) standard for power management
233 features within a system.
234 </li>
235 <li>
236 The <c>acpi</c> USE flag enables support for <e>Advanced Configuration and
237 Power Interface</e>, the successor of APM. All modern laptops support ACPI.
238 </li>
239</ul>
240
241<p>
242Depending on your system, you will either need <c>acpi</c> or <c>apm</c> set. In
243the remainder of this guide, we assume that your laptop is recent enough to use
244ACPI.
245</p>
246
247<p>
248So, with the USE flags set, let's install <c>laptop-mode-tools</c>.
241</p> 249</p>
242 250
243<note> 251<note>
244You can safely skip this section if you don't like the idea of having another 252If you have USE="acpi" set, the installation will pull in <c>acpid</c>. However,
245runlevel. However, skipping this step will make the rest a bit trickier to set 253the current stable ACPI daemon (2.0.9) does not support the new ACPI interfaces
246up. The next sections assume a runlevel <c>battery</c> exists. 254within the Linux kernel (using the netlink interface). As such, we recommend
255unmasking <c>sys-power/acpid-2.0.12</c> (or higher). For more information about
256unmasking packages, please read
257<uri link="/doc/en/handbook/handbook-amd64.xml?part=3&amp;chap=3">Mixing Software
258Branches</uri> in the Gentoo Handbook.
247</note> 259</note>
248 260
249<pre caption="Creating a battery runlevel"> 261<pre caption="Installing laptop-mode-tools">
250# <i>cd /etc/runlevels</i> 262# <i>emerge laptop-mode-tools</i>
251# <i>cp -a default battery</i>
252</pre>
253
254<p>
255Finished. Your new runlevel <c>battery</c> contains everything like
256<c>default</c>, but there is no automatic switch between both yet. Time to
257change it.
258</p> 263</pre>
259 264
260</body> 265</body>
261</section>
262<section> 266</section>
263<title>Reacting On ACPI Events</title> 267<section>
268<title>Configuration</title>
269<body>
270
271<p>
272Having <c>laptop-mode-tools</c> installed on your system does not automatically
273enable the power management features that you might need. To configure the
274package, first take a look at <path>/etc/laptop-mode/laptop-mode.conf</path>.
275This is the main configuration file for the package and is pretty well described
276(through comments).
277</p>
278
279<p>
280But it is not the only configuration file to work with. The Laptop Mode Tools
281package supports plugins (or modules) which have their own configuration
282file(s). These files are located in <path>/etc/laptop-mode/conf.d</path> and are
283named after the module they represent (such as
284<path>intel-sata-powermgmt.conf</path>).
285</p>
286
287<p>
288Now, one of the important settings in each configuration file is if the Laptop
289Mode Tools package should govern a particular setting or not. This is important
290when you want to combine <c>laptop-mode-tools</c> with other services like
291<c>cpufreqd</c>. In this example case, you will need to set
292<c>CONTROL_CPU_FREQUENCY=0</c>:
293</p>
294
295<pre caption="Editing /etc/laptop-mode/conf.d/cpufreq.conf">
296# <i>nano -w /etc/laptop-mode/conf.d/cpufreq.conf</i>
297CONTROL_CPU_FREQUENCY=<i>0</i>
298</pre>
299
300<p>
301The next few sections will help you configure <c>laptop-mode-tools</c> to suit
302your needs. When you are finished, start the <c>laptop_mode</c> service and make
303sure it is started when you boot up your system.
304</p>
305
306<pre caption="Starting the laptop_mode service">
307# <i>/etc/init.d/laptop_mode start</i>
308# <i>rc-update add laptop_mode default</i>
309</pre>
310
264<body> 311</body>
312</section>
313<section>
314<title>How does laptop-mode-tools work</title>
315<body>
265 316
266<p>
267Typical ACPI events are closing the lid, changing the power source or pressing
268the sleep button. An important event is changing the power source, which should
269cause a runlevel switch. A small script will take care of it.
270</p> 317<p>
271 318When running the <c>laptop_mode</c> service, the software will check in which
319state your system is in. The states are defined as:
272<p> 320</p>
273First you need a script which changes the runlevel to <c>default</c> 321
274respectively <c>battery</c> depending on the power source. The script uses the 322<ul>
275<c>on_ac_power</c> command from <c>sys-power/powermgmt-base</c> - make sure the 323 <li>
276package is installed on your system. 324 <e>Battery</e>, in the configuration files using the <c>BATT_</c> prefix, is
325 active when the system is running on battery power
326 </li>
327 <li>
328 <e>AC</e>, in the configuration files using the <c>AC_</c> prefix, is active
329 when the system is running on AC power
330 </li>
331 <li>
332 <e>Laptop Mode</e>, in the configuration files using the <c>LM_</c> prefix,
333 is active when <e>laptop mode</e> is enabled
334 </li>
335 <li>
336 <e>No Laptop Mode</e>, in the configuration files using the <c>NOLM_</c>
337 prefix, is active when <e>laptop mode</e> is disabled
338 </li>
339</ul>
340
277</p> 341<p>
278 342The <c>AC/BATT_</c> and <c>LM/NOLM_</c> prefixes can be combined (so you can
279<pre caption="Installing powermgt-base"> 343have a <c>AC_LM_</c> prefix).
280# <i>emerge powermgmt-base</i>
281</pre>
282
283<p> 344</p>
284You are now able to determine the power source by executing <c>on_ac_power 345
285&amp;&amp; echo AC available || echo Running on batteries</c> in a shell. The
286script below is responsible for changing runlevels. Save it as
287<path>/etc/acpi/actions/pmg_switch_runlevel.sh</path>.
288</p> 346<p>
289 347When the <c>laptop_mode</c> service is started, it will switch modes based on
290<pre caption="/etc/acpi/actions/pmg_switch_runlevel.sh"> 348events that occur (and of course based on the configuration settings). For
291#!/bin/bash 349instance, the setting <c>ENABLE_LAPTOP_MODE_ON_BATTERY=1</c> will make sure that
292 350the laptop mode tools switch to <e>laptop mode</e> when battery power is used.
293<comment># BEGIN configuration</comment> 351If that is the case, then the settings starting with <c>LM_</c>,
294RUNLEVEL_AC="default" 352<c>LM_BATT_</c>, <c>BATT_LM_</c> and <c>BATT_</c> will be used.
295RUNLEVEL_BATTERY="battery"
296<comment># END configuration</comment>
297
298
299if [ ! -d "/etc/runlevels/${RUNLEVEL_AC}" ]
300then
301 logger "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting."
302 exit 1
303fi
304
305if [ ! -d "/etc/runlevels/${RUNLEVEL_BATTERY}" ]
306then
307 logger "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting."
308 exit 1
309fi
310
311if on_ac_power
312then
313 if [[ "$(&lt;/var/lib/init.d/softlevel)" != "${RUNLEVEL_AC}" ]]
314 then
315 logger "Switching to ${RUNLEVEL_AC} runlevel"
316 /sbin/rc ${RUNLEVEL_AC}
317 fi
318elif [[ "$(&lt;/var/lib/init.d/softlevel)" != "${RUNLEVEL_BATTERY}" ]]
319then
320 logger "Switching to ${RUNLEVEL_BATTERY} runlevel"
321 /sbin/rc ${RUNLEVEL_BATTERY}
322fi
323</pre>
324
325<p> 353</p>
326Dont forget to run <c>chmod +x /etc/acpi/actions/pmg_switch_runlevel.sh</c> to 354
327make the script executable. The last thing that needs to be done is calling the
328script whenever the power source changes. That's done by catching ACPI events
329with the help of <c>acpid</c>. First you need to know which events are
330generated when the power source changes. The events are called
331<c>ac_adapter</c> and <c>battery</c> on most laptops, but it might be different
332on yours.
333</p> 355<p>
334 356To make sure settings to not collide, it is not allowed to have overlapping
335<pre caption="Determining ACPI events for changing the power source"> 357settigns. In the next example, the first set (for <c>CPU_MAXFREQ</c>) is valid,
336# <i>tail -f /var/log/acpid | grep "received event"</i> 358but the second one (for <c>CPU_GOVERNOR</c>) isn't.
337</pre>
338
339<p> 359</p>
340Run the command above and pull the power cable. You should see something like 360
341this: 361<pre caption="Colliding settings">
362<comment>## Valid set</comment>
363BATT_CPU_MAXFREQ=fastest
364LM_AC_CPU_MAXFREQ=fastest
365NOLM_AC_CPU_MAXFREQ=fastest
366
367<comment>## Invalid set</comment>
368BATT_CPU_MINFREQ=fastest
369LM_AC_CPU_MINFREQ=fastest
370<comment># The following includes AC and BATT, but BATT is already defined</comment>
371NOLM_CPU_MINFREQ=fastest
372</pre>
373
374</body>
375</section>
376<section>
377<title>Configuring CPU frequency management</title>
378<body>
379
342</p> 380<p>
343 381The support for CPU frequency management in the laptop mode tools allows
344<pre caption="Sample output for power source changes"> 382switching frequencies. It supports setting the CPU frequency governor, minimum
345[Tue Sep 20 17:39:06 2005] received event "ac_adapter AC 00000080 00000000" 383frequency and maximum frequency. The configuration file used here is
346[Tue Sep 20 17:39:06 2005] received event "battery BAT0 00000080 00000001" 384<path>/etc/laptop-mode/conf.d/cpufreq.conf</path>.
347</pre>
348
349<p> 385</p>
350The interesting part is the quoted string after <c>received event</c>. It will 386
351be matched by the event line in the files you are going to create below. Don't
352worry if your system generates multiple events or always the same. As long as
353any event is generated, runlevel changing will work.
354</p> 387<p>
355 388The <e>CPU frequency governor</e> is a kernel-level policy that defines how the
356<pre caption="/etc/acpi/events/pmg_ac_adapter"> 389kernel will select the CPU frequency. We already selected the governors we want
357<comment># replace "ac_adapter" below with the event generated on your laptop</comment> 390to use in the kernel configuration earlier. Let's recap:
358<comment># For example, ac_adapter.* will match ac_adapter AC 00000080 00000000</comment>
359event=ac_adapter.*
360action=/etc/acpi/actions/pmg_switch_runlevel.sh %e
361</pre>
362
363<pre caption="/etc/acpi/events/pmg_battery">
364<comment># replace "battery" below with the event generated on your laptop</comment>
365<comment># For example, battery.* will match battery BAT0 00000080 00000001</comment>
366event=battery.*
367action=/etc/acpi/actions/pmg_switch_runlevel.sh %e
368</pre>
369
370<p> 391</p>
371Finally acpid has to be restarted to recognize the changes. 392
393<ul>
394 <li>
395 <c>performance</c> always picks the highest frequency
396 </li>
397 <li>
398 <c>powersave</c> always picks the lowest frequency
399 </li>
400 <li>
401 <c>userspace</c> does not pick anything, but let the user decide (or any
402 process that the user is running that will decide for the user)
403 </li>
404 <li>
405 <c>ondemand</c> will scale the CPU frequency up to the highest frequency
406 when load is available
407 </li>
408 <li>
409 <c>conservative</c> will scale the CPU frequency up gradually when load is
410 available
411 </li>
412</ul>
413
372</p> 414<p>
373 415When switching between AC or battery, or (no) laptop mode, the appropriate
374<pre caption="Finishing runlevel switching with acpid"> 416governor (as well as its minimum and maximum frequency) is selected.
375# <i>/etc/init.d/acpid restart</i>
376</pre>
377
378<p> 417</p>
379Give it a try: Plug AC in and out and watch syslog for the "Switching to AC 418
380mode" or "Switching to battery mode" messages. See the <uri 419</body>
381link="#doc_chap8">Troubleshooting section</uri> if the script is not able to 420</section>
382detect the power source correctly. 421<section>
422<title>Configuring display brightness</title>
423<body>
424
383</p> 425<p>
384 426With <path>/etc/laptop-mode/conf.d/lcd-brightness.conf</path>, you can have the
427laptop mode tools govern the brightness of your LCD screen.
385<p> 428</p>
386Due to the nature of the event mechanism, your laptop will boot into runlevel 429
387<c>default</c> regardless of the AC/battery state. This is fine when running
388from AC, but we'd like to boot into the battery runlevel otherwise. One
389solution would be to add another entry to the boot loader with the parameter
390<c>softlevel=battery</c>, but it's likely to forget choosing it. A better way
391is faking an ACPI event in the end of the boot process and letting
392<path>pmg_switch_runlevel.sh</path> script decide whether a runlevel change is
393necessary. Open <path>/etc/conf.d/local.start</path> in your favourite editor
394and add these lines:
395</p> 430<p>
396 431The file currently uses the <path>/proc/acpi/video/VID/LCD/brightness</path>
397<pre caption="Runlevel adjustment at boot time by editing local.start"> 432file to set brightness values. Recent kernels do not provide this anymore -
398<comment># Fake acpi event to switch runlevel if running on batteries</comment> 433you will need to adjust this to <path>/sys/class/backlight/acpi_video0/brightness</path>
399/etc/acpi/actions/pmg_switch_runlevel.sh "battery/battery" 434instead.
400</pre>
401
402<p> 435</p>
403Prepared like this you can activate Power Management policies for individual 436
404devices. 437<p>
438The values you can use are between 0 and 15, with 0 being the lowest brightness
439value.
440</p>
441
442</body>
443</section>
444<section>
445<title>Configuring other services</title>
446<body>
447
448<p>
449An interesting feature of <c>laptop-mode-tools</c> is to support reloading
450particular services (like the system logger) after switching its configuration
451file. This is handled through
452<path>/etc/laptop-mode/conf.d/configuration-file-control.conf</path>.
453</p>
454
455<p>
456If enabled, the <c>laptop_mode</c> application will switch the configuration
457file(s) of the mentioned services with the same file, but suffixed with
458<path>-nolm-ac</path>, <path>-lm-ac</path> or <path>-batt</path>. It willl then
459signal or reload the appropriate services so they can use the new configuration
460file.
405</p> 461</p>
406 462
407</body> 463</body>
408</section> 464</section>
409</chapter> 465</chapter>
410 466
411<chapter> 467<chapter>
412<title>CPU Power Management</title> 468<title>Using cpufreqd</title>
413<section>
414<body>
415
416<p>
417Mobile processors can operate at different frequencies. Some allow changing
418voltage as well. Most of the time your CPU doesn't need to run at full speed
419and scaling it down will save much energy - often without any performance
420decrease.
421</p>
422
423</body>
424</section> 469<section>
425<section> 470<title>Installation</title>
426<title>Some Technical Terms</title>
427<body>
428
429<p>
430CPU frequency scaling brings up some technical terms that might be unknown to
431you. Here's a quick introduction.
432</p>
433
434<p>
435First of all, the kernel has to be able to change the processor's frequency.
436The <b>CPUfreq processor driver</b> knows the commands to do it on your CPU.
437Thus it's important to choose the right one in your kernel. You should already
438have done it above. Once the kernel knows how to change frequencies, it has to
439know which frequency it should set. This is done according to the <b>policy</b>
440which consists of a <b>CPUfreq policy</b> and a <b>governor</b>. A CPUfreq
441policy are just two numbers which define a range the frequency has to stay
442between - minimal and maximal frequency. The governor now decides which of the
443available frequencies in between minimal and maximal frequency to choose. For
444example, the <b>powersave governor</b> always chooses the lowest frequency
445available, the <b>performance governor</b> the highest one. The <b>userspace
446governor</b> makes no decision but chooses whatever the user (or a program in
447userspace) wants - which means it reads the frequency from
448<path>/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed</path>.
449</p>
450
451<p>
452This doesn't sound like dynamic frequency changes yet and in fact it isn't.
453Dynamics however can be accomplished with various approaches. For example, the
454<b>ondemand governor</b> makes its decisions depending on the current CPU load.
455The same is done by various userland tools like <c>cpudyn</c>, <c>cpufreqd</c>,
456<c>powernowd</c> and many more. ACPI events can be used to enable or disable
457dynamic frequency changes depending on power source.
458</p>
459
460</body> 471<body>
461</section>
462<section>
463<title>Setting The Frequency Manually</title>
464<body>
465 472
466<p>
467Decreasing CPU speed and voltage has two advantages: On the one hand less
468energy is consumed, on the other hand there is thermal improvement as your
469system doesn't get as hot as running on full speed. The main disadvantage is
470obviously the loss of performance. Decreasing processor speed is a trade off
471between performance loss and energy saving.
472</p> 473<p>
473 474The <c>cpufreqd</c> application allows you to manage CPU frequencies in a more
474<note> 475granular approach then what <c>laptop-mode-tools</c> supports. But before we
475Not every laptop supports frequency scaling. If unsure, have a look at the list 476dive into the installation of <c>cpufreqd</c>, let's first look at the USE flags
476of supported processors in the <uri link="#doc_chap8">Troubleshooting</uri> 477it supports.
477section to verify yours is supported.
478</note>
479
480<p>
481It's time to test whether CPU frequency changing works. Let's install another
482tool which is very handy for debugging purposes: <c>sys-power/cpufrequtils</c>
483</p>
484
485<pre caption="Checking CPU frequency">
486# <i>emerge cpufrequtils</i>
487# <i>cpufreq-info</i>
488</pre>
489
490<p>
491Here is an example output:
492</p>
493
494<pre caption="Sample output from cpufreq-info">
495cpufrequtils 0.3: cpufreq-info (C) Dominik Brodowski 2004
496Report errors and bugs to linux@brodo.de, please.
497analyzing CPU 0:
498 driver: centrino
499 CPUs which need to switch frequency at the same time: 0
500 hardware limits: 600 MHz - 1.40 GHz
501 available frequency steps: 600 MHz, 800 MHz, 1000 MHz, 1.20 GHz, 1.40 GHz
502 available cpufreq governors: conservative, ondemand, powersave, userspace, performance
503 current policy: frequency should be within 924 MHz and 1.40 GHz.
504 The governor "performance" may decide which speed to use
505 within this range.
506 current CPU frequency is 1.40 GHz.
507</pre>
508
509<p>
510Now play around with <c>cpufreq-set</c> to make sure frequency switching works.
511Run <c>cpufreq-set -g ondemand</c> for example to activate the ondemand
512governor and verify the change with <c>cpufreq-info</c>. If it doesn't work as
513expected, you might find help in the <uri link="#doc_chap8">Troubleshooting
514section</uri> in the end of this guide.
515</p>
516
517</body>
518</section>
519<section>
520<title>Automated frequency adaption</title>
521<body>
522
523<p>
524The above is quite nice, but not doable in daily life. Better let your system
525set the appropriate frequency automatically. There are many different
526approaches to do this. The following table gives a quick overview to help you
527decide on one of them. It's roughly separated in three categories <b>kernel</b>
528for approaches that only need kernel support, <b>daemon</b> for programs that
529run in the background and <b>graphical</b> for programs that provide a GUI for
530easy configuration and changes.
531</p> 478</p>
532 479
533<table> 480<table>
534<tr> 481<tr>
535 <th>Name</th> 482 <th>USE flag</th>
536 <th>Category</th> 483 <th>Description</th>
537 <th>Switch decision</th> 484 <th>Suggested when...</th>
538 <th>Kernel governors</th>
539 <th>Further governors</th>
540 <th>Comments</th>
541</tr>
542<tr> 485</tr>
543 <ti>'ondemand' governor</ti> 486<tr>
544 <ti>Kernel</ti> 487 <ti>acpi</ti>
545 <ti>CPU load</ti>
546 <ti>N.A.</ti>
547 <ti>N.A.</ti>
548 <ti>
549 Chooses maximal frequency on CPU load and slowly steps down when the CPU is
550 idle. Further tuning through files in
551 <path>/sys/devices/system/cpu/cpu0/cpufreq/ondemand/</path>. Still requires
552 userland tools (programs, scripts) if governor switching or similar is
553 desired.
554 </ti> 488 <ti>
555</tr> 489 Enable support for ACPI, allowing <c>cpufreqd</c> to be notified about
556<tr> 490 specific events as well as govern power through the ACPI interface
557 <ti>'conservative' governor</ti>
558 <ti>Kernel</ti>
559 <ti>CPU load</ti>
560 <ti>N.A.</ti>
561 <ti>N.A.</ti>
562 <ti> 491 </ti>
563 Unlike the ondemand governor, conversative doesn't jump to maximum 492 <ti>your laptop is not too old (~ year 2003 and later)</ti>
564 frequency when CPU load is high, but increases the frequency step by step. 493</tr>
565 Further tuning through files in 494<tr>
566 <path>/sys/devices/system/cpu/cpu0/cpufreq/ondemand/</path>. Still requires 495 <ti>apm</ti>
567 userland tools (programs, scripts) if governor switching or similar is
568 desired.
569 </ti> 496 <ti>
570</tr> 497 Enable support for APM, allowing <c>cpufreqd</c> to be notified about
571<tr> 498 specific events as well as govern power through the APM interface
572 <ti><uri link="http://mnm.uib.es/~gallir/cpudyn/">cpudyn</uri></ti>
573 <ti>Daemon</ti>
574 <ti>CPU load</ti>
575 <ti>Performance, powersave</ti>
576 <ti>Dynamic</ti>
577 <ti> 499 </ti>
578 Also supports disk standby - notice however that <e>laptop mode</e> in most 500 <ti>your laptop is very old</ti>
579 cases will do a better job. 501</tr>
502<tr>
503 <ti>lm_sensors</ti>
580 </ti> 504 <ti>
581</tr> 505 Enable support for the Linux hardware sensors (through
582<tr> 506 <c>sys-apps/lm_sensors</c>), allowing to switch profiles based on hardware
583 <ti><uri link="http://sourceforge.net/projects/cpufreqd/">cpufreqd</uri></ti> 507 sensor results
584 <ti>Daemon</ti>
585 <ti>Battery state, CPU load, temperature, running programs and more</ti>
586 <ti>All available</ti>
587 <ti>None</ti>
588 <ti> 508 </ti>
589 Sophisticated (but somewhat complicated) setup. Extendible through plugins
590 like sensor monitoring (lm_sensors) or coordinating some NVidia based
591 graphics card memory and core. Cpufreqd is SMP aware and can optionally be
592 controlled manually at runtime.
593 </ti> 509 <ti>
594</tr> 510 you want to use advanced events through lm_sensors
595<tr>
596 <ti> 511 </ti>
597 <uri link="http://www.deater.net/john/powernowd.html">powernowd</uri> 512</tr>
513<tr>
514 <ti>nforce2</ti>
598 </ti> 515 <ti>
599 <ti>Daemon</ti> 516 Enable support for NForce, allowing <c>cpufreqd</c> to change the NForce FSB
600 <ti>CPU load</ti> 517 clock and video card frequency
601 <ti>None</ti>
602 <ti>Passive, sine, aggressive</ti>
603 <ti> 518 </ti>
604 Supports SMP.
605 </ti> 519 <ti>
606</tr> 520 you have an NVidia graphical card based on the NForce chipset
607<tr>
608 <ti> 521 </ti>
609 <uri 522</tr>
610 link="http://fatcat.ftj.agh.edu.pl/~nelchael/index.php?cat=projs&amp;subcat=ncpufreqd&amp;language=en">ncpufreqd</uri> 523<tr>
524 <ti>nvidia</ti>
611 </ti> 525 <ti>
612 <ti>Daemon</ti> 526 Enable support for NVidia graphical card configuration (through the NVidia
613 <ti>Temperature</ti> 527 <e>nvclock</e> interface), allowing <c>cpufreqd</c> to change the video card
614 <ti>None</ti> 528 frequency of NVidia graphical cards
615 <ti>Powersave, performance</ti>
616 <ti> 529 </ti>
617 Toggles the used governor between performance and powersave depending on
618 system temperature. Very useful on laptops with notorious heat problems.
619 </ti> 530 <ti>
620</tr> 531 you have an NVidia graphical card
621<tr>
622 <ti><uri link="http://www.goop.org/~jeremy/speedfreq/">speedfreq</uri></ti>
623 <ti>Daemon</ti>
624 <ti>CPU load</ti>
625 <ti>None</ti>
626 <ti>Dynamic, powersave, performance, fixed speed</ti>
627 <ti> 532 </ti>
628 Easy to configure with a nice client/server interface. Requires a 2.6 533</tr>
629 kernel. Unmaintained, broken and thus removed from Portage. Please switch 534<tr>
630 to cpufreqd if you're still using it. 535 <ti>pmu</ti>
631 </ti> 536 <ti>
632</tr> 537 Enable the Power Management Unit plug-in of <c>cpufreqd</c>. This allows the
633<tr> 538 software to poll the Linux kernel Power Supply interface, getting more
634 <ti><uri link="http://cpuspeedy.sourceforge.net/">gtk-cpuspeedy</uri></ti> 539 detailed information on battery charge.
635 <ti>Graphical</ti>
636 <ti>None</ti>
637 <ti>None</ti>
638 <ti>None</ti>
639 <ti> 540 </ti>
640 Gnome application, a graphical tool to set CPU frequency manually. It does
641 not offer any automation.
642 </ti> 541 <ti>
643</tr> 542 your laptop does not support ACPI or APM
644<tr>
645 <ti>klaptopdaemon</ti>
646 <ti>Graphical</ti>
647 <ti>Battery state</ti>
648 <ti>All available</ti>
649 <ti>None</ti>
650 <ti>
651 KDE only, 'ondemand' governor required for dynamic frequency scaling.
652 </ti> 543 </ti>
653</tr> 544</tr>
654</table> 545</table>
655 546
656<p> 547<p>
657While adjusting the frequency to the current load looks simple at a first 548The USE flags <c>acpi</c>, <c>apm</c> and <c>pmu</c> overlap, so you should only
658glance, it's not such a trivial task. A bad algorithm can cause switching 549have one active. If your laptop is sufficiently recent, <c>acpi</c> is your best
659between two frequencies all the time or wasting energy when setting frequency 550bet. If not, <c>apm</c> offers all that is needed. When even APM isn't
660to an unnecessary high level. 551supported, you can try <c>pmu</c>.
661</p>
662
663<p> 552</p>
664Which one to choose? If you have no idea about it, try <c>cpufreqd</c>: 553
554<p>
555With the USE flags configured, it is time to install <c>cpufreqd</c>.
665</p> 556</p>
666 557
667<pre caption="Installing cpufreqd"> 558<pre caption="Installing cpufreqd">
668# <i>emerge cpufreqd</i> 559# <i>emerge cpufreqd</i>
669</pre> 560</pre>
670 561
562</body>
563</section>
564<section>
565<title>Configuration</title>
566<body>
567
568<p>
569The <c>cpufreqd</c> application monitors the status of the system through
570several plugins. Based on the feedback it receives from those plugins, it will
571adjust the policy used to govern the CPU frequency.
671<p> 572</p>
573
574<p>
672<c>cpufreqd</c> can be configured by editing <path>/etc/cpufreqd.conf</path>. 575<c>cpufreqd</c> can be configured by editing <path>/etc/cpufreqd.conf</path>. It
673The default one that ships with cpufreqd may look a bit confusing. I recommend 576contains three different sections:
674replacing it with the one from Gentoo developer Henrik Brix Andersen (see 577</p>
675below). Please notice that you need cpufreqd-2.0.0 or later. Earlier versions 578
676have a different syntax for the config file. 579<ol>
580 <li>
581 The <c>[General]...[/General]</c> section contains general configuration
582 information
583 </li>
584 <li>
585 The <c>[Profile]...[/Profile]</c> section defines the policies that the
586 <c>cpufreqd</c> daemon can switch to. The section is very similar to the
587 information you use when manually setting the CPU frequency policy using
588 <c>cpufreq-set</c>.
589 </li>
590 <li>
591 The <c>[Rule]...[/Rule]</c> section is the work-horse of the <c>cpufreqd</c>
592 daemon, defining when the daemon decides to switch to a different profile.
593 </li>
594</ol>
595
677</p> 596<p>
597Let's take a quick look at an example rule.
598</p>
678 599
679<pre caption="/etc/cpufreqd.conf (cpufreqd-2.0.0 and later)"> 600<pre caption="Sample cpufreqd rule">
680[General]
681pidfile=/var/run/cpufreqd.pid
682poll_interval=3
683enable_plugins=acpi_ac, acpi_battery
684enable_remote=1
685remote_group=wheel
686verbosity=5
687[/General]
688
689[Profile] 601[Profile]
690name=ondemand 602name=On Demand High
691minfreq=0% 603minfreq=40%
692maxfreq=100% 604maxfreq=100%
693policy=ondemand 605policy=ondemand
694[/Profile] 606[/Profile]
695 607
696[Profile]
697name=conservative
698minfreq=0%
699maxfreq=100%
700policy=conservative
701[/Profile]
702
703[Profile]
704name=powersave
705minfreq=0%
706maxfreq=100%
707policy=powersave
708[/Profile]
709
710[Profile]
711name=performance
712minfreq=0%
713maxfreq=100%
714policy=performance
715[/Profile]
716
717[Rule] 608[Rule]
718name=battery 609name=AC Off - High Power
719ac=off 610ac=off
720profile=conservative 611battery_interval=70-100
612profile=On Demand High
721[/Rule] 613[/Rule]
722
723[Rule]
724name=battery_low
725ac=off
726battery_interval=0-10
727profile=powersave
728[/Rule]
729
730[Rule]
731name=ac
732ac=on
733profile=ondemand
734[/Rule]
735</pre> 614</pre>
736 615
616<p>
617In the above example, <c>cpufreqd</c> will switch the system to the <e>On Demand
618High</e> profile (also shown in the above excerpt). This profile by itself uses
619the <c>ondemand</c> governor with a minimum frequency of 40% (iow, a CPU of 2Ghz
620will have by this policy a minimum frequency of 800Mhz).
737<p> 621</p>
738Now you can start the cpufreqd daemon. Add it to the <c>default</c> and 622
739<c>battery</c> runlevel as well. 623<p>
624As you can see, the <c>cpufreqd</c> application can offer a more granular
625approach on CPU frequency scaling. But not only that, you can tweak the CPU
626frequency scaling based on various other metrics available. The default
627configuration offers a sample rule for when you watch a movie, where you want
628maximum performance, unless the CPU temperature is getting too high.
629</p>
630
631<p>
632When you have configured <c>cpufreqd</c>, it is time to start it (and make sure
633the service is loaded automatically). Make sure that CPU frequency handling by
634other tools (like <c>laptop-mode-tools</c>) is disabled!
740</p> 635</p>
741 636
742<pre caption="Starting cpufreqd"> 637<pre caption="Starting cpufreqd">
743# <i>rc-update add cpufreqd default battery</i> 638# <i>rc-update add cpufreqd default</i>
744# <i>rc</i> 639# <i>/etc/init.d/cpufreqd start</i>
745</pre>
746
747<p>
748Sometimes it can be desirable to select another policy than the daemon chooses,
749for example when battery power is low, but you know that AC will be available
750soon. In that case you can turn on cpufreqd's manual mode with <c>cpufreqd-set
751manual</c> and select one of your configured policies (as listed by
752<c>cpufreqd-get</c>). You can leave manual mode by executing <c>cpufreqd-set
753dynamic</c>.
754</p> 640</pre>
755
756<warn>
757Do not run more than one of the above programs at the same time. It may cause
758confusion like switching between two frequencies all the time.
759</warn>
760
761</body>
762</section>
763<section>
764<title>Verifying the result</title>
765<body>
766
767<p>
768The last thing to check is that your new policies do a good job. An easy way to
769do so is monitoring CPU speed while working with your laptop:
770</p>
771
772<pre caption="Monitoring CPU speed">
773# <i>watch grep \"cpu MHz\" /proc/cpuinfo</i>
774</pre>
775
776<p>
777If <path>/proc/cpuinfo</path> doesn't get updated (see <uri
778link="#doc_chap8">Troubleshooting</uri>), monitor the CPU frequency with:
779</p>
780
781<pre caption="Alternative CPU speed monitoring">
782# <i>watch x86info -mhz</i>
783</pre>
784
785<p>
786Depending on your setup, CPU speed should increase on heavy load, decrease on
787no activity or just stay at the same level. When using <c>cpufreqd</c> and
788verbosity set to 5 or higher in <path>cpufreqd.conf</path> you'll get
789additional information about what's happening reported to <c>syslog</c>.
790</p>
791 641
792</body> 642</body>
793</section> 643</section>
794</chapter> 644</chapter>
795 645
796<chapter> 646<chapter>
797<title>LCD Power Management</title> 647<title>Resources</title>
798<section>
799<body>
800
801<p>
802As you can see in <uri link="#doc_chap1_fig1">figure 1.1</uri>, the LCD
803display consumes the biggest part of energy (might not be the case for
804non-mobile CPU's). Thus it's quite important not only to shut the display off
805when not needed, but also to reduce it's backlight if possible. Most laptops
806offer the possibility to control the backlight dimming.
807</p>
808
809</body>
810</section> 648<section>
811<section> 649<title>Tools</title>
812<title>Standby settings</title>
813<body>
814
815<p>
816The first thing to check is the standby/suspend/off timings of the display. As
817this depends heavily on your windowmanager, I'll let you figure it out
818yourself. Just two common places: Blanking the terminal can be done with
819<c>setterm -blank &lt;number-of-minutesM&gt;</c>, <c>setterm -powersave on</c>
820and <c>setterm -powerdown &lt;number-of-minutesM&gt;</c>. For X.org, modify
821<path>/etc/X11/xorg.conf</path> similar to this:
822</p>
823
824<pre caption="LCD suspend settings in X.org and XFree86">
825Section "ServerLayout"
826 Identifier [...]
827 [...]
828 Option "BlankTime" "5" <comment># Blank the screen after 5 minutes (Fake)</comment>
829 Option "StandbyTime" "10" <comment># Turn off screen after 10 minutes (DPMS)</comment>
830 Option "SuspendTime" "20" <comment># Full suspend after 20 minutes</comment>
831 Option "OffTime" "30" <comment># Turn off after half an hour</comment>
832 [...]
833EndSection
834
835[...]
836
837Section "Monitor"
838 Identifier [...]
839 Option "DPMS" "true"
840 [...]
841EndSection
842</pre>
843
844<p>
845This is the same for XFree86 and <path>/etc/X11/XF86Config</path>.
846</p>
847
848</body> 650<body>
849</section>
850<section>
851<title>Backlight dimming</title>
852<body>
853
854<p>
855Probably 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
857battery 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
859appropriate 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
861described below.
862</p>
863
864<warn>
865Support for setting brightness is marked experimental in ibm-acpi. It accesses
866hardware directly and may cause severe harm to your system. Please read the
867<uri link="http://ibm-acpi.sourceforge.net/">ibm-acpi website</uri>
868</warn>
869
870<p>
871To be able to set the brightness level, the ibm_acpi module has to be loaded
872with the experimental parameter.
873</p>
874
875<pre caption="automatically loading the ibm_acpi module">
876<comment>(Please read the warnings above before doing this!)</comment>
877# <i>echo "options ibm_acpi experimental=1" >> /etc/modules.d/ibm_acpi</i>
878# <i>/sbin/modules-update</i>
879# <i>echo ibm_acpi >> /etc/modules.autoload.d/kernel-2.6</i>
880# <i>modprobe ibm_acpi</i>
881</pre>
882
883<p>
884This should work without error messages and a file
885<path>/proc/acpi/ibm/brightness</path> should be created after loading the
886module. An init script will take care of choosing the brightness according to
887the power source.
888</p>
889
890<pre caption="/etc/conf.d/lcd-brightness">
891<comment># See /proc/acpi/ibm/brightness for available values</comment>
892<comment># Please read /usr/src/linux/Documentation/ibm-acpi.txt</comment>
893
894<comment># brigthness level in ac mode. Default is 7.</comment>
895BRIGHTNESS_AC=7
896
897<comment># brightness level in battery mode. Default is 4.</comment>
898BRIGHTNESS_BATTERY=4
899</pre>
900
901<pre caption="/etc/init.d/lcd-brightness">
902#!/sbin/runscript
903
904set_brightness() {
905 if on_ac_power
906 then
907 LEVEL=${BRIGHTNESS_AC:-7}
908 else
909 LEVEL=${BRIGHTNESS_BATTERY:-4}
910 fi
911
912 if [ -f /proc/acpi/ibm/brightness ]
913 then
914 ebegin "Setting LCD brightness"
915 echo "level ${LEVEL}" > /proc/acpi/ibm/brightness
916 eend $?
917 elif [[ -e /usr/bin/acpitool &amp;&amp; -n $(acpitool -T | grep "LCD brightness") ]]
918 then
919 ebegin "Setting LCD brightness"
920 acpitool -l $LEVEL >/dev/null || ewarn "Unable to set lcd brightness"
921 eend $?
922 else
923 ewarn "Setting LCD brightness is not supported."
924 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"
926 fi
927}
928
929start() {
930 set_brightness
931}
932
933stop () {
934 set_brightness
935}
936</pre>
937
938<p>
939When done, make sure brightness is adjusted automatically by adding it to the
940battery runlevel.
941</p>
942
943<pre caption="Enabling automatic brightness adjustment">
944# <i>chmod +x /etc/init.d/lcd-brightness</i>
945# <i>rc-update add lcd-brightness battery</i>
946# <i>rc</i>
947</pre>
948
949</body>
950</section>
951</chapter>
952
953<chapter>
954<title>Disk Power Management</title>
955<section>
956<body>
957
958<p>
959Hard disks consume less energy in sleep mode. Therefore it makes sense to
960activate power saving features whenever the hard disk is not used for a certain
961amount of time. I'll show you two alternative possibilities to do it. First,
962laptop-mode will save most energy due to several measures which prevent or at
963least delay write accesses. The drawback is that due to the delayed write
964accesses a power outage or kernel crash will be more dangerous for data loss.
965If you don't like this, you have to make sure that there are no processes which
966write to your hard disk frequently. Afterwards you can enable power saving
967features of your hard disk with <c>hdparm</c> as the second alternative.
968</p>
969
970</body>
971</section>
972<section>
973<title>Increasing idle time - laptop-mode</title>
974<body>
975
976<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
979written to disk on read calls or after 10 minutes (instead of 30 seconds). This
980minimizes the time the hard disk needs to be spun up.
981</p>
982
983<pre caption="Automated start of laptop-mode">
984# <i>emerge laptop-mode-tools</i>
985</pre>
986
987<p>
988<c>laptop-mode-tools</c> has its configuration file in
989<path>/etc/laptop-mode/laptop-mode.conf</path>. Adjust it the way you like it,
990it's well commented. Run <c>rc-update add laptop_mode battery</c> to start it
991automatically.
992</p>
993
994<p>
995Recent versions (1.11 and later) of laptop-mode-tools include a new tool
996<c>lm-profiler</c>. It will monitor your system's disk usage and running
997network services and suggests to disable unneeded ones. You can either disable
998them through laptop-mode-tools builtin runlevel support (which will be reverted
999by Gentoo's <c>/sbin/rc</c>) or use your <c>default</c>/<c>battery</c>
1000runlevels (recommended).
1001</p>
1002
1003<pre caption="Sample output from running lm-profiler">
1004# <i>lm-profiler</i>
1005Profiling session started.
1006Time remaining: 600 seconds
1007[4296896.602000] amarokapp
1008Time remaining: 599 seconds
1009[4296897.714000] sort
1010[4296897.970000] mv
1011Time remaining: 598 seconds
1012Time remaining: 597 seconds
1013[4296900.482000] reiserfs/0
1014</pre>
1015
1016<p>
1017After profiling your system for ten minutes, lm-profiler will present a list of
1018services which might have caused disk accesses during that time.
1019</p>
1020
1021<pre caption="lm-profiler suggests to disable some services">
1022Program: "atd"
1023Reason: standard recommendation (program may not be running)
1024Init script: /etc/init.d/atd (GUESSED)
1025
1026Do you want to disable this service in battery mode? [y/N]: <i>n</i>
1027</pre>
1028
1029<p>
1030To disable atd as suggested in the example above, you would run <c>rc-update
1031del atd battery</c>. Be careful not to disable services that are needed for
1032your system to run properly - <c>lm-profiler</c> is likely to generate some
1033false positives. Do not disable a service if you are unsure whether it's
1034needed.
1035</p>
1036
1037</body>
1038</section>
1039<section>
1040<title>Limiting Write Accesses</title>
1041<body>
1042
1043<p>
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
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
1048logged and thus don't create disk traffic. <c>Cups</c> writes to disk
1049periodically, so consider shutting it down and only enable it manually when
1050needed.
1051</p>
1052
1053<pre caption="Disabling cups in battery mode">
1054# <i>rc-update del cupsd battery</i>
1055</pre>
1056
1057<p>
1058You can also use <c>lm-profiler</c> from laptop-mode-tools (see above) to find
1059services to disable. Once you eliminated all of them, go on with configuring
1060hdparm.
1061</p>
1062
1063</body>
1064</section>
1065<section>
1066<title>hdparm</title>
1067<body>
1068
1069<p>
1070The second possibility is using a small script and <c>hdparm</c>. Skip this if
1071you are using laptop-mode. Otherwise, create <path>/etc/init.d/pmg_hda</path>:
1072</p>
1073
1074<pre caption="Using hdparm for disk standby">
1075#!/sbin/runscript
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>
1093
1094<p>
1095See <c>man hdparm</c> for the options. If your script is ready, add it to the
1096battery runlevel.
1097</p>
1098
1099<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>
1103</pre>
1104
1105<impo>
1106Be careful with sleep/spin down settings of your hard drive. Setting it to
1107small values might wear out your drive and lose warranty.
1108</impo>
1109
1110</body>
1111</section>
1112<section>
1113<title>Other tricks</title>
1114<body>
1115
1116<p>
1117Another possibility is to deactivate swap in battery mode. Before writing a
1118swapon/swapoff switcher, make sure there is enough RAM and swap isn't used
1119heavily, otherwise you'll be in big problems.
1120</p>
1121
1122<p>
1123If you don't want to use laptop-mode, it's still possible to minimize disk
1124access by mounting certain directories as <c>tmpfs</c> - write accesses are not
1125stored on a disk, but in main memory and get lost with unmounting. Often it's
1126useful to mount <path>/tmp</path> like this - you don't have to pay special
1127attention as it gets cleared on every reboot regardless whether it was mounted
1128on disk or in RAM. Just make sure you have enough RAM and no program (like a
1129download client or compress utility) needs extraordinary much space in
1130<path>/tmp</path>. To activate this, enable tmpfs support in your kernel and
1131add a line to <path>/etc/fstab</path> like this:
1132</p>
1133
1134<pre caption="Editing /etc/fstab to make /tmp even more volatile">
1135none /tmp tmpfs size=32m 0 0
1136</pre>
1137
1138<warn>
1139Pay attention to the size parameter and modify it for your system. If you're
1140unsure, don't try this at all, it can become a performance bottleneck easily. In
1141case you want to mount <path>/var/log</path> like this, make sure to merge the
1142log files to disk before unmounting. They are essential. Don't attempt to mount
1143<path>/var/tmp</path> like this. Portage uses it for compiling...
1144</warn>
1145
1146</body>
1147</section>
1148</chapter>
1149
1150<chapter>
1151<title>Power Management For Other Devices</title>
1152<section>
1153<title>Graphics Cards</title>
1154<body>
1155
1156<p>
1157In case you own an ATI graphics card supporting PowerPlay (dynamic clock
1158scaling for the 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
1160<c>DynamicClocks</c> option in the Device section. Please notice that this
1161feature will lead to crashes on some systems.
1162</p>
1163
1164<pre caption="Enabling ATI PowerPlay support in X.org">
1165Section "Device"
1166[...]
1167Option "DynamicClocks" "on"
1168EndSection
1169</pre>
1170
1171</body>
1172</section>
1173<section>
1174<title>Wireless Power Management</title>
1175<body>
1176
1177<p>
1178Wireless LAN cards consume quite a bit of energy. Put them in Power Management
1179mode in analogy to the <c>pmg_hda</c> script.
1180</p>
1181
1182<note>
1183This script assumes your wireless interface is called <c>wlan0</c>; replace
1184this with the actual name of your interface.
1185</note>
1186
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>
1210
1211<pre caption="Power Management for WLAN">
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>
1216
1217</body>
1218</section>
1219<section>
1220<title>USB Power Management</title>
1221<body>
1222
1223<p>
1224There are two problems with USB devices regarding energy consumption: First,
1225devices like USB mice, digital cameras or USB sticks consume energy while
1226plugged in. You cannot avoid this (nevertheless remove them in case they're not
1227needed). Second, when there are USB devices plugged in, the USB host controller
1228periodically accesses the bus which in turn prevents the CPU from going into
1229sleep mode. The kernel offers an experimental option to enable suspension of
1230USB devices through driver calls or one of the <path>power/state</path> files
1231in <path>/sys</path>.
1232</p>
1233
1234<pre caption="Enabling USB suspend support in the kernel">
1235Device Drivers
1236 USB support
1237 [*] Support for Host-side USB
1238 [*] USB suspend/resume (EXPERIMENTAL)
1239</pre>
1240
1241</body>
1242</section>
1243</chapter>
1244
1245<chapter>
1246<title>Sleep States: sleep, standby, and suspend to disk</title>
1247<section>
1248<body>
1249
1250<p>
1251ACPI defines different sleep states. The more important ones are
1252</p>
1253 651
1254<ul> 652<ul>
1255 <li>S1 aka Standby</li> 653 <li>
1256 <li>S3 aka Suspend to RAM aka Sleep</li> 654 <uri link="http://samwel.tk/laptop_mode/">Laptop Mode Tools Homepage</uri>,
1257 <li>S4 aka Suspend to Disk aka Hibernate</li> 655 includes <uri link="http://samwel.tk/laptop_mode/laptop_mode">About laptop
656 mode</uri>.
657 </li>
658 <li>
659 <uri link="http://www.lesswatts.org/projects/powertop/">PowerTOP</uri>, an
660 interactive application helping users to find out which processes are
661 forcing wakeups on the CPU most often.
662 </li>
1258</ul> 663</ul>
1259 664
1260<p>
1261They can be called whenever the system is not in use, but a shutdown is not
1262wanted due to the long boot time.
1263</p>
1264
1265</body> 665</body>
1266</section>
1267<section> 666</section>
1268<title>Sleep (S3)</title>
1269<body>
1270
1271<p>
1272The ACPI support for these sleep states is marked experimental for good reason.
1273APM sleep states seem to be more stable, however you can't use APM and ACPI
1274together.
1275</p>
1276
1277<pre caption="Kernel configuration for the various suspend types">
1278 Power Management Options ---&gt;
1279 [*] Power Management support
1280 ACPI (Advanced Configuration and Power Interface) Support ---&gt;
1281 [*] ACPI Support
1282 [*] Sleep States
1283</pre>
1284
1285<p>
1286Once your kernel is properly configured, you can use the
1287<c>hibernate-script</c> to activate suspend or sleep mode. Let's install that
1288first.
1289</p>
1290
1291<pre caption="Installing the hibernate-script">
1292# <i>emerge hibernate-script</i>
1293</pre>
1294
1295<p>
1296Some configuration has to be done in <path>/etc/hibernate</path> The default
1297package introduces two configuration files <path>hibernate.conf</path> and
1298<path>ram.conf</path>.
1299</p>
1300
1301<p>
1302To configure sleep, edit <path>ram.conf</path> in <path>/etc/hibernate</path>.
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>
1309
1310<p>
1311Ready? 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
1313like <c>Fn</c> to resume from sleep.
1314</p>
1315
1316<pre caption="Calling sleep">
1317# <i>hibernate-ram</i>
1318</pre>
1319
1320<p>
1321If 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
1323creating a symlink <path>/usr/sbin/hibernate-standby</path> pointing to
1324<path>/usr/sbin/hibernate</path>. S3 and S4 are the more interesting sleep
1325states due to greater energy savings however.
1326</p>
1327
1328</body>
1329</section> 667<section>
1330<section> 668<title>Articles and Guides</title>
1331<title>Hibernate (S4)</title>
1332<body>
1333
1334<p>
1335This section introduces hibernation, where a snapshot of the running system is
1336written to disk before powering off. On resume, the snapshot is loaded and you
1337can go on working at exactly the point you called hibernate before.
1338</p>
1339
1340<warn>
1341Don't exchange non hot-pluggable hardware when suspended. Don't attempt to load
1342a snapshot with a different kernel image than the one it was created with.
1343Shutdown any NFS or samba server/client before hibernating.
1344</warn>
1345
1346<p>
1347There are two different implementations for S4. The original one is swsusp,
1348then there is the newer suspend2 with a nicer interface (including fbsplash
1349support). A <uri link="http://suspend2.net/features.html#compare"> feature
1350comparison</uri> is available at the <uri link="http://suspend2.net"> suspend2
1351Homepage</uri>. There used to be Suspend-to-Disk (pmdisk), a fork of swsusp,
1352but it has been merged back.
1353</p>
1354
1355<p>
1356Suspend2 is not included in the mainline kernel yet, therefore you either have
1357to patch your kernel sources with the patches provided by <uri
1358link="http://suspend2.net">suspend2.net</uri> or use
1359<c>sys-kernel/suspend2-sources</c>.
1360</p>
1361
1362<p>
1363The kernel part for both swusp and suspend2 is as follows:
1364</p>
1365
1366<pre caption="Kernel configuration for the various suspend types">
1367Power Management Options ---&gt;
1368 <comment>(hibernate with swsusp)</comment>
1369 [*] Software Suspend
1370 <comment>(replace /dev/SWAP with your swap partition)</comment>
1371 (/dev/SWAP) Default resume partition
1372
1373 <comment>(hibernate with suspend2)</comment>
1374 Software Suspend 2
1375 --- Image Storage (you need at least one writer)
1376 [*] File Writer
1377 [*] Swap Writer
1378 --- General Options
1379 [*] LZF image compression
1380 <comment>(replace /dev/SWAP with your swap partition)</comment>
1381 (swap:/dev/SWAP) Default resume device name
1382 [ ] Allow Keep Image Mode
1383</pre>
1384
1385<p>
1386The configuration for swsusp is rather easy. If you didn't store the location
1387of your swap partition in the kernel config, you can also pass it as a
1388parameter with the <c>resume=/dev/SWAP</c> directive. If booting is not
1389possible due to a broken image, use the <c>noresume</c> kernel parameter. The
1390<c>hibernate-cleanup</c> init script invalidates swsusp images during the boot
1391process.
1392</p>
1393
1394<pre caption="Invalidating swsusp images during the boot process">
1395# <i>rc-update add hibernate-cleanup boot</i>
1396</pre>
1397
1398<p>
1399To activate hibernate with swsusp, use the hibernate script and set
1400<c>UseSysfsPowerState disk</c> in <path>/etc/hibernate/hibernate.conf</path>.
1401</p>
1402
1403<warn>
1404Backup 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
1406with X running, but not logged in.
1407</warn>
1408
1409<p>
1410If 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
1412mode. There are configuration options for this in <path>hibernate.conf</path>
1413</p>
1414
1415<pre caption="Hibernating with swsusp">
1416# <i>nano -w /etc/hibernate.conf</i>
1417<comment>(Make sure you have a backup of your data)</comment>
1418# <i>hibernate</i>
1419</pre>
1420
1421<p>
1422The following section discusses the setup of suspend2 including fbsplash
1423support for a nice graphical progress bar during suspend and resume.
1424</p>
1425
1426<p>
1427The first part of the configuration is similar to the configuration of swsusp.
1428In case you didn't store the location of your swap partition in the kernel
1429config, you have to pass it as a kernel parameter with the
1430<c>resume2=swap:/dev/SWAP</c> directive. If booting is not possible due to a
1431broken image, append the <c>noresume2</c> parameter. Additionally, the
1432<c>hibernate-cleanup</c> init script invalidates suspend2 images during the
1433boot process.
1434</p>
1435
1436<pre caption="Invalidating suspend2 images during the boot process">
1437# <i>rc-update add hibernate-cleanup boot</i>
1438</pre>
1439
1440<p>
1441Now edit <path>/etc/hibernate/hibernate.conf</path>, enable the <c>suspend2</c>
1442section and comment everything in the <c>sysfs_power_state</c> and
1443<c>acpi_sleep</c> sections. Do not enable the <c>fbsplash</c> part in global
1444options yet.
1445</p>
1446
1447<pre caption="Hibernating with suspend2">
1448# <i>nano -w /etc/hibernate.conf</i>
1449<comment>(Make sure you have a backup of your data)</comment>
1450# <i>hibernate</i>
1451</pre>
1452
1453<p>
1454Please configure <c>fbsplash</c> now if you didn't do already. To enable
1455fbsplash support during hibernation, the <c>sys-apps/suspend2-userui</c>
1456package is needed. Additionally, you've got to enable the <c>fbsplash</c> USE
1457flag.
1458</p>
1459
1460<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>
1463# <i>emerge suspend2-userui</i>
1464</pre>
1465
1466<p>
1467The ebuild tells you to make a symlink to the theme you want to use. For
1468example, to use the <c>livecd-2005.1</c> theme, run the following command:
1469</p>
1470
1471<pre caption="Using the livecd-2005.1 theme during hibernation">
1472# <i>ln -sfn /etc/splash/livecd-2005.1 /etc/splash/suspend2</i>
1473</pre>
1474
1475<p>
1476If you don't want a black screen in the first part of the resume process, you
1477have to add the <c>suspend2ui_fbsplash</c> tool to your initrd image. Assuming
1478you created the initrd image with <c>splash_geninitramfs</c> and saved it as
1479<path>/boot/fbsplash-emergence-1024x768</path>, here's how to do that.
1480</p>
1481
1482<pre caption="Adding suspend2ui_fbsplash to an initrd image">
1483# <i>mount /boot</i>
1484# <i>mkdir ~/initrd.d</i>
1485# <i>cp /boot/fbsplash-emergence-1024x768 ~/initrd.d/</i>
1486# <i>cd ~/initrd.d</i>
1487# <i>gunzip -c fbsplash-emergence-1024x768 | cpio -idm --quiet -H newc</i>
1488# <i>rm fbsplash-emergence-1024x768</i>
1489# <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>
1491</pre>
1492
1493<p>
1494Afterwards adjust <path>grub.conf</path> respectively <path>lilo.conf</path> so
1495that your suspend2 kernel uses
1496<path>/boot/fbsplash-suspend2-emergence-1024x768</path> as initrd image. You
1497can now test a dry run to see if everything is setup correctly.
1498</p>
1499
1500<pre caption="Test run for fbsplash hibernation">
1501# <i>suspend2ui_fbsplash -t</i>
1502</pre>
1503
1504<p>
1505Afterwards open <path>/etc/hibernate/hibernate.conf</path> again and activate
1506the fbsplash options. Execute <c>hibernate</c> and enjoy.
1507</p>
1508
1509</body> 669<body>
1510</section>
1511</chapter>
1512 670
1513<chapter> 671<ul>
1514<title>Troubleshooting</title> 672 <li>
1515<section> 673 A ThinkWiki article on <uri
1516<body> 674 link="http://www.thinkwiki.org/wiki/How_to_reduce_power_consumption">How to
1517 675 reduce power consumption</uri> (on Linux). This article offers an exhaustive
1518<p> 676 list of measures one can take. However, it should be noted that the laptop
1519<e>Q:</e> I'm trying to change the CPU frequency, but 677 mode tools implements the majority of these (if properly configured).
1520<path>/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor</path> does not 678 </li>
1521exist. 679</ul>
1522</p>
1523
1524<p>
1525<e>A:</e> Make sure your processor supports CPU frequency scaling and you chose
1526the right CPUFreq driver for your processor. Here is a list of processors that
1527are supported by cpufreq (kernel 2.6.7): ARM Integrator, ARM-SA1100,
1528ARM-SA1110, AMD Elan - SC400, SC410, AMD mobile K6-2+, AMD mobile K6-3+, AMD
1529mobile Duron, AMD mobile Athlon, AMD Opteron, AMD Athlon 64, Cyrix Media GXm,
1530Intel mobile PIII and Intel mobile PIII-M on certain chipsets, Intel Pentium 4,
1531Intel Xeon, Intel Pentium M (Centrino), National Semiconductors Geode GX,
1532Transmeta Crusoe, VIA Cyrix 3 / C3, UltraSPARC-III, SuperH SH-3, SH-4, several
1533"PowerBook" and "iBook2" and various processors on some ACPI 2.0-compatible
1534systems (only if "ACPI Processor Performance States" are available to the
1535ACPI/BIOS interface).
1536</p>
1537
1538<p>
1539<e>Q:</e> My laptop supports frequency scaling, but
1540<path>/sys/devices/system/cpu/cpu0/cpufreq/</path> is empty.
1541</p>
1542
1543<p>
1544<e>A:</e> Look for ACPI related error messages with <c>dmesg | grep ACPI</c>.
1545Try to update the BIOS, especially if a broken DSDT is reported. You can also
1546try to fix it yourself (which is beyond the scope of this guide).
1547</p>
1548
1549<p>
1550<e>Q:</e> My laptop supports frequency scaling, but according to
1551<path>/proc/cpuinfo</path> the speed never changes.
1552</p>
1553
1554<p>
1555<e>A:</e> Probably you have activated symmetric multiprocessing support
1556(CONFIG_SMP) in your kernel. Deactivate it and it should work. Some older
1557kernels had a bug causing this. In that case, run <c>emerge x86info</c>, update
1558your kernel as asked and check the current frequency with
1559<c>x86info -mhz</c>.
1560</p>
1561
1562<p>
1563<e>Q:</e> I can change the CPU frequency, but the range is not as wide as in
1564another OS.
1565</p>
1566
1567<p>
1568<e>A:</e> You can combine frequency scaling with ACPI throttling to get a lower
1569minimum frequency. Notice that throttling doesn't save much energy and is
1570mainly used for thermal management (keeping your laptop cool and quiet). You
1571can read the current throttling state with <c>cat
1572/proc/acpi/processor/CPU/throttling</c> and change it with <c>echo -n "0:x" >
1573/proc/acpi/processor/CPU/limit</c>, where x is one of the Tx states listed in
1574<path>/proc/acpi/processor/CPU/throttling</path>.
1575</p>
1576
1577<p>
1578<e>Q:</e> When configuring the kernel, powersave, performance and userspace
1579governors show up, but that ondemand thing is missing. Where do I get it?
1580</p>
1581
1582<p>
1583<e>A:</e> The ondemand governor is only included in recent kernel sources. Try
1584updating them.
1585</p>
1586
1587<p>
1588<e>Q:</e> Battery life time seems to be worse than before.
1589</p>
1590
1591<p>
1592<e>A:</e> Check your BIOS settings. Maybe you forgot to re-enable some of the
1593settings.
1594</p>
1595
1596<p>
1597<e>Q:</e> My battery is charged, but KDE reports there would be 0% left and
1598immediately shuts down.
1599</p>
1600
1601<p>
1602<e>A:</e> Check that battery support is compiled into your kernel. If you use
1603it as a module, make sure the module is loaded.
1604</p>
1605
1606<p>
1607<e>Q:</e> My system logger reports things like "logger: ACPI group battery /
1608action battery is not defined".
1609</p>
1610
1611<p>
1612<e>A:</e> This message is generated by the <path>/etc/acpi/default.sh</path>
1613script that is shipped with acpid. You can safely ignore it. If you like to get
1614rid of it, you can comment the appropriate line in
1615<path>/etc/acpi/default.sh</path> as shown below:
1616</p>
1617
1618<pre caption="Disabling warnings about unknown acpi events">
1619 *) # logger "ACPI action $action is not defined"
1620</pre>
1621
1622<p>
1623<e>Q:</e> I have a Dell Inspiron 51XX and I don't get any ACPI events.
1624</p>
1625
1626<p>
1627<e>A:</e> This seems to be a kernel bug. Read on <uri
1628link="http://bugme.osdl.org/show_bug.cgi?id=1752">here</uri>.
1629</p>
1630
1631<p>
1632<e>Q:</e> I activated the <c>DynamicClocks</c> option in <path>xorg.conf</path>
1633and now X.org crashes / the screen stays black / my laptop doesn't shutdown
1634properly.
1635</p>
1636
1637<p>
1638<e>A:</e> This happens on some systems. You have to disable
1639<c>DynamicClocks</c>.
1640</p>
1641
1642<p>
1643<e>Q:</e> I want to use suspend2, but it tells me my swap partition is too
1644small. Resizing is not an option.
1645</p>
1646
1647<p>
1648<e>A:</e> If there is enough free space on your system, you can use the
1649filewriter instead of the swapwriter. The <c>hibernate-script</c> supports it
1650as well. More information can be found in
1651<path>/usr/src/linux/Documentation/power/suspend2.txt</path>.
1652</p>
1653
1654<p>
1655<e>Q:</e> I just bought a brand new battery, but it only lasts for some
1656minutes! What am I doing wrong?
1657</p>
1658
1659<p>
1660<e>A:</e> First follow your manufacturer's advice on how to charge the battery
1661correctly.
1662</p>
1663
1664<p>
1665<e>Q:</e> The above didn't help. What should I do then?
1666</p>
1667
1668<p>
1669<e>A:</e> Some batteries sold as "new" are in fact old ones. Try the following:
1670</p>
1671
1672<pre caption="Querying battery state">
1673$ <i>grep capacity /proc/acpi/battery/BAT0/info</i>
1674design capacity: 47520 mWh
1675last full capacity: 41830 mWh
1676</pre>
1677
1678<p>
1679If the "last full capacity" differs significantly from the design capacity,
1680your battery is probably broken. Try to claim your warranty.
1681</p>
1682
1683<p>
1684<e>Q:</e> My problem is not listed above. Where should I go next?
1685</p>
1686
1687<p>
1688<e>A:</e> Don't fear to contact me, <mail link="earthwings@gentoo.org">Dennis
1689Nienhüser</mail>, directly. The <uri link="http://forums.gentoo.org">Gentoo
1690Forums</uri> are a good place to get help as well. If you prefer IRC, try the
1691<c>#gentoo-laptop</c> channel at <uri
1692link="irc://irc.freenode.net">irc.freenode.net</uri>.
1693</p>
1694 680
1695</body> 681</body>
1696</section> 682</section>
1697</chapter> 683</chapter>
1698</guide> 684</guide>

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

  ViewVC Help
Powered by ViewVC 1.1.20