USB: fix EHCI pm_suspend and pm_resume.
authorwlf <wulf@rock-chips.com>
Tue, 22 Apr 2014 07:08:49 +0000 (15:08 +0800)
committerwlf <wulf@rock-chips.com>
Tue, 22 Apr 2014 07:08:49 +0000 (15:08 +0800)
drivers/usb/host/ehci-rkhsic.c
drivers/usb/host/ehci-rockchip.c

index 480afa7e1ced79ace7e84e0d9f5e3ec1ee119921..e8efd39be592298ab1502fca64548d3579d784d3 100755 (executable)
@@ -339,24 +339,13 @@ static int ehci_rkhsic_remove(struct platform_device *pdev)
 static int ehci_rkhsic_pm_suspend(struct device *dev)
 {
        struct usb_hcd *hcd = dev_get_drvdata(dev);
-       bool wakeup = device_may_wakeup(dev);
+       bool do_wakeup  = device_may_wakeup(dev);
+       int ret;
 
        dev_dbg(dev, "ehci-rkhsic PM suspend\n");
+       ret = ehci_suspend(hcd, do_wakeup);
 
-       /*
-        * EHCI helper function has also the same check before manipulating
-        * port wakeup flags.  We do check here the same condition before
-        * calling the same helper function to avoid bringing hardware
-        * from Low power mode when there is no need for adjusting port
-        * wakeup flags.
-        */
-       if (hcd->self.root_hub->do_remote_wakeup && !wakeup) {
-               pm_runtime_resume(dev);
-               ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd),
-                               wakeup);
-       }
-
-       return 0;
+       return ret;
 }
 
 static int ehci_rkhsic_pm_resume(struct device *dev)
@@ -364,7 +353,7 @@ static int ehci_rkhsic_pm_resume(struct device *dev)
        struct usb_hcd *hcd = dev_get_drvdata(dev);
 
        dev_dbg(dev, "ehci-rkhsic PM resume\n");
-       ehci_prepare_ports_for_controller_resume(hcd_to_ehci(hcd));
+       ehci_resume(hcd, false);
 
        return 0;
 }
@@ -374,8 +363,8 @@ static int ehci_rkhsic_pm_resume(struct device *dev)
 #endif
 
 static const struct dev_pm_ops ehci_rkhsic_dev_pm_ops = {
-       .suspend         = ehci_rkhsic_pm_suspend,
-       .resume          = ehci_rkhsic_pm_resume,
+       .suspend        = ehci_rkhsic_pm_suspend,
+       .resume         = ehci_rkhsic_pm_resume,
 };
 
 static struct platform_driver ehci_rkhsic_driver = {
index f2633858f1bb43a03ba5912be3b96b9a3f9aad3a..20a7c5d286c5d118af8b44082167021abc8816fa 100755 (executable)
@@ -438,24 +438,14 @@ static int ehci_rk_remove(struct platform_device *pdev)
 static int ehci_rk_pm_suspend(struct device *dev)
 {
        struct usb_hcd *hcd = dev_get_drvdata(dev);
-       bool wakeup = device_may_wakeup(dev);
+       bool do_wakeup  = device_may_wakeup(dev);
+       int ret;
 
        dev_dbg(dev, "ehci-rockchip PM suspend\n");
 
-       /*
-        * EHCI helper function has also the same check before manipulating
-        * port wakeup flags.  We do check here the same condition before
-        * calling the same helper function to avoid bringing hardware
-        * from Low power mode when there is no need for adjusting port
-        * wakeup flags.
-        */
-       if (hcd->self.root_hub->do_remote_wakeup && !wakeup) {
-               pm_runtime_resume(dev);
-               ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd),
-                               wakeup);
-       }
+       ret = ehci_suspend(hcd, do_wakeup);
 
-       return 0;
+       return ret;
 }
 
 static int ehci_rk_pm_resume(struct device *dev)
@@ -463,7 +453,7 @@ static int ehci_rk_pm_resume(struct device *dev)
        struct usb_hcd *hcd = dev_get_drvdata(dev);
 
        dev_dbg(dev, "ehci-rockchip PM resume\n");
-       ehci_prepare_ports_for_controller_resume(hcd_to_ehci(hcd));
+       ehci_resume(hcd, false);
 
        return 0;
 }
@@ -473,8 +463,8 @@ static int ehci_rk_pm_resume(struct device *dev)
 #endif
 
 static const struct dev_pm_ops ehci_rk_dev_pm_ops = {
-       .suspend         = ehci_rk_pm_suspend,
-       .resume          = ehci_rk_pm_resume,
+       .suspend        = ehci_rk_pm_suspend,
+       .resume         = ehci_rk_pm_resume,
 };
 
 static struct platform_driver ehci_rk_driver = {