summaryrefslogtreecommitdiff
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
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>
-rw-r--r--include/driver/tcpm/tcpm.h15
-rw-r--r--include/usb_pd_tcpm.h2
2 files changed, 10 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);
}
diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h
index 6fe8336123..13d1fbbcb5 100644
--- a/include/usb_pd_tcpm.h
+++ b/include/usb_pd_tcpm.h
@@ -487,6 +487,7 @@ struct tcpm_drv {
* Bit 4 --> Set to 1 if TCPC is using TCPCI Revision 2.0 but does not support
* the vSafe0V bit in the EXTENDED_STATUS_REGISTER
* Bit 5 --> Set to 1 to prevent TCPC setting debug accessory control
+ * Bit 6 --> TCPC controls VCONN (even when CONFIG_USB_PD_TCPC_VCONN is off)
*/
#define TCPC_FLAGS_ALERT_ACTIVE_HIGH BIT(0)
#define TCPC_FLAGS_ALERT_OD BIT(1)
@@ -494,6 +495,7 @@ struct tcpm_drv {
#define TCPC_FLAGS_TCPCI_REV2_0 BIT(3)
#define TCPC_FLAGS_TCPCI_REV2_0_NO_VSAFE0V BIT(4)
#define TCPC_FLAGS_NO_DEBUG_ACC_CONTROL BIT(5)
+#define TCPC_FLAGS_CONTROL_VCONN BIT(6)
struct tcpc_config_t {
enum ec_bus_type bus_type; /* enum ec_bus_type */