From 732622e52c2d60fb89e1b09d8f4e850a016d2a40 Mon Sep 17 00:00:00 2001 From: Aravind Venkateswaran Date: Tue, 10 Dec 2019 14:07:12 -0800 Subject: [PATCH] disp: msm: dp: init/deinit host only for cable connection/disconnection DP host initialization and de-initialization need to be done only in response to cable connect/disconnect events. De-initializing host (which includes turning off all regulators), for every HPD low events is unnecessary and can cause unintended issues with DP CTS tests. Change-Id: I95ac71853dc14a46e4175cf0bee4c3eae315fc1e Signed-off-by: Aravind Venkateswaran Signed-off-by: Tatenda Chipeperekwa --- msm/dp/dp_display.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/msm/dp/dp_display.c b/msm/dp/dp_display.c index ce58c17fe11d..c8dd23d9eb61 100644 --- a/msm/dp/dp_display.c +++ b/msm/dp/dp_display.c @@ -866,6 +866,25 @@ static void dp_display_host_ready(struct dp_display_private *dp) return; } + /* + * Reset the aborted state for AUX and CTRL modules. This will + * allow these modules to execute normally in response to the + * cable connection event. + * + * One corner case still exists. While the execution flow ensures + * that cable disconnection flushes all pending work items on the DP + * workqueue, and waits for the user module to clean up the DP + * connection session, it is possible that the system delays can + * lead to timeouts in the connect path. As a result, the actual + * connection callback from user modules can come in late and can + * race against a subsequent connection event here which would have + * reset the aborted flags. There is no clear solution for this since + * the connect/disconnect notifications do not currently have any + * sessions IDs. + */ + dp->aux->abort(dp->aux, false); + dp->ctrl->abort(dp->ctrl, false); + dp->aux->init(dp->aux, dp->parser->aux_cfg); dp->panel->init(dp->panel); @@ -934,7 +953,6 @@ static int dp_display_process_hpd_high(struct dp_display_private *dp) dp->dp_display.max_pclk_khz = min(dp->parser->max_pclk_khz, dp->debug->max_pclk_khz); - dp_display_host_init(dp); dp_display_host_ready(dp); dp->link->psm_config(dp->link, &dp->panel->link_info, false); @@ -1164,7 +1182,6 @@ static int dp_display_handle_disconnect(struct dp_display_private *dp) dp_display_clean(dp); dp_display_host_unready(dp); - dp_display_host_deinit(dp); mutex_unlock(&dp->session_lock); @@ -1215,6 +1232,10 @@ static int dp_display_usbpd_disconnect_cb(struct device *dev) dp_display_disconnect_sync(dp); + mutex_lock(&dp->session_lock); + dp_display_host_deinit(dp); + mutex_unlock(&dp->session_lock); + if (!dp->debug->sim_mode && !dp->parser->no_aux_switch && !dp->parser->gpio_aux_switch) dp->aux->aux_switch(dp->aux, false, ORIENTATION_NONE);