diff options
author | Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> | 2017-09-29 20:45:00 +0900 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2017-10-19 10:38:07 +0300 |
commit | 90d588642a7ff598533f68c2f56ee64657a40186 (patch) | |
tree | 1807279a2a32b918327f34153a45fe3fab3f49a7 /drivers/usb/gadget/udc/renesas_usb3.c | |
parent | cf06df3fae286b795c1abf59c4b493ebf30a7a9f (diff) | |
download | linux-90d588642a7ff598533f68c2f56ee64657a40186.tar.bz2 |
usb: gadget: udc: renesas_usb3: Add suspend/resume functions
This patch adds support suspend/resume functions
Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
[shimoda: add the commit log]
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/gadget/udc/renesas_usb3.c')
-rw-r--r-- | drivers/usb/gadget/udc/renesas_usb3.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c index 740497c43bd3..75afc4c4bbd8 100644 --- a/drivers/usb/gadget/udc/renesas_usb3.c +++ b/drivers/usb/gadget/udc/renesas_usb3.c @@ -2655,11 +2655,45 @@ err_alloc_prd: return ret; } +#ifdef CONFIG_PM_SLEEP +static int renesas_usb3_suspend(struct device *dev) +{ + struct renesas_usb3 *usb3 = dev_get_drvdata(dev); + + /* Not started */ + if (!usb3->driver) + return 0; + + renesas_usb3_stop_controller(usb3); + pm_runtime_put(dev); + + return 0; +} + +static int renesas_usb3_resume(struct device *dev) +{ + struct renesas_usb3 *usb3 = dev_get_drvdata(dev); + + /* Not started */ + if (!usb3->driver) + return 0; + + pm_runtime_get_sync(dev); + renesas_usb3_init_controller(usb3); + + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(renesas_usb3_pm_ops, renesas_usb3_suspend, + renesas_usb3_resume); + static struct platform_driver renesas_usb3_driver = { .probe = renesas_usb3_probe, .remove = renesas_usb3_remove, .driver = { .name = (char *)udc_name, + .pm = &renesas_usb3_pm_ops, .of_match_table = of_match_ptr(usb3_of_match), }, }; |