Bläddra i källkod

disp: msm: dp: add support to dump dpcd from debugfs node

Current debugfs dpcd node only dumps last written dpcd
string in dpsim mode. This change adds support to dump
dpcd information in real monitor use case.

Change-Id: I8a716f30df72feadf9012c65f5a56fe7194d91d2
Signed-off-by: Sudarsan Ramesh <[email protected]>
Sudarsan Ramesh 4 år sedan
förälder
incheckning
8339221ace
1 ändrade filer med 15 tillägg och 7 borttagningar
  1. 15 7
      msm/dp/dp_debug.c

+ 15 - 7
msm/dp/dp_debug.c

@@ -313,15 +313,23 @@ static ssize_t dp_debug_read_dpcd(struct file *file,
 	if (!dpcd)
 		goto bail;
 
-	dp_sim_read_dpcd_reg(debug->sim_bridge, dpcd,
-			debug->dpcd_size, debug->dpcd_offset);
+	/*
+	 * In simulation mode, this function returns the last written DPCD node.
+	 * For a real monitor plug in, it always dumps the first 16 DPCD registers.
+	 */
+	if (debug->dp_debug.sim_mode) {
+		dp_sim_read_dpcd_reg(debug->sim_bridge, dpcd, debug->dpcd_size, debug->dpcd_offset);
+	} else {
+		debug->dpcd_size = sizeof(debug->panel->dpcd);
+		debug->dpcd_offset = 0;
+		memcpy(dpcd, debug->panel->dpcd, debug->dpcd_size);
+	}
 
-	len += snprintf(buf, buf_size, "0x%x", debug->dpcd_offset);
+	len += scnprintf(buf, buf_size, "%04x: ", debug->dpcd_offset);
 
-	while (offset < debug->dpcd_size) {
-		len += snprintf(buf + len, buf_size - len, "0x%x",
-			dpcd[debug->dpcd_offset + offset++]);
-	}
+	while (offset < debug->dpcd_size)
+		len += scnprintf(buf + len, buf_size - len, "%02x ",
+				dpcd[debug->dpcd_offset + offset++]);
 
 	kfree(dpcd);