Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4918073pxu; Thu, 10 Dec 2020 08:28:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzVRoMOoYknSGmOQKGEXufAaactbclXqXnKQIOeuWtIMqhHXwIIEctSUeHX8McYAj/eQCy1 X-Received: by 2002:a50:84a9:: with SMTP id 38mr7477103edq.378.1607617721429; Thu, 10 Dec 2020 08:28:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607617721; cv=none; d=google.com; s=arc-20160816; b=ZOF1AvdsuYJcANczuPyOcxz9do/muKyRfYVXkl0A5kKofSw9Xd6aysf41fXMgWdJ0X +F3sYdA5nSDU3QSdcTBQcgTTYHhziXZB87yqSmCs2ADno57YYesIOUK+EfZvjYyp/zEc zJ18MDWLxfxK0b+IVfTKaRa0ffZ/7e32085Hep5EPE4Ztev5QfkblqFRxAo4wDGFDHAu gfh3xWRnwyfkyZpGtU2NUqO8dpY0EKOik0vWpD6AFlMhhpkIzEoeU6VsJkRvW/SQHv+N W3yRcOilGQUf2kZq7FAD0Al8jqVqQCjBXnbbBg3HH/ebFocdasaRqfByCNPS0wvJb+Vz +UiA== 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=DX1IGSJOLwNmoD7ChR7ql4zq0DcEr7fG4whLNwvSdBk=; b=md2hUv9LySwzPUEQjEiOHn42y8rfPysFjQSBob2Z+c4nNt2Cyz/+3ccR9Fs+SdPR8o EcpUpk7NTfiDyk3t/SUg2PvLR1RO39iLCyD16Eprq5FXEw5TyJYH1kwGt8trZd58kFrw PZBnuBgbWUrt2nBlcAd2xUNJMrxVxjzRUH4dyvZ//pFB/YIsRyIXf4hPrmm+2K/OsW4A TUcI8EkPyTUaN3Vwd2qJpuJ1glFlH3wiQLD8KuQOianIKv5QkWsZi+MazywSg0PI0eky nao2xaTjMlrb+ImFgqKSfeLl9urXkDSc7MyD8whKGMY/tIQcC63KHC01tq6XM13mGDAC FDhw== 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 c26si2991303edx.406.2020.12.10.08.28.17; Thu, 10 Dec 2020 08:28:41 -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 S2388534AbgLJQZF (ORCPT + 99 others); Thu, 10 Dec 2020 11:25:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:34720 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389377AbgLJQFk (ORCPT ); Thu, 10 Dec 2020 11:05:40 -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, Kyle Tso , Badhri Jagan Sridharan , Will McVicker , Greg Kroah-Hartman Subject: [PATCH 4/5] USB: typec: tcpm: Add a 30ms room for tPSSourceOn in PR_SWAP Date: Thu, 10 Dec 2020 17:05:20 +0100 Message-Id: <20201210160521.3417426-5-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: Kyle Tso TCPM state machine needs 20-25ms to enter the ErrorRecovery state after tPSSourceOn timer timeouts. Change the timer from max 480ms to 450ms to ensure that the timer complies with the Spec. In order to keep the flexibility for other usecases using tPSSourceOn, add another timer only for PR_SWAP. Cc: Guenter Roeck Cc: Heikki Krogerus Cc: Badhri Jagan Sridharan Signed-off-by: Kyle Tso Signed-off-by: Will McVicker Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/tcpm/tcpm.c | 2 +- include/linux/usb/pd.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index d51c45961893..5ed78194a1bd 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -3728,7 +3728,7 @@ static void run_state_machine(struct tcpm_port *port) tcpm_set_state(port, ERROR_RECOVERY, 0); break; } - tcpm_set_state(port, ERROR_RECOVERY, PD_T_PS_SOURCE_ON); + tcpm_set_state(port, ERROR_RECOVERY, PD_T_PS_SOURCE_ON_PRS); break; case PR_SWAP_SRC_SNK_SINK_ON: /* Set the vbus disconnect threshold for implicit contract */ diff --git a/include/linux/usb/pd.h b/include/linux/usb/pd.h index 63a66dd5d832..bb9a782e1411 100644 --- a/include/linux/usb/pd.h +++ b/include/linux/usb/pd.h @@ -466,6 +466,7 @@ static inline unsigned int rdo_max_power(u32 rdo) #define PD_T_DRP_SRC 30 #define PD_T_PS_SOURCE_OFF 920 #define PD_T_PS_SOURCE_ON 480 +#define PD_T_PS_SOURCE_ON_PRS 450 /* 390 - 480ms */ #define PD_T_PS_HARD_RESET 30 #define PD_T_SRC_RECOVER 760 #define PD_T_SRC_RECOVER_MAX 1000 -- 2.29.2