linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 1/2] usb: gadget: core: change the comment for usb_gadget_connect
@ 2020-10-13  9:27 Peter Chen
  2020-10-13  9:27 ` [PATCH RESEND 2/2] usb: gadget: core: do not try to disconnect gadget if it is not connected Peter Chen
  2020-12-01  6:46 ` [PATCH RESEND 1/2] usb: gadget: core: change the comment for usb_gadget_connect Peter Chen
  0 siblings, 2 replies; 7+ messages in thread
From: Peter Chen @ 2020-10-13  9:27 UTC (permalink / raw)
  To: balbi; +Cc: linux-usb, linux-imx, Peter Chen

The pullup does not need to be enabled at below situations:
- For platforms which the hardware pullup starts after setting
register even they do not see the VBUS. If the pullup is always
enabled for these platforms, it will consume more power and
break the USB IF compliance tests [1].
- For platforms which need to do BC 1.2 charger detection after
seeing the VBUS. Pullup D+ will break the charger detection
flow.
- For platforms which the system suspend is allowed when the
connection with host is there but the bus is not at suspend.
For these platforms, it is better to disable pullup when
entering the system suspend otherwise the host may confuse
the device behavior after controller is in low power mode.
Disable pullup is considered as a disconnection event from
host side.

[1] USB-IF Full and Low Speed Compliance Test Procedure
F Back-voltage Testing
Section 7.2.1 of the USB specification requires that no device
shall supply (source) current on VBUS at its upstream facing
port at any time. From VBUS on its upstream facing port,
a device may only draw (sink) current. They may not provide power
to the pull-up resistor on D+/D- unless VBUS is present (see
Section 7.1.5).

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/usb/gadget/udc/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
index debf54205d22..215ecbe8b692 100644
--- a/drivers/usb/gadget/udc/core.c
+++ b/drivers/usb/gadget/udc/core.c
@@ -659,8 +659,7 @@ EXPORT_SYMBOL_GPL(usb_gadget_vbus_disconnect);
  *
  * Enables the D+ (or potentially D-) pullup.  The host will start
  * enumerating this gadget when the pullup is active and a VBUS session
- * is active (the link is powered).  This pullup is always enabled unless
- * usb_gadget_disconnect() has been used to disable it.
+ * is active (the link is powered).
  *
  * Returns zero on success, else negative errno.
  */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH RESEND 2/2] usb: gadget: core: do not try to disconnect gadget if it is not connected
  2020-10-13  9:27 [PATCH RESEND 1/2] usb: gadget: core: change the comment for usb_gadget_connect Peter Chen
@ 2020-10-13  9:27 ` Peter Chen
  2020-10-29 10:45   ` Peter Chen
  2020-12-01  6:46 ` [PATCH RESEND 1/2] usb: gadget: core: change the comment for usb_gadget_connect Peter Chen
  1 sibling, 1 reply; 7+ messages in thread
From: Peter Chen @ 2020-10-13  9:27 UTC (permalink / raw)
  To: balbi; +Cc: linux-usb, linux-imx, Peter Chen

Current UDC core connects gadget during the loading gadget flow
(udc_bind_to_driver->usb_udc_connect_control), but for
platforms which do not connect gadget if the VBUS is not there,
they call usb_gadget_disconnect, but the gadget is not connected
at this time, notify disconnecton for the gadget driver is meaningless
at this situation.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/usb/gadget/udc/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
index 215ecbe8b692..8ad4203dea8c 100644
--- a/drivers/usb/gadget/udc/core.c
+++ b/drivers/usb/gadget/udc/core.c
@@ -672,6 +672,9 @@ int usb_gadget_connect(struct usb_gadget *gadget)
 		goto out;
 	}
 
+	if (!gadget->connected)
+		goto out;
+
 	if (gadget->deactivated) {
 		/*
 		 * If gadget is deactivated we only save new state.
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH RESEND 2/2] usb: gadget: core: do not try to disconnect gadget if it is not connected
  2020-10-13  9:27 ` [PATCH RESEND 2/2] usb: gadget: core: do not try to disconnect gadget if it is not connected Peter Chen
@ 2020-10-29 10:45   ` Peter Chen
  2020-12-01  6:45     ` Peter Chen
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Chen @ 2020-10-29 10:45 UTC (permalink / raw)
  To: Peter Chen; +Cc: balbi, USB list, linux-imx

