From 6a68c684bdc03afe8989f126d18e41ebcc3e9658 Mon Sep 17 00:00:00 2001 From: Tatenda Chipeperekwa Date: Wed, 13 May 2020 15:56:50 -0700 Subject: [PATCH] disp: msm: dp: exit stream enable on cable disconnect Exit stream enable on cable disconnect considering that the controller and display modules would have transitioned to aborted state. It is possible that the disconnect might have prevented the link clock from being enabled, so we have to skip any register programming in the link clock domain. We remove the unprepare call from the DRM wrapper error handling since that path can lead to unclocked register access when the link clock is not enabled. Change-Id: I92595c0824193df63c2746bc8cd644f59c33604a Signed-off-by: Tatenda Chipeperekwa --- msm/dp/dp_ctrl.c | 5 +++++ msm/dp/dp_display.c | 6 +++--- msm/dp/dp_drm.c | 4 +--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/msm/dp/dp_ctrl.c b/msm/dp/dp_ctrl.c index 1b81192c0278..19445de21d62 100644 --- a/msm/dp/dp_ctrl.c +++ b/msm/dp/dp_ctrl.c @@ -1168,6 +1168,11 @@ static int dp_ctrl_stream_on(struct dp_ctrl *dp_ctrl, struct dp_panel *panel) ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); + if (!ctrl->power_on) { + DP_DEBUG("controller powered off\n"); + return -EPERM; + } + rc = dp_ctrl_enable_stream_clocks(ctrl, panel); if (rc) { DP_ERR("failure on stream clock enable\n"); diff --git a/msm/dp/dp_display.c b/msm/dp/dp_display.c index 78686fd7d16e..487c63fed23c 100644 --- a/msm/dp/dp_display.c +++ b/msm/dp/dp_display.c @@ -1948,8 +1948,8 @@ static int dp_display_prepare(struct dp_display *dp_display, void *panel) end: mutex_unlock(&dp->session_lock); - SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_EXIT, dp->state); - return 0; + SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_EXIT, dp->state, rc); + return rc; } static int dp_display_set_stream_info(struct dp_display *dp_display, @@ -2061,7 +2061,7 @@ static int dp_display_enable(struct dp_display *dp_display, void *panel) dp_display_state_add(DP_STATE_ENABLED); end: mutex_unlock(&dp->session_lock); - SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_EXIT, dp->state); + SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_EXIT, dp->state, rc); return rc; } diff --git a/msm/dp/dp_drm.c b/msm/dp/dp_drm.c index 7496d60d3e4c..fbe5ee87362e 100644 --- a/msm/dp/dp_drm.c +++ b/msm/dp/dp_drm.c @@ -116,11 +116,9 @@ static void dp_bridge_pre_enable(struct drm_bridge *drm_bridge) dp->set_stream_info(dp, bridge->dp_panel, 0, 0, 0, 0, 0); rc = dp->enable(dp, bridge->dp_panel); - if (rc) { + if (rc) DP_ERR("[%d] DP display enable failed, rc=%d\n", bridge->id, rc); - dp->unprepare(dp, bridge->dp_panel); - } } static void dp_bridge_enable(struct drm_bridge *drm_bridge)