primus: set input current
BRANCH=none
TEST=make -j BOARD=primus
TEST=verify by power team.
#include "charge_ramp.h"
#include "charger.h"
#include "common.h"
+#include "charge_state_v2.h"
#include "compile_time_macros.h"
#include "console.h"
#include "fw_config.h"
#include "switch.h"
#include "throttle_ap.h"
#include "usbc_config.h"
+#include "util.h"
#include "gpio_list.h" /* Must come after other header files. */
@@ -116,3 +118,17 @@ static void keyboard_init(void)
set_scancode_set2(0, 11, get_scancode_set2(3, 9));
}
DECLARE_HOOK(HOOK_INIT, keyboard_init, HOOK_PRIO_DEFAULT);
+
+__override void board_set_charge_limit(int port, int supplier, int charge_ma,
+ int max_ma, int charge_mv)
+{
+ /*
+ * Follow OEM request to limit the input current to
+ * 97% negotiated limit.
+ */
+ charge_ma = charge_ma * 97 / 100;
+
+ charge_set_input_current_limit(MAX(charge_ma,
+ CONFIG_CHARGER_INPUT_CURRENT),
+ charge_mv);
+}
