From 91a070feb3abdb9a96f88fe29a92f2f218e4d282 Mon Sep 17 00:00:00 2001 From: Abhijit Kulkarni Date: Tue, 10 Nov 2020 14:31:35 -0800 Subject: [PATCH] disp: msm: sde: request hard reset on vsync timeout During frame updates if vsync timeout happens, the probable reason is pixel_clock is turned off. In such a case the recent update is not applied on hw and can lead to issues. For example if a pipe was detached it will not get detached since this update will not take place. This change detects the timeout and requests a hard reset from user mode driver so as to ensure that all the displays are power off and footswitch is turned off. This will ensure dpu hardware gets reset. Change-Id: Ic9bade88b6502feb7334d239eaf669977233dbac Signed-off-by: Abhijit Kulkarni --- msm/sde/sde_encoder_phys_vid.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/msm/sde/sde_encoder_phys_vid.c b/msm/sde/sde_encoder_phys_vid.c index 08cafe49..2c556c4f 100644 --- a/msm/sde/sde_encoder_phys_vid.c +++ b/msm/sde/sde_encoder_phys_vid.c @@ -877,12 +877,15 @@ static int _sde_encoder_phys_vid_wait_for_vblank( u32 event = SDE_ENCODER_FRAME_EVENT_ERROR | SDE_ENCODER_FRAME_EVENT_SIGNAL_RELEASE_FENCE | SDE_ENCODER_FRAME_EVENT_SIGNAL_RETIRE_FENCE; + struct drm_connector *conn; if (!phys_enc) { pr_err("invalid encoder\n"); return -EINVAL; } + conn = phys_enc->connector; + wait_info.wq = &phys_enc->pending_kickoff_wq; wait_info.atomic_cnt = &phys_enc->pending_kickoff_cnt; wait_info.timeout_ms = KICKOFF_TIMEOUT_MS; @@ -893,10 +896,16 @@ static int _sde_encoder_phys_vid_wait_for_vblank( if (notify && (ret == -ETIMEDOUT) && atomic_add_unless(&phys_enc->pending_retire_fence_cnt, -1, 0) && - phys_enc->parent_ops.handle_frame_done) + phys_enc->parent_ops.handle_frame_done) { phys_enc->parent_ops.handle_frame_done( phys_enc->parent, phys_enc, event); + if (sde_encoder_recovery_events_enabled(phys_enc->parent)) + sde_connector_event_notify(conn, + DRM_EVENT_SDE_HW_RECOVERY, + sizeof(uint8_t), SDE_RECOVERY_HARD_RESET); + } + SDE_EVT32(DRMID(phys_enc->parent), event, notify, ret, ret ? SDE_EVTLOG_FATAL : 0); return ret;