Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4921262pxu; Thu, 10 Dec 2020 08:32:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJyLMEpCiekVrsNuZVLVQrXsPxI51O9c55sB/tQEesMe7rKoqszPX+FjvbQ3Xv/Cx+4tiFnJ X-Received: by 2002:a17:906:268c:: with SMTP id t12mr7024395ejc.91.1607617973031; Thu, 10 Dec 2020 08:32:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607617973; cv=none; d=google.com; s=arc-20160816; b=FZfxhSAqoIibMPKNaDEJQep00Z1qDKZlI1HoSXlgxWmD3EQuevSscOWkNfWeIK8Mhc lf7uQc4EXk7EystGuoqDBeTEsvnInzsooSUwcw4ONfC9byCHXKfto0thTqiLhVRBhqGx CT+FoCfWVUzZ8Xt4AkOqK77crdVWId0QdE61KToR1vzzBee7TKB4SF4O2kE/enH8q/0i WOzEcpbV0T3DUGJumTsihvajErutJIhyCea1u70GF9lSTboOvOSM0wiUblyeHqqfe55G ifND7cdAvjSgcGUSC7pC9Mfzeub17VK61s8OjfuCiYNTxFLe5pX7cqHag0lrUTUe7gcj vuAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=zWY9qD8SvJg+NSKLmtuoLlaU9W54PYlWojeBGnULSBw=; b=H8hcefPWYbtJrZAu01wJvzGBULZqtWlGULuVVuiqj9dDj9+QUgmxTYq8vb8DVv8quA R5t9NkvfGnDOkCusb9rjVXnzCy0Libk0SVjnmU2RUnz1uH5A7pY4iyxllPgflp++jXGA a499x1XVN6rs2RvhSf6SEdbEwmyG/qfd+3l8fRh/75bHt9glWPyyrGxsl+ayYsppI8/5 SyhISw0U/8Qzxg6GD634iHJOrZMLb5vFNlcnqtag/wpjsNrCnPe5HGS0Oxy48AIzdVEK 86tiLD6CHDTOo5DeH5Uc774LJD8usAvgaHmAxXaONvukvWwXsWYv6RF+qgnRlz0onlLH XsSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d14si3109270edp.294.2020.12.10.08.32.28; Thu, 10 Dec 2020 08:32:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391158AbgLJQF3 (ORCPT + 99 others); Thu, 10 Dec 2020 11:05:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:33716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389598AbgLJQFY (ORCPT ); Thu, 10 Dec 2020 11:05:24 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: heikki.krogerus@linux.intel.com, linux@roeck-us.net Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, pumahsu , Badhri Jagan Sridharan , Kyle Tso , Will McVicker , Greg Kroah-Hartman Subject: [PATCH 2/5] USB: typec: tcpm: Hard Reset after not receiving a Request Date: Thu, 10 Dec 2020 17:05:18 +0100 Message-Id: <20201210160521.3417426-3-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201210160521.3417426-1-gregkh@linuxfoundation.org> References: <20201210160521.3417426-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: pumahsu 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 Cc: Heikki Krogerus Cc: Badhri Jagan Sridharan Signed-off-by: pumahsu Signed-off-by: Kyle Tso Signed-off-by: Will McVicker Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/tcpm/tcpm.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 0ceeab50ed64..0efda59bb104 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -2218,6 +2218,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; @@ -2237,7 +2238,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; -- 2.29.2