summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2017-10-10 09:43:47 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2017-10-10 22:45:19 +0000
commit763a3d869ff6c8ccbfd7ec0264e1e2180f4317ed (patch)
tree1967a63ddbed3db8d3ce9c2872c048938c9abaf9
parent0c9cfeb7c043d8b5f1eee1495daf51f78e219513 (diff)
downloadchrome-ec-763a3d869ff6c8ccbfd7ec0264e1e2180f4317ed.tar.gz
charge_manager: Delay power on if battery is not present
If the battery 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) This will allow a board without a battery to boot without browning out the system. BUG=b:66977532 BRANCH=eve TEST=successfully boot on the first attempt without a battery Change-Id: Ia362b55962d15aa9c72eb4b0742989e3cac0b5d4 Signed-off-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: https://chromium-review.googlesource.com/709473 Reviewed-by: Scott Collyer <scollyer@chromium.org>
-rw-r--r--common/charge_state_v2.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index f7ad95bb29..fe35a26851 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -1027,6 +1027,17 @@ int charge_prevent_power_on(int power_button_pressed)
(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() <
+ (LIKELY_PD_USBC_POWER_MW * 1000))
+ prevent_power_on = 1;
+#endif
#endif
return prevent_power_on;