mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 01:50:53 +00:00
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 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>
This commit is contained in:
@@ -111,6 +111,7 @@ static void battery_led_update(void)
|
||||
{
|
||||
int current;
|
||||
int desired_current;
|
||||
int rv;
|
||||
enum led_state_t state = LED_STATE_OFF;
|
||||
|
||||
/* Current states and next states */
|
||||
@@ -120,13 +121,14 @@ static void battery_led_update(void)
|
||||
/* Determine LED power */
|
||||
new_led_power = extpower_is_present();
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user