aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Zyngier <maz@kernel.org>2023-05-13 15:46:19 +0100
committerMarc Zyngier <maz@kernel.org>2023-05-13 15:46:19 +0100
commit975f74e13cfcb1c5c6bae08f61919807938bd5be (patch)
treee979921b84577a0de56829ab4d5e953819486b75
parentddea7a17b7609fe26ebf168fa60c83ca87f7b125 (diff)
downloadcs-sw-975f74e13cfcb1c5c6bae08f61919807938bd5be.tar.gz
Enable VCONN when the opposite CC line isn't open
On discovering an opposite CC line that isn't disconnected, apply VCONN to it. This allows the emarker to be powered. Signed-off-by: Marc Zyngier <maz@kernel.org>
-rw-r--r--vdmtool.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/vdmtool.c b/vdmtool.c
index 8bf29cd..b2463a8 100644
--- a/vdmtool.c
+++ b/vdmtool.c
@@ -104,6 +104,13 @@ static void evt_dfpconnect(struct vdm_context *cxt)
fusb302_tcpm_set_polarity(PORT(cxt), 1);
cprintf(cxt, "Polarity: CC2 (flipped)\n");
}
+
+ /* If none of the CCs are disconnected, enable VCONN */
+ if (cc1 && cc2) {
+ fusb302_tcpm_set_vconn(PORT(cxt), 1);
+ cprintf(cxt, "VCONN on CC%d\n", (cc2 < cc1) + 1);
+ }
+
fusb302_tcpm_set_rx_enable(PORT(cxt), 1);
vbus_on(cxt);
STATE(cxt, DFP_VBUS_ON);
@@ -138,6 +145,7 @@ static void evt_disconnect(struct vdm_context *cxt)
vbus_off(cxt);
cprintf(cxt, "Disconnected\n");
fusb302_pd_reset(PORT(cxt));
+ fusb302_tcpm_set_vconn(PORT(cxt), 0);
fusb302_tcpm_set_rx_enable(PORT(cxt), 0);
fusb302_tcpm_select_rp_value(PORT(cxt), TYPEC_RP_USB);
fusb302_tcpm_set_cc(PORT(cxt), TYPEC_CC_RP); // DFP mode