* [PATCH] usb: typec: tcpm: advance vdm_discovery_state on Discover Identity Not_Supported
@ 2026-09-14 9:38 Xu Yang
2026-09-18 7:53 ` Heikki Krogerus
0 siblings, 1 reply; 2+ messages in thread
From: Xu Yang @ 2026-09-14 9:38 UTC (permalink / raw)
To: badhri, heikki.krogerus, gregkh; +Cc: linux-usb, linux-kernel, imx, jun.li
From: Xu Yang <xu.yang_2@nxp.com>
Commit fa4d0a7cd036 ("usb: typec: tcpm: fix Discover Identity retry loop
on Control Message reject") advances vdm_discovery_state to
VDM_DISCOVERY_COMPLETE when a CMDT_RSP_NAK is received, but it does not
advance the state when a non-modal port returns PD_CTRL_NOT_SUPP.
This can re-arm another vdm_discovery_work if the port is going to
respond with PD_CTRL_NOT_SUPP to the partner.
tcpm_pd_handle_msg(port, PD_MSG_CTRL_NOT_SUPP, NONE_AMS);
tcpm_queue_message();
mod_tcpm_delayed_work();
tcpm_state_machine_work()
tcpm_send_queued_message() -> send PD_MSG_CTRL_NOT_SUPP
run_state_machine()
case SRC_READY:
case SNK_READY:
mod_vdm_discovery_delayed_work(port, 0);
If both the port and its partner do not support modal operation, they
will send DISCOVER_IDENTITY to each other infinitely.
Advance vdm_discovery_state to VDM_DISCOVERY_COMPLETE in this path as
well, mirroring the existing handling for the SVDM CMDT_RSP_NAK case.
Fixes: fa4d0a7cd036 ("usb: typec: tcpm: fix Discover Identity retry loop on Control Message reject")
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
drivers/usb/typec/tcpm/tcpm.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 2d6b14aa2085..cc9ea5d5e78a 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -3891,6 +3891,9 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port,
case SRC_READY:
case SNK_READY:
if (port->vdm_state > VDM_STATE_READY) {
+ if (port->ams == DISCOVER_IDENTITY)
+ tcpm_update_vdm_discovery_state(port,
+ VDM_DISCOVERY_COMPLETE);
port->vdm_state = VDM_STATE_DONE;
if (tcpm_vdm_ams(port))
tcpm_ams_finish(port);
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: typec: tcpm: advance vdm_discovery_state on Discover Identity Not_Supported
2026-09-14 9:38 [PATCH] usb: typec: tcpm: advance vdm_discovery_state on Discover Identity Not_Supported Xu Yang
@ 2026-09-18 7:53 ` Heikki Krogerus
0 siblings, 0 replies; 2+ messages in thread
From: Heikki Krogerus @ 2026-09-18 7:53 UTC (permalink / raw)
To: Xu Yang; +Cc: badhri, gregkh, linux-usb, linux-kernel, imx, jun.li
On Mon, Sep 14, 2026 at 05:38:28PM +0800, Xu Yang wrote:
> From: Xu Yang <xu.yang_2@nxp.com>
>
> Commit fa4d0a7cd036 ("usb: typec: tcpm: fix Discover Identity retry loop
> on Control Message reject") advances vdm_discovery_state to
> VDM_DISCOVERY_COMPLETE when a CMDT_RSP_NAK is received, but it does not
> advance the state when a non-modal port returns PD_CTRL_NOT_SUPP.
>
> This can re-arm another vdm_discovery_work if the port is going to
> respond with PD_CTRL_NOT_SUPP to the partner.
>
> tcpm_pd_handle_msg(port, PD_MSG_CTRL_NOT_SUPP, NONE_AMS);
> tcpm_queue_message();
> mod_tcpm_delayed_work();
> tcpm_state_machine_work()
> tcpm_send_queued_message() -> send PD_MSG_CTRL_NOT_SUPP
> run_state_machine()
> case SRC_READY:
> case SNK_READY:
> mod_vdm_discovery_delayed_work(port, 0);
>
> If both the port and its partner do not support modal operation, they
> will send DISCOVER_IDENTITY to each other infinitely.
>
> Advance vdm_discovery_state to VDM_DISCOVERY_COMPLETE in this path as
> well, mirroring the existing handling for the SVDM CMDT_RSP_NAK case.
>
> Fixes: fa4d0a7cd036 ("usb: typec: tcpm: fix Discover Identity retry loop on Control Message reject")
I can't find that commit from anywhere?
Thanks,
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 2d6b14aa2085..cc9ea5d5e78a 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -3891,6 +3891,9 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port,
> case SRC_READY:
> case SNK_READY:
> if (port->vdm_state > VDM_STATE_READY) {
> + if (port->ams == DISCOVER_IDENTITY)
> + tcpm_update_vdm_discovery_state(port,
> + VDM_DISCOVERY_COMPLETE);
> port->vdm_state = VDM_STATE_DONE;
> if (tcpm_vdm_ams(port))
> tcpm_ams_finish(port);
> --
> 2.34.1
--
heikki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-18 7:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14 9:38 [PATCH] usb: typec: tcpm: advance vdm_discovery_state on Discover Identity Not_Supported Xu Yang
2026-09-18 7:53 ` Heikki Krogerus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®