Pārlūkot izejas kodu

disp: msm: dp: reenable sink crc for robustness

Some monitors seem to be not enabling Sink CRC capability on first plugin
and therefore the CRC read returns all zeros. But on subsequent plugins
the capability is set properly and CRC values are calculated. To
workaround this quirk on the sink side, this change reenables sink CRC
if the values are read as zeros.

Change-Id: I67ace5c064b2b56d03732a78f334ea6b1b649608
Signed-off-by: Rajkumar Subbiah <[email protected]>
Rajkumar Subbiah 2 gadi atpakaļ
vecāks
revīzija
7ac494a18e
2 mainītis faili ar 16 papildinājumiem un 11 dzēšanām
  1. 9 1
      msm/dp/dp_debug.c
  2. 7 10
      msm/dp/dp_panel.c

+ 9 - 1
msm/dp/dp_debug.c

@@ -402,8 +402,16 @@ static ssize_t dp_debug_read_crc(struct file *file, char __user *user_buff, size
 		panel = debug->panel;
 	}
 
-	panel->get_src_crc(panel, src_crc);
 	panel->get_sink_crc(panel, sink_crc);
+	if (!(sink_crc[0] + sink_crc[1] + sink_crc[2])) {
+		panel->sink_crc_enable(panel, true);
+		mutex_unlock(&debug->lock);
+		msleep(30);
+		mutex_lock(&debug->lock);
+		panel->get_sink_crc(panel, sink_crc);
+	}
+
+	panel->get_src_crc(panel, src_crc);
 
 	len += scnprintf(buf + len, buf_size - len, "FRAME_CRC:\nSource vs Sink\n");
 

+ 7 - 10
msm/dp/dp_panel.c

@@ -3113,18 +3113,15 @@ int dp_panel_sink_crc_enable(struct dp_panel *dp_panel, bool enable)
 	panel = container_of(dp_panel, struct dp_panel_private, dp_panel);
 	drm_aux = panel->aux->drm_aux;
 
-	if (dp_panel->link_info.capabilities & DP_LINK_CAP_CRC) {
-		ret = drm_dp_dpcd_readb(drm_aux, DP_TEST_SINK, &buf);
-		if (ret < 0)
-			return ret;
+	ret = drm_dp_dpcd_readb(drm_aux, DP_TEST_SINK, &buf);
+	if (ret < 0)
+		return ret;
 
-		ret = drm_dp_dpcd_writeb(drm_aux, DP_TEST_SINK, buf | DP_TEST_SINK_START);
-		if (ret < 0)
-			return ret;
+	ret = drm_dp_dpcd_writeb(drm_aux, DP_TEST_SINK, buf | DP_TEST_SINK_START);
+	if (ret < 0)
+		return ret;
 
-		drm_dp_dpcd_readb(drm_aux, DP_TEST_SINK, &buf);
-		DP_DEBUG("Enabled CRC: %x\n", buf);
-	}
+	drm_dp_dpcd_readb(drm_aux, DP_TEST_SINK, &buf);
 
 	return rc;
 }