Skip to content

Commit e3fafbd

Browse files
jhovoldgregkh
authored andcommitted
usb: dwc3: qcom: fix wakeup implementation
It is the Qualcomm glue wakeup interrupts that may be able to wake the system from suspend and this can now be described in the devicetree. Move the wakeup-source property handling over from the core driver and instead propagate the capability setting to the core device during probe. This is needed as there is currently no way for the core driver to query the wakeup setting of the glue device, but it is the core driver that manages the PHY power state during suspend. Also don't leave the PHYs enabled when system wakeup has been disabled through sysfs. Fixes: 649f5c8 ("usb: dwc3: core: Host wake up support from system suspend") Signed-off-by: Johan Hovold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 416b618 commit e3fafbd

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

drivers/usb/dwc3/core.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,7 +1822,6 @@ static int dwc3_probe(struct platform_device *pdev)
18221822

18231823
platform_set_drvdata(pdev, dwc);
18241824
dwc3_cache_hwparams(dwc);
1825-
device_init_wakeup(&pdev->dev, of_property_read_bool(dev->of_node, "wakeup-source"));
18261825

18271826
spin_lock_init(&dwc->lock);
18281827
mutex_init(&dwc->mutex);
@@ -1984,7 +1983,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg)
19841983
dwc3_core_exit(dwc);
19851984
break;
19861985
case DWC3_GCTL_PRTCAP_HOST:
1987-
if (!PMSG_IS_AUTO(msg) && !device_can_wakeup(dwc->dev)) {
1986+
if (!PMSG_IS_AUTO(msg) && !device_may_wakeup(dwc->dev)) {
19881987
dwc3_core_exit(dwc);
19891988
break;
19901989
}
@@ -2045,7 +2044,7 @@ static int dwc3_resume_common(struct dwc3 *dwc, pm_message_t msg)
20452044
spin_unlock_irqrestore(&dwc->lock, flags);
20462045
break;
20472046
case DWC3_GCTL_PRTCAP_HOST:
2048-
if (!PMSG_IS_AUTO(msg) && !device_can_wakeup(dwc->dev)) {
2047+
if (!PMSG_IS_AUTO(msg) && !device_may_wakeup(dwc->dev)) {
20492048
ret = dwc3_core_init_for_resume(dwc);
20502049
if (ret)
20512050
return ret;

drivers/usb/dwc3/dwc3-qcom.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,7 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
786786
struct resource *res, *parent_res = NULL;
787787
int ret, i;
788788
bool ignore_pipe_clk;
789+
bool wakeup_source;
789790

790791
qcom = devm_kzalloc(&pdev->dev, sizeof(*qcom), GFP_KERNEL);
791792
if (!qcom)
@@ -901,7 +902,10 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
901902
if (ret)
902903
goto interconnect_exit;
903904

904-
device_init_wakeup(&pdev->dev, 1);
905+
wakeup_source = of_property_read_bool(dev->of_node, "wakeup-source");
906+
device_init_wakeup(&pdev->dev, wakeup_source);
907+
device_init_wakeup(&qcom->dwc3->dev, wakeup_source);
908+
905909
qcom->is_suspended = false;
906910
pm_runtime_set_active(dev);
907911
pm_runtime_enable(dev);

0 commit comments

Comments
 (0)