usb: chipidea: fix ci_irq for role-switching use-case

Message ID 20200626110311.221596-1-philippe.schenker@toradex.com
State New
Headers show
Series
  • usb: chipidea: fix ci_irq for role-switching use-case
Related show

Commit Message

Philippe Schenker June 26, 2020, 11:03 a.m.
If the hardware is in low-power-mode and one plugs in device or host
it did not switch the mode due to the early exit out of the interrupt.

This patch fixes that behaviour and lets the rest of the code check if
something has to be done. If nothing has to be done the same return
value gets returned as before.

Fixes: 1f874edcb731 ("usb: chipidea: add runtime power management support")
Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>

---

Hi Peter

During my investigation I found a bug in ci_irq. I would appreciate
if you could review this. From what I see this patch should be save to apply.

This patch does not solve all of our issues. When I have RUNTIME_PM
enabled on imx6ull or imx7. RNDIS still does not come up. So there
has to be another bug hiding somewhere in the Runtime PM code to prevent
RNDIS from working properly. I quickly looked through your patches
that added this stuff back in 2015 but couldn't spot anything related to
usb gadget-mode.

If you right away know where the problem could be hiding itself,
I would appreciate a hint.

Thanks,
Philippe

---

 drivers/usb/chipidea/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 9a7c53d09ab4..5159420a23a4 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -518,7 +518,7 @@  static irqreturn_t ci_irq(int irq, void *data)
 		disable_irq_nosync(irq);
 		ci->wakeup_int = true;
 		pm_runtime_get(ci->dev);
-		return IRQ_HANDLED;
+		ret = IRQ_HANDLED;
 	}
 
 	if (ci->is_otg) {