diff options
author | Neil Armstrong <narmstrong@baylibre.com> | 2019-08-21 16:35:18 +0300 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2019-08-28 13:04:59 +0300 |
commit | 1cf084d161f40baf4aa6976bb2dcef114adbebd6 (patch) | |
tree | 011d890f4958fadaa249789d96a185cef1bc1216 /drivers/usb/dwc3/dwc3-meson-g12a.c | |
parent | 566aacaf80b8ae0cb0e6bc3d11d49a36ab7f32ca (diff) | |
download | linux-1cf084d161f40baf4aa6976bb2dcef114adbebd6.tar.xz |
usb: dwc3: meson-g12a: fix suspend resume regulator unbalanced disables
When going in suspend, in Device mode, then resuming back leads
to the following:
unbalanced disables for USB_PWR_EN
WARNING: CPU: 0 PID: 163 at ../drivers/regulator/core.c:2590 _regulator_disable+0x104/0x180
Hardware name: Amlogic Meson G12A U200 Development Board (DT)
[...]
pc : _regulator_disable+0x104/0x180
lr : _regulator_disable+0x104/0x180
[...]
Call trace:
_regulator_disable+0x104/0x180
regulator_disable+0x40/0x78
dwc3_meson_g12a_otg_mode_set+0x84/0xb0
dwc3_meson_g12a_irq_thread+0x58/0xb8
irq_thread_fn+0x28/0x80
irq_thread+0x118/0x1b8
kthread+0xf4/0x120
ret_from_fork+0x10/0x18
This disables the regulator if enabled on suspend, and the reverse on
resume.
Fixes: c99993376f72 ("usb: dwc3: Add Amlogic G12A DWC3 glue")
Tested-by: Kevin Hilman <khilman@baylibre.com>
Reported-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc3/dwc3-meson-g12a.c')
-rw-r--r-- | drivers/usb/dwc3/dwc3-meson-g12a.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c index d73ccd9e1366..8a3ec1a951fe 100644 --- a/drivers/usb/dwc3/dwc3-meson-g12a.c +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -562,7 +562,13 @@ static int __maybe_unused dwc3_meson_g12a_runtime_resume(struct device *dev) static int __maybe_unused dwc3_meson_g12a_suspend(struct device *dev) { struct dwc3_meson_g12a *priv = dev_get_drvdata(dev); - int i; + int i, ret; + + if (priv->vbus && priv->otg_phy_mode == PHY_MODE_USB_HOST) { + ret = regulator_disable(priv->vbus); + if (ret) + return ret; + } for (i = 0 ; i < PHY_COUNT ; ++i) { phy_power_off(priv->phys[i]); @@ -597,6 +603,12 @@ static int __maybe_unused dwc3_meson_g12a_resume(struct device *dev) return ret; } + if (priv->vbus && priv->otg_phy_mode == PHY_MODE_USB_HOST) { + ret = regulator_enable(priv->vbus); + if (ret) + return ret; + } + return 0; } |