summaryrefslogtreecommitdiff
path: root/board/drobit/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/drobit/board.c')
-rw-r--r--board/drobit/board.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/board/drobit/board.c b/board/drobit/board.c
index 1e4255c5fc..f54d5b8308 100644
--- a/board/drobit/board.c
+++ b/board/drobit/board.c
@@ -9,6 +9,7 @@
#include "common.h"
#include "accelgyro.h"
#include "cbi_ec_fw_config.h"
+#include "charge_state_v2.h"
#include "driver/bc12/pi3usb9201.h"
#include "driver/ppc/syv682x.h"
#include "driver/retimer/bb_retimer.h"
@@ -435,3 +436,17 @@ static void board_chipset_suspend(void)
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
+/******************************************************************************/
+/* Set the charge limit based upon desired maximum. */
+void board_set_charge_limit(int port, int supplier, int charge_ma,
+ int max_ma, int charge_mv)
+{
+ /*
+ * Limit the input current to 98% negotiated limit,
+ * to account for the charger chip margin.
+ */
+ charge_ma = charge_ma * 98 / 100;
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT),
+ charge_mv);
+}