summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/fizz/board.c5
-rw-r--r--board/fizz/board.h1
-rw-r--r--board/nami/board.c5
-rw-r--r--board/nami/board.h1
-rw-r--r--board/poppy/board.c6
-rw-r--r--board/poppy/board.h2
-rw-r--r--board/rainier/board.c6
-rw-r--r--board/rainier/board.h2
-rw-r--r--board/rowan/board.c6
-rw-r--r--board/rowan/board.h2
-rw-r--r--board/scarlet/board.c6
-rw-r--r--board/scarlet/board.h2
-rw-r--r--common/button.c28
-rw-r--r--include/config.h21
14 files changed, 43 insertions, 50 deletions
diff --git a/board/fizz/board.c b/board/fizz/board.c
index c15d171ed8..7967c953f8 100644
--- a/board/fizz/board.c
+++ b/board/fizz/board.c
@@ -488,11 +488,6 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
}
}
-const struct button_config *recovery_buttons[] = {
- &buttons[BUTTON_RECOVERY],
-};
-const int recovery_buttons_count = ARRAY_SIZE(recovery_buttons);
-
enum battery_present battery_is_present(void)
{
/* The GPIO is low when the battery is present */
diff --git a/board/fizz/board.h b/board/fizz/board.h
index 5c784b3791..2dbcd311dd 100644
--- a/board/fizz/board.h
+++ b/board/fizz/board.h
@@ -18,7 +18,6 @@
/* EC */
#define CONFIG_ADC
#define CONFIG_BOARD_VERSION
-#define CONFIG_BUTTON_RECOVERY
#define CONFIG_DEDICATED_RECOVERY_BUTTON
#define CONFIG_EMULATED_SYSRQ
#define CONFIG_LED_COMMON
diff --git a/board/nami/board.c b/board/nami/board.c
index 7c0e79854b..08335ad6b3 100644
--- a/board/nami/board.c
+++ b/board/nami/board.c
@@ -499,11 +499,6 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
}
}
-const struct button_config *recovery_buttons[] = {
- &buttons[BUTTON_RECOVERY],
-};
-const int recovery_buttons_count = ARRAY_SIZE(recovery_buttons);
-
enum battery_present battery_is_present(void)
{
/* The GPIO is low when the battery is present */
diff --git a/board/nami/board.h b/board/nami/board.h
index 69326bd1b9..7bff00ae65 100644
--- a/board/nami/board.h
+++ b/board/nami/board.h
@@ -18,7 +18,6 @@
/* EC */
#define CONFIG_ADC
#define CONFIG_BOARD_VERSION
-#define CONFIG_BUTTON_RECOVERY
#define CONFIG_DEDICATED_RECOVERY_BUTTON
#define CONFIG_EMULATED_SYSRQ
#define CONFIG_LED_COMMON
diff --git a/board/poppy/board.c b/board/poppy/board.c
index 7e2e5a9366..8ce3c3a4b6 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -534,12 +534,6 @@ const struct temp_sensor_t temp_sensors[] = {
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-const struct button_config *recovery_buttons[] = {
- &buttons[BUTTON_VOLUME_DOWN],
- &buttons[BUTTON_VOLUME_UP],
-};
-const int recovery_buttons_count = ARRAY_SIZE(recovery_buttons);
-
/*
* Check if PMIC fault registers indicate VR fault. If yes, print out fault
* register info to console. Additionally, set panic reason so that the OS can
diff --git a/board/poppy/board.h b/board/poppy/board.h
index eea4a75c02..062802c419 100644
--- a/board/poppy/board.h
+++ b/board/poppy/board.h
@@ -19,7 +19,7 @@
#define CONFIG_BACKLIGHT_LID
#define CONFIG_BOARD_VERSION
#define CONFIG_BOARD_SPECIFIC_VERSION
-#define CONFIG_BUTTON_RECOVERY
+#define CONFIG_BUTTON_TRIGGERED_RECOVERY
#define CONFIG_DPTF
#define CONFIG_EMULATED_SYSRQ
#define CONFIG_FLASH_SIZE 0x80000
diff --git a/board/rainier/board.c b/board/rainier/board.c
index 09b3ee1358..89c7490356 100644
--- a/board/rainier/board.c
+++ b/board/rainier/board.c
@@ -129,12 +129,6 @@ const enum gpio_signal hibernate_wake_pins[] = {
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/******************************************************************************/
-const struct button_config *recovery_buttons[] = {
- &buttons[BUTTON_VOLUME_DOWN],
- &buttons[BUTTON_VOLUME_UP],
- };
-const int recovery_buttons_count = ARRAY_SIZE(recovery_buttons);
-
const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
{I2C_PORT_TCPC0, FUSB302_I2C_SLAVE_ADDR, &fusb302_tcpm_drv},
};
diff --git a/board/rainier/board.h b/board/rainier/board.h
index 4b6e4fb97a..6b06f4efbd 100644
--- a/board/rainier/board.h
+++ b/board/rainier/board.h
@@ -43,7 +43,7 @@
#define CONFIG_BOARD_PRE_INIT
#define CONFIG_BOARD_SPECIFIC_VERSION
#define CONFIG_BOARD_VERSION
-#define CONFIG_BUTTON_RECOVERY
+#define CONFIG_BUTTON_TRIGGERED_RECOVERY
#define CONFIG_CHARGER_ILIM_PIN_DISABLED
#define CONFIG_FORCE_CONSOLE_RESUME
#define CONFIG_HOST_COMMAND_STATUS
diff --git a/board/rowan/board.c b/board/rowan/board.c
index 35864a2493..d8150d8b23 100644
--- a/board/rowan/board.c
+++ b/board/rowan/board.c
@@ -156,12 +156,6 @@ const struct temp_sensor_t temp_sensors[] = {
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-const struct button_config *recovery_buttons[] = {
- &buttons[BUTTON_VOLUME_DOWN],
- &buttons[BUTTON_VOLUME_UP],
-};
-const int recovery_buttons_count = ARRAY_SIZE(recovery_buttons);
-
struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
{
.port_addr = 0, /* port idx */
diff --git a/board/rowan/board.h b/board/rowan/board.h
index 82aabcdf73..1eee437180 100644
--- a/board/rowan/board.h
+++ b/board/rowan/board.h
@@ -17,7 +17,7 @@
#define CONFIG_CMD_GPIO_EXTENDED
/* Button */
-#define CONFIG_BUTTON_RECOVERY
+#define CONFIG_BUTTON_TRIGGERED_RECOVERY
#define CONFIG_VOLUME_BUTTONS
/* Accelero meter and gyro sensor */
diff --git a/board/scarlet/board.c b/board/scarlet/board.c
index 7a796bc8a9..4b9a71c746 100644
--- a/board/scarlet/board.c
+++ b/board/scarlet/board.c
@@ -123,12 +123,6 @@ const struct spi_device_t spi_devices[] = {
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
-const struct button_config *recovery_buttons[] = {
- &buttons[BUTTON_VOLUME_DOWN],
- &buttons[BUTTON_VOLUME_UP],
- };
-const int recovery_buttons_count = ARRAY_SIZE(recovery_buttons);
-
const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
{I2C_PORT_TCPC0, FUSB302_I2C_SLAVE_ADDR, &fusb302_tcpm_drv},
};
diff --git a/board/scarlet/board.h b/board/scarlet/board.h
index 40443024b1..5d4f941441 100644
--- a/board/scarlet/board.h
+++ b/board/scarlet/board.h
@@ -48,7 +48,7 @@
#define CONFIG_BOARD_PRE_INIT
#define CONFIG_BOARD_SPECIFIC_VERSION
#define CONFIG_BOARD_VERSION
-#define CONFIG_BUTTON_RECOVERY
+#define CONFIG_BUTTON_TRIGGERED_RECOVERY
#define CONFIG_CHARGER_ILIM_PIN_DISABLED
#define CONFIG_FORCE_CONSOLE_RESUME
#define CONFIG_HOST_COMMAND_STATUS
diff --git a/common/button.c b/common/button.c
index 084cb35c47..5a48c8842e 100644
--- a/common/button.c
+++ b/common/button.c
@@ -83,7 +83,7 @@ static int raw_button_pressed(const struct button_config *button)
raw_value : !raw_value;
}
-#ifdef CONFIG_BUTTON_RECOVERY
+#ifdef CONFIG_BUTTON_TRIGGERED_RECOVERY
#ifdef CONFIG_LED_COMMON
static void button_blink_hw_reinit_led(void)
@@ -184,7 +184,7 @@ static int is_recovery_boot(void)
return 0;
return 1;
}
-#endif /* CONFIG_BUTTON_RECOVERY */
+#endif /* CONFIG_BUTTON_TRIGGERED_RECOVERY */
/*
* Button initialization.
@@ -201,13 +201,13 @@ void button_init(void)
gpio_enable_interrupt(buttons[i].gpio);
}
-#ifdef CONFIG_BUTTON_RECOVERY
+#ifdef CONFIG_BUTTON_TRIGGERED_RECOVERY
if (is_recovery_boot()) {
system_clear_reset_flags(RESET_FLAG_AP_OFF);
host_set_single_event(EC_HOST_EVENT_KEYBOARD_RECOVERY);
button_check_hw_reinit_required();
}
-#endif
+#endif /* defined(CONFIG_BUTTON_TRIGGERED_RECOVERY) */
}
/*
@@ -716,6 +716,10 @@ DECLARE_HOOK(HOOK_TICK, debug_led_tick, HOOK_PRIO_DEFAULT);
#endif /* !CONFIG_DEDICATED_RECOVERY_BUTTON */
#endif /* CONFIG_EMULATED_SYSRQ */
+#if defined(CONFIG_VOLUME_BUTTONS) && defined(CONFIG_DEDICATED_RECOVERY_BUTTON)
+#error "A dedicated recovery button is not needed if you have volume buttons."
+#endif /* defined(CONFIG_VOLUME_BUTTONS && CONFIG_DEDICATED_RECOVERY_BUTTON) */
+
const struct button_config buttons[BUTTON_COUNT] = {
#ifdef CONFIG_VOLUME_BUTTONS
[BUTTON_VOLUME_UP] = {
@@ -733,9 +737,8 @@ const struct button_config buttons[BUTTON_COUNT] = {
.debounce_us = 30 * MSEC,
.flags = 0,
},
-#endif /* defined(CONFIG_VOLUME_BUTTONS) */
-#ifdef CONFIG_DEDICATED_RECOVERY_BUTTON
+#elif defined(CONFIG_DEDICATED_RECOVERY_BUTTON)
[BUTTON_RECOVERY] = {
.name = "Recovery",
.type = KEYBOARD_BUTTON_RECOVERY,
@@ -745,3 +748,16 @@ const struct button_config buttons[BUTTON_COUNT] = {
}
#endif /* defined(CONFIG_DEDICATED_RECOVERY_BUTTON) */
};
+
+#ifdef CONFIG_BUTTON_TRIGGERED_RECOVERY
+const struct button_config *recovery_buttons[] = {
+#ifdef CONFIG_DEDICATED_RECOVERY_BUTTON
+ &buttons[BUTTON_RECOVERY],
+
+#elif defined(CONFIG_VOLUME_BUTTONS)
+ &buttons[BUTTON_VOLUME_DOWN],
+ &buttons[BUTTON_VOLUME_UP],
+#endif /* defined(CONFIG_VOLUME_BUTTONS) */
+};
+const int recovery_buttons_count = ARRAY_SIZE(recovery_buttons);
+#endif /* defined(CONFIG_BUTTON_TRIGGERED_RECOVERY) */
diff --git a/include/config.h b/include/config.h
index b0582f3f22..35f0821080 100644
--- a/include/config.h
+++ b/include/config.h
@@ -400,13 +400,17 @@
/*****************************************************************************/
/*
- * Support for entering recovery mode using volume buttons. You need to
- * list the buttons in recovery_buttons.
+ * Support for entering recovery mode using the volume buttons or a dedicated
+ * recovery button. Note that these are *buttons* and not keys in the keyboard
+ * matrix.
*/
-#undef CONFIG_BUTTON_RECOVERY
+#undef CONFIG_BUTTON_TRIGGERED_RECOVERY
/*
- * Indicates there is a dedicated recovery button.
+ * Indicates there is a dedicated recovery button. Note, that if there are
+ * volume buttons, a dedicated recovery button is not needed. This is intended
+ * because if a board has volume buttons, they can do everything a dedicated
+ * recovery button can do.
*/
#undef CONFIG_DEDICATED_RECOVERY_BUTTON
@@ -3131,6 +3135,15 @@
/*****************************************************************************/
/*
+ * Define CONFIG_BUTTON_TRIGGERED_RECOVERY if a board has a dedicated recovery
+ * button.
+ */
+#ifdef CONFIG_DEDICATED_RECOVERY_BUTTON
+#define CONFIG_BUTTON_TRIGGERED_RECOVERY
+#endif /* defined(CONFIG_DEDICATED_RECOVERY_BUTTON) */
+
+/*****************************************************************************/
+/*
* Handle task-dependent configs.
*
* This prevent sub-modules from being compiled when the task and parent module