summaryrefslogtreecommitdiff
path: root/include/driver
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2021-10-28 15:49:13 -0700
committerCommit Bot <commit-bot@chromium.org>2021-10-29 22:35:46 +0000
commite72577c801f4ee4c050dc7954d5e95f25f513de0 (patch)
tree2c63fbb22ad754eed89460939ecbe95e7db8e7d7 /include/driver
parent175eb7bc8f31eda0e047e4f850f258ca27c2f3e7 (diff)
downloadchrome-ec-e72577c801f4ee4c050dc7954d5e95f25f513de0.tar.gz
tcpm: Add port flag indicating if the TCPC controls VCONN
This adds a port flag to indicate that its TCPC needs to control VCONN. We have a global compile time flag (CONFIG_USB_PD_TCPC_VCONN) to enable TCPC control of VCONN. However, on some device architectures, such a global setting is not suitable for all ports in the system. So, add a port flag to enable VCONN control where it would otherwise be disabled. BRANCH=none BUG=b:204102039 TEST=with reset of patch stack, external monitor links up using active TBT4 cable Change-Id: I9028f65a8b10b2f8eb5b614a256d90e05064b4c3 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3252410 Reviewed-by: Boris Mittelberg <bmbm@google.com>
Diffstat (limited to 'include/driver')
-rw-r--r--include/driver/tcpm/tcpm.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/include/driver/tcpm/tcpm.h b/include/driver/tcpm/tcpm.h
index fb63e5504f..ef5981f1b4 100644
--- a/include/driver/tcpm/tcpm.h
+++ b/include/driver/tcpm/tcpm.h
@@ -227,13 +227,14 @@ static inline int tcpm_sop_prime_enable(int port, bool enable)
static inline int tcpm_set_vconn(int port, int enable)
{
-#ifdef CONFIG_USB_PD_TCPC_VCONN
- int rv;
-
- rv = tcpc_config[port].drv->set_vconn(port, enable);
- if (rv)
- return rv;
-#endif
+ if (IS_ENABLED(CONFIG_USB_PD_TCPC_VCONN) ||
+ tcpc_config[port].flags & TCPC_FLAGS_CONTROL_VCONN) {
+ int rv;
+
+ rv = tcpc_config[port].drv->set_vconn(port, enable);
+ if (rv)
+ return rv;
+ }
return tcpm_sop_prime_enable(port, enable);
}