Commit 6498a96c authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

usb: dwc3: qcom: fix runtime PM wakeup

A device must enable wakeups during runtime suspend regardless of
whether it is capable and allowed to wake the system up from system
suspend.

Fixes: 2664deb0 ("usb: dwc3: qcom: Honor wakeup enabled/disabled state")
Tested-by: default avatarMatthias Kaehlcke <mka@chromium.org>
Reviewed-by: default avatarMatthias Kaehlcke <mka@chromium.org>
Reviewed-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20220804151001.23612-6-johan+linaro@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a872ab30
...@@ -397,7 +397,7 @@ static void dwc3_qcom_enable_interrupts(struct dwc3_qcom *qcom) ...@@ -397,7 +397,7 @@ static void dwc3_qcom_enable_interrupts(struct dwc3_qcom *qcom)
dwc3_qcom_enable_wakeup_irq(qcom->ss_phy_irq, 0); dwc3_qcom_enable_wakeup_irq(qcom->ss_phy_irq, 0);
} }
static int dwc3_qcom_suspend(struct dwc3_qcom *qcom) static int dwc3_qcom_suspend(struct dwc3_qcom *qcom, bool wakeup)
{ {
u32 val; u32 val;
int i, ret; int i, ret;
...@@ -416,7 +416,7 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom) ...@@ -416,7 +416,7 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom)
if (ret) if (ret)
dev_warn(qcom->dev, "failed to disable interconnect: %d\n", ret); dev_warn(qcom->dev, "failed to disable interconnect: %d\n", ret);
if (device_may_wakeup(qcom->dev)) { if (wakeup) {
qcom->usb2_speed = dwc3_qcom_read_usb2_speed(qcom); qcom->usb2_speed = dwc3_qcom_read_usb2_speed(qcom);
dwc3_qcom_enable_interrupts(qcom); dwc3_qcom_enable_interrupts(qcom);
} }
...@@ -426,7 +426,7 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom) ...@@ -426,7 +426,7 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom)
return 0; return 0;
} }
static int dwc3_qcom_resume(struct dwc3_qcom *qcom) static int dwc3_qcom_resume(struct dwc3_qcom *qcom, bool wakeup)
{ {
int ret; int ret;
int i; int i;
...@@ -434,7 +434,7 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom) ...@@ -434,7 +434,7 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom)
if (!qcom->is_suspended) if (!qcom->is_suspended)
return 0; return 0;
if (device_may_wakeup(qcom->dev)) if (wakeup)
dwc3_qcom_disable_interrupts(qcom); dwc3_qcom_disable_interrupts(qcom);
for (i = 0; i < qcom->num_clocks; i++) { for (i = 0; i < qcom->num_clocks; i++) {
...@@ -945,9 +945,11 @@ static int dwc3_qcom_remove(struct platform_device *pdev) ...@@ -945,9 +945,11 @@ static int dwc3_qcom_remove(struct platform_device *pdev)
static int __maybe_unused dwc3_qcom_pm_suspend(struct device *dev) static int __maybe_unused dwc3_qcom_pm_suspend(struct device *dev)
{ {
struct dwc3_qcom *qcom = dev_get_drvdata(dev); struct dwc3_qcom *qcom = dev_get_drvdata(dev);
bool wakeup = device_may_wakeup(dev);
int ret = 0; int ret = 0;
ret = dwc3_qcom_suspend(qcom);
ret = dwc3_qcom_suspend(qcom, wakeup);
if (!ret) if (!ret)
qcom->pm_suspended = true; qcom->pm_suspended = true;
...@@ -957,9 +959,10 @@ static int __maybe_unused dwc3_qcom_pm_suspend(struct device *dev) ...@@ -957,9 +959,10 @@ static int __maybe_unused dwc3_qcom_pm_suspend(struct device *dev)
static int __maybe_unused dwc3_qcom_pm_resume(struct device *dev) static int __maybe_unused dwc3_qcom_pm_resume(struct device *dev)
{ {
struct dwc3_qcom *qcom = dev_get_drvdata(dev); struct dwc3_qcom *qcom = dev_get_drvdata(dev);
bool wakeup = device_may_wakeup(dev);
int ret; int ret;
ret = dwc3_qcom_resume(qcom); ret = dwc3_qcom_resume(qcom, wakeup);
if (!ret) if (!ret)
qcom->pm_suspended = false; qcom->pm_suspended = false;
...@@ -970,14 +973,14 @@ static int __maybe_unused dwc3_qcom_runtime_suspend(struct device *dev) ...@@ -970,14 +973,14 @@ static int __maybe_unused dwc3_qcom_runtime_suspend(struct device *dev)
{ {
struct dwc3_qcom *qcom = dev_get_drvdata(dev); struct dwc3_qcom *qcom = dev_get_drvdata(dev);
return dwc3_qcom_suspend(qcom); return dwc3_qcom_suspend(qcom, true);
} }
static int __maybe_unused dwc3_qcom_runtime_resume(struct device *dev) static int __maybe_unused dwc3_qcom_runtime_resume(struct device *dev)
{ {
struct dwc3_qcom *qcom = dev_get_drvdata(dev); struct dwc3_qcom *qcom = dev_get_drvdata(dev);
return dwc3_qcom_resume(qcom); return dwc3_qcom_resume(qcom, true);
} }
static const struct dev_pm_ops dwc3_qcom_dev_pm_ops = { static const struct dev_pm_ops dwc3_qcom_dev_pm_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment