public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] PM: fast power off - driver
@ 2007-01-27 20:05 akuster
  2007-01-28  3:20 ` Andi Kleen
  2007-01-28 18:09 ` Randy Dunlap
  0 siblings, 2 replies; 4+ messages in thread
From: akuster @ 2007-01-27 20:05 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 72 bytes --]

My apologies, I cc'd the wrong list the first time around.

- Armin
---

[-- Attachment #2: fastpoweroff-1.0_driver.patch --]
[-- Type: text/x-patch, Size: 3040 bytes --]


Fastpoweroff default profile driver

signed-off-by: Armin Kuster <AKuster@mvista.com>
---
 kernel/power/fastoff/Kconfig      |    8 ++++
 kernel/power/fastoff/Makefile     |    2 -
 kernel/power/fastoff/fastoffdrv.c |   69 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 78 insertions(+), 1 deletion(-)

Index: linux-2.6_dev/kernel/power/fastoff/fastoffdrv.c
===================================================================
--- /dev/null
+++ linux-2.6_dev/kernel/power/fastoff/fastoffdrv.c
@@ -0,0 +1,69 @@
+/*
+ * kernel/power/fastoff/fastoffdrv.c
+ *
+ * This provides a sysfs interface that allows the user to
+ * bypass running rc kill scripts in the advent the user
+ * needed to power down as fast as possible. This could be
+ * in a low battery conditon and you want to try to keep
+ * data from being corrupted.
+ *
+ * Author: Armin Kuster <AKuster@mvista.com, or source@mvista.com>
+ *
+ * 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.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/string.h>
+#include <linux/errno.h>
+
+#include "../power.h"
+#include "fpo.h"
+
+static int fsd_default_off(void)
+{
+	/*
+	 * Actions taken:
+	 *
+	 *    1. Freeze all user processes.
+	 *
+	 *    2. Power off
+	 *
+	 *    3. Power off devices
+	 */
+
+	printk(KERN_EMERG "Fast Power Off initiated.\n");
+	fastpoweroff_prepare();
+	fastpoweroff();
+	fastpoweroff_standby();
+	return 1;
+}
+
+static struct fpo_driver fpo_default = {
+	.name = "default",
+	.policy = fsd_default_off,
+};
+
+static int __init fsd_default_init(void)
+{
+	int ret = 0;
+
+	if(( ret = fastpoweroff_register(&fpo_default)) < 0) {
+		printk(KERN_ERR "PM: Fastpoweroff: %s profile registation failed %d.\n",
+			fpo_default.name,ret);
+		goto errout;
+	}
+
+	printk(KERN_INFO "PM: Fastpoweroff, %s profile added\n",fpo_default.name);
+errout:
+	return ret;
+}
+
+module_init(fsd_default_init);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Armin Kuster <akuster@mvista.com>");
+
Index: linux-2.6_dev/kernel/power/fastoff/Kconfig
===================================================================
--- linux-2.6_dev.orig/kernel/power/fastoff/Kconfig
+++ linux-2.6_dev/kernel/power/fastoff/Kconfig
@@ -10,4 +10,12 @@ config FAST_POWER_OFF
 	---help---
 	  Say yes if you want core support for sysfs/power/fastoff
 
+config FAST_POWER_DOWN
+	tristate "Fast power of profile"
+	depends on FAST_POWER_OFF
+	default n
+	---help---
+	  Say yes if want to bypass the rc kill scripts
+	  and shut the machine down
+
 endmenu
Index: linux-2.6_dev/kernel/power/fastoff/Makefile
===================================================================
--- linux-2.6_dev.orig/kernel/power/fastoff/Makefile
+++ linux-2.6_dev/kernel/power/fastoff/Makefile
@@ -5,4 +5,4 @@
 #
 
 obj-$(CONFIG_FAST_POWER_OFF)	:= fpo.o
-
+obj-$(CONFIG_FAST_POWER_DOWN)	+= fastoffdrv.o

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-01-31  7:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-27 20:05 [PATCH 2/2] PM: fast power off - driver akuster
2007-01-28  3:20 ` Andi Kleen
2007-01-28 18:09 ` Randy Dunlap
2007-01-29 17:41   ` akuster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox