summaryrefslogtreecommitdiff
path: root/common/charge_state_v2.c
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2014-09-29 07:11:13 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-09-30 01:53:41 +0000
commitfa4407c11c1ad05c75a158fc9d69bc66c5a590d7 (patch)
treed6292ee6b03b5b2f08cb23764b3cb52b9831d5bf /common/charge_state_v2.c
parenta451aa850b72863d5a4fc0a0884bfb12780b2f32 (diff)
downloadchrome-ec-fa4407c11c1ad05c75a158fc9d69bc66c5a590d7.tar.gz
charge_state_v2: Send host event if charge state changes
If there is any delay between AC status and the battery charge status it is possible for the power_manager to read the battery state when the AC status event is sent and still see that the battery is not yet charging. This can cause lag in the UI battery icon because the AP is not notified when the battery charge state changes. In order for the host to be able to differentiate the dynamic battery state changing (re-read ACPI _BST by sending Notify 0x80) from the static battery info (re-read ACPI _BIX/_BIF by sending Notify 0x81) it needs a separate host event. BUG=chrome-os-partner:32196 BRANCH=samus TEST=Test AC instertion and removal while watching state on the host to ensure that an event is sent to the host which triggers power manager to re-read the battery status and notice that the charge state has changed if there is any delay after the AC status event: watch -n 0.1 "cat /sys/class/power_supply/AC/online; cat /sys/class/power_supply/BAT0/status; tail -10 /var/log/power_manager/powerd.LATEST" Change-Id: I18ce70719dc231c43c474cefad2068f949675a2b Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220257 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'common/charge_state_v2.c')
-rw-r--r--common/charge_state_v2.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 1b796c9c27..2c17a838bf 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -212,6 +212,9 @@ static void update_dynamic_battery_info(void)
break;
}
+ /* Tell the AP to re-read battery status if charge state changes */
+ if (*memmap_flags != tmp)
+ host_set_single_event(EC_HOST_EVENT_BATTERY_STATUS);
*memmap_flags = tmp;
/* Poke the AP if the full_capacity changes. */