diff options
author | Eric Yilun Lin <yllin@chromium.org> | 2020-07-21 15:35:32 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-22 10:05:49 +0000 |
commit | e19d7f2b47cc62245114ba26da36d753d48714bd (patch) | |
tree | fc945fbd00152e2812c80d29c67cddf6cd6bfd3c /baseboard | |
parent | f06d92218d6c44d8d97ad0600baccc33cb785ff5 (diff) | |
download | chrome-ec-e19d7f2b47cc62245114ba26da36d753d48714bd.tar.gz |
baseboard/kukui: check stable_current by the timestamp
We should check the stable_current by the timestamp
rather than the inited value or not (i.e.
CHARGE_CURRENT_UNINITIALIZED). This is because
the stable_current might be modified to a previous measured
value to let the PDO selection pick the correct PDO by power
consumed. e.g.
1. Pick 9V PDO, set stable timestamp expired for 5 mins,
rewrite stable_current to CHARGE_CURRENT_UNINITIALIZED
2. At next iteration, if we only check stable_current, we
would try to pick a new PDO again, but however, the timestamp
is not expired yet.
BUG=b:160448099
TEST=ensure kakadu charging won't switch back to 5V immediately
after just picking 9V charging
BRANCH=kukui
Change-Id: I2bfd49a9e8fc5c6d5f4b84eb7da4262d2938f7a6
Signed-off-by: Eric Yilun Lin <yllin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2309524
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'baseboard')
-rw-r--r-- | baseboard/kukui/charger_mt6370.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/baseboard/kukui/charger_mt6370.c b/baseboard/kukui/charger_mt6370.c index 49e815c613..5e78a100c5 100644 --- a/baseboard/kukui/charger_mt6370.c +++ b/baseboard/kukui/charger_mt6370.c @@ -205,7 +205,7 @@ static void battery_desired_curr_dynamic(struct charge_state_data *curr) supply_voltage = charge_manager_get_charger_voltage(); stable_current = charge_get_stable_current(); - if (stable_current == CHARGE_CURRENT_UNINITIALIZED) + if (!charge_is_current_stable()) return; if (!prev_supply_voltage) |