summaryrefslogtreecommitdiff
path: root/include/extpower.h
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2020-06-11 15:17:46 -0700
committerCommit Bot <commit-bot@chromium.org>2020-06-12 20:29:53 +0000
commitc8e36edc96360458dd29919e88a85a6749f1740b (patch)
tree5eb33a81b740b35483754575aff4a6d107ed70d8 /include/extpower.h
parentdac0ef5c373bbe418ab9d9ccbf0f12a901077b1a (diff)
downloadchrome-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 'include/extpower.h')
-rw-r--r--include/extpower.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/extpower.h b/include/extpower.h
index 2198809034..5a10898c70 100644
--- a/include/extpower.h
+++ b/include/extpower.h
@@ -22,4 +22,11 @@ int extpower_is_present(void);
*/
void extpower_interrupt(enum gpio_signal signal);
+/**
+ * Routine to trigger actions based on external power state change.
+ *
+ * @param is_present State of external power (1 = present, 0 = not present)
+ */
+void extpower_handle_update(int is_present);
+
#endif /* __CROS_EC_EXTPOWER_H */