All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <seanpaul@chromium.org>
To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	seanpaul@google.com
Subject: [PATCH] drm/i915: Only disable HDCP when it's active
Date: Tue,  9 Jan 2018 13:53:13 -0500	[thread overview]
Message-ID: <20180109185330.16853-1-seanpaul@chromium.org> (raw)

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>
---
 drivers/gpu/drm/i915/intel_hdcp.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 3c164a27d50b..827cab22f191 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -616,15 +616,17 @@ int intel_hdcp_enable(struct intel_connector *connector)
 
 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);
-- 
2.15.1.620.gb9897f4670-goog

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2018-01-09 18:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-09 18:53 Sean Paul [this message]
2018-01-09 19:35 ` ✗ Fi.CI.BAT: failure for drm/i915: Only disable HDCP when it's active Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180109185330.16853-1-seanpaul@chromium.org \
    --to=seanpaul@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=seanpaul@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.