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

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

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

Revision 1.16 Revision 1.21
1<?xml version='1.0' encoding="UTF-8"?> 1<?xml version='1.0' encoding="UTF-8"?>
2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v 1.16 2006/01/01 11:51:43 neysx Exp $ --> 3<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v 1.21 2006/08/17 00:45:29 rane Exp $ -->
4<guide link="/doc/en/power-management-guide.xml"> 4<guide link="/doc/en/power-management-guide.xml">
5<title>Power Management Guide</title> 5<title>Power Management Guide</title>
6 6
7<author title="Author"> 7<author title="Author">
8 <mail link="fragfred@gmx.de">Dennis Nienhüser</mail> 8 <mail link="earthwings@gentoo.org">Dennis Nienhüser</mail>
9</author>
10<author title="Editor">
11 <mail link="chriswhite@gentoo.org">Chris White</mail>
9</author> 12</author>
10 13
11<abstract> 14<abstract>
12Power Management is the key to extend battery run time on mobile systems like 15Power Management is the key to extend battery run time on mobile systems like
13laptops. This guide assists you setting it up on your laptop. 16laptops. This guide assists you setting it up on your laptop.
15 18
16<!-- The content of this document is licensed under the CC-BY-SA license --> 19<!-- The content of this document is licensed under the CC-BY-SA license -->
17<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> 20<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
18<license/> 21<license/>
19 22
20<version>1.25</version> 23<version>1.28</version>
21<date>2005-10-02</date> 24<date>2006-07-26</date>
22 25
23<chapter> 26<chapter>
24<title>Introduction</title> 27<title>Introduction</title>
25<section> 28<section>
26<title>Why Power Management?</title>
27<body> 29<body>
28 30
29<p> 31<p>
30Capacity and lifetime of laptop batteries have improved much in the last years. 32Capacity and lifetime of laptop batteries have improved much in the last years.
31Nevertheless modern processors consume much more energy than older ones and 33Nevertheless modern processors consume much more energy than older ones and
35intelligent Power Management policies. 37intelligent Power Management policies.
36</p> 38</p>
37 39
38</body> 40</body>
39</section> 41</section>
40
41<section> 42<section>
42<title>A quick overview</title> 43<title>A Quick Overview</title>
43<body> 44<body>
44 45
45<p> 46<p>
46Please notice that this guide describes Power Management for <e>laptops</e>. 47Please notice that this guide describes Power Management for <e>laptops</e>.
47While some sections might also suite for <e>servers</e>, others do not and may 48While some sections might also suite for <e>servers</e>, others do not and may
53As this guide has become rather long, here's a short overview helping you to 54As this guide has become rather long, here's a short overview helping you to
54find your way through it. 55find your way through it.
55</p> 56</p>
56 57
57<p> 58<p>
58The <e>Prerequisites</e> chapter talks about some requirements that should be 59The <uri link="#doc_chap2">Prerequisites</uri> chapter talks about some
59met before any of the following device individual sections will work. This 60requirements that should be met before any of the following device individual
60includes BIOS settings, kernel configuration and some simplifications in user 61sections will work. This includes BIOS settings, kernel configuration and some
61land. The following three chapters focus on devices that typically consume 62simplifications in user land. The following three chapters focus on devices
62most energy - processor, display and hard drive. Each can be configured 63that typically consume most energy - processor, display and hard drive. Each
63seperately. <e>CPU Power Management</e> shows how to adjust the processor's 64can be configured seperately. <uri link="#doc_chap3">CPU Power Management</uri>
64frequency to save a maximum of energy whithout losing too much performance. A 65shows how to adjust the processor's frequency to save a maximum of energy
65few different tricks prevent your hard drive from working unnecessarily often 66without losing too much performance. A few different tricks prevent your hard
66in <e>Disk Power Management</e> (decreasing noise level as a nice side 67drive from working unnecessarily often in <uri link="#doc_chap5">Disk Power
67effect). Some notes on graphics cards, Wireless LAN and USB finish the device 68Management</uri> (decreasing noise level as a nice side effect). Some notes on
68section in <e>Power Management for other devices</e> while another chapter is 69graphics cards, Wireless LAN and USB finish the device section in <uri
69dedicated to the (rather experimental) <e>sleep states</e>. Last not least 70link="#doc_chap6">Power Management For Other Devices</uri> while another
70<e>Troubleshooting</e> lists common pitfalls. 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.
71</p> 74</p>
72 75
73</body> 76</body>
74</section>
75
76<section> 77</section>
78<section>
77<title>Power Budget for each component</title> 79<title>Power Budget For Each Component</title>
78<body> 80<body>
79 81
80<figure link="/images/energy-budget.png" short="Which component consumes how 82<figure link="/images/energy-budget.png" short="Which component consumes how
81much energy?" caption="Power budget for each component"/> 83much energy?" caption="Power budget for each component"/>
82 84
93</chapter> 95</chapter>
94 96
95<chapter> 97<chapter>
96<title>Prerequisites</title> 98<title>Prerequisites</title>
97<section> 99<section>
98<title>What has to be done first</title>
99<body>
100
101<p>
102Before going into the details on making individual devices Power Management
103aware, make sure certain requirements are met. After controlling the BIOS
104settings, some kernel options want to be enabled - these are in short ACPI,
105sleep states and CPU frequency scaling. As power saving most of the time comes
106along with performance loss or increased latency, it should only be enabled
107when running on batteries. That's where a new runlevel <e>battery</e> comes in
108handy.
109</p>
110
111</body> 100<body>
112</section> 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>
113<section> 112</section>
113<section>
114<title>The BIOS part</title> 114<title>The BIOS Part</title>
115<body> 115<body>
116 116
117<p> 117<p>
118First have a look into your BIOS Power Management settings. The best way is to 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 119combine BIOS and operating system policies, but for the moment it's better to
123</p> 123</p>
124 124
125</body> 125</body>
126</section> 126</section>
127<section> 127<section>
128<title>Setting USE Flags</title>
129<body>
130
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>
139
140</body>
141</section>
142<section>
128<title>Configuring the kernel</title> 143<title>Configuring The Kernel</title>
129<body> 144<body>
130 145
131<p> 146<p>
132ACPI (Advanced Configuration and Power Interface) support in the kernel is 147ACPI (Advanced Configuration and Power Interface) support in the kernel is
133still work in progress. Using a recent kernel will make sure you'll get the 148still work in progress. Using a recent kernel will make sure you'll get the
134most out of it. 149most out of it.
135</p> 150</p>
136 151
137<p> 152<p>
138There are different kernel sources in Portage. I'd recommend using 153There are different kernel sources in Portage. I'd recommend using
139<c>gentoo-sources</c> or <c>suspend2-sources</c>. The latter contains patches 154<c>gentoo-sources</c> or <c>suspend2-sources</c>. The latter contains patches
140for Software Suspend 2, see the chapter about sleep states for details. When 155for Software Suspend 2, see the chapter about <uri link="#doc_chap7">sleep
141configuring the kernel, activate at least these options: 156states</uri> for more details. When configuring the kernel, activate at least
157these options:
142</p> 158</p>
143 159
144<pre caption="Minimum kernel setup for Power Management (Kernel 2.6)"> 160<pre caption="Minimum kernel setup for Power Management (Kernel 2.6)">
145Power Management Options ---&gt; 161Power Management Options ---&gt;
146 [*] Power Management Support 162 [*] Power Management Support
163 &lt; &gt; Toshiba Laptop Extras 179 &lt; &gt; Toshiba Laptop Extras
164 (0) Disable ACPI for systems before Jan 1st this year 180 (0) Disable ACPI for systems before Jan 1st this year
165 [ ] Debug Statements 181 [ ] Debug Statements
166 [*] Power Management Timer Support 182 [*] Power Management Timer Support
167 &lt; &gt; ACPI0004,PNP0A05 and PNP0A06 Container Driver (EXPERIMENTAL) 183 &lt; &gt; ACPI0004,PNP0A05 and PNP0A06 Container Driver (EXPERIMENTAL)
168 184
169 CPU Frequency Scaling ---&gt; 185 CPU Frequency Scaling ---&gt;
170 [*] CPU Frequency scaling 186 [*] CPU Frequency scaling
171 [ ] Enable CPUfreq debugging 187 [ ] Enable CPUfreq debugging
172 &lt; &gt; CPU frequency translation statistics 188 &lt; &gt; CPU frequency translation statistics
173 [ ] CPU frequency translation statistics details 189 [ ] CPU frequency translation statistics details
186(see below). If you own an ASUS, Medion, IBM Thinkpad or Toshiba laptop, enable 202(see below). If you own an ASUS, Medion, IBM Thinkpad or Toshiba laptop, enable
187the appropriate section. 203the appropriate section.
188</p> 204</p>
189 205
190<p> 206<p>
191The kernel has to know how to enable CPU frequency scaling on your processor. As 207The kernel has to know how to enable CPU frequency scaling on your processor.
192each type of CPU has a different interface, you've got to choose the right 208As each type of CPU has a different interface, you've got to choose the right
193driver for your processor. Be careful here - enabling <e>Intel Pentium 4 clock 209driver for your processor. Be careful here - enabling <c>Intel Pentium 4 clock
194modulation</e> on a Pentium M system will lead to strange results for example. 210modulation</c> on a Pentium M system will lead to strange results for example.
195Consult the kernel documentation if you're unsure which one to take. 211Consult the kernel documentation if you're unsure which one to take.
196</p> 212</p>
197 213
198<p> 214<p>
199Compile your kernel, make sure the right modules get loaded at startup and boot 215Compile your kernel, make sure the right modules get loaded at startup and boot
200into your new ACPI-enabled kernel. Next run <c>emerge sys-power/acpid</c> to get 216into your new ACPI-enabled kernel. Next run <c>emerge sys-power/acpid</c> to
201the acpi daemon. This one informs you about events like switching from AC to 217get the acpi daemon. This one informs you about events like switching from AC
202battery or closing the lid. Make sure the modules are loaded if you didn't 218to battery or closing the lid. Make sure the modules are loaded if you didn't
203compile them into the kernel and start acpid by executing 219compile them into the kernel and start acpid by executing <c>/etc/init.d/acpid
204<c>/etc/init.d/acpid start</c>. Run <c>rc-update add acpid default</c> to load 220start</c>. Run <c>rc-update add acpid default</c> to load it on startup. You'll
205it on startup. You'll soon see how to use it. 221soon see how to use it.
206</p> 222</p>
207 223
208<pre caption="Installing acpid"> 224<pre caption="Installing acpid">
209# <i>emerge sys-power/acpid</i> 225# <i>emerge sys-power/acpid</i>
210# <i>/etc/init.d/acpid start</i> 226# <i>/etc/init.d/acpid start</i>
212</pre> 228</pre>
213 229
214</body> 230</body>
215</section> 231</section>
216<section> 232<section>
217<title>Creating a "battery" runlevel</title> 233<title>Creating A "battery" Runlevel</title>
218<body> 234<body>
219 235
220<p> 236<p>
221The default policy will be to enable Power Management only when needed - 237The default policy will be to enable Power Management only when needed -
222running on batteries. To make the switch between AC and battery convenient, 238running on batteries. To make the switch between AC and battery convenient,
223create a runlevel <e>battery</e> that holds all the scripts starting and 239create a runlevel <c>battery</c> that holds all the scripts starting and
224stopping Power Management. 240stopping Power Management.
225</p> 241</p>
226 242
227<note> 243<note>
228You can safely skip this section if you don't like the idea of having another 244You can safely skip this section if you don't like the idea of having another
229runlevel. However, skipping this step will make the rest a bit trickier to set 245runlevel. However, skipping this step will make the rest a bit trickier to set
230up. The next sections assume a runlevel <e>battery</e> exists. 246up. The next sections assume a runlevel <c>battery</c> exists.
231</note> 247</note>
232 248
233<pre caption="Creating a battery runlevel"> 249<pre caption="Creating a battery runlevel">
234# <i>cd /etc/runlevels</i> 250# <i>cd /etc/runlevels</i>
235# <i>cp -a default battery</i> 251# <i>cp -a default battery</i>
236</pre> 252</pre>
237 253
238<p> 254<p>
239Finished. Your new runlevel <e>battery</e> contains everything like 255Finished. Your new runlevel <c>battery</c> contains everything like
240<e>default</e>, but there is no automatic switch between both yet. Time to 256<c>default</c>, but there is no automatic switch between both yet. Time to
241change it. 257change it.
242</p> 258</p>
243 259
244</body> 260</body>
245</section> 261</section>
246<section> 262<section>
247<title>Reacting on ACPI events</title> 263<title>Reacting On ACPI Events</title>
248<body> 264<body>
249 265
250<p> 266<p>
251Typical ACPI events are closing the lid, changing the power source or pressing 267Typical ACPI events are closing the lid, changing the power source or pressing
252the sleep button. An important event is changing the power source, which should 268the sleep button. An important event is changing the power source, which should
259<c>on_ac_power</c> command from <c>sys-power/powermgmt-base</c> - make sure the 275<c>on_ac_power</c> command from <c>sys-power/powermgmt-base</c> - make sure the
260package is installed on your system. 276package is installed on your system.
261</p> 277</p>
262 278
263<pre caption="Installing powermgt-base"> 279<pre caption="Installing powermgt-base">
264<i># emerge powermgmt-base</i> 280# <i>emerge powermgmt-base</i>
265</pre> 281</pre>
266 282
267<p> 283<p>
268You are now able to determine the power source by executing 284You are now able to determine the power source by executing <c>on_ac_power
269<c>on_ac_power &amp;&amp; echo AC available || echo Running on batteries</c> in 285&amp;&amp; echo AC available || echo Running on batteries</c> in a shell. The
270a shell. The script below is responsible for changing runlevels. Save it as 286script below is responsible for changing runlevels. Save it as
271<path>/etc/acpi/actions/pmg_switch_runlevel.sh</path>. 287<path>/etc/acpi/actions/pmg_switch_runlevel.sh</path>.
272</p> 288</p>
273 289
274<pre caption="/etc/acpi/actions/pmg_switch_runlevel.sh"> 290<pre caption="/etc/acpi/actions/pmg_switch_runlevel.sh">
275#!/bin/bash 291#!/bin/bash
280<comment># END configuration</comment> 296<comment># END configuration</comment>
281 297
282 298
283if [ ! -d "/etc/runlevels/${RUNLEVEL_AC}" ] 299if [ ! -d "/etc/runlevels/${RUNLEVEL_AC}" ]
284then 300then
285 logger "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting." 301 logger "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting."
286 exit 1 302 exit 1
287fi 303fi
288 304
289if [ ! -d "/etc/runlevels/${RUNLEVEL_BATTERY}" ] 305if [ ! -d "/etc/runlevels/${RUNLEVEL_BATTERY}" ]
290then 306then
291 logger "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting." 307 logger "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting."
292 exit 1 308 exit 1
293fi 309fi
294 310
295if on_ac_power 311if on_ac_power
296then 312then
297 if [[ "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_AC}" ]] 313 if [[ "$(&lt;/var/lib/init.d/softlevel)" != "${RUNLEVEL_AC}" ]]
298 then 314 then
299 logger "Switching to ${RUNLEVEL_AC} runlevel" 315 logger "Switching to ${RUNLEVEL_AC} runlevel"
300 /sbin/rc ${RUNLEVEL_AC} 316 /sbin/rc ${RUNLEVEL_AC}
301 fi 317 fi
302elif [[ "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_BATTERY}" ]] 318elif [[ "$(&lt;/var/lib/init.d/softlevel)" != "${RUNLEVEL_BATTERY}" ]]
303then 319then
304 logger "Switching to ${RUNLEVEL_BATTERY} runlevel" 320 logger "Switching to ${RUNLEVEL_BATTERY} runlevel"
305 /sbin/rc ${RUNLEVEL_BATTERY} 321 /sbin/rc ${RUNLEVEL_BATTERY}
306fi 322fi
307</pre> 323</pre>
308 324
309<p> 325<p>
310Dont forget to run <c>chmod +x /etc/acpi/actions/pmg_switch_runlevel.sh</c> to 326Dont forget to run <c>chmod +x /etc/acpi/actions/pmg_switch_runlevel.sh</c> to
311make the script executable. The last thing that needs to be done is calling the 327make the script executable. The last thing that needs to be done is calling the
312script whenever the power source changes. That's done by catching ACPI events 328script whenever the power source changes. That's done by catching ACPI events
313with the help of <c>acpid</c>. First you need to know which events are 329with the help of <c>acpid</c>. First you need to know which events are
314generated when the power source changes. The events are called 330generated when the power source changes. The events are called
315<e>ac_adapter</e> and <e>battery</e> on most laptops, but it might be different 331<c>ac_adapter</c> and <c>battery</c> on most laptops, but it might be different
316on yours. 332on yours.
317</p> 333</p>
318 334
319<pre caption="Determining ACPI events for changing the power source"> 335<pre caption="Determining ACPI events for changing the power source">
320<i># tail -f /var/log/acpid | grep "received event"</i> 336# <i>tail -f /var/log/acpid | grep "received event"</i>
321</pre> 337</pre>
322 338
323<p> 339<p>
324Run the command above and pull the power cable. You should see something 340Run the command above and pull the power cable. You should see something like
325like this: 341this:
326</p> 342</p>
327 343
328<pre caption="Sample output for power source changes"> 344<pre caption="Sample output for power source changes">
329[Tue Sep 20 17:39:06 2005] received event "ac_adapter AC 00000080 00000000" 345[Tue Sep 20 17:39:06 2005] received event "ac_adapter AC 00000080 00000000"
330[Tue Sep 20 17:39:06 2005] received event "battery BAT0 00000080 00000001" 346[Tue Sep 20 17:39:06 2005] received event "battery BAT0 00000080 00000001"
331</pre> 347</pre>
332 348
333<p> 349<p>
334The interesting part is the quoted string after <e>received event</e>. It will 350The interesting part is the quoted string after <c>received event</c>. It will
335be matched by the event line in the files you are going to create below. Don't 351be matched by the event line in the files you are going to create below. Don't
336worry if your system generates multiple events or always the same. As long as 352worry if your system generates multiple events or always the same. As long as
337any event is generated, runlevel changing will work. 353any event is generated, runlevel changing will work.
338</p> 354</p>
339 355
354<p> 370<p>
355Finally acpid has to be restarted to recognize the changes. 371Finally acpid has to be restarted to recognize the changes.
356</p> 372</p>
357 373
358<pre caption="Finishing runlevel switching with acpid"> 374<pre caption="Finishing runlevel switching with acpid">
359<i># /etc/init.d/acpid restart</i> 375# <i>/etc/init.d/acpid restart</i>
360</pre> 376</pre>
361 377
362<p> 378<p>
363Give it a try: Plug AC in and out and watch syslog for the "Switching to AC 379Give it a try: Plug AC in and out and watch syslog for the "Switching to AC
364mode" or "Switching to battery mode" messages. See the Troubleshooting 380mode" or "Switching to battery mode" messages. See the <uri
365section if the script is not able to detect the power source correctly. 381link="#doc_chap8">Troubleshooting section</uri> if the script is not able to
382detect the power source correctly.
366</p> 383</p>
367 384
368<p> 385<p>
369Due to the nature of the event mechanism, your laptop will boot into runlevel 386Due to the nature of the event mechanism, your laptop will boot into runlevel
370<e>default</e> regardless of the AC/battery state. This is fine when running 387<c>default</c> regardless of the AC/battery state. This is fine when running
371from AC, but we'd like to boot into the battery runlevel otherwise. One 388from AC, but we'd like to boot into the battery runlevel otherwise. One
372solution would be to add another entry to the boot loader with the parameter 389solution would be to add another entry to the boot loader with the parameter
373<c>softlevel=battery</c>, but it's likely to forget choosing it. A better way 390<c>softlevel=battery</c>, but it's likely to forget choosing it. A better way
374is faking an ACPI event in the end of the boot process and letting 391is faking an ACPI event in the end of the boot process and letting
375<path>pmg_switch_runlevel.sh</path> script decide whether a 392<path>pmg_switch_runlevel.sh</path> script decide whether a runlevel change is
376runlevel change is necessary. Open <path>/etc/conf.d/local.start</path> in your 393necessary. Open <path>/etc/conf.d/local.start</path> in your favourite editor
377favourite editor and add these lines: 394and add these lines:
378</p> 395</p>
379 396
380<pre caption="Runlevel adjustment at boot time by editing local.start"> 397<pre caption="Runlevel adjustment at boot time by editing local.start">
381<comment># Fake acpi event to switch runlevel if running on batteries</comment> 398<comment># Fake acpi event to switch runlevel if running on batteries</comment>
382/etc/acpi/actions/pmg_switch_runlevel.sh "battery/battery" 399/etc/acpi/actions/pmg_switch_runlevel.sh "battery/battery"
383</pre> 400</pre>
384 401
385<p> 402<p>
386Prepared like this you can activate Power Management policies for individual 403Prepared like this you can activate Power Management policies for individual
387devices. 404devices.
388</p> 405</p>
389 406
390</body> 407</body>
391</section> 408</section>
392</chapter> 409</chapter>
393 410
394<chapter> 411<chapter>
395<title>CPU Power Management</title> 412<title>CPU Power Management</title>
396<section> 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>
425<section>
397<title>Some technical terms</title> 426<title>Some Technical Terms</title>
398<body> 427<body>
399 428
400<p> 429<p>
401CPU frequency scaling brings up some technical terms that might be unknown to 430CPU frequency scaling brings up some technical terms that might be unknown to
402you. Here's a quick introduction. 431you. Here's a quick introduction.
403</p> 432</p>
404 433
405<p> 434<p>
406First of all, the kernel has to be able to change the processor's frequency. 435First of all, the kernel has to be able to change the processor's frequency.
407The <e>CPUfreq processor driver</e> knows the commands to do it on your CPU. 436The <b>CPUfreq processor driver</b> knows the commands to do it on your CPU.
408Thus it's important to choose the right one in your kernel. You should 437Thus it's important to choose the right one in your kernel. You should already
409already have done it above. Once the kernel knows how to change frequencies, 438have done it above. Once the kernel knows how to change frequencies, it has to
410it has to know which frequency it should set. This is done according to the 439know which frequency it should set. This is done according to the <b>policy</b>
411<e>policy</e> which consists of a <e>CPUfreq policy</e> and a 440which consists of a <b>CPUfreq policy</b> and a <b>governor</b>. A CPUfreq
412<e>governor</e>. A CPUfreq policy are just two numbers which define a range 441policy are just two numbers which define a range the frequency has to stay
413the frequency has to stay between - minimal and maximal frequency. The 442between - minimal and maximal frequency. The governor now decides which of the
414governor now decides which of the available frequencies in between minimal 443available frequencies in between minimal and maximal frequency to choose. For
415and maximal frequency to choose. For example, the <e>powersave governor</e> 444example, the <b>powersave governor</b> always chooses the lowest frequency
416always chooses the lowest frequency available, the <e>performance 445available, the <b>performance governor</b> the highest one. The <b>userspace
417governor</e> the highest one. The <e>userspace governor</e> makes no decision 446governor</b> makes no decision but chooses whatever the user (or a program in
418but chooses whatever the user (or a program in userspace) wants - which means 447userspace) wants - which means it reads the frequency from
419it reads the frequency from
420<path>/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed</path>. 448<path>/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed</path>.
421</p> 449</p>
422 450
423<p> 451<p>
424This doesn't sound like dynamic frequency changes yet and in fact it isn't. 452This doesn't sound like dynamic frequency changes yet and in fact it isn't.
425Dynamics however can be accomplished with various approaches. For example, 453Dynamics however can be accomplished with various approaches. For example, the
426the <e>ondemand governor</e> makes its decisions depending on the current CPU 454<b>ondemand governor</b> makes its decisions depending on the current CPU load.
427load. The same is done by various userland tools like <c>cpudyn</c>, 455The same is done by various userland tools like <c>cpudyn</c>, <c>cpufreqd</c>,
428<c>cpufreqd</c>, <c>powernowd</c> and many more. ACPI events can be used to 456<c>powernowd</c> and many more. ACPI events can be used to enable or disable
429enable or disable dynamic frequency changes depending on power source. 457dynamic frequency changes depending on power source.
430</p> 458</p>
431 459
432</body> 460</body>
433</section>
434<section> 461</section>
462<section>
435<title>Setting the frequency manually</title> 463<title>Setting The Frequency Manually</title>
436<body> 464<body>
437 465
438<p> 466<p>
439Decreasing CPU speed and voltage has two advantages: On the one hand less 467Decreasing CPU speed and voltage has two advantages: On the one hand less
440energy is consumed, on the other hand there is thermal improvement as your 468energy is consumed, on the other hand there is thermal improvement as your
443between performance loss and energy saving. 471between performance loss and energy saving.
444</p> 472</p>
445 473
446<note> 474<note>
447Not every laptop supports frequency scaling. If unsure, have a look at the list 475Not every laptop supports frequency scaling. If unsure, have a look at the list
448of supported processors in the <e>Troubleshooting</e> section to verify your's 476of supported processors in the <uri link="#doc_chap8">Troubleshooting</uri>
449is supported. 477section to verify yours is supported.
450</note> 478</note>
451 479
452<p> 480<p>
453It's time to test whether CPU frequency changing works. Let's install another 481It's time to test whether CPU frequency changing works. Let's install another
454tool which is very handy for debugging purposes: <c>sys-power/cpufrequtils</c> 482tool which is very handy for debugging purposes: <c>sys-power/cpufrequtils</c>
480 508
481<p> 509<p>
482Now play around with <c>cpufreq-set</c> to make sure frequency switching works. 510Now play around with <c>cpufreq-set</c> to make sure frequency switching works.
483Run <c>cpufreq-set -g ondemand</c> for example to activate the ondemand 511Run <c>cpufreq-set -g ondemand</c> for example to activate the ondemand
484governor and verify the change with <c>cpufreq-info</c>. If it doesn't work as 512governor and verify the change with <c>cpufreq-info</c>. If it doesn't work as
485expected, you might find help in the Troubleshooting section in the end of this 513expected, you might find help in the <uri link="#doc_chap8">Troubleshooting
486guide. 514section</uri> in the end of this guide.
487</p> 515</p>
488 516
489</body> 517</body>
490</section> 518</section>
491<section> 519<section>
494 522
495<p> 523<p>
496The above is quite nice, but not doable in daily life. Better let your system 524The above is quite nice, but not doable in daily life. Better let your system
497set the appropriate frequency automatically. There are many different 525set the appropriate frequency automatically. There are many different
498approaches to do this. The following table gives a quick overview to help you 526approaches to do this. The following table gives a quick overview to help you
499decide on one of them. It's roughly seperated in three categories 527decide on one of them. It's roughly separated in three categories <b>kernel</b>
500<e>kernel</e> for approaches that only need kernel support, <e>daemon</e> for 528for approaches that only need kernel support, <b>daemon</b> for programs that
501programs that run in the background and <e>graphical</e> for programs that 529run in the background and <b>graphical</b> for programs that provide a GUI for
502provide a GUI for easy configuration and changes. 530easy configuration and changes.
503</p> 531</p>
504 532
505<table> 533<table>
506<tr> 534<tr>
507 <th>Name</th> 535 <th>Name</th>
552 </ti> 580 </ti>
553</tr> 581</tr>
554<tr> 582<tr>
555 <ti><uri link="http://sourceforge.net/projects/cpufreqd/">cpufreqd</uri></ti> 583 <ti><uri link="http://sourceforge.net/projects/cpufreqd/">cpufreqd</uri></ti>
556 <ti>Daemon</ti> 584 <ti>Daemon</ti>
557 <ti>Battery state, CPU load, temperature, running programs</ti> 585 <ti>Battery state, CPU load, temperature, running programs and more</ti>
558 <ti>All available</ti> 586 <ti>All available</ti>
559 <ti>None</ti> 587 <ti>None</ti>
560 <ti> 588 <ti>
561 Sophisticated (but also complicated) setup. 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.
562 </ti> 593 </ti>
563</tr> 594</tr>
564<tr> 595<tr>
565 <ti> 596 <ti>
566 <uri link="http://www.deater.net/john/powernowd.html">powernowd</uri> 597 <uri link="http://www.deater.net/john/powernowd.html">powernowd</uri>
573 Supports SMP. 604 Supports SMP.
574 </ti> 605 </ti>
575</tr> 606</tr>
576<tr> 607<tr>
577 <ti> 608 <ti>
609 <uri
578 <uri link="http://fatcat.ftj.agh.edu.pl/~nelchael/index.php?cat=projs&amp;subcat=ncpufreqd&amp;language=en">ncpufreqd</uri> 610 link="http://fatcat.ftj.agh.edu.pl/~nelchael/index.php?cat=projs&amp;subcat=ncpufreqd&amp;language=en">ncpufreqd</uri>
579 </ti> 611 </ti>
580 <ti>Daemon</ti> 612 <ti>Daemon</ti>
581 <ti>Temperature</ti> 613 <ti>Temperature</ti>
582 <ti>None</ti> 614 <ti>None</ti>
583 <ti>Powersave, performance</ti> 615 <ti>Powersave, performance</ti>
623 655
624<p> 656<p>
625While adjusting the frequency to the current load looks simple at a first 657While adjusting the frequency to the current load looks simple at a first
626glance, it's not such a trivial task. A bad algorithm can cause switching 658glance, it's not such a trivial task. A bad algorithm can cause switching
627between two frequencies all the time or wasting energy when setting frequency 659between two frequencies all the time or wasting energy when setting frequency
628to an unnecessary high level. 660to an unnecessary high level.
629</p> 661</p>
630 662
631<p> 663<p>
632Which one to choose? If you have no idea about it, try <c>cpufreqd</c>: 664Which one to choose? If you have no idea about it, try <c>cpufreqd</c>:
633</p> 665</p>
638 670
639<p> 671<p>
640<c>cpufreqd</c> can be configured by editing <path>/etc/cpufreqd.conf</path>. 672<c>cpufreqd</c> can be configured by editing <path>/etc/cpufreqd.conf</path>.
641The default one that ships with cpufreqd may look a bit confusing. I recommend 673The default one that ships with cpufreqd may look a bit confusing. I recommend
642replacing it with the one from Gentoo developer Henrik Brix Andersen (see 674replacing it with the one from Gentoo developer Henrik Brix Andersen (see
643below). 675below). Please notice that you need cpufreqd-2.0.0 or later. Earlier versions
676have a different syntax for the config file.
644</p> 677</p>
645 678
646<pre caption="/etc/cpufreqd.conf"> 679<pre caption="/etc/cpufreqd.conf (cpufreqd-2.0.0 and later)">
647[General] 680[General]
648pidfile=/var/run/cpufreqd.pid 681pidfile=/var/run/cpufreqd.pid
649poll_interval=2 682poll_interval=3
650pm_type=acpi 683enable_plugins=acpi_ac, acpi_battery
684enable_remote=1
685remote_group=wheel
651verbosity=5 686verbosity=5
687[/General]
652 688
653[Profile] 689[Profile]
654name=ondemand 690name=ondemand
655minfreq=0% 691minfreq=0%
656maxfreq=100% 692maxfreq=100%
657policy=ondemand 693policy=ondemand
694[/Profile]
658 695
659[Profile] 696[Profile]
660name=conservative 697name=conservative
661minfreq=0% 698minfreq=0%
662maxfreq=100% 699maxfreq=100%
663policy=conservative 700policy=conservative
701[/Profile]
664 702
665[Profile] 703[Profile]
666name=powersave 704name=powersave
667minfreq=0% 705minfreq=0%
668maxfreq=100% 706maxfreq=100%
669policy=powersave 707policy=powersave
708[/Profile]
670 709
671[Profile] 710[Profile]
672name=performance 711name=performance
673minfreq=0% 712minfreq=0%
674maxfreq=100% 713maxfreq=100%
675policy=performance 714policy=performance
715[/Profile]
676 716
677[Rule] 717[Rule]
678name=battery 718name=battery
679ac=off 719ac=off
680profile=conservative 720profile=conservative
721[/Rule]
681 722
682[Rule] 723[Rule]
683name=battery_low 724name=battery_low
684ac=off 725ac=off
685battery_interval=0-10 726battery_interval=0-10
686profile=powersave 727profile=powersave
728[/Rule]
687 729
688[Rule] 730[Rule]
689name=ac 731name=ac
690ac=on 732ac=on
691profile=ondemand 733profile=ondemand
734[/Rule]
692</pre> 735</pre>
693 736
694<p> 737<p>
695Now you can start the cpufreqd daemon. Add it to the <e>default</e> and 738Now you can start the cpufreqd daemon. Add it to the <c>default</c> and
696<e>battery</e> runlevel as well. 739<c>battery</c> runlevel as well.
697</p> 740</p>
698 741
699<pre caption="Starting cpufreqd"> 742<pre caption="Starting cpufreqd">
700# <i>rc-update add cpufreqd default battery</i> 743# <i>rc-update add cpufreqd default battery</i>
701# <i>rc</i> 744# <i>rc</i>
702</pre> 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>
703 755
704<warn> 756<warn>
705Do not run more than one of the above programs at the same time. It may cause 757Do not run more than one of the above programs at the same time. It may cause
706confusion like switching between two frequencies all the time. 758confusion like switching between two frequencies all the time.
707</warn> 759</warn>
708 760
709</body> 761</body>
710</section> 762</section>
711
712<section> 763<section>
713<title>Verifying the result</title> 764<title>Verifying the result</title>
714
715<body> 765<body>
716 766
717<p> 767<p>
718The last thing to check is that your new policies do a good job. An easy way to 768The last thing to check is that your new policies do a good job. An easy way to
719do so is monitoring CPU speed while working with your laptop: 769do so is monitoring CPU speed while working with your laptop:
722<pre caption="Monitoring CPU speed"> 772<pre caption="Monitoring CPU speed">
723# <i>watch grep \"cpu MHz\" /proc/cpuinfo</i> 773# <i>watch grep \"cpu MHz\" /proc/cpuinfo</i>
724</pre> 774</pre>
725 775
726<p> 776<p>
727If <path>/proc/cpuinfo</path> doesn't get updated (see Troubleshooting), 777If <path>/proc/cpuinfo</path> doesn't get updated (see <uri
728monitor the CPU frequency with: 778link="#doc_chap8">Troubleshooting</uri>), monitor the CPU frequency with:
729</p> 779</p>
730 780
731<pre caption="Alternative CPU speed monitoring"> 781<pre caption="Alternative CPU speed monitoring">
732# <i>watch x86info -mhz</i> 782# <i>watch x86info -mhz</i>
733</pre> 783</pre>
734 784
735<p> 785<p>
736Depending on your setup, CPU speed should increase on heavy load, decrease on 786Depending on your setup, CPU speed should increase on heavy load, decrease on
737no activity or just stay at the same level. When using cpufreqd and verbosity 787no activity or just stay at the same level. When using <c>cpufreqd</c> and
738set to 5 or higher in <path>cpufreqd.conf</path> you'll get additional 788verbosity set to 5 or higher in <path>cpufreqd.conf</path> you'll get
739information about what's happening reported to syslog. 789additional information about what's happening reported to <c>syslog</c>.
740</p> 790</p>
741 791
742</body> 792</body>
743</section> 793</section>
744</chapter> 794</chapter>
745 795
746<chapter> 796<chapter>
747<title>LCD Power Management</title> 797<title>LCD Power Management</title>
748<section> 798<section>
749<title>Energy consumer no. 1</title>
750<body> 799<body>
751 800
752<p> 801<p>
753As you can see in <uri link="#doc_chap1_fig1">figure 1.1</uri>, the LCD display 802As you can see in <uri link="#doc_chap1_fig1">figure 1.1</uri>, the LCD
754consumes the biggest part of energy (might not be the case for non-mobile 803display consumes the biggest part of energy (might not be the case for
755CPU's). Thus it's quite important not only to shut the display off when not 804non-mobile CPU's). Thus it's quite important not only to shut the display off
756needed, but also to reduce it's backlight if possible. Most laptops offer the 805when not needed, but also to reduce it's backlight if possible. Most laptops
757possibility to control the backlight dimming. 806offer the possibility to control the backlight dimming.
758</p>
759
760<p> 807</p>
808
809</body>
810</section>
811<section>
812<title>Standby settings</title>
813<body>
814
815<p>
761First thing to check is the standby/suspend/off timings of the display. As this 816The first thing to check is the standby/suspend/off timings of the display. As
762depends heavily on your windowmanager, I'll let you figure it out yourself. 817this depends heavily on your windowmanager, I'll let you figure it out
763Just two common places: Blanking the terminal can be done with <c>setterm 818yourself. Just two common places: Blanking the terminal can be done with
764-blank &lt;number-of-minutesM&gt;</c>, <c>setterm -powersave on</c> and 819<c>setterm -blank &lt;number-of-minutesM&gt;</c>, <c>setterm -powersave on</c>
765<c>setterm -powerdown &lt;number-of-minutesM&gt;</c>. 820and <c>setterm -powerdown &lt;number-of-minutesM&gt;</c>. For X.org, modify
766For X.org, modify <path>/etc/X11/xorg.conf</path> similar to this: 821<path>/etc/X11/xorg.conf</path> similar to this:
767</p> 822</p>
768 823
769<pre caption="LCD suspend settings in X.org and XFree86"> 824<pre caption="LCD suspend settings in X.org and XFree86">
770Section "ServerLayout" 825Section "ServerLayout"
771 Identifier [...] 826 Identifier [...]
788 843
789<p> 844<p>
790This is the same for XFree86 and <path>/etc/X11/XF86Config</path>. 845This is the same for XFree86 and <path>/etc/X11/XF86Config</path>.
791</p> 846</p>
792 847
848</body>
849</section>
850<section>
851<title>Backlight dimming</title>
852<body>
853
793<p> 854<p>
794Probably more important is the backlight dimming. If you have access to the 855Probably more important is the backlight dimming. If you have access to the
795dimming settings via a tool, write a small script that dims the backlight in 856dimming settings via a tool, write a small script that dims the backlight in
796battery mode and place it in your <e>battery</e> runlevel. The following script 857battery mode and place it in your <c>battery</c> runlevel. The following script
797should work on most IBM Thinkpads. It needs the <c>app-laptop/ibm-acpi</c> 858should work on most IBM Thinkpads and Toshiba laptops. You've got to enable the
798package or the appropriate option in your kernel has to be enabled. 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.
799</p> 862</p>
800 863
801<warn> 864<warn>
802Support for setting brightness is marked experimental in ibm-acpi. It accesses 865Support for setting brightness is marked experimental in ibm-acpi. It accesses
803hardware directly and may cause severe harm to your system. Please read the 866hardware directly and may cause severe harm to your system. Please read the
809with the experimental parameter. 872with the experimental parameter.
810</p> 873</p>
811 874
812<pre caption="automatically loading the ibm_acpi module"> 875<pre caption="automatically loading the ibm_acpi module">
813<comment>(Please read the warnings above before doing this!)</comment> 876<comment>(Please read the warnings above before doing this!)</comment>
814<i># emerge ibm-acpi</i>
815<i># echo "options ibm_acpi experimental=1" >> /etc/modules.d/ibm_acpi</i> 877# <i>echo "options ibm_acpi experimental=1" >> /etc/modules.d/ibm_acpi</i>
816<i># /sbin/modules-update</i> 878# <i>/sbin/modules-update</i>
817<i># echo ibm_acpi >> /etc/modules.autoload.d/kernel-2.6</i> 879# <i>echo ibm_acpi >> /etc/modules.autoload.d/kernel-2.6</i>
818<i># modprobe ibm_acpi</i> 880# <i>modprobe ibm_acpi</i>
819</pre> 881</pre>
820 882
821<p> 883<p>
822This should work without error messages and a file 884This should work without error messages and a file
823<path>/proc/acpi/ibm/brightness</path> should be created after loading the 885<path>/proc/acpi/ibm/brightness</path> should be created after loading the
824module. An init script will take care of choosing the brightness according 886module. An init script will take care of choosing the brightness according to
825to the power source. 887the power source.
826</p> 888</p>
827 889
828<pre caption="/etc/conf.d/lcd-brightness"> 890<pre caption="/etc/conf.d/lcd-brightness">
829<comment># See /proc/acpi/ibm/brightness for available values</comment> 891<comment># See /proc/acpi/ibm/brightness for available values</comment>
830<comment># Please read /usr/share/doc/ibm-acpi-*/README.gz</comment> 892<comment># Please read /usr/src/linux/Documentation/ibm-acpi.txt</comment>
831 893
832<comment># brigthness level in ac mode. Default is 7.</comment> 894<comment># brigthness level in ac mode. Default is 7.</comment>
833BRIGHTNESS_AC=7 895BRIGHTNESS_AC=7
834 896
835<comment># brightness level in battery mode. Default is 4.</comment> 897<comment># brightness level in battery mode. Default is 4.</comment>
850 if [ -f /proc/acpi/ibm/brightness ] 912 if [ -f /proc/acpi/ibm/brightness ]
851 then 913 then
852 ebegin "Setting LCD brightness" 914 ebegin "Setting LCD brightness"
853 echo "level ${LEVEL}" > /proc/acpi/ibm/brightness 915 echo "level ${LEVEL}" > /proc/acpi/ibm/brightness
854 eend $? 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 $?
855 else 922 else
856 ewarn "Setting LCD brightness is not supported." 923 ewarn "Setting LCD brightness is not supported."
857 ewarn "Check that ibm_acpi is loaded into the kernel" 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"
858 fi 926 fi
859} 927}
860 928
861start() { 929start() {
862 set_brightness 930 set_brightness
871When done, make sure brightness is adjusted automatically by adding it to the 939When done, make sure brightness is adjusted automatically by adding it to the
872battery runlevel. 940battery runlevel.
873</p> 941</p>
874 942
875<pre caption="Enabling automatic brightness adjustment"> 943<pre caption="Enabling automatic brightness adjustment">
876<i># chmod +x /etc/init.d/lcd-brightness</i> 944# <i>chmod +x /etc/init.d/lcd-brightness</i>
877<i># rc-update add lcd-brightness battery</i> 945# <i>rc-update add lcd-brightness battery</i>
878<i># rc</i> 946# <i>rc</i>
879</pre> 947</pre>
880 948
881</body> 949</body>
882</section> 950</section>
883</chapter> 951</chapter>
884 952
885<chapter> 953<chapter>
886<title>Disk Power Management</title> 954<title>Disk Power Management</title>
887<section> 955<section>
888<title>Sleep when idle</title> 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
889<body> 970</body>
971</section>
972<section>
973<title>Increasing idle time - laptop-mode</title>
974<body>
890 975
891<p>
892Let's bring the hard disk to sleep as early as possible whenever it is not
893needed. I'll show you two possibilities to do it. First <c>cpudyn</c> supports
894Disk Power Management. Uncomment the lines in the "Disk Options" section in
895<path>/etc/conf.d/cpudyn</path>. To put your first disk to sleep after 60
896seconds of no activity, you would modify it like this:
897</p> 976<p>
898 977Recent kernels (2.6.6 and greater, recent 2.4 ones and others with patches)
899<pre caption="Using cpudyn for disk standby"> 978include the so-called <c>laptop-mode</c>. When activated, dirty buffers are
900<comment>################################################ 979written to disk on read calls or after 10 minutes (instead of 30 seconds). This
901# DISK OPTIONS 980minimizes the time the hard disk needs to be spun up.
902# (disabled by default)
903################################################
904
905#
906# Timeout to put the disk in standby mode if there was no
907# io during that period (in seconds)
908#
909</comment>
910TIMEOUT=60
911<comment>
912#
913# Specified disks to spindown (comma separated devices)
914#
915</comment>
916DISKS=/dev/hda
917</pre>
918
919<p> 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>
920The second possibility is using a small script and hdparm. Create 1070The second possibility is using a small script and <c>hdparm</c>. Skip this if
921<path>/etc/init.d/pm.hda</path> like this: 1071you are using laptop-mode. Otherwise, create <path>/etc/init.d/pmg_hda</path>:
922</p> 1072</p>
923 1073
924<pre caption="Using hdparm for disk standby"> 1074<pre caption="Using hdparm for disk standby">
925#!/sbin/runscript 1075#!/sbin/runscript
926 1076
927depend() { 1077depend() {
928 after hdparm 1078after hdparm
929} 1079}
930 1080
931start() { 1081start() {
932 ebegin "Activating Power Management for Hard Drives" 1082ebegin "Activating Power Management for Hard Drives"
933 hdparm -q -S12 /dev/hda 1083hdparm -q -S12 /dev/hda
934 eend $? 1084eend $?
935} 1085}
936 1086
937stop () { 1087stop () {
938 ebegin "Deactivating Power Management for Hard Drives" 1088ebegin "Deactivating Power Management for Hard Drives"
939 hdparm -q -S253 /dev/hda 1089hdparm -q -S253 /dev/hda
940 eend $? 1090eend $?
941} 1091}
942</pre> 1092</pre>
943 1093
944<p> 1094<p>
945See <c>man hdparm</c> for the options. If your script is ready, add it to the 1095See <c>man hdparm</c> for the options. If your script is ready, add it to the
946battery runlevel. 1096battery runlevel.
947</p> 1097</p>
948 1098
949<pre caption="Automate disk standby settings"> 1099<pre caption="Automate disk standby settings">
950# <i>chmod +x /etc/init.d/pm.hda</i> 1100# <i>chmod +x /etc/init.d/pmg_hda</i>
951# <i>/sbin/depscan.sh</i> 1101# <i>/sbin/depscan.sh</i>
952# <i>rc-update add pm.hda battery</i> 1102# <i>rc-update add pmg_hda battery</i>
953</pre> 1103</pre>
954 1104
955<impo> 1105<impo>
956Be careful with sleep/spin down settings of your hard drive. Setting it to 1106Be careful with sleep/spin down settings of your hard drive. Setting it to
957small values might wear out your drive and lose warranty. 1107small values might wear out your drive and lose warranty.
958</impo> 1108</impo>
959 1109
960</body> 1110</body>
961</section> 1111</section>
962<section> 1112<section>
963<title>Increasing idle time - laptop-mode</title>
964<body>
965
966<p>
967Recent kernels (2.6.6 and greater, recent 2.4 ones and others with patches)
968include the so-called <e>laptop-mode</e>. When activated, dirty buffers are
969written to disk on read calls or after 10 minutes (instead of 30 seconds). This
970minimizes the time the hard disk needs to be spun up.
971</p>
972
973<pre caption="Automated start of laptop-mode">
974# <i>emerge laptop-mode-tools</i>
975</pre>
976
977<p>
978<c>laptop-mode-tools</c> has it's configuration file in
979<path>/etc/laptop-mode/laptop-mode.conf</path>. Adjust it the way you like it,
980it's well commented. Run <c>rc-update add laptop_mode battery</c> to start it
981automatically.
982</p>
983
984</body>
985</section>
986<section>
987<title>Other tricks</title> 1113<title>Other tricks</title>
988<body> 1114<body>
989
990<p>
991Besides putting your disk to sleep state as early as possible, it is a good
992idea to minimize disk accesses. Have a look at processes that write to your
993disk frequently - the syslogd is a good candidate. You probably don't want to
994shut it down completely, but it's possible to modify the config file so that
995"unnecessary" things don't get logged and thus don't create disk traffic. Cups
996writes to disk periodically, so consider shutting it down and only enable it
997manually when needed.
998</p>
999
1000<pre caption="Disabling cups in battery mode">
1001# <i>rc-update del cupsd battery</i>
1002</pre>
1003 1115
1004<p> 1116<p>
1005Another possibility is to deactivate swap in battery mode. Before writing a 1117Another possibility is to deactivate swap in battery mode. Before writing a
1006swapon/swapoff switcher, make sure there is enough RAM and swap isn't used 1118swapon/swapoff switcher, make sure there is enough RAM and swap isn't used
1007heavily, otherwise you'll be in big problems. 1119heavily, otherwise you'll be in big problems.
1008</p> 1120</p>
1009 1121
1010<p> 1122<p>
1011If you don't want to use laptop-mode, it's still possible to minimize disk 1123If you don't want to use laptop-mode, it's still possible to minimize disk
1012access by mounting certain directories as <e>tmpfs</e> - write accesses are not 1124access by mounting certain directories as <c>tmpfs</c> - write accesses are not
1013stored on a disk, but in main memory and get lost with unmounting. Often it's 1125stored on a disk, but in main memory and get lost with unmounting. Often it's
1014useful to mount <path>/tmp</path> like this - you don't have to pay special 1126useful to mount <path>/tmp</path> like this - you don't have to pay special
1015attention as it gets cleared on every reboot regardless whether it was mounted 1127attention as it gets cleared on every reboot regardless whether it was mounted
1016on disk or in RAM. Just make sure you have enough RAM and no program (like a 1128on disk or in RAM. Just make sure you have enough RAM and no program (like a
1017download client or compress utility) needs extraordinary much space in 1129download client or compress utility) needs extraordinary much space in
1023none /tmp tmpfs size=32m 0 0 1135none /tmp tmpfs size=32m 0 0
1024</pre> 1136</pre>
1025 1137
1026<warn> 1138<warn>
1027Pay attention to the size parameter and modify it for your system. If you're 1139Pay attention to the size parameter and modify it for your system. If you're
1028unsure, don't try this at all, it can become a perfomance bottleneck easily. In 1140unsure, don't try this at all, it can become a performance bottleneck easily. In
1029case you want to mount <path>/var/log</path> like this, make sure to merge the 1141case you want to mount <path>/var/log</path> like this, make sure to merge the
1030log files to disk before unmounting. They are essential. Don't attempt to mount 1142log files to disk before unmounting. They are essential. Don't attempt to mount
1031/var/tmp like this. Portage uses it for compiling... 1143<path>/var/tmp</path> like this. Portage uses it for compiling...
1032</warn> 1144</warn>
1033 1145
1034</body> 1146</body>
1035</section> 1147</section>
1036</chapter> 1148</chapter>
1037 1149
1038<chapter> 1150<chapter>
1039<title>Power Management for other devices</title> 1151<title>Power Management For Other Devices</title>
1040<section> 1152<section>
1041<title>Graphics cards</title> 1153<title>Graphics Cards</title>
1042<body> 1154<body>
1043 1155
1044<p> 1156<p>
1045In case you own an ATI graphics card supporting PowerPlay (dynamic clock 1157In case you own an ATI graphics card supporting PowerPlay (dynamic clock
1046scaling for the the graphics processing unit GPU), you can activate this 1158scaling for the the graphics processing unit GPU), you can activate this
1047feature in X.org. Open <path>/etc/X11/xorg.conf</path> and add (or enable) 1159feature in X.org. Open <path>/etc/X11/xorg.conf</path> and add (or enable) the
1048the <c>DynamicClocks</c> option in the Device section. Please notice that 1160<c>DynamicClocks</c> option in the Device section. Please notice that this
1049this feature will lead to crashes on some systems. 1161feature will lead to crashes on some systems.
1050</p> 1162</p>
1051 1163
1052<pre caption="Enabling ATI PowerPlay support in X.org"> 1164<pre caption="Enabling ATI PowerPlay support in X.org">
1053Section "Device" 1165Section "Device"
1054[...] 1166[...]
1061<section> 1173<section>
1062<title>Wireless Power Management</title> 1174<title>Wireless Power Management</title>
1063<body> 1175<body>
1064 1176
1065<p> 1177<p>
1066Wireless LAN cards consume quite a few energy. Put them in Power Management 1178Wireless LAN cards consume quite a bit of energy. Put them in Power Management
1067mode in analogy to the pm.hda script. 1179mode in analogy to the <c>pmg_hda</c> script.
1068</p> 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>
1069 1186
1070<pre caption="WLAN Power Management automated"> 1187<pre caption="WLAN Power Management automated">
1071#!/sbin/runscript 1188#!/sbin/runscript
1072start() { 1189start() {
1073 ebegin "Activating Power Management for Wireless LAN" 1190 ebegin "Activating Power Management for Wireless LAN"
1074 iwconfig wlan0 power on power max period 3 1191 iwconfig wlan0 power on
1075 eend $? 1192 eend $?
1076} 1193}
1077 1194
1078stop () { 1195stop () {
1079 ebegin "Deactivating Power Management for Wireless LAN" 1196 ebegin "Deactivating Power Management for Wireless LAN"
1081 eend $? 1198 eend $?
1082} 1199}
1083</pre> 1200</pre>
1084 1201
1085<p> 1202<p>
1086Starting this script will put wlan0 in Power Management mode, going to sleep at 1203Starting this script will activate power saving features for wlan0. Save it as
1087the latest three seconds after no traffic.
1088Save it as <path>/etc/init.d/pm.wlan0</path> and add it to the battery runlevel 1204<path>/etc/init.d/pmg_wlan0</path> and add it to the battery runlevel like the
1089like the disk script above. See <c>man iwconfig</c> for details and more 1205disk script above. See <c>man iwconfig</c> for details and more options like
1090options. If your driver and access point support changing the beacon time, this 1206the period between wakeups or timeout settings. If your driver and access point
1091is a good starting point to save even more energy. 1207support changing the beacon time, this is a good starting point to save even
1208more energy.
1092</p> 1209</p>
1093 1210
1094<pre caption="Power Management for WLAN"> 1211<pre caption="Power Management for WLAN">
1095# <i>chmod +x /etc/init.d/pm.wlan0</i> 1212# <i>chmod +x /etc/init.d/pmg_wlan0</i>
1096# <i>/sbin/depscan.sh</i> 1213# <i>/sbin/depscan.sh</i>
1097# <i>rc-update add pm.wlan0 battery</i> 1214# <i>rc-update add pmg_wlan0 battery</i>
1098</pre> 1215</pre>
1099 1216
1100</body> 1217</body>
1101</section> 1218</section>
1102<section> 1219<section>
1107There are two problems with USB devices regarding energy consumption: First, 1224There are two problems with USB devices regarding energy consumption: First,
1108devices like USB mice, digital cameras or USB sticks consume energy while 1225devices like USB mice, digital cameras or USB sticks consume energy while
1109plugged in. You cannot avoid this (nevertheless remove them in case they're not 1226plugged in. You cannot avoid this (nevertheless remove them in case they're not
1110needed). Second, when there are USB devices plugged in, the USB host controller 1227needed). Second, when there are USB devices plugged in, the USB host controller
1111periodically accesses the bus which in turn prevents the CPU from going into 1228periodically accesses the bus which in turn prevents the CPU from going into
1112sleep mode. The kernel offers an experimental option to enable suspension of 1229sleep mode. The kernel offers an experimental option to enable suspension of
1113USB devices through driver calls or one of the <path>power/state</path> files 1230USB devices through driver calls or one of the <path>power/state</path> files
1114in <path>/sys</path>. 1231in <path>/sys</path>.
1115</p> 1232</p>
1116 1233
1117<pre caption="Enabling USB suspend support in the kernel"> 1234<pre caption="Enabling USB suspend support in the kernel">
1124</body> 1241</body>
1125</section> 1242</section>
1126</chapter> 1243</chapter>
1127 1244
1128<chapter> 1245<chapter>
1129<title>Sleep states: sleep, standby, suspend to disk</title> 1246<title>Sleep States: sleep, standby, and suspend to disk</title>
1130<section> 1247<section>
1131<title>Overview</title>
1132<body> 1248<body>
1133 1249
1134<p> 1250<p>
1135ACPI defines different sleep states. The more important ones are 1251ACPI defines different sleep states. The more important ones are
1136</p> 1252</p>
1137 1253
1138<ul> 1254<ul>
1139 <li>S1 aka Standby</li> 1255 <li>S1 aka Standby</li>
1140 <li>S3 aka Suspend to RAM aka Sleep</li> 1256 <li>S3 aka Suspend to RAM aka Sleep</li>
1141 <li>S4 aka Suspend to Disk aka Hibernate</li> 1257 <li>S4 aka Suspend to Disk aka Hibernate</li>
1142</ul> 1258</ul>
1143 1259
1165 [*] ACPI Support 1281 [*] ACPI Support
1166 [*] Sleep States 1282 [*] Sleep States
1167</pre> 1283</pre>
1168 1284
1169<p> 1285<p>
1170Once your kernel is prepared like above, you can use the 1286Once your kernel is properly configured, you can use the
1171<c>hibernate-script</c> to activate suspend or sleep mode. Let's install that 1287<c>hibernate-script</c> to activate suspend or sleep mode. Let's install that
1172first. 1288first.
1173</p> 1289</p>
1174 1290
1175<pre caption="Installing the hibernate-script"> 1291<pre caption="Installing the hibernate-script">
1176<i># emerge hibernate-script</i> 1292# <i>emerge hibernate-script</i>
1177</pre> 1293</pre>
1178 1294
1179<p> 1295<p>
1180Some configuration has to be done in <path>/etc/hibernate</path> The default 1296Some configuration has to be done in <path>/etc/hibernate</path> The default
1181package introduces two configuration files <path>hibernate.conf</path> and 1297package introduces two configuration files <path>hibernate.conf</path> and
1192</p> 1308</p>
1193 1309
1194<p> 1310<p>
1195Ready? Now is the last chance to backup any data you want to keep after 1311Ready? Now is the last chance to backup any data you want to keep after
1196executing the next command. Notice that you probably have to hit a special key 1312executing the next command. Notice that you probably have to hit a special key
1197like <e>Fn</e> to resume from sleep. 1313like <c>Fn</c> to resume from sleep.
1198</p> 1314</p>
1199 1315
1200<pre caption="Calling sleep"> 1316<pre caption="Calling sleep">
1201<i># hibernate-ram</i> 1317# <i>hibernate-ram</i>
1202</pre> 1318</pre>
1203 1319
1204<p> 1320<p>
1205If you're still reading, it seems to work. You can also setup standby (S1) in 1321If you're still reading, it seems to work. You can also setup standby (S1) in a
1206a similar way by copying <path>ram.conf</path> to <path>standby.conf</path> 1322similar way by copying <path>ram.conf</path> to <path>standby.conf</path> and
1207and creating a symlink <path>/usr/sbin/hibernate-standby</path> pointing to 1323creating a symlink <path>/usr/sbin/hibernate-standby</path> pointing to
1208<path>/usr/sbin/hibernate</path>. S3 and S4 are the more interesting sleep 1324<path>/usr/sbin/hibernate</path>. S3 and S4 are the more interesting sleep
1209states due to greater energy savings however. 1325states due to greater energy savings however.
1210</p> 1326</p>
1211 1327
1212</body> 1328</body>
1227Shutdown any NFS or samba server/client before hibernating. 1343Shutdown any NFS or samba server/client before hibernating.
1228</warn> 1344</warn>
1229 1345
1230<p> 1346<p>
1231There are two different implementations for S4. The original one is swsusp, 1347There are two different implementations for S4. The original one is swsusp,
1232then there is the newer suspend2 with a nicer interface (including 1348then there is the newer suspend2 with a nicer interface (including fbsplash
1233fbsplash support). A <uri link="http://suspend2.net/features.html#compare"> 1349support). A <uri link="http://suspend2.net/features.html#compare"> feature
1234feature comparison</uri> is available at the <uri link="http://suspend2.net"> 1350comparison</uri> is available at the <uri link="http://suspend2.net"> suspend2
1235suspend2 Homepage</uri>. There used to be Suspend-to-Disk (pmdisk), a fork of 1351Homepage</uri>. There used to be Suspend-to-Disk (pmdisk), a fork of swsusp,
1236swsusp, but it has been merged back. 1352but it has been merged back.
1237</p> 1353</p>
1238 1354
1239<p> 1355<p>
1240Suspend2 is not included in the mainline kernel yet, therefore you either have 1356Suspend2 is not included in the mainline kernel yet, therefore you either have
1241to patch your kernel sources with the patches provided by 1357to patch your kernel sources with the patches provided by <uri
1242<uri link="http://suspend2.net">suspend2.net</uri> or use 1358link="http://suspend2.net">suspend2.net</uri> or use
1243<c>sys-kernel/suspend2-sources</c>. 1359<c>sys-kernel/suspend2-sources</c>.
1244</p> 1360</p>
1245 1361
1246<p> 1362<p>
1247The kernel part for both swusp and suspend2 is as follows: 1363The kernel part for both swusp and suspend2 is as follows:
1251Power Management Options ---&gt; 1367Power Management Options ---&gt;
1252 <comment>(hibernate with swsusp)</comment> 1368 <comment>(hibernate with swsusp)</comment>
1253 [*] Software Suspend 1369 [*] Software Suspend
1254 <comment>(replace /dev/SWAP with your swap partition)</comment> 1370 <comment>(replace /dev/SWAP with your swap partition)</comment>
1255 (/dev/SWAP) Default resume partition 1371 (/dev/SWAP) Default resume partition
1256 1372
1257 <comment>(hibernate with suspend2)</comment> 1373 <comment>(hibernate with suspend2)</comment>
1258 Software Suspend 2 1374 Software Suspend 2
1259 --- Image Storage (you need at least one writer) 1375 --- Image Storage (you need at least one writer)
1260 [*] File Writer 1376 [*] File Writer
1261 [*] Swap Writer 1377 [*] Swap Writer
1269<p> 1385<p>
1270The configuration for swsusp is rather easy. If you didn't store the location 1386The configuration for swsusp is rather easy. If you didn't store the location
1271of your swap partition in the kernel config, you can also pass it as a 1387of your swap partition in the kernel config, you can also pass it as a
1272parameter with the <c>resume=/dev/SWAP</c> directive. If booting is not 1388parameter with the <c>resume=/dev/SWAP</c> directive. If booting is not
1273possible due to a broken image, use the <c>noresume</c> kernel parameter. The 1389possible due to a broken image, use the <c>noresume</c> kernel parameter. The
1274<c>hibernate-cleanup</c> init script invalidates swsusp images during the 1390<c>hibernate-cleanup</c> init script invalidates swsusp images during the boot
1275boot process. 1391process.
1276</p> 1392</p>
1277 1393
1278<pre caption="Invalidating swsusp images during the boot process"> 1394<pre caption="Invalidating swsusp images during the boot process">
1279<i># rc-update add hibernate-cleanup boot</i> 1395# <i>rc-update add hibernate-cleanup boot</i>
1280</pre> 1396</pre>
1281 1397
1282<p> 1398<p>
1283To activate hibernate with swsusp, use the hibernate script and set 1399To activate hibernate with swsusp, use the hibernate script and set
1284<c>UseSysfsPowerState disk</c> in <path>/etc/hibernate/hibernate.conf</path>. 1400<c>UseSysfsPowerState disk</c> in <path>/etc/hibernate/hibernate.conf</path>.
1287<warn> 1403<warn>
1288Backup your data before doing this. Run <c>sync</c> before executing one of the 1404Backup your data before doing this. Run <c>sync</c> before executing one of the
1289commands to have cached data written to disk. First try it outside of X, then 1405commands to have cached data written to disk. First try it outside of X, then
1290with X running, but not logged in. 1406with X running, but not logged in.
1291</warn> 1407</warn>
1292 1408
1293<p> 1409<p>
1294If you experience kernel panics due to uhci or similar, try to compile USB 1410If you experience kernel panics due to uhci or similar, try to compile USB
1295support as module and unload the modules before sending your laptop to sleep 1411support as module and unload the modules before sending your laptop to sleep
1296mode. There are configuration options for this in <path>hibernate.conf</path> 1412mode. There are configuration options for this in <path>hibernate.conf</path>
1297</p> 1413</p>
1298 1414
1299<pre caption="Hibernating with swsusp"> 1415<pre caption="Hibernating with swsusp">
1300<i># nano -w /etc/hibernate.conf</i> 1416# <i>nano -w /etc/hibernate.conf</i>
1301<comment>(Make sure you have a backup of your data)</comment> 1417<comment>(Make sure you have a backup of your data)</comment>
1302<i># hibernate</i> 1418# <i>hibernate</i>
1303</pre> 1419</pre>
1304 1420
1305<p> 1421<p>
1306The following section discusses the setup of suspend2 including fbsplash 1422The following section discusses the setup of suspend2 including fbsplash
1307support for a nice graphical progress bar during suspend and resume. 1423support for a nice graphical progress bar during suspend and resume.
1308</p> 1424</p>
1309 1425
1310<p> 1426<p>
1311The first part of the configuration is similar to the configuration of 1427The first part of the configuration is similar to the configuration of swsusp.
1312swsusp. In case you didn't store the location of your swap partition in the 1428In case you didn't store the location of your swap partition in the kernel
1313kernel config, you have to pass it as a kernel parameter with the 1429config, you have to pass it as a kernel parameter with the
1314<c>resume2=swap:/dev/SWAP</c> directive. If booting is not possible due to a 1430<c>resume2=swap:/dev/SWAP</c> directive. If booting is not possible due to a
1315broken image, append the <c>noresume2</c> parameter. Additionally, the 1431broken image, append the <c>noresume2</c> parameter. Additionally, the
1316<c>hibernate-cleanup</c> init script invalidates suspend2 images during the 1432<c>hibernate-cleanup</c> init script invalidates suspend2 images during the
1317boot process. 1433boot process.
1318</p> 1434</p>
1319 1435
1320<pre caption="Invalidating suspend2 images during the boot process"> 1436<pre caption="Invalidating suspend2 images during the boot process">
1321<i># rc-update add hibernate-cleanup boot</i> 1437# <i>rc-update add hibernate-cleanup boot</i>
1322</pre> 1438</pre>
1323 1439
1440<p>
1324<p>Now edit <path>/etc/hibernate/hibernate.conf</path>, enable the 1441Now edit <path>/etc/hibernate/hibernate.conf</path>, enable the <c>suspend2</c>
1325<e>suspend2</e> section and comment everything in the <e>sysfs_power_state</e> 1442section and comment everything in the <c>sysfs_power_state</c> and
1326and <e>acpi_sleep</e> sections. Do not enable the fbsplash part in global 1443<c>acpi_sleep</c> sections. Do not enable the <c>fbsplash</c> part in global
1327options yet. 1444options yet.
1328</p> 1445</p>
1329 1446
1330<pre caption="Hibernating with suspend2"> 1447<pre caption="Hibernating with suspend2">
1331<i># nano -w /etc/hibernate.conf</i> 1448# <i>nano -w /etc/hibernate.conf</i>
1332<comment>(Make sure you have a backup of your data)</comment> 1449<comment>(Make sure you have a backup of your data)</comment>
1333<i># hibernate</i> 1450# <i>hibernate</i>
1334</pre> 1451</pre>
1335 1452
1336<p> 1453<p>
1337Please configure fbsplash now if you didn't do already. To enable fbsplash 1454Please configure <c>fbsplash</c> now if you didn't do already. To enable
1338support during hibernation, the <c>sys-apps/suspend2-userui</c> package is 1455fbsplash support during hibernation, the <c>sys-apps/suspend2-userui</c>
1339needed. Additionally, you've got to enable the <e>fbsplash</e> USE flag. 1456package is needed. Additionally, you've got to enable the <c>fbsplash</c> USE
1457flag.
1340</p> 1458</p>
1341 1459
1342<pre caption="Installing suspend2-userui"> 1460<pre caption="Installing suspend2-userui">
1343<i># mkdir -p /etc/portage</i> 1461# <i>mkdir -p /etc/portage</i>
1344<i># echo sys-apps/suspend2-userui fbsplash >> /etc/portage/package.use</i> 1462# <i>echo "sys-apps/suspend2-userui fbsplash" >> /etc/portage/package.use</i>
1345<i># emerge suspend2-userui</i> 1463# <i>emerge suspend2-userui</i>
1346</pre> 1464</pre>
1347 1465
1348<p> 1466<p>
1349The ebuild tells you to make a symlink to the theme you want to use. For 1467The ebuild tells you to make a symlink to the theme you want to use. For
1350example, to use the <c>livecd-2005.1</c> theme, run the following command: 1468example, to use the <c>livecd-2005.1</c> theme, run the following command:
1351</p> 1469</p>
1352 1470
1353<pre caption="Using the livecd-2005.1 theme during hibernation"> 1471<pre caption="Using the livecd-2005.1 theme during hibernation">
1354<i># ln -sfn /etc/splash/livecd-2005.1 /etc/splash/suspend2</i> 1472# <i>ln -sfn /etc/splash/livecd-2005.1 /etc/splash/suspend2</i>
1355</pre> 1473</pre>
1356 1474
1357<p> 1475<p>
1358If you don't want a black screen in the first part of the resume process, you 1476If you don't want a black screen in the first part of the resume process, you
1359have to add the <c>suspend2ui_fbsplash</c> tool to your initrd image. Assuming 1477have to add the <c>suspend2ui_fbsplash</c> tool to your initrd image. Assuming
1360you created the initrd image with <c>splash_geninitramfs</c> and saved it as 1478you created the initrd image with <c>splash_geninitramfs</c> and saved it as
1361<path>/boot/fbsplash-emergence-1024x768</path>, here's how to do 1479<path>/boot/fbsplash-emergence-1024x768</path>, here's how to do that.
1362that.
1363</p> 1480</p>
1364 1481
1365<pre caption="Adding suspend2ui_fbsplash to an initrd image"> 1482<pre caption="Adding suspend2ui_fbsplash to an initrd image">
1366<i># mount /boot</i> 1483# <i>mount /boot</i>
1367<i># mkdir ~/initrd.d</i> 1484# <i>mkdir ~/initrd.d</i>
1368<i># cp /boot/fbsplash-emergence-1024x768 ~/initrd.d/</i> 1485# <i>cp /boot/fbsplash-emergence-1024x768 ~/initrd.d/</i>
1369<i># cd ~/initrd.d</i> 1486# <i>cd ~/initrd.d</i>
1370<i># gunzip -c fbsplash-emergence-1024x768 | cpio -idm --quiet -H newc</i> 1487# <i>gunzip -c fbsplash-emergence-1024x768 | cpio -idm --quiet -H newc</i>
1371<i># rm fbsplash-emergence-1024x768</i> 1488# <i>rm fbsplash-emergence-1024x768</i>
1372<i># cp /usr/sbin/suspend2ui_fbsplash sbin/</i> 1489# <i>cp /usr/sbin/suspend2ui_fbsplash sbin/</i>
1373<i># find . | cpio --quiet --dereference -o -H newc | gzip -9 > /boot/fbsplash-suspend2-emergence-1024x768</i> 1490# <i>find . | cpio --quiet --dereference -o -H newc | gzip -9 > /boot/fbsplash-suspend2-emergence-1024x768</i>
1374</pre> 1491</pre>
1375 1492
1376<p> 1493<p>
1377Afterwards adjust <path>grub.conf</path> respectively <path>lilo.conf</path> 1494Afterwards adjust <path>grub.conf</path> respectively <path>lilo.conf</path> so
1378so that your suspend2 kernel uses 1495that your suspend2 kernel uses
1379<path>/boot/fbsplash-suspend2-emergence-1024x768</path> as initrd image. You 1496<path>/boot/fbsplash-suspend2-emergence-1024x768</path> as initrd image. You
1380can now test a dry run to see if everything is setup correctly. 1497can now test a dry run to see if everything is setup correctly.
1381</p> 1498</p>
1382 1499
1383<pre caption="Test run for fbsplash hibernation"> 1500<pre caption="Test run for fbsplash hibernation">
1384<i># suspend2ui_fbsplash -t</i> 1501# <i>suspend2ui_fbsplash -t</i>
1385</pre> 1502</pre>
1386 1503
1387<p> 1504<p>
1388Afterwards open <path>/etc/hibernate/hibernate.conf</path> again and activate 1505Afterwards open <path>/etc/hibernate/hibernate.conf</path> again and activate
1389the fbsplash options. Execute <c>hibernate</c> and enjoy. 1506the fbsplash options. Execute <c>hibernate</c> and enjoy.
1394</chapter> 1511</chapter>
1395 1512
1396<chapter> 1513<chapter>
1397<title>Troubleshooting</title> 1514<title>Troubleshooting</title>
1398<section> 1515<section>
1399<title>If things go wrong...</title>
1400<body> 1516<body>
1401 1517
1402<p> 1518<p>
1403<e>Q:</e> I'm trying to change the CPU frequency, but 1519<e>Q:</e> I'm trying to change the CPU frequency, but
1404<path>/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor</path> does not 1520<path>/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor</path> does not
1429Try to update the BIOS, especially if a broken DSDT is reported. You can also 1545Try to update the BIOS, especially if a broken DSDT is reported. You can also
1430try to fix it yourself (which is beyond the scope of this guide). 1546try to fix it yourself (which is beyond the scope of this guide).
1431</p> 1547</p>
1432 1548
1433<p> 1549<p>
1434<e>Q:</e> My laptop supports frequency scaling, but according to /proc/cpuinfo 1550<e>Q:</e> My laptop supports frequency scaling, but according to
1435the speed never changes. 1551<path>/proc/cpuinfo</path> the speed never changes.
1436</p> 1552</p>
1437 1553
1438<p> 1554<p>
1439<e>A:</e> Probably you have activated symmetric multiprocessing support 1555<e>A:</e> Probably you have activated symmetric multiprocessing support
1440(CONFIG_SMP) in your kernel. Deactivate it and it should work. Some older 1556(CONFIG_SMP) in your kernel. Deactivate it and it should work. Some older
1441kernels had a bug causing this. In that case, run <c>emerge x86info</c>, 1557kernels had a bug causing this. In that case, run <c>emerge x86info</c>, update
1442update your kernel as asked and check the current frequency with 1558your kernel as asked and check the current frequency with
1443<c>x86info -mhz</c>. 1559<c>x86info -mhz</c>.
1444</p> 1560</p>
1445 1561
1446<p> 1562<p>
1447<e>Q:</e> I can change the CPU frequency, but the range is not as wide as in 1563<e>Q:</e> I can change the CPU frequency, but the range is not as wide as in
1486<e>A:</e> Check that battery support is compiled into your kernel. If you use 1602<e>A:</e> Check that battery support is compiled into your kernel. If you use
1487it as a module, make sure the module is loaded. 1603it as a module, make sure the module is loaded.
1488</p> 1604</p>
1489 1605
1490<p> 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>
1491<e>Q:</e> I have a Dell Inspiron 51XX and I don't get any ACPI events. 1623<e>Q:</e> I have a Dell Inspiron 51XX and I don't get any ACPI events.
1492</p> 1624</p>
1493 1625
1494<p> 1626<p>
1495<e>A:</e> This seems to be a kernel bug. Read on <uri 1627<e>A:</e> This seems to be a kernel bug. Read on <uri
1496link="http://bugme.osdl.org/show_bug.cgi?id=1752">here</uri>. 1628link="http://bugme.osdl.org/show_bug.cgi?id=1752">here</uri>.
1497</p> 1629</p>
1498 1630
1499<p> 1631<p>
1500<e>Q:</e> I activated the DynamicClocks option in <path>xorg.conf</path> and 1632<e>Q:</e> I activated the <c>DynamicClocks</c> option in <path>xorg.conf</path>
1501now X.org crashes / the screen stays black / my laptop doesn't shutdown 1633and now X.org crashes / the screen stays black / my laptop doesn't shutdown
1502properly. 1634properly.
1503</p> 1635</p>
1504 1636
1505<p> 1637<p>
1506<e>A:</e> This happens on some systems. You have to disable DynamicClocks. 1638<e>A:</e> This happens on some systems. You have to disable
1639<c>DynamicClocks</c>.
1507</p> 1640</p>
1508 1641
1509<p> 1642<p>
1510<e>Q:</e> I want to use suspend2, but it tells me my swap partition is too 1643<e>Q:</e> I want to use suspend2, but it tells me my swap partition is too
1511small. Resizing is not an option. 1644small. Resizing is not an option.
1512</p> 1645</p>
1513 1646
1514<p> 1647<p>
1515<e>A:</e> If there is enough free space on your system, you can use the 1648<e>A:</e> If there is enough free space on your system, you can use the
1516filewriter instead of the swapwriter. The <c>hibernate-script</c> supports it 1649filewriter instead of the swapwriter. The <c>hibernate-script</c> supports it
1517as well. More information can be found in 1650as well. More information can be found in
1518<path>/usr/src/linux/Documentation/power/suspend2.txt</path>. 1651<path>/usr/src/linux/Documentation/power/suspend2.txt</path>.
1519</p> 1652</p>
1520 1653
1523minutes! What am I doing wrong? 1656minutes! What am I doing wrong?
1524</p> 1657</p>
1525 1658
1526<p> 1659<p>
1527<e>A:</e> First follow your manufacturer's advice on how to charge the battery 1660<e>A:</e> First follow your manufacturer's advice on how to charge the battery
1528correctly. 1661correctly.
1529</p> 1662</p>
1530 1663
1531<p> 1664<p>
1532<e>Q:</e> The above didn't help. What should I do then? 1665<e>Q:</e> The above didn't help. What should I do then?
1533</p> 1666</p>
1550<p> 1683<p>
1551<e>Q:</e> My problem is not listed above. Where should I go next? 1684<e>Q:</e> My problem is not listed above. Where should I go next?
1552</p> 1685</p>
1553 1686
1554<p> 1687<p>
1555<e>A:</e> Don't fear to contact me, <mail link="fragfred@gmx.de">Dennis 1688<e>A:</e> Don't fear to contact me, <mail link="earthwings@gentoo.org">Dennis
1556Nienhüser</mail>, directly. 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>.
1557</p> 1693</p>
1558 1694
1559</body> 1695</body>
1560</section> 1696</section>
1561</chapter> 1697</chapter>

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

  ViewVC Help
Powered by ViewVC 1.1.20