diff options
author | Diana Z <dzigterman@chromium.org> | 2021-02-09 14:59:48 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-10 00:04:31 +0000 |
commit | ed048ab342d0ac52e2c0855eb043b25db52cc54f (patch) | |
tree | f4abd83da15a519224d0d0a9f57d181d2bc6f88b /common/charge_state_v2.c | |
parent | 127c005ec700af12cfae91248bb3ed437c45898c (diff) | |
download | chrome-ec-ed048ab342d0ac52e2c0855eb043b25db52cc54f.tar.gz |
Charge_state_v2: Report discharge when no active charger is present
For the purpose of LED display, report discharge any time there is no
active charge port present. This may occur in situations where a source
is connected in S5 which we will not charge from (ex. a phone). The
charge_state_v2 code will consider the state to be charging in these
scenarios, since a Vbus supply is present.
BRANCH=None
BUG=b:174726240
TEST=on galith, shut down with phone attached and note that the charging
LED does not turn on. Attach a charger and verify LED does turn on.
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: I80ce46ae009250eddf3b83398a1e12822d3c5f3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2685476
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common/charge_state_v2.c')
-rw-r--r-- | common/charge_state_v2.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c index 29826e8796..8d256a3cb2 100644 --- a/common/charge_state_v2.c +++ b/common/charge_state_v2.c @@ -2351,7 +2351,10 @@ enum charge_state charge_get_state(void) return PWR_STATE_DISCHARGE; case ST_CHARGE: /* The only difference here is what the LEDs display. */ - if (battery_near_full()) + if (IS_ENABLED(CONFIG_CHARGE_MANAGER) && + charge_manager_get_active_charge_port() == CHARGE_PORT_NONE) + return PWR_STATE_DISCHARGE; + else if (battery_near_full()) return PWR_STATE_CHARGE_NEAR_FULL; else return PWR_STATE_CHARGE; |