diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2017-10-23 15:45:16 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-11-02 23:21:52 -0700 |
commit | 2f127f3081be00dc318b4e0b9a9947c68b24849d (patch) | |
tree | a5ca33f3e2654f788e676790dee4d5d65a18b773 /board/scarlet | |
parent | f28ab5c2ecd0549a72dc042564374faade58abcc (diff) | |
download | chrome-ec-2f127f3081be00dc318b4e0b9a9947c68b24849d.tar.gz |
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 <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/733954
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/scarlet')
-rw-r--r-- | board/scarlet/board.c | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/board/scarlet/board.c b/board/scarlet/board.c index f496abcda9..f0899842ff 100644 --- a/board/scarlet/board.c +++ b/board/scarlet/board.c @@ -166,21 +166,6 @@ uint16_t tcpc_get_alert_status(void) int board_set_active_charge_port(int charge_port) { - 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() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON || - battery_get_disconnect_state() == BATTERY_DISCONNECTED)) { - CPRINTS("Bat critical, don't stop charging"); - return -1; - } - CPRINTS("New chg p%d", charge_port); switch (charge_port) { @@ -198,25 +183,12 @@ int board_set_active_charge_port(int charge_port) break; } - initialized = 1; return EC_SUCCESS; } void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma, int charge_mv) { - /* - * Ignore lower charge ceiling on PD transition if our battery is - * critical, as we may brownout. - */ - if (supplier == CHARGE_SUPPLIER_PD && - charge_ma < 1500 && - (charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON || - battery_get_disconnect_state() == BATTERY_DISCONNECTED)) { - CPRINTS("Using max ilim %d", max_ma); - charge_ma = max_ma; - } - charge_set_input_current_limit(MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv); } |