From bb6f15ba11f3c5424a71cb10ef4f8d5a3bb87df2 Mon Sep 17 00:00:00 2001 From: Yashwanth Date: Fri, 9 Apr 2021 14:58:48 +0530 Subject: [PATCH] disp: msm: sde: flush commit thread queue during pm suspend Following is the sequence during which issue is observed: 1) After suspend, resume commit is with doze suspend mode (LP2) but kickoff didn't begin. 2) At the same time, runtime pm suspend is triggered which makes idle request on pm suspend/resume thread. 3) Since the kickoff has not yet started on commit thread, pending kickoff count is not updated and idle power collapse sequence is started from pm suspend. 4) As part of idle, irqs are turned off from pm suspend thread which are turned on commit thread after kickoff before pp tx irq arrives. In such cases, during pm suspend, commit thread workqueue is flushed before encoder idle request to prevent irq's from getting turned off before the transfer is complete to avoid inconsistent state. Change-Id: I417ece0ae7021b0fc5005e262a0d87e43ac729be Signed-off-by: Yashwanth --- msm/sde/sde_kms.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/msm/sde/sde_kms.c b/msm/sde/sde_kms.c index 78bcf7aed5be..df3e6a41b341 100644 --- a/msm/sde/sde_kms.c +++ b/msm/sde/sde_kms.c @@ -3492,6 +3492,11 @@ static void _sde_kms_pm_suspend_idle_helper(struct sde_kms *sde_kms, if (sde_encoder_in_clone_mode(conn->encoder)) continue; + crtc_id = drm_crtc_index(conn->state->crtc); + if (priv->disp_thread[crtc_id].thread) + kthread_flush_worker( + &priv->disp_thread[crtc_id].worker); + ret = sde_encoder_wait_for_event(conn->encoder, MSM_ENC_TX_COMPLETE); if (ret && ret != -EWOULDBLOCK) { @@ -3499,7 +3504,6 @@ static void _sde_kms_pm_suspend_idle_helper(struct sde_kms *sde_kms, "[conn: %d] wait for commit done returned %d\n", conn->base.id, ret); } else if (!ret) { - crtc_id = drm_crtc_index(conn->state->crtc); if (priv->event_thread[crtc_id].thread) kthread_flush_worker( &priv->event_thread[crtc_id].worker);