summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2018-01-08 16:18:13 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-01-18 17:40:28 -0800
commit9e71ed4b4de20b375e49b5d6c427c38af022893a (patch)
treeb0ae5f58c17752f96c823d5476d511611792004e
parentf8825cef150365a70e49464089f0133a418a9c9f (diff)
downloadchrome-ec-9e71ed4b4de20b375e49b5d6c427c38af022893a.tar.gz
charge_state_v2: Wake charger task when we start/stop providing power
BRANCH=none BUG=b:65697962 TEST=On wand, battery information is quickly updated after (un)pluging AC on lid (otherwise we might have to wait up to 60 seconds). Change-Id: I2bd457ba4d38aa4c99638a2576a4132406416de2 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/859401 Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--common/charge_state_v2.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 75c25d072d..7774978cd0 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -1319,6 +1319,11 @@ int charge_set_output_current_limit(int ma, int mv)
if (ret != EC_SUCCESS)
return ret;
+ /* If we start/stop providing power, wake the charger task. */
+ if ((curr.output_current == 0 && enable) ||
+ (curr.output_current > 0 && !enable))
+ task_wake(TASK_ID_CHARGER);
+
curr.output_current = ma;
return EC_SUCCESS;