Re: [PATCH 11/16] usb: musb: da8xx: Add support of suspend / resume

2017-01-03 Thread Bin Liu
On Tue, Jan 03, 2017 at 04:37:58PM +0100, Greg KH wrote:
> On Tue, Jan 03, 2017 at 09:15:16AM -0600, Bin Liu wrote:
> > From: Alexandre Bailon 
> > 
> > Implement PM methods specifics for da8xx glue.
> > The only thing to do is to power off the phy.
> > As the registers are in retention during suspend,
> > there is no need to save them.
> > 
> > Signed-off-by: Alexandre Bailon 
> > Signed-off-by: Bin Liu 
> > ---
> >  drivers/usb/musb/da8xx.c | 29 +
> >  1 file changed, 29 insertions(+)
> 
> This is not a regression fix :(

will drop this in v2.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 11/16] usb: musb: da8xx: Add support of suspend / resume

2017-01-03 Thread Greg KH
On Tue, Jan 03, 2017 at 09:15:16AM -0600, Bin Liu wrote:
> From: Alexandre Bailon 
> 
> Implement PM methods specifics for da8xx glue.
> The only thing to do is to power off the phy.
> As the registers are in retention during suspend,
> there is no need to save them.
> 
> Signed-off-by: Alexandre Bailon 
> Signed-off-by: Bin Liu 
> ---
>  drivers/usb/musb/da8xx.c | 29 +
>  1 file changed, 29 insertions(+)

This is not a regression fix :(
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/16] usb: musb: da8xx: Add support of suspend / resume

2017-01-03 Thread Bin Liu
From: Alexandre Bailon 

Implement PM methods specifics for da8xx glue.
The only thing to do is to power off the phy.
As the registers are in retention during suspend,
there is no need to save them.

Signed-off-by: Alexandre Bailon 
Signed-off-by: Bin Liu 
---
 drivers/usb/musb/da8xx.c | 29 +
 1 file changed, 29 insertions(+)

diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 26766a523352..738417986398 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -577,6 +577,34 @@ static int da8xx_remove(struct platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int da8xx_suspend(struct device *dev)
+{
+   int ret;
+   struct da8xx_glue *glue = dev_get_drvdata(dev);
+
+   ret = phy_power_off(glue->phy);
+   if (ret)
+   return ret;
+   clk_disable_unprepare(glue->clk);
+
+   return 0;
+}
+
+static int da8xx_resume(struct device *dev)
+{
+   int ret;
+   struct da8xx_glue *glue = dev_get_drvdata(dev);
+
+   ret = clk_prepare_enable(glue->clk);
+   if (ret)
+   return ret;
+   return phy_power_on(glue->phy);
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(da8xx_pm_ops, da8xx_suspend, da8xx_resume);
+
 #ifdef CONFIG_OF
 static const struct of_device_id da8xx_id_table[] = {
{
@@ -592,6 +620,7 @@ static int da8xx_remove(struct platform_device *pdev)
.remove = da8xx_remove,
.driver = {
.name   = "musb-da8xx",
+   .pm = _pm_ops,
.of_match_table = of_match_ptr(da8xx_id_table),
},
 };
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html