diff options
author | Alexandre Bailon <abailon@baylibre.com> | 2017-02-01 21:30:18 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-02-03 10:05:10 +0100 |
commit | 71f5a0ad9e82c1239f0d748bda32a4b6e6dbcb80 (patch) | |
tree | 904267cbb2fb6ac2ea9af7642e349b341ce533fa /drivers/usb/musb | |
parent | ca7c1d5094ec1c425bd9a38153789f9cedb0b8e2 (diff) | |
download | linux-stable-71f5a0ad9e82c1239f0d748bda32a4b6e6dbcb80.tar.gz linux-stable-71f5a0ad9e82c1239f0d748bda32a4b6e6dbcb80.tar.bz2 linux-stable-71f5a0ad9e82c1239f0d748bda32a4b6e6dbcb80.zip |
usb: musb: da8xx: Add support of suspend / resume
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 <abailon@baylibre.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r-- | drivers/usb/musb/da8xx.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index d5766ebeb761..eb5acee82173 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -573,6 +573,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[] = { { @@ -588,6 +616,7 @@ static struct platform_driver da8xx_driver = { .remove = da8xx_remove, .driver = { .name = "musb-da8xx", + .pm = &da8xx_pm_ops, .of_match_table = of_match_ptr(da8xx_id_table), }, }; |