summaryrefslogtreecommitdiff
path: root/include/button.h
diff options
context:
space:
mode:
authorAndrew McRae <amcrae@google.com>2020-05-21 11:13:58 +1000
committerCommit Bot <commit-bot@chromium.org>2020-05-22 03:41:49 +0000
commita69d8010850bfe3860507df05d9754b38d757885 (patch)
treeb1ca385bcf1b5fcc20797d6c0685040890e52a6a /include/button.h
parent288e1a5d8ea9be1e15829067969cc786d725a4a4 (diff)
downloadchrome-ec-a69d8010850bfe3860507df05d9754b38d757885.tar.gz
config.h: Add CONFIG_DEDICATED_RECOVERY_BUTTON_2
Puff has a second dedicated recovery button input, so expand the common recovery button handler to include a second recovery button signal. The signals are treated as an OR, so that either signal will indicate recovery. The reason a second input is required is that the signal from the H1 for recovery is masked off if the power button is pressed, so that recovery mode of pressing both power and recovery is not possible. BUG=b:157181336 TEST=Patched into puff, verified recovery mode. BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: I476b2e8b1f5ec0f91f39e9a568dac4f15a45438f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2208342 Commit-Queue: Andrew McRae <amcrae@chromium.org> Tested-by: Andrew McRae <amcrae@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'include/button.h')
-rw-r--r--include/button.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/include/button.h b/include/button.h
index bbe4cb44df..381e650550 100644
--- a/include/button.h
+++ b/include/button.h
@@ -13,7 +13,9 @@
#include "gpio.h"
#include "ec_commands.h"
-#define BUTTON_FLAG_ACTIVE_HIGH BIT(0)
+#define BUTTON_FLAG_ACTIVE_HIGH BIT(0)
+#define BUTTON_FLAG_DISABLED BIT(1) /* Button disabled */
+
#define BUTTON_DEBOUNCE_US (30 * MSEC)
@@ -32,6 +34,9 @@ enum button {
#endif /* defined(CONFIG_VOLUME_BUTTONS) */
#ifdef CONFIG_DEDICATED_RECOVERY_BUTTON
BUTTON_RECOVERY,
+#ifdef CONFIG_DEDICATED_RECOVERY_BUTTON_2
+ BUTTON_RECOVERY_2,
+#endif /* defined(CONFIG_DEDICATED_RECOVERY_BUTTON_2) */
#endif /* defined(CONFIG_DEDICATED_RECOVERY_BUTTON) */
BUTTON_COUNT,
};
@@ -66,6 +71,16 @@ void button_init(void);
int button_reassign_gpio(enum button button_type, enum gpio_signal gpio);
/*
+ * Disable a button GPIO signal at runtime.
+ *
+ * @param button_type Button type to reassign
+ *
+ * Returns EC_SUCCESS if the button is disabled,
+ * EC_ERROR_* otherwise.
+ */
+int button_disable_gpio(enum button button_type);
+
+/*
* Interrupt handler for button.
*
* @param signal Signal which triggered the interrupt.