aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Lindgren <[email protected]>2017-05-25 09:13:31 -0700
committerGreg Kroah-Hartman <[email protected]>2017-06-03 18:08:04 +0900
commit0aa0b93e7af663b6ca9d9ae31d1b73f2c36ddf46 (patch)
treea0aca8a85020d84a58722b6cdbe66600e2eb3f6c
parentfa72e6afa795dbb35d0cc6332606e83e4415e45e (diff)
usb: host: ohci-platform: Add basic runtime PM support
This is needed in preparation of adding support for omap3 and later OHCI. The runtime PM will only do something on platforms that implement it. Cc: [email protected] Cc: Hans de Goede <[email protected]> Cc: Rob Herring <[email protected]> Cc: Sebastian Reichel <[email protected]> Cc: Yoshihiro Shimoda <[email protected]> Signed-off-by: Tony Lindgren <[email protected]> Acked-by: Roger Quadros <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/usb/host/ohci-platform.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index 6368fce43197..589177dca8ca 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -24,6 +24,7 @@
#include <linux/err.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <linux/usb/ohci_pdriver.h>
#include <linux/usb.h>
@@ -242,6 +243,8 @@ static int ohci_platform_probe(struct platform_device *dev)
}
#endif
+ pm_runtime_set_active(&dev->dev);
+ pm_runtime_enable(&dev->dev);
if (pdata->power_on) {
err = pdata->power_on(dev);
if (err < 0)
@@ -271,6 +274,7 @@ err_power:
if (pdata->power_off)
pdata->power_off(dev);
err_reset:
+ pm_runtime_disable(&dev->dev);
while (--rst >= 0)
reset_control_assert(priv->resets[rst]);
err_put_clks:
@@ -292,6 +296,7 @@ static int ohci_platform_remove(struct platform_device *dev)
struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
int clk, rst;
+ pm_runtime_get_sync(&dev->dev);
usb_remove_hcd(hcd);
if (pdata->power_off)
@@ -305,6 +310,9 @@ static int ohci_platform_remove(struct platform_device *dev)
usb_put_hcd(hcd);
+ pm_runtime_put_sync(&dev->dev);
+ pm_runtime_disable(&dev->dev);
+
if (pdata == &ohci_platform_defaults)
dev->dev.platform_data = NULL;