usb: typec: tcpm: Query Source partner for FRS capability only if it is DRP
authorKyle Tso <kyletso@google.com>
Tue, 5 Dec 2023 07:47:46 +0000 (15:47 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Dec 2023 12:53:58 +0000 (13:53 +0100)
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.

Signed-off-by: Kyle Tso <kyletso@google.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20231205074747.1821297-1-kyletso@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/tcpm/tcpm.c

index ff67553b69323862390e72d354c67400c4a8fcb4..8372f98de757de4d3c97de61d3cf4b4b3507bf10 100644 (file)
@@ -4402,7 +4402,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)