summaryrefslogtreecommitdiff
path: root/arch/arm/mach-omap2/pm.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/pm.c')
-rw-r--r--arch/arm/mach-omap2/pm.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index a6c441842cc..a119cbe9e7f 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -18,6 +18,11 @@
#include <linux/suspend.h>
#include <linux/cpu.h>
#include <linux/of_platform.h>
+#include <linux/console.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/wakeup_reason.h>
+#include <linux/printk.h>
#include <asm/system_misc.h>
@@ -38,6 +43,9 @@
* suspend work
*/
int (*omap_pm_suspend)(void);
+#ifdef CONFIG_PM_SUSPEND_AGAIN_OPS
+const static struct suspend_again_ops *suspend_again_ops;
+#endif
#ifdef CONFIG_PM
/**
@@ -239,14 +247,38 @@ static void omap_pm_finish(void)
omap_prcm_irq_complete();
}
+#ifdef CONFIG_PM_SUSPEND_AGAIN_OPS
+void pm_register_suspend_again_ops(struct suspend_again_ops const *ops) {
+ suspend_again_ops = ops;
+}
+
+//Return True if going back to sleep
+bool omap_suspend_again(void) {
+ pr_info("Suspend again decision.");
+ if(suspend_again_ops && suspend_again_ops->suspend_again_check) {
+ return suspend_again_ops->suspend_again_check(suspend_again_ops->data_ptr);
+ }
+
+ return false;
+}
+#endif
+
static const struct platform_suspend_ops omap_pm_ops = {
.begin = omap_pm_begin,
.end = omap_pm_end,
.enter = omap_pm_enter,
.finish = omap_pm_finish,
.valid = suspend_valid_only_mem,
+ .suspend_again = omap_suspend_again
};
+
+
+DECLARE_WAIT_QUEUE_HEAD(wq_susp_again);
+DEFINE_MUTEX(susp_again_decision_mutex);
+#define NO_DECISION 3
+static int accel_should_suspend = NO_DECISION;
+
#endif /* CONFIG_SUSPEND */
static void __init omap3_init_voltages(void)
@@ -290,6 +322,7 @@ static int __init omap2_common_pm_init(void)
/* if (!of_have_populated_dt()) OLIO TEST */
omap2_init_processor_devices();
+
omap_pm_if_init();
return 0;