diff options
author | Furquan Shaikh <furquan@google.com> | 2020-06-11 15:17:46 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-12 20:29:53 +0000 |
commit | c8e36edc96360458dd29919e88a85a6749f1740b (patch) | |
tree | 5eb33a81b740b35483754575aff4a6d107ed70d8 /board/samus | |
parent | dac0ef5c373bbe418ab9d9ccbf0f12a901077b1a (diff) | |
download | chrome-ec-c8e36edc96360458dd29919e88a85a6749f1740b.tar.gz |
extpower: Add helper function extpower_handle_update
This change adds a helper function extpower_handle_update() that
performs all the necessary actions that need to be done on external
power state change:
1. Call hook_notify with AC_CHANGE
2. Update memmap_batt_flags to update EC_BATT_FLAG_AC_PRESENT
3. Set host event for EC_HOST_EVENT_AC_CONNECTED or
EC_HOST_EVENT_AC_DISCONNECTED.
Step#2 above is important because it ensures that the memory map flag
is correctly updated when host reads it. Before this change, it was
observed that EC_BATT_FLAG_AC_PRESENT is updated only when
static/dynamic battery information gets updated. This could result in
host reading the wrong AC state if battery information did not update
before host acts on the host event bit getting set for AC
connect/disconnect.
BUG=b:157752693
BRANCH=None
TEST=Verified on trembyle that EC ASL routines read the correct state
of AC present flag on receiving host event.
Signed-off-by: Furquan Shaikh <furquan@google.com>
Change-Id: I077de1135320654f571e5cf87ced6f08cbf23876
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2242353
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Auto-Submit: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'board/samus')
-rw-r--r-- | board/samus/extpower.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/board/samus/extpower.c b/board/samus/extpower.c index 22cd13b44d..c6a7424fca 100644 --- a/board/samus/extpower.c +++ b/board/samus/extpower.c @@ -412,15 +412,7 @@ void extpower_task(void) extpower_board_hacks(extpower, extpower_prev); extpower_prev = extpower; - hook_notify(HOOK_AC_CHANGE); - - /* Forward notification to host */ - if (extpower) - host_set_single_event( - EC_HOST_EVENT_AC_CONNECTED); - else - host_set_single_event( - EC_HOST_EVENT_AC_DISCONNECTED); + extpower_handle_update(extpower); } } } |