diff options
author | Govindraj.R <govindraj.raja@ti.com> | 2012-05-02 15:14:19 +0800 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2012-06-07 10:14:25 +0800 |
commit | 22b154c50fcccf6e867466ddb08a6482afa66c9d (patch) | |
tree | 286694d83d3e7630661ce225a8aa24dc298c03c4 /drivers | |
parent | 4291a28efa5b10a90e9b435ea04ef97c323d1717 (diff) | |
download | panda-22b154c50fcccf6e867466ddb08a6482afa66c9d.tar.gz |
usb: ehci: add bus_suspend/bus resume
ehci clocks can be gated on usb bus autosupend
so add custom bus_suspend/resume hooks that will
gate ehci clocks if usb autosuspend is used.
Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/host/ehci-omap.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index b50909117cb..00880a76cae 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c @@ -341,12 +341,41 @@ static void ehci_hcd_omap_shutdown(struct platform_device *pdev) hcd->driver->shutdown(hcd); } +static int ehci_omap_bus_suspend(struct usb_hcd *hcd) +{ + struct device *dev = hcd->self.controller; + int ret = 0; + + dev_dbg(dev, "ehci_omap_bus_suspend\n"); + + ret = ehci_bus_suspend(hcd); + + if (ret != 0) { + dev_dbg(dev, "ehci_omap_bus_suspend failed %d\n", ret); + return ret; + } + + pm_runtime_put(dev); + + return ret; +} + +static int ehci_omap_bus_resume(struct usb_hcd *hcd) +{ + struct device *dev = hcd->self.controller; + + dev_dbg(dev, "ehci_omap_bus_resume\n"); + + if (pm_runtime_suspended(dev)) + pm_runtime_get_sync(dev); + + return ehci_bus_resume(hcd); +} + static struct platform_driver ehci_hcd_omap_driver = { .probe = ehci_hcd_omap_probe, .remove = ehci_hcd_omap_remove, .shutdown = ehci_hcd_omap_shutdown, - /*.suspend = ehci_hcd_omap_suspend, */ - /*.resume = ehci_hcd_omap_resume, */ .driver = { .name = "ehci-omap", } @@ -391,8 +420,8 @@ static const struct hc_driver ehci_omap_hc_driver = { */ .hub_status_data = ehci_hub_status_data, .hub_control = ehci_hub_control, - .bus_suspend = ehci_bus_suspend, - .bus_resume = ehci_bus_resume, + .bus_suspend = ehci_omap_bus_suspend, + .bus_resume = ehci_omap_bus_resume, .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, }; |