summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-09-11 15:19:22 -0600
committerCommit Bot <commit-bot@chromium.org>2020-09-15 17:51:00 +0000
commit62a164a4c53368fd36faa596e8fcc3a90a6f9ffa (patch)
tree45e6bc857ab258a676faa1ccf675ca3ee4c349c8
parent73430b61121309fbc783a725650cd6c6e77467ea (diff)
downloadchrome-ec-62a164a4c53368fd36faa596e8fcc3a90a6f9ffa.tar.gz
USB-C: Make Vbus check overridable
Boards may have capacity to detect vSafe0V outside the TCPCI driver. Make the Vbus level check overridable so boards may define their own. BRANCH=None BUG=b:167666781,b:160996247 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I7b8c582a3efdf1d338fc335b9798edc85b5f62a8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2406340 Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--common/usb_common.c9
-rw-r--r--include/usb_pd.h5
2 files changed, 12 insertions, 2 deletions
diff --git a/common/usb_common.c b/common/usb_common.c
index 8299b6829b..a64999aad9 100644
--- a/common/usb_common.c
+++ b/common/usb_common.c
@@ -760,7 +760,14 @@ void pd_deferred_resume(int port)
}
#endif /* CONFIG_USB_PD_TCPM_TCPCI */
-bool pd_check_vbus_level(int port, enum vbus_level level)
+
+/*
+ * Check the specified Vbus level
+ *
+ * Note that boards may override this function if they have a method outside the
+ * TCPCI driver to verify vSafe0V.
+ */
+__overridable bool pd_check_vbus_level(int port, enum vbus_level level)
{
if (IS_ENABLED(CONFIG_USB_PD_VBUS_DETECT_TCPC))
return tcpm_check_vbus_level(port, level);
diff --git a/include/usb_pd.h b/include/usb_pd.h
index e013779106..61096c1180 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -2679,10 +2679,13 @@ bool pd_is_disconnected(int port);
/**
* Return true if vbus is at level on the specified port.
*
+ * Note that boards may override this function if they have a method outside the
+ * TCPCI driver to verify vSafe0V
+ *
* @param port USB-C port number
* @param level vbus_level to check against
*/
-bool pd_check_vbus_level(int port, enum vbus_level level);
+__override_proto bool pd_check_vbus_level(int port, enum vbus_level level);
/**
* Return true if vbus is at Safe5V on the specified port.