aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpumahsu <[email protected]>2020-12-10 17:05:18 +0100
committerGreg Kroah-Hartman <[email protected]>2020-12-11 10:51:38 +0100
commit60e998d1c6d98cd28b14a677b61278c33cc5c7df (patch)
treeb5006d64ce32b9867eb13ca89d640d12ead55490
parent8704fd73bf5658bf4b827643f7f526481082d83f (diff)
USB: typec: tcpm: Hard Reset after not receiving a Request
PD 3.0 spec 8.3.3.2.3, A Get_Source_Cap message is sent to a UUT that is in the PE_SRC_Ready state. After sending a Source_Capabilities message, the UUT should then expect a Request message in response. When one is not received, the UUT should timeout to PE_SRC_Hard_Reset. Cc: Guenter Roeck <[email protected]> Cc: Heikki Krogerus <[email protected]> Cc: Badhri Jagan Sridharan <[email protected]> Acked-by: Heikki Krogerus <[email protected]> Signed-off-by: pumahsu <[email protected]> Signed-off-by: Kyle Tso <[email protected]> Signed-off-by: Will McVicker <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/usb/typec/tcpm/tcpm.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index cedc6cf82d61..fa0500a03413 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -2228,6 +2228,7 @@ static int tcpm_pd_send_control(struct tcpm_port *port,
static bool tcpm_send_queued_message(struct tcpm_port *port)
{
enum pd_msg_request queued_message;
+ int ret;
do {
queued_message = port->queued_message;
@@ -2247,7 +2248,16 @@ static bool tcpm_send_queued_message(struct tcpm_port *port)
tcpm_pd_send_sink_caps(port);
break;
case PD_MSG_DATA_SOURCE_CAP:
- tcpm_pd_send_source_caps(port);
+ ret = tcpm_pd_send_source_caps(port);
+ if (ret < 0) {
+ tcpm_log(port,
+ "Unable to send src caps, ret=%d",
+ ret);
+ tcpm_set_state(port, SOFT_RESET_SEND, 0);
+ } else if (port->pwr_role == TYPEC_SOURCE) {
+ tcpm_set_state(port, HARD_RESET_SEND,
+ PD_T_SENDER_RESPONSE);
+ }
break;
default:
break;