summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-08-20 13:17:44 +0800
committerChromeBot <chrome-bot@google.com>2013-08-20 09:50:39 -0700
commit6d225d01d2a0cdd56ded8ca20c8ec8116c52a4e9 (patch)
tree6d21066b6205119b1ac281ba8f73faabbb5422f6
parentcd9f2480e648ee2c98375300e9dfed88879d12b3 (diff)
downloadchrome-ec-6d225d01d2a0cdd56ded8ca20c8ec8116c52a4e9.tar.gz
Fix a bug that I2C error may cause incorrect LED color
If there is an I2C transaction error while setting LED color, the three LED color channels might be in an inconsistent state. In this case, we should explicitly set the LED state to INVALID so as to force the next LED color update. BUG=None TEST=Build success BRANCH=Spring Change-Id: I0121c238e34f10bd5e6491478f92322b9738b201 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/66312 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/spring/board.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/board/spring/board.c b/board/spring/board.c
index 0e6c66cc9f..9f87985cfe 100644
--- a/board/spring/board.c
+++ b/board/spring/board.c
@@ -50,6 +50,9 @@ enum led_state_t {
/* Not an actual state */
LED_STATE_OFF,
+
+ /* Used to force next LED color update */
+ LED_STATE_INVALID,
};
static enum led_state_t last_state = LED_STATE_OFF;
@@ -323,12 +326,14 @@ static int set_led_color(enum led_state_t state)
case LED_STATE_SOLID_YELLOW:
rv = lp5562_set_color(LED_COLOR_YELLOW);
break;
- case LED_STATE_OFF:
+ default:
break;
}
if (rv == EC_SUCCESS)
last_state = state;
+ else
+ last_state = LED_STATE_INVALID;
return rv;
}