From 2ba9bd9434a14ecfc50195cfb0348814d5f01152 Mon Sep 17 00:00:00 2001 From: Rajkumar Subbiah Date: Mon, 13 Jul 2020 08:53:27 -0400 Subject: [PATCH 1/2] disp: msm: dp: skip dp disconnect if already in progress When dp disconnect is triggered, as part of the teardown process, the driver sends a notification to audio driver and waits for the audio driver to complete before proceeding. When back to back disconnects are triggered currently there is no check if a disconnect is already in progress. So the driver ends up reinitializing the signal completion that the previous disconnect thread is waiting on causing this issue. This change adds a check at the beginning of disconnect handling and bail out if a disconnect is already in progress. Change-Id: I2eaee339408d9dbc120f8efc14d86fca0ebb0758 Signed-off-by: Rajkumar Subbiah --- msm/dp/dp_display.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/msm/dp/dp_display.c b/msm/dp/dp_display.c index 6ba2cac3b533..3e58b7a72666 100644 --- a/msm/dp/dp_display.c +++ b/msm/dp/dp_display.c @@ -1335,6 +1335,13 @@ static int dp_display_usbpd_disconnect_cb(struct device *dev) SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_ENTRY, dp->state, dp->debug->psm_enabled); + /* skip if a disconnect is already in progress */ + if (dp_display_state_is(DP_STATE_ABORTED)) { + DP_DEBUG("disconnect already in progress\n"); + SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_CASE1, dp->state); + return 0; + } + if (dp->debug->psm_enabled && dp_display_state_is(DP_STATE_READY)) dp->link->psm_config(dp->link, &dp->panel->link_info, true); From 853e959f4d89618affec5cad15ac72b769d7a37c Mon Sep 17 00:00:00 2001 From: Rajkumar Subbiah Date: Mon, 13 Jul 2020 13:45:13 -0400 Subject: [PATCH 2/2] disp: msm: dp: ensure display is disabled before deinit When hpd disconnect is received, the dp driver sends an uevent to usermode and waits for the usermode to tear down all external displays before turning off the dp link. If the wait for uevent completion times out or exits prematurely due to a race condition with the connect path, it is possible for the dp link to be turned off prematurely, with displays still in enabled state. On a subsequent hpd disconnect, the driver attempts to disable the display causing this issue since the link has been already turned off. This change adds a check for display status after uevent handling and before turning off dp link, to make sure the displays are always cleaned up before the link is turned off. Any future attempts to disable from usermode will be ignored. Change-Id: I404ad90b037fede9c9469a2fd16ca1fbdbd36b7c Signed-off-by: Rajkumar Subbiah --- msm/dp/dp_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msm/dp/dp_display.c b/msm/dp/dp_display.c index 3e58b7a72666..d512497c2f16 100644 --- a/msm/dp/dp_display.c +++ b/msm/dp/dp_display.c @@ -1287,7 +1287,7 @@ static int dp_display_handle_disconnect(struct dp_display_private *dp) } mutex_lock(&dp->session_lock); - if (rc && dp_display_state_is(DP_STATE_ENABLED)) + if (dp_display_state_is(DP_STATE_ENABLED)) dp_display_clean(dp); dp_display_host_unready(dp);