diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2012-06-22 23:16:47 +0000 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-06-26 18:15:37 -0700 |
commit | 108aab99d49649e1ef61763a8803bd3754c5ad1e (patch) | |
tree | ba25f0b9fc5c49e81eb79647b2210155960ad54f | |
parent | c56b1a7bdbcd596c78290dfff48e65f8c352916c (diff) | |
download | chrome-ec-108aab99d49649e1ef61763a8803bd3754c5ad1e.tar.gz |
tpschrome: skip bad I2C read
When an I2C read fails, we don't want to switch off the system or even
print verbose warnings.
Indeed, we are failing all I2C reads and writes to the charger and
battery when they are on the same bus as the AP and the AP is ON.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chrome-os-partner:9724
TEST=on Lucas DVT, run the system and see we have no spurious switch off
or verbose EC traces.
Change-Id: Ieb2f7836c70a0d2ad2c4a0f775aa190ce81a6932
Reviewed-on: https://gerrit.chromium.org/gerrit/26064
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | common/pmu_tps65090.c | 9 | ||||
-rw-r--r-- | common/pmu_tps65090_charger.c | 3 |
2 files changed, 7 insertions, 5 deletions
diff --git a/common/pmu_tps65090.c b/common/pmu_tps65090.c index b32000b283..290db145b3 100644 --- a/common/pmu_tps65090.c +++ b/common/pmu_tps65090.c @@ -82,7 +82,12 @@ static int pmu_get_event(int *event) int pmu_is_charger_alarm(void) { int status; - if (pmu_read(CG_STATUS1, &status) || (status & CHARGER_ALARM)) + + /** + * if the I2C access to the PMU fails, we consider the failure as + * non-critical and wait for the next read without send the alert. + */ + if (!pmu_read(CG_STATUS1, &status) && (status & CHARGER_ALARM)) return 1; return 0; } @@ -123,5 +128,3 @@ void pmu_init(void) */ pmu_write(CG_CTRL3, 0xbb); } - - diff --git a/common/pmu_tps65090_charger.c b/common/pmu_tps65090_charger.c index d8f8022af2..db13247050 100644 --- a/common/pmu_tps65090_charger.c +++ b/common/pmu_tps65090_charger.c @@ -247,7 +247,7 @@ static int calc_next_state(int state) } } /* Check discharging alarm */ - if (battery_status(&alarm) || (alarm & ALARM_DISCHARGING)) { + if (!battery_status(&alarm) && (alarm & ALARM_DISCHARGING)) { CPRINTF("[pmu] discharging: battery alarm %016b\n", alarm); return system_off(); @@ -279,4 +279,3 @@ void pmu_charger_task(void) } } } - |