Blob Blame History Raw
From: Sean Paul <seanpaul@chromium.org>
Date: Tue, 9 Jan 2018 13:53:13 -0500
Subject: drm/i915: Only disable HDCP when it's active
Git-commit: 01468d6c711a31a9fe333d072afa8a4730ef3bf9
Patch-mainline: v4.17-rc1
References: FATE#326289 FATE#326079 FATE#326049 FATE#322398 FATE#326166

Instead of always trying to disable HDCP. Only run hdcp_disable when the
state is not UNDESIRED. This will catch cases where it's enabled and
also cases where enable failed and the state is left in DESIRED mode.

Note that things won't blow up if disable is attempted while already
disabled, it's just bad form.

Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180109185330.16853-1-seanpaul@chromium.org

Acked-by: Petr Tesarik <ptesarik@suse.com>
---
 drivers/gpu/drm/i915/intel_hdcp.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -616,15 +616,17 @@ out:
 
 int intel_hdcp_disable(struct intel_connector *connector)
 {
-	int ret;
+	int ret = 0;
 
 	if (!connector->hdcp_shim)
 		return -ENOENT;
 
 	mutex_lock(&connector->hdcp_mutex);
 
-	connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_UNDESIRED;
-	ret = _intel_hdcp_disable(connector);
+	if (connector->hdcp_value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
+		connector->hdcp_value = DRM_MODE_CONTENT_PROTECTION_UNDESIRED;
+		ret = _intel_hdcp_disable(connector);
+	}
 
 	mutex_unlock(&connector->hdcp_mutex);
 	cancel_delayed_work_sync(&connector->hdcp_check_work);