Skip to content

Commit

Permalink
usb: s3c-hsudc: add basic runtime_pm calls
Browse files Browse the repository at this point in the history
This will enable the system to check for activity of the usb gadget
and also in a later patch to control the usbphy power-domain.
When handling the power domain there, it will be possible to remove
another reference to architecture code.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Heiko Stübner authored and Felipe Balbi committed Jan 24, 2012
1 parent 2d4172c commit 294f78e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/usb/gadget/s3c-hsudc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -1178,6 +1179,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();
Expand Down Expand Up @@ -1208,6 +1212,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);
Expand Down Expand Up @@ -1362,6 +1369,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);
Expand Down

0 comments on commit 294f78e

Please sign in to comment.