Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp100788pxa; Tue, 11 Aug 2020 18:44:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFG1NV3XnwZZRcm/vBoKAT4MPGGM3dbiMfLBwTvTRO7A2SfgVb11KtqQ5EjzwYGd0QdEAc X-Received: by 2002:a50:bf07:: with SMTP id f7mr29344793edk.356.1597196659552; Tue, 11 Aug 2020 18:44:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597196659; cv=none; d=google.com; s=arc-20160816; b=LVPEvdBrUwootuZbOa3egbsX6RiZb4sF43DVUv+ImU/rf6ME7FfU0r0b+QyJzuzLfa F1zxTiKWBGs+uixCk7nXHMmMps/ZXrXcfP9NGgwwHPsfIo0Kbr8UZjZz53xTmY1HXdK/ HWMgnDut0+VUKIreaa5W6bqjWSYgymtDRHTnH6+CJhpX0Gm1KRDxsZBYroXYciNzmEb9 DxHBU7KrsxeweEd1dIVrAK3WEKbdeynQ8bsfkbPRvx03WhAen/sPP7nhA/442ky0Yon4 R7IpNTUvPtfjhokoqVjiPIeodmKokRCRN2gNCjNvItSNgUicZT85WxffqG7oH8lyYnQ4 +g4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=YES8VqMRuW00rmoC1R22Qi8IRpCzo5Gd0iswt9weQBg=; b=IFlZxEcNEPSH3dC1ta4tK4SrZNMrHbq77rSuwC1vuo6NvoSme5FphhnpZ8fB9Trut7 mZ9J+ZIjlPSqf2RbSZVBlQ6mB8KVJRcV6vYPV4zh/+EVNYVoNGGBjJIgqy/XpUTeCFtH VaPBCdpqqVZBqltSCwPM+evcDAHvq4aW62W2k01fcf/zN9/0DAfNUveZimFSF/r97hRP SwUXhn2xAEWSI89NPTckVUuBqNyGj80QF+S/P+K5PliQPaablCvuIdHMj9BxB/a+O1IW /5f7bkKUtzq8/7n3sHdqBA4TfyD17odxQCIkEyH+aHybQ21dYtOvY5i9H6Chkj++Am51 62cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=uuYeM7kN; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d14si309145eds.413.2020.08.11.18.43.56; Tue, 11 Aug 2020 18:44:19 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=uuYeM7kN; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726428AbgHLBnV (ORCPT + 99 others); Tue, 11 Aug 2020 21:43:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726173AbgHLBnV (ORCPT ); Tue, 11 Aug 2020 21:43:21 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 398C3C06174A; Tue, 11 Aug 2020 18:43:21 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id y206so193275pfb.10; Tue, 11 Aug 2020 18:43:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=YES8VqMRuW00rmoC1R22Qi8IRpCzo5Gd0iswt9weQBg=; b=uuYeM7kNudgVbWQu1/imVKTRbpa9ZXbLkEF5NJLrv7T8D4N/DulEodE4drALGxPjOG mX6gsZuBYp4iW9hxkfWBIj8ph43PrXBC6gqu4j++eD8bnDfaOnQSFkT4Qz5IHeP8MXRB PScch6wA9IKvyXbZbFfiFRH82Hos5k6mTBnPzY2wau7UZBpN4G1Z+VzQ4VKCEicUltY7 s4l8xUYJwy89Tez+276WXVuBBCLA3x3X9loEv92v9tHAvE6dKwGImFUNDEJ9PUpxdJEA wvKhanOcxp9/v2np8e7D0AhOUI6nh0acZesZ0Lrnrwl+ESNOObvIE/CHWF9WR8J4gaOH 8BzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=YES8VqMRuW00rmoC1R22Qi8IRpCzo5Gd0iswt9weQBg=; b=Sa1OcGGzAwkcs4FE+UR5oZTTiidXS8plQCzgVUSVsWCEILdHykInV4Q05S5nD9/wuQ zw3rRWx3LYIHzAXfVauC2p4W+RR4fAjGVQ9SOFprDW7BbaOZi8gs9JKz65UAwhHe4d9p XKNL1GqzaskBlUcXZ9k0HjybgwZfo+eW36N1NHrOB22yD7NXGHB6vp7cwD9FZVtOglfE b9MWQBYAPFc6oA3dbWj/Bzcz/wMKJRW9SKy9uyvnwqHAZAxBHRfDttkNrmYVm4eseE5i S7QfR+A0jKUY9XbMQGtQDCT8K3QybavhicTx5mLlWyUEh+lZqNG9M14U/PHli4wjcBuO 6Qlg== X-Gm-Message-State: AOAM532PkLtb6f0fw56CnIdsN1hdukFVezSDxUSbOK7NShrMlhVmLSlT ICeX/ZQB5b5YcqNJyJ/ZbYVoFvSA X-Received: by 2002:a62:1614:: with SMTP id 20mr8896080pfw.258.1597196600691; Tue, 11 Aug 2020 18:43:20 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id e2sm356626pfm.37.2020.08.11.18.43.20 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Aug 2020 18:43:20 -0700 (PDT) Date: Tue, 11 Aug 2020 18:43:19 -0700 From: Guenter Roeck To: Badhri Jagan Sridharan Cc: Heikki Krogerus , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] tcpm: During PR_SWAP, source caps should be sent only after tSwapSourceStart Message-ID: <20200812014319.GA116801@roeck-us.net> References: <20200812001439.545655-1-badhri@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200812001439.545655-1-badhri@google.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 11, 2020 at 05:14:39PM -0700, Badhri Jagan Sridharan wrote: > From the spec: > "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." > > This fixes TD.PD.CP.E3, TD.PD.CP.E4, TD.PD.CP.E5 failures > > Signed-off-by: Badhri Jagan Sridharan Nit below, otherwise Reviewed-by: Guenter Roeck Note that I wasn't copied on this patch and only noticed it accidentally. Guenter > --- > Changes since V1: > - Comment on the permissible values of tSwapSourceStart > --- > 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..ed5eed73ccf8 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 */ Odd alignment. Same as with the previous two lines which don't use tabs either. > > #define PD_T_DRP_TRY 100 /* 75 - 150 ms */ > #define PD_T_DRP_TRYWAIT 600 /* 400 - 800 ms */