From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: linux@roeck-us.net, linux-usb@vger.kernel.org,
gregkh@linuxfoundation.org, jun.li@nxp.com
Subject: Re: [PATCH] usb: typec: tcpm: reset counter when enter into unattached state after try role
Date: Wed, 23 Aug 2023 09:52:37 +0300 [thread overview]
Message-ID: <ZOWstZYPGFDj/acA@kuha.fi.intel.com> (raw)
In-Reply-To: <20230820151518.1403006-1-xu.yang_2@nxp.com>
On Sun, Aug 20, 2023 at 11:15:18PM +0800, Xu Yang wrote:
> The try_src_count and try_snk_count may still be 1 after enter into
> unattached state. This may be caused by below case:
> - SNK_TRY->SNK_TRY_WAIT->SRC_TRYWAIT->SNK_UNATTACHED
> - SRC_TRY->SRC_TRY_WAIT->SNK_TRYWAIT->SNK_UNATTACHED
>
> The port->attached is not true at the end and tcpm_reset_port() will not
> be called. This will reset counter into for these cases, otherwise the tcpm
> won't try role when new cable attached.
>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 5639b9a1e0bf..c9a186a8c58c 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -3719,6 +3719,9 @@ static void tcpm_detach(struct tcpm_port *port)
> if (tcpm_port_is_disconnected(port))
> port->hard_reset_count = 0;
>
> + port->try_src_count = 0;
> + port->try_snk_count = 0;
> +
> if (!port->attached)
> return;
>
> --
> 2.34.1
--
heikki
next prev parent reply other threads:[~2023-08-23 6:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-20 15:15 [PATCH] usb: typec: tcpm: reset counter when enter into unattached state after try role Xu Yang
2023-08-23 6:52 ` Heikki Krogerus [this message]
2023-08-23 13:25 ` Guenter Roeck
2024-02-10 17:28 ` Ondřej Jirman
2024-02-19 8:36 ` [EXT] " Xu Yang
2024-02-24 3:42 ` Ondřej Jirman
2024-02-26 2:44 ` Xu Yang
2024-02-26 10:00 ` Ondřej Jirman
2024-02-26 10:32 ` Xu Yang
2024-03-01 17:25 ` Ondřej Jirman
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=ZOWstZYPGFDj/acA@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jun.li@nxp.com \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=xu.yang_2@nxp.com \
/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