Linux-USB Archive mirror
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: RD Babiera <rdbabiera@google.com>
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
Date: Thu, 25 Apr 2024 12:51:38 +0300	[thread overview]
Message-ID: <Zionqg7KXa7m8yuc@kuha.fi.intel.com> (raw)
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 <rdbabiera@google.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  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

      reply	other threads:[~2024-04-25  9:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 20:27 [PATCH v1] usb: typec: tcpm: clear pd_event queue in PORT_RESET RD Babiera
2024-04-25  9:51 ` Heikki Krogerus [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zionqg7KXa7m8yuc@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=badhri@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=rdbabiera@google.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).