summaryrefslogtreecommitdiff
path: root/common/body_detection.c
diff options
context:
space:
mode:
authorJosh Tsai <josh_tsai@compal.corp-partner.google.com>2022-09-15 14:43:41 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-22 02:36:33 +0000
commit949477c098b288dec19a69baf5c31e379bb38d98 (patch)
tree5d51399ab7f1483f41382b3a5a63a0971b2cb820 /common/body_detection.c
parent13673d5a7dec5bfcbea51a7e2012587a69286238 (diff)
downloadchrome-ec-949477c098b288dec19a69baf5c31e379bb38d98.tar.gz
common: body_detection: notify host when body status is changed
When body status is changed, EC will send the SCI event "EC_HOST_EVENT_MODE_CHANGE" to host, the host will use the ACPI command to get the mode change value. BRANCH=none BUG=b:236668095;b:232946420 LOW_COVERAGE_REASON=no unit test for body_detection yet: b/259754018 TEST=zmake build winterhold and test on Whiterun MB. When shake MB trigger on body, and flat in desk trigger off body. ec:$ [359.832100 even[359.834200 event clear 0x0000000010000000] ec:$ [359.837000 ACPI query = 29] t set 0x0000000010000000] ec:$ [359.840800 HC 0x0067 err 9] ec:$ [359.842300 body_detect changed state to: off body] ec:$ [366.634800 even[366.636600 event clear 0x0000000010000000] ec:$ [366.639600 ACPI query = 29] t set 0x0000000010000000] ec:$ [366.644300 HC 0x0067 err 9] ec:$ [366.645100 body_detect changed state to: on body] Signed-off-by: Josh Tsai <josh_tsai@compal.corp-partner.google.com> Change-Id: Ia42accf551e6a4ea02a573d63389d388309cd3b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3868880 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com> Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'common/body_detection.c')
-rw-r--r--common/body_detection.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/body_detection.c b/common/body_detection.c
index 848c4f08c1..e6b842ddf1 100644
--- a/common/body_detection.c
+++ b/common/body_detection.c
@@ -113,6 +113,11 @@ void body_detect_change_state(enum body_detect_states state, bool spoof)
/* reset time counting of stationary */
stationary_timeframe = 0;
}
+
+#ifdef CONFIG_BODY_DETECTION_NOTIFY_MODE_CHANGE
+ host_set_single_event(EC_HOST_EVENT_MODE_CHANGE);
+#endif
+
/* state changing log */
CPRINTS("body_detect changed state to: %s body",
motion_state ? "on" : "off");