Gentoo Archives: gentoo-doc-cvs

From: Stefano Rossi <so@×××××××××××.org>
To: gentoo-doc-cvs@l.g.o
Subject: [gentoo-doc-cvs] cvs commit: power-management-guide.xml
Date: Fri, 28 Oct 2005 14:48:14
Message-Id: 200510281448.j9SEm7cY005181@robin.gentoo.org
1 so 05/10/28 14:48:06
2
3 Modified: xml/htdocs/doc/en power-management-guide.xml
4 Log:
5 #106878 update for this guide
6
7 Revision Changes Path
8 1.15 +409 -157 xml/htdocs/doc/en/power-management-guide.xml
9
10 file : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/power-management-guide.xml?rev=1.15&content-type=text/x-cvsweb-markup&cvsroot=gentoo
11 plain: http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/power-management-guide.xml?rev=1.15&content-type=text/plain&cvsroot=gentoo
12 diff : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/power-management-guide.xml.diff?r1=1.14&r2=1.15&cvsroot=gentoo
13
14 Index: power-management-guide.xml
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v
17 retrieving revision 1.14
18 retrieving revision 1.15
19 diff -u -r1.14 -r1.15
20 --- power-management-guide.xml 10 Jun 2005 18:45:21 -0000 1.14
21 +++ power-management-guide.xml 28 Oct 2005 14:48:06 -0000 1.15
22 @@ -1,7 +1,7 @@
23 <?xml version='1.0' encoding="UTF-8"?>
24 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
25 -<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v 1.14 2005/06/10 18:45:21 swift Exp $ -->
26 -<guide link="power-management-guide.xml">
27 +<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v 1.15 2005/10/28 14:48:06 so Exp $ -->
28 +<guide link="/doc/en/power-management-guide.xml">
29 <title>Power Management Guide</title>
30
31 <author title="Author">
32 @@ -14,11 +14,11 @@
33 </abstract>
34
35 <!-- The content of this document is licensed under the CC-BY-SA license -->
36 -<!-- See http://creativecommons.org/licenses/by-sa/2.0 -->
37 +<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
38 <license/>
39
40 -<version>1.24</version>
41 -<date>2005-06-10</date>
42 +<version>1.25</version>
43 +<date>2005-10-02</date>
44
45 <chapter>
46 <title>Introduction</title>
47 @@ -27,7 +27,7 @@
48 <body>
49
50 <p>
51 -Capacity and lifetime of laptop batteries has improved much in the last years.
52 +Capacity and lifetime of laptop batteries have improved much in the last years.
53 Nevertheless modern processors consume much more energy than older ones and
54 each laptop generation introduces more devices hungry for energy. That's why
55 Power Management is more important than ever. Increasing battery run time
56 @@ -58,16 +58,16 @@
57 The <e>Prerequisites</e> chapter talks about some requirements that should be
58 met before any of the following device individual sections will work. This
59 includes BIOS settings, kernel configuration and some simplifications in user
60 -land. The following three chapters focus on devices that typically consume most
61 -energy - processor, display and hard drive. Each can be configured seperately.
62 -<e>CPU Power Management</e> shows how to adjust the processor's frequency to
63 -save a maximum of energy whithout losing too much performance. A few different
64 -tricks prevent your hard drive from working unnecessarily often in <e>Disk Power
65 -Management</e> (decreasing noise level as a nice side effect). Some notes on
66 -Wireless LAN and USB finish the device section in <e>Power Management for other
67 -devices</e> while another chapter is dedicated to the (rather experimental)
68 -<e>sleep states</e>. Last not least <e>Troubleshooting</e> lists common
69 -pitfalls.
70 +land. The following three chapters focus on devices that typically consume
71 +most energy - processor, display and hard drive. Each can be configured
72 +seperately. <e>CPU Power Management</e> shows how to adjust the processor's
73 +frequency to save a maximum of energy whithout losing too much performance. A
74 +few different tricks prevent your hard drive from working unnecessarily often
75 +in <e>Disk Power Management</e> (decreasing noise level as a nice side
76 +effect). Some notes on graphics cards, Wireless LAN and USB finish the device
77 +section in <e>Power Management for other devices</e> while another chapter is
78 +dedicated to the (rather experimental) <e>sleep states</e>. Last not least
79 +<e>Troubleshooting</e> lists common pitfalls.
80 </p>
81
82 </body>
83 @@ -135,42 +135,55 @@
84 </p>
85
86 <p>
87 -In kernel config, activate at least these options:
88 +There are different kernel sources in Portage. I'd recommend using
89 +<c>gentoo-sources</c> or <c>suspend2-sources</c>. The latter contains patches
90 +for Software Suspend 2, see the chapter about sleep states for details. When
91 +configuring the kernel, activate at least these options:
92 </p>
93
94 <pre caption="Minimum kernel setup for Power Management (Kernel 2.6)">
95 Power Management Options ---&gt;
96 [*] Power Management Support
97 [ ] Software Suspend
98 - [ ] Suspend-to-Disk Support
99
100 ACPI( Advanced Configuration and Power Interface ) Support ---&gt;
101 [*] ACPI Support
102 [ ] Sleep States
103 + [ ] /proc/acpi/sleep (deprecated)
104 [*] AC Adapter
105 [*] Battery
106 &lt;M&gt; Button
107 + &lt;M&gt; Video
108 + [ ] Generic Hotkey
109 &lt;M&gt; Fan
110 &lt;M&gt; Processor
111 &lt;M&gt; Thermal Zone
112 &lt; &gt; ASUS/Medion Laptop Extras
113 + &lt; &gt; IBM ThinkPad Laptop Extras
114 &lt; &gt; Toshiba Laptop Extras
115 + (0) Disable ACPI for systems before Jan 1st this year
116 [ ] Debug Statements
117 + [*] Power Management Timer Support
118 + &lt; &gt; ACPI0004,PNP0A05 and PNP0A06 Container Driver (EXPERIMENTAL)
119
120 CPU Frequency Scaling ---&gt;
121 [*] CPU Frequency scaling
122 + [ ] Enable CPUfreq debugging
123 + &lt; &gt; CPU frequency translation statistics
124 + [ ] CPU frequency translation statistics details
125 Default CPUFreq governor (userspace)
126 &lt;*&gt; 'performance' governor
127 &lt;*&gt; 'powersave' governor
128 &lt;*&gt; 'ondemand' cpufreq policy governor
129 + &lt;*&gt; 'conservative' cpufreq governor
130 &lt;*&gt; CPU frequency table helpers
131 &lt;M&gt; ACPI Processor P-States driver
132 &lt;*&gt; <i>CPUFreq driver for your processor</i>
133 </pre>
134
135 <p>
136 -Decide yourself whether you want to enable Software Suspend, Suspend-to-Disk and
137 -Sleep States (see below). If you own an ASUS, Medion or Toshiba laptop, enable
138 +Decide yourself whether you want to enable Software Suspend, and Sleep States
139 +(see below). If you own an ASUS, Medion, IBM Thinkpad or Toshiba laptop, enable
140 the appropriate section.
141 </p>
142
143 @@ -237,8 +250,25 @@
144 <p>
145 Typical ACPI events are closing the lid, changing the power source or pressing
146 the sleep button. An important event is changing the power source, which should
147 -cause a runlevel switch. Create the following files to switch between
148 -<e>default</e> and <e>battery</e> runlevel depending on the power source:
149 +cause a runlevel switch. A small script will take care of it.
150 +</p>
151 +
152 +<p>
153 +First you need a script which changes the runlevel to <c>default</c>
154 +respectively <c>battery</c> depending on the power source. The script uses the
155 +<c>on_ac_power</c> command from <c>sys-power/powermgmt-base</c> - make sure the
156 +package is installed on your system.
157 +</p>
158 +
159 +<pre caption="Installing powermgt-base">
160 +<i># emerge powermgmt-base</i>
161 +</pre>
162 +
163 +<p>
164 +You are now able to determine the power source by executing
165 +<c>on_ac_power &amp;&amp; echo AC available || echo Running on batteries</c> in
166 +a shell. The script below is responsible for changing runlevels. Save it as
167 +<path>/etc/acpi/actions/pmg_switch_runlevel.sh</path>.
168 </p>
169
170 <pre caption="/etc/acpi/actions/pmg_switch_runlevel.sh">
171 @@ -276,29 +306,56 @@
172 fi
173 </pre>
174
175 +<p>
176 +Dont forget to run <c>chmod +x /etc/acpi/actions/pmg_switch_runlevel.sh</c> to
177 +make the script executable. The last thing that needs to be done is calling the
178 +script whenever the power source changes. That's done by catching ACPI events
179 +with the help of <c>acpid</c>. First you need to know which events are
180 +generated when the power source changes. The events are called
181 +<e>ac_adapter</e> and <e>battery</e> on most laptops, but it might be different
182 +on yours.
183 +</p>
184 +
185 +<pre caption="Determining ACPI events for changing the power source">
186 +<i># tail -f /var/log/acpid | grep "received event"</i>
187 +</pre>
188 +
189 +<p>
190 +Run the command above and pull the power cable. You should see something
191 +like this:
192 +</p>
193 +
194 +<pre caption="Sample output for power source changes">
195 +[Tue Sep 20 17:39:06 2005] received event "ac_adapter AC 00000080 00000000"
196 +[Tue Sep 20 17:39:06 2005] received event "battery BAT0 00000080 00000001"
197 +</pre>
198 +
199 +<p>
200 +The interesting part is the quoted string after <e>received event</e>. It will
201 +be matched by the event line in the files you are going to create below. Don't
202 +worry if your system generates multiple events or always the same. As long as
203 +any event is generated, runlevel changing will work.
204 +</p>
205 +
206 <pre caption="/etc/acpi/events/pmg_ac_adapter">
207 <comment># replace "ac_adapter" below with the event generated on your laptop</comment>
208 -<comment># See /var/log/acpid</comment>
209 +<comment># For example, ac_adapter.* will match ac_adapter AC 00000080 00000000</comment>
210 event=ac_adapter.*
211 action=/etc/acpi/actions/pmg_switch_runlevel.sh %e
212 </pre>
213
214
215
216 --
217 gentoo-doc-cvs@g.o mailing list