summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-06-08 12:20:08 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-09 00:13:54 +0000
commit930e001165c2df0b491288b2a8de1071b58ac6ec (patch)
treefc5172654bc75b016c309cb07ddc3a53f5ec4301 /common
parent38a49030556c7989b05aaa685ea2d84b48a4cf2c (diff)
downloadchrome-ec-930e001165c2df0b491288b2a8de1071b58ac6ec.tar.gz
glados: limit max input current to 1.5A to avoid i2c errorsstabilize-7155.B
Add workaround to limit the max input current to 1.5A due to i2c communication problems at higher currents. Note that this max should be removed when possible. This introduces a new CONFIG option to define the maximum input current limit for a board, as opposed to the already existing default input current limit. BUG=none BRANCH=none TEST=load on glados, charge with zinger, make sure input current is set to 1.5A and no recurring i2c errors talking to battery and charger. Change-Id: Ib7070772e1bf5475e98a2dc946ae75bf08047b70 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276169 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/charge_state_v2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 27bdbab410..5b84ddc4eb 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -995,6 +995,10 @@ int charge_set_input_current_limit(int ma)
if (curr.batt.is_present != BP_YES && !system_is_locked())
return EC_SUCCESS;
+#ifdef CONFIG_CHARGER_MAX_INPUT_CURRENT
+ /* Limit input current limit to max limit for this board */
+ ma = MIN(ma, CONFIG_CHARGER_MAX_INPUT_CURRENT);
+#endif
curr.desired_input_current = ma;
return charger_set_input_current(ma);
}