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

Jouni Högander jouni.hogander at intel.com
Mon Jan 16 07:27:23 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>
---
 .../drm/i915/display/intel_display_debugfs.c  | 45 +++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_psr.c      |  2 +-
 drivers/gpu/drm/i915/display/intel_psr.h      |  2 +
 3 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
index 7bcd90384a46..9f07c2bf1d3f 100644
--- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
+++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
@@ -360,6 +360,50 @@ static int intel_psr_status(struct seq_file *m, struct intel_dp *intel_dp)
 	return 0;
 }
 
+static int i915_edp_psr_error_status(struct seq_file *m, void *data)
+{
+	struct drm_i915_private *dev_priv = node_to_i915(m->private);
+	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;
+}
+
 static int i915_edp_psr_status(struct seq_file *m, void *data)
 {
 	struct drm_i915_private *dev_priv = node_to_i915(m->private);
@@ -1580,6 +1624,7 @@ static const struct drm_info_list intel_display_debugfs_list[] = {
 	{"i915_vbt", i915_vbt, 0},
 	{"i915_gem_framebuffer", i915_gem_framebuffer_info, 0},
 	{"i915_edp_psr_status", i915_edp_psr_status, 0},
+	{"i915_edp_psr_error_status", i915_edp_psr_error_status, 0},
 	{"i915_power_domain_info", i915_power_domain_info, 0},
 	{"i915_display_info", i915_display_info, 0},
 	{"i915_shared_dplls_info", i915_shared_dplls_info, 0},
diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
index d0d774219cc5..f52604283658 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -2447,7 +2447,7 @@ void intel_psr_init(struct intel_dp *intel_dp)
 	mutex_init(&intel_dp->psr.lock);
 }
 
-static int psr_get_status_and_error_status(struct intel_dp *intel_dp,
+int psr_get_status_and_error_status(struct intel_dp *intel_dp,
 					   u8 *status, u8 *error_status)
 {
 	struct drm_dp_aux *aux = &intel_dp->aux;
diff --git a/drivers/gpu/drm/i915/display/intel_psr.h b/drivers/gpu/drm/i915/display/intel_psr.h
index 2ac3a46cccc5..dec0dad0f30b 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.h
+++ b/drivers/gpu/drm/i915/display/intel_psr.h
@@ -54,6 +54,8 @@ void intel_psr2_disable_plane_sel_fetch(struct intel_plane *plane,
 					const struct intel_crtc_state *crtc_state);
 void intel_psr_pause(struct intel_dp *intel_dp);
 void intel_psr_resume(struct intel_dp *intel_dp);
+int psr_get_status_and_error_status(struct intel_dp *intel_dp,
+				    u8 *status, u8 *error_status);
 
 void intel_psr_lock(const struct intel_crtc_state *crtc_state);
 void intel_psr_unlock(const struct intel_crtc_state *crtc_state);
-- 
2.34.1



More information about the Intel-gfx-trybot mailing list