diff options
author | Scott Collyer <scollyer@google.com> | 2017-11-03 11:13:57 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-11-07 17:52:21 -0800 |
commit | 4328a3c58e6c5a4769d344f490a5e497ffb98cf0 (patch) | |
tree | ee9bbf8e637fcc726847ad540ea9eb768661a820 /board/coral | |
parent | 0e7186422fea5046f11d15fdcf0647887b2aa4f9 (diff) | |
download | chrome-ec-4328a3c58e6c5a4769d344f490a5e497ffb98cf0.tar.gz |
coral: Ensure battery report timer can be restarted
Coral uses a 1 second delay to report battery being present to help
avoid VSYS glitches than can affect H1. On Eve, it was not expected to
remove and reconnect the battery while running. However, on Coral the
battery connector allows this action to take place.
Current if the battery is removed, when it's reconnected it can't
report as present because the timer_started flag is not being
reset. This CL checks for the case where the battery is not present
after being present and uses that as a trigger to reset the
battery_report_present_timer_started flag.
BUG=b:66923031
BRANCH=coral
TEST=While Coral unit has battery and ext AC connect, remove the
battery connector. Verifed the console log showed that this condition
was caught. Waited about 10 seconds, then reconnected battery and
verified that it reports as present.
[52.778818 Battery was present, but is now removed]
[60.211048 battery will now report present]
[60.217801 Battery FET: reg 0xe000 mask 0x4000 disc 0x0000]
[60.711195 battery woke up]
Change-Id: I41ae8c1b04a56697d20d3037b94189aff778fc4d
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/754025
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
Diffstat (limited to 'board/coral')
-rw-r--r-- | board/coral/battery.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/board/coral/battery.c b/board/coral/battery.c index ba4e75c0d5..b80bac3645 100644 --- a/board/coral/battery.c +++ b/board/coral/battery.c @@ -654,6 +654,15 @@ enum battery_present battery_is_present(void) if (!battery_report_present) batt_pres = BP_NO; + /* + * If battery was present, but has been disabled or removed, then reset + * the timer_started variable, so when battery is reconnected it can + * report as present. + */ + if (batt_pres_prev == BP_YES && batt_pres == BP_NO) { + battery_report_present_timer_started = 0; + CPRINTS("Battery was present, but is now disconnected"); + } batt_pres_prev = batt_pres; |