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-11-14 08:09:50 +0000
commitfd2ee035ade9b6f82c2fc0566dc82051a9e468fc (patch)
tree186287f7817c7c4a99a037d76a5aff4c7a1098c1
parent6507a7fa0b375bd5465ffe73c2b64983ce94050e (diff)
downloadchrome-ec-fd2ee035ade9b6f82c2fc0566dc82051a9e468fc.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/c/1335228 Reviewed-by: Marco Chen <marcochen@chromium.org> Commit-Queue: Marco Chen <marcochen@chromium.org> Tested-by: Marco Chen <marcochen@chromium.org>
-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 2f136caa84..427a5b79a2 100644
--- a/common/physical_presence.c
+++ b/common/physical_presence.c
@@ -259,6 +259,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 */