Hi, On Sat, Oct 13, 2012 at 06:40:25PM +0530, Vikas Sajjan wrote: > Adding the suspend and resume functionality to exynos dwc3 driver better commit log. > Signed-off-by: Abhilash Kesavan <a.kesavan@xxxxxxxxxxx> > Signed-off-by: Vikas C Sajjan <vikas.sajjan@xxxxxxxxxx> > CC: Doug Anderson <dianders@xxxxxxxxxxxx> > --- > drivers/usb/dwc3/dwc3-exynos.c | 39 +++++++++++++++++++++++++++++++++++++++ > 1 files changed, 39 insertions(+), 0 deletions(-) > > diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c > index ca65978..2781301 100644 > --- a/drivers/usb/dwc3/dwc3-exynos.c > +++ b/drivers/usb/dwc3/dwc3-exynos.c > @@ -15,6 +15,7 @@ > #include <linux/module.h> > #include <linux/kernel.h> > #include <linux/slab.h> > +#include <linux/pm_runtime.h> > #include <linux/platform_device.h> > #include <linux/platform_data/dwc3-exynos.h> > #include <linux/dma-mapping.h> > @@ -200,11 +201,49 @@ static int __devexit dwc3_exynos_remove(struct platform_device *pdev) > return 0; > } > > +#ifdef CONFIG_PM > +static int dwc3_exynos_suspend(struct device *dev) > +{ > + struct dwc3_exynos *exynos = dev_get_drvdata(dev); > + > + BUG_ON(!exynos); drop this. It's nonsense. This will never happen and if it does clk_disable() call will already oops for us. > + > + clk_disable(exynos->clk); > + > + return 0; > +} > + > +static int dwc3_exynos_resume(struct device *dev) > +{ > + struct dwc3_exynos *exynos = dev_get_drvdata(dev); > + > + BUG_ON(!exynos); drop this. It's nonsense. This will never happen and if it does clk_enable() call will already oops for us. > + clk_enable(exynos->clk); > + > + /* runtime set active to reflect active state. */ > + pm_runtime_disable(dev); > + pm_runtime_set_active(dev); > + pm_runtime_enable(dev); > + > + return 0; > +} > + > +static const struct dev_pm_ops dwc3_exynos_pm_ops = { > + .suspend = dwc3_exynos_suspend, > + .resume = dwc3_exynos_resume, use SET_SYSTEM_SLEEP_PM_OPS() > +}; > +#define DWC3_EXYNOS_DEV_PM_OPS &(dwc3_exynos_pm_ops) > +#else > +#define DWC3_EXYNOS_DEV_PM_OPS NULL > +#endif /* CONFIG_PM */ > + > static struct platform_driver dwc3_exynos_driver = { > .probe = dwc3_exynos_probe, > .remove = __devexit_p(dwc3_exynos_remove), > .driver = { > .name = "exynos-dwc3", > + .pm = DWC3_EXYNOS_DEV_PM_OPS, > }, > }; > > -- > 1.7.6.5 > -- balbi
Attachment:
signature.asc
Description: Digital signature