]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
usb: chipidea: add usb as system wakeup source
authorPeter Chen <peter.chen@freescale.com>
Wed, 11 Feb 2015 04:44:48 +0000 (12:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Mar 2015 15:19:09 +0000 (16:19 +0100)
The USB signal can be system wakeup source, this patch add the
support, for how to enable it, see Documentation/usb/chipidea.txt.
Since USB wakeup enable logic is vendor/platform specific, the
glue layer needs to implement it to support this feature.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/chipidea/core.c

index 63d2b398c9a0f0097db74975dedc49f26851d19d..6d9dc2d175eb7ca47fdea7cee4b61a9c8499c9a5 100644 (file)
@@ -808,6 +808,8 @@ static int ci_hdrc_probe(struct platform_device *pdev)
        if (ci_otg_is_fsm_mode(ci))
                ci_hdrc_otg_fsm_start(ci);
 
+       device_set_wakeup_capable(&pdev->dev, true);
+
        ret = dbg_create_files(ci);
        if (!ret)
                return 0;
@@ -898,6 +900,11 @@ static int ci_suspend(struct device *dev)
                return 0;
        }
 
+       if (device_may_wakeup(dev)) {
+               usb_phy_set_wakeup(ci->usb_phy, true);
+               enable_irq_wake(ci->irq);
+       }
+
        ci_controller_suspend(ci);
 
        return 0;
@@ -908,6 +915,9 @@ static int ci_resume(struct device *dev)
        struct ci_hdrc *ci = dev_get_drvdata(dev);
        int ret;
 
+       if (device_may_wakeup(dev))
+               disable_irq_wake(ci->irq);
+
        ret = ci_controller_resume(dev);
        if (ret)
                return ret;