Pārlūkot izejas kodu

Revert "disp: msm: dsi: skip DSI disable operations in trusted VM"

This reverts commit 61518d4f5f49a0acf94d9c5257b46c2afc27bcfd.

This change corrupts the DSI engine state machine which expects
all the state tracking updates from the calls that are now being
skipped.

Change-Id: I506ecbd98cc771950b17212a2702e7dde81fe539
Signed-off-by: Steve Cohen <[email protected]>
Steve Cohen 3 gadi atpakaļ
vecāks
revīzija
b57a445cf4
1 mainītis faili ar 28 papildinājumiem un 21 dzēšanām
  1. 28 21
      msm/dsi/dsi_display.c

+ 28 - 21
msm/dsi/dsi_display.c

@@ -313,6 +313,7 @@ static int dsi_display_cmd_engine_disable(struct dsi_display *display)
 	int rc = 0;
 	int i;
 	struct dsi_display_ctrl *m_ctrl, *ctrl;
+	bool skip_op = is_skip_op_required(display);
 
 	m_ctrl = &display->ctrl[display->cmd_master_idx];
 	mutex_lock(&m_ctrl->ctrl->ctrl_lock);
@@ -325,14 +326,14 @@ static int dsi_display_cmd_engine_disable(struct dsi_display *display)
 		rc = dsi_ctrl_set_cmd_engine_state(ctrl->ctrl, DSI_CTRL_ENGINE_OFF);
 		if (rc)
 			DSI_ERR(
-			   "[%s] disable cmd engine failed, rc:%d\n",
-				display->name, rc);
+			   "[%s] disable cmd engine failed, skip_op:%d rc:%d\n",
+				display->name, skip_op, rc);
 	}
 
 	rc = dsi_ctrl_set_cmd_engine_state(m_ctrl->ctrl, DSI_CTRL_ENGINE_OFF);
 	if (rc)
-		DSI_ERR("[%s] disable mcmd engine failed, rc:%d\n",
-			display->name, rc);
+		DSI_ERR("[%s] disable mcmd engine failed, skip_op:%d rc:%d\n",
+			display->name, skip_op, rc);
 
 	mutex_unlock(&m_ctrl->ctrl->ctrl_lock);
 	return rc;
@@ -8486,41 +8487,47 @@ int dsi_display_disable(struct dsi_display *display)
 	rc = dsi_display_wake_up(display);
 	if (rc)
 		DSI_ERR("[%s] display wake up failed, rc=%d\n",
-			display->name, rc);
-
-	if (is_skip_op_required(display)) {
-		/* applicable only for trusted vm */
-		display->panel->panel_initialized = false;
-		display->panel->power_mode = SDE_MODE_DPMS_OFF;
-		goto out_unlock;
-	}
+		       display->name, rc);
 
 	if (display->config.panel_mode == DSI_OP_VIDEO_MODE) {
 		rc = dsi_display_vid_engine_disable(display);
 		if (rc)
-			DSI_ERR("[%s]failed to disable DSI vid engine, rc=%d\n", display->name, rc);
+			DSI_ERR("[%s]failed to disable DSI vid engine, rc=%d\n",
+			       display->name, rc);
 	} else if (display->config.panel_mode == DSI_OP_CMD_MODE) {
-		/* On POMS request , disable panel TE through delayed work queue. */
-		if (display->poms_pending && display->panel->poms_align_vsync) {
-			INIT_DELAYED_WORK(&display->poms_te_work, dsi_display_handle_poms_te);
-			queue_delayed_work(system_wq, &display->poms_te_work,
+		/**
+		 * On POMS request , disable panel TE through
+		 * delayed work queue.
+		 */
+		if (display->poms_pending &&
+				display->panel->poms_align_vsync) {
+			INIT_DELAYED_WORK(&display->poms_te_work,
+					dsi_display_handle_poms_te);
+			queue_delayed_work(system_wq,
+					&display->poms_te_work,
 					msecs_to_jiffies(100));
 		}
 		rc = dsi_display_cmd_engine_disable(display);
 		if (rc)
-			DSI_ERR("[%s]failed to disable DSI cmd engine, rc=%d\n", display->name, rc);
+			DSI_ERR("[%s]failed to disable DSI cmd engine, rc=%d\n",
+			       display->name, rc);
 	} else {
 		DSI_ERR("[%s] Invalid configuration\n", display->name);
 		rc = -EINVAL;
 	}
 
-	if (!display->poms_pending) {
+	if (!display->poms_pending && !is_skip_op_required(display)) {
 		rc = dsi_panel_disable(display->panel);
 		if (rc)
-			DSI_ERR("[%s] failed to disable DSI panel, rc=%d\n", display->name, rc);
+			DSI_ERR("[%s] failed to disable DSI panel, rc=%d\n",
+				display->name, rc);
 	}
 
-out_unlock:
+	if (is_skip_op_required(display)) {
+		/* applicable only for trusted vm */
+		display->panel->panel_initialized = false;
+		display->panel->power_mode = SDE_MODE_DPMS_OFF;
+	}
 	mutex_unlock(&display->display_lock);
 	SDE_EVT32(SDE_EVTLOG_FUNC_EXIT);
 	return rc;