diff options
Diffstat (limited to 'board/nautilus/board.c')
-rw-r--r-- | board/nautilus/board.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/board/nautilus/board.c b/board/nautilus/board.c index af7d7f48d4..3cdd7abaf1 100644 --- a/board/nautilus/board.c +++ b/board/nautilus/board.c @@ -528,6 +528,26 @@ int board_set_active_charge_port(int charge_port) } /** + * 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); +} + +/** * Return the maximum allowed input current */ int board_get_ramp_current_limit(int supplier, int sup_curr) |