mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 16:41:55 +00:00
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>
This commit is contained in:
committed by
chrome-bot
parent
0e7186422f
commit
4328a3c58e
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user