linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@kernel.org>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: gregkh@linuxfoundation.org, shawnguo@kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com, linux-imx@nxp.com, balbi@ti.com,
	linux-usb@vger.kernel.org, jun.li@nxp.com
Subject: Re: [PATCH 3/3] usb: phy: mxs: disconnect line when USB charger is attached
Date: Mon, 10 Jul 2023 11:21:33 +0800	[thread overview]
Message-ID: <20230710032133.GF2418446@nchen-desktop> (raw)
In-Reply-To: <20230627110353.1879477-3-xu.yang_2@nxp.com>

On 23-06-27 19:03:53, Xu Yang wrote:
> For mxs PHY, if there is a vbus but the bus is not enumerated, we need
> to force the dp/dm as SE0 from the controller side. If not, there is
> possible USB wakeup due to unstable dp/dm, since there is possible no
> pull on dp/dm, such as there is a USB charger on the port.
> 
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>

Acked-by: Peter Chen <peter.chen@kernel.org>

Peter
> ---
>  drivers/usb/phy/phy-mxs-usb.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
> index f484c79efa6c..619411aab86c 100644
> --- a/drivers/usb/phy/phy-mxs-usb.c
> +++ b/drivers/usb/phy/phy-mxs-usb.c
> @@ -395,6 +395,7 @@ static bool mxs_phy_is_otg_host(struct mxs_phy *mxs_phy)
>  static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on)
>  {
>  	bool vbus_is_on = false;
> +	enum usb_phy_events last_event = mxs_phy->phy.last_event;
>  
>  	/* If the SoCs don't need to disconnect line without vbus, quit */
>  	if (!(mxs_phy->data->flags & MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS))
> @@ -406,7 +407,8 @@ static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on)
>  
>  	vbus_is_on = mxs_phy_get_vbus_status(mxs_phy);
>  
> -	if (on && !vbus_is_on && !mxs_phy_is_otg_host(mxs_phy))
> +	if (on && ((!vbus_is_on && !mxs_phy_is_otg_host(mxs_phy))
> +		|| (last_event == USB_EVENT_VBUS)))
>  		__mxs_phy_disconnect_line(mxs_phy, true);
>  	else
>  		__mxs_phy_disconnect_line(mxs_phy, false);
> -- 
> 2.34.1
> 

-- 

Thanks,
Peter Chen

  reply	other threads:[~2023-07-10  3:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 11:03 [PATCH 1/3] usb: chipidea: add USB PHY event Xu Yang
2023-06-27 11:03 ` [PATCH 2/3] usb: phy: mxs: fix getting wrong state with mxs_phy_is_otg_host() Xu Yang
2023-07-10  3:20   ` Peter Chen
2023-07-26  6:08   ` Francesco Dolcini
2023-07-26  6:40     ` [EXT] " Xu Yang
2023-06-27 11:03 ` [PATCH 3/3] usb: phy: mxs: disconnect line when USB charger is attached Xu Yang
2023-07-10  3:21   ` Peter Chen [this message]
2023-07-10  3:19 ` [PATCH 1/3] usb: chipidea: add USB PHY event Peter Chen
2023-07-18 12:27 ` Luca Ceresoli
2024-08-27  6:10 ` Pu, Hui
2024-08-29  9:17   ` Xu Yang
2024-08-29  9:59     ` Pu, Hui
2024-09-02  7:59 ` Xu Yang
2024-09-02  8:49   ` Greg KH

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=20230710032133.GF2418446@nchen-desktop \
    --to=peter.chen@kernel.org \
    --cc=balbi@ti.com \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jun.li@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-imx@nxp.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).