summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-06-10 21:54:23 +0800
committerChromeBot <chrome-bot@google.com>2013-06-11 07:45:45 -0700
commitefc560f04f292cb42bdaf81c0d4fa3b1f5a1482a (patch)
tree2ec1a3d18d2a0f203b1a5ef4a64d9d36ef531731
parentad01c21d8fe30aff16539216fe93ccfefa97af6b (diff)
downloadchrome-ec-efc560f04f292cb42bdaf81c0d4fa3b1f5a1482a.tar.gz
Only cache LP5562 status on I2C transaction success
If the I2C transaction fails, we shouldn't cache the status because that status is not set correctly in LP5562. BUG=chrome-os-partner:20020 TEST=Boot and check battery LED still works. BRANCH=spring Original-Change-Id: I3f40c2d5c85db41e4ba4b80dc5252e5d86100823 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58072 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 465b59342a026d231ffef0cfcc1efc9c8e55a4f4) Change-Id: Ie57985b3c196ed9d1cfcf891a245c74aa0c929fa Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58182 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/spring/board.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/board/spring/board.c b/board/spring/board.c
index 65ed854631..440dacc07e 100644
--- a/board/spring/board.c
+++ b/board/spring/board.c
@@ -350,6 +350,7 @@ static void board_battery_led_update(void)
{
int current;
int desired_current;
+ int rv;
enum led_state_t state = LED_STATE_OFF;
/* Current states and next states */
@@ -359,13 +360,14 @@ static void board_battery_led_update(void)
/* Determine LED power */
new_led_power = board_get_ac();
if (new_led_power != led_power) {
- led_power = new_led_power;
if (new_led_power) {
- lp5562_poweron();
+ rv = lp5562_poweron();
} else {
- lp5562_poweroff();
+ rv = lp5562_poweroff();
set_led_color(LED_STATE_OFF);
}
+ if (!rv)
+ led_power = new_led_power;
}
if (!new_led_power)
return;