summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2022-01-14 14:22:12 +0800
committerCommit Bot <commit-bot@chromium.org>2022-01-19 06:38:17 +0000
commitfd8210fd57184db0f496a89ea83e4525dabbc644 (patch)
treeb2ad840facfc95ba22fbf53c7cf15112659821c5
parentc836b762e935c9a531a8ff2059489d9a92c79242 (diff)
downloadchrome-ec-fd8210fd57184db0f496a89ea83e4525dabbc644.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>
-rw-r--r--driver/tcpm/rt1718s.c19
-rw-r--r--driver/tcpm/rt1718s.h9
2 files changed, 27 insertions, 1 deletions
diff --git a/driver/tcpm/rt1718s.c b/driver/tcpm/rt1718s.c
index 81356c946c..82f9fc67b3 100644
--- a/driver/tcpm/rt1718s.c
+++ b/driver/tcpm/rt1718s.c
@@ -405,6 +405,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;
@@ -584,7 +601,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 2e74132847..791398db5c 100644
--- a/driver/tcpm/rt1718s.h
+++ b/driver/tcpm/rt1718s.h
@@ -269,4 +269,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 */