summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/iio/imu/st_lsm6ds3/st_lsm6ds3_trigger.c9
-rw-r--r--include/linux/wakeup_reason.h2
2 files changed, 3 insertions, 8 deletions
diff --git a/drivers/iio/imu/st_lsm6ds3/st_lsm6ds3_trigger.c b/drivers/iio/imu/st_lsm6ds3/st_lsm6ds3_trigger.c
index 5e20cc722e8..a2df1d2990b 100644
--- a/drivers/iio/imu/st_lsm6ds3/st_lsm6ds3_trigger.c
+++ b/drivers/iio/imu/st_lsm6ds3/st_lsm6ds3_trigger.c
@@ -106,15 +106,12 @@ static void st_lsm6ds3_irq_management(struct work_struct *data_work)
cdata = container_of((struct work_struct *)data_work,
struct lsm6ds3_data, data_work);
-
if(cdata->first_irq_from_resume && last_wakeup_reason_test(cdata->irq)){
+ //take_wake_lock to give app enough time from wakeup
woken_from_sleep = 1;
+ wake_lock_timeout(&cdata->wlock,msecs_to_jiffies(1000));
}
- if(!wake_lock_active(&cdata->wlock))
- wake_lock(&cdata->wlock);
-
-
mutex_lock(&cdata->fifo_lock);
cdata->tf->read(cdata, ST_LSM6DS3_6D_SRC_ADDR, 1, &d6d_src_reg, true);
@@ -225,8 +222,6 @@ static void st_lsm6ds3_irq_management(struct work_struct *data_work)
}
enable_irq(cdata->irq);
mutex_unlock(&cdata->fifo_lock);
- if(wake_lock_active(&cdata->wlock))
- wake_unlock(&cdata->wlock);
cdata->first_irq_from_resume = 0;
return;
diff --git a/include/linux/wakeup_reason.h b/include/linux/wakeup_reason.h
index b58723ab7c7..e5f3e1f44ae 100644
--- a/include/linux/wakeup_reason.h
+++ b/include/linux/wakeup_reason.h
@@ -19,7 +19,7 @@
#define _LINUX_WAKEUP_REASON_H
void log_wakeup_reason(int irq);
-int get_last_wakeup_reason();
+int get_last_wakeup_reason(void);
int last_wakeup_reason_test(int reason);
#endif /* _LINUX_WAKEUP_REASON_H */