summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Wilson <evan@oliodevices.com>2016-03-01 20:17:33 -0800
committerEvan Wilson <evan@oliodevices.com>2016-03-01 20:17:33 -0800
commit44216bd52b70736b1e2c21b828d6f666ee89aac2 (patch)
treeaea74e936df18803f0fb844c5e63e5789777991f
parent411509515867d0b8e5248850c0efa69a12b588c3 (diff)
downloadolio-linux-3.10-44216bd52b70736b1e2c21b828d6f666ee89aac2.tar.xz
olio-linux-3.10-44216bd52b70736b1e2c21b828d6f666ee89aac2.zip
Adding suspend again experiment 2
Change-Id: I48623c801e5b7d1c597f202930038c8b8da366d9
-rw-r--r--arch/arm/mach-omap2/pm.c25
-rw-r--r--drivers/iio/imu/st_lsm6ds3/st_lsm6ds3_core.c5
-rw-r--r--include/linux/suspend.h1
-rw-r--r--kernel/power/suspend.c1
4 files changed, 22 insertions, 10 deletions
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 6bd5f3b9c7a..ed39eecef3a 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -274,6 +274,20 @@ void susp_again_post_decision(bool should_suspend)
pr_err("Unable to post decision, didn't get lock");
}
+void susp_again_clear_decision()
+{
+ int res;
+ //clear flags for next time
+ res = mutex_trylock(&susp_again_decision_mutex);
+ if(res) {
+ pr_info("susp again: clearing flag\n");
+ accel_should_suspend = NO_DECISION; // Not true or false
+ mutex_unlock(&susp_again_decision_mutex);
+ }
+
+
+}
+
//Return True if going back to sleep
bool olio_suspend_again(void) {
int res;
@@ -298,23 +312,16 @@ bool olio_suspend_again(void) {
#define MAX_WAIT_TIME_SUSP_AGAIN msecs_to_jiffies(15)
res = wait_event_timeout(wq_susp_again, accel_should_suspend != NO_DECISION, MAX_WAIT_TIME_SUSP_AGAIN);
if(!res)
- pr_warn("Suspend again was not acknowledged by driver\n");
+ pr_warn("susp again: warning! decision not posted by accel driver\n");
#ifdef SUSPEND_AGAIN_THAW_KTHREADS
freeze_kernel_threads();
#endif
if (accel_should_suspend != NO_DECISION) {
- pr_info("Suspend again decision: %i", accel_should_suspend);
+ pr_info("susp again: decision: %i \n", accel_should_suspend);
should_suspend = accel_should_suspend;
}
- //clear flags for next time
- res = mutex_trylock(&susp_again_decision_mutex);
- if(res) {
- pr_info("susp again: clearing flag");
- accel_should_suspend = NO_DECISION; // Not true or false
- mutex_unlock(&susp_again_decision_mutex);
- }
return should_suspend;
}
diff --git a/drivers/iio/imu/st_lsm6ds3/st_lsm6ds3_core.c b/drivers/iio/imu/st_lsm6ds3/st_lsm6ds3_core.c
index 8b8f47d1714..bb385cc6108 100644
--- a/drivers/iio/imu/st_lsm6ds3/st_lsm6ds3_core.c
+++ b/drivers/iio/imu/st_lsm6ds3/st_lsm6ds3_core.c
@@ -25,6 +25,7 @@
#include <linux/iio/buffer.h>
#include <linux/iio/events.h>
#include <linux/reboot.h>
+#include <linux/suspend.h>
#include <asm/unaligned.h>
#include <linux/wakelock.h>
#include <linux/iio/common/st_sensors.h>
@@ -2531,7 +2532,9 @@ int st_lsm6ds3_common_suspend(struct lsm6ds3_data *cdata)
#endif
//ensure that the IRQ is enabled before we sleep
+ disable_irq(cdata->irq);
st_lsm6ds3_flush_works();
+ enable_irq(cdata->irq); //probably don't need this if flush is successful
return 0;
}
@@ -2543,7 +2546,7 @@ int st_lsm6ds3_common_resume(struct lsm6ds3_data *cdata)
int err, i;
struct lsm6ds3_sensor_data *sdata;
u8 reg_value;
-
+ susp_again_clear_decision();
for (i = 0; i < ST_INDIO_DEV_NUM; i++) {
if ((i == ST_INDIO_DEV_SIGN_MOTION) || (i == ST_INDIO_DEV_TILT))
continue;
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 07a0e8ad54c..cc562efdf50 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -366,6 +366,7 @@ extern void pm_wakep_autosleep_enabled(bool set);
/* arch/arm/mach-omap2/pm.c */
extern void susp_again_post_decision(bool should_suspend);
+extern void susp_again_clear_decision();
static inline void lock_system_sleep(void)
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 454568e6c8d..c2d1ff21ff4 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -279,6 +279,7 @@ int suspend_devices_and_enter(suspend_state_t state)
do {
error = suspend_enter(state, &wakeup);
+ resume_console();//suspended again in suspend_enter
} while (!error && !wakeup && need_suspend_ops(state)
&& suspend_ops->suspend_again && suspend_ops->suspend_again());