Эх сурвалжийг харах

Merge "disp: msm: dsi: register io resource collection VM event hook"

qctecmdr 5 жил өмнө
parent
commit
6fd5a637c2

+ 3 - 3
msm/dsi/dsi_catalog.c

@@ -102,11 +102,11 @@ static void dsi_catalog_cmn_init(struct dsi_ctrl_hw *ctrl,
 	case DSI_CTRL_VERSION_2_5:
 		ctrl->ops.phy_reset_config = dsi_ctrl_hw_22_phy_reset_config;
 		ctrl->ops.config_clk_gating = dsi_ctrl_hw_22_config_clk_gating;
-		ctrl->ops.setup_lane_map = dsi_ctrl_hw_20_setup_lane_map;
+		ctrl->ops.setup_lane_map = dsi_ctrl_hw_22_setup_lane_map;
 		ctrl->ops.wait_for_lane_idle =
-			dsi_ctrl_hw_20_wait_for_lane_idle;
+			dsi_ctrl_hw_22_wait_for_lane_idle;
 		ctrl->ops.reg_dump_to_buffer =
-			dsi_ctrl_hw_20_reg_dump_to_buffer;
+			dsi_ctrl_hw_22_reg_dump_to_buffer;
 		ctrl->ops.ulps_ops.ulps_request = dsi_ctrl_hw_cmn_ulps_request;
 		ctrl->ops.ulps_ops.ulps_exit = dsi_ctrl_hw_cmn_ulps_exit;
 		ctrl->ops.ulps_ops.get_lanes_in_ulps =

+ 6 - 0
msm/dsi/dsi_catalog.h

@@ -243,6 +243,12 @@ void dsi_ctrl_hw_kickoff_non_embedded_mode(struct dsi_ctrl_hw *ctrl,
 					u32 flags);
 
 /* Definitions specific to 2.2 DSI controller hardware */
+void dsi_ctrl_hw_22_setup_lane_map(struct dsi_ctrl_hw *ctrl,
+		       struct dsi_lane_map *lane_map);
+int dsi_ctrl_hw_22_wait_for_lane_idle(struct dsi_ctrl_hw *ctrl, u32 lanes);
+ssize_t dsi_ctrl_hw_22_reg_dump_to_buffer(struct dsi_ctrl_hw *ctrl,
+					  char *buf, u32 size);
+
 void dsi_ctrl_hw_22_config_clk_gating(struct dsi_ctrl_hw *ctrl, bool enable,
 		enum dsi_clk_gate_type clk_selection);
 

+ 63 - 61
msm/dsi/dsi_ctrl.c

@@ -1998,6 +1998,27 @@ static struct platform_driver dsi_ctrl_driver = {
 	},
 };
 
+int dsi_ctrl_get_io_resources(struct msm_io_res *io_res)
+{
+	int rc = 0;
+	struct dsi_ctrl_list_item *dsi_ctrl;
+
+	mutex_lock(&dsi_ctrl_list_lock);
+
+	list_for_each_entry(dsi_ctrl, &dsi_ctrl_list, list) {
+		rc = msm_dss_get_io_mem(dsi_ctrl->ctrl->pdev, &io_res->mem);
+		if (rc) {
+			DSI_CTRL_ERR(dsi_ctrl->ctrl,
+					"failed to get io mem, rc = %d\n", rc);
+			return rc;
+		}
+	}
+
+	mutex_unlock(&dsi_ctrl_list_lock);
+
+	return rc;
+}
+
 /**
  * dsi_ctrl_get() - get a dsi_ctrl handle from an of_node
  * @of_node:    of_node of the DSI controller.
@@ -2792,7 +2813,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 +2823,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 +2840,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 +2873,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 +3272,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 +3379,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 +3388,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 +3406,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 +3424,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 +3433,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 +3449,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 +3467,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 +3476,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 +3495,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);

+ 22 - 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.
@@ -851,4 +847,14 @@ void dsi_ctrl_set_continuous_clk(struct dsi_ctrl *dsi_ctrl, bool enable);
  * @dsi_ctrl:                      DSI controller handle.
  */
 int dsi_ctrl_wait4dynamic_refresh_done(struct dsi_ctrl *ctrl);
