[PATCH] drm/i915/display: Add psr sink error status debugfs files

Jouni Högander jouni.hogander at intel.com
Fri Aug 25 12:28:19 UTC 2023


Some panels seem to not generate interrupt on PSR errors. Add
debugfs entry to read psr error status dpcd register from the
panel.

Signed-off-by: Jouni Högander <jouni.hogander at intel.com>
---
 drivers/gpu/drm/i915/display/intel_psr.c | 52 +++++++++++++++++++++++-
 1 file changed, 51 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
index 72887c29fb51..b73c2d9c433f 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -23,6 +23,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_damage_helper.h>
+#include <drm/drm_debugfs.h>
 
 #include "i915_drv.h"
 #include "i915_reg.h"
@@ -3188,6 +3189,52 @@ static int i915_psr_status_show(struct seq_file *m, void *data)
 }
 DEFINE_SHOW_ATTRIBUTE(i915_psr_status);
 
+static int i915_psr_error_status_show(struct seq_file *m, void *data)
+{
+	struct drm_info_node *node = m->private;
+	struct drm_i915_private *dev_priv = to_i915(node->minor->dev);
+	struct intel_dp *intel_dp = NULL;
+	struct intel_encoder *encoder;
+	int ret = 0;
+
+	if (!HAS_PSR(dev_priv))
+		return -ENODEV;
+
+	/* Find the first EDP which supports PSR */
+	for_each_intel_encoder_with_psr(&dev_priv->drm, encoder) {
+		u8 status, error_status;
+		const u8 errors = DP_PSR_RFB_STORAGE_ERROR |
+			DP_PSR_VSC_SDP_UNCORRECTABLE_ERROR |
+			DP_PSR_LINK_CRC_ERROR;
+
+		intel_dp = enc_to_intel_dp(encoder);
+
+		ret = psr_get_status_and_error_status(intel_dp, &status, &error_status);
+		if (ret)
+			goto out;
+
+		if (status == DP_PSR_SINK_INTERNAL_ERROR && !error_status)
+			seq_printf(m, "PSR sink internal error\n");
+		if (error_status & DP_PSR_RFB_STORAGE_ERROR)
+			seq_printf(m, "PSR RFB storage error\n");
+		if (error_status & DP_PSR_VSC_SDP_UNCORRECTABLE_ERROR)
+			seq_printf(m, "PSR VSC SDP uncorrectable error\n");
+		if (error_status & DP_PSR_LINK_CRC_ERROR)
+			seq_printf(m, "PSR Link CRC error\n");
+
+		if (error_status & ~errors)
+			printk(KERN_ERR"PSR_ERROR_STATUS unhandled errors %x\n",
+			       error_status & ~errors);
+
+		/* clear status register */
+		drm_dp_dpcd_writeb(&intel_dp->aux, DP_PSR_ERROR_STATUS, error_status);
+	}
+
+out:
+	return ret;
+}
+DEFINE_SHOW_ATTRIBUTE(i915_psr_error_status);
+
 void intel_psr_connector_debugfs_add(struct intel_connector *connector)
 {
 	struct drm_i915_private *i915 = to_i915(connector->base.dev);
@@ -3199,7 +3246,10 @@ void intel_psr_connector_debugfs_add(struct intel_connector *connector)
 	debugfs_create_file("i915_psr_sink_status", 0444, root,
 			    connector, &i915_psr_sink_status_fops);
 
-	if (HAS_PSR(i915))
+	if (HAS_PSR(i915)) {
 		debugfs_create_file("i915_psr_status", 0444, root,
 				    connector, &i915_psr_status_fops);
+		debugfs_create_file("i915_psr_error_status", 0444, root,
+				    connector, &i915_psr_error_status_fops);
+	}
 }
-- 
2.34.1



More information about the Intel-gfx-trybot mailing list