Răsfoiți Sursa

disp: msm: dsi: reuse continuous splash path for trusted vm

Display in trusted VM works in a handover mode i.e, all
display components need to be initialized by the primary VM
before switching to trusted VM on the usecase boundary.
That makes it a hard requirement for the trusted VM not to
re-program any of the display configuration registers before
it could hand the HW back to the primary VM.

Also, most of the linux framework drivers including pintrl, clocks
are not enabled in the trusted VM.

In order to address the above two limitations and to control the
probe/commit sequences, this change adapts the same path as that
of continuous splash to bypass some of the critical functions
which are identified to be HW intrusive. Based on the DT property
read from SDE handle, dsi drivers will choose to bypass
enable/disable HW state updates when executing in the vm environment.

Change-Id: Ica71c924d189ab65fe3be5b0ac870633e3b749e1
Signed-off-by: Jeykumar Sankaran <[email protected]>
Signed-off-by: Veera Sundaram Sankaran <[email protected]>
Jeykumar Sankaran 5 ani în urmă
părinte
comite
4b27380f07
8 a modificat fișierele cu 302 adăugiri și 238 ștergeri
  1. 42 61
      msm/dsi/dsi_ctrl.c
  2. 12 16
      msm/dsi/dsi_ctrl.h
  3. 167 139
      msm/dsi/dsi_display.c
  4. 4 0
      msm/dsi/dsi_display.h
  5. 45 12
      msm/dsi/dsi_panel.c
  6. 16 1
      msm/dsi/dsi_panel.h
  7. 9 5
      msm/dsi/dsi_phy.c
  8. 7 4
      msm/dsi/dsi_phy.h

+ 42 - 61
msm/dsi/dsi_ctrl.c