+
+/**
+ * dsi_ctrl_get_io_resources() - reads associated register range
+ *
+ * @io_res:	 pointer to msm_io_res struct to populate the ranges
+ *
+ * Return: error code.
+ */
+int dsi_ctrl_get_io_resources(struct msm_io_res *io_res);
+
 #endif /* _DSI_CTRL_H_ */

+ 57 - 2
msm/dsi/dsi_ctrl_hw_2_2.c

@@ -1,8 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
  */
-
+#include <linux/iopoll.h>
 #include "dsi_ctrl_hw.h"
 #include "dsi_ctrl_reg.h"
 #include "dsi_hw.h"
@@ -13,6 +13,61 @@
 /* register to configure DMA scheduling */
 #define DSI_DMA_SCHEDULE_CTRL 0x100
 
+void dsi_ctrl_hw_22_setup_lane_map(struct dsi_ctrl_hw *ctrl,
+		       struct dsi_lane_map *lane_map)
+{
+	u32 reg_value = lane_map->lane_map_v2[DSI_LOGICAL_LANE_0] |
+			(lane_map->lane_map_v2[DSI_LOGICAL_LANE_1] << 4) |
+			(lane_map->lane_map_v2[DSI_LOGICAL_LANE_2] << 8) |
+			(lane_map->lane_map_v2[DSI_LOGICAL_LANE_3] << 12);
+
+	DSI_W32(ctrl, DSI_LANE_SWAP_CTRL, reg_value);
+
+	DSI_CTRL_HW_DBG(ctrl, "[DSI_%d] Lane swap setup complete\n",
+			ctrl->index);
+}
+
+int dsi_ctrl_hw_22_wait_for_lane_idle(struct dsi_ctrl_hw *ctrl,
+		u32 lanes)
+{
+	int rc = 0, val = 0;
+	u32 fifo_empty_mask = 0;
+	u32 const sleep_us = 10;
+	u32 const timeout_us = 100;
+
+	if (lanes & DSI_DATA_LANE_0)
+		fifo_empty_mask |= (BIT(12) | BIT(16));
+
+	if (lanes & DSI_DATA_LANE_1)
+		fifo_empty_mask |= BIT(20);
+
+	if (lanes & DSI_DATA_LANE_2)
+		fifo_empty_mask |= BIT(24);
+
+	if (lanes & DSI_DATA_LANE_3)
+		fifo_empty_mask |= BIT(28);
+
+	DSI_CTRL_HW_DBG(ctrl, "%s: polling for fifo empty, mask=0x%08x\n",
+		__func__, fifo_empty_mask);
+	rc = readl_poll_timeout(ctrl->base + DSI_FIFO_STATUS, val,
+			(val & fifo_empty_mask), sleep_us, timeout_us);
+	if (rc) {
+		DSI_CTRL_HW_ERR(ctrl,
+				"%s: fifo not empty, FIFO_STATUS=0x%08x\n",
+				__func__, val);
+		goto error;
+	}
+error:
+	return rc;
+}
+
+ssize_t dsi_ctrl_hw_22_reg_dump_to_buffer(struct dsi_ctrl_hw *ctrl,
+					  char *buf,
+					  u32 size)
+{
+	return size;
+}
+
 /**
  * dsi_ctrl_hw_22_phy_reset_config() - to configure clamp control during ulps
  * @ctrl:          Pointer to the controller host hardware.

+ 207 - 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 */
@@ -5026,6 +5037,39 @@ error:
 	return rc;
 }
 
