summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongBeum.Ha <ybha@samsung.corp-partner.google.com>2021-04-21 17:38:18 +0900
committerCommit Bot <commit-bot@chromium.org>2021-04-22 19:02:28 +0000
commitcb827da14fc71000085c2afe17ac16a90ae31dac (patch)
treee032274e89221690d2231bb3f3678d98169f1b5d
parentdfd6ea85f7837dbffbf3826364c438caba9e9d9e (diff)
downloadchrome-ec-cb827da14fc71000085c2afe17ac16a90ae31dac.tar.gz
sasuke : fix bug during faft_pd
Some items in faft_pd is failed because of WA for S0iX power consumption. WA is fixed, based on CL:2773218 BUG=b:186022475 BRANCH=none TEST=make -j BOARD=sasuke & run faft_pd Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Change-Id: I9fe8a14c6e071f12d13012ec7809dad4d20e3192 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2842715 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--board/sasuke/battery.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/board/sasuke/battery.c b/board/sasuke/battery.c
index d560a2d894..ad7ea9c2fe 100644
--- a/board/sasuke/battery.c
+++ b/board/sasuke/battery.c
@@ -144,21 +144,29 @@ enum ec_status charger_profile_override_set_param(uint32_t param,
}
/* Lower our input voltage to 5V in S0iX when battery is full. */
+#define PD_VOLTAGE_WHEN_FULL 5000
static void reduce_input_voltage_when_full(void)
{
- int max_pd_voltage_mv;
- int port;
+ static int saved_input_voltage = -1;
+ int max_pd_voltage_mv = pd_get_max_voltage();
+ int port;
- if (charge_get_percent() == 100 &&
- chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
- max_pd_voltage_mv = 5000;
- else
- max_pd_voltage_mv = PD_MAX_VOLTAGE_MV;
+ if (charge_get_percent() == 100 &&
+ chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) {
+ if (max_pd_voltage_mv != PD_VOLTAGE_WHEN_FULL) {
+ saved_input_voltage = max_pd_voltage_mv;
+ max_pd_voltage_mv = PD_VOLTAGE_WHEN_FULL;
+ }
+ } else if (saved_input_voltage != -1) {
+ if (max_pd_voltage_mv == PD_VOLTAGE_WHEN_FULL)
+ max_pd_voltage_mv = saved_input_voltage;
+ saved_input_voltage = -1;
+ }
- if (pd_get_max_voltage() != max_pd_voltage_mv) {
- for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++)
- pd_set_external_voltage_limit(port, max_pd_voltage_mv);
- }
+ if (pd_get_max_voltage() != max_pd_voltage_mv) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++)
+ pd_set_external_voltage_limit(port, max_pd_voltage_mv);
+ }
}
DECLARE_HOOK(HOOK_SECOND, reduce_input_voltage_when_full,
HOOK_PRIO_DEFAULT);