summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/suspend.c
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2011-04-28 19:23:28 +0200
committerPaul Mundt <lethal@linux-sh.org>2011-05-25 04:19:17 +0200
commitc3dada1894de46139c21352a1000c0fd02d308d5 (patch)
tree5486666006f9e377ad0585a4b4b2a0bf656646be /arch/arm/mach-shmobile/suspend.c
parentmailmap: Add entry for Damian Hobson-Garcia. (diff)
downloadlinux-c3dada1894de46139c21352a1000c0fd02d308d5.tar.xz
linux-c3dada1894de46139c21352a1000c0fd02d308d5.zip
ARM: mach-shmobile: Suspend-to-RAM support
This patch adds a simple Suspend-to-RAM implementation for SH-Mobile ARM. The struct shmobile_suspend_ops are kept global to allow cpu-specific code to override the callbacks if needed. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile/suspend.c')
-rw-r--r--arch/arm/mach-shmobile/suspend.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/suspend.c b/arch/arm/mach-shmobile/suspend.c
new file mode 100644
index 000000000000..c1febe13f709
--- /dev/null
+++ b/arch/arm/mach-shmobile/suspend.c
@@ -0,0 +1,47 @@
+/*
+ * Suspend-to-RAM support code for SH-Mobile ARM
+ *
+ * Copyright (C) 2011 Magnus Damm
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/pm.h>
+#include <linux/suspend.h>
+#include <linux/module.h>
+#include <linux/err.h>
+#include <asm/system.h>
+#include <asm/io.h>
+
+static int shmobile_suspend_default_enter(suspend_state_t suspend_state)
+{
+ cpu_do_idle();
+ return 0;
+}
+
+static int shmobile_suspend_begin(suspend_state_t state)
+{
+ disable_hlt();
+ return 0;
+}
+
+static void shmobile_suspend_end(void)
+{
+ enable_hlt();
+}
+
+struct platform_suspend_ops shmobile_suspend_ops = {
+ .begin = shmobile_suspend_begin,
+ .end = shmobile_suspend_end,
+ .enter = shmobile_suspend_default_enter,
+ .valid = suspend_valid_only_mem,
+};
+
+static int __init shmobile_suspend_init(void)
+{
+ suspend_set_ops(&shmobile_suspend_ops);
+ return 0;
+}
+late_initcall(shmobile_suspend_init);