summaryrefslogtreecommitdiff
path: root/include/usb_common.h
diff options
context:
space:
mode:
authorli feng <li1.feng@intel.com>2021-04-29 21:26:17 -0700
committerCommit Bot <commit-bot@chromium.org>2021-05-01 03:07:48 +0000
commit01ef01d06be623269cf286c580d39e1f0e3a78d4 (patch)
treec4397d9aae192186e8700be985a260c2e6db779c /include/usb_common.h
parent7b08eda737c78d7bbf7e64b27e4c2a69c46b334f (diff)
downloadchrome-ec-01ef01d06be623269cf286c580d39e1f0e3a78d4.tar.gz
tcpc: Add common routine to check power
This comment is from CL:1123314: We do not want to allow depthcharge to suspend the PD port for a firmware upgrade if there is not enough battery power to last during the full firmware upgrade. A common routine is created to check power: pd_firmware_upgrade_check_power_readiness() in usb_common.c. Firmware upgrade which needs to suspend PD port should check this function to make sure there is enough power. BUG=none BRANCH=none TEST=make -j buildall Signed-off-by: li feng <li1.feng@intel.com> Change-Id: I47910a4d82da9b569c297ad2cd399a2faf4cf98a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2862556 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'include/usb_common.h')
-rw-r--r--include/usb_common.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/usb_common.h b/include/usb_common.h
index fc385eacf8..f33ad870f7 100644
--- a/include/usb_common.h
+++ b/include/usb_common.h
@@ -81,6 +81,17 @@ int hex8tou32(char *str, uint32_t *val);
*/
int remote_flashing(int argc, char **argv);
+/*
+ * When AP requests to suspend PD traffic on the EC so it can do
+ * firmware upgrade (retimer firmware, or TCPC chips firmware),
+ * it calls this function to check if power is ready for performing
+ * the upgrade.
+ * @param port USB-C port number
+ * @dreturn true - power is ready
+ * false - power is not ready
+ */
+bool pd_firmware_upgrade_check_power_readiness(int port);
+
/* Returns the battery percentage [0-100] of the system. */
int usb_get_battery_soc(void);