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/host/board.c | 10 ---------- board/host/gpio.inc | 4 ++-- 2 files changed, 2 insertions(+), 12 deletions(-) (limited to 'board/host') diff --git a/board/host/board.c b/board/host/board.c index b29f6e9230..e3183fa874 100644 --- a/board/host/board.c +++ b/board/host/board.c @@ -45,16 +45,6 @@ test_mockable void button_interrupt(enum gpio_signal signal) { }; -#ifdef CONFIG_BUTTON_COUNT -const struct button_config buttons[] = { - {"Volume Down", KEYBOARD_BUTTON_VOLUME_DOWN, GPIO_BUTTON_VOLUME_DOWN_L, - 30 * MSEC, 0}, - {"Volume Up", KEYBOARD_BUTTON_VOLUME_UP, GPIO_BUTTON_VOLUME_UP, - 60 * MSEC, BUTTON_FLAG_ACTIVE_HIGH}, -}; -BUILD_ASSERT(ARRAY_SIZE(buttons) == CONFIG_BUTTON_COUNT); -#endif - #ifdef CONFIG_I2C /* I2C ports */ const struct i2c_port_t i2c_ports[] = { diff --git a/board/host/gpio.inc b/board/host/gpio.inc index 7695a6021d..73bd6c0252 100644 --- a/board/host/gpio.inc +++ b/board/host/gpio.inc @@ -11,8 +11,8 @@ GPIO_INT(LID_OPEN, PIN(0, 0), GPIO_INT_BOTH, lid_interrupt) GPIO_INT(POWER_BUTTON_L, PIN(0, 1), GPIO_INT_BOTH, power_button_interrupt) GPIO_INT(AC_PRESENT, PIN(0, 2), GPIO_INT_BOTH, extpower_interrupt) -GPIO_INT(BUTTON_VOLUME_DOWN_L, PIN(0, 3), GPIO_INT_BOTH, button_interrupt) -GPIO_INT(BUTTON_VOLUME_UP, PIN(0, 4), GPIO_INT_BOTH, button_interrupt) +GPIO_INT(VOLUME_DOWN_L, PIN(0, 3), GPIO_INT_BOTH, button_interrupt) +GPIO_INT(VOLUME_UP_L, PIN(0, 4), GPIO_INT_BOTH, button_interrupt) GPIO_INT(CHARGE_DONE, PIN(0, 5), GPIO_INT_BOTH, inductive_charging_interrupt) GPIO(EC_INT_L, PIN(0, 6), 0) -- cgit v1.2.1