diff options
author | Marc Zyngier <maz@kernel.org> | 2023-05-13 15:46:19 +0100 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2023-05-13 15:46:19 +0100 |
commit | 975f74e13cfcb1c5c6bae08f61919807938bd5be (patch) | |
tree | e979921b84577a0de56829ab4d5e953819486b75 | |
parent | ddea7a17b7609fe26ebf168fa60c83ca87f7b125 (diff) | |
download | cs-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.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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 |