+static int dsi_display_get_io_resources(struct msm_io_res *io_res, void *data)
+{
+	int rc = 0;
+
+	rc = dsi_ctrl_get_io_resources(io_res);
+	if (rc)
+		goto end;
+
+	rc = dsi_phy_get_io_resources(io_res);
+end:
+	return rc;
+}
+
+static int dsi_display_pre_release(void *data)
+{
+	if (!data)
+		return -EINVAL;
+
+	dsi_display_ctrl_irq_update((struct dsi_display *)data, false);
+
+	return 0;
+}
+
+static int dsi_display_pre_acquire(void *data)
+{
+	if (!data)
+		return -EINVAL;
+
+	dsi_display_ctrl_irq_update((struct dsi_display *)data, true);
+
+	return 0;
+}
+
 /**
  * dsi_display_bind - bind dsi device with controlling device
  * @dev:        Pointer to base of platform device
@@ -5046,6 +5090,11 @@ static int dsi_display_bind(struct device *dev,
 	struct platform_device *pdev = to_platform_device(dev);
 	char *client1 = "dsi_clk_client";
 	char *client2 = "mdp_event_client";
+	struct msm_vm_ops vm_event_ops = {
+		.vm_get_io_resources = dsi_display_get_io_resources,
+		.vm_pre_hw_release = dsi_display_pre_release,
+		.vm_post_hw_acquire = dsi_display_pre_acquire,
+	};
 	int i, rc = 0;
 
 	if (!dev || !pdev || !master) {
@@ -5239,6 +5288,8 @@ static int dsi_display_bind(struct device *dev,
 	/* register te irq handler */
 	dsi_display_register_te_irq(display);
 
+	msm_register_vm_event(master, dev, &vm_event_ops, (void *)display);
+
 	goto error;
 
 error_host_deinit:
@@ -5419,6 +5470,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 +5497,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 +5507,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 +5996,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 +6907,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 +7249,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 +7260,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 +7271,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 +7316,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 +7350,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 +7607,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 +7681,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 +7939,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 +8028,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 +8084,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);
 

+ 30 - 5
msm/dsi/dsi_phy.c

@@ -116,6 +116,27 @@ int dsi_phy_get_version(struct msm_dsi_phy *phy)
 	return phy->ver_info->version;
 }
 
+int dsi_phy_get_io_resources(struct msm_io_res *io_res)
+{
+	struct dsi_phy_list_item *dsi_phy;
+	int rc = 0;
+
+	mutex_lock(&dsi_phy_list_lock);
+
+	list_for_each_entry(dsi_phy, &dsi_phy_list, list) {
+		rc = msm_dss_get_io_mem(dsi_phy->phy->pdev, &io_res->mem);
+		if (rc) {
+			DSI_PHY_ERR(dsi_phy->phy,
+					"failed to get io mem, rc = %d\n", rc);
+			return rc;
+		}
+	}
+
+	mutex_unlock(&dsi_phy_list_lock);
+
+	return rc;
+}
+
 static int dsi_phy_regmap_init(struct platform_device *pdev,
 			       struct msm_dsi_phy *phy)
 {
@@ -872,7 +893,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 +904,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 +939,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 +990,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 +1005,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);
 

+ 16 - 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
@@ -353,4 +356,13 @@ int dsi_phy_dyn_refresh_cache_phy_timings(struct msm_dsi_phy *phy,
  */
 void dsi_phy_set_continuous_clk(struct msm_dsi_phy *phy, bool enable);
 
+/**
+ * dsi_phy_get_io_resources() - reads associated register range
+ *
+ * @io_res:	 pointer to msm_io_res struct to populate the ranges
+ *
+ * Return: error code.
+ */
+int dsi_phy_get_io_resources(struct msm_io_res *io_res);
+
 #endif /* _DSI_PHY_H_ */

+ 9 - 0
msm/dsi/dsi_pll.c

@@ -118,6 +118,7 @@ int dsi_pll_init(struct platform_device *pdev, struct dsi_pll_resource **pll)
 	int rc = 0;
 	const char *label;
 	struct dsi_pll_resource *pll_res = NULL;
+	bool in_trusted_vm = false;
 
 	if (!pdev->dev.of_node) {
 		pr_err("Invalid DSI PHY node\n");
@@ -201,6 +202,14 @@ int dsi_pll_init(struct platform_device *pdev, struct dsi_pll_resource **pll)
 		return -ENOMEM;
 	}
 
+	in_trusted_vm = of_property_read_bool(pdev->dev.of_node,
+						"qcom,dsi-pll-in-trusted-vm");
+	if (in_trusted_vm) {
+		DSI_PLL_INFO(pll_res,
+			"Bypassing PLL clock register for Trusted VM\n");
+		return rc;
+	}
+
 	rc = dsi_pll_clock_register(pdev, pll_res);
 	if (rc) {
 		DSI_PLL_ERR(pll_res, "clock register failed rc=%d\n", rc);