From ae6b76bff95cdf7670fd03e01198fe41f46fc0ad Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Fri, 23 Aug 2024 07:58:05 +0100 Subject: [PATCH] Revert "usb: typec: tcpm: avoid resets for missing source capability messages" This reverts commit 122968f8dda8205c5735d7e1b1ccb041a54906d1. Causes Pixel 6 ADB failures. Will be reapplied in due course. Bug: 361711314 Signed-off-by: Lee Jones Change-Id: I07569d004923225969c7e04162ced0956fc27c59 --- drivers/usb/typec/tcpm/tcpm.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 26f9006e95e1..22d88e41596f 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -57,7 +57,6 @@ S(SNK_DISCOVERY_DEBOUNCE), \ S(SNK_DISCOVERY_DEBOUNCE_DONE), \ S(SNK_WAIT_CAPABILITIES), \ - S(SNK_WAIT_CAPABILITIES_TIMEOUT), \ S(SNK_NEGOTIATE_CAPABILITIES), \ S(SNK_NEGOTIATE_PPS_CAPABILITIES), \ S(SNK_TRANSITION_SINK), \ @@ -3111,8 +3110,7 @@ static void tcpm_pd_data_request(struct tcpm_port *port, PD_MSG_CTRL_REJECT : PD_MSG_CTRL_NOT_SUPP, NONE_AMS); - } else if (port->state == SNK_WAIT_CAPABILITIES || - port->state == SNK_WAIT_CAPABILITIES_TIMEOUT) { + } else if (port->state == SNK_WAIT_CAPABILITIES) { /* * This message may be received even if VBUS is not * present. This is quite unexpected; see USB PD @@ -5043,31 +5041,10 @@ static void run_state_machine(struct tcpm_port *port) tcpm_set_state(port, SNK_SOFT_RESET, PD_T_SINK_WAIT_CAP); } else { - tcpm_set_state(port, SNK_WAIT_CAPABILITIES_TIMEOUT, + tcpm_set_state(port, hard_reset_state(port), PD_T_SINK_WAIT_CAP); } break; - case SNK_WAIT_CAPABILITIES_TIMEOUT: - /* - * There are some USB PD sources in the field, which do not - * properly implement the specification and fail to start - * sending Source Capability messages after a soft reset. The - * specification suggests to do a hard reset when no Source - * capability message is received within PD_T_SINK_WAIT_CAP, - * but that might effectively kil the machine's power source. - * - * This slightly diverges from the specification and tries to - * recover from this by explicitly asking for the capabilities - * using the Get_Source_Cap control message before falling back - * to a hard reset. The control message should also be supported - * and handled by all USB PD source and dual role devices - * according to the specification. - */ - if (tcpm_pd_send_control(port, PD_CTRL_GET_SOURCE_CAP, TCPC_TX_SOP)) - tcpm_set_state_cond(port, hard_reset_state(port), 0); - else - tcpm_set_state(port, hard_reset_state(port), PD_T_SINK_WAIT_CAP); - break; case SNK_NEGOTIATE_CAPABILITIES: port->pd_capable = true; tcpm_set_partner_usb_comm_capable(port,