]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
usb: xhci-plat: Add remote wakeup support
authorAnurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Wed, 27 Sep 2017 14:05:07 +0000 (19:35 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 4 Oct 2017 11:59:57 +0000 (13:59 +0200)
This patch adds support for enabling remote wakeup capability
to the host controller

Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/usb/host/xhci-plat.c

index 1c32820cbb894dfa6cb91df66d1380a0f6bd709d..661f6a6b90b26e96cc3e46256ab29a06eee2149d 100644 (file)
@@ -200,6 +200,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
                        return ret;
        }
 
+       /* Set the controller as wakeup capable */
+       device_set_wakeup_capable(&pdev->dev, true);
+
        hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
        if (!hcd)
                return -ENOMEM;
@@ -334,10 +337,12 @@ static int xhci_plat_suspend(struct device *dev)
 
 #if IS_ENABLED(CONFIG_USB_DWC3_OF_SIMPLE)
        /* Inform dwc3 driver about the device wakeup capability */
-       if (device_may_wakeup(dev))
+       if (device_may_wakeup(&hcd->self.root_hub->dev)) {
+               enable_irq_wake(hcd->irq);
                dwc3_host_wakeup_capable(dev, true);
-       else
+       } else {
                dwc3_host_wakeup_capable(dev, false);
+       }
 #endif
 
        /*
@@ -356,6 +361,9 @@ static int xhci_plat_resume(struct device *dev)
        struct usb_hcd  *hcd = dev_get_drvdata(dev);
        struct xhci_hcd *xhci = hcd_to_xhci(hcd);
 
+       if (device_may_wakeup(&hcd->self.root_hub->dev))
+               disable_irq_wake(hcd->irq);
+
        return xhci_resume(xhci, 0);
 }