From de2a794a228ea8aa86f4d4c5c21c99150f4688f6 Mon Sep 17 00:00:00 2001 From: Ting Shen Date: Tue, 4 Jun 2019 17:36:18 +0800 Subject: krane: limit input power to 5V/2A in S0 This is a short term fix to prevent charger overheat. BUG=b:134227872 TEST=manually, boot with the new fw and measure the power. BRANCH=master Change-Id: I88c3444f0a0c0c9a755579fcb1f9c52fc032a179 Signed-off-by: Ting Shen Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1642478 Tested-by: Tony Lin Tested-by: Ting Shen Reviewed-by: Yilun Lin Commit-Queue: Ting Shen --- board/kukui/battery.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/board/kukui/battery.c b/board/kukui/battery.c index 6a01322b89..8cf9299f41 100644 --- a/board/kukui/battery.c +++ b/board/kukui/battery.c @@ -15,6 +15,7 @@ #include "extpower.h" #include "gpio.h" #include "hooks.h" +#include "power.h" #include "usb_pd.h" #include "util.h" @@ -211,10 +212,20 @@ int charger_profile_override(struct charge_state_data *curr) /* Limit input (=VBUS) to 5V when soc > 85% and charge current < 1A. */ if (!(curr->batt.flags & BATT_FLAG_BAD_CURRENT) && charge_get_percent() > BAT_LEVEL_PD_LIMIT && - curr->batt.current < 1000) + curr->batt.current < 1000) { chg_limit_mv = 5500; - else + } else if (IS_ENABLED(BOARD_KRANE) && + board_get_version() == 3 && + power_get_state() == POWER_S0) { + /* + * TODO(b:134227872): limit power to 5V/2A in S0 to prevent + * overheat + */ + chg_limit_mv = 5500; + curr->requested_current = 2000; + } else { chg_limit_mv = PD_MAX_VOLTAGE_MV; + } if (chg_limit_mv != previous_chg_limit_mv) CPRINTS("VBUS limited to %dmV", chg_limit_mv); -- cgit v1.2.1