Devicetree
 help / color / mirror / Atom feed
* [PATCH 0/2] usb: typec: tcpm: Make tSenderResponse timer configurable
@ 2026-10-04  2:58 Amit Sunil Dhamne via B4 Relay
  2026-10-04  2:58 ` [PATCH 1/2] dt-bindings: connector: Add time property for tSenderResponse Amit Sunil Dhamne via B4 Relay
  2026-10-04  2:58 ` [PATCH 2/2] usb: typec: tcpm: Allow configuring tSenderResponse via fwnode Amit Sunil Dhamne via B4 Relay
  0 siblings, 2 replies; 4+ messages in thread
From: Amit Sunil Dhamne via B4 Relay @ 2026-10-04  2:58 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Greg Kroah-Hartman, Badhri Jagan Sridharan, Heikki Krogerus
  Cc: devicetree, linux-kernel, linux-usb, RD Babiera, Kyle Tso,
	Amit Sunil Dhamne

TCPM currently uses a fixed, relaxed tSenderResponse value of 60 ms
(PD_T_SENDER_RESPONSE) for all typec ports. This series adds an
optional "sender-response-time-ms" connector property so that platforms
can specify a different value. Ports that don't specify the property
continue to use 60 ms, so the existing behavior is unchanged.

Dependencies:
Patch 2 ("usb: typec: tcpm: Allow configuring tSenderResponse via
fwnode") depends on patch 1 ("dt-bindings: connector: Add time property
for tSenderResponse"), as patch 1 documents the property that patch 2
parses.

Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
---
Amit Sunil Dhamne (2):
      dt-bindings: connector: Add time property for tSenderResponse
      usb: typec: tcpm: Allow configuring tSenderResponse via fwnode

 .../bindings/connector/usb-connector.yaml          |  9 ++++++
 .../devicetree/bindings/usb/maxim,max33359.yaml    |  1 +
 drivers/usb/typec/tcpm/tcpm.c                      | 35 ++++++++++++++--------
 3 files changed, 32 insertions(+), 13 deletions(-)
---
base-commit: 93f51579e7df248780214094418f205253383cc5
change-id: 20260929-tcpm-sender-response-time-5c8e2ea3fb70

Best regards,
-- 
Amit Sunil Dhamne <amitsd@google.com>



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

* [PATCH 1/2] dt-bindings: connector: Add time property for tSenderResponse
  2026-10-04  2:58 [PATCH 0/2] usb: typec: tcpm: Make tSenderResponse timer configurable Amit Sunil Dhamne via B4 Relay
@ 2026-10-04  2:58 ` Amit Sunil Dhamne via B4 Relay
  2026-10-04  3:05   ` sashiko-bot
  2026-10-04  2:58 ` [PATCH 2/2] usb: typec: tcpm: Allow configuring tSenderResponse via fwnode Amit Sunil Dhamne via B4 Relay
  1 sibling, 1 reply; 4+ messages in thread
From: Amit Sunil Dhamne via B4 Relay @ 2026-10-04  2:58 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Greg Kroah-Hartman, Badhri Jagan Sridharan, Heikki Krogerus
  Cc: devicetree, linux-kernel, linux-usb, RD Babiera, Kyle Tso,
	Amit Sunil Dhamne

From: Amit Sunil Dhamne <amitsd@google.com>

Add the sender-response-time-ms property to allow platforms to specify
the tSenderResponse timer value, i.e. the max time a port waits for the
port partner to respond to a message that requires a response.

Also update the max33359 example to showcase the new property.

Assisted-by: LLM
Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
Reviewed-by: Badhri Jagan Sridharan <badhri@google.com>
---
 Documentation/devicetree/bindings/connector/usb-connector.yaml | 9 +++++++++
 Documentation/devicetree/bindings/usb/maxim,max33359.yaml      | 1 +
 2 files changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml
index 8ca0292490a2..52dbdd738db6 100644
--- a/Documentation/devicetree/bindings/connector/usb-connector.yaml
+++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml
@@ -283,6 +283,15 @@ properties:
     maximum: 200
     default: 200
 
+  sender-response-time-ms:
+    description: Represents the max time in ms that a Type-C port waits for
+      the port partner to respond to a message that requires a response. This
+      timer starts when the port's PHY layer receives the last bit of the
+      GoodCRC EOP corresponding to the message requiring a response. This timer
+      stops when the last bit of the EOP of the expected response message is
+      received by the PHY layer. A timeout leads to a soft or hard reset by the
+      port.
+
   sink-bc12-completion-time-ms:
     description: Represents the max time in ms that a port in sink role takes
       to complete Battery Charger (BC1.2) Detection. BC1.2 detection is a
diff --git a/Documentation/devicetree/bindings/usb/maxim,max33359.yaml b/Documentation/devicetree/bindings/usb/maxim,max33359.yaml
index 003c0b713068..61d8fc660703 100644
--- a/Documentation/devicetree/bindings/usb/maxim,max33359.yaml
+++ b/Documentation/devicetree/bindings/usb/maxim,max33359.yaml
@@ -78,6 +78,7 @@ examples:
                                        PDO_FIXED_DUAL_ROLE)
                                        PDO_FIXED(9000, 2000, 0)>;
                 sink-bc12-completion-time-ms = <500>;
+                sender-response-time-ms = <29>;
                 pd-revision = /bits/ 8 <0x03 0x01 0x01 0x08>;
                 sink-load-step = <150>;
                 sink-load-characteristics = /bits/ 16 <SINK_LOAD_CHAR(0, 1, 1, 2)>;

-- 
2.56.0.rc1.315.gc6ed9934b7-goog



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

* [PATCH 2/2] usb: typec: tcpm: Allow configuring tSenderResponse via fwnode
  2026-10-04  2:58 [PATCH 0/2] usb: typec: tcpm: Make tSenderResponse timer configurable Amit Sunil Dhamne via B4 Relay
  2026-10-04  2:58 ` [PATCH 1/2] dt-bindings: connector: Add time property for tSenderResponse Amit Sunil Dhamne via B4 Relay
@ 2026-10-04  2:58 ` Amit Sunil Dhamne via B4 Relay
  1 sibling, 0 replies; 4+ messages in thread
From: Amit Sunil Dhamne via B4 Relay @ 2026-10-04  2:58 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Greg Kroah-Hartman, Badhri Jagan Sridharan, Heikki Krogerus
  Cc: devicetree, linux-kernel, linux-usb, RD Babiera, Kyle Tso,
	Amit Sunil Dhamne

From: Amit Sunil Dhamne <amitsd@google.com>

The USB PD specification defines a range of values for tSenderResponse.
TCPM currently uses a fixed, relaxed value of 60 ms
(PD_T_SENDER_RESPONSE), which may not suit all platforms.

Allow platforms to specify their own tSenderResponse deadline through
the "sender-response-time-ms" fwnode property. Platforms that do not
set the property keep the existing 60 ms default.

Assisted-by: LLM
Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
Reviewed-by: Badhri Jagan Sridharan <badhri@google.com>
---
 drivers/usb/typec/tcpm/tcpm.c | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 2d6b14aa2085..9f98c87957b1 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -399,12 +399,14 @@ struct pd_revision_info {
  * @sink_wait_cap_time: Deadline (in ms) for tTypeCSinkWaitCap timer
  * @ps_src_wait_off_time: Deadline (in ms) for tPSSourceOff timer
  * @cc_debounce_time: Deadline (in ms) for tCCDebounce timer
+ * @sender_response_time: Deadline (in ms) for tSenderResponse timer
  */
 struct pd_timings {
 	u32 sink_wait_cap_time;
 	u32 ps_src_off_time;
 	u32 cc_debounce_time;
 	u32 snk_bc12_cmpletion_time;
+	u32 sender_response_time;
 };
 
 /* Convert microwatt to watt */
@@ -4316,7 +4318,7 @@ static bool tcpm_send_queued_message(struct tcpm_port *port)
 			} else if (port->pwr_role == TYPEC_SOURCE) {
 				tcpm_ams_finish(port);
 				tcpm_set_state(port, HARD_RESET_SEND,
-					       PD_T_SENDER_RESPONSE);
+					       port->timings.sender_response_time);
 			} else {
 				tcpm_ams_finish(port);
 			}
@@ -5549,7 +5551,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_SENDER_RESPONSE);
+					    port->timings.sender_response_time);
 		}
 		break;
 	case SRC_SEND_CAPABILITIES_TIMEOUT:
@@ -5896,7 +5898,7 @@ static void run_state_machine(struct tcpm_port *port)
 			tcpm_set_state(port, SNK_WAIT_CAPABILITIES, 0);
 		} else {
 			tcpm_set_state_cond(port, hard_reset_state(port),
-					    PD_T_SENDER_RESPONSE);
+					    port->timings.sender_response_time);
 		}
 		break;
 	case SNK_NEGOTIATE_PPS_CAPABILITIES:
@@ -5921,7 +5923,7 @@ static void run_state_machine(struct tcpm_port *port)
 				tcpm_set_state(port, SNK_READY, 0);
 		} else {
 			tcpm_set_state_cond(port, hard_reset_state(port),
-					    PD_T_SENDER_RESPONSE);
+					    port->timings.sender_response_time);
 		}
 		break;
 	case SNK_TRANSITION_SINK:
@@ -6208,7 +6210,8 @@ static void run_state_machine(struct tcpm_port *port)
 			port->message_id_prime = 0;
 			port->rx_msgid_prime = -1;
 			tcpm_pd_send_control(port, PD_CTRL_SOFT_RESET, TCPC_TX_SOP_PRIME);
-			tcpm_set_state_cond(port, ready_state(port), PD_T_SENDER_RESPONSE);
+			tcpm_set_state_cond(port, ready_state(port),
+					    port->timings.sender_response_time);
 		} else {
 			port->message_id = 0;
 			port->rx_msgid = -1;
@@ -6218,7 +6221,7 @@ static void run_state_machine(struct tcpm_port *port)
 				tcpm_set_state_cond(port, hard_reset_state(port), 0);
 			else
 				tcpm_set_state_cond(port, hard_reset_state(port),
-						    PD_T_SENDER_RESPONSE);
+						    port->timings.sender_response_time);
 		}
 		break;
 
@@ -6226,7 +6229,7 @@ static void run_state_machine(struct tcpm_port *port)
 	case DR_SWAP_SEND:
 		tcpm_pd_send_control(port, PD_CTRL_DR_SWAP, TCPC_TX_SOP);
 		tcpm_set_state_cond(port, DR_SWAP_SEND_TIMEOUT,
-				    PD_T_SENDER_RESPONSE);
+				    port->timings.sender_response_time);
 		break;
 	case DR_SWAP_ACCEPT:
 		tcpm_pd_send_control(port, PD_CTRL_ACCEPT, TCPC_TX_SOP);
@@ -6256,7 +6259,7 @@ static void run_state_machine(struct tcpm_port *port)
 			tcpm_set_state(port, ERROR_RECOVERY, 0);
 			break;
 		}
-		tcpm_set_state_cond(port, FR_SWAP_SEND_TIMEOUT, PD_T_SENDER_RESPONSE);
+		tcpm_set_state_cond(port, FR_SWAP_SEND_TIMEOUT, port->timings.sender_response_time);
 		break;
 	case FR_SWAP_SEND_TIMEOUT:
 		tcpm_set_state(port, ERROR_RECOVERY, 0);
@@ -6288,7 +6291,7 @@ static void run_state_machine(struct tcpm_port *port)
 	case PR_SWAP_SEND:
 		tcpm_pd_send_control(port, PD_CTRL_PR_SWAP, TCPC_TX_SOP);
 		tcpm_set_state_cond(port, PR_SWAP_SEND_TIMEOUT,
-				    PD_T_SENDER_RESPONSE);
+				    port->timings.sender_response_time);
 		break;
 	case PR_SWAP_SEND_TIMEOUT:
 		tcpm_swap_complete(port, -ETIMEDOUT);
@@ -6385,7 +6388,7 @@ static void run_state_machine(struct tcpm_port *port)
 	case VCONN_SWAP_SEND:
 		tcpm_pd_send_control(port, PD_CTRL_VCONN_SWAP, TCPC_TX_SOP);
 		tcpm_set_state(port, VCONN_SWAP_SEND_TIMEOUT,
-			       PD_T_SENDER_RESPONSE);
+			       port->timings.sender_response_time);
 		break;
 	case VCONN_SWAP_SEND_TIMEOUT:
 		tcpm_swap_complete(port, -ETIMEDOUT);
@@ -6467,7 +6470,7 @@ static void run_state_machine(struct tcpm_port *port)
 	case GET_STATUS_SEND:
 		tcpm_pd_send_control(port, PD_CTRL_GET_STATUS, TCPC_TX_SOP);
 		tcpm_set_state(port, GET_STATUS_SEND_TIMEOUT,
-			       PD_T_SENDER_RESPONSE);
+			       port->timings.sender_response_time);
 		break;
 	case GET_STATUS_SEND_TIMEOUT:
 		tcpm_set_state(port, ready_state(port), 0);
@@ -6475,14 +6478,14 @@ static void run_state_machine(struct tcpm_port *port)
 	case GET_PPS_STATUS_SEND:
 		tcpm_pd_send_control(port, PD_CTRL_GET_PPS_STATUS, TCPC_TX_SOP);
 		tcpm_set_state(port, GET_PPS_STATUS_SEND_TIMEOUT,
-			       PD_T_SENDER_RESPONSE);
+			       port->timings.sender_response_time);
 		break;
 	case GET_PPS_STATUS_SEND_TIMEOUT:
 		tcpm_set_state(port, ready_state(port), 0);
 		break;
 	case GET_SINK_CAP:
 		tcpm_pd_send_control(port, PD_CTRL_GET_SINK_CAP, TCPC_TX_SOP);
-		tcpm_set_state(port, GET_SINK_CAP_TIMEOUT, PD_T_SENDER_RESPONSE);
+		tcpm_set_state(port, GET_SINK_CAP_TIMEOUT, port->timings.sender_response_time);
 		break;
 	case GET_SINK_CAP_TIMEOUT:
 		port->sink_cap_done = true;
@@ -8160,6 +8163,12 @@ static void tcpm_fw_get_timings(struct tcpm_port *port, struct fwnode_handle *fw
 	ret = fwnode_property_read_u32(fwnode, "sink-bc12-completion-time-ms", &val);
 	if (!ret)
 		port->timings.snk_bc12_cmpletion_time = val;
+
+	ret = fwnode_property_read_u32(fwnode, "sender-response-time-ms", &val);
+	if (!ret)
+		port->timings.sender_response_time = val;
+	else
+		port->timings.sender_response_time = PD_T_SENDER_RESPONSE;
 }
 
 static void tcpm_fw_get_pd_ident(struct tcpm_port *port)

-- 
2.56.0.rc1.315.gc6ed9934b7-goog



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

* Re: [PATCH 1/2] dt-bindings: connector: Add time property for tSenderResponse
  2026-10-04  2:58 ` [PATCH 1/2] dt-bindings: connector: Add time property for tSenderResponse Amit Sunil Dhamne via B4 Relay
@ 2026-10-04  3:05   ` sashiko-bot
  0 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-10-04  3:05 UTC (permalink / raw)
  To: Amit Sunil Dhamne; +Cc: robh, devicetree, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] dt-bindings: missing schema constraints for sender-response-time-ms
--

commit eb9d81bbfb13df2dbe09db76aefbc40c815abe01
Author: Amit Sunil Dhamne <amitsd@google.com>

dt-bindings: connector: Add time property for tSenderResponse

Add the sender-response-time-ms property to allow platforms to specify
the tSenderResponse timer value, i.e. the max time a port waits for the
port partner to respond to a message that requires a response.

> diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml
> index 8ca0292490a2c..52dbdd738db64 100644
> --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml
> +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml
> @@ -283,6 +283,15 @@ properties:
>      maximum: 200
>      default: 200
>  
> +  sender-response-time-ms:
> +    description: Represents the max time in ms that a Type-C port waits for

[Severity: Low]
Is this new property missing minimum, maximum, or default constraints?

Unlike other timers in this schema (such as sink-wait-cap-time-ms), the lack
of boundaries means offline schema validation (dt_binding_check) will silently
accept arbitrary values. Should this have explicit numerical limits to prevent
accidentally violating USB PD timing requirements?

> +      the port partner to respond to a message that requires a response. This
> +      timer starts when the port's PHY layer receives the last bit of the
> +      GoodCRC EOP corresponding to the message requiring a response. This timer
> +      stops when the last bit of the EOP of the expected response message is
> +      received by the PHY layer. A timeout leads to a soft or hard reset by the
> +      port.
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261004-tcpm-sender-response-time-v1-0-3f8b43084acc@google.com?part=1

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

end of thread, other threads:[~2026-10-04  3:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-04  2:58 [PATCH 0/2] usb: typec: tcpm: Make tSenderResponse timer configurable Amit Sunil Dhamne via B4 Relay
2026-10-04  2:58 ` [PATCH 1/2] dt-bindings: connector: Add time property for tSenderResponse Amit Sunil Dhamne via B4 Relay
2026-10-04  3:05   ` sashiko-bot
2026-10-04  2:58 ` [PATCH 2/2] usb: typec: tcpm: Allow configuring tSenderResponse via fwnode Amit Sunil Dhamne via B4 Relay

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