diff options
author | Vic Yang <victoryang@chromium.org> | 2013-06-08 21:07:00 +0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-06-14 06:03:20 -0700 |
commit | 088a65615df492adce57244db86af9f04eb93ca4 (patch) | |
tree | ae8191440e402f5879f480ea6f49509280450eaa | |
parent | 2779b3cfeeb60d9ca576e0a2b9d347da75149823 (diff) | |
download | chrome-ec-088a65615df492adce57244db86af9f04eb93ca4.tar.gz |
spring: Show green LED when 94% charged
For Spring, we cannot rely on the battery current to decide if it's
fully charged. Therefore, we just use the battery charge level as the
sole indicator. The battery spec says it might stop charging when charge
level is 95%+, so we should show green LED when it reaches 94%.
Otherwise, show yellow LED.
BUG=chrome-os-partner:20017
TEST=Manual. Monitor the battery level and see LED turns green when it
goes from 93% to 94%.
BRANCH=spring
Original-Change-Id: Ia525b2e89ebe36cc2ccce1ea0b798ba03be258a7
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58059
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit 6a701c59576ace1c6a5d5f74ae661285b1773b97)
Change-Id: I4b5fdafd5ddbe0f637942b49efe7257695dd67a8
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58651
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | board/spring/board.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/board/spring/board.c b/board/spring/board.c index 440dacc07e..78a9c85917 100644 --- a/board/spring/board.c +++ b/board/spring/board.c @@ -30,6 +30,8 @@ #define HARD_RESET_TIMEOUT_MS 5 +#define GREEN_LED_THRESHOLD 94 + /* We use yellow LED instead of blue LED. Re-map colors here. */ #define LED_COLOR_NONE LP5562_COLOR_NONE #define LED_COLOR_GREEN LP5562_COLOR_GREEN @@ -351,6 +353,7 @@ static void board_battery_led_update(void) int current; int desired_current; int rv; + int state_of_charge; enum led_state_t state = LED_STATE_OFF; /* Current states and next states */ @@ -391,7 +394,8 @@ static void board_battery_led_update(void) break; case ST_CHARGING: if (battery_current(¤t) || - battery_desired_current(&desired_current)) { + battery_desired_current(&desired_current) || + battery_state_of_charge(&state_of_charge)) { /* Cannot talk to the battery. Set LED to red. */ state = LED_STATE_SOLID_RED; break; @@ -403,7 +407,7 @@ static void board_battery_led_update(void) } /* If battery doesn't want any current, it's considered full. */ - if (desired_current) + if (state_of_charge < GREEN_LED_THRESHOLD) state = LED_STATE_SOLID_YELLOW; else state = LED_STATE_SOLID_GREEN; |