diff options
author | Ching-Kang Yen <chingkang@chromium.org> | 2021-03-10 19:20:05 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-29 19:07:50 +0000 |
commit | 4adf9a75431bf5e00875e15de54c7848c6f81c6c (patch) | |
tree | 99813b0ee67eae3a5a9b2c3d3149842ac4c7f732 /common | |
parent | 31fd36d0340755327457172c81883b2ba0305a69 (diff) | |
download | chrome-ec-4adf9a75431bf5e00875e15de54c7848c6f81c6c.tar.gz |
common: body_detection: re-enable body_detection in S0
The powerd will enable the body_detection once after rebooting, but not
after resuming. Because we disable the body_detection in S3, we should
re-enable the body_detection in S0.
BRANCH=trogdor
BUG=b:123434029
TEST=powerd_dbus_suspend; ectool motionsense list_activities;
see if body_detection is enabled.
TEST=make buildall;
Signed-off-by: Ching-Kang Yen <chingkang@chromium.org>
Change-Id: Idb06888d9b4ec0eca994201f7fbd646f37c2c371
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2752573
Commit-Queue: Ching-Kang Yen <chingkang@chromium.org>
Tested-by: Ching-Kang Yen <chingkang@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/motion_sense.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c index 4dd8b6cc13..c0d556b5cb 100644 --- a/common/motion_sense.c +++ b/common/motion_sense.c @@ -437,6 +437,22 @@ static void motion_sense_switch_sensor_rate(void) ap_event_interval = 0; } + /* disable the body detection since AP is suspended */ + if (IS_ENABLED(CONFIG_BODY_DETECTION)) { + static bool was_enabled; + + switch (sensor_active) { + case SENSOR_ACTIVE_S3: + was_enabled = body_detect_get_enable(); + body_detect_set_enable(false); + break; + case SENSOR_ACTIVE_S0: + body_detect_set_enable(was_enabled); + break; + default: + break; + } + } /* Forget activities set by the AP */ if (IS_ENABLED(CONFIG_GESTURE_DETECTION) && (sensor_active == SENSOR_ACTIVE_S5)) { @@ -500,9 +516,6 @@ static void motion_sense_suspend(void) sensor_active = SENSOR_ACTIVE_S3; - /* disable the body detection since AP is suspended */ - if (IS_ENABLED(CONFIG_BODY_DETECTION)) - body_detect_set_enable(false); /* * During shutdown sequence sensor rails can be powered down * asynchronously to the EC hence EC cannot interlock the sensor |