usb: dwc3: gadget: Ensure core is not suspended when handling interrupt

Since dwc3_thread_interrupt is part of interrupt handling that
can be scheduled to run in thread context, it leaves open a
window in which the controller might be placed into low power
mode. In this state, clocks would be disabled, and by the time
dwc3_thread_interrupt runs, would result in an unclocked I/O
access when it tries to write to the GEVNTCOUNT register.

Prevent this by calling pm_runtime_get() in dwc3_interrupt() in
order to force the device to remain in active state, which
increments the parent device's child count so that it too is
prevented from entering suspend. Call pm_runtime_put() at the
end of dwc3_thread_interrupt() after finishing processing the
event buffers.

CRs-fixed: 609233
CRs-fixed: 622850
Change-Id: Ia21c9ac74d74833a889081f41c93acec2a7ae011
Signed-off-by: Jack Pham <jackp@codeaurora.org>
This commit is contained in:
Jack Pham 2014-02-13 18:33:50 -08:00 committed by David Keitel
parent 88f0a43593
commit 0b937c189f

View file

@ -2755,6 +2755,7 @@ static irqreturn_t dwc3_thread_interrupt(int irq, void *_dwc)
spin_unlock_irqrestore(&dwc->lock, flags);
pm_runtime_put(dwc->dev);
return ret;
}
@ -2796,6 +2797,9 @@ static irqreturn_t dwc3_interrupt(int irq, void *_dwc)
ret = status;
}
if (ret == IRQ_WAKE_THREAD)
pm_runtime_get(dwc->dev);
return ret;
}