Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb: typec: tcpm: Complete discovery when the partner lacks SVDM support
@ 2026-11-02 14:04 Alexey Charkov
  2026-11-02 14:18 ` sashiko-bot
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Charkov @ 2026-11-02 14:04 UTC (permalink / raw)
  To: Badhri Jagan Sridharan, Heikki Krogerus, Greg Kroah-Hartman
  Cc: Sebastian Reichel, linux-usb, linux-kernel, Alexey Charkov

A PD 3.0 port that does not support Structured VDMs answers Discover
Identity with Not_Supported, as TCPM itself does when no sink-vdos are
configured. TCPM treats a NAK to Discover Identity or Discover SVIDs as
the end of discovery, but on Not_Supported it only ends the VDM exchange
and leaves discovery pending. Every pass through the ready state then
restarts it, and the state machine passes through it after each reply
it sends.

Two such ports therefore keep each other busy: each answers the other's
Discover Identity with Not_Supported, which restarts its own discovery,
which draws a Not_Supported in turn. Two RK3576 boards connected to each
other exchange about 25 Discover Identity requests per second each way,
indefinitely, crowding out other PD traffic.

Mark discovery complete when the partner answers Discover Identity or
Discover SVIDs with Not_Supported, as on a NAK. Leave a Not_Supported
from the cable plug alone, so that it cannot cut short discovery of the
partner.

Signed-off-by: Alexey Charkov <alchark@flipper.net>
---
 drivers/usb/typec/tcpm/tcpm.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index d721baef5210..e21fe544b2d4 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -3908,6 +3908,17 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port,
 		case SNK_READY:
 			if (port->vdm_state > VDM_STATE_READY) {
 				port->vdm_state = VDM_STATE_DONE;
+				/*
+				 * A partner without Structured VDM support answers
+				 * discovery with Not_Supported: there is nothing left
+				 * to discover, just as after a NAK.
+				 */
+				if (type == PD_CTRL_NOT_SUPP &&
+				    rx_sop_type == TCPC_TX_SOP &&
+				    (port->ams == DISCOVER_IDENTITY ||
+				     port->ams == DISCOVER_SVIDS))
+					tcpm_update_vdm_discovery_state(port,
+									VDM_DISCOVERY_COMPLETE);
 				if (tcpm_vdm_ams(port))
 					tcpm_ams_finish(port);
 				mod_vdm_delayed_work(port, 0);

---
base-commit: 7649ba73f9e7e1e04d0b46213e39c79ae09dd55c
change-id: 20261102-tcpm-discovery-no-svdm-b8aa1f5768dd

Best regards,
--  
Alexey Charkov <alchark@flipper.net>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-02 15:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-02 14:04 [PATCH] usb: typec: tcpm: Complete discovery when the partner lacks SVDM support Alexey Charkov
2026-11-02 14:18 ` sashiko-bot
2026-11-02 15:53   ` Alexey Charkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox