From patchwork Tue Jan 9 18:53:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10153051 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 23AD4602CA for ; Tue, 9 Jan 2018 18:53:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EA7428717 for ; Tue, 9 Jan 2018 18:53:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11C3C2871D; Tue, 9 Jan 2018 18:53:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B86F02871A for ; Tue, 9 Jan 2018 18:53:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 249F189E9E; Tue, 9 Jan 2018 18:53:36 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-yw0-x244.google.com (mail-yw0-x244.google.com [IPv6:2607:f8b0:4002:c05::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id E74D189E38 for ; Tue, 9 Jan 2018 18:53:34 +0000 (UTC) Received: by mail-yw0-x244.google.com with SMTP id z132so6046513ywd.9 for ; Tue, 09 Jan 2018 10:53:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=wb/11nl9eordvIEHm0h36hoesFKaTky5pOSr/6Xz5p8=; b=ausqa0pKw3ppKHYtYTxlef82jk9XJL+LP2P8SNBc+XDkr9Zl0Gou8InDW2G4+45pfN W44+ngy1dHfoGpiGDRgZFfDESdHNYBdysBBmtTF7cpoeL0WhlvFfSD5OsHQOS51es4D+ SvbnBaKnKGOSxd3u73SN4aJXI/h71H6VTV3p4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wb/11nl9eordvIEHm0h36hoesFKaTky5pOSr/6Xz5p8=; b=a27WL3y5iUd0M4ZzKWICdM8U+d2BzIs4+L2MrmH9raXiQCrNbQXGBUBFvuJB42BwnY erqplSV6KlgbwTHu2hBlCIkIVgdvsWrFGrEUXv3pdygebq/rRXoGg+kOWq9uB6oUhUiS XP8iBv4EkYxgs/GQ5AGXMzGX/ZwYU2rh39guO9diyczcrMPQsw68qra5cX6q6aBLBZbd QRFkbRJDHKdG/nXAntzC4qpMYVenW39GrbZdOb0/Xry/VMzgKiWy8lF886rdwfP2YhHo DZdtIqMAh2rXjj0LjHRtmVcima2+zSRlf1v+LOkRZJY9GorPujYmSfn5wEevheDLIX2s hP3w== X-Gm-Message-State: AKwxyte2J3dUajDFocHDFgsiJTHsm2MVA5unPGQhWwjc/7qq8Z0ILhNs JKqhbtSmj+Mmcfx0LTf4dntjT2WH0Gs= X-Google-Smtp-Source: ACJfBovV7ic67PAtTuqW9O4jjexzaJeIl46eY/bVExAPm9O+xV8IP9UmA9iA+vbyxF4YDXwNGg+4mw== X-Received: by 10.129.61.20 with SMTP id k20mr1946579ywa.471.1515524013837; Tue, 09 Jan 2018 10:53:33 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:d3af:69ac:1964:28e8]) by smtp.gmail.com with ESMTPSA id e2sm6362749ywc.1.2018.01.09.10.53.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 10:53:33 -0800 (PST) From: Sean Paul To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, seanpaul@google.com Date: Tue, 9 Jan 2018 13:53:13 -0500 Message-Id: <20180109185330.16853-1-seanpaul@chromium.org> X-Mailer: git-send-email 2.15.1.620.gb9897f4670-goog Subject: [Intel-gfx] [PATCH] drm/i915: Only disable HDCP when it's active X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Sean Paul --- 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);