Skip to contentSkip to conversation

APM (emu) support

PATCH In review Rodolfo Giometti 2 participants 2 messages Jun 5, 2006 – Jun 13, 2006 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 APM (emu) support

Hello,

here my proposal to add APM (emu) support into mips tree. It's just the one for ARM adapted...

I have tested it on my au1100 based board with a battery pack. Also the command:

   $ apm --suspend

works correctly!

Ciao,

Rodolfo

Signature · 4 lines
GNU/Linux Solutions                  e-mail:    [email protected]
Linux Device Driver                             [email protected]
Embedded Systems                     		[email protected]
UNIX programming                     phone:     +39 349 2432127
arch/mips/Kconfig +26 -0
index df2c58a..a783803 100644
@@ -1848,6 +1848,32 @@ config PM
 	bool "Power Management support (EXPERIMENTAL)"
 	depends on EXPERIMENTAL && SOC_AU1X00
 
+config APM
+        tristate "Advanced Power Management Emulation"
+	depends on PM
+        ---help---
+	  APM is a BIOS specification for saving power using several different
+	  techniques. This is mostly useful for battery powered systems with
+	  APM compliant BIOSes. If you say Y here, the system time will be
+	  reset after a RESUME operation, the /proc/apm device will provide
+	  battery status information, and user-space programs will receive
+	  notification of APM "events" (e.g. battery status change).
+
+	  In order to use APM, you will need supporting software. For location
+	  and more information, read <file:Documentation/pm.txt> and the
+	  Battery Powered Linux mini-HOWTO, available from
+	  <http://www.tldp.org/docs.html#howto>.
+
+	  This driver does not spin down disk drives (see the hdparm(8)
+	  manpage ("man 8 hdparm") for that), and it doesn't turn off
+	  VESA-compliant "green" monitors.
+
+	  Generally, if you don't have a battery in your machine, there isn't
+	  much point in using this driver and you should say N. If you get
+	  random kernel OOPSes or reboots that don't seem to be related to
+	  anything, try disabling/enabling this option (or disabling/enabling
+	  APM in your BIOS).
+
 endmenu
 
 source "net/Kconfig"
arch/mips/kernel/Makefile +2 -0
index 34e8a25..881c467 100644
@@ -13,6 +13,8 @@ binfmt_irix-objs	:= irixelf.o irixinv.o 
 
 obj-$(CONFIG_MODULES)		+= mips_ksyms.o module.o
 
+obj-$(CONFIG_APM)		+= apm.o
+
 obj-$(CONFIG_CPU_R3000)		+= r2300_fpu.o r2300_switch.o
 obj-$(CONFIG_CPU_TX39XX)	+= r2300_fpu.o r2300_switch.o
 obj-$(CONFIG_CPU_TX49XX)	+= r4k_fpu.o r4k_switch.o
arch/mips/kernel/apm.c new file +605 -0

605 lines not on this page · raw message

include/asm-mips/apm.h new file +65 -0

65 lines not on this page · raw message

#1 lore raw
Quoted 9 lines · Rodolfo Giometti

here my proposal to add APM (emu) support into mips tree. It's just the one for ARM adapted...

I have tested it on my au1100 based board with a battery pack. Also the command:

   $ apm --suspend

works correctly!

Looking good, indeed.

There is a sore spot though. Your patch creates arch/mips/kernel/apm.c as an essentially unmodified copy of arch/arch/kernel/apm.c and the latter as you have found is actually portable code. So I suggest you rather move that file to drivers/char/ and use it for both architectures.

Ralf