usb: dwc3: dwc3-msm-core: MOVE perf_vote_enable in msm_suspend

During Host mode RT suspend, we remove PM QoS requests at the
beginning of msm_suspend(). However, if msm_prepare_suspend()
fails and we bail out after resuming xHCI. And we won't add
the perf votes again from msm_resume(), since msm_suspend()
never succeeded and the in_lpm flag was not set.

Consequently, during the next dwc3_msm_suspend(), we remove the
perf votes again results in warnings in kernel logs.

To address this issue:
- Move the perf_vote_enable(false) operation after completing
  dwc3_msm_prepare_suspend().
- moving pm_qos_add() or pm_qos_remove() to msm_probe and
  msm_remove respectively.

Change-Id: Id064b0fe55e03905ba6c60c533519d5e0268b1c1
Signed-off-by: Rajashekar kuruva <quic_kuruva@quicinc.com>
This commit is contained in:
Rajashekar kuruva 2024-07-03 10:45:33 +05:30 committed by Rajashekar Kuruva
parent 3b9ebc6f81
commit 6b964b0f9f

View File

@ -4232,7 +4232,6 @@ static int dwc3_msm_suspend(struct dwc3_msm *mdwc, bool force_power_collapse)
return 0;
}
msm_dwc3_perf_vote_enable(mdwc, false);
if (dwc) {
if (!mdwc->in_host_mode) {
evt = dwc->ev_buf;
@ -4289,6 +4288,8 @@ static int dwc3_msm_suspend(struct dwc3_msm *mdwc, bool force_power_collapse)
return ret;
}
msm_dwc3_perf_vote_enable(mdwc, false);
/* disable power event irq, hs and ss phy irq is used as wake up src */
disable_irq_nosync(mdwc->wakeup_irq[PWR_EVNT_IRQ].irq);
@ -6493,6 +6494,12 @@ static int dwc3_msm_probe(struct platform_device *pdev)
}
mdwc->force_disconnect = false;
/* Add pm_qos with default mode intially */
if (mdwc->pm_qos_latency)
cpu_latency_qos_add_request(&mdwc->pm_qos_req_dma,
PM_QOS_DEFAULT_VALUE);
return 0;
put_dwc3:
@ -6543,6 +6550,10 @@ static int dwc3_msm_remove(struct platform_device *pdev)
msm_dwc3_perf_vote_enable(mdwc, false);
cancel_work_sync(&mdwc->sm_work);
/* Remove pm_qos request */
if (mdwc->pm_qos_latency)
cpu_latency_qos_remove_request(&mdwc->pm_qos_req_dma);
if (mdwc->hs_phy)
mdwc->hs_phy->flags &= ~PHY_HOST_MODE;
dwc3_msm_notify_event(dwc, DWC3_GSI_EVT_BUF_FREE, 0);
@ -6843,9 +6854,6 @@ static void msm_dwc3_perf_vote_enable(struct dwc3_msm *mdwc, bool enable)
/* make sure when enable work, save a valid start irq count */
mdwc->irq_cnt = irq_desc->tot_count;
/* start default mode intially */
cpu_latency_qos_add_request(&mdwc->pm_qos_req_dma,
PM_QOS_DEFAULT_VALUE);
schedule_delayed_work(&mdwc->perf_vote_work,
msecs_to_jiffies(PM_QOS_DEFAULT_SAMPLE_MS));
} else {
@ -6853,7 +6861,6 @@ static void msm_dwc3_perf_vote_enable(struct dwc3_msm *mdwc, bool enable)
return;
cancel_delayed_work_sync(&mdwc->perf_vote_work);
msm_dwc3_perf_vote_update(mdwc, false);
cpu_latency_qos_remove_request(&mdwc->pm_qos_req_dma);
}
}