diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2018-01-10 11:14:20 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-01-12 03:27:08 -0800 |
commit | 0207f0c53ba644a3fc2a4df8ce6f316faf6b7033 (patch) | |
tree | 2ef6a454828f21159c596dcc846589a8f0181a2b | |
parent | 25b59e26caa0fc1a8593d98ea5fc0af2a7650d09 (diff) | |
download | chrome-ec-0207f0c53ba644a3fc2a4df8ce6f316faf6b7033.tar.gz |
pp: add API to show when press is expected
This patch adds an API which exports current physical presence state
machine state to allow the caller to see if the state machine is in
one of the three distinct states:
- no PP process in progress
- user PP input is expected
- PP process in progress, user input is not currently expected
BRANCH=cr50
BUG=b:62537474
TEST=with the rest of the patches applied verified that PP state is
properly communicated through this API.
Change-Id: Ia10cd20c490dadef595f30e0b7257e51b6abf8fa
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/860998
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
-rw-r--r-- | common/physical_presence.c | 14 | ||||
-rw-r--r-- | include/physical_presence.h | 12 |
2 files changed, 26 insertions, 0 deletions
diff --git a/common/physical_presence.c b/common/physical_presence.c index 0069a4fef9..896f1a8850 100644 --- a/common/physical_presence.c +++ b/common/physical_presence.c @@ -268,6 +268,20 @@ int physical_detect_press(void) return EC_SUCCESS; } +enum pp_fsm_state physical_presense_fsm_state(void) +{ + switch (pp_detect_state) { + case PP_DETECT_AWAITING_PRESS: + return PP_AWAITING_PRESS; + case PP_DETECT_BETWEEN_PRESSES: + return PP_BETWEEN_PRESSES; + default: + break; + } + + return PP_OTHER; +} + #ifdef CONFIG_PHYSICAL_PRESENCE_DEBUG_UNSAFE /** diff --git a/include/physical_presence.h b/include/physical_presence.h index f2678993fc..0acbc65691 100644 --- a/include/physical_presence.h +++ b/include/physical_presence.h @@ -61,4 +61,16 @@ int physical_detect_press(void); */ void board_physical_presence_enable(int enable); +/** + * An API to report physical presence FSM state to an external entity. Of + * interest are states when key press is currently required or is expected + * soon. + */ +enum pp_fsm_state { + PP_OTHER = 0, + PP_AWAITING_PRESS = 1, + PP_BETWEEN_PRESSES = 2, +}; +enum pp_fsm_state physical_presense_fsm_state(void); + #endif /* __CROS_EC_PHYSICAL_PRESENCE_H */ |