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 <mka@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/818496
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Matthias Kaehlcke
2017-12-07 17:38:24 -08:00
committed by chrome-bot
parent 91c1b0abab
commit 665ee23299

View File

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