From 949477c098b288dec19a69baf5c31e379bb38d98 Mon Sep 17 00:00:00 2001 From: Josh Tsai Date: Thu, 15 Sep 2022 14:43:41 +0800 Subject: 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 Change-Id: Ia42accf551e6a4ea02a573d63389d388309cd3b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3868880 Reviewed-by: Gwendal Grignou Code-Coverage: Zoss Reviewed-by: Elthan Huang Reviewed-by: Diana Z --- common/body_detection.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'common/body_detection.c') 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"); -- cgit v1.2.1