From patchwork Wed Aug 12 02:29:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Badhri Jagan Sridharan X-Patchwork-Id: 11710213 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 19DC6722 for ; Wed, 12 Aug 2020 02:29:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EEF6C20782 for ; Wed, 12 Aug 2020 02:29:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="AKUcSaKS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726501AbgHLC3m (ORCPT ); Tue, 11 Aug 2020 22:29:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726355AbgHLC3m (ORCPT ); Tue, 11 Aug 2020 22:29:42 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4694AC061787 for ; Tue, 11 Aug 2020 19:29:41 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id w17so1194776ybl.9 for ; Tue, 11 Aug 2020 19:29:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=7kb24t9t+2UT9QF6trcnIzylz5AUfXTHeh+iRSA5lxs=; b=AKUcSaKSobaoX5zmoQ76o7aqK0kHuajdBECPrrDoILiqK+Nui2Ow50R7p4MzAezUo7 Xwwhyv/KojLYQdQysAu3YR1Yr+Bp/5qgV+lLNeJJwKZR7QGvJfU9b/nCA7riP8QLq49t ukjXkVozELxxRvqX8vD7+A+cvBmqISRPaHcJbAOhosiJd1kvT/X0POOnfJFyuU0km6Wj 4+J6yl5fV0PHOKcuw4jMl4n1o3rVFGFOq5Ex5wUg4XWI8SWLHkH8pxhtIAmQATJCGiua F8fcZjXZDzi7XkU+8tRMSSbEv23PVNlakTVVG02U9S4LgTmxlGfcoQ1rWgRkCf6lhTko aEew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=7kb24t9t+2UT9QF6trcnIzylz5AUfXTHeh+iRSA5lxs=; b=EGjbINlW7l+ZGtS4UN5k1+WKbvXXRbqAvSyt/5de5pu5Ut9KioZcIzshn3kpZeWYS3 CvWSC3BMuwvak9hvXYWUk7P6R5r5dkU6WWRM0Plb9mM7Qv16YbRUhFCwrtjEZEBbYjX9 6Ny7fW4YA1nFqRAa8yV59S7QjObHFCIrBZHlsNtilsXFjkdVkv1r06njMNSUHTIs1mzT l1fsHHN49FInuMsRoPF6oTCwIAP7hdNgR569RqexxofGZ0oxHkY6W76PTkRBWMGWY35u Pw9YSQQJ/bUaPoduaCb84iOO+SA2+hhml7vBhVbQB0d+YbZwpfuJ6ZFWxV+RjfGuQLJn lOkQ== X-Gm-Message-State: AOAM533Cq5Eiz/BXP0mL75fVLpqxYs3m4gOGO3H/Uq/k9Qeu6W3LcICe +nfoWvXXDTl2NjYsrYJHs2iSD/eRxj4= X-Google-Smtp-Source: ABdhPJxPCfFXqPh8VcN+e0QkWWP1l77w1/QEG44qg/HZ2qv3Ez2CpZFKcVLHfoEqCxt91wbUnIt5poZR/S4= X-Received: by 2002:a5b:451:: with SMTP id s17mr46194749ybp.433.1597199378613; Tue, 11 Aug 2020 19:29:38 -0700 (PDT) Date: Tue, 11 Aug 2020 19:29:33 -0700 Message-Id: <20200812022934.568134-1-badhri@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.28.0.236.gb10cc79966-goog Subject: [PATCH 1/2 v3] tcpm: During PR_SWAP, source caps should be sent only after tSwapSourceStart From: Badhri Jagan Sridharan To: Heikki Krogerus , Greg Kroah-Hartman , Guenter Roeck Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Badhri Jagan Sridharan Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Reviewed-by: Guenter Roeck --- 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 --- 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 */ From patchwork Wed Aug 12 02:29:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Badhri Jagan Sridharan X-Patchwork-Id: 11710215 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68D06722 for ; Wed, 12 Aug 2020 02:29:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F7FB20782 for ; Wed, 12 Aug 2020 02:29:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="gF+6KkYS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726526AbgHLC3r (ORCPT ); Tue, 11 Aug 2020 22:29:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726173AbgHLC3q (ORCPT ); Tue, 11 Aug 2020 22:29:46 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F977C06174A for ; Tue, 11 Aug 2020 19:29:46 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id x184so1196694ybx.10 for ; Tue, 11 Aug 2020 19:29:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=+n1LUw8DJLUyTXbv9Oe2r81KbedmVRu6OMKCTfy3ZiQ=; b=gF+6KkYSkPuCLW86O6juaBcdj4+WaTmJrk88Z0Ll9t0HKXakRLGtL2e+dhoGTjOnOR kaUAbdEXQaR5k+Qbya8c5FHurzzHJN1LAkLzVFEolC2/dwXBzRVWyqiVLvuba/NVbUZJ noY+rFhLK1Q9kfzlB8PDzkFSYMgTRB1JfbleLBaqnviMYn7MWW4CG7/xL6hjbElKNo14 gmJSvbOGWteTH8BIykzQFgef/ngKDt0Sg56ylSppx36Hki0V1gGdEPBJDrlV4lT7tq+k uPsTKxJCjdk7QRkcXjgoMHmkaC7JaEpnFmoFuVb6hkzmNgrJwpdw3YQtKmaNsIywOXMQ VHPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=+n1LUw8DJLUyTXbv9Oe2r81KbedmVRu6OMKCTfy3ZiQ=; b=Z5jPZqZBfz0J4fmE34yx8pHSUaAcpB7+xTuvPgwTgNtDWk6e2spFDTLFBRyy6ylMqY H9lRDiQV0PKdNskZCk6mRWEfHC5of17aHLeHwh3g3rQZphe9rytzHNwYxt6zmwY4w2oD c+T039aPZPh5hNFVp3jklNRNrabC6KzPBDcRLM0J8XY2qXybJqiFeZZe+J3fl5YdEX8H 2RK/6wjQaqVb7YZJ56cQdnEwfPjRT4FFd0hPlZeZKu20nroOoLZW3DemQms5TUfe7bzL 7A8jfpxj/TBQON/YFAONol+cE8j36TYjUf4jfjZO8w6GtfIl0UztCuhLsmE2mepaCtzC bDHQ== X-Gm-Message-State: AOAM531CTAm9iCUWcNKhY3QnOuVDV+0ad//LHAYt15hHdXu2yDAWf+cI mNmj5wYf0yo8G1g4jPZzp8b3NX2foMw= X-Google-Smtp-Source: ABdhPJy4Ky3Al50cuQO6kqOXG7d2vNlasxYBXERWMS28MgJ0beqiTabAX+wsLbbYFzmtVPKC3nhGlkrYfuA= X-Received: by 2002:a25:f30c:: with SMTP id c12mr55236202ybs.471.1597199385901; Tue, 11 Aug 2020 19:29:45 -0700 (PDT) Date: Tue, 11 Aug 2020 19:29:34 -0700 In-Reply-To: <20200812022934.568134-1-badhri@google.com> Message-Id: <20200812022934.568134-2-badhri@google.com> Mime-Version: 1.0 References: <20200812022934.568134-1-badhri@google.com> X-Mailer: git-send-email 2.28.0.236.gb10cc79966-goog Subject: [PATCH 2/2 v3] usb: typec: pd: Fix formatting in pd.h header From: Badhri Jagan Sridharan To: Heikki Krogerus , Greg Kroah-Hartman , Guenter Roeck Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Badhri Jagan Sridharan Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Replacing spaces with tabs for PD_T_* constants. Signed-off-by: Badhri Jagan Sridharan Reviewed-by: Guenter Roeck Reviewed-by: Heikki Krogerus --- Change history: First version. Keeping the version number same as the parent. --- include/linux/usb/pd.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/usb/pd.h b/include/linux/usb/pd.h index 1df895e4680b..f842e4589bd2 100644 --- a/include/linux/usb/pd.h +++ b/include/linux/usb/pd.h @@ -471,9 +471,10 @@ static inline unsigned int rdo_max_power(u32 rdo) #define PD_T_VCONN_SOURCE_ON 100 #define PD_T_SINK_REQUEST 100 /* 100 ms minimum */ #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_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_BIST_CONT_MODE 50 /* 30 - 60 ms */ #define PD_T_DRP_TRY 100 /* 75 - 150 ms */ #define PD_T_DRP_TRYWAIT 600 /* 400 - 800 ms */ @@ -484,5 +485,4 @@ static inline unsigned int rdo_max_power(u32 rdo) #define PD_N_CAPS_COUNT (PD_T_NO_RESPONSE / PD_T_SEND_SOURCE_CAP) #define PD_N_HARD_RESET_COUNT 2 -#define PD_T_BIST_CONT_MODE 50 /* 30 - 60 ms */ #endif /* __LINUX_USB_PD_H */