Преглед изворни кода

drm/msm/dsi-staging: update frame transfer time calculations

Change updates frame transfer time calculations. Frame threshold
is provided as input to decide on the final transfer time.
Panel dsi clock node followed by mdp transfer time node
will take priority in selecting final transfer time than frame
threshold time.

Change-Id: I40c3abfc635cd9b338b705535612ac32e047ce6e
Signed-off-by: Vara Reddy <[email protected]>
Vara Reddy пре 6 година
родитељ
комит
98ac941a1b
5 измењених фајлова са 28 додато и 13 уклоњено
  1. 10 1
      msm/dsi/dsi_ctrl.c
  2. 5 0
      msm/dsi/dsi_ctrl.h
  3. 4 1
      msm/dsi/dsi_display.c
  4. 8 10
      msm/dsi/dsi_panel.c
  5. 1 1
      msm/dsi/dsi_panel.h

+ 10 - 1
msm/dsi/dsi_ctrl.c

@@ -1704,7 +1704,7 @@ static int dsi_enable_io_clamp(struct dsi_ctrl *dsi_ctrl,
 static int dsi_ctrl_dts_parse(struct dsi_ctrl *dsi_ctrl,
 				  struct device_node *of_node)
 {
-	u32 index = 0;
+	u32 index = 0, frame_threshold_time_us = 0;
 	int rc = 0;
 
 	if (!dsi_ctrl || !of_node) {
@@ -1730,6 +1730,15 @@ static int dsi_ctrl_dts_parse(struct dsi_ctrl *dsi_ctrl,
 	dsi_ctrl->null_insertion_enabled = of_property_read_bool(of_node,
 					"qcom,null-insertion-enabled");
 
+	rc = of_property_read_u32(of_node, "frame-threshold-time-us",
+			&frame_threshold_time_us);
+	if (rc) {
+		pr_debug("frame-threshold-time not specified, defaulting\n");
+		frame_threshold_time_us = 2666;
+	}
+
+	dsi_ctrl->frame_threshold_time_us = frame_threshold_time_us;
+
 	return 0;
 }
 

+ 5 - 0
msm/dsi/dsi_ctrl.h

@@ -204,6 +204,9 @@ struct dsi_ctrl_interrupts {
  * @debugfs_root:        Root for debugfs entries.
  * @misr_enable:         Frame MISR enable/disable
  * @misr_cache:          Cached Frame MISR value
+ * @frame_threshold_time_us: Frame threshold time in microseconds, where
+ *		 	  dsi data lane will be idle i.e from pingpong done to
+ *			  next TE for command mode.
  * @phy_isolation_enabled:    A boolean property allows to isolate the phy from
  *                          dsi controller and run only dsi controller.
  * @null_insertion_enabled:  A boolean property to allow dsi controller to
@@ -255,6 +258,8 @@ struct dsi_ctrl {
 	bool misr_enable;
 	u32 misr_cache;
 
+	u32 frame_threshold_time_us;
+
 	/* Check for spurious interrupts */
 	unsigned long jiffies_start;
 	unsigned int error_interrupt_count;

+ 4 - 1
msm/dsi/dsi_display.c

@@ -5539,6 +5539,7 @@ int dsi_display_get_modes(struct dsi_display *display,
 			  struct dsi_display_mode **out_modes)
 {
 	struct dsi_dfps_capabilities dfps_caps;
+	struct dsi_display_ctrl *ctrl;
 	u32 num_dfps_rates, panel_mode_count, total_mode_count;
 	u32 mode_idx, array_idx = 0;
 	int i, rc = -EINVAL;
@@ -5549,6 +5550,7 @@ int dsi_display_get_modes(struct dsi_display *display,
 	}
 
 	*out_modes = NULL;
+	ctrl = &display->ctrl[0];
 
 	mutex_lock(&display->display_lock);
 
@@ -5582,6 +5584,7 @@ int dsi_display_get_modes(struct dsi_display *display,
 	for (mode_idx = 0; mode_idx < panel_mode_count; mode_idx++) {
 		struct dsi_display_mode panel_mode;
 		int topology_override = NO_OVERRIDE;
+		u32 frame_threshold_us = ctrl->ctrl->frame_threshold_time_us;
 
 		if (display->cmdline_timing == mode_idx)
 			topology_override = display->cmdline_topology;
@@ -5601,7 +5604,7 @@ int dsi_display_get_modes(struct dsi_display *display,
 		if (display->panel->panel_mode == DSI_OP_CMD_MODE) {
 			dsi_panel_calc_dsi_transfer_time(
 					&display->panel->host_config,
-					&panel_mode.timing);
+					&panel_mode, frame_threshold_us);
 			panel_mode.priv_info->dsi_transfer_time_us =
 				panel_mode.timing.dsi_transfer_time_us;
 			panel_mode.priv_info->min_dsi_clk_hz =

+ 8 - 10
msm/dsi/dsi_panel.c

@@ -25,8 +25,6 @@
 
 #define DSI_PANEL_DEFAULT_LABEL  "Default dsi panel"
 
-#define DEFAULT_MDP_TRANSFER_TIME 14000
-
 #define DEFAULT_PANEL_JITTER_NUMERATOR		2
 #define DEFAULT_PANEL_JITTER_DENOMINATOR	1
 #define DEFAULT_PANEL_JITTER_ARRAY_SIZE		2
@@ -763,8 +761,7 @@ static int dsi_panel_parse_timing(struct dsi_mode_info *mode,
 		display_mode->priv_info->mdp_transfer_time_us =
 			mode->mdp_transfer_time_us;
 	else
-		display_mode->priv_info->mdp_transfer_time_us =
-			DEFAULT_MDP_TRANSFER_TIME;
+		display_mode->priv_info->mdp_transfer_time_us = 0;
 
 	rc = utils->read_u32(utils->data,
 				"qcom,mdss-dsi-panel-framerate",
@@ -3309,20 +3306,18 @@ 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_mode_info *timing)
+		struct dsi_display_mode *mode, u32 frame_threshold_us)
 {
 	u32 frame_time_us,nslices;
 	u64 min_bitclk, total_active_pixels, bits_per_line;
-	struct msm_display_dsc_info *dsc = timing->dsc;
+	struct msm_display_dsc_info *dsc = mode->timing.dsc;
+	struct dsi_mode_info *timing = &mode->timing;
 
 	/* Packet overlead in bits,2 bytes header + 2 bytes checksum
 	 * + 1 byte dcs data command.
         */
 	const u32 packet_overhead = 56;
 
-	/* Default time between pingpong done to TE in microsecs */
-	const u32 max_tx_threshold_time = 2166;
-
 	frame_time_us = mult_frac(1000, 1000, (timing->refresh_rate));
 
 	if (timing->dsc_enabled) {
@@ -3350,9 +3345,12 @@ void dsi_panel_calc_dsi_transfer_time(struct dsi_host_common_cfg *config,
 		/* adjust the transfer time proportionately for bit clk*/
 		timing->dsi_transfer_time_us = mult_frac(frame_time_us,
 				min_bitclk, timing->clk_rate_hz);
+	} else if (mode->priv_info->mdp_transfer_time_us) {
+		timing->dsi_transfer_time_us =
+			mode->priv_info->mdp_transfer_time_us;
 	} else {
 		timing->dsi_transfer_time_us = frame_time_us -
-			max_tx_threshold_time;
+			frame_threshold_us;
 	}
 }
 

+ 1 - 1
msm/dsi/dsi_panel.h

@@ -300,6 +300,6 @@ int dsi_panel_parse_esd_reg_read_configs(struct dsi_panel *panel);
 void dsi_panel_ext_bridge_put(struct dsi_panel *panel);
 
 void dsi_panel_calc_dsi_transfer_time(struct dsi_host_common_cfg *config,
-		struct dsi_mode_info *timing);
+		struct dsi_display_mode *mode, u32 frame_threshold_us);
 
 #endif /* _DSI_PANEL_H_ */