All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/hdcp: Retry first read and writes to downstream
@ 2024-09-25  6:56 Suraj Kandpal
  2024-09-25  8:55 ` Jani Nikula
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Suraj Kandpal @ 2024-09-25  6:56 UTC (permalink / raw)
  To: intel-gfx; +Cc: ankit.k.nautiyal, Suraj Kandpal

Retry the first read and write to downstream at least 10 times
with a 50ms delay if not hdcp2 capable. The reason being that
during suspend resume Dock usually keep the HDCP2 registers inaccesible
causing AUX error. This wouldn't be a big problem if the userspace
just kept retrying with some delay while it continues to play low
values content but most userpace applications end up throwing an error
when it receives one from KMD. This makes sure we give the dock
and the sink devices to complete its power cycle and then try HDCP
authentication.

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
---
 drivers/gpu/drm/i915/display/intel_hdcp.c | 26 +++++++++++++++++------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c
index 2afa92321b08..5f2383c219e8 100644
--- a/drivers/gpu/drm/i915/display/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
@@ -1512,7 +1512,7 @@ static int hdcp2_authentication_key_exchange(struct intel_connector *connector)
 	} msgs;
 	const struct intel_hdcp_shim *shim = hdcp->shim;
 	size_t size;
-	int ret;
+	int ret, i;
 
 	/* Init for seq_num */
 	hdcp->seq_num_v = 0;
@@ -1522,13 +1522,25 @@ static int hdcp2_authentication_key_exchange(struct intel_connector *connector)
 	if (ret < 0)
 		return ret;
 
-	ret = shim->write_2_2_msg(connector, &msgs.ake_init,
-				  sizeof(msgs.ake_init));
-	if (ret < 0)
-		return ret;
+	for (i = 0; i <= 10; i++) {
+		if (!intel_hdcp2_get_capability(connector)) {
+			msleep(50);
+			continue;
+		}
+
+		ret = shim->write_2_2_msg(connector, &msgs.ake_init,
+					  sizeof(msgs.ake_init));
+		if (ret < 0)
+			continue;
+
+		ret = shim->read_2_2_msg(connector, HDCP_2_2_AKE_SEND_CERT,
+					 &msgs.send_cert, sizeof(msgs.send_cert));
+		if (ret < 0)
+			continue;
+		else
+			break;
+	}
 
-	ret = shim->read_2_2_msg(connector, HDCP_2_2_AKE_SEND_CERT,
-				 &msgs.send_cert, sizeof(msgs.send_cert));
 	if (ret < 0)
 		return ret;
 
-- 
2.43.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-09-30 18:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-25  6:56 [PATCH] drm/i915/hdcp: Retry first read and writes to downstream Suraj Kandpal
2024-09-25  8:55 ` Jani Nikula
2024-09-25 11:35   ` Kandpal, Suraj
2024-09-26  7:14 ` Suraj Kandpal
2024-09-27  4:52   ` Nautiyal, Ankit K
2024-09-27  6:04 ` Suraj Kandpal
2024-09-27 21:49 ` ✓ Fi.CI.BAT: success for drm/i915/hdcp: Retry first read and writes to downstream (rev3) Patchwork
2024-09-28 20:34 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-09-30 18:18 ` ✓ Fi.CI.IGT: success " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.