From 4c84afb1cdb1d1da8155f1bc30ea93ecd7b8dd4b Mon Sep 17 00:00:00 2001 From: Gwendal Grignou Date: Mon, 22 Mar 2021 17:30:39 -0700 Subject: common: motion_sense: Prevent on/off body from waking up device Introduce a new flag: BYPASS_FIFO to raise an interrupt to the AP when an event is sent. It is not as strong as WAKEUP, as it does not wake up the AP. BYPASS_FIFO must be set when WAKEUP is set. It is applied to sync sensor as well as gesture/activity sensor. BUG=b:123434029 BRANCH=trogdor TEST=Compile Signed-off-by: Gwendal Grignou Change-Id: Id5aba71e6d11ef31f7fa2c67ba2e07178d088b1b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2780834 Reviewed-by: Ching-Kang Yen Tested-by: Ching-Kang Yen Commit-Queue: Ching-Kang Yen --- include/ec_commands.h | 2 ++ include/motion_sense_fifo.h | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/ec_commands.h b/include/ec_commands.h index 8949077e8e..bd62d3a3ce 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -2770,6 +2770,8 @@ struct ec_motion_sense_activity { #define MOTIONSENSE_SENSOR_FLAG_TABLET_MODE BIT(3) #define MOTIONSENSE_SENSOR_FLAG_ODR BIT(4) +#define MOTIONSENSE_SENSOR_FLAG_BYPASS_FIFO BIT(7) + /* * Send this value for the data element to only perform a read. If you * send any other value, the EC will interpret it as data to set and will diff --git a/include/motion_sense_fifo.h b/include/motion_sense_fifo.h index 554475d9f3..90d3f78879 100644 --- a/include/motion_sense_fifo.h +++ b/include/motion_sense_fifo.h @@ -21,17 +21,26 @@ enum motion_sense_async_event { */ void motion_sense_fifo_init(void); +/** + * Whether or not we need to bypass the FIFO to send an important message. + * + * @return Non zero when a bypass is needed. + */ +int motion_sense_fifo_bypass_needed(void); + /** * Whether or not we need to wake up the AP. * + * When the wakeup flag is set, the bypass flag must be set to. + * * @return Non zero when a wake-up is needed. */ int motion_sense_fifo_wake_up_needed(void); /** - * Resets the flag for wake up needed. + * Resets the flag for wake up and bypass needed. */ -void motion_sense_fifo_reset_wake_up_needed(void); +void motion_sense_fifo_reset_needed_flags(void); /** * Insert an async event into the fifo. -- cgit v1.2.1