Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp253163pxa; Tue, 18 Aug 2020 23:36:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOFMjgy2/jR/7rGaDxk4GnT8Qlu1AkcHrGYfETO7sylbp3gpRjSSJZ3GpjnGd41zg6Jizv X-Received: by 2002:a17:906:841:: with SMTP id f1mr2879738ejd.158.1597818964300; Tue, 18 Aug 2020 23:36:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597818964; cv=none; d=google.com; s=arc-20160816; b=CU3Vs+sfX6VEtE1MJJGeh0lAJ0Kql4BIRJda7Dchj/e3ssY66W9L1zsBcdb2BIoQTd 6N7Xf+Ap+ce1pBRFD42CL1Ahx/jusvzR6SVpfarS7SCjHcLrfYFDAztYAJDmykm37ut/ 1JR1306ZUwQsRPUZogLl+DjybQgqB0pxPOmnDnCgExKMGC38EnS2dFsdzPDB/kOZxh7W 3Pmnm9IjjAGJVkyjNxp5YuSE40MVV27u2JnKxEXowekVr4SxhPXFLPYKjyg8+cuSM32h X7DYkeqvdbDVIo8OOk7+cZsQLpRm7ZIDJQY0fshQ6IhyNZzEWA5a6PXH1MR2SkUagQfv GLYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=dMG7y0qD+55gtb4RkK3VjWqhIfa+R2WnVzyv/okpF1U=; b=akrjX/rGTVRr8SBFCiJ0eCxEeI6MZ0GF6/OnYuLS/sI7wHna3eKsVcJuk/uZEirNtr ffytph3e2M7nw6br0imAJ4cauCsd5JffPjZFSE45QP2E7OFkCvsuxMRl6JkksDkdKJ7X bJFdOutbGEtOitWoVXaJcwTQtxNkH+i1uQ+qxK0z0Zbo16gsmFVvHFXmHIJr4qu+WQdQ 3A5zI7EcUB70CrBkLAUvon8OOmUCExHFXz8PVHNCdAFLuPo+xw6uwGdayNrhheZpefei m2YAaxCiTG8Knt9B80vb2otTYtX9lCoTihdIGfhPPGnGnuvoYelmoFJ08kLmICZ8X2FH 87KQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qc15si14404953ejb.658.2020.08.18.23.35.41; Tue, 18 Aug 2020 23:36:04 -0700 (PDT) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726703AbgHSGdJ (ORCPT + 99 others); Wed, 19 Aug 2020 02:33:09 -0400 Received: from mga11.intel.com ([192.55.52.93]:54924 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726685AbgHSGdI (ORCPT ); Wed, 19 Aug 2020 02:33:08 -0400 IronPort-SDR: VR+3QcAulfk/HIxfCiq8T2S1bybY+5vQK8lxbQRkQNUGpEV2tQfeUNAqVZZRweEBOv/QS7Of1T 5LPkzzBzO9zQ== X-IronPort-AV: E=McAfee;i="6000,8403,9717"; a="152675316" X-IronPort-AV: E=Sophos;i="5.76,330,1592895600"; d="scan'208";a="152675316" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2020 23:30:57 -0700 IronPort-SDR: yWGynPXoF/ygcZzdiuq4SnHzVEviyzMnEv8e3E0nomUDhYzbJYzVNCN8LMryjRcCns9bAmMmcb nwLn6d8Wq2LQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,330,1592895600"; d="scan'208";a="400730444" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 18 Aug 2020 23:30:54 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Wed, 19 Aug 2020 09:30:54 +0300 Date: Wed, 19 Aug 2020 09:30:54 +0300 From: Heikki Krogerus To: Badhri Jagan Sridharan Cc: Guenter Roeck , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2 v4] tcpm: During PR_SWAP, source caps should be sent only after tSwapSourceStart Message-ID: <20200819063054.GA2772165@kuha.fi.intel.com> References: <20200817183828.1895015-1-badhri@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200817183828.1895015-1-badhri@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 17, 2020 at 11:38:27AM -0700, Badhri Jagan Sridharan wrote: > The patch addresses the compliance test failures while running > TD.PD.CP.E3, TD.PD.CP.E4, TD.PD.CP.E5 of the "Deterministic PD > Compliance MOI" test plan published in https://www.usb.org/usbc. > For a product to be Type-C compliant, it's expected that these tests > are run on usb.org certified Type-C compliance tester as mentioned in > https://www.usb.org/usbc. > > The purpose of the tests TD.PD.CP.E3, TD.PD.CP.E4, TD.PD.CP.E5 is to > verify the PR_SWAP response of the device. While doing so, the test > asserts that Source Capabilities message is NOT received from the test > device within tSwapSourceStart min (20 ms) from the time the last bit > of GoodCRC corresponding to the RS_RDY message sent by the UUT was > sent. If it does then the test fails. > > This is in line with the requirements from the USB Power Delivery > Specification Revision 3.0, Version 1.2: > "6.6.8.1 SwapSourceStartTimer > The SwapSourceStartTimer Shall be used by the new Source, after a > Power Role Swap or Fast Role Swap, to ensure that it does not send > Source_Capabilities Message before the new Sink is ready to receive > the > Source_Capabilities Message. The new Source Shall Not send the > Source_Capabilities Message earlier than tSwapSourceStart after the > last bit of the EOP of GoodCRC Message sent in response to the PS_RDY > Message sent by the new Source indicating that its power supply is > ready." > > The patch makes sure that TCPM does not send the Source_Capabilities > Message within tSwapSourceStart(20ms) by transitioning into > SRC_STARTUP only after tSwapSourceStart(20ms). > > Signed-off-by: Badhri Jagan Sridharan > Reviewed-by: Guenter Roeck Reviewed-by: Heikki Krogerus > --- > Changes since V1: > - Comment on the permissible values of tSwapSourceStart > > Changes since V2: > - Fixing alignment issue pointed out by Guenter. > - Added Reviewed-by: Guenter Roeck > > Changes since V3: > - Updated commit description and made it elaborate to address Heikki's > suggestion. > --- > 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 3ef37202ee37..d38347bd3335 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -3555,7 +3555,7 @@ static void run_state_machine(struct tcpm_port *port) > */ > tcpm_set_pwr_role(port, TYPEC_SOURCE); > tcpm_pd_send_control(port, PD_CTRL_PS_RDY); > - tcpm_set_state(port, SRC_STARTUP, 0); > + tcpm_set_state(port, SRC_STARTUP, PD_T_SWAP_SRC_START); > break; > > case VCONN_SWAP_ACCEPT: > diff --git a/include/linux/usb/pd.h b/include/linux/usb/pd.h > index b6c233e79bd4..1df895e4680b 100644 > --- a/include/linux/usb/pd.h > +++ b/include/linux/usb/pd.h > @@ -473,6 +473,7 @@ static inline unsigned int rdo_max_power(u32 rdo) > #define PD_T_ERROR_RECOVERY 100 /* minimum 25 is insufficient */ > #define PD_T_SRCSWAPSTDBY 625 /* Maximum of 650ms */ > #define PD_T_NEWSRC 250 /* Maximum of 275ms */ > +#define PD_T_SWAP_SRC_START 20 /* Minimum of 20ms */ > > #define PD_T_DRP_TRY 100 /* 75 - 150 ms */ > #define PD_T_DRP_TRYWAIT 600 /* 400 - 800 ms */ thanks, -- heikki