On Tue, Oct 13, 2020 at 8:01 PM Peter Chen <peter.chen@nxp.com> wrote:
>
> Current UDC core connects gadget during the loading gadget flow
> (udc_bind_to_driver->usb_udc_connect_control), but for
> platforms which do not connect gadget if the VBUS is not there,
> they call usb_gadget_disconnect, but the gadget is not connected
> at this time, notify disconnecton for the gadget driver is meaningless
> at this situation.
>
> Signed-off-by: Peter Chen <peter.chen@nxp.com>
> ---
>  drivers/usb/gadget/udc/core.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
> index 215ecbe8b692..8ad4203dea8c 100644
> --- a/drivers/usb/gadget/udc/core.c
> +++ b/drivers/usb/gadget/udc/core.c
> @@ -672,6 +672,9 @@ int usb_gadget_connect(struct usb_gadget *gadget)
>                 goto out;
>         }
>
> +       if (!gadget->connected)
> +               goto out;
> +
>         if (gadget->deactivated) {
>                 /*
>                  * If gadget is deactivated we only save new state.
> --
> 2.17.1
>

A gentle ping.

Peter

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH RESEND 2/2] usb: gadget: core: do not try to disconnect gadget if it is not connected
  2020-10-29 10:45   ` Peter Chen
@ 2020-12-01  6:45     ` Peter Chen
       [not found]       ` <CAL411-pgUVSieBSCa1D8CLL+qSJ8SHTVWt998XgJp0UVNWp1Mg@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Chen @ 2020-12-01  6:45 UTC (permalink / raw)
  To: Peter Chen; +Cc: balbi, USB list, linux-imx

BR,
Peter Chen

On Thu, Oct 29, 2020 at 6:45 PM Peter Chen <hzpeterchen@gmail.com> wrote:
>
> On Tue, Oct 13, 2020 at 8:01 PM Peter Chen <peter.chen@nxp.com> wrote:
> >
> > Current UDC core connects gadget during the loading gadget flow
> > (udc_bind_to_driver->usb_udc_connect_control), but for
> > platforms which do not connect gadget if the VBUS is not there,
> > they call usb_gadget_disconnect, but the gadget is not connected
> > at this time, notify disconnecton for the gadget driver is meaningless
> > at this situation.
> >
> > Signed-off-by: Peter Chen <peter.chen@nxp.com>
> > ---
> >  drivers/usb/gadget/udc/core.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
> > index 215ecbe8b692..8ad4203dea8c 100644
> > --- a/drivers/usb/gadget/udc/core.c
> > +++ b/drivers/usb/gadget/udc/core.c
> > @@ -672,6 +672,9 @@ int usb_gadget_connect(struct usb_gadget *gadget)
> >                 goto out;
> >         }
> >
> > +       if (!gadget->connected)
> > +               goto out;
> > +
> >         if (gadget->deactivated) {
> >                 /*
> >                  * If gadget is deactivated we only save new state.
> > --
> > 2.17.1
> >
>
> A gentle ping.
>

ping again.

Peter

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH RESEND 1/2] usb: gadget: core: change the comment for usb_gadget_connect
  2020-10-13  9:27 [PATCH RESEND 1/2] usb: gadget: core: change the comment for usb_gadget_connect Peter Chen
  2020-10-13  9:27 ` [PATCH RESEND 2/2] usb: gadget: core: do not try to disconnect gadget if it is not connected Peter Chen
@ 2020-12-01  6:46 ` Peter Chen
       [not found]   ` <CAL411-pcwrRyPCnq79JHZRH4db39Ke31E4tNH2W3vAbwJc=2xA@mail.gmail.com>
  1 sibling, 1 reply; 7+ messages in thread
From: Peter Chen @ 2020-12-01  6:46 UTC (permalink / raw)
  To: Peter Chen; +Cc: balbi, USB list, linux-imx

On Tue, Oct 13, 2020 at 8:01 PM Peter Chen <peter.chen@nxp.com> wrote:
>
> The pullup does not need to be enabled at below situations:
> - For platforms which the hardware pullup starts after setting
> register even they do not see the VBUS. If the pullup is always
> enabled for these platforms, it will consume more power and
> break the USB IF compliance tests [1].
> - For platforms which need to do BC 1.2 charger detection after
> seeing the VBUS. Pullup D+ will break the charger detection
> flow.
> - For platforms which the system suspend is allowed when the
> connection with host is there but the bus is not at suspend.
> For these platforms, it is better to disable pullup when
> entering the system suspend otherwise the host may confuse
> the device behavior after controller is in low power mode.
> Disable pullup is considered as a disconnection event from
> host side.
>
> [1] USB-IF Full and Low Speed Compliance Test Procedure
> F Back-voltage Testing
> Section 7.2.1 of the USB specification requires that no device
> shall supply (source) current on VBUS at its upstream facing
> port at any time. From VBUS on its upstream facing port,
> a device may only draw (sink) current. They may not provide power
> to the pull-up resistor on D+/D- unless VBUS is present (see
> Section 7.1.5).
>
> Signed-off-by: Peter Chen <peter.chen@nxp.com>
> ---
>  drivers/usb/gadget/udc/core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
> index debf54205d22..215ecbe8b692 100644
> --- a/drivers/usb/gadget/udc/core.c
> +++ b/drivers/usb/gadget/udc/core.c
> @@ -659,8 +659,7 @@ EXPORT_SYMBOL_GPL(usb_gadget_vbus_disconnect);
>   *
>   * Enables the D+ (or potentially D-) pullup.  The host will start
>   * enumerating this gadget when the pullup is active and a VBUS session
> - * is active (the link is powered).  This pullup is always enabled unless
> - * usb_gadget_disconnect() has been used to disable it.
> + * is active (the link is powered).
>   *
>   * Returns zero on success, else negative errno.
>   */
> --
> 2.17.1
>

Ping...

Peter

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH RESEND 1/2] usb: gadget: core: change the comment for usb_gadget_connect
       [not found]   ` <CAL411-pcwrRyPCnq79JHZRH4db39Ke31E4tNH2W3vAbwJc=2xA@mail.gmail.com>
@ 2020-12-29 10:17     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2020-12-29 10:17 UTC (permalink / raw)
  To: Peter Chen; +Cc: balbi, USB list, linux-imx, Peter Chen

On Tue, Dec 29, 2020 at 01:55:07PM +0800, Peter Chen wrote:
> On Tue, Dec 1, 2020 at 2:46 PM Peter Chen <hzpeterchen@gmail.com> wrote:
> 
> > On Tue, Oct 13, 2020 at 8:01 PM Peter Chen <peter.chen@nxp.com> wrote:
> > >
> > > The pullup does not need to be enabled at below situations:
> > > - For platforms which the hardware pullup starts after setting
> > > register even they do not see the VBUS. If the pullup is always
> > > enabled for these platforms, it will consume more power and
> > > break the USB IF compliance tests [1].
> > > - For platforms which need to do BC 1.2 charger detection after
> > > seeing the VBUS. Pullup D+ will break the charger detection
> > > flow.
> > > - For platforms which the system suspend is allowed when the
> > > connection with host is there but the bus is not at suspend.
> > > For these platforms, it is better to disable pullup when
> > > entering the system suspend otherwise the host may confuse
> > > the device behavior after controller is in low power mode.
> > > Disable pullup is considered as a disconnection event from
> > > host side.
> > >
> > > [1] USB-IF Full and Low Speed Compliance Test Procedure
> > > F Back-voltage Testing
> > > Section 7.2.1 of the USB specification requires that no device
> > > shall supply (source) current on VBUS at its upstream facing
> > > port at any time. From VBUS on its upstream facing port,
> > > a device may only draw (sink) current. They may not provide power
> > > to the pull-up resistor on D+/D- unless VBUS is present (see
> > > Section 7.1.5).
> > >
> > > Signed-off-by: Peter Chen <peter.chen@nxp.com>
> > > ---
> > >  drivers/usb/gadget/udc/core.c | 3 +--
> > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/usb/gadget/udc/core.c
> > b/drivers/usb/gadget/udc/core.c
> > > index debf54205d22..215ecbe8b692 100644
> > > --- a/drivers/usb/gadget/udc/core.c
> > > +++ b/drivers/usb/gadget/udc/core.c
> > > @@ -659,8 +659,7 @@ EXPORT_SYMBOL_GPL(usb_gadget_vbus_disconnect);
> > >   *
> > >   * Enables the D+ (or potentially D-) pullup.  The host will start
> > >   * enumerating this gadget when the pullup is active and a VBUS session
> > > - * is active (the link is powered).  This pullup is always enabled
> > unless
> > > - * usb_gadget_disconnect() has been used to disable it.
> > > + * is active (the link is powered).
> > >   *
> > >   * Returns zero on success, else negative errno.
> > >   */
> > > --
> > > 2.17.1
> > >
> >
> > Ping...
> >
> > Peter
> >
> 
> Greg, would you please help to catch it up?

Can you resend the patches please?  Digging it out from a response like
this is a bit difficult :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH RESEND 2/2] usb: gadget: core: do not try to disconnect gadget if it is not connected
       [not found]       ` <CAL411-pgUVSieBSCa1D8CLL+qSJ8SHTVWt998XgJp0UVNWp1Mg@mail.gmail.com>
