[3/3] drm/i915: HDCP: retry link integrity check on failure
diff mbox series

Message ID 20200226080645.7421-3-oliver.barta@aptiv.com
State New
Headers show
Series
  • [1/3] drm/i915: HDCP: fix Ri prime check done during link check
Related show

Commit Message

Oliver Barta Feb. 26, 2020, 8:06 a.m. UTC
A single Ri mismatch doesn't automatically mean that the
link integrity is broken. Update and check of Ri and Ri'
are done asynchronously. In case an update happens just
between the read of Ri' and the check against Ri there will
be a mismatch even if the link integrity is fine otherwise.

A failure can also be caused by transmission errors on DDC.

Signed-off-by: Oliver Barta <oliver.barta@aptiv.com>
---
 drivers/gpu/drm/i915/display/intel_hdmi.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
index 14912daad7ff..5711745d0006 100644
--- a/drivers/gpu/drm/i915/display/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
@@ -1505,7 +1505,7 @@  int intel_hdmi_hdcp_toggle_signalling(struct intel_digital_port *intel_dig_port,
 }
 
 static
-bool intel_hdmi_hdcp_check_link(struct intel_digital_port *intel_dig_port)
+bool intel_hdmi_hdcp_check_link_once(struct intel_digital_port *intel_dig_port)
 {
 	struct drm_i915_private *dev_priv =
 		intel_dig_port->base.base.dev->dev_private;
@@ -1529,7 +1529,7 @@  bool intel_hdmi_hdcp_check_link(struct intel_digital_port *intel_dig_port)
 	if (wait_for((I915_READ(HDCP_STATUS(dev_priv, cpu_transcoder, port)) &
 		     (HDCP_STATUS_RI_MATCH | HDCP_STATUS_ENC)) ==
 		     (HDCP_STATUS_RI_MATCH | HDCP_STATUS_ENC), 1)) {
-		DRM_ERROR("Ri' mismatch detected, link check failed (%x)\n",
+		DRM_DEBUG("Ri' mismatch detected (%x)\n",
 			  I915_READ(HDCP_STATUS(dev_priv, cpu_transcoder,
 						port)));
 		return false;
@@ -1537,6 +1537,19 @@  bool intel_hdmi_hdcp_check_link(struct intel_digital_port *intel_dig_port)
 	return true;
 }
 
+static
+bool intel_hdmi_hdcp_check_link(struct intel_digital_port *intel_dig_port)
+{
+	int retry;
+
+	for (retry = 0; retry < 3; retry++)
+		if (intel_hdmi_hdcp_check_link_once(intel_dig_port))
+			return true;
+
+	DRM_ERROR("Link check failed\n");
+	return false;
+}
+
 struct hdcp2_hdmi_msg_timeout {
 	u8 msg_id;
 	u16 timeout;