diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2017-12-26 18:25:15 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-12-27 13:18:41 -0800 |
commit | 1c87ad4153488512792e6b7898408126111727cf (patch) | |
tree | 75b167c112a9011a1533ece7bf5296c9c193fc8f /common | |
parent | 90d735c3c326b6efe4239eebead4c08fe3ce69ec (diff) | |
download | chrome-ec-1c87ad4153488512792e6b7898408126111727cf.tar.gz |
charger: Use shorter poll timeouts when on-ac
If AC is present but we're not charging yet, it's very possible this
status is transient (eg. due to cut-off battery, brief spike in current
useage, etc), so don't use very long task timeout.
BUG=b:70554834
BRANCH=None
TEST=Verify soraka doesn't take over a minute to boot when exiting from
ship mode.
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I9dbfd8cb7dfc54cb8017bb0c7d633c5d64a15025
Diffstat (limited to 'common')
-rw-r--r-- | common/charge_state_v2.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c index 9b1573c59a..7236f34009 100644 --- a/common/charge_state_v2.c +++ b/common/charge_state_v2.c @@ -1089,8 +1089,9 @@ wait_for_it: sleep_usec = CHARGE_POLL_PERIOD_SHORT; else if (sleep_usec <= 0) { /* default values depend on the state */ - if (curr.state == ST_IDLE || - curr.state == ST_DISCHARGE) { + if (!curr.ac && + (curr.state == ST_IDLE || + curr.state == ST_DISCHARGE)) { /* If AP is off, we can sleep a long time */ if (chipset_in_state(CHIPSET_STATE_ANY_OFF | CHIPSET_STATE_ANY_SUSPEND)) @@ -1100,7 +1101,7 @@ wait_for_it: /* Discharging, not too urgent */ sleep_usec = CHARGE_POLL_PERIOD_LONG; } else { - /* Charging, so pay closer attention */ + /* AC present, so pay closer attention */ sleep_usec = CHARGE_POLL_PERIOD_CHARGE; } } |