OLPC: Add XO-1 poweroff support
PATCH 1/1 OLPC: Add XO-1 poweroff support
Add a pm_power_off handler for the OLPC XO-1 laptop.
--- arch/x86/Kconfig | 6 ++ arch/x86/kernel/Makefile | 1 + arch/x86/kernel/olpc-xo1.c | 112 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+), 0 deletions(-) create mode 100644 arch/x86/kernel/olpc-xo1.c
The new olpc-xo1.c file will also be used for further functionality (suspend/resume, lid switch device, etc); patches to be submitted shortly after the review/merge of this one.
arch/x86/Kconfig +6 -0
@@ -2065,6 +2065,12 @@ config OLPC Add support for detecting the unique features of the OLPC XO hardware. +config OLPC_XO1 + bool "OLPC XO-1 support" + depends on OLPC + ---help--- + Add support for non-essential features of the OLPC XO-1 laptop. + config OLPC_OPENFIRMWARE bool "Support for OLPC's Open Firmware" depends on !X86_64 && !X86_PAE
arch/x86/kernel/Makefile +1 -0
@@ -106,6 +106,7 @@ obj-$(CONFIG_SCx200) += scx200.o scx200-y += scx200_32.o obj-$(CONFIG_OLPC) += olpc.o +obj-$(CONFIG_OLPC_XO1) += olpc-xo1.o obj-$(CONFIG_OLPC_OPENFIRMWARE) += olpc_ofw.o obj-$(CONFIG_X86_MRST) += mrst.o
arch/x86/kernel/olpc-xo1.c new file +112 -0
112 lines not on this page · raw message
Signature · 1 line
1.7.2.3
Quoted 20 lines · On Thu, 7 Oct 2010 19:59:52 +0100 (BST) Daniel Drake <[email protected]> wrote:
Add a
pm_power_offhandler for the OLPC XO-1 laptop.Signed-off-by Daniel Drake <[email protected]>--- arch/x86/Kconfig | 6 ++ arch/x86/kernel/Makefile | 1 + arch/x86/kernel/olpc-xo1.c | 112++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+), 0 deletions(-) create mode 100644
arch/x86/kernel/olpc-xo1.cThe new
olpc-xo1.cfile will also be used for further functionality (suspend/resume, lid switch device, etc); patches to be submitted shortly after the review/merge of this one.arch/x86/Kconfig +0
-0
arch/x86/Kconfig config OLPC · line 2069
Quoted 5 lines
arch/x86/Kconfig +2
-0@@ -2065,6 +2065,12 @@ config OLPC Add support for detecting the unique features of the OLPC XO hardware. +config OLPC_XO1 + bool "OLPC XO-1 support"
Any particular reason why this can't be modular?
[...]
arch/x86/Kconfig config OLPC · line 2072
Quoted 3 lines
arch/x86/Kconfig +3
-0+ + pm_power_off = xo1_power_off; +
If this were to be modular, I'm not sure what the best option is for pm_power_off. If the old value was saved upon module load, and restored upon module unload, I could imagine races like the following:
module A load:
saved_ppo = pm_power_off; /* NULL */
pm_power_off = frob;
module B load:
old_ppo = pm_power_off; /* frob */
pm_power_off = foo;
module A unload:
pm_power_off = saved_ppo; /* NULL */
So I guess just clobbering whatever's in pm_power_off and setting back to NULL upon unload, with the assumption that driver's only really going to clobber it in the case of actual OLPC hardware, and the callbacks being clobbered wouldn't really have done the correct thing anyways?
Quoted 5 lines
arch/x86/Kconfig +5
-0+ printk(KERN_INFO "OLPC XO-1 support registered\n"); + return 0; +} +device_initcall(olpc_xo1_init); +
Quoted 1 line · Andres Salomon
Any particular reason why this can't be modular?
Because of the pm_power_off thing.
Also, a similar situation would be encountered with set_suspend_ops().
I don't really understand your suggestion. If we set it to NULL on module unload then the power off would crash on shutdown, right?
Daniel
Quoted 10 lines · On Thu, 7 Oct 2010 21:42:59 +0100 Daniel Drake <[email protected]> wrote:
Quoted 1 line · Andres Salomon
Any particular reason why this can't be modular?
Because of the
pm_power_offthing.
Also, a similar situation would be encountered withset_suspend_ops().I don't really understand your suggestion. If we set it to NULL on module unload then the power off would crash on shutdown, right?
Daniel
See arch/x86/kernel/apm_32.c for an example of modular pm_power_off handling.
Power off shouldn't crash; at least, native_machine_power_off first check if pm_power_off is !NULL before calling it.