diff mbox

drm/i915: Fix psr sink status report.

Message ID 20180719071236.5503-1-rodrigo.vivi@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rodrigo Vivi July 19, 2018, 7:12 a.m. UTC
First of all don't try to read dpcd if PSR is not even supported.

But also, if read failed return -EIO instead of reporting via a
backchannel.

Fixes: 5b7b30864d1d ("drm/i915/psr: Split sink status into a separate debugfs node")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index b3aefd623557..401aca53169d 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2594,6 +2594,7 @@  static const struct file_operations i915_guc_log_relay_fops = {
 
 static int i915_psr_sink_status_show(struct seq_file *m, void *data)
 {
+	struct drm_i915_private *dev_priv = node_to_i915(m->private);
 	u8 val;
 	static const char * const sink_status[] = {
 		"inactive",
@@ -2609,6 +2610,11 @@  static int i915_psr_sink_status_show(struct seq_file *m, void *data)
 	struct intel_dp *intel_dp =
 		enc_to_intel_dp(&intel_attached_encoder(connector)->base);
 
+	if (!CAN_PSR(dev_priv)) {
+		seq_puts(m, "PSR Unsupported\n");
+		return -ENODEV;
+	}
+
 	if (connector->status != connector_status_connected)
 		return -ENODEV;
 
@@ -2620,7 +2626,7 @@  static int i915_psr_sink_status_show(struct seq_file *m, void *data)
 			str = sink_status[val];
 		seq_printf(m, "Sink PSR status: 0x%x [%s]\n", val, str);
 	} else {
-		DRM_ERROR("dpcd read (at %u) failed\n", DP_PSR_STATUS);
+		return -EIO;
 	}
 
 	return 0;