From 8339221ace8224da538ee23dba2772e72a79595a Mon Sep 17 00:00:00 2001 From: Sudarsan Ramesh Date: Fri, 30 Apr 2021 13:59:17 -0400 Subject: [PATCH] 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 --- msm/dp/dp_debug.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/msm/dp/dp_debug.c b/msm/dp/dp_debug.c index ac1200ab7b..e0cbaaf0ba 100644 --- a/msm/dp/dp_debug.c +++ b/msm/dp/dp_debug.c @@ -313,16 +313,24 @@ 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); - - len += snprintf(buf, buf_size, "0x%x", debug->dpcd_offset); - - while (offset < debug->dpcd_size) { - len += snprintf(buf + len, buf_size - len, "0x%x", - dpcd[debug->dpcd_offset + 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 += scnprintf(buf, buf_size, "%04x: ", debug->dpcd_offset); + + while (offset < debug->dpcd_size) + len += scnprintf(buf + len, buf_size - len, "%02x ", + dpcd[debug->dpcd_offset + offset++]); + kfree(dpcd); len = min_t(size_t, count, len);