Skip to contentSkip to conversation

usb: typec: tcpm: Do not finish VDM AMS for retrying Responses

PATCH In review Kyle Tso 3 participants 3 messages Jun 6, 2021 – Jun 7, 2021

Subsystems (3)
lore
Share & tools
lore

Kyle Tso

author
#0 lore raw

PATCH 1/1 usb: typec: tcpm: Do not finish VDM AMS for retrying Responses

If the VDM responses couldn't be sent successfully, it doesn't need to finish the AMS until the retry count reaches the limit.

Fixes 0908c5aca31e ("usb: typec: tcpm: AMS and Collision Avoidance")
---
 drivers/usb/typec/tcpm/tcpm.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/usb/typec/tcpm/tcpm.c +3 -0
index 0db685d5d9c0..08fabe1fc31d 100644
@@ -1965,6 +1965,9 @@ static void vdm_run_state_machine(struct tcpm_port *port)
 			tcpm_log(port, "VDM Tx error, retry");
 			port->vdm_retries++;
 			port->vdm_state = VDM_STATE_READY;
+			if (PD_VDO_SVDM(vdo_hdr) && PD_VDO_CMDT(vdo_hdr) == CMDT_INIT)
+				tcpm_ams_finish(port);
+		} else {
 			tcpm_ams_finish(port);
 		}
 		break;
Signature · 1 line
2.32.0.rc1.229.g3e70b5a671-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Kyle Tso

If the VDM responses couldn't be sent successfully, it doesn't need to finish the AMS until the retry count reaches the limit.

Fixes 0908c5aca31e ("usb: typec: tcpm: AMS and Collision Avoidance")
Quoted 21 lines
---
 drivers/usb/typec/tcpm/tcpm.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/usb/typec/tcpm/tcpm.c +3 -0
index 0db685d5d9c0..08fabe1fc31d 100644
@@ -1965,6 +1965,9 @@ static void vdm_run_state_machine(struct tcpm_port *port)
 			tcpm_log(port, "VDM Tx error, retry");
 			port->vdm_retries++;
 			port->vdm_state = VDM_STATE_READY;
+			if (PD_VDO_SVDM(vdo_hdr) && PD_VDO_CMDT(vdo_hdr) == CMDT_INIT)
+				tcpm_ams_finish(port);
+		} else {
 			tcpm_ams_finish(port);
 		}
 		break;
Signature · 1 line
2.32.0.rc1.229.g3e70b5a671-goog
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Kyle Tso
Quoted 5 lines · Kyle Tso

If the VDM responses couldn't be sent successfully, it doesn't need to finish the AMS until the retry count reaches the limit.

Fixes 0908c5aca31e ("usb: typec: tcpm: AMS and Collision Avoidance")
Quoted 20 lines
---
 drivers/usb/typec/tcpm/tcpm.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/usb/typec/tcpm/tcpm.c +3 -0
index 0db685d5d9c0..08fabe1fc31d 100644
@@ -1965,6 +1965,9 @@ static void vdm_run_state_machine(struct tcpm_port *port)
 			tcpm_log(port, "VDM Tx error, retry");
 			port->vdm_retries++;
 			port->vdm_state = VDM_STATE_READY;
+			if (PD_VDO_SVDM(vdo_hdr) && PD_VDO_CMDT(vdo_hdr) == CMDT_INIT)
+				tcpm_ams_finish(port);
+		} else {
 			tcpm_ams_finish(port);
 		}
 		break;
Signature · 1 line
2.32.0.rc1.229.g3e70b5a671-goog
Signature · 1 line
heikki