summaryrefslogtreecommitdiff
path: root/board/rammus/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/rammus/board.c')
-rw-r--r--board/rammus/board.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/board/rammus/board.c b/board/rammus/board.c
index e4abed4afb..8cbc6c6856 100644
--- a/board/rammus/board.c
+++ b/board/rammus/board.c
@@ -558,6 +558,26 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
+/**
+ * Set the charge limit based upon desired maximum.
+ *
+ * @param port Port number.
+ * @param supplier Charge supplier type.
+ * @param charge_ma Desired charge limit (mA).
+ * @param charge_mv Negotiated charge voltage (mV).
+ */
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
+{
+ /*
+ * Limit the input current to 96% negotiated limit,
+ * to account for the charger chip margin.
+ */
+ charge_ma = charge_ma * 96 / 100;
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
+
void board_hibernate(void)
{
CPRINTS("Triggering PMIC shutdown.");