usb: dwc3: msm: Disable system wakeup if remote wakeup is not required

Remote wakeup capability from system suspend is not a requirement for
certain hardware platforms. Keep system wakeup disabled based on the DT
property "qcom,disable-wakeup", and disable the interrupt accordingly.

Change-Id: I0b82877aa51616420bef414a5aa615736b99ac00
Signed-off-by: Faisal Hassan <quic_faisalh@quicinc.com>
This commit is contained in:
Faisal Hassan 2024-09-11 00:22:17 +05:30
parent 03411905c8
commit febf6564b5

View file

@ -4223,7 +4223,8 @@ static void dwc3_msm_interrupt_enable(struct dwc3_msm *mdwc, bool enable)
}
}
static int dwc3_msm_suspend(struct dwc3_msm *mdwc, bool force_power_collapse)
static int dwc3_msm_suspend(struct dwc3_msm *mdwc, bool force_power_collapse,
bool enable_wakeup)
{
int ret;
struct dwc3 *dwc = NULL;
@ -4346,7 +4347,7 @@ static int dwc3_msm_suspend(struct dwc3_msm *mdwc, bool force_power_collapse)
* case of platforms with mpm interrupts and snps phy, enable
* dpse hsphy irq and dmse hsphy irq as done for pdc interrupts.
*/
dwc3_msm_interrupt_enable(mdwc, true);
dwc3_msm_interrupt_enable(mdwc, enable_wakeup);
if (mdwc->use_pwr_event_for_wakeup &&
!(mdwc->lpm_flags & MDWC3_SS_PHY_SUSPEND))
@ -6216,6 +6217,7 @@ static int dwc3_msm_probe(struct platform_device *pdev)
struct resource *res;
int ret = 0, i;
u32 val;
bool disable_wakeup;
mdwc = devm_kzalloc(&pdev->dev, sizeof(*mdwc), GFP_KERNEL);
if (!mdwc)
@ -6390,7 +6392,10 @@ static int dwc3_msm_probe(struct platform_device *pdev)
atomic_set(&mdwc->in_lpm, 1);
pm_runtime_set_autosuspend_delay(mdwc->dev, 1000);
pm_runtime_use_autosuspend(mdwc->dev);
device_init_wakeup(mdwc->dev, 1);
disable_wakeup =
device_property_read_bool(mdwc->dev, "qcom,disable-wakeup");
device_init_wakeup(mdwc->dev, !disable_wakeup);
if (of_property_read_bool(node, "qcom,disable-dev-mode-pm"))
pm_runtime_get_noresume(mdwc->dev);
@ -7465,10 +7470,17 @@ static int dwc3_msm_pm_suspend(struct device *dev)
* Power collapse the core. Hence call dwc3_msm_suspend with
* 'force_power_collapse' set to 'true'.
*/
ret = dwc3_msm_suspend(mdwc, true);
ret = dwc3_msm_suspend(mdwc, true, device_may_wakeup(dev));
if (!ret)
atomic_set(&mdwc->pm_suspended, 1);
/*
* Disable IRQs if not wakeup capable. Wakeup IRQs may sometimes
* be enabled as part of a runtime suspend.
*/
if (!device_may_wakeup(dev))
dwc3_msm_interrupt_enable(mdwc, false);
return ret;
}
@ -7616,7 +7628,7 @@ static int dwc3_msm_runtime_suspend(struct device *dev)
if (dwc)
device_init_wakeup(dwc->dev, false);
return dwc3_msm_suspend(mdwc, false);
return dwc3_msm_suspend(mdwc, false, true);
}
static int dwc3_msm_runtime_resume(struct device *dev)