summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@chromium.org>2017-09-20 09:47:02 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-09-21 01:08:04 -0700
commitbabc3b9e5d369b7494cc95d326e4a439921a1d21 (patch)
tree1901510f0dc62ab2b274a0fde36c54e01eda3de6
parent220c75bd1626c656234d6121af8068c42ff182f8 (diff)
downloadchrome-ec-babc3b9e5d369b7494cc95d326e4a439921a1d21.tar.gz
poppy/soraka: Do not disable charge port in critical battery state
When battery is at critical charge level, reject charge port disable request. Since battery is not able to provide enough power to the EC on boot, we should not cut off our input power, regardless of dual-role determination or other charging policy. (Reference: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/351224) BUG=b:64703097 BRANCH=None TEST=make -j buildall. Verified that both right and left port are able to boot the EC up successfully. No reboot loops observed in critical battery conditions. Change-Id: I098083036388783c0975ac772da3a3412895e26f Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/675586 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--board/poppy/board.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/board/poppy/board.c b/board/poppy/board.c
index 0303da3fba..9add68bfa9 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -634,6 +634,7 @@ DECLARE_HOOK(HOOK_AC_CHANGE, board_extpower, HOOK_PRIO_DEFAULT);
*/
int board_set_active_charge_port(int charge_port)
{
+ static uint8_t initialized;
/* charge port is a physical port */
int is_real_port = (charge_port >= 0 &&
charge_port < CONFIG_USB_PD_PORT_COUNT);
@@ -646,6 +647,13 @@ int board_set_active_charge_port(int charge_port)
return EC_ERROR_INVAL;
}
+ if (!initialized &&
+ charge_port == CHARGE_PORT_NONE &&
+ charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) {
+ CPRINTS("Bat critical, don't stop charging");
+ return -1;
+ }
+
CPRINTF("New chg p%d", charge_port);
if (charge_port == CHARGE_PORT_NONE) {
@@ -661,6 +669,7 @@ int board_set_active_charge_port(int charge_port)
GPIO_USB_C0_CHARGE_L, 0);
}
+ initialized = 1;
return EC_SUCCESS;
}