summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacky Wang <jacky5_wang@pegatron.corp-partner.google.com>2021-03-23 17:11:10 +0800
committerCommit Bot <commit-bot@chromium.org>2021-03-24 03:38:47 +0000
commit597035d35fe4ee1ae1b89644bb009919e0287066 (patch)
tree5a4972618de4f7c0cfdea9eab725c5dc0fe82cf6
parent9219c2cc000bb3322ba186bbe953d5282f6073d4 (diff)
downloadchrome-ec-597035d35fe4ee1ae1b89644bb009919e0287066.tar.gz
drobit: Limit the input current setting
Limit the input current to 98% negotiated limit, to account for the charger chip margin. BUG=b:183467915 BRANCH=firmware-volteer-13672.B TEST=make BOARD=drobit Use "ectool chargstate show" to check input current. Signed-off-by: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com> Change-Id: I4cff9c69b39f84616e535958e2bde1a64fd040ec Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2781097 Reviewed-by: Michael5 Chen <michael5_chen1@pegatron.corp-partner.google.com> Reviewed-by: Zhuohao Lee <zhuohao@chromium.org>
-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);
+}