diff options
author | Furquan Shaikh <furquan@chromium.org> | 2017-06-26 20:26:32 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-06-28 03:09:51 -0700 |
commit | e85d3e982597a9bfc20bb7ef820ef93db1927de1 (patch) | |
tree | 9daf84b06b1c93d259deab00df07815c3796f255 /common/button.c | |
parent | 52eb3b3b6404b2c2b99715124e5ea9af307db8bf (diff) | |
download | chrome-ec-e85d3e982597a9bfc20bb7ef820ef93db1927de1.tar.gz |
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>
Diffstat (limited to 'common/button.c')
-rw-r--r-- | common/button.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/common/button.c b/common/button.c index 9ed2e015ce..bc66ae6611 100644 --- a/common/button.c +++ b/common/button.c @@ -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(); } |