diff options
author | Sam McNally <sammc@chromium.org> | 2023-02-13 13:01:46 +1100 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-02-21 06:20:10 +0000 |
commit | 1e4ac3b7d6bcaca171b8522d99317dc3272529f2 (patch) | |
tree | 748c41db666ab1f8eddbc79d207f52898fc1ca40 | |
parent | 8adc6caf9d7d1b40b310210fb0d45cf86ed9d61c (diff) | |
download | chrome-ec-1e4ac3b7d6bcaca171b8522d99317dc3272529f2.tar.gz |
common/button.c: Support configuring recovery buttons as active high.
Dedicated recovery buttons may be active high rather than the current
default of active low. Add config options for specifying flags for
dedicated recovery buttons following the style of power button flags.
Since neither the power button flags config this is following, nor the
dedicated recovery button configs themselves are surfaced to zephyr, add
these dedicated recovery button flags configs to config_allowed.txt.
While possible to add now, it would likely result in a non-functional
implementation to be largely or entirely replaced when the first zephyr
platform actually requires this functionality.
BUG=b:268309238
TEST=none
BRANCH=none
Change-Id: Iba658735e87c20ace140a783c2a2242897baf8c1
Signed-off-by: Sam McNally <sammc@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4240910
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
-rw-r--r-- | common/button.c | 10 | ||||
-rw-r--r-- | include/config.h | 4 | ||||
-rw-r--r-- | util/config_allowed.txt | 2 |
3 files changed, 14 insertions, 2 deletions
diff --git a/common/button.c b/common/button.c index 284d026285..27cd8ae058 100644 --- a/common/button.c +++ b/common/button.c @@ -849,20 +849,26 @@ struct button_config buttons[BUTTON_COUNT] = { #endif #if defined(CONFIG_DEDICATED_RECOVERY_BUTTON) +#ifndef CONFIG_DEDICATED_RECOVERY_BUTTON_FLAGS +#define CONFIG_DEDICATED_RECOVERY_BUTTON_FLAGS 0 +#endif [BUTTON_RECOVERY] = { .name = "Recovery", .type = KEYBOARD_BUTTON_RECOVERY, .gpio = GPIO_RECOVERY_L, .debounce_us = BUTTON_DEBOUNCE_US, - .flags = 0, + .flags = CONFIG_DEDICATED_RECOVERY_BUTTON_FLAGS, }, #ifdef CONFIG_DEDICATED_RECOVERY_BUTTON_2 +#ifndef CONFIG_DEDICATED_RECOVERY_BUTTON_2_FLAGS +#define CONFIG_DEDICATED_RECOVERY_BUTTON_2_FLAGS 0 +#endif [BUTTON_RECOVERY_2] = { .name = "Recovery2", .type = KEYBOARD_BUTTON_RECOVERY, .gpio = GPIO_RECOVERY_L_2, .debounce_us = BUTTON_DEBOUNCE_US, - .flags = 0, + .flags = CONFIG_DEDICATED_RECOVERY_BUTTON_2_FLAGS, } #endif /* defined(CONFIG_DEDICATED_RECOVERY_BUTTON_2) */ #endif /* defined(CONFIG_DEDICATED_RECOVERY_BUTTON) */ diff --git a/include/config.h b/include/config.h index 57e48fc059..f9dee49661 100644 --- a/include/config.h +++ b/include/config.h @@ -846,6 +846,10 @@ #undef CONFIG_DEDICATED_RECOVERY_BUTTON #undef CONFIG_DEDICATED_RECOVERY_BUTTON_2 +/* Configure recovery button. e.g. BUTTON_FLAG_ACTIVE_HIGH */ +#undef CONFIG_DEDICATED_RECOVERY_BUTTON_FLAGS +#undef CONFIG_DEDICATED_RECOVERY_BUTTON_2_FLAGS + /* * RISC-V core specific panic data is bigger than Cortex-M core specific panic * data. Including this into union in panic_data structure causes whole diff --git a/util/config_allowed.txt b/util/config_allowed.txt index 211db546d4..7fa6ba652f 100644 --- a/util/config_allowed.txt +++ b/util/config_allowed.txt @@ -340,6 +340,8 @@ CONFIG_DEBUG_STACK_OVERFLOW CONFIG_DEDICATED_CHARGE_PORT_COUNT CONFIG_DEDICATED_RECOVERY_BUTTON CONFIG_DEDICATED_RECOVERY_BUTTON_2 +CONFIG_DEDICATED_RECOVERY_BUTTON_2_FLAGS +CONFIG_DEDICATED_RECOVERY_BUTTON_FLAGS CONFIG_DELAY_DSW_PWROK_TO_PWRBTN CONFIG_DETACHABLE_BASE CONFIG_DEVICE_EVENT |