summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 */