diff options
author | 2021-10-15 18:14:25 +0200 | |
---|---|---|
committer | 2021-10-26 16:36:22 +0530 | |
commit | 95e38c17d9971cd6639ce899a24e581800e7113a (patch) | |
tree | 5dd2424aaba89f9c8b36340a261178ff5a05f380 | |
parent | dt-bindings: phy: rockchip: remove usb-phy fallback string for rk3066a/rk3188 (diff) | |
download | linux-95e38c17d9971cd6639ce899a24e581800e7113a.tar.gz linux-95e38c17d9971cd6639ce899a24e581800e7113a.tar.bz2 linux-95e38c17d9971cd6639ce899a24e581800e7113a.zip |
phy: stm32: restore utmi switch on resume
UTMI switch value can be lost during suspend/resume, depending on the power
state reached.
This patch adds resume function to usbphyc, to reconfigure utmi switch
after suspend.
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://lore.kernel.org/r/20211015161427.220784-2-amelie.delaunay@foss.st.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
-rw-r--r-- | drivers/phy/st/phy-stm32-usbphyc.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/phy/st/phy-stm32-usbphyc.c b/drivers/phy/st/phy-stm32-usbphyc.c index 937a14fa7448..083593aea53a 100644 --- a/drivers/phy/st/phy-stm32-usbphyc.c +++ b/drivers/phy/st/phy-stm32-usbphyc.c @@ -598,6 +598,18 @@ static int stm32_usbphyc_remove(struct platform_device *pdev) return 0; } +static int __maybe_unused stm32_usbphyc_resume(struct device *dev) +{ + struct stm32_usbphyc *usbphyc = dev_get_drvdata(dev); + + if (usbphyc->switch_setup >= 0) + stm32_usbphyc_switch_setup(usbphyc, usbphyc->switch_setup); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(stm32_usbphyc_pm_ops, NULL, stm32_usbphyc_resume); + static const struct of_device_id stm32_usbphyc_of_match[] = { { .compatible = "st,stm32mp1-usbphyc", }, { }, @@ -610,6 +622,7 @@ static struct platform_driver stm32_usbphyc_driver = { .driver = { .of_match_table = stm32_usbphyc_of_match, .name = "stm32-usbphyc", + .pm = &stm32_usbphyc_pm_ops, } }; module_platform_driver(stm32_usbphyc_driver); |