summaryrefslogtreecommitdiffstats
path: root/drivers/usb/cdns3/gadget.c
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@nxp.com>2020-09-02 17:57:32 +0800
committerFelipe Balbi <balbi@kernel.org>2020-10-02 09:57:38 +0300
commitb1234e3b3b265588bab1e7a28508621045b87efa (patch)
treef20257a026b57cf81525bea8b1433d5df5d9c6f9 /drivers/usb/cdns3/gadget.c
parentefe2fa0836a7a051a816c90b44f07590f2fd74c5 (diff)
downloadlinux-stable-b1234e3b3b265588bab1e7a28508621045b87efa.tar.gz
linux-stable-b1234e3b3b265588bab1e7a28508621045b87efa.tar.bz2
linux-stable-b1234e3b3b265588bab1e7a28508621045b87efa.zip
usb: cdns3: add runtime PM support
Introduce runtime PM and wakeup interrupt handler for cdns3, the runtime PM is default off since other cdns3 may not implement glue layer support for runtime PM. One typical wakeup event use case is xHCI runtime suspend will clear USBCMD.RS bit, after that the xHCI will not trigger any interrupts, so its parent (cdns core device) needs to resume xHCI device when any (wakeup) events occurs at host port. When the controller is in low power mode, the lpm flag will be set. The interrupt triggered later than lpm flag is set considers as wakeup interrupt and handled at cdns_wakeup_irq. Once the wakeup occurs, it first disables interrupt to avoid later interrupt occurrence since the controller is in low power mode at that time, and access registers may be invalid at that time. At wakeup handler, it will call pm_request_resume to wakeup xHCI device, and at runtime resume handler, it will enable interrupt again. The API platform_suspend is introduced for glue layer to implement platform specific PM sequence. Reviewed-by: Pawel Laszczak <pawell@cadence.com> Signed-off-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Felipe Balbi <balbi@kernel.org>
Diffstat (limited to 'drivers/usb/cdns3/gadget.c')
-rw-r--r--drivers/usb/cdns3/gadget.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
index 02a69e20014b..9e6ff7d00784 100644
--- a/drivers/usb/cdns3/gadget.c
+++ b/drivers/usb/cdns3/gadget.c
@@ -1769,9 +1769,13 @@ static void cdns3_check_usb_interrupt_proceed(struct cdns3_device *priv_dev,
static irqreturn_t cdns3_device_irq_handler(int irq, void *data)
{
struct cdns3_device *priv_dev = data;
+ struct cdns3 *cdns = dev_get_drvdata(priv_dev->dev);
irqreturn_t ret = IRQ_NONE;
u32 reg;
+ if (cdns->in_lpm)
+ return ret;
+
/* check USB device interrupt */
reg = readl(&priv_dev->regs->usb_ists);
if (reg) {