Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1140469lqd; Thu, 25 Apr 2024 07:09:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV9iJ/bJxKkit3zz9ef7pTrhcsGPP6jkYUXsoh4p5/JV1Q4f25JU0X3VjTPoYw+9EtEHlSuP/YoIVJqSwlrYHkBJ83vMR47AFcEApVxvg== X-Google-Smtp-Source: AGHT+IGxqpYkr6gVb6Ocn476fpsyGllpfXszThHbNg3C31O/pqYYI5Ep//Uju1E/e7TljKHf8fUl X-Received: by 2002:a17:902:6bcb:b0:1e4:b1a2:b40c with SMTP id m11-20020a1709026bcb00b001e4b1a2b40cmr5166493plt.42.1714054177256; Thu, 25 Apr 2024 07:09:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714054177; cv=pass; d=google.com; s=arc-20160816; b=RPbAyv09IS0FnkaIGG6Wke/iuQYZa/IPYucYCxQsSnrq4cztMtoH9imanbXRrmDmmp oCsDZ4Ktq3iwtOmGcJQNphX8KlJJjriqLXrg4oiKR8XjTXOAsLT1bcrsbvOB0BoqU8ub HQV1yBsGESCY6rwhTJ7SpI4/PD9Vr0R487rrB0Vo5fsbE+VRnDXPL5KTc2bsAOVJ0weC F0CH3yW1CmwTgr5jJmAEDap732ZNr0y/hoN+Z3RBvoff5KlO4W2gZKQto8tqZo4Dvaij rvTymQp+LdQAHXsCI0GWn1DM0+Jz/BoOFIj07d+JDuZbZDy/XYbzY4aDIsWefcXgDigG CpgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=G2z+Ukt5xBnHmvN0B6W4jh5I6K6/vl0sBER1vRP9y6M=; fh=oxzGuIqiDbk9kHH7K1uF5WVDOvb56lrt25o6pvXSMXA=; b=i1rsAuEd968VHWklKwcFU2JzANpwrdyDk48UwQwe9JzO6YFPUjxSG413g0KR44gEXt hRRsrU3lg3F7xpq9tax6zPil/CvNRXN7T4QSJmmyb0me1U1+6fnstHVqPgC6E9dwh6Ao /w+1bzwu5qYURXYuUQ+388Or3YySgIyb4Bid+6G+h9bhVZPnyV4ks/Qlwv0egpmol6DR PSTom72SKI2Pc5QM97kMEWQaPpy6RN4YdtLl718fYyJewh9gVdbie//hIYDNN87lvZa4 EBDOPToIVzrL1ag9tQxETnYU9GkPDxlRHusp+x7zdgXVbpEj05BGRjqV3/lDhrCyz5l7 WsZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ir0I5AtE; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-158334-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158334-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id ix6-20020a170902f80600b001e3d3ae4d74si12974870plb.28.2024.04.25.07.09.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 07:09:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-158334-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ir0I5AtE; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-158334-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158334-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 30B1DB28DA8 for ; Thu, 25 Apr 2024 09:51:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4EF5186250; Thu, 25 Apr 2024 09:51:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ir0I5AtE" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BFFC6AFB6; Thu, 25 Apr 2024 09:51:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714038704; cv=none; b=RZ6kPHaezzAZW5H4M1if4aCIeqPoRJ4je52Se2xFv0qXuIYGbMyiBQPCsl4E6niS19fby961/mRlpt1knP4CuaTCBXUYHR9oECUYGAF9eW3MPVdT2DAxOyPnThacF5nkeN8EZ0/WHTBiHrJjtF/As7xjJCIgMJIwHb5wnkOgv7Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714038704; c=relaxed/simple; bh=lU8tV3G8euvf2o7zJo7VAJNX9vi9q7wDMvvI2z8B19M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gyzKXgFKx2b7F1/AYDtiCVLUZ/+ILqCWzrS5HCP/tguuJ5+dLyG+7Bg9PCvehOZJHGnyRhFHqWbwq5tB1i4ClKGKLFZ/fNQdBXOu5p4UTWdrL3Io9228L/l+OLXa3Fcc+56SZjIiUB4IHbo9rde/DfrFlhlTs8djdZmv5Kl38SI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ir0I5AtE; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714038703; x=1745574703; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=lU8tV3G8euvf2o7zJo7VAJNX9vi9q7wDMvvI2z8B19M=; b=ir0I5AtElYTuA0Ys5cSxrMoP+hlNkMISMt5bN0u0+8jmhqR7XlFOhH82 uvQ2+J6S5rVMi3uskzkEVL3LFAe6WKm41T0sVhEdFPHGrfH1zzU+yl/EX 0ABSJOFekw6ZqdNBDaACIoQ11wsrCYJZeYKhOYXLiaN2GWzKbwQnw2Vyy XQl73AgR4K2vzjn8aUUkt5uFTe8iwxIaV34kyaUvzix+/pW4cjMUqL4s7 XCbhnyEgeGzHBtdPPv2SZrEiAdubas37J6o2iCc4OEwtrCSYpdh3tAG6X hz9V2ds/KmtwVBcAqSnMUh5TPy3r6AyH+wnanBwL2SdgBEueVM+nw+H4m w==; X-CSE-ConnectionGUID: hY+1uHJzS6SSUt/MaHc89A== X-CSE-MsgGUID: BkTvoFmTSfej5F6x/ok+Iw== X-IronPort-AV: E=McAfee;i="6600,9927,11054"; a="21133659" X-IronPort-AV: E=Sophos;i="6.07,229,1708416000"; d="scan'208";a="21133659" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2024 02:51:42 -0700 X-CSE-ConnectionGUID: 8qPQ5SUIS6eAAHnrJAef6w== X-CSE-MsgGUID: JDYMhXx7TxC/X5eesRDeOQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,229,1708416000"; d="scan'208";a="25006598" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmviesa009.fm.intel.com with SMTP; 25 Apr 2024 02:51:39 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Thu, 25 Apr 2024 12:51:38 +0300 Date: Thu, 25 Apr 2024 12:51:38 +0300 From: Heikki Krogerus To: RD Babiera Cc: linux@roeck-us.net, gregkh@linuxfoundation.org, badhri@google.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v1] usb: typec: tcpm: clear pd_event queue in PORT_RESET Message-ID: References: <20240423202715.3375827-2-rdbabiera@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240423202715.3375827-2-rdbabiera@google.com> On Tue, Apr 23, 2024 at 08:27:16PM +0000, RD Babiera wrote: > When a Fast Role Swap control message attempt results in a transition > to ERROR_RECOVERY, the TCPC can still queue a TCPM_SOURCING_VBUS event. > > If the event is queued but processed after the tcpm_reset_port() call > in the PORT_RESET state, then the following occurs: > 1. tcpm_reset_port() calls tcpm_init_vbus() to reset the vbus sourcing and > sinking state > 2. tcpm_pd_event_handler() turns VBUS on before the port is in the default > state. > 3. The port resolves as a sink. In the SNK_DISCOVERY state, > tcpm_set_charge() cannot set vbus to charge. > > Clear pd events within PORT_RESET to get rid of non-applicable events. > > Fixes: b17dd57118fe ("staging: typec: tcpm: Improve role swap with non PD capable partners") > Cc: stable@vger.kernel.org > Signed-off-by: RD Babiera Reviewed-by: Heikki Krogerus > --- > drivers/usb/typec/tcpm/tcpm.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index c26fb70c3ec6..6dcafbaf10a2 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -5605,6 +5605,7 @@ static void run_state_machine(struct tcpm_port *port) > break; > case PORT_RESET: > tcpm_reset_port(port); > + port->pd_events = 0; > if (port->self_powered) > tcpm_set_cc(port, TYPEC_CC_OPEN); > else > > base-commit: 684e9f5f97eb4b7831298ffad140d5c1d426ff27 > -- > 2.44.0.769.g3c40516874-goog -- heikki