Browse Source

disp: msm: dp: skip crc read if pclk is not on

The DP debugfs node for CRC read currently does not check
if the panel is enabled before attempting the read. This
could cause unclocked access of DP registers. This change
adds the necessary protection and bails out if the clocks
are not turned on.

Change-Id: Ia555e2473fc9f0f7434ee3665eb4fb7cfb4f97cf
Signed-off-by: Rajkumar Subbiah <[email protected]>
Rajkumar Subbiah 2 years ago
parent
commit
da304b72c6
3 changed files with 6 additions and 0 deletions
  1. 2 0
      msm/dp/dp_ctrl.c
  2. 3 0
      msm/dp/dp_debug.c
  3. 1 0
      msm/dp/dp_panel.h

+ 2 - 0
msm/dp/dp_ctrl.c

@@ -1286,6 +1286,7 @@ static int dp_ctrl_stream_on(struct dp_ctrl *dp_ctrl, struct dp_panel *panel)
 		return rc;
 	}
 
+	panel->pclk_on = true;
 	rc = panel->hw_cfg(panel, true);
 	if (rc)
 		return rc;
@@ -1376,6 +1377,7 @@ static void dp_ctrl_stream_off(struct dp_ctrl *dp_ctrl, struct dp_panel *panel)
 
 	panel->hw_cfg(panel, false);
 
+	panel->pclk_on = false;
 	dp_ctrl_disable_stream_clocks(ctrl, panel);
 	ctrl->stream_count--;
 }

+ 3 - 0
msm/dp/dp_debug.c

@@ -402,6 +402,9 @@ static ssize_t dp_debug_read_crc(struct file *file, char __user *user_buff, size
 		panel = debug->panel;
 	}
 
+	if (!panel->pclk_on)
+		goto bail;
+
 	panel->get_sink_crc(panel, sink_crc);
 	if (!(sink_crc[0] + sink_crc[1] + sink_crc[2])) {
 		panel->sink_crc_enable(panel, true);

+ 1 - 0
msm/dp/dp_panel.h

@@ -154,6 +154,7 @@ struct dp_panel {
 	bool widebus_en;
 	bool dsc_continuous_pps;
 	bool mst_state;
+	bool pclk_on;
 
 	/* override debug option */
 	bool mst_hide;