diff options
author | Ruihai Zhou <zhouruihai@huaqin.corp-partner.google.com> | 2023-03-16 16:58:38 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-03-22 08:16:33 +0000 |
commit | 4ba3799473fc967e9edadec92c701d9d68a5c6f8 (patch) | |
tree | ffc95bfd60094e3468e7c8c4fbcbc06a6f77b9d4 | |
parent | 81e984c8f8f3e2303bac7a690f4d2f49ed2ba7ba (diff) | |
download | chrome-ec-4ba3799473fc967e9edadec92c701d9d68a5c6f8.tar.gz |
common: notify host via mkbp switch when body on/off
Add PLATFORM_EC_BODY_DETECTION_NOTIFY_MKBP to notify the host
via EC_MKBP_FRONT_PROXIMITY when the body status on/off.
BRANCH=corsola
BUG=b:272655176
TEST=check ec log:
23-03-22 11:09:17.498 [333.643400 body detect mode enabled]
23-03-22 11:09:18.911 [333.644300 mkbp switches: 9]
...
23-03-22 11:09:21.690 [349.965200 body detect mode disabled]
23-03-22 11:09:35.269 [349.966100 mkbp switches: 1]
Change-Id: If7161c8fd2365f2eb70ae158cea423382b782cad
Signed-off-by: Ruihai Zhou <zhouruihai@huaqin.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4344831
Reviewed-by: Eric Yilun Lin <yllin@google.com>
Reviewed-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com>
-rw-r--r-- | common/body_detection.c | 4 | ||||
-rw-r--r-- | include/config.h | 3 | ||||
-rw-r--r-- | zephyr/Kconfig.body_detection | 7 | ||||
-rw-r--r-- | zephyr/shim/include/config_chip.h | 3 |
4 files changed, 17 insertions, 0 deletions
diff --git a/common/body_detection.c b/common/body_detection.c index 3357283eb2..646bc6d740 100644 --- a/common/body_detection.c +++ b/common/body_detection.c @@ -10,6 +10,7 @@ #include "hwtimer.h" #include "lid_switch.h" #include "math_util.h" +#include "mkbp_input_devices.h" #include "motion_sense_fifo.h" #include "timer.h" @@ -127,6 +128,9 @@ void body_detect_change_state(enum body_detect_states state, bool spoof) if (IS_ENABLED(CONFIG_BODY_DETECTION_NOTIFY_MODE_CHANGE)) host_set_single_event(EC_HOST_EVENT_BODY_DETECT_CHANGE); + if (IS_ENABLED(CONFIG_BODY_DETECTION_NOTIFY_MKBP)) + mkbp_update_switches(EC_MKBP_FRONT_PROXIMITY, motion_state); + hook_notify(HOOK_BODY_DETECT_CHANGE); } diff --git a/include/config.h b/include/config.h index 6d374ef53b..bef08e27b0 100644 --- a/include/config.h +++ b/include/config.h @@ -231,6 +231,9 @@ /* Send the SCI event to notify host when body status change */ #undef CONFIG_BODY_DETECTION_NOTIFY_MODE_CHANGE +/* Send the MKBP event to notify host when body status change */ +#undef CONFIG_BODY_DETECTION_NOTIFY_MKBP + /* Always enable the body detection function in S0 */ #undef CONFIG_BODY_DETECTION_ALWAYS_ENABLE_IN_S0 diff --git a/zephyr/Kconfig.body_detection b/zephyr/Kconfig.body_detection index 243dff912b..df163799c6 100644 --- a/zephyr/Kconfig.body_detection +++ b/zephyr/Kconfig.body_detection @@ -87,6 +87,13 @@ config PLATFORM_EC_BODY_DETECTION_NOTIFY_MODE_CHANGE status is changed, in addition to adding an event in the motion sensor FIFO queue. +config PLATFORM_EC_BODY_DETECTION_NOTIFY_MKBP + bool "Notify host with MKBP event when the body on/off" + default n + help + Notify the host via EC_MKBP_FRONT_PROXIMITY + when the body status changed. + config PLATFORM_EC_BODY_DETECTION_ALWAYS_ENABLE_IN_S0 bool "Always enable body detection function in S0" default n diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h index bfd962de29..f1bd619247 100644 --- a/zephyr/shim/include/config_chip.h +++ b/zephyr/shim/include/config_chip.h @@ -2121,6 +2121,9 @@ extern char mock_jump_data[CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE]; #ifdef CONFIG_PLATFORM_EC_BODY_DETECTION_NOTIFY_MODE_CHANGE #define CONFIG_BODY_DETECTION_NOTIFY_MODE_CHANGE #endif /* CONFIG_PLATFORM_EC_BODY_DETECTION_NOTIFY_MODE_CHANGE */ +#ifdef CONFIG_PLATFORM_EC_BODY_DETECTION_NOTIFY_MKBP +#define CONFIG_BODY_DETECTION_NOTIFY_MKBP +#endif /* CONFIG_PLATFORM_EC_BODY_DETECTION_NOTIFY_MKBP */ #ifdef CONFIG_PLATFORM_EC_BODY_DETECTION_ALWAYS_ENABLE_IN_S0 #define CONFIG_BODY_DETECTION_ALWAYS_ENABLE_IN_S0 #endif |