usb: gadget: core: change the comment for usb_gadget_connect
PATCH RESEND 1/2 usb: gadget: core: change the comment for usb_gadget_connect
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).
--- drivers/usb/gadget/udc/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/gadget/udc/core.c +1 -2
@@ -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. */
Signature · 1 line
2.17.1
PATCH RESEND 2/2 usb: gadget: core: do not try to disconnect gadget if it is not connected
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.
--- drivers/usb/gadget/udc/core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/gadget/udc/core.c +3 -0
@@ -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.
Signature · 1 line
2.17.1
Re: [PATCH RESEND 2/2] usb: gadget: core: do not try to disconnect gadget if it is not connected
Quoted 28 lines · 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 callusb_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 <[email protected]>--- drivers/usb/gadget/udc/core.c | 3 +++ 1 file changed, 3 insertions(+)drivers/usb/gadget/udc/core.c +3
-1@@ -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. --
Quoted 2 lines
2.17.1
A gentle ping.
Peter
Re: [PATCH RESEND 2/2] usb: gadget: core: do not try to disconnect gadget if it is not connected
BR,
Peter Chen
Quoted 23 lines · Peter Chen
Quoted 21 lines · 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 callusb_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 <[email protected]>--- drivers/usb/gadget/udc/core.c | 3 +++ 1 file changed, 3 insertions(+)drivers/usb/gadget/udc/core.c +0
-0@@ -672,6 +672,9 @@ int usb_gadget_connect(struct usb_gadget *gadget) goto out; }
Quoted 12 lines
Quoted 9 lines
drivers/usb/gadget/udc/core.c +3
-1+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
Quoted 46 lines · 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 <[email protected]>--- drivers/usb/gadget/udc/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/usb/gadget/udc/core.c +1
-3@@ -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. */ --
Quoted 2 lines
2.17.1
Ping...
Peter
Greg Kroah-Hartman
maintainerRe: [PATCH RESEND 2/2] usb: gadget: core: do not try to disconnect gadget if it is not connected
In reply to a message not in the archiveQuoted 43 lines · Peter Chen
Quoted 41 lines · Peter Chen
BR,
Peter ChenQuoted 10 lines · Peter Chen
Quoted 8 lines · 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 callusb_gadget_disconnect, but the gadget is not connected at this time, notify disconnecton for the gadget driver is meaningless at this situation.Quoted 6 lines
Review
Quoted 6 lines
Signed-off-by Peter Chen <[email protected]>--- drivers/usb/gadget/udc/core.c | 3 +++ 1 file changed, 3 insertions(+)(quoted diff) +0
-0
b/drivers/usb/gadget/udc/core.cQuoted 19 lines
Quoted 14 lines
index
215ecbe8b692..8ad4203dea8c100644drivers/usb/gadget/udc/core.c +3
-1@@ -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. -- Quoted 2 lines
2.17.1
A gentle ping.
Quoted 6 lines
Quoted 4 lines
ping again.
Peter
Greg, would you please help to catch it up?
Again, can you please resend?
thanks,
greg k-h
Greg Kroah-Hartman
maintainerQuoted 54 lines · Peter Chen
Quoted 52 lines · Peter Chen
Quoted 26 lines · 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).Review
Quoted 6 lines
Signed-off-by Peter Chen <[email protected]>--- drivers/usb/gadget/udc/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/usb/gadget/udc/core.cdrivers/usb/gadget/udc/core.c EXPORT_SYMBOL_GPL(usb_gadget_vbus_disconnect); · line 662
Quoted 8 lines
index
debf54205d22..215ecbe8b692100644drivers/usb/gadget/udc/core.c +0
-1@@ -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
Quoted 8 lines
drivers/usb/gadget/udc/core.c +1
-2-* 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
Quoted 6 lines
Quoted 4 lines
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