summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2018-01-10 11:14:20 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-02-01 00:48:16 +0000
commit7fea01ecf3f35561ada34dff70fc608aa336802f (patch)
tree70e1491f8765d76f36b91b28ced46afc8bf96de0
parent3f91d64389c1256d5f498b9927dc577b611c6d01 (diff)
downloadchrome-ec-7fea01ecf3f35561ada34dff70fc608aa336802f.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> (cherry picked from commit 0207f0c53ba644a3fc2a4df8ce6f316faf6b7033) Reviewed-on: https://chromium-review.googlesource.com/896760
-rw-r--r--common/physical_presence.c14
-rw-r--r--include/physical_presence.h12
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 */