Skip to contentSkip to conversation

usb: typec: tcpm: set SRC_SEND_CAPABILITIES timeout to PD_T_SENDER_RESPONSE

PATCH In review joswang 3 participants 4 messages Jan 5, 2025 – Jan 16, 2025

Subsystems (4)
lore
Share & tools
lore

joswang

author
#0 lore raw

PATCH 1/1 usb: typec: tcpm: set SRC_SEND_CAPABILITIES timeout to PD_T_SENDER_RESPONSE

From: Jos Wang <[email protected]>

As PD2.0 spec ("8.3.3.2.3 PE_SRC_Send_Capabilities state"), after the Source receives the GoodCRC Message from the Sink in response to the Source_Capabilities message, it should start the SenderResponseTimer, after the timer times out, the state machine transitions to the HARD_RESET state.

Fixes f0690a25a140 ("staging: typec: USB Type-C Port Manager (tcpm)")
---
 drivers/usb/typec/tcpm/tcpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/typec/tcpm/tcpm.c +1 -1
index 460dbde9fe22..57fae1118ac9 100644
@@ -4821,7 +4821,7 @@ static void run_state_machine(struct tcpm_port *port)
 			port->caps_count = 0;
 			port->pd_capable = true;
 			tcpm_set_state_cond(port, SRC_SEND_CAPABILITIES_TIMEOUT,
-					    PD_T_SEND_SOURCE_CAP);
+					    PD_T_SENDER_RESPONSE);
 		}
 		break;
 	case SRC_SEND_CAPABILITIES_TIMEOUT:
Signature · 1 line
2.17.1
maintainer
#1 lore raw

+Badhri

Quoted 20 lines · joswang

From: Jos Wang <[email protected]>

As PD2.0 spec ("8.3.3.2.3 PE_SRC_Send_Capabilities state"), after the Source receives the GoodCRC Message from the Sink in response to the Source_Capabilities message, it should start the SenderResponseTimer, after the timer times out, the state machine transitions to the HARD_RESET state.

Fixes f0690a25a140 ("staging: typec: USB Type-C Port Manager (tcpm)")
---
 drivers/usb/typec/tcpm/tcpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/typec/tcpm/tcpm.c +0 -0
index 460dbde9fe22..57fae1118ac9 100644

drivers/usb/typec/tcpm/tcpm.c static void run_state_machine(struct tcpm_port *port) · line 4827

Quoted 8 lines
drivers/usb/typec/tcpm/tcpm.c +1 -1
@@ -4821,7 +4821,7 @@ static void run_state_machine(struct tcpm_port *port)
 			port->caps_count = 0;
 			port->pd_capable = true;
 			tcpm_set_state_cond(port, SRC_SEND_CAPABILITIES_TIMEOUT,
-					    PD_T_SEND_SOURCE_CAP);
+					    PD_T_SENDER_RESPONSE);
 		}
 		break;
 	case SRC_SEND_CAPABILITIES_TIMEOUT:

This looks okay to me, but let's get comments from Badhri, just in case.

thanks,

Signature · 1 line
heikki
maintainer Reviewed-by
#2 lore raw
Quoted 15 lines · Heikki Krogerus

+Badhri

Quoted 11 lines · joswang

From: Jos Wang <[email protected]>

As PD2.0 spec ("8.3.3.2.3 PE_SRC_Send_Capabilities state"), after the Source receives the GoodCRC Message from the Sink in response to the Source_Capabilities message, it should start the SenderResponseTimer, after the timer times out, the state machine transitions to the HARD_RESET state.

Fixes f0690a25a140 ("staging: typec: USB Type-C Port Manager (tcpm)")
Quoted 4 lines
Quoted 4 lines
---
 drivers/usb/typec/tcpm/tcpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 10 lines

drivers/usb/typec/tcpm/tcpm.c static void run_state_machine(struct tcpm_port *port) · line 4824

Quoted 10 lines
drivers/usb/typec/tcpm/tcpm.c +1 -1
index 460dbde9fe22..57fae1118ac9 100644
@@ -4821,7 +4821,7 @@ static void run_state_machine(struct tcpm_port *port)
                      port->caps_count = 0;
                      port->pd_capable = true;
                      tcpm_set_state_cond(port, SRC_SEND_CAPABILITIES_TIMEOUT,
-                                         PD_T_SEND_SOURCE_CAP);
+                                         PD_T_SENDER_RESPONSE);

This aligns with what the spec says as Jos Wang has already mentioned. However, itdoes reduce the time within which the sink has to reply back with the request message. So if there are non-compliant sinks, which we don't know of yet, we would know now and we can later see how we can handle the interoperability.

Regards,
Badhri

Quoted 11 lines

drivers/usb/typec/tcpm/tcpm.c static void run_state_machine(struct tcpm_port *port) · line 4827

Quoted 3 lines
drivers/usb/typec/tcpm/tcpm.c +0 -0
              }
              break;
      case SRC_SEND_CAPABILITIES_TIMEOUT:

This looks okay to me, but let's get comments from Badhri, just in case.

thanks,

--
heikki

maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to joswang
Quoted 11 lines · joswang

From: Jos Wang <[email protected]>

As PD2.0 spec ("8.3.3.2.3 PE_SRC_Send_Capabilities state"), after the Source receives the GoodCRC Message from the Sink in response to the Source_Capabilities message, it should start the SenderResponseTimer, after the timer times out, the state machine transitions to the HARD_RESET state.

Fixes f0690a25a140 ("staging: typec: USB Type-C Port Manager (tcpm)")
Quoted 19 lines
---
 drivers/usb/typec/tcpm/tcpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/typec/tcpm/tcpm.c +1 -1
index 460dbde9fe22..57fae1118ac9 100644
@@ -4821,7 +4821,7 @@ static void run_state_machine(struct tcpm_port *port)
 			port->caps_count = 0;
 			port->pd_capable = true;
 			tcpm_set_state_cond(port, SRC_SEND_CAPABILITIES_TIMEOUT,
-					    PD_T_SEND_SOURCE_CAP);
+					    PD_T_SENDER_RESPONSE);
 		}
 		break;
 	case SRC_SEND_CAPABILITIES_TIMEOUT:
Signature · 1 line
2.17.1
Signature · 1 line
heikki