summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Aaberg <jonas.aberg@stericsson.com>2011-09-20 12:00:04 +0200
committerJonas ABERG <jonas.aberg@stericsson.com>2011-09-29 08:52:11 +0200
commit7e24e5645db9631c8cade532e51d61dae0740fe3 (patch)
treee82bb30c79eaf666ba80ab462bc75bcad9648692
parent41fe35a99a95442f7221b925895cdcd362fb1962 (diff)
ARM: ux500: Add interface for modem to block sleep
Change-Id: I0c8bf0077e36ee0db0882b820ae1600af9607804 Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32078
-rw-r--r--arch/arm/mach-ux500/include/mach/suspend.h17
-rw-r--r--arch/arm/mach-ux500/pm/suspend.c22
2 files changed, 39 insertions, 0 deletions
diff --git a/arch/arm/mach-ux500/include/mach/suspend.h b/arch/arm/mach-ux500/include/mach/suspend.h
new file mode 100644
index 00000000000..65086ed56b1
--- /dev/null
+++ b/arch/arm/mach-ux500/include/mach/suspend.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) ST-Ericsson SA 2010-2011
+ *
+ * License terms: GNU General Public License (GPL) version 2
+ */
+#ifndef __MACH_SUSPEND_H
+#define __MACH_SUSPEND_H
+
+#ifdef CONFIG_UX500_SUSPEND
+void suspend_block_sleep(void);
+void suspend_unblock_sleep(void);
+#else
+static inline void suspend_block_sleep(void) { }
+static inline void suspend_unblock_sleep(void) { }
+#endif
+
+#endif /* __MACH_SUSPEND_H */
diff --git a/arch/arm/mach-ux500/pm/suspend.c b/arch/arm/mach-ux500/pm/suspend.c
index 96ee874d420..dc0ee2eef05 100644
--- a/arch/arm/mach-ux500/pm/suspend.c
+++ b/arch/arm/mach-ux500/pm/suspend.c
@@ -18,10 +18,32 @@
#include "suspend_dbg.h"
+static atomic_t block_sleep = ATOMIC_INIT(0);
+
+void suspend_block_sleep(void)
+{
+ atomic_inc(&block_sleep);
+}
+
+void suspend_unblock_sleep(void)
+{
+ atomic_dec(&block_sleep);
+}
+
+static bool sleep_is_blocked(void)
+{
+ return (atomic_read(&block_sleep) != 0);
+}
+
static int suspend(bool do_deepsleep)
{
int ret = 0;
+ if (sleep_is_blocked()) {
+ pr_info("suspend/resume: interrupted by modem.\n");
+ return -EBUSY;
+ }
+
nmk_gpio_clocks_enable();
ux500_suspend_dbg_add_wake_on_uart();