From 59ce941927d5ccf332498e4326560e46095ca0e3 Mon Sep 17 00:00:00 2001 From: Vijay Hiremath Date: Mon, 21 Aug 2017 13:29:55 -0700 Subject: [PATCH] tcpm: Configure board specific post TCPC init Some boards have TCPC configurations post TCPC initialization. Added code to support those configurations. BUG=b:64531818 BRANCH=glkrvp TEST=Manually verified on GLKRVP. External GPIOs of PTN5110 are configured properly. Change-Id: I3da1c171839f22cf183dacf390cf033becddce0f Signed-off-by: Vijay Hiremath Reviewed-on: https://chromium-review.googlesource.com/624557 Commit-Ready: Vijay P Hiremath Tested-by: Vijay P Hiremath Reviewed-by: Shawn N --- driver/tcpm/tcpm.h | 12 +++++++++++- include/usb_pd_tcpm.h | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/driver/tcpm/tcpm.h b/driver/tcpm/tcpm.h index b2d8aef2ea..34f1138c57 100644 --- a/driver/tcpm/tcpm.h +++ b/driver/tcpm/tcpm.h @@ -72,7 +72,17 @@ static inline void tcpc_lock(int port, int lock) /* TCPM driver wrapper function */ static inline int tcpm_init(int port) { - return tcpc_config[port].drv->init(port); + int rv; + + rv = tcpc_config[port].drv->init(port); + if (rv) + return rv; + + /* Board specific post TCPC init */ + if (board_tcpc_post_init) + rv = board_tcpc_post_init(port); + + return rv; } static inline int tcpm_release(int port) diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h index edcd3f5875..d8ad743caa 100644 --- a/include/usb_pd_tcpm.h +++ b/include/usb_pd_tcpm.h @@ -273,4 +273,13 @@ void tcpc_alert_clear(int port); */ int tcpc_run(int port, int evt); +/** + * Initialize board specific TCPC functions post TCPC initialization. + * + * @param port Type-C port number + * + * @return EC_SUCCESS or error + */ +int board_tcpc_post_init(int port) __attribute__((weak)); + #endif /* __CROS_EC_USB_PD_TCPM_H */