kevin: Use maximum negotiated charge limit on critical battery

To improve spec compliance, we reduce input current limit on PD voltage
transition. This may cause us to brownout if the battery cannot provide
sufficient current, so use the max. negotiated current when our battery
is critical.

BUG=chrome-os-partner:56139
BRANCH=None
TEST=Boot with critical battery on kevin, verify system boots to OS
without brownout.

Change-Id: I1bdb2b7168c7b810af789e2206d0420f5d2bdcdd
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/383733
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Shawn Nematbakhsh
2016-09-09 10:41:34 -07:00
committed by chrome-bot
parent 94f2bc0740
commit a04a2cb9af

View File

@@ -238,6 +238,17 @@ int board_set_active_charge_port(int charge_port)
void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma)
{
/*
* 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() < 2) {
CPRINTS("Using max ilim %d", max_ma);
charge_ma = max_ma;
}
charge_set_input_current_limit(MAX(charge_ma,
CONFIG_CHARGER_INPUT_CURRENT));
}