Skip to contentSkip to conversation

usb: typec: tcpm: Query Source partner for FRS capability only if it is DRP

PATCH In review Kyle Tso 3 participants 3 messages Dec 5, 2023 – Dec 8, 2023

Subsystems (3)
lore
Share & tools
lore

Kyle Tso

author
#0 lore raw

PATCH 1/1 usb: typec: tcpm: Query Source partner for FRS capability only if it is DRP

Source-only port partner will always respond NOT_SUPPORTED to GET_SINK_CAP. Avoid this redundant AMS by bailing out querying the FRS capability if the Source port partner is not DRP.

---
 drivers/usb/typec/tcpm/tcpm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/typec/tcpm/tcpm.c +2 -1
index 50cbc52386b3..192c103e0d10 100644
@@ -4401,7 +4401,8 @@ static void run_state_machine(struct tcpm_port *port)
 			tcpm_set_current_limit(port, tcpm_get_current_limit(port), 5000);
 		tcpm_swap_complete(port, 0);
 		tcpm_typec_connect(port);
-		mod_enable_frs_delayed_work(port, 0);
+		if (port->pd_capable && port->source_caps[0] & PDO_FIXED_DUAL_ROLE)
+			mod_enable_frs_delayed_work(port, 0);
 		tcpm_pps_complete(port, port->pps_status);
 
 		if (port->ams != NONE_AMS)
Signature · 1 line
2.43.0.472.g3155946c3a-goog
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Kyle Tso

Source-only port partner will always respond NOT_SUPPORTED to GET_SINK_CAP. Avoid this redundant AMS by bailing out querying the FRS capability if the Source port partner is not DRP.

Quoted 20 lines
---
 drivers/usb/typec/tcpm/tcpm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/typec/tcpm/tcpm.c +2 -1
index 50cbc52386b3..192c103e0d10 100644
@@ -4401,7 +4401,8 @@ static void run_state_machine(struct tcpm_port *port)
 			tcpm_set_current_limit(port, tcpm_get_current_limit(port), 5000);
 		tcpm_swap_complete(port, 0);
 		tcpm_typec_connect(port);
-		mod_enable_frs_delayed_work(port, 0);
+		if (port->pd_capable && port->source_caps[0] & PDO_FIXED_DUAL_ROLE)
+			mod_enable_frs_delayed_work(port, 0);
 		tcpm_pps_complete(port, port->pps_status);
 
 		if (port->ams != NONE_AMS)
Signature · 1 line
2.43.0.472.g3155946c3a-goog
Signature · 1 line
heikki
Reviewed-by on v1 1/1
#2 lore raw
In reply to Kyle Tso
Quoted 5 lines · Kyle Tso

Source-only port partner will always respond NOT_SUPPORTED to GET_SINK_CAP. Avoid this redundant AMS by bailing out querying the FRS capability if the Source port partner is not DRP.

Quoted 18 lines
---
  drivers/usb/typec/tcpm/tcpm.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/typec/tcpm/tcpm.c +2 -1
index 50cbc52386b3..192c103e0d10 100644
@@ -4401,7 +4401,8 @@ static void run_state_machine(struct tcpm_port *port)
  			tcpm_set_current_limit(port, tcpm_get_current_limit(port), 5000);
  		tcpm_swap_complete(port, 0);
  		tcpm_typec_connect(port);
-		mod_enable_frs_delayed_work(port, 0);
+		if (port->pd_capable && port->source_caps[0] & PDO_FIXED_DUAL_ROLE)
+			mod_enable_frs_delayed_work(port, 0);
  		tcpm_pps_complete(port, port->pps_status);
 
  		if (port->ams != NONE_AMS)