From f1cec86967d79c94aec4cecc56585c3e186ea9df Mon Sep 17 00:00:00 2001
From: Marc Fonvieille <blackend@FreeBSD.org>
Date: Fri, 20 Jun 2003 17:25:12 +0000
Subject: [PATCH] 2nd part of content updating:

- Update APM part for 4.X and 5.X
- Add a new ACPI section.

Most of changes coming from:
PR:		docs/53292
Submitted by:	Lukas Ertl <l.ertl@univie.ac.at>
---
 en_US.ISO8859-1/articles/laptop/article.sgml | 144 ++++++++++++++++---
 1 file changed, 125 insertions(+), 19 deletions(-)

diff --git a/en_US.ISO8859-1/articles/laptop/article.sgml b/en_US.ISO8859-1/articles/laptop/article.sgml
index 4c32a9554f..8e81885e7a 100644
--- a/en_US.ISO8859-1/articles/laptop/article.sgml
+++ b/en_US.ISO8859-1/articles/laptop/article.sgml
@@ -159,25 +159,130 @@
       FreeBSD.  If you are lucky, some functions may work reliably;
       or they may not work at all.</para>
 
-    <para>To enable this, you may need to compile a kernel with
-      power management support (<literal>device apm0</literal>) or
-      add the option <literal>enable apm0</literal> to 
-      <filename>/boot/loader.conf</filename>, and
-      also enable the &man.apmd.8; daemon at boot time (line
-      <literal>apm_enable="YES"</literal> in
-      <filename>/etc/rc.conf</filename>).  The apm commands are
-      listed in the &man.apm.8; manual page.  For instance,
-      <command>apm -b</command> gives you battery status (or 255 if
-      not supported), <command>apm -Z</command> puts the laptop on
-      standby, <command>apm -z</command> (or zzz) suspends it.  To
-      shutdown and power off the machine, use <command>shutdown -p</command>.
-      Again, some or all of these functions may not work very well
-      or at all.  You may find that laptop suspension/standby works
-      in console mode but not under X (that is, the screen does not
-      come on again; in that case, switch to a virtual console
-      (using Ctrl-Alt-F1 or another function key) and then execute
-      the &man.apm.8; command.
-    </para>
+    <para>To make things a little more complex, there are two existing
+      standards for power management: APM and ACPI, the latter
+      superseding the former and including more features, but also
+      introducing more problems.</para>
+
+    <para>Some laptops support both APM and ACPI (to a certain
+      degree), others just support one of them, so chances are that
+      you have to experiment with both of them to have reliable power
+      management on your laptop.</para>
+
+    <note>
+      <para>You cannot have APM and ACPI enabled at the same time,
+	even if your laptop has support for both of them.</para>
+    </note>
+
+    <sect2>
+      <title>APM</title>
+
+      <para>The APM (Advanced Power Management) BIOS provides support
+	for various power management features like standby, suspend,
+	hibernation, CPU clock slow down etc. and is available
+	under &os;&nbsp;4.X and &os;&nbsp;5.X.</para>
+
+      <para>To enable APM support, you can compile a kernel with power
+	management support (<literal>device apm0</literal> on
+	&os;&nbsp;4.X and <literal>device apm</literal> on
+	&os;&nbsp;5.X).  A kernel module for APM is available under
+	&os;&nbsp;5.X, to simply load the APM kernel module at boot
+	add the line <literal>apm_load="YES"</literal> to
+	<filename>/boot/loader.conf</filename>.</para>
+
+      <para>On &os;&nbsp;5.X, you also have to set
+	<literal>hint.apm.0.disabled="0"</literal> in
+	<filename>/boot/device.hints</filename>.</para>
+
+      <para>You can start APM at boot time by having
+	<literal>apm_enable="YES"</literal> in
+	<filename>/etc/rc.conf</filename>.  You may also want start
+	the &man.apmd.8; daemon by adding
+	<literal>apmd_enable="YES"</literal> to
+	<filename>/etc/rc.conf</filename>, which takes care of
+	various APM events that are posted to the BIOS, so you can
+	have your laptop suspend/resume by pressing some function
+	key on the keyboard or by closing/opening the lid.</para>
+
+      <para>The APM commands are listed in the &man.apm.8; manual page.
+	For instance, <command>apm -b</command> gives you battery
+	status (or 255 if not supported), <command>apm -Z</command>
+	puts the laptop on standby, <command>apm -z</command> (or
+	<command>zzz</command>) suspends it.  To shutdown and power
+	off the machine, use <command>shutdown -p</command>.  Again,
+	some or all of these functions may not work very well or at
+	all.</para>
+
+      <para>You may find that laptop suspension/standby works in
+	console mode but not under X (that is, the screen does not
+	come on again); if you are running &os;&nbsp;5.X, one solution
+	for this might be to put <literal>options
+	SC_NO_SUSPEND_VTYSWITCH</literal>
+	in your kernel configuration file and recompile your kernel.
+	Another workaround is to switch to a virtual console (using
+        <keycombo
+	action="simul"><keycap>Ctrl</keycap><keycap>Alt</keycap><keycap>F1</keycap></keycombo>
+	or another function key) and then execute &man.apm.8;.
+	You can automate this with &man.vidcontrol.1;, if you are
+	running &man.apmd.8;.  Simply edit
+	<filename>/etc/apmd.conf</filename> and change it to
+	this:</para>
+
+      <programlisting>apm_event SUSPENDREQ {
+ exec "vidcontrol -s 1 &lt; /dev/console";
+ exec "/etc/rc.suspend";
+}
+
+apm_event USERSUSPENDREQ {
+ exec "vidcontrol -s 1 &lt; /dev/console";
+ exec "sync && sync && sync";
+ exec "sleep 1";
+ exec "apm -z";
+}
+
+apm_event NORMRESUME, STANDBYRESUME {
+ exec "/etc/rc.resume";
+ exec "vidcontrol -s 9 &lt; /dev/console";
+}</programlisting>
+    </sect2>
+
+    <sect2>
+      <title>ACPI</title>
+
+      <para>ACPI (Advanced Configuration and Power Management
+	Interface) provides not only power management but also
+	platform hardware discovery (superseding PnP and PCI BIOS).
+	ACPI is only available under &os;&nbsp;5.X and is enabled by
+	default, so you do not have to do anything special to get it
+	running.  You can control ACPI behaviour with
+	&man.acpiconf.8;.</para>
+
+      <para>Unfortunately, vendors often ship their laptops with
+	broken ACPI implementations, thus having ACPI enabled
+	sometimes causes more problems than being useful, up to the
+	point that you cannot even boot &os; on some machines with
+	ACPI enabled.</para>
+
+      <para>If ACPI is causing problems, you might check if your
+	laptop vendor has released a new BIOS version that fixes some
+	bugs.  Since the &os; ACPI implementation is still very
+	evolving code, you might also want to upgrade your system;
+	chances are that your problems are fixed.</para>
+
+      <para>If you want to disable ACPI simply add
+	<literal>hint.acpi.0.disabled="1"</literal> to
+	<filename>/boot/device.hints</filename>.  You can disable
+	ACPI temporarily at the boot loader prompt by issueing
+	<literal>unset acpi_load</literal> if you are having problems
+	booting an ACPI enabled machine.  &os;&nbsp;5.1-RELEASE and
+	later come with a boot-time menu that controls how &os; is
+	booted.  One of the proposed options is to turn off ACPI.  So
+	to disable ACPI just select <guimenuitem>2. Boot &os; with ACPI
+	disabled</guimenuitem> in the menu.</para>
+    </sect2>
+
+    <sect2>
+      <title>Display Power Management</title>
 
     <para>The X window system (<application>XFree86</application>) also includes display power
       management (look at the &man.xset.1; manual page, and search for
@@ -185,6 +290,7 @@
       too, works inconsistently on laptops: it
       often turns off the display but does not turn off the
       backlight.</para>
+    </sect2>
 
   </sect1>
 </article>