From 34a97f50d5275f1fa2f1cb377683c96286b2421d Mon Sep 17 00:00:00 2001 From: Aseda Aboagye Date: Wed, 15 Nov 2017 22:23:00 -0800 Subject: buttons: Make buttons[] common. Nearly every board had a buttons array defined in which its contents had the standard volume buttons. This commit creates a single common buttons array that can contain the standard volume buttons and recovery buttons. If a board has volume up and down buttons, they can simply define CONFIG_VOLUME_BUTTONS and it will populate the buttons array with the standard definition. The buttons are active low and have a 30 ms debounce period. Similiarly, if a board has a dedicated recovery button, defining CONFIG_DEDICATED_RECOVERY_BUTTON will also populate the buttons array with a recovery button. BUG=chromium:783371 BRANCH=None TEST=make -j buildall. TEST=Flash a device with CONFIG_VOLUME_BUTTONS, verify pressing volume buttons still work. Change-Id: Ie5d63670ca4c6b146ec8ffb64d40ea9ce437b913 Signed-off-by: Aseda Aboagye Reviewed-on: https://chromium-review.googlesource.com/773794 Commit-Ready: Aseda Aboagye Tested-by: Aseda Aboagye Reviewed-by: Daisuke Nojiri Reviewed-by: Shawn N --- board/coral/board.c | 7 ------- board/coral/board.h | 4 +++- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'board/coral') diff --git a/board/coral/board.c b/board/coral/board.c index 43ea4fca91..7ab358e912 100644 --- a/board/coral/board.c +++ b/board/coral/board.c @@ -501,13 +501,6 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); -const struct button_config buttons[CONFIG_BUTTON_COUNT] = { - {"Volume Down", KEYBOARD_BUTTON_VOLUME_DOWN, GPIO_EC_VOLDN_BTN_ODL, - 30 * MSEC, 0}, - {"Volume Up", KEYBOARD_BUTTON_VOLUME_UP, GPIO_EC_VOLUP_BTN_ODL, - 30 * MSEC, 0}, -}; - /* Called by APL power state machine when transitioning from G3 to S5 */ static void chipset_pre_init(void) { diff --git a/board/coral/board.h b/board/coral/board.h index 3706cd4ae8..d10081f0a0 100644 --- a/board/coral/board.h +++ b/board/coral/board.h @@ -120,7 +120,6 @@ #define CONFIG_ADC #define CONFIG_BOARD_VERSION #define CONFIG_BOARD_SPECIFIC_VERSION -#define CONFIG_BUTTON_COUNT 2 #define CONFIG_EXTPOWER_GPIO #undef CONFIG_EXTPOWER_DEBOUNCE_MS #define CONFIG_EXTPOWER_DEBOUNCE_MS 1000 @@ -148,6 +147,9 @@ #define CONFIG_SCI_GPIO GPIO_PCH_SCI_L #define CONFIG_UART_HOST 0 #define CONFIG_VBOOT_HASH +#define CONFIG_VOLUME_BUTTONS +#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL +#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL #define CONFIG_BACKLIGHT_LID #define CONFIG_WIRELESS #define CONFIG_WIRELESS_SUSPEND EC_WIRELESS_SWITCH_WLAN_POWER -- cgit v1.2.1