Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4233315pxb; Tue, 25 Jan 2022 06:21:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwytyxrfeSbby38hj1uyLFWV5GJuZ5k88trTY3G22VAXgNGBEXj/HxnOUPc1FkDPqkMS9ZA X-Received: by 2002:a05:6a00:cc5:b0:4c3:832a:1180 with SMTP id b5-20020a056a000cc500b004c3832a1180mr19036969pfv.10.1643120474066; Tue, 25 Jan 2022 06:21:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643120474; cv=none; d=google.com; s=arc-20160816; b=wpN8/KRmfK6uWZPGAsGRmP+OLcU+aJusFfUg3xoy3LSMUbqHWT6Q7SZw/IkaEgsHIW baA4H6WAD6tpAPTn00QB+kAi5DfcGOqd6USaVQU0lLvGC6QPRRQZHDu+ZtL4a7zlipSn xJ59qlTulPJqaBno0yn4qdYkXAdyZOm8RWswMM0vuxTZJFfAXo9KwCv7nxleLXjoE5PV CkTmoO7jX1u3ItDmKyqvqatwR+g3aW5OpcKPnjvHQhu0znB4vgvJGGF2+2tJBQi/QaPl yPZCNooQm+WPnvroLlQUDzRkNRDDPWPkFH6CkNx1EmH7+PBkA/p5wsOXGCROmo0eszHh Ex6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=uPUWupQ236oPAWb5vUPTrmarcoTxumffiTZG4hGNTCE=; b=XQ1O5sFVIzruADSikCjH7qj8fFvzHy2UaICx6XQ6rs8yPDldrqwwCgCEdigPXP3o40 +7sYlyKrO+Ks10Ra11v2hhpAZjVZqw7dZqV4F6JWHZk9liyFuP5/Q34X46In8uGUVGR8 AvgBZoGnf5USiEw2ZDiICtP5LJ98w1cTasL+JzAcfvso/P4NJgTKmxV4Z1gY25yOTjOn DLZQPNfYKafB74zQjJlVff+qC4yjmn9E64QBqCxH4jVYChqddJX+skjZHtFlLNx3udFK cvWdlfz2Z3dE4fbv7Yer1fk3GqfNm5CLwxvU4mV2b04u83Fv0ItMuzE7gFDOmwjLWHl1 D9lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=d+Oohpr4; 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=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 b7si3600646pgg.211.2022.01.25.06.20.59; Tue, 25 Jan 2022 06:21:14 -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=@intel.com header.s=Intel header.b=d+Oohpr4; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573459AbiAYJ37 (ORCPT + 99 others); Tue, 25 Jan 2022 04:29:59 -0500 Received: from mga05.intel.com ([192.55.52.43]:4621 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455982AbiAYJH5 (ORCPT ); Tue, 25 Jan 2022 04:07:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643101677; x=1674637677; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=EXHV5EA/AYibvFLmGk7sya8bHLZVSKVgJE8RlOP/3M4=; b=d+Oohpr4xoZ7nJb3hdJ5XGCckgXHLVCVpNvpJQstOIXCcXO2tuYV6ux/ FvdxkHFqqeRWDU+fmMqcBaXvg1gFaowSepMeflWsEmp6qQ0/eE4nph6vi /9sjQq0CUhdTEzXYszc5KSKQTj+LmX5gSicEIYV2dIG4L6/KbFFToENOn I8UyXKUPXhcZG6Ry8SlPQTPllx0sTKzR5xFhZgLqyTa8+ya+Q0MRfVEu/ cBce8rRe3g7nLFpwBic8JcjmQJVvborErJ6qoA+yGA3937HCkoueQaqet 8B+y/ReOHolUQPWl8nVdAmV22/WsxPCaJTa5sMJAVeSOxgWEDz0wPo9DD Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10237"; a="332613043" X-IronPort-AV: E=Sophos;i="5.88,314,1635231600"; d="scan'208";a="332613043" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2022 01:02:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,314,1635231600"; d="scan'208";a="673927566" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 25 Jan 2022 01:02:26 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Tue, 25 Jan 2022 11:02:25 +0200 Date: Tue, 25 Jan 2022 11:02:25 +0200 From: Heikki Krogerus To: Badhri Jagan Sridharan Cc: Guenter Roeck , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Kyle Tso , stable@vger.kernel.org Subject: Re: [PATCH v1 2/2] usb: typec: tcpm: Do not disconnect when receiving VSAFE0V Message-ID: References: <20220122015520.332507-1-badhri@google.com> <20220122015520.332507-2-badhri@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220122015520.332507-2-badhri@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 21, 2022 at 05:55:20PM -0800, Badhri Jagan Sridharan wrote: > With some chargers, vbus might momentarily raise above VSAFE5V and fall > back to 0V causing VSAFE0V to be triggered. This will > will report a VBUS off event causing TCPM to transition to > SNK_UNATTACHED state where it should be waiting in either SNK_ATTACH_WAIT > or SNK_DEBOUNCED state. This patch makes TCPM avoid VSAFE0V events > while in SNK_ATTACH_WAIT or SNK_DEBOUNCED state. > > Stub from the spec: > "4.5.2.2.4.2 Exiting from AttachWait.SNK State > A Sink shall transition to Unattached.SNK when the state of both > the CC1 and CC2 pins is SNK.Open for at least tPDDebounce. > A DRP shall transition to Unattached.SRC when the state of both > the CC1 and CC2 pins is SNK.Open for at least tPDDebounce." > > [23.194131] CC1: 0 -> 0, CC2: 0 -> 5 [state SNK_UNATTACHED, polarity 0, connected] > [23.201777] state change SNK_UNATTACHED -> SNK_ATTACH_WAIT [rev3 NONE_AMS] > [23.209949] pending state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED @ 170 ms [rev3 NONE_AMS] > [23.300579] VBUS off > [23.300668] state change SNK_ATTACH_WAIT -> SNK_UNATTACHED [rev3 NONE_AMS] > [23.301014] VBUS VSAFE0V > [23.301111] Start toggling > > Fixes: 28b43d3d746b8 ("usb: typec: tcpm: Introduce vsafe0v for vbus") > Cc: stable@vger.kernel.org > Signed-off-by: Badhri Jagan Sridharan Acked-by: Heikki Krogerus > --- > drivers/usb/typec/tcpm/tcpm.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index b8afe3d8c882..5fce795b69c7 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -5264,6 +5264,10 @@ static void _tcpm_pd_vbus_vsafe0v(struct tcpm_port *port) > case PR_SWAP_SNK_SRC_SOURCE_ON: > /* Do nothing, vsafe0v is expected during transition */ > break; > + case SNK_ATTACH_WAIT: > + case SNK_DEBOUNCED: > + /*Do nothing, still waiting for VSAFE5V for connect */ > + break; > default: > if (port->pwr_role == TYPEC_SINK && port->auto_vbus_discharge_enabled) > tcpm_set_state(port, SNK_UNATTACHED, 0); > -- > 2.35.0.rc0.227.g00780c9af4-goog -- heikki