@ 2020-12-29 10:17         ` Greg Kroah-Hartman
  0 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2020-12-29 10:17 UTC (permalink / raw)
  To: Peter Chen; +Cc: balbi, USB list, linux-imx, Peter Chen

On Tue, Dec 29, 2020 at 01:56:00PM +0800, Peter Chen wrote:
> On Tue, Dec 1, 2020 at 2:45 PM Peter Chen <hzpeterchen@gmail.com> wrote:
> 
> > BR,
> > Peter Chen
> >
> > On Thu, Oct 29, 2020 at 6:45 PM Peter Chen <hzpeterchen@gmail.com> wrote:
> > >
> > > On Tue, Oct 13, 2020 at 8:01 PM Peter Chen <peter.chen@nxp.com> wrote:
> > > >
> > > > Current UDC core connects gadget during the loading gadget flow
> > > > (udc_bind_to_driver->usb_udc_connect_control), but for
> > > > platforms which do not connect gadget if the VBUS is not there,
> > > > they call usb_gadget_disconnect, but the gadget is not connected
> > > > at this time, notify disconnecton for the gadget driver is meaningless
> > > > at this situation.
> > > >
> > > > Signed-off-by: Peter Chen <peter.chen@nxp.com>
> > > > ---
> > > >  drivers/usb/gadget/udc/core.c | 3 +++
> > > >  1 file changed, 3 insertions(+)
> > > >
> > > > diff --git a/drivers/usb/gadget/udc/core.c
> > b/drivers/usb/gadget/udc/core.c
> > > > index 215ecbe8b692..8ad4203dea8c 100644
> > > > --- a/drivers/usb/gadget/udc/core.c
> > > > +++ b/drivers/usb/gadget/udc/core.c
> > > > @@ -672,6 +672,9 @@ int usb_gadget_connect(struct usb_gadget *gadget)
> > > >                 goto out;
> > > >         }
> > > >
> > > > +       if (!gadget->connected)
> > > > +               goto out;
> > > > +
> > > >         if (gadget->deactivated) {
> > > >                 /*
> > > >                  * If gadget is deactivated we only save new state.
> > > > --
> > > > 2.17.1
> > > >
> > >
> > > A gentle ping.
> > >
> >
> > ping again.
> >
> > Peter
> >
> 
> Greg, would you please help to catch it up?

Again, can you please resend?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-12-29 10:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-13  9:27 [PATCH RESEND 1/2] usb: gadget: core: change the comment for usb_gadget_connect Peter Chen
2020-10-13  9:27 ` [PATCH RESEND 2/2] usb: gadget: core: do not try to disconnect gadget if it is not connected Peter Chen
2020-10-29 10:45   ` Peter Chen
2020-12-01  6:45     ` Peter Chen
     [not found]       ` <CAL411-pgUVSieBSCa1D8CLL+qSJ8SHTVWt998XgJp0UVNWp1Mg@mail.gmail.com>
2020-12-29 10:17         ` Greg Kroah-Hartman
2020-12-01  6:46 ` [PATCH RESEND 1/2] usb: gadget: core: change the comment for usb_gadget_connect Peter Chen
     [not found]   ` <CAL411-pcwrRyPCnq79JHZRH4db39Ke31E4tNH2W3vAbwJc=2xA@mail.gmail.com>
2020-12-29 10:17     ` Greg Kroah-Hartman

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