From e9c3b705d5efd8e691e6ddbd198b543a11db7997 Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Wed, 6 Feb 2013 10:47:11 +0800 Subject: [PATCH] spring: Tweak battery LED policy When battery is nearly full, we sometimes see: - Battery asks for no current, but slowly discharge (5-7 mA) - Battery asks for current, but not charging. For these cases, we consider the battery full and show green LED. BUG=chrome-os-partner:17561 TEST=Manual BRANCH=none Change-Id: I2808d4c1a89d37000244fb308197cdef473ec5be Signed-off-by: Vic Yang Reviewed-on: https://gerrit.chromium.org/gerrit/42688 Reviewed-by: Vincent Palatin --- board/spring/board.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/board/spring/board.c b/board/spring/board.c index 3b26ab4cf9..2867128050 100644 --- a/board/spring/board.c +++ b/board/spring/board.c @@ -301,6 +301,7 @@ int board_get_ac(void) int board_battery_led(enum charging_state state) { int current; + int desired_current; uint32_t color = LED_COLOR_RED; /* @@ -316,12 +317,13 @@ int board_battery_led(enum charging_state state) color = LED_COLOR_YELLOW; break; case ST_CHARGING: - if (battery_desired_current(¤t)) { + if (battery_current(¤t) || + battery_desired_current(&desired_current)) { /* Cannot talk to the battery. Set LED to red. */ color = LED_COLOR_RED; break; } - if (current) + if (current && desired_current) color = LED_COLOR_YELLOW; else color = LED_COLOR_GREEN;