config: Add CONFIG_BUTTON_TRIGGERED_RECOVERY.

The CONFIG_BUTTON_RECOVERY option was a little confusing especially when
we have the CONFIG_DEDICATED_RECOVERY_BUTTON option.  This commit
renames CONFIG_BUTTON_RECOVERY to CONFIG_BUTTON_TRIGGERED_RECOVERY to
help make things a little clearer.

Additionally, to avoid copy paste, defining
CONFIG_BUTTON_TRIGGERED_RECOVERY will populate the recovery_buttons
table with either the volume buttons or a dedicated recovery button
depending what the board is configured for.

Lastly, if CONFIG_DEDICATED_RECOVERY_BUTTON is defined,
CONFIG_BUTTON_TRIGGERED_RECOVERY is defined as well since it's implicit.

BUG=chromium:783371
BRANCH=None
TEST=make -j buildall

Change-Id: Idccaa4d049ace0df3b98b35bdd38ac9dbd843200
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/830917
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
This commit is contained in:
Aseda Aboagye
2017-12-15 15:55:27 -08:00
committed by chrome-bot
parent f889d14d4e
commit a6509d28ab
14 changed files with 43 additions and 50 deletions

View File

@@ -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 */

View File

@@ -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

View File

@@ -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 */

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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},
};

View File

@@ -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

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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},
};

View File

@@ -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

View File

@@ -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) */

View File

@@ -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
@@ -3129,6 +3133,15 @@
#define CONFIG_USB_PD_VBUS_MEASURE_CHARGER
#endif
/*****************************************************************************/
/*
* 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.