@@ -2792,7 +2792,8 @@ int dsi_ctrl_update_host_state(struct dsi_ctrl *dsi_ctrl,
 /**
  * dsi_ctrl_host_init() - Initialize DSI host hardware.
  * @dsi_ctrl:        DSI controller handle.
- * @is_splash_enabled:        boolean signifying splash status.
+ * @skip_op:         Boolean to indicate few operations can be skipped.
+ *                   Set during the cont-splash or trusted-vm enable case.
  *
  * Initializes DSI controller hardware with host configuration provided by
  * dsi_ctrl_update_host_config(). Initialization can be performed only during
@@ -2801,7 +2802,7 @@ int dsi_ctrl_update_host_state(struct dsi_ctrl *dsi_ctrl,
  *
  * Return: error code.
  */
-int dsi_ctrl_host_init(struct dsi_ctrl *dsi_ctrl, bool is_splash_enabled)
+int dsi_ctrl_host_init(struct dsi_ctrl *dsi_ctrl, bool skip_op)
 {
 	int rc = 0;
 
@@ -2818,10 +2819,11 @@ int dsi_ctrl_host_init(struct dsi_ctrl *dsi_ctrl, bool is_splash_enabled)
 		goto error;
 	}
 
-	/* For Splash usecases we omit hw operations as bootloader
-	 * already takes care of them
+	/*
+	 * For continuous splash/trusted vm usecases we omit hw operations
+	 * as bootloader/primary vm takes care of them respectively
 	 */
-	if (!is_splash_enabled) {
+	if (!skip_op) {
 		dsi_ctrl->hw.ops.setup_lane_map(&dsi_ctrl->hw,
 					&dsi_ctrl->host_config.lane_map);
 
@@ -2850,8 +2852,8 @@ int dsi_ctrl_host_init(struct dsi_ctrl *dsi_ctrl, bool is_splash_enabled)
 	dsi_ctrl->hw.ops.enable_status_interrupts(&dsi_ctrl->hw, 0x0);
 	dsi_ctrl_enable_error_interrupts(dsi_ctrl);
 
-	DSI_CTRL_DEBUG(dsi_ctrl, "Host initialization complete, continuous splash status:%d\n",
-		is_splash_enabled);
+	DSI_CTRL_DEBUG(dsi_ctrl, "Host initialization complete, skip op: %d\n",
+			skip_op);
 	dsi_ctrl_update_state(dsi_ctrl, DSI_CTRL_OP_HOST_INIT, 0x1);
 error:
 	mutex_unlock(&dsi_ctrl->ctrl_lock);
@@ -3249,42 +3251,6 @@ int dsi_ctrl_get_host_engine_init_state(struct dsi_ctrl *dsi_ctrl,
 	return 0;
 }
 
-/**
- * dsi_ctrl_update_host_engine_state_for_cont_splash() -
- *            set engine state for dsi controller during continuous splash
- * @dsi_ctrl:          DSI controller handle.
- * @state:             Engine state.
- *
- * Set host engine state for DSI controller during continuous splash.
- *
- * Return: error code.
- */
-int dsi_ctrl_update_host_engine_state_for_cont_splash(struct dsi_ctrl *dsi_ctrl,
-					enum dsi_engine_state state)
-{
-	int rc = 0;
-
-	if (!dsi_ctrl || (state >= DSI_CTRL_ENGINE_MAX)) {
-		DSI_CTRL_ERR(dsi_ctrl, "Invalid params\n");
-		return -EINVAL;
-	}
-
-	mutex_lock(&dsi_ctrl->ctrl_lock);
-
-	rc = dsi_ctrl_check_state(dsi_ctrl, DSI_CTRL_OP_HOST_ENGINE, state);
-	if (rc) {
-		DSI_CTRL_ERR(dsi_ctrl, "Controller state check failed, rc=%d\n",
-				rc);
-		goto error;
-	}
-
-	DSI_CTRL_DEBUG(dsi_ctrl, "Set host engine state = %d\n", state);
-	dsi_ctrl_update_state(dsi_ctrl, DSI_CTRL_OP_HOST_ENGINE, state);
-error:
-	mutex_unlock(&dsi_ctrl->ctrl_lock);
-	return rc;
-}
-
 /**
  * dsi_ctrl_set_power_state() - set power state for dsi controller
  * @dsi_ctrl:          DSI controller handle.
@@ -3392,6 +3358,8 @@ error:
  * dsi_ctrl_set_host_engine_state() - set host engine state
  * @dsi_ctrl:            DSI Controller handle.
  * @state:               Engine state.
+ * @skip_op:             Boolean to indicate few operations can be skipped.
+ *                       Set during the cont-splash or trusted-vm enable case.
  *
  * Host engine state can be modified only when DSI controller power state is
  * set to DSI_CTRL_POWER_LINK_CLK_ON and cmd, video engines are disabled.
@@ -3399,7 +3367,7 @@ error:
  * Return: error code.
  */
 int dsi_ctrl_set_host_engine_state(struct dsi_ctrl *dsi_ctrl,
-				   enum dsi_engine_state state)
+				   enum dsi_engine_state state, bool skip_op)
 {
 	int rc = 0;
 
@@ -3417,10 +3385,12 @@ int dsi_ctrl_set_host_engine_state(struct dsi_ctrl *dsi_ctrl,
 		goto error;
 	}
 
-	if (state == DSI_CTRL_ENGINE_ON)
-		dsi_ctrl->hw.ops.ctrl_en(&dsi_ctrl->hw, true);
-	else
-		dsi_ctrl->hw.ops.ctrl_en(&dsi_ctrl->hw, false);
+	if (!skip_op) {
+		if (state == DSI_CTRL_ENGINE_ON)
+			dsi_ctrl->hw.ops.ctrl_en(&dsi_ctrl->hw, true);
+		else
+			dsi_ctrl->hw.ops.ctrl_en(&dsi_ctrl->hw, false);
+	}
 
 	DSI_CTRL_DEBUG(dsi_ctrl, "Set host engine state = %d\n", state);
 	dsi_ctrl_update_state(dsi_ctrl, DSI_CTRL_OP_HOST_ENGINE, state);
@@ -3433,6 +3403,8 @@ error:
  * dsi_ctrl_set_cmd_engine_state() - set command engine state
  * @dsi_ctrl:            DSI Controller handle.
  * @state:               Engine state.
+ * @skip_op:             Boolean to indicate few operations can be skipped.
+ *                       Set during the cont-splash or trusted-vm enable case.
  *
  * Command engine state can be modified only when DSI controller power state is
  * set to DSI_CTRL_POWER_LINK_CLK_ON.
@@ -3440,7 +3412,7 @@ error:
  * Return: error code.
  */
 int dsi_ctrl_set_cmd_engine_state(struct dsi_ctrl *dsi_ctrl,
-				  enum dsi_engine_state state)
+				  enum dsi_engine_state state, bool skip_op)
 {
 	int rc = 0;
 
@@ -3456,12 +3428,15 @@ int dsi_ctrl_set_cmd_engine_state(struct dsi_ctrl *dsi_ctrl,
 		goto error;
 	}
 
-	if (state == DSI_CTRL_ENGINE_ON)
-		dsi_ctrl->hw.ops.cmd_engine_en(&dsi_ctrl->hw, true);
-	else
-		dsi_ctrl->hw.ops.cmd_engine_en(&dsi_ctrl->hw, false);
+	if (!skip_op) {
+		if (state == DSI_CTRL_ENGINE_ON)
+			dsi_ctrl->hw.ops.cmd_engine_en(&dsi_ctrl->hw, true);
+		else
+			dsi_ctrl->hw.ops.cmd_engine_en(&dsi_ctrl->hw, false);
+	}
 
-	DSI_CTRL_DEBUG(dsi_ctrl, "Set cmd engine state = %d\n", state);
+	DSI_CTRL_DEBUG(dsi_ctrl, "Set cmd engine state:%d, skip_op:%d\n",
+					state, skip_op);
 	dsi_ctrl_update_state(dsi_ctrl, DSI_CTRL_OP_CMD_ENGINE, state);
 error:
 	return rc;
@@ -3471,6 +3446,8 @@ error:
  * dsi_ctrl_set_vid_engine_state() - set video engine state
  * @dsi_ctrl:            DSI Controller handle.
  * @state:               Engine state.
+ * @skip_op:             Boolean to indicate few operations can be skipped.
+ *                       Set during the cont-splash or trusted-vm enable case.
  *
  * Video engine state can be modified only when DSI controller power state is
  * set to DSI_CTRL_POWER_LINK_CLK_ON.
@@ -3478,7 +3455,7 @@ error:
  * Return: error code.
  */
 int dsi_ctrl_set_vid_engine_state(struct dsi_ctrl *dsi_ctrl,
-				  enum dsi_engine_state state)
+				  enum dsi_engine_state state, bool skip_op)
 {
 	int rc = 0;
 	bool on;
@@ -3497,14 +3474,18 @@ int dsi_ctrl_set_vid_engine_state(struct dsi_ctrl *dsi_ctrl,
 		goto error;
 	}
 
-	on = (state == DSI_CTRL_ENGINE_ON) ? true : false;
-	dsi_ctrl->hw.ops.video_engine_en(&dsi_ctrl->hw, on);
 
-	/* perform a reset when turning off video engine */
-	if (!on)
-		dsi_ctrl->hw.ops.soft_reset(&dsi_ctrl->hw);
+	if (!skip_op) {
+		on = (state == DSI_CTRL_ENGINE_ON) ? true : false;
+		dsi_ctrl->hw.ops.video_engine_en(&dsi_ctrl->hw, on);
+
+		/* perform a reset when turning off video engine */
+		if (!on)
+			dsi_ctrl->hw.ops.soft_reset(&dsi_ctrl->hw);
+	}
 
-	DSI_CTRL_DEBUG(dsi_ctrl, "Set video engine state = %d\n", state);
+	DSI_CTRL_DEBUG(dsi_ctrl, "Set video engine state:%d, skip_op:%d\n",
+					state, skip_op);
 	dsi_ctrl_update_state(dsi_ctrl, DSI_CTRL_OP_VID_ENGINE, state);
 error:
 	mutex_unlock(&dsi_ctrl->ctrl_lock);

+ 12 - 16
msm/dsi/dsi_ctrl.h

@@ -455,7 +455,8 @@ int dsi_ctrl_host_timing_update(struct dsi_ctrl *dsi_ctrl);
 /**
  * dsi_ctrl_host_init() - Initialize DSI host hardware.
  * @dsi_ctrl:        DSI controller handle.
- * @is_splash_enabled:       boolean signifying splash status.
+ * @skip_op:         Boolean to indicate few operations can be skipped.
+ *                   Set during the cont-splash or trusted-vm enable case.
  *
  * Initializes DSI controller hardware with host configuration provided by
  * dsi_ctrl_update_host_config(). Initialization can be performed only during
@@ -464,7 +465,7 @@ int dsi_ctrl_host_timing_update(struct dsi_ctrl *dsi_ctrl);
  *
  * Return: error code.
  */
-int dsi_ctrl_host_init(struct dsi_ctrl *dsi_ctrl, bool is_splash_enabled);
+int dsi_ctrl_host_init(struct dsi_ctrl *dsi_ctrl, bool skip_op);
 
 /**
  * dsi_ctrl_host_deinit() - De-Initialize DSI host hardware.
@@ -565,17 +566,6 @@ int dsi_ctrl_cmd_transfer(struct dsi_ctrl *dsi_ctrl,
  */
 int dsi_ctrl_cmd_tx_trigger(struct dsi_ctrl *dsi_ctrl, u32 flags);
 
-/**
- * dsi_ctrl_update_host_engine_state_for_cont_splash() - update engine
- *                                 states for cont splash usecase
- * @dsi_ctrl:              DSI controller handle.
- * @state:                 DSI engine state
- *
- * Return: error code.
- */
-int dsi_ctrl_update_host_engine_state_for_cont_splash(struct dsi_ctrl *dsi_ctrl,
-				enum dsi_engine_state state);
-
 /**
  * dsi_ctrl_set_power_state() - set power state for dsi controller
  * @dsi_ctrl:          DSI controller handle.
@@ -593,6 +583,8 @@ int dsi_ctrl_set_power_state(struct dsi_ctrl *dsi_ctrl,
  * dsi_ctrl_set_cmd_engine_state() - set command engine state
  * @dsi_ctrl:            DSI Controller handle.
  * @state:               Engine state.
+ * @skip_op:             Boolean to indicate few operations can be skipped.
+ *                       Set during the cont-splash or trusted-vm enable case.
  *
  * Command engine state can be modified only when DSI controller power state is
  * set to DSI_CTRL_POWER_LINK_CLK_ON.
@@ -600,7 +592,7 @@ int dsi_ctrl_set_power_state(struct dsi_ctrl *dsi_ctrl,
  * Return: error code.
  */
 int dsi_ctrl_set_cmd_engine_state(struct dsi_ctrl *dsi_ctrl,
-				  enum dsi_engine_state state);
+				  enum dsi_engine_state state, bool skip_op);
 
 /**
  * dsi_ctrl_validate_host_state() - validate DSI ctrl host state
@@ -616,6 +608,8 @@ bool dsi_ctrl_validate_host_state(struct dsi_ctrl *dsi_ctrl);
  * dsi_ctrl_set_vid_engine_state() - set video engine state
  * @dsi_ctrl:            DSI Controller handle.
  * @state:               Engine state.
+ * @skip_op:             Boolean to indicate few operations can be skipped.
+ *                       Set during the cont-splash or trusted-vm enable case.
  *
  * Video engine state can be modified only when DSI controller power state is
  * set to DSI_CTRL_POWER_LINK_CLK_ON.
@@ -623,12 +617,14 @@ bool dsi_ctrl_validate_host_state(struct dsi_ctrl *dsi_ctrl);
  * Return: error code.
  */
 int dsi_ctrl_set_vid_engine_state(struct dsi_ctrl *dsi_ctrl,
-				  enum dsi_engine_state state);
+				  enum dsi_engine_state state, bool skip_op);
 
 /**
  * dsi_ctrl_set_host_engine_state() - set host engine state
  * @dsi_ctrl:            DSI Controller handle.
  * @state:               Engine state.
+ * @skip_op:             Boolean to indicate few operations can be skipped.
+ *                       Set during the cont-splash or trusted-vm enable case.
  *
  * Host engine state can be modified only when DSI controller power state is
  * set to DSI_CTRL_POWER_LINK_CLK_ON and cmd, video engines are disabled.
@@ -636,7 +632,7 @@ int dsi_ctrl_set_vid_engine_state(struct dsi_ctrl *dsi_ctrl,
  * Return: error code.
  */
 int dsi_ctrl_set_host_engine_state(struct dsi_ctrl *dsi_ctrl,
-				   enum dsi_engine_state state);
+				   enum dsi_engine_state state, bool skip_op);
 
 /**
  * dsi_ctrl_set_ulps() - set ULPS state for DSI lanes.

+ 167 - 139
msm/dsi/dsi_display.c

@@ -46,6 +46,14 @@ static const struct of_device_id dsi_display_dt_match[] = {
 	{}
 };
 
+bool is_skip_op_required(struct dsi_display *display)
+{
+	if (!display)
+		return false;
+
+	return (display->is_cont_splash_enabled || display->trusted_vm_env);
+}
+
 static void dsi_display_mask_ctrl_error_interrupts(struct dsi_display *display,
 			u32 mask, bool enable)
 {
@@ -252,6 +260,7 @@ static int dsi_display_cmd_engine_enable(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);
@@ -261,10 +270,11 @@ static int dsi_display_cmd_engine_enable(struct dsi_display *display)
 		goto done;
 	}
 
-	rc = dsi_ctrl_set_cmd_engine_state(m_ctrl->ctrl, DSI_CTRL_ENGINE_ON);
+	rc = dsi_ctrl_set_cmd_engine_state(m_ctrl->ctrl,
+				DSI_CTRL_ENGINE_ON, skip_op);
 	if (rc) {
-		DSI_ERR("[%s] failed to enable cmd engine, rc=%d\n",
-		       display->name, rc);
+		DSI_ERR("[%s] enable mcmd engine failed, skip_op:%d rc:%d\n",
+		       display->name, skip_op, rc);
 		goto done;
 	}
 
@@ -274,10 +284,11 @@ static int dsi_display_cmd_engine_enable(struct dsi_display *display)
 			continue;
 
 		rc = dsi_ctrl_set_cmd_engine_state(ctrl->ctrl,
-						   DSI_CTRL_ENGINE_ON);
+					DSI_CTRL_ENGINE_ON, skip_op);
 		if (rc) {
-			DSI_ERR("[%s] failed to enable cmd engine, rc=%d\n",
-			       display->name, rc);
+			DSI_ERR(
+			    "[%s] enable cmd engine failed, skip_op:%d rc:%d\n",
+			       display->name, skip_op, rc);
 			goto error_disable_master;
 		}
 	}
@@ -285,7 +296,8 @@ static int dsi_display_cmd_engine_enable(struct dsi_display *display)
 	display->cmd_engine_refcount++;
 	goto done;
 error_disable_master:
-	(void)dsi_ctrl_set_cmd_engine_state(m_ctrl->ctrl, DSI_CTRL_ENGINE_OFF);
+	(void)dsi_ctrl_set_cmd_engine_state(m_ctrl->ctrl,
+				DSI_CTRL_ENGINE_OFF, skip_op);
 done:
 	mutex_unlock(&m_ctrl->ctrl->ctrl_lock);
 	return rc;
@@ -296,6 +308,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);
@@ -314,16 +327,18 @@ static int dsi_display_cmd_engine_disable(struct dsi_display *display)
 			continue;
 
 		rc = dsi_ctrl_set_cmd_engine_state(ctrl->ctrl,
-						   DSI_CTRL_ENGINE_OFF);
+					DSI_CTRL_ENGINE_OFF, skip_op);
 		if (rc)
-			DSI_ERR("[%s] failed to enable cmd engine, rc=%d\n",
-			       display->name, rc);
+			DSI_ERR(
+			   "[%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);
+	rc = dsi_ctrl_set_cmd_engine_state(m_ctrl->ctrl,
+				DSI_CTRL_ENGINE_OFF, skip_op);
 	if (rc) {
-		DSI_ERR("[%s] failed to enable cmd engine, rc=%d\n",
-		       display->name, rc);
+		DSI_ERR("[%s] disable mcmd engine failed, skip_op:%d rc:%d\n",
+			display->name, skip_op, rc);
 		goto error;
 	}
 
@@ -444,6 +459,11 @@ static void dsi_display_register_te_irq(struct dsi_display *display)
 		return;
 	}
 
+	if (display->trusted_vm_env) {
+		DSI_INFO("GPIO's are not enabled in trusted VM\n");
+		return;
+	}
+
 	if (!gpio_is_valid(display->disp_te_gpio)) {
 		rc = -EINVAL;
 		goto error;
@@ -1827,10 +1847,10 @@ static int dsi_display_is_ulps_req_valid(struct dsi_display *display,
 
 	/*
 	 * No need to enter ULPS when transitioning from splash screen to
-	 * boot animation since it is expected that the clocks would be turned
-	 * right back on.
+	 * boot animation or trusted vm environments since it is expected
+	 * that the clocks would be turned right back on.
 	 */
-	if (enable && display->is_cont_splash_enabled)
+	if (enable && is_skip_op_required(display))
 		return false;
 
 	return true;
@@ -2184,30 +2204,6 @@ void dsi_display_enable_event(struct drm_connector *connector,
 	}
 }
 
-/**
- * dsi_config_host_engine_state_for_cont_splash()- update host engine state
- *                                                 during continuous splash.
- * @display: Handle to dsi display
- *
- */
-static void dsi_config_host_engine_state_for_cont_splash
-					(struct dsi_display *display)
-{
-	int i;
-	struct dsi_display_ctrl *ctrl;
-	enum dsi_engine_state host_state = DSI_CTRL_ENGINE_ON;
-
-	/* Sequence does not matter for split dsi usecases */
-	display_for_each_ctrl(i, display) {
-		ctrl = &display->ctrl[i];
-		if (!ctrl->ctrl)
-			continue;
-
-		dsi_ctrl_update_host_engine_state_for_cont_splash(ctrl->ctrl,
-							host_state);
-	}
-}
-
 static int dsi_display_ctrl_power_on(struct dsi_display *display)
 {
 	int rc = 0;
@@ -2542,6 +2538,7 @@ static int dsi_display_ctrl_init(struct dsi_display *display)
 	int rc = 0;
 	int i;
 	struct dsi_display_ctrl *ctrl;
+	bool skip_op = is_skip_op_required(display);
 
 	/* when ULPS suspend feature is enabled, we will keep the lanes in
 	 * ULPS during suspend state and clamp DSI phy. Hence while resuming
@@ -2553,11 +2550,11 @@ static int dsi_display_ctrl_init(struct dsi_display *display)
 	if (!display->panel->ulps_suspend_enabled || !display->ulps_enabled) {
 		display_for_each_ctrl(i, display) {
 			ctrl = &display->ctrl[i];
-			rc = dsi_ctrl_host_init(ctrl->ctrl,
-					display->is_cont_splash_enabled);
+			rc = dsi_ctrl_host_init(ctrl->ctrl, skip_op);
 			if (rc) {
-				DSI_ERR("[%s] failed to init host_%d, rc=%d\n",
-				       display->name, i, rc);
+				DSI_ERR(
+				"[%s] failed to init host_%d, skip_op=%d, rc=%d\n",
+				       display->name, i, skip_op, rc);
 				goto error_host_deinit;
 			}
 		}
@@ -2605,21 +2602,15 @@ static int dsi_display_ctrl_host_enable(struct dsi_display *display)
 	int rc = 0;
 	int i;
 	struct dsi_display_ctrl *m_ctrl, *ctrl;
-
-	/* Host engine states are already taken care for
-	 * continuous splash case
-	 */
-	if (display->is_cont_splash_enabled) {
-		DSI_DEBUG("cont splash enabled, host enable not required\n");
-		return 0;
-	}
+	bool skip_op = is_skip_op_required(display);
 
 	m_ctrl = &display->ctrl[display->cmd_master_idx];
 
-	rc = dsi_ctrl_set_host_engine_state(m_ctrl->ctrl, DSI_CTRL_ENGINE_ON);
+	rc = dsi_ctrl_set_host_engine_state(m_ctrl->ctrl,
+			DSI_CTRL_ENGINE_ON, skip_op);
 	if (rc) {
-		DSI_ERR("[%s] failed to enable host engine, rc=%d\n",
-		       display->name, rc);
+		DSI_ERR("[%s]enable host engine failed, skip_op:%d rc:%d\n",
+		       display->name, skip_op, rc);
 		goto error;
 	}
 
@@ -2629,17 +2620,19 @@ static int dsi_display_ctrl_host_enable(struct dsi_display *display)
 			continue;
 
 		rc = dsi_ctrl_set_host_engine_state(ctrl->ctrl,
-						    DSI_CTRL_ENGINE_ON);
+						DSI_CTRL_ENGINE_ON, skip_op);
 		if (rc) {
-			DSI_ERR("[%s] failed to enable sl host engine, rc=%d\n",
-			       display->name, rc);
+			DSI_ERR(
+			"[%s] enable host engine failed, skip_op:%d rc:%d\n",
+			       display->name, skip_op, rc);
 			goto error_disable_master;
 		}
 	}
 
 	return rc;
 error_disable_master:
-	(void)dsi_ctrl_set_host_engine_state(m_ctrl->ctrl, DSI_CTRL_ENGINE_OFF);
+	(void)dsi_ctrl_set_host_engine_state(m_ctrl->ctrl,
+					DSI_CTRL_ENGINE_OFF, skip_op);
 error:
 	return rc;
 }
@@ -2649,6 +2642,7 @@ static int dsi_display_ctrl_host_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];
 	/*
@@ -2676,16 +2670,18 @@ static int dsi_display_ctrl_host_disable(struct dsi_display *display)
 			continue;
 
 		rc = dsi_ctrl_set_host_engine_state(ctrl->ctrl,
-						    DSI_CTRL_ENGINE_OFF);
+					DSI_CTRL_ENGINE_OFF, skip_op);
 		if (rc)
-			DSI_ERR("[%s] failed to disable host engine, rc=%d\n",
-			       display->name, rc);
+			DSI_ERR(
+			"[%s] disable host engine failed, skip_op:%d rc:%d\n",
+			       display->name, skip_op, rc);
 	}
 
-	rc = dsi_ctrl_set_host_engine_state(m_ctrl->ctrl, DSI_CTRL_ENGINE_OFF);
+	rc = dsi_ctrl_set_host_engine_state(m_ctrl->ctrl,
+				DSI_CTRL_ENGINE_OFF, skip_op);
 	if (rc) {
-		DSI_ERR("[%s] failed to disable host engine, rc=%d\n",
-		       display->name, rc);
+		DSI_ERR("[%s] disable mhost engine failed, skip_op:%d rc:%d\n",
+		       display->name, skip_op, rc);
 		goto error;
 	}
 
@@ -2698,13 +2694,15 @@ static int dsi_display_vid_engine_enable(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->video_master_idx];
 
-	rc = dsi_ctrl_set_vid_engine_state(m_ctrl->ctrl, DSI_CTRL_ENGINE_ON);
+	rc = dsi_ctrl_set_vid_engine_state(m_ctrl->ctrl,
+			DSI_CTRL_ENGINE_ON, skip_op);
 	if (rc) {
-		DSI_ERR("[%s] failed to enable vid engine, rc=%d\n",
-		       display->name, rc);
+		DSI_ERR("[%s] enable mvid engine failed, skip_op:%d rc:%d\n",
+				display->name, skip_op, rc);
 		goto error;
 	}
 
@@ -2714,17 +2712,19 @@ static int dsi_display_vid_engine_enable(struct dsi_display *display)
 			continue;
 
 		rc = dsi_ctrl_set_vid_engine_state(ctrl->ctrl,
-						   DSI_CTRL_ENGINE_ON);
+					DSI_CTRL_ENGINE_ON, skip_op);
 		if (rc) {
-			DSI_ERR("[%s] failed to enable vid engine, rc=%d\n",
-			       display->name, rc);
+			DSI_ERR(
+			    "[%s] enable vid engine failed, skip_op:%d rc:%d\n",
+				display->name, skip_op, rc);
 			goto error_disable_master;
 		}
 	}
 
 	return rc;
 error_disable_master:
-	(void)dsi_ctrl_set_vid_engine_state(m_ctrl->ctrl, DSI_CTRL_ENGINE_OFF);
+	(void)dsi_ctrl_set_vid_engine_state(m_ctrl->ctrl,
+				DSI_CTRL_ENGINE_OFF, skip_op);
 error:
 	return rc;
 }
@@ -2734,6 +2734,7 @@ static int dsi_display_vid_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->video_master_idx];
 
@@ -2743,16 +2744,18 @@ static int dsi_display_vid_engine_disable(struct dsi_display *display)
 			continue;
 
 		rc = dsi_ctrl_set_vid_engine_state(ctrl->ctrl,
-						   DSI_CTRL_ENGINE_OFF);
+					DSI_CTRL_ENGINE_OFF, skip_op);
 		if (rc)
-			DSI_ERR("[%s] failed to disable vid engine, rc=%d\n",
-			       display->name, rc);
+			DSI_ERR(
+			   "[%s] disable vid engine failed, skip_op:%d rc:%d\n",
+				display->name, skip_op, rc);
 	}
 
-	rc = dsi_ctrl_set_vid_engine_state(m_ctrl->ctrl, DSI_CTRL_ENGINE_OFF);
+	rc = dsi_ctrl_set_vid_engine_state(m_ctrl->ctrl,
+				DSI_CTRL_ENGINE_OFF, skip_op);
 	if (rc)
-		DSI_ERR("[%s] failed to disable mvid engine, rc=%d\n",
-		       display->name, rc);
+		DSI_ERR("[%s] disable mvid engine failed, skip_op:%d rc:%d\n",
+				display->name, skip_op, rc);
 
 	return rc;
 }
@@ -2763,19 +2766,17 @@ static int dsi_display_phy_enable(struct dsi_display *display)
 	int i;
 	struct dsi_display_ctrl *m_ctrl, *ctrl;
 	enum dsi_phy_pll_source m_src = DSI_PLL_SOURCE_STANDALONE;
+	bool skip_op = is_skip_op_required(display);
 
 	m_ctrl = &display->ctrl[display->clk_master_idx];
 	if (display->ctrl_count > 1)
 		m_src = DSI_PLL_SOURCE_NATIVE;
 
-	rc = dsi_phy_enable(m_ctrl->phy,
-			    &display->config,
-			    m_src,
-			    true,
-			    display->is_cont_splash_enabled);
+	rc = dsi_phy_enable(m_ctrl->phy, &display->config,
+			m_src, true, skip_op);
 	if (rc) {
-		DSI_ERR("[%s] failed to enable DSI PHY, rc=%d\n",
-		       display->name, rc);
+		DSI_ERR("[%s] failed to enable DSI PHY, skip_op=%d rc=%d\n",
+		       display->name, skip_op, rc);
 		goto error;
 	}
 
@@ -2784,14 +2785,12 @@ static int dsi_display_phy_enable(struct dsi_display *display)
 		if (!ctrl->ctrl || (ctrl == m_ctrl))
 			continue;
 
-		rc = dsi_phy_enable(ctrl->phy,
-				    &display->config,
-				    DSI_PLL_SOURCE_NON_NATIVE,
-				    true,
-				    display->is_cont_splash_enabled);
+		rc = dsi_phy_enable(ctrl->phy, &display->config,
+				DSI_PLL_SOURCE_NON_NATIVE, true, skip_op);
 		if (rc) {
-			DSI_ERR("[%s] failed to enable DSI PHY, rc=%d\n",
-			       display->name, rc);
+			DSI_ERR(
+				"[%s] failed to enable DSI PHY, skip_op: %d rc=%d\n",
+				display->name, skip_op, rc);
 			goto error_disable_master;
 		}
 	}
@@ -2799,7 +2798,7 @@ static int dsi_display_phy_enable(struct dsi_display *display)
 	return rc;
 
 error_disable_master:
-	(void)dsi_phy_disable(m_ctrl->phy);
+	(void)dsi_phy_disable(m_ctrl->phy, skip_op);
 error:
 	return rc;
 }
@@ -2809,6 +2808,7 @@ static int dsi_display_phy_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->clk_master_idx];
 
@@ -2817,16 +2817,17 @@ static int dsi_display_phy_disable(struct dsi_display *display)
 		if (!ctrl->ctrl || (ctrl == m_ctrl))
 			continue;
 
-		rc = dsi_phy_disable(ctrl->phy);
+		rc = dsi_phy_disable(ctrl->phy, skip_op);
 		if (rc)
-			DSI_ERR("[%s] failed to disable DSI PHY, rc=%d\n",
-			       display->name, rc);
+			DSI_ERR(
+				"[%s] failed to disable DSI PHY, skip_op=%d rc=%d\n",
+				display->name, skip_op,  rc);
 	}
 
-	rc = dsi_phy_disable(m_ctrl->phy);
+	rc = dsi_phy_disable(m_ctrl->phy, skip_op);
 	if (rc)
-		DSI_ERR("[%s] failed to disable DSI PHY, rc=%d\n",
-		       display->name, rc);
+		DSI_ERR("[%s] failed to disable DSI PHY, skip_op=%d rc=%d\n",
+		       display->name, skip_op, rc);
 
 	return rc;
 }
@@ -2909,11 +2910,14 @@ static int dsi_display_phy_sw_reset(struct dsi_display *display)
 	int i;
 	struct dsi_display_ctrl *m_ctrl, *ctrl;
 
-	/* For continuous splash use case ctrl states are updated
-	 * separately and hence we do an early return
+	/*
+	 * For continuous splash and trusted vm environment,
+	 * ctrl states are updated separately and hence we do
+	 * an early return
 	 */
-	if (display->is_cont_splash_enabled) {
-		DSI_DEBUG("cont splash enabled, phy sw reset not required\n");
+	if (is_skip_op_required(display)) {
+		DSI_DEBUG(
+			"cont splash/trusted vm use case, phy sw reset not required\n");
 		return 0;
 	}
 
@@ -3857,7 +3861,8 @@ static int dsi_display_res_init(struct dsi_display *display)
 				display->panel_node,
 				display->parser_node,
 				display->display_type,
-				display->cmdline_topology);
+				display->cmdline_topology,
+				display->trusted_vm_env);
 	if (IS_ERR_OR_NULL(display->panel)) {
 		rc = PTR_ERR(display->panel);
 		DSI_ERR("failed to get panel, rc=%d\n", rc);
@@ -3886,7 +3891,14 @@ static int dsi_display_res_init(struct dsi_display *display)
 		goto error_ctrl_put;
 	}
 
-	display->is_active = true;
+	/**
+	 * In trusted vm, the connectors will not be enabled
+	 * until the HW resources are assigned and accepted.
+	 */
+	if (display->trusted_vm_env)
+		display->is_active = false;
+	else
+		display->is_active = true;
 
 	return 0;
 error_ctrl_put:
@@ -4920,7 +4932,6 @@ int dsi_display_cont_splash_config(void *dsi_display)
 		goto clks_disabled;
 	}
 
-	dsi_config_host_engine_state_for_cont_splash(display);
 	mutex_unlock(&display->display_lock);
 
 	/* Set the current brightness level */
@@ -5419,6 +5430,19 @@ int dsi_display_dev_probe(struct platform_device *pdev)
 		rc =  -EINVAL;
 		goto end;
 	}
+
+	mdp_node = of_parse_phandle(pdev->dev.of_node, "qcom,mdp", 0);
+	if (!mdp_node) {
+		DSI_ERR("mdp_node not found\n");
+		rc = -ENODEV;
+		goto end;
+	}
+
+	display->trusted_vm_env = of_property_read_bool(mdp_node,
+						"qcom,sde-trusted-vm-env");
+	if (display->trusted_vm_env)
+		DSI_INFO("Display enabled with trusted vm path\n");
+
 	/* initialize panel id to UINT64_MAX */
 	display->panel_id = ~0x0;
 
@@ -5433,13 +5457,6 @@ int dsi_display_dev_probe(struct platform_device *pdev)
 	boot_disp = &boot_displays[index];
 	node = pdev->dev.of_node;
 	if (boot_disp->boot_disp_en) {
-		mdp_node = of_parse_phandle(node, "qcom,mdp", 0);
-		if (!mdp_node) {
-			DSI_ERR("mdp_node not found\n");
-			rc = -ENODEV;
-			goto end;
-		}
-
 		/* The panel name should be same as UEFI name index */
 		panel_node = of_find_node_by_name(mdp_node, boot_disp->name);
 		if (!panel_node)
@@ -5450,7 +5467,7 @@ int dsi_display_dev_probe(struct platform_device *pdev)
 		if (!panel_node)
 			DSI_WARN("default panel not found\n");
 
-		if (IS_ENABLED(CONFIG_DSI_PARSER))
+		if (IS_ENABLED(CONFIG_DSI_PARSER) && !display->trusted_vm_env)
 			firm_req = !request_firmware_nowait(
 				THIS_MODULE, 1, "dsi_prop",
 				&pdev->dev, GFP_KERNEL, display,
@@ -5939,7 +5956,7 @@ static struct mipi_dsi_host_ops dsi_host_ext_ops = {
 	.transfer = dsi_host_transfer,
 };
 
-struct drm_panel *dsi_display_get_drm_panel(struct dsi_display * display)
+struct drm_panel *dsi_display_get_drm_panel(struct dsi_display *display)
 {
 	if (!display || !display->panel) {
 		pr_err("invalid param(s)\n");
@@ -6850,11 +6867,14 @@ static int dsi_display_pre_switch(struct dsi_display *display)
 		goto error_ctrl_clk_off;
 	}
 
-	rc = dsi_display_set_clk_src(display);
-	if (rc) {
-		DSI_ERR("[%s] failed to set DSI link clock source, rc=%d\n",
+	if (!display->trusted_vm_env) {
+		rc = dsi_display_set_clk_src(display);
+		if (rc) {
+			DSI_ERR(
+			"[%s] failed to set DSI link clock source, rc=%d\n",
 			display->name, rc);
-		goto error_ctrl_deinit;
+			goto error_ctrl_deinit;
+		}
 	}
 
 	rc = dsi_display_clk_ctrl(display->dsi_clk_handle,
@@ -7189,7 +7209,8 @@ int dsi_display_prepare(struct dsi_display *display)
 	dsi_display_set_ctrl_esd_check_flag(display, false);
 
 	/* Set up ctrl isr before enabling core clk */
-	dsi_display_ctrl_isr_configure(display, true);
+	if (!display->trusted_vm_env)
+		dsi_display_ctrl_isr_configure(display, true);
 
 	if (mode->dsi_mode_flags & DSI_MODE_FLAG_DMS) {
 		if (display->is_cont_splash_enabled &&
@@ -7199,7 +7220,7 @@ int dsi_display_prepare(struct dsi_display *display)
 			goto error;
 		}
 
-		if (!display->is_cont_splash_enabled) {
+		if (!is_skip_op_required(display)) {
 			/* update dsi ctrl for new mode */
 			rc = dsi_display_pre_switch(display);
 			if (rc)
@@ -7210,9 +7231,9 @@ int dsi_display_prepare(struct dsi_display *display)
 	}
 
 	if (!(mode->dsi_mode_flags & DSI_MODE_FLAG_POMS) &&
-		(!display->is_cont_splash_enabled)) {
+		(!is_skip_op_required(display))) {
 		/*
-		 * For continuous splash usecase we skip panel
+		 * For continuous splash/trusted vm, we skip panel
 		 * pre prepare since the regulator vote is already
 		 * taken care in splash resource init
 		 */
@@ -7255,11 +7276,14 @@ int dsi_display_prepare(struct dsi_display *display)
 		}
 	}
 
-	rc = dsi_display_set_clk_src(display);
-	if (rc) {
-		DSI_ERR("[%s] failed to set DSI link clock source, rc=%d\n",
-			display->name, rc);
-		goto error_phy_disable;
+	if (!display->trusted_vm_env) {
+		rc = dsi_display_set_clk_src(display);
+		if (rc) {
+			DSI_ERR(
+			"[%s] failed to set DSI link clock source, rc=%d\n",
+				display->name, rc);
+			goto error_phy_disable;
+		}
 	}
 
 	rc = dsi_display_ctrl_init(display);
@@ -7286,9 +7310,9 @@ int dsi_display_prepare(struct dsi_display *display)
 		goto error_host_engine_off;
 	}
 
-	if (!display->is_cont_splash_enabled) {
+	if (!is_skip_op_required(display)) {
 		/*
-		 * For continuous splash usecase, skip panel prepare and
+		 * For continuous splash/trusted vm, skip panel prepare and
 		 * ctl reset since the pnael and ctrl is already in active
 		 * state and panel on commands are not needed
 		 */
@@ -7543,9 +7567,6 @@ int dsi_display_config_ctrl_for_cont_splash(struct dsi_display *display)
 		return -EINVAL;
 	}
 
-	if (!display->is_cont_splash_enabled)
-		return 0;
-
 	if (display->config.panel_mode == DSI_OP_VIDEO_MODE) {
 		rc = dsi_display_vid_engine_enable(display);
 		if (rc) {
@@ -7620,10 +7641,11 @@ int dsi_display_enable(struct dsi_display *display)
 	}
 	SDE_EVT32(SDE_EVTLOG_FUNC_ENTRY);
 
-	/* Engine states and panel states are populated during splash
-	 * resource init and hence we return early
+	/*
+	 * Engine states and panel states are populated during splash
+	 * resource/trusted vm and hence we return early
 	 */
-	if (display->is_cont_splash_enabled) {
+	if (is_skip_op_required(display)) {
 
 		dsi_display_config_ctrl_for_cont_splash(display);
 
@@ -7877,12 +7899,18 @@ int dsi_display_disable(struct dsi_display *display)
 		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);
 	}
+
+	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;
@@ -7960,7 +7988,7 @@ int dsi_display_unprepare(struct dsi_display *display)
 	if (rc)
 		DSI_ERR("[%s] display wake up failed, rc=%d\n",
 		       display->name, rc);
-	if (!display->poms_pending) {
+	if (!display->poms_pending && !is_skip_op_required(display)) {
 		rc = dsi_panel_unprepare(display->panel);
 		if (rc)
 			DSI_ERR("[%s] panel unprepare failed, rc=%d\n",
@@ -8016,7 +8044,7 @@ int dsi_display_unprepare(struct dsi_display *display)
 	/* destrory dsi isr set up */
 	dsi_display_ctrl_isr_configure(display, false);
 
-	if (!display->poms_pending) {
+	if (!display->poms_pending && !is_skip_op_required(display)) {
 		rc = dsi_panel_post_unprepare(display->panel);
 		if (rc)
 			DSI_ERR("[%s] panel post-unprepare failed, rc=%d\n",

+ 4 - 0
msm/dsi/dsi_display.h

@@ -188,6 +188,8 @@ struct dsi_display_ext_bridge {
  * @dma_cmd_workq:	Pointer to the workqueue of DMA command transfer done
  *				wait sequence.
  * @is_active:        status of the display
+ * @trusted_vm_env:   Set to true, it the executing VM is Trusted VM.
+ *                    Set to false, otherwise.
  */
 struct dsi_display {
 	struct platform_device *pdev;
@@ -281,6 +283,8 @@ struct dsi_display {
 	/* panel id of the display */
 	u64 panel_id;
 	bool is_active;
+
+	bool trusted_vm_env;
 };
 
 int dsi_display_dev_probe(struct platform_device *pdev);

+ 45 - 12
msm/dsi/dsi_panel.c

@@ -291,6 +291,9 @@ static int dsi_panel_set_pinctrl_state(struct dsi_panel *panel, bool enable)
 	if (panel->host_config.ext_bridge_mode)
 		return 0;
 
+	if (!panel->pinctrl.pinctrl)
+		return 0;
+
 	if (enable)
 		state = panel->pinctrl.active;
 	else
@@ -2423,14 +2426,14 @@ static int dsi_panel_parse_dsc_params(struct dsi_display_mode *mode,
 	rc = sde_dsc_populate_dsc_config(&priv_info->dsc.config,
 			priv_info->dsc.scr_rev);
 	if (rc) {
-		DSI_DEBUG("failed populating dsc params \n");
+		DSI_DEBUG("failed populating dsc params\n");
 		rc = -EINVAL;
 		goto error;
 	}
 
 	rc = sde_dsc_populate_dsc_private_params(&priv_info->dsc, intf_width);
 	if (rc) {
-		DSI_DEBUG("failed populating other dsc params \n");
+		DSI_DEBUG("failed populating other dsc params\n");
 		rc = -EINVAL;
 		goto error;
 	}
@@ -3182,11 +3185,38 @@ end:
 	utils->node = panel->panel_of_node;
 }
 
+static int dsi_panel_vm_stub(struct dsi_panel *panel)
+{
+	return 0;
+}
+
+static void dsi_panel_setup_vm_ops(struct dsi_panel *panel, bool trusted_vm_env)
+{
+	if (trusted_vm_env) {
+		panel->panel_ops.pinctrl_init = dsi_panel_vm_stub;
+		panel->panel_ops.gpio_request = dsi_panel_vm_stub;
+		panel->panel_ops.pinctrl_deinit = dsi_panel_vm_stub;
+		panel->panel_ops.gpio_release = dsi_panel_vm_stub;
+		panel->panel_ops.bl_register = dsi_panel_vm_stub;
+		panel->panel_ops.bl_unregister = dsi_panel_vm_stub;
+		panel->panel_ops.parse_gpios = dsi_panel_vm_stub;
+	} else {
+		panel->panel_ops.pinctrl_init = dsi_panel_pinctrl_init;
+		panel->panel_ops.gpio_request = dsi_panel_gpio_request;
+		panel->panel_ops.pinctrl_deinit = dsi_panel_pinctrl_deinit;
+		panel->panel_ops.gpio_release = dsi_panel_gpio_release;
+		panel->panel_ops.bl_register = dsi_panel_bl_register;
+		panel->panel_ops.bl_unregister = dsi_panel_bl_unregister;
+		panel->panel_ops.parse_gpios = dsi_panel_parse_gpios;
+	}
+}
+
 struct dsi_panel *dsi_panel_get(struct device *parent,
 				struct device_node *of_node,
 				struct device_node *parser_node,
 				const char *type,
-				int topology_override)
+				int topology_override,
+				bool trusted_vm_env)
 {
 	struct dsi_panel *panel;
 	struct dsi_parser_utils *utils;
@@ -3197,6 +3227,8 @@ struct dsi_panel *dsi_panel_get(struct device *parent,
 	if (!panel)
 		return ERR_PTR(-ENOMEM);
 
+	dsi_panel_setup_vm_ops(panel, trusted_vm_env);
+
 	panel->panel_of_node = of_node;
 	panel->parent = parent;
 	panel->type = type;
@@ -3255,7 +3287,7 @@ struct dsi_panel *dsi_panel_get(struct device *parent,
 		goto error;
 	}
 
-	rc = dsi_panel_parse_gpios(panel);
+	rc = panel->panel_ops.parse_gpios(panel);
 	if (rc) {
 		DSI_ERR("failed to parse panel gpios, rc=%d\n", rc);
 		goto error;
@@ -3355,21 +3387,22 @@ int dsi_panel_drv_init(struct dsi_panel *panel,
 	dev->lanes = 4;
 
 	panel->host = host;
-	rc = dsi_panel_pinctrl_init(panel);
+
+	rc = panel->panel_ops.pinctrl_init(panel);
 	if (rc) {
 		DSI_ERR("[%s] failed to init pinctrl, rc=%d\n",
 				panel->name, rc);
 		goto exit;
 	}
 
-	rc = dsi_panel_gpio_request(panel);
+	rc = panel->panel_ops.gpio_request(panel);
 	if (rc) {
 		DSI_ERR("[%s] failed to request gpios, rc=%d\n", panel->name,
 		       rc);
 		goto error_pinctrl_deinit;
 	}
 
-	rc = dsi_panel_bl_register(panel);
+	rc = panel->panel_ops.bl_register(panel);
 	if (rc) {
 		if (rc != -EPROBE_DEFER)
 			DSI_ERR("[%s] failed to register backlight, rc=%d\n",
@@ -3399,17 +3432,17 @@ int dsi_panel_drv_deinit(struct dsi_panel *panel)
 
 	mutex_lock(&panel->panel_lock);
 
-	rc = dsi_panel_bl_unregister(panel);
+	rc = panel->panel_ops.bl_unregister(panel);
 	if (rc)
 		DSI_ERR("[%s] failed to unregister backlight, rc=%d\n",
 		       panel->name, rc);
 
-	rc = dsi_panel_gpio_release(panel);
+	rc = panel->panel_ops.gpio_release(panel);
 	if (rc)
 		DSI_ERR("[%s] failed to release gpios, rc=%d\n", panel->name,
 		       rc);
 
-	rc = dsi_panel_pinctrl_deinit(panel);
+	rc = panel->panel_ops.pinctrl_deinit(panel);
 	if (rc)
 		DSI_ERR("[%s] failed to deinit gpios, rc=%d\n", panel->name,
 		       rc);
@@ -3606,7 +3639,7 @@ void dsi_panel_put_mode(struct dsi_display_mode *mode)
 void dsi_panel_calc_dsi_transfer_time(struct dsi_host_common_cfg *config,
 		struct dsi_display_mode *mode, u32 frame_threshold_us)
 {
-	u32 frame_time_us,nslices;
+	u32 frame_time_us, nslices;
 	u64 min_bitclk_hz, total_active_pixels, bits_per_line, pclk_rate_hz,
 		dsi_transfer_time_us, pixel_clk_khz;
 	struct msm_display_dsc_info *dsc = mode->timing.dsc;
@@ -3618,7 +3651,7 @@ void dsi_panel_calc_dsi_transfer_time(struct dsi_host_common_cfg *config,
 
 	/* Packet overlead in bits,2 bytes header + 2 bytes checksum
 	 * + 1 byte dcs data command.
-        */
+	*/
 	const u32 packet_overhead = 56;
 
 	display_mode = container_of(timing, struct dsi_display_mode, timing);

+ 16 - 1
msm/dsi/dsi_panel.h

@@ -170,6 +170,18 @@ struct dsi_panel_spr_info {
 	enum msm_display_spr_pack_type pack_type;
 };
 
+struct dsi_panel;
+
+struct dsi_panel_ops {
+	int (*pinctrl_init)(struct dsi_panel *panel);
+	int (*gpio_request)(struct dsi_panel *panel);
+	int (*pinctrl_deinit)(struct dsi_panel *panel);
+	int (*gpio_release)(struct dsi_panel *panel);
+	int (*bl_register)(struct dsi_panel *panel);
+	int (*bl_unregister)(struct dsi_panel *panel);
+	int (*parse_gpios)(struct dsi_panel *panel);
+};
+
 struct dsi_panel {
 	const char *name;
 	const char *type;
@@ -227,6 +239,8 @@ struct dsi_panel {
 	int panel_test_gpio;
 	int power_mode;
 	enum dsi_panel_physical_type panel_type;
+
+	struct dsi_panel_ops panel_ops;
 };
 
 static inline bool dsi_panel_ulps_feature_enabled(struct dsi_panel *panel)
@@ -258,7 +272,8 @@ struct dsi_panel *dsi_panel_get(struct device *parent,
 				struct device_node *of_node,
 				struct device_node *parser_node,
 				const char *type,
-				int topology_override);
+				int topology_override,
+				bool trusted_vm_env);
 
 int dsi_panel_trigger_esd_attack(struct dsi_panel *panel);
 

+ 9 - 5
msm/dsi/dsi_phy.c

@@ -872,7 +872,8 @@ error:
  * @config:             DSI host configuration.
  * @pll_source:         Source PLL for PHY clock.
  * @skip_validation:    Validation will not be performed on parameters.
- * @is_cont_splash_enabled:    check whether continuous splash enabled.
+ * @skip_op:            Skip re-enabling dsi phy hw during usecases like
+ *                      cont-splash/trusted-vm if set to true.
  *
  * Validates and enables DSI PHY.
  *
@@ -882,7 +883,7 @@ int dsi_phy_enable(struct msm_dsi_phy *phy,
 		   struct dsi_host_config *config,
 		   enum dsi_phy_pll_source pll_source,
 		   bool skip_validation,
-		   bool is_cont_splash_enabled)
+		   bool skip_op)
 {
 	int rc = 0;
 
@@ -917,7 +918,7 @@ int dsi_phy_enable(struct msm_dsi_phy *phy,
 		goto error;
 	}
 
-	if (!is_cont_splash_enabled) {
+	if (!skip_op) {
 		dsi_phy_enable_hw(phy);
 		DSI_PHY_DBG(phy, "cont splash not enabled, phy enable required\n");
 	}
@@ -968,10 +969,12 @@ int dsi_phy_lane_reset(struct msm_dsi_phy *phy)
 /**
  * dsi_phy_disable() - disable DSI PHY hardware.
  * @phy:        DSI PHY handle.
+ * @skip_op:    Skip disabling dsi phy hw during usecases like
+ *              trusted-vm if set to true.
  *
  * Return: error code.
  */
-int dsi_phy_disable(struct msm_dsi_phy *phy)
+int dsi_phy_disable(struct msm_dsi_phy *phy, bool skip_op)
 {
 	int rc = 0;
 
@@ -981,7 +984,8 @@ int dsi_phy_disable(struct msm_dsi_phy *phy)
 	}
 
 	mutex_lock(&phy->phy_lock);
-	dsi_phy_disable_hw(phy);
+	if (!skip_op)
+		dsi_phy_disable_hw(phy);
 	phy->dsi_phy_state = DSI_PHY_ENGINE_OFF;
 	mutex_unlock(&phy->phy_lock);
 

+ 7 - 4
msm/dsi/dsi_phy.h

@@ -181,7 +181,8 @@ int dsi_phy_set_power_state(struct msm_dsi_phy *dsi_phy, bool enable);
  * @config:             DSI host configuration.
  * @pll_source:         Source PLL for PHY clock.
  * @skip_validation:    Validation will not be performed on parameters.
- * @is_cont_splash_enabled:    check whether continuous splash enabled.
+ * @skip_op:            Skip re-enabling dsi phy hw during usecases like
+ *                      cont-splash/trusted-vm if set to true.
  *
  * Validates and enables DSI PHY.
  *
@@ -191,15 +192,17 @@ int dsi_phy_enable(struct msm_dsi_phy *dsi_phy,
 		   struct dsi_host_config *config,
 		   enum dsi_phy_pll_source pll_source,
 		   bool skip_validation,
-		   bool is_cont_splash_enabled);
+		   bool skip_op);
 
 /**
  * dsi_phy_disable() - disable DSI PHY hardware.
- * @phy:        DSI PHY handle.
+ * @phy:            DSI PHY handle.
+ * @skip_op:        Skip disabling dsi phy hw during usecases like
+ *                  trusted-vm if set to true.
  *
  * Return: error code.
  */
-int dsi_phy_disable(struct msm_dsi_phy *phy);
+int dsi_phy_disable(struct msm_dsi_phy *phy, bool skip_op);
 
 /**
  * dsi_phy_set_ulps() - set ulps state for DSI pHY