From 01a917127b1cab90d0ded433d4468c9c7944c054 Mon Sep 17 00:00:00 2001 From: wlf Date: Tue, 22 Apr 2014 15:08:49 +0800 Subject: [PATCH] USB: fix EHCI pm_suspend and pm_resume. --- drivers/usb/host/ehci-rkhsic.c | 25 +++++++------------------ drivers/usb/host/ehci-rockchip.c | 24 +++++++----------------- 2 files changed, 14 insertions(+), 35 deletions(-) diff --git a/drivers/usb/host/ehci-rkhsic.c b/drivers/usb/host/ehci-rkhsic.c index 480afa7e1ced..e8efd39be592 100755 --- a/drivers/usb/host/ehci-rkhsic.c +++ b/drivers/usb/host/ehci-rkhsic.c @@ -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 = { diff --git a/drivers/usb/host/ehci-rockchip.c b/drivers/usb/host/ehci-rockchip.c index f2633858f1bb..20a7c5d286c5 100755 --- a/drivers/usb/host/ehci-rockchip.c +++ b/drivers/usb/host/ehci-rockchip.c @@ -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 = { -- 2.34.1