s3c-hsudc: add runtime_pm calls
From: Heiko Stuebner <heiko.stuebner@...> Date: Thu, 22 Dec 2011 16:24:09 +0100
Commit-Message
This also enables controlling the usbphy power domain and removes therefore a reference to architecture code. Signed-off-by: Heiko Stuebner <heiko@...>
Patch-Comment
drivers/usb/gadget/s3c-hsudc.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-)
Statistics
- 9 lines added
- 6 lines removed
Changes
------------------------ drivers/usb/gadget/s3c-hsudc.c ------------------------
index 7b53e77..98b3c65 100644
@@ -30,6 +30,7 @@
#include <linux/prefetch.h>
#include <linux/platform_data/s3c-hsudc.h>
#include <linux/regulator/consumer.h>
+#include <linux/pm_runtime.h>
#include <mach/regs-s3c2443-clock.h>
@@ -194,9 +195,6 @@ static void s3c_hsudc_init_phy(void)
{
u32 cfg;
cfg = readl(S3C2443_URSTCON);
cfg |= (S3C2443_URSTCON_FUNCRST | S3C2443_URSTCON_PHYRST);
writel(cfg, S3C2443_URSTCON);
@@ -228,9 +226,6 @@ static void s3c_hsudc_uninit_phy(void)
{
u32 cfg;
writel(S3C2443_PHYPWR_FSUSPEND, S3C2443_PHYPWR);
cfg = readl(S3C2443_UCLKCON) & ~S3C2443_UCLKCON_FUNC_CLKEN;
@@ -1178,6 +1173,9 @@ static int s3c_hsudc_start(struct usb_gadget *gadget,
dev_info(hsudc->dev, "bound driver %s\n", driver->driver.name);
s3c_hsudc_reconfig(hsudc);
+
+ pm_runtime_get_sync(hsudc->dev);
+
s3c_hsudc_init_phy();
if (hsudc->pd->gpio_init)
hsudc->pd->gpio_init();
@@ -1208,6 +1206,9 @@ static int s3c_hsudc_stop(struct usb_gadget *gadget,
hsudc->gadget.dev.driver = NULL;
hsudc->gadget.speed = USB_SPEED_UNKNOWN;
s3c_hsudc_uninit_phy();
+
+ pm_runtime_put(hsudc->dev);
+
if (hsudc->pd->gpio_uninit)
hsudc->pd->gpio_uninit();
s3c_hsudc_stop_activity(hsudc);
@@ -1362,6 +1363,8 @@ static int __devinit s3c_hsudc_probe(struct platform_device *pdev)
if (ret)
goto err_add_udc;
+ pm_runtime_enable(dev);
+
return 0;
err_add_udc:
device_unregister(&hsudc->gadget.dev);