Skip to contentSkip to conversation

Share APM emulator between architectures.

APM Ralf Baechle 2 participants 2 messages Oct 5, 2006 – Oct 6, 2006

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

Currently ARM and MIPS both have a copy of the APM emulation code. Move that code to drivers/char and make it selectable through SYS_SUPPORTS_APM_EMULATION. To make this work, fix MIPS Kconfig to use kernel/power/Kconfig.

arch/arm/Kconfig +1 -25
index adb05de..466e7fe 100644
@@ -9,6 +9,7 @@ config ARM
 	bool
 	default y
 	select RTC_LIB
+	select SYS_SUPPORTS_APM_EMULATION
 	help
 	  The ARM series is a line of low-power-consumption RISC chip designs
 	  licensed by ARM Ltd and targeted at embedded applications and
@@ -823,31 +824,6 @@ menu "Power management options"
 
 source "kernel/power/Kconfig"
 
-config APM
-	tristate "Advanced Power Management Emulation"
-	---help---
-	  APM is a BIOS specification for saving power using several different
-	  techniques. This is mostly useful for battery powered laptops 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/arm/common/sharpsl_pm.c +1 -1
index f412ded..9ab3eda 100644
@@ -27,7 +27,7 @@ #include <linux/leds.h>
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/irq.h>
-#include <asm/apm.h>
+#include <asm/apm-emulation.h>
 #include <asm/arch/pm.h>
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/sharpsl.h>
arch/arm/kernel/Makefile +0 -1
index 1320a0e..a89ad33 100644
@@ -10,7 +10,6 @@ obj-y		:= compat.o entry-armv.o entry-co
 		   process.o ptrace.o semaphore.o setup.o signal.o sys_arm.o \
 		   time.o traps.o
 
-obj-$(CONFIG_APM)		+= apm.o
 obj-$(CONFIG_ISA_DMA_API)	+= dma.o
 obj-$(CONFIG_ARCH_ACORN)	+= ecard.o 
 obj-$(CONFIG_FIQ)		+= fiq.o
arch/arm/kernel/apm.c deleted +0 -597

597 lines not on this page · raw message

arch/arm/mach-pxa/corgi_pm.c +1 -1
index 4c3de40..165017d 100644
@@ -16,7 +16,7 @@ #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
-#include <asm/apm.h>
+#include <asm/apm-emulation.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 #include <asm/hardware.h>
arch/arm/mach-pxa/sharpsl_pm.c +1 -1
index db6e8f5..b1d8cfc 100644
@@ -23,7 +23,7 @@ #include <linux/platform_device.h>
 
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
-#include <asm/apm.h>
+#include <asm/apm-emulation.h>
 #include <asm/arch/pm.h>
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/sharpsl.h>
arch/arm/mach-pxa/spitz_pm.c +1 -1
index 40be833..b97d543 100644
@@ -16,7 +16,7 @@ #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
-#include <asm/apm.h>
+#include <asm/apm-emulation.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 #include <asm/hardware.h>
arch/mips/Kconfig +6 -29
index 3ecf211..fb14d4c 100644
@@ -954,6 +954,7 @@ config SOC_AU1X00
 	bool
 	select SYS_HAS_CPU_MIPS32_R1
 	select SYS_SUPPORTS_32BIT_KERNEL
+	select SYS_SUPPORTS_APM_EMULATION
 
 config PNX8550
 	bool
@@ -1966,35 +1967,11 @@ config SECCOMP
 
 	  If unsure, say Y. Only embedded should say N here.
 
-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
+
+menu "Power management options"
+
+source "kernel/power/Kconfig"
 
 endmenu
 
arch/mips/kernel/Makefile +0 -2
index cd9cec9..65490f6 100644
@@ -14,8 +14,6 @@ binfmt_irix-objs	:= irixelf.o irixinv.o 
 obj-$(CONFIG_STACKTRACE)	+= stacktrace.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 deleted +0 -604

604 lines not on this page · raw message

drivers/char/Makefile +2 -0
index 44b2e0e..00d0d07 100644
@@ -60,6 +60,8 @@ obj-$(CONFIG_BRIQ_PANEL)	+= briq_panel.o
 obj-$(CONFIG_PRINTER)		+= lp.o
 obj-$(CONFIG_TIPAR)		+= tipar.o
 
+obj-$(CONFIG_APM_EMULATION)	+= apm-emulation.o
+
 obj-$(CONFIG_DTLK)		+= dtlk.o
 obj-$(CONFIG_R3964)		+= n_r3964.o
 obj-$(CONFIG_APPLICOM)		+= applicom.o
drivers/char/apm-emulation.c new file +597 -0

597 lines not on this page · raw message

include/asm-arm/apm.h deleted +0 -64

64 lines not on this page · raw message

include/asm-mips/apm.h deleted +0 -64

64 lines not on this page · raw message

include/linux/apm-emulation.h new file +64 -0

64 lines not on this page · raw message

kernel/power/Kconfig +29 -0
index 825068c..4f0472c 100644
@@ -130,3 +130,32 @@ config SUSPEND_SMP
 	bool
 	depends on HOTPLUG_CPU && X86 && PM
 	default y
+
+config APM_EMULATION
+	tristate "Advanced Power Management Emulation"
+	depends on SYS_SUPPORTS_APM_EMULATION
+	---help---
+	  APM is a BIOS specification for saving power using several different
+	  techniques. This is mostly useful for battery powered laptops 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).
+
+config SYS_SUPPORTS_APM_EMULATION
+	bool
#1 lore raw
Quoted 4 lines · On Thu, 5 Oct 2006 16:18:40 +0100 Ralf Baechle <[email protected]> wrote:

Currently ARM and MIPS both have a copy of the APM emulation code. Move that code to drivers/char and make it selectable through SYS_SUPPORTS_APM_EMULATION. To make this work, fix MIPS Kconfig to use kernel/power/Kconfig.

It would have been better to create the new driver as a standalone patch, then let arm and mips independently migrate over to it later on.

But if Russell's OK with this patch we can run with it.