Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7203425pxb; Thu, 18 Feb 2021 04:25:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJwFmlhy5zRuAfWM7z67M7rjnmufNYzHIWJdCl/SXCXtxszix9+KlgT6fXRycrYVeC7FBpJ2 X-Received: by 2002:a17:906:a57:: with SMTP id x23mr3779604ejf.40.1613651138484; Thu, 18 Feb 2021 04:25:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613651138; cv=none; d=google.com; s=arc-20160816; b=YTxxZmwW24+pCbhULZhQzx2B2yhOMZQ3WqL4OI3Ao5OBMU9njRbfW055hpvk3WwtfY s+jXFWOME+XASW2yDJwV6dgxJCvq10YF7nnGPWYsKislvVrNRCpyBH5/DOBJgGMYmd/Y J1WXYnuiEWz1/IhoJZRDc3fJAAR+DYrbSBdIvE5IO8dAWq3UneayeQuQEjATdQVIW1As zaXly4zhLdJcGFIYGNkg6nis5RGL3xXF2Fh6osmrlVP7y0u2uySipp8KZ4Nx0HkMe9k6 REIHAs9p3oFeiOdjY4jxR8aVpzTgKE9BExlXHLV3xzHClHZkO2yt15Weo9euTXP62OLg r0lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=YOMMWx83sVK5s2KM8oWsXJouuzi+vPSeQ0UYQiVlDHo=; b=kF3ucbyslUddz0QM0p0OpaaefjQtDXr2MHHyRldOx6qAkOhtiYuwDXeEr20EXFB3sN OGCkMsYK0jCJFQA9wkDbOEXobon2IVn/goaNQTsqNQQkKevAbLdor4MQFflcEOv4KlvM dttV0/7wcs1btof7e0FN4fL5oWTnbdmJXknKCV+Gux+FV/NEMWz9D6zKJuQv3seVeFWL OgnnJr8kKzs/oFakwhae0d4pavfALYJSCVKgMIeszbxzNs1e2lPhWSaeAsCYRAkSxKjY oiOiMc5av79v9umACnwzzCHt0Btup58HXzLi3PJdn+uKZ1mnC7aHrg/HF85QaK2uYENH B4iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=c9BPEGK3; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x5si3805746edi.139.2021.02.18.04.25.12; Thu, 18 Feb 2021 04:25:38 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=c9BPEGK3; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232457AbhBRMV4 (ORCPT + 99 others); Thu, 18 Feb 2021 07:21:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232131AbhBRKsu (ORCPT ); Thu, 18 Feb 2021 05:48:50 -0500 Received: from mail-vk1-xa32.google.com (mail-vk1-xa32.google.com [IPv6:2607:f8b0:4864:20::a32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89B33C0613D6 for ; Thu, 18 Feb 2021 02:39:22 -0800 (PST) Received: by mail-vk1-xa32.google.com with SMTP id j188so312507vke.13 for ; Thu, 18 Feb 2021 02:39:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YOMMWx83sVK5s2KM8oWsXJouuzi+vPSeQ0UYQiVlDHo=; b=c9BPEGK3whetKJ6sOLH5PlmsnME8gyj1FGRVbxRKxYxf2UwAwymKeA5i/DtAjtui/q dTghxChZ0MwNq3RmRuCHNsKs4Yhg7C6YL+oqu0koUHEZpIvqmjNe4lAQvGk0pccqZ+j9 AaB56ANM8+auv7mRc1MaO00zR9BzFgiL1nCWmm+gLu7IDi44vQJJsqHcQH2CYPuT2Tu+ /N7mLzN30IN6D3UPBlea3gP+0zD+/ki9SglVgbeT2CT9NNA9vf1saZTdYWQzYtS9TzGH EtTMqYiT0qFI3i5psPFes07/aHSOYzJcs9NPw+eIfCTFeGbmgHka4VWstntjVbz9mBCt N0vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YOMMWx83sVK5s2KM8oWsXJouuzi+vPSeQ0UYQiVlDHo=; b=AzHVwN6Cz5fxwOecJ33PwE3bLP1mjQwv2HglXj+FfQ+yPvBs/WuDHFi2iAHfDwWsV5 OvAYmxZyjCdP5E4hnIhY+z8SsNxb7IxyYspdkq3QJaZla9vFx/psCOx7Id3cOLrLEcw7 /zjURUf5FbQd5gfMtNm34ZZ+QRQ2sDKiKJu9otBayztTsVPs9ZzhEBW9QaH3/tD0+dPA KEkL/XQo0sCwqk3AVaJB8S7bbiU+wepLBMngAF3xGOoOXCf51goXsL85QAgznB+3CrPB 9unFL9cH1zRF8eOrg1Wp7LGivG9b9MoAaa9k2A7pCTORHGiMoZAVPcrLpezLznHD7xfj 1gZg== X-Gm-Message-State: AOAM533y43X+E5C5ZwvlKmUJ3Mt9tRXXUmjKnHybFHisoLnli/GZ505d ZumijCbQZmSNDQ4n3FiAzu9ghJNBM6E2pqmbRskXlg== X-Received: by 2002:a1f:df06:: with SMTP id w6mr373486vkg.18.1613644761430; Thu, 18 Feb 2021 02:39:21 -0800 (PST) MIME-Version: 1.0 References: <20210218100243.32187-1-badhri@google.com> In-Reply-To: From: Badhri Jagan Sridharan Date: Thu, 18 Feb 2021 02:38:45 -0800 Message-ID: Subject: Re: [PATCH v1] usb: typec: tcpm: Wait for vbus discharge to VSAFE0V before toggling To: Greg Kroah-Hartman Cc: Guenter Roeck , Heikki Krogerus , Kyle Tso , USB , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, This patch is a bug fix for the following patch which was introduced in 5.11. commit f321a02caebdd0c56e167610cda2fa148cd96e8b Author: Badhri Jagan Sridharan Date: Wed Oct 28 23:31:35 2020 -0700 usb: typec: tcpm: Implement enabling Auto Discharge disconnect support TCPCI spec allows TCPC hardware to autonomously discharge the vbus capacitance upon disconnect. The expectation is that the TCPM enables AutoDischargeDisconnect while entering SNK/SRC_ATTACHED states. Hardware then automously discharges vbus when the vbus falls below a certain threshold i.e. VBUS_SINK_DISCONNECT_THRESHOLD. Apart from enabling the vbus discharge circuit, AutoDischargeDisconnect is also used a flag to move TCPCI based TCPC implementations into Attached.Snk/Attached.Src state as mentioned in Figure 4-15. TCPC State Diagram before a Connection of the USB Type-C Port Controller Interface Specification. In such TCPC implementations, setting AutoDischargeDisconnect would prevent TCPC into entering "Connection_Invalid" state as well. Signed-off-by: Badhri Jagan Sridharan Reviewed-by: Heikki Krogerus Link: https://lore.kernel.org/r/20201029063138.1429760-8-badhri@google.com Signed-off-by: Greg Kroah-Hartman Thanks, Badhri On Thu, Feb 18, 2021 at 2:10 AM Greg Kroah-Hartman wrote: > > On Thu, Feb 18, 2021 at 02:02:43AM -0800, Badhri Jagan Sridharan wrote: > > When vbus auto discharge is enabled, TCPM can sometimes be faster than > > the TCPC i.e. TCPM can go ahead and move the port to unattached state > > (involves disabling vbus auto discharge) before TCPC could effectively > > discharge vbus to VSAFE0V. This leaves vbus with residual charge and > > increases the decay time which prevents tsafe0v from being met. > > This change introduces a new state VBUS_DISCHARGE where the TCPM waits > > for a maximum of tSafe0V(max) for vbus to discharge to VSAFE0V before > > transitioning to unattached state and re-enable toggling. If vbus > > discharges to vsafe0v sooner, then, transition to unattached state > > happens right away. > > > > Also, while in SNK_READY, when auto discharge is enabled, drive > > disconnect based on vbus turning off instead of Rp disappearing on > > CC pins. Rp disappearing on CC pins is almost instanteous compared > > to vbus decay. > > > > Signed-off-by: Badhri Jagan Sridharan > > --- > > drivers/usb/typec/tcpm/tcpm.c | 60 +++++++++++++++++++++++++++++++---- > > 1 file changed, 53 insertions(+), 7 deletions(-) > > As this seems to be a bugfix, what commit does it fix? Should it go to > stable kernels? If so, how far back? > > And as this is the merge window, I can't do anything with this until > 5.12-rc1 is out, so be prepared for the delay... > > thanks, > > greg k-h