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 20:19:32 +0000
commit1876ca65793e601004f2f047f28a61b72354bd3c (patch)
tree70470b0eac5ac76f721b7a57c5f2264c1e4fcf8c
parente32de8826abf0ee3c123962df683a7a7b20cf158 (diff)
downloadchrome-ec-1876ca65793e601004f2f047f28a61b72354bd3c.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> (cherry picked from commit 597035d35fe4ee1ae1b89644bb009919e0287066) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2784323 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@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);
+}