TCPMv2: Enable AutoDischargeDisconnect in Attached.SRC during PR_Swap Previously, ADD was intentionally kept disabled during PR_Swap and only re-enabled after tc_pr_swap_complete(). However, this caused the TCPC do not entering in Attached.SRC state, causing VBUS timing issues. Fix this by enabling ADD in tc_attached_src_entry state even during PR_Swap, ensuring the TCPC enters Attached.SRC state without delay. This change resolves VBUS timing issues observed during PR_Swap and improves PD compliance testing. BUG=b:469587422, b:469585879, b:469640239, b:469642332 TEST=PS.SNK.3, PS.SNK.2, PROT.SRC.9, PROT.SNK.13 Change-Id: I5ff233e447e42238a0b3830f08896a4a5c8edc2e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/7700592 Auto-Submit: Harikrishna M <harikrishna.m@7rays.corp-partner.google.com> Commit-Queue: Edward Dai <edwarddai@chromium.org> Tested-by: Harikrishna M <harikrishna.m@7rays.corp-partner.google.com> Reviewed-by: Pranava Y N <pranavayn@google.com> Reviewed-by: Edward Dai <edwarddai@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c index 92ddc4b..c30ec32 100644 --- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c +++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -3142,11 +3142,15 @@ /* Apply Rp */ typec_update_cc(port); + /* Attached.SRC - enable AutoDischargeDisconnect + * TODO(b:469587422): Remove the logic to enable Auto + * Discharge Disconnect in tc_pr_swap_complete. That's + * too late for a sink-to-source PRS. */ + tcpm_enable_auto_discharge_disconnect(port, 1); + /* * Maintain VCONN supply state, whether ON or OFF, and - * its data role / usb mux connections. Do not - * re-enable AutoDischargeDisconnect until the swap is - * completed and tc_pr_swap_complete is called. + * its data role / usb mux connections. */ } else { /*