From 2f127f3081be00dc318b4e0b9a9947c68b24849d Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Mon, 23 Oct 2017 15:45:16 -0700 Subject: charge_manager: Enter safe mode at boot Charge port / current selection often needs to be significantly altered when a battery cannot provide sufficient charge, so have charge_manager initially enter safe mode. After a battery with sufficient capacity has been identified, charge manager will leave safe mode, and port / current selection will return to standard rules. BUG=chromium:777596 BRANCH=None TEST=Pass charge_manager unit tests. On kevin, remove battery, attach Apple PD charger, verify safe mode is not exited and device does not brown out. Hot-plug battery and verify safe mode is exited. Next, remove battery, attach to Samus, verify safe mode is not exited and device doesn't brown out. Hot-plug battery, verify that safe mode is exited and no active charge port, due to dual-role exclusion. Change-Id: I7784865750087a037aad8dbbac058b22c77ba6d4 Signed-off-by: Shawn Nematbakhsh Reviewed-on: https://chromium-review.googlesource.com/733954 Commit-Ready: Shawn N Tested-by: Shawn N Reviewed-by: Vincent Palatin --- board/eve/board.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'board/eve') diff --git a/board/eve/board.c b/board/eve/board.c index ca5b43d63c..d6b4d87c38 100644 --- a/board/eve/board.c +++ b/board/eve/board.c @@ -472,17 +472,6 @@ int board_set_active_charge_port(int charge_port) { enum bd9995x_charge_port bd9995x_port; int bd9995x_port_select = 1; - static int initialized; - - /* - * Reject charge port disable if our battery is critical and we - * have yet to initialize a charge port - continue to charge using - * charger ROM / POR settings. - */ - if (!initialized && - charge_port == CHARGE_PORT_NONE && - charge_get_percent() < 2) - return -1; switch (charge_port) { case 0: @@ -511,7 +500,6 @@ int board_set_active_charge_port(int charge_port) } CPRINTS("New chg p%d", charge_port); - initialized = 1; return bd9995x_select_input_port(bd9995x_port, bd9995x_port_select); } -- cgit v1.2.1