summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chen <philipchen@google.com>2018-12-14 11:21:20 -0800
committerPhilip Chen <philipchen@chromium.org>2018-12-14 23:21:24 +0000
commitf57c609176a308ba928391571d5c1de7c87deccf (patch)
tree857f4844500ce08c4a96230b426a1372c0a6fab9
parentfd780d6b77801a4088a6f08d4bde11ab72c8ac2b (diff)
downloadchrome-ec-f57c609176a308ba928391571d5c1de7c87deccf.tar.gz
scarlet: Throttle PD voltage regardless of power state
BUG=b:78792296 BRANCH=scarlet TEST=manually on dru Change-Id: Ic5f20cdbeee113a4e1609d7eb9d1b2c1b2c07f25 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/1378765 Reviewed-by: David Schneider <dnschneid@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Trybot-Ready: Philip Chen <philipchen@chromium.org>
-rw-r--r--board/scarlet/battery.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/board/scarlet/battery.c b/board/scarlet/battery.c
index 420d30bee1..5d66c403ca 100644
--- a/board/scarlet/battery.c
+++ b/board/scarlet/battery.c
@@ -298,25 +298,12 @@ static void pd_limit_5v(uint8_t en)
pd_set_external_voltage_limit(0, wanted_pd_voltage);
}
-/*
- * When the board is in S3/S5 and battery level > BAT_LEVEL_PD_LIMIT,
- * we limit PD voltage to 5V.
- */
+/* When battery level > BAT_LEVEL_PD_LIMIT, we limit PD voltage to 5V. */
static void board_pd_voltage(void)
{
- uint8_t pd_limit_en;
- int bat_level;
-
- bat_level = charge_get_percent();
- pd_limit_en = chipset_in_or_transitioning_to_state(
- CHIPSET_STATE_ANY_OFF | CHIPSET_STATE_ANY_SUSPEND) &&
- bat_level > BAT_LEVEL_PD_LIMIT;
-
- pd_limit_5v(pd_limit_en);
+ pd_limit_5v(charge_get_percent() > BAT_LEVEL_PD_LIMIT);
}
DECLARE_HOOK(HOOK_BATTERY_SOC_CHANGE, board_pd_voltage, HOOK_PRIO_DEFAULT);
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_pd_voltage, HOOK_PRIO_DEFAULT);
-DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_pd_voltage, HOOK_PRIO_DEFAULT);
/* Customs options controllable by host command. */
#define PARAM_FASTCHARGE (CS_PARAM_CUSTOM_PROFILE_MIN + 0)