summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
*/