diff options
author | Eric Yilun Lin <yllin@chromium.org> | 2022-01-14 14:22:12 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-07-06 10:36:54 +0000 |
commit | 292a7656058627fa0885a93de55cf496d78ccb8c (patch) | |
tree | e87ddc570f8ce9d68817a70f9ddf2ffa429a7c77 | |
parent | f33191eb5e59092cbf4a32a30f80fdd577139658 (diff) | |
download | chrome-ec-292a7656058627fa0885a93de55cf496d78ccb8c.tar.gz |
tcpm/rt1718s: add board hook for set_snk_ctrl()
RT1718S provides 3 GPIO for universal uses, and one of the
use is making one of the GPIO a SNK enable pin.
For such case, we add a board hook for board customization, so
the board can control the pin as their needs.
BUG=b:214146359
TEST=ensure the board hook is called
BRANCH=none
Change-Id: I15955e07bfcd192ea79ab891da58021a2ec153c6
Signed-off-by: Eric Yilun Lin <yllin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3386981
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Commit-Queue: Eric Yilun Lin <yllin@google.com>
Tested-by: Eric Yilun Lin <yllin@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3723359
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Tommy Chung <tommy.chung@quanta.corp-partner.google.com>
Auto-Submit: Tommy Chung <tommy.chung@quanta.corp-partner.google.com>
-rw-r--r-- | driver/tcpm/rt1718s.c | 19 | ||||
-rw-r--r-- | driver/tcpm/rt1718s.h | 9 |
2 files changed, 27 insertions, 1 deletions
diff --git a/driver/tcpm/rt1718s.c b/driver/tcpm/rt1718s.c index 9798f0c073..c7b8f23b5f 100644 --- a/driver/tcpm/rt1718s.c +++ b/driver/tcpm/rt1718s.c @@ -449,6 +449,23 @@ void rt1718s_vendor_defined_alert(int port) tcpc_write16(port, TCPC_REG_ALERT, TCPC_REG_ALERT_VENDOR_DEF); } +__overridable int board_rt1718s_set_snk_enable(int port, int enable) +{ + return EC_SUCCESS; +} + + +static int rt1718s_tcpm_set_snk_ctrl(int port, int enable) +{ + int rv; + + rv = board_rt1718s_set_snk_enable(port, enable); + if (rv) + return rv; + + return tcpci_tcpm_set_snk_ctrl(port, enable); +} + static void rt1718s_alert(int port) { int alert; @@ -628,7 +645,7 @@ const struct tcpm_drv rt1718s_tcpm_drv = { #endif .get_chip_info = &tcpci_get_chip_info, #ifdef CONFIG_USB_PD_PPC - .set_snk_ctrl = &tcpci_tcpm_set_snk_ctrl, + .set_snk_ctrl = &rt1718s_tcpm_set_snk_ctrl, .set_src_ctrl = &tcpci_tcpm_set_src_ctrl, #endif #ifdef CONFIG_USB_PD_TCPC_LOW_POWER diff --git a/driver/tcpm/rt1718s.h b/driver/tcpm/rt1718s.h index cf8aa8c9b0..0811dbf194 100644 --- a/driver/tcpm/rt1718s.h +++ b/driver/tcpm/rt1718s.h @@ -272,4 +272,13 @@ int rt1718s_frs_init(int port); * @return EC_SUCCESS if success, EC_ERROR_UNKNOWN otherwise. */ int rt1718s_sw_reset(int port); + +/** + * Board hook for rt1718s_set_snk_enable + * + * @param port USB-C port + * @param enable enable/disable sink + * @return EC_SUCCESS if success, EC_ERROR_UNKNOWN otherwise. + */ +__override_proto int board_rt1718s_set_snk_enable(int port, int enable); #endif /* __CROS_EC_USB_PD_TCPM_MT6370_H */ |