summaryrefslogtreecommitdiff
path: root/include/charge_manager.h
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-08-14 15:28:20 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-08-19 01:50:21 +0000
commit4d382ad6401cbe178fa9c53309bdc8a460cf3413 (patch)
tree30822cab382bbba385db6a1891d5df3daa060613 /include/charge_manager.h
parentaa14b36f1890e373424463afc584659b2834dce6 (diff)
downloadchrome-ec-4d382ad6401cbe178fa9c53309bdc8a460cf3413.tar.gz
charge_manager: Support multiple independent charge ceilings
We will soon have a need to independently set a charge ceiling from both the PD state machine and from incoming host commands. Store these ceilings separately, and have the minimum take effect. BUG=chrome-os-partner:43285 TEST=Pass unit tests. Also, host command current limit takes effect with subsequent commit. BRANCH=None Change-Id: I0ecfe888a7df0d5da5a68999c164c7c841da348b Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/293818 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'include/charge_manager.h')
-rw-r--r--include/charge_manager.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/include/charge_manager.h b/include/charge_manager.h
index 8758c3a19c..6cfd6cc7ce 100644
--- a/include/charge_manager.h
+++ b/include/charge_manager.h
@@ -51,8 +51,21 @@ enum dualrole_capabilities {
/* Called by charging tasks to indicate partner dualrole capability change */
void charge_manager_update_dualrole(int port, enum dualrole_capabilities cap);
-/* Update charge ceiling for a given port */
-void charge_manager_set_ceil(int port, int ceil);
+/*
+ * Charge ceiling can be set independently by different tasks / functions,
+ * for different purposes.
+ */
+enum ceil_requestor {
+ /* Set by PD task, during negotiation */
+ CEIL_REQUESTOR_PD,
+ /* Set by host commands */
+ CEIL_REQUESTOR_HOST,
+ /* Number of ceiling groups */
+ CEIL_REQUESTOR_COUNT,
+};
+
+/* Update charge ceiling for a given port / requestor */
+void charge_manager_set_ceil(int port, enum ceil_requestor requestor, int ceil);
/* Select an 'override port', which is always the preferred charge port */
int charge_manager_set_override(int port);