Skip to contentSkip to conversation

Add missing link states in dwc3 gadget wakeup

PATCH In review Marcel Hamer 3 participants 4 messages Apr 23, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add missing link states in dwc3 gadget wakeup

In dwc3_send_gadget_ep_cmd() a check is performed if the gadget needs waking up. The following condition is checked before calling the __dwc3_gadget_wakeup() function:

	needs_wakeup = (dwc->link_state == DWC3_LINK_STATE_U1 ||
        		dwc->link_state == DWC3_LINK_STATE_U2 ||
                        dwc->link_state == DWC3_LINK_STATE_U3);

Inside __dwc3_gadget_wakeup() only link_state DWC3_LINK_STATE_U3 is checked and link state DWC3_LINK_STATE_U1 and DWC3_LINK_STATE_U2 are considered invalid and generate a warning becaus of the call to:

dev_WARN_ONCE(dwc->dev, ret, "wakeup failed --> %d\n", ret);

because of ret being -EINVAL.

---
 drivers/usb/dwc3/gadget.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/dwc3/gadget.c +2 -0
index c7ef218e7a8c..d05a7d630410 100644
@@ -1972,6 +1972,8 @@ static int __dwc3_gadget_wakeup(struct dwc3 *dwc)
 	switch (link_state) {
 	case DWC3_LINK_STATE_RESET:
 	case DWC3_LINK_STATE_RX_DET:	/* in HS, means Early Suspend */
+	case DWC3_LINK_STATE_U1:
+	case DWC3_LINK_STATE_U2:
 	case DWC3_LINK_STATE_U3:	/* in HS, means SUSPEND */
 	case DWC3_LINK_STATE_RESUME:
 		break;
Signature · 1 line
2.25.1
#1 lore raw

Hello,

I would like to add that I do not have the dwc3 documentation myself, given it is not publically available. I deduced the patch from active debugging on my system.

Please let me know if DWC3_LINK_STATE_U1 and DWC3_LINK_STATE_U2 should either be removed from the 'needs_wakeup =' line instead. Or if something else is off with the proposed patch.

Kind regards,

Marcel

Quoted 37 lines · Marcel Hamer

In dwc3_send_gadget_ep_cmd() a check is performed if the gadget needs waking up. The following condition is checked before calling the __dwc3_gadget_wakeup() function:

	needs_wakeup = (dwc->link_state == DWC3_LINK_STATE_U1 ||
        		dwc->link_state == DWC3_LINK_STATE_U2 ||
                        dwc->link_state == DWC3_LINK_STATE_U3);

Inside __dwc3_gadget_wakeup() only link_state DWC3_LINK_STATE_U3 is checked and link state DWC3_LINK_STATE_U1 and DWC3_LINK_STATE_U2 are considered invalid and generate a warning becaus of the call to:

dev_WARN_ONCE(dwc->dev, ret, "wakeup failed --> %d\n", ret);

because of ret being -EINVAL.

---
 drivers/usb/dwc3/gadget.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/dwc3/gadget.c +2 -0
index c7ef218e7a8c..d05a7d630410 100644
@@ -1972,6 +1972,8 @@ static int __dwc3_gadget_wakeup(struct dwc3 *dwc)
 	switch (link_state) {
 	case DWC3_LINK_STATE_RESET:
 	case DWC3_LINK_STATE_RX_DET:	/* in HS, means Early Suspend */
+	case DWC3_LINK_STATE_U1:
+	case DWC3_LINK_STATE_U2:
 	case DWC3_LINK_STATE_U3:	/* in HS, means SUSPEND */
 	case DWC3_LINK_STATE_RESUME:
 		break;
Signature · 1 line
2.25.1
maintainer
#2 lore raw
Quoted 9 lines · Marcel Hamer

Hello,

I would like to add that I do not have the dwc3 documentation myself, given it is not publically available. I deduced the patch from active debugging on my system.

Please let me know if DWC3_LINK_STATE_U1 and DWC3_LINK_STATE_U2 should either be removed from the 'needs_wakeup =' line instead. Or if something else is off with the proposed patch.

When submitting patches, please use scripts/get_maintainers.pl to know who to cc: so that they know to pay attention to your commit. Care to do that again here and resend it?

Also, you might want to change your subject line to match up with others for this driver:
[PATCH] USB: dwc3: add missing link...

thanks,

greg k-h

#3 lore raw
Quoted 15 lines · Greg KH
Quoted 9 lines · Marcel Hamer

Hello,

I would like to add that I do not have the dwc3 documentation myself, given it is not publically available. I deduced the patch from active debugging on my system.

Please let me know if DWC3_LINK_STATE_U1 and DWC3_LINK_STATE_U2 should either be removed from the 'needs_wakeup =' line instead. Or if something else is off with the proposed patch.

When submitting patches, please use scripts/get_maintainers.pl to know who to cc: so that they know to pay attention to your commit. Care to do that again here and resend it?

Quoted 7 lines

Also, you might want to change your subject line to match up with others for this driver:
[PATCH] USB: dwc3: add missing link...

thanks,

greg k-h

Absolutely, will resend it. Thanks for the information.

Marcel