diff mbox

[1/3] usb: host: ohci-platform: Add basic runtime PM support

Message ID 20170525161333.32639-2-tony@atomide.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tony Lindgren May 25, 2017, 4:13 p.m. UTC
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: devicetree@vger.kernel.org
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Roger Quadros <rogerq@ti.com>
Cc: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/usb/host/ohci-platform.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Alan Stern May 25, 2017, 4:45 p.m. UTC | #1
On Thu, 25 May 2017, Tony Lindgren wrote:

> 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: devicetree@vger.kernel.org
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Rob Herring <robh@kernel.org>
> Cc: Roger Quadros <rogerq@ti.com>
> Cc: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  drivers/usb/host/ohci-platform.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
> --- 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 @@ static int ohci_platform_probe(struct platform_device *dev)
>  	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;

Acked-by: Alan Stern <stern@rowland.harvard.edu>

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Roger Quadros May 26, 2017, 7:28 a.m. UTC | #2
On 25/05/17 19:13, Tony Lindgren wrote:
> 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: devicetree@vger.kernel.org
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Rob Herring <robh@kernel.org>
> Cc: Roger Quadros <rogerq@ti.com>
> Cc: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Acked-by: Roger Quadros <rogerq@ti.com>

> ---
>  drivers/usb/host/ohci-platform.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
> --- 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 @@ static int ohci_platform_probe(struct platform_device *dev)
>  	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;
>  
>
diff mbox

Patch

diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
--- 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 @@  static int ohci_platform_probe(struct platform_device *dev)
 	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;