summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2016-12-07 11:13:55 +0100
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2016-12-08 07:46:57 +0000
commitcd34006ebf765e57233b51a1b091c76f4b2b96cb (patch)
tree432e9542eb0440fd7aa0bb62fe9fa1b77744171f
parent13498c72dcb95cbb30add18132c114d5b139a55b (diff)
downloadchrome-ec-cd34006ebf765e57233b51a1b091c76f4b2b96cb.tar.gz
caroline: limit input current to 95% of the negotiated value
Account for the charger chip regulation accuracy plus margin to avoid going over the negotiated current value. BRANCH=glados BUG=chrome-os-partner:60693 TEST=Attach a Caroline charger through Twinkie and see 1.930A at 14.980V. Change-Id: Ifc2ebba73c16768eed1d874e4813a81fdda0d5fe Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/417800 Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--board/caroline/board.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/board/caroline/board.c b/board/caroline/board.c
index a35418cf8b..0a80c14871 100644
--- a/board/caroline/board.c
+++ b/board/caroline/board.c
@@ -323,6 +323,11 @@ int board_set_active_charge_port(int charge_port)
*/
void board_set_charge_limit(int charge_ma)
{
+ /*
+ * Limit the input current to 95% negotiated limit,
+ * to account for the charger chip margin.
+ */
+ charge_ma = charge_ma * 95 / 100;
charge_set_input_current_limit(MAX(charge_ma,
CONFIG_CHARGER_INPUT_CURRENT));
}