summaryrefslogtreecommitdiff
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
parent38a49030556c7989b05aaa685ea2d84b48a4cf2c (diff)
downloadchrome-ec-stabilize-7155.B.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>
-rw-r--r--board/glados/board.h2
-rw-r--r--common/charge_state_v2.c4
-rw-r--r--include/config.h7
3 files changed, 12 insertions, 1 deletions
diff --git a/board/glados/board.h b/board/glados/board.h
index 1d3a84e17f..0a570f80ba 100644
--- a/board/glados/board.h
+++ b/board/glados/board.h
@@ -21,6 +21,8 @@
#define CONFIG_CHARGER_SENSE_RESISTOR 10
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 20
#define CONFIG_CHARGER_INPUT_CURRENT 512
+/* TODO: Remove this limit once boards can charge at higher than this */
+#define CONFIG_CHARGER_MAX_INPUT_CURRENT 1500
#define CONFIG_CHARGER_DISCHARGE_ON_AC
#define CONFIG_CHIPSET_SKYLAKE
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);
}
diff --git a/include/config.h b/include/config.h
index 63371dcd6c..60adb684d7 100644
--- a/include/config.h
+++ b/include/config.h
@@ -274,7 +274,7 @@
#undef CONFIG_CHARGER_ILIM_PIN_DISABLED
/*
- * Maximum amount of input current the charger can receive, in mA.
+ * Default input current for the board, in mA.
*
* This value should depend on external power adapter, designed charging
* voltage, and the maximum power of the running system.
@@ -282,6 +282,11 @@
#undef CONFIG_CHARGER_INPUT_CURRENT
/*
+ * Board specific maximum input current limit, in mA.
+ */
+#undef CONFIG_CHARGER_MAX_INPUT_CURRENT
+
+/*
* Equivalent of CONFIG_BATTERY_OVERRIDE_PARAMS for use with
* CONFIG_CHARGER_V2
*/