From b1e212dabe0d4e70e79762f9728113067c7d315b Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Tue, 7 Mar 2017 09:47:29 -0800 Subject: eve: Fix LED behavior when discharging with full battery In order to prevent noise when using the system with a full battery the EC can disable charging at full until it reaches 97% and then turn on charging again. However this needs additional LED handling to ensure that the charging LED is shown green in this state. BUG=b:36024657 BRANCH=none TEST=manual test with full battery on Eve P1b, ensure that the LED is still green when battery is full and discharging. Change-Id: Iad2b1462ad85163dc9702ff1154f3ff10eb0f7ca Signed-off-by: Duncan Laurie Reviewed-on: https://chromium-review.googlesource.com/450953 Reviewed-by: Scott Collyer --- board/eve/led.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'board/eve/led.c') diff --git a/board/eve/led.c b/board/eve/led.c index ddc3efa567..9c5a08b2bd 100644 --- a/board/eve/led.c +++ b/board/eve/led.c @@ -140,6 +140,10 @@ static void eve_led_set_power_battery(void) PWR_STATE_CHARGE_NEAR_FULL) { set_color(LED_GREEN, side); blueside = !side; + } else if (chg_state == PWR_STATE_DISCHARGE_FULL && + extpower_is_present()) { + set_color(LED_GREEN, side); + blueside = !side; } set_color(LED_BLUE, blueside); return; @@ -165,8 +169,13 @@ static void eve_led_set_power_battery(void) } else if (chg_state == PWR_STATE_CHARGE) { set_color(LED_AMBER, side); blinkside = !side; + } else if (chg_state == PWR_STATE_DISCHARGE_FULL && + extpower_is_present()) { + set_color(LED_GREEN, side); + blinkside = !side; } if (chg_state == PWR_STATE_DISCHARGE || + chg_state == PWR_STATE_DISCHARGE_FULL || chg_state == PWR_STATE_CHARGE || chg_state == PWR_STATE_CHARGE_NEAR_FULL || chg_state == PWR_STATE_IDLE) { @@ -183,6 +192,11 @@ static void eve_led_set_power_battery(void) /* CHIPSET_STATE_OFF */ switch (chg_state) { + case PWR_STATE_DISCHARGE_FULL: + set_color(LED_OFF, LED_BOTH); + if (extpower_is_present()) + set_color(LED_GREEN, side); + break; case PWR_STATE_DISCHARGE: set_color(LED_OFF, LED_BOTH); break; -- cgit v1.2.1