From 665ee232999ab22a9e0a53ddba020e0b1f387fcf Mon Sep 17 00:00:00 2001 From: Matthias Kaehlcke Date: Thu, 7 Dec 2017 17:38:24 -0800 Subject: [PATCH] scarlet: blink charging LED in debug mode The blinking LED indicates that debug mode is active. BUG=b:69981636 TEST=Press VolUp + VolDown for 10s to enter debug mode => charging LED blinks => stops blinking after user action or timeout test different cases: - fully charged battery, connected to power - fully charged battery, not connected to power - partially discharged battery, connected to power - partially discharged battery, not connected to power BRANCH=none Change-Id: If7ca06aaf5d1fb4c3df4dfb9e63ca6425002b880 Signed-off-by: Matthias Kaehlcke Reviewed-on: https://chromium-review.googlesource.com/818496 Reviewed-by: Shawn N --- board/scarlet/led.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/board/scarlet/led.c b/board/scarlet/led.c index 0062b0bb41..d4c758cdcc 100644 --- a/board/scarlet/led.c +++ b/board/scarlet/led.c @@ -127,3 +127,18 @@ static void led_second(void) scarlet_led_set_battery(); } DECLARE_HOOK(HOOK_SECOND, led_second, HOOK_PRIO_DEFAULT); + +void led_control(enum ec_led_id led_id, enum ec_led_state state) +{ + if ((led_id != EC_LED_ID_RECOVERY_HW_REINIT_LED) && + (led_id != EC_LED_ID_SYSRQ_DEBUG_LED)) + return; + + if (state == LED_STATE_RESET) { + led_auto_control(EC_LED_ID_BATTERY_LED, 1); + return; + } + + led_auto_control(EC_LED_ID_BATTERY_LED, 0); + bat_led_set_color(state ? LED_AMBER : LED_OFF); +}