summaryrefslogtreecommitdiff
path: root/board/elm/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/elm/board.c')
-rw-r--r--board/elm/board.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/board/elm/board.c b/board/elm/board.c
index f8621d086e..4007d34379 100644
--- a/board/elm/board.c
+++ b/board/elm/board.c
@@ -337,10 +337,13 @@ int board_set_active_charge_port(int charge_port)
* @param charge_ma Desired charge limit (mA).
* @param charge_mv Negotiated charge voltage (mV).
*/
-__override void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
- charge_set_input_current_limit(charge_ma, charge_mv);
+ /* Limit input current 95% ratio on elm board for safety */
+ charge_ma = (charge_ma * 95) / 100;
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}