summaryrefslogtreecommitdiff
path: root/include/usb_pd.h
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2021-02-17 02:46:43 -0800
committerCommit Bot <commit-bot@chromium.org>2021-02-24 23:52:43 +0000
commit38c6a96e4470b3a6afb276a862ec77c0265f5a40 (patch)
tree41d2b41e75cff2369bd8b791729db045c031e2d2 /include/usb_pd.h
parent7a401a50478315bc37d84124f01b86b60fe8db22 (diff)
downloadchrome-ec-38c6a96e4470b3a6afb276a862ec77c0265f5a40.tar.gz
common: Add board_is_usb_pd_port_present function
This adds a new overridable function to check if a USB PD port exists on a system. This is preferred over using board_get_usb_pd_port_count() or CONFIG_USB_PD_PORT_MAX_COUNT because it handles sparse port numbering. The "missing" port no longer needs to be the highest numbered port and call sites no longer need to implement the special checks for this case. BRANCH=none BUG=b:173575131 TEST=buildall passes Change-Id: I3f74eddd99c6901b42ce05bab6f2bdd545127d1a Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2700313 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'include/usb_pd.h')
-rw-r--r--include/usb_pd.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/usb_pd.h b/include/usb_pd.h
index a31fefbc3d..71d2449753 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -2899,6 +2899,15 @@ __override_proto uint8_t get_dp_pin_mode(int port);
*/
__override_proto uint8_t board_get_usb_pd_port_count(void);
+/**
+ * Return true if specified PD port is present. This is similar to
+ * checking CONFIG_USB_PD_PORT_MAX_COUNT but handles sparse numbering.
+ *
+ * @param port USB-C port number
+ *
+ * @return true if port is present.
+ */
+__override_proto bool board_is_usb_pd_port_present(int port);
/**
* Resets external PD chips including TCPCs and MCUs.