button: Switch on recovery LED after entering recovery mode

Recovery mode can be triggered with or without hw reinit. And both the
modes are triggered using the same button combination held down for
different amount of time. For recovery mode with hw reinit (>30
seconds), LED blinks for 4 seconds. However, for recovery mode without
hw reinit(>10 seconds), there is no user indication. This change turns
on the LED as soon as the >10 second condition is satisfied. This
provides an indication to the user that recovery mode is triggered.

BUG=b:62886608
BRANCH=None
TEST=make -j buildall

Change-Id: I949c3e7e98441131df987b6351c1f614f3b4831c
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/549775
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
This commit is contained in:
Furquan Shaikh
2017-06-26 20:26:32 -07:00
committed by chrome-bot
parent 52eb3b3b64
commit e85d3e9825

View File

@@ -110,6 +110,9 @@ static void button_check_hw_reinit_required(void)
{
timestamp_t deadline;
timestamp_t now = get_time();
#ifdef CONFIG_LED_COMMON
uint8_t led_on = 0;
#endif
deadline.val = now.val + (20 * SECOND);
@@ -119,8 +122,22 @@ static void button_check_hw_reinit_required(void)
if (!is_recovery_button_pressed() ||
!power_button_signal_asserted()) {
CPRINTS("No HW_REINIT request");
#ifdef CONFIG_LED_COMMON
if (led_on)
led_control(EC_LED_ID_RECOVERY_HW_REINIT_LED,
LED_STATE_RESET);
#endif
return;
}
#ifdef CONFIG_LED_COMMON
if (!led_on) {
led_control(EC_LED_ID_RECOVERY_HW_REINIT_LED,
LED_STATE_ON);
led_on = 1;
}
#endif
now = get_time();
watchdog_reload();
}