diff options
author | Vic Yang <victoryang@chromium.org> | 2013-08-20 14:16:53 +0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-08-21 19:20:44 -0700 |
commit | 0e024b2bae085f12ec4df33000799339aef38809 (patch) | |
tree | e62357e408cf9f75a3ce4661c7fdd68d3c5e36f1 /common | |
parent | 5d1eeefdbcf16e9eb18540b7b6ed4aff8609c4d9 (diff) | |
download | chrome-ec-0e024b2bae085f12ec4df33000799339aef38809.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: I1353044ef782481872d692f15748413ef539cb27
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/66314
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/led_lp5562.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/common/led_lp5562.c b/common/led_lp5562.c index a35332be9b..3d6e316426 100644 --- a/common/led_lp5562.c +++ b/common/led_lp5562.c @@ -35,6 +35,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; @@ -57,12 +60,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; } |