PM: fast power off - core
Subsystems (3)
PATCH 1/2 PM: fast power off - core
My apologies, I cc'd the wrong list the first time around.
- Armin
---
Fastpoweroff allows a user to power down the system without using rc kill scripts. This is used in the advent of a battery operated device about to lose power. The user interface is vis sysfs /sys/power/fastpoweroff. A simple cat of the fastpoweroff will list any registered profiles. To invoke
the profile sequence, echo {profile name} > /sys/power/fastpoweroff.
This is the core code for fastpoweroff profile support, it includes a register/unregister and default profile callbacks.
--- fs/super.c | 6 + kernel/power/Kconfig | 2 kernel/power/Makefile | 2 kernel/power/fastoff/Kconfig | 13 +++ kernel/power/fastoff/Makefile | 8 ++ kernel/power/fastoff/fpo.c | 155 ++++++++++++++++++++++++++++++++++++++++++ kernel/power/fastoff/fpo.h | 27 +++++++ 7 files changed, 213 insertions(+)
kernel/power/Kconfig +2 -0
@@ -131,3 +131,5 @@ config SUSPEND_SMP bool depends on HOTPLUG_CPU && X86 && PM default y + +source "kernel/power/fastoff/Kconfig"
kernel/power/Makefile +2 -0
@@ -8,3 +8,5 @@ obj-$(CONFIG_PM_LEGACY) += pm.o obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o disk.o snapshot.o swap.o user.o obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o + +obj-$(CONFIG_FAST_POWER_OFF) += fastoff/
kernel/power/fastoff/Kconfig new file +13 -0
@@ -0,0 +1,13 @@ +# +# Fast power off configuration +# +menu "Fast Power off" + +config FAST_POWER_OFF + bool "Fast power off support" + default y + depends on PM && SYSFS + ---help--- + Say yes if you want core support for sysfs/power/fastoff + +endmenu
kernel/power/fastoff/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# +# Makefile for Fast Power off +# +# 15 Jan. 2007 Armin Kuster <[email protected]> +# + +obj-$(CONFIG_FAST_POWER_OFF) := fpo.o +
kernel/power/fastoff/fpo.h new file +27 -0
@@ -0,0 +1,27 @@ +#ifndef __FASTOFF_H__ +#define __FASTOFF_H__ +/* +* kernel/power/fastoff/fpo.h +* +* Author: Armin Kuster <[email protected], or [email protected]> +* +* 2006, 2007 (c) MontaVista Software, Inc. This file is licensed under +* the terms of the GNU General Public License version 2. This program +* is licensed "as is" without any warranty of any kind, whether express +* or implied. +*/ + +#define FPO_NAME_LEN 16 + +struct fpo_driver { +char name[FPO_NAME_LEN ]; +int (*policy) (void ); +struct list_head fpo_list; +}; + +extern int fastpoweroff_register (struct fpo_driver *fpo); +extern void fastpoweroff_unregister (struct fpo_driver *fpo); +extern void fastpoweroff_prepare (void ); +extern void fastpoweroff (void ); +extern void fastpoweroff_standby (void ); +#endif /* __FASTOFF_H__ */
kernel/power/fastoff/fpo.c new file +155 -0
155 lines not on this page · raw message
fs/super.c +6 -0
@@ -649,6 +649,12 @@ void emergency_remount(void)pdflush_operation (do_emergency_remount,0 ); } +#ifdef CONFIG_FAST_POWER_OFF +void suspend_emergency_remount (void ) +{ +do_emergency_remount (0 ); +} +#endif /* * Unnamed block devices are dummy devices used by virtual * filesystems which don't use real block-devices. -- jrs
Quoted 1 line · On Sat, 27 Jan 2007 10:05:43 -1000 akuster wrote:
My apologies, I cc'd the wrong list the first time around.
{argh, attachments}
kernel/power/Kconfig +2 -0
@@ -131,3 +131,5 @@ config SUSPEND_SMP bool depends on HOTPLUG_CPU && X86 && PM default y + +source "kernel/power/fastoff/Kconfig"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Why a separate, new Kconfig file?
We shouldn't add a new Kconfig file for every new 1-2 kconfig symbols.
---
~Randy
Quoted 5 lines · Randy Dunlap
Quoted 1 line · On Sat, 27 Jan 2007 10:05:43 -1000 akuster wrote:
My apologies, I cc'd the wrong list the first time around.
{argh, attachments}
my bad
Quoted 11 lines
kernel/power/Kconfig +2
-0@@ -131,3 +131,5 @@ config SUSPEND_SMP bool depends on HOTPLUG_CPU && X86 && PM default y + +source "kernel/power/fastoff/Kconfig"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 1 line
Why a separate, new
Kconfigfile?
Thought it would be cleaner.
Quoted 1 line
We shouldn't add a new
Kconfigfile for every new 1-2 kconfig symbols.
OK
Quoted 4 lines
---
~Randy