Browse Source

disp: msm: dsi: flush workers during pre-release

Wait for asynchronous DSI DCS command transfers to complete
before disabling DSI interrupts during pre-release. This is
required to resolve a race condition where dsi worker threads
can trigger HW access while a VM lend/release is occurring on
the CRTC commit thread.

Change-Id: Ia1f153a2cd008c617dba274473e7678b01a38d29
Signed-off-by: Steve Cohen <[email protected]>
Steve Cohen 3 years ago
parent
commit
bd01b504a5
1 changed files with 12 additions and 0 deletions
  1. 12 0
      msm/dsi/dsi_display.c

+ 12 - 0
msm/dsi/dsi_display.c

@@ -5419,6 +5419,7 @@ static int dsi_display_get_io_resources(struct msm_io_res *io_res, void *data)
 static int dsi_display_pre_release(void *data)
 {
 	struct dsi_display *display;
+	int i;
 
 	if (!data)
 		return -EINVAL;
@@ -5428,6 +5429,17 @@ static int dsi_display_pre_release(void *data)
 	display->hw_ownership = false;
 	mutex_unlock(&display->display_lock);
 
+	/* flush work queues */
+	display_for_each_ctrl(i, display) {
+		struct dsi_display_ctrl *ctrl = &display->ctrl[i];
+
+		if (!ctrl->ctrl || !(ctrl->ctrl->post_tx_queued))
+			continue;
+		flush_workqueue(display->post_cmd_tx_workq);
+		cancel_work_sync(&ctrl->ctrl->post_cmd_tx_work);
+		ctrl->ctrl->post_tx_queued = false;
+	}
+
 	dsi_display_ctrl_irq_update(display, false);
 
 	return 0;