diff options
author | Scott Collyer <scollyer@google.com> | 2017-11-02 18:09:36 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-11-03 13:52:44 -0700 |
commit | ea673281c32575674db1dc210ee3537d57fc1b23 (patch) | |
tree | 56c824bfe0ca71bb18a417449562ae3983c94b7b /common | |
parent | 10dc1b8aad55939f14277b16d0d3cc7199615a36 (diff) | |
download | chrome-ec-ea673281c32575674db1dc210ee3537d57fc1b23.tar.gz |
charge_manager: Wait for charge current to be initialized
When allowing an unlocked system to automatically power up we
may attempt to boot before the charger is ready to supply enough
power and get stuck in a reset loop.
In addition, if the batttery is not physically present in the system
then delay power-on until the charger is providing at least 15W of
power. (currently defined as LIKELY_PD_USBC_POWER_MW)
By adding a final check to the charge_prevent_power_on() function
to ensure that charge_manager_get_charger_current() is returning
a valid value instead of CHARGE_CURRENT_UNINITIALIZED then the
board is able to reliably boot.
This CL combines 2 CLs made on Eve which addressed the same problem
I'm seeing on Robo devices.
https://chromium-review.googlesource.com/582545
https://chromium-review.googlesource.com/709473
BUG=b:68226308
BRANCH=coral
TEST=Used Robo system which was consistently failing when external
power was connected to Port 1. After adding this change was able to
consistently power up the system without going into a reboot loop. In
addition had signal wires attached to VBUS and VSYS so could verify
that VSYS was no longer collapsing.
Change-Id: Iadecf032feaacfda230bfc98a332cd7963fb0afe
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/752755
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
Diffstat (limited to 'common')
-rw-r--r-- | common/charge_state_v2.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c index cb742f1bb6..7a926cfb54 100644 --- a/common/charge_state_v2.c +++ b/common/charge_state_v2.c @@ -1044,6 +1044,28 @@ int charge_prevent_power_on(int power_button_pressed) )); #endif +#ifdef CONFIG_CHARGE_MANAGER + /* Always prevent power on until charge current is initialized */ + if (extpower_is_present() && + (charge_manager_get_charger_current() == + CHARGE_CURRENT_UNINITIALIZED)) + prevent_power_on = 1; +#ifdef CONFIG_BATTERY_HW_PRESENT_CUSTOM + /* + * If battery is NOT physically present then prevent power on until + * charge manager provides at least LIKELY_PD_USBC_POWER_MW. + */ + if (extpower_is_present() && battery_hw_present() == BP_NO && + charge_manager_get_power_limit_uw() < +#ifdef CONFIG_CHARGER_LIMIT_POWER_THRESH_BAT_PCT + MIN(LIKELY_PD_USBC_POWER_MW * 1000, + CONFIG_CHARGER_LIMIT_POWER_THRESH_CHG_MW * 1000)) +#else + (LIKELY_PD_USBC_POWER_MW * 1000)) +#endif + prevent_power_on = 1; +#endif +#endif return prevent_power_on; } |