From 6076cdc39559317f8a78fa9c1fa971ade24e51cf Mon Sep 17 00:00:00 2001 From: Harsh Agarwal Date: Mon, 21 Dec 2020 11:52:24 +0530 Subject: [PATCH] usb: host: Disable system wakeup if remote wakeup is not required For some platforms, remote wakeup capability from system suspend is not a default requirement. Keep system wakeup as disabled from dwc3-msm and xhci-plat. Change-Id: Ic32af43c818f666228db5921e927f66c3554c0f4 Signed-off-by: Harsh Agarwal --- drivers/usb/dwc3/dwc3-msm.c | 6 ++++-- drivers/usb/dwc3/host.c | 4 ---- drivers/usb/host/xhci-plat.c | 11 +++++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c index f578fbed9d24..538d5821537e 100644 --- a/drivers/usb/dwc3/dwc3-msm.c +++ b/drivers/usb/dwc3/dwc3-msm.c @@ -4470,7 +4470,9 @@ static int dwc3_msm_probe(struct platform_device *pdev) atomic_set(&dwc->in_lpm, 1); pm_runtime_set_autosuspend_delay(mdwc->dev, 1000); pm_runtime_use_autosuspend(mdwc->dev); - device_init_wakeup(mdwc->dev, 1); + /* Skip creating device wakeup node if remote wakeup is not a requirement*/ + if (!dwc->ignore_wakeup_src_in_hostmode) + device_init_wakeup(mdwc->dev, 1); if (of_property_read_bool(node, "qcom,disable-dev-mode-pm")) pm_runtime_get_noresume(mdwc->dev); @@ -5316,7 +5318,7 @@ static int dwc3_msm_pm_suspend(struct device *dev) } /* Wakeup not required for automotive/telematics platform host mode */ - ret = dwc3_msm_suspend(mdwc, false, false); + ret = dwc3_msm_suspend(mdwc, false, device_may_wakeup(dev)); if (!ret) atomic_set(&mdwc->pm_suspended, 1); diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c index 8f1463a1ba46..79ad03507903 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -115,10 +115,6 @@ int dwc3_host_init(struct dwc3 *dwc) if (dwc->revision <= DWC3_REVISION_300A) props[prop_idx++] = PROPERTY_ENTRY_BOOL("quirk-broken-port-ped"); - if (dwc->ignore_wakeup_src_in_hostmode) - props[prop_idx++] = - PROPERTY_ENTRY_BOOL("ignore-wakeup-src-in-hostmode"); - if (prop_idx) { ret = platform_device_add_properties(xhci, props); if (ret) { diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 2acf74dec14a..9f2f37226075 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -275,7 +275,8 @@ static int xhci_plat_probe(struct platform_device *pdev) *priv = *priv_match; } - device_wakeup_enable(hcd->self.controller); + if (device_may_wakeup(sysdev)) + device_wakeup_enable(hcd->self.controller); xhci->main_hcd = hcd; xhci->shared_hcd = __usb_create_hcd(driver, sysdev, &pdev->dev, @@ -330,8 +331,10 @@ static int xhci_plat_probe(struct platform_device *pdev) goto dealloc_usb2_hcd; device_enable_async_suspend(&pdev->dev); - device_wakeup_enable(&xhci->shared_hcd->self.root_hub->dev); - device_wakeup_enable(&hcd->self.root_hub->dev); + if (device_may_wakeup(sysdev)) { + device_wakeup_enable(&xhci->shared_hcd->self.root_hub->dev); + device_wakeup_enable(&hcd->self.root_hub->dev); + } pm_runtime_mark_last_busy(&pdev->dev); pm_runtime_put_autosuspend(&pdev->dev); @@ -402,7 +405,7 @@ static int xhci_plat_suspend(struct device *dev) dev_dbg(dev, "xhci-plat PM suspend\n"); /* Disable wakeup capability */ - return xhci_suspend(xhci, false); + return xhci_suspend(xhci, device_may_wakeup(dev)); } static int xhci_plat_resume(struct device *dev)