dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ramalingam C <ramalingam.c@intel.com>
To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	daniel.vetter@intel.com
Subject: [RFC v1 19/20] drm/hdcp2.2: HDCP2.2 enable as a asynchronous work
Date: Wed, 12 Jul 2017 13:59:03 +0530	[thread overview]
Message-ID: <1499848144-8456-20-git-send-email-ramalingam.c@intel.com> (raw)
In-Reply-To: <1499848144-8456-1-git-send-email-ramalingam.c@intel.com>

HDCP2 Authentication might take more then 5Secs based on the
downstream topology. So when atomic property set ioctl requests
for HDCP enable, We schedule the HDCP2 enbale as a asynchronous
work by not blocking the ioctl call.

The Result of the work will be updated to the DRM Property.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/drm_hdcp.c | 40 +++++++++++++++++++++++++++++++++++++---
 include/drm/drm_hdcp.h     |  8 ++++++++
 2 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_hdcp.c b/drivers/gpu/drm/drm_hdcp.c
index cb20cc9..9e1b7ae 100644
--- a/drivers/gpu/drm/drm_hdcp.c
+++ b/drivers/gpu/drm/drm_hdcp.c
@@ -69,6 +69,39 @@ static void drm_hdcp_update_change(struct drm_hdcp *hdcp, bool enabled,
 	}
 }
 
+static void hdcp_2_2_enable_work(struct work_struct *work)
+{
+	struct drm_hdcp *hdcp = container_of(work, struct drm_hdcp,
+							hdcp2_enable_work);
+
+	mutex_lock(&hdcp->mutex);
+
+	/* Marking it as WIP */
+	drm_hdcp_update_change(hdcp, false, DRM_HDCP_WIP, true);
+	hdcp->spec_ver_used = HDCP_2_2_SUPPORT;
+
+	/*
+	 * TODO: Implement the HDCP2.2 authentication and Encryption Enable
+	 */
+	mutex_unlock(&hdcp->mutex);
+}
+
+static int drm_hdcp_2_2_enable(struct drm_hdcp *hdcp, uint8_t stream_type)
+{
+	mutex_lock(&hdcp->mutex);
+
+	/* Set the stream type */
+	hdcp->streams[0].stream_type = stream_type;
+
+	hdcp->req_state &= ~(DRM_HDCP_ENABLE | DRM_HDCP_TYPE_MASK);
+	hdcp->req_state = DRM_HDCP_ENABLE |
+				(stream_type << DRM_HDCP_TYPE_SHIFT);
+
+	schedule_work(&hdcp->hdcp2_enable_work);
+
+	mutex_unlock(&hdcp->mutex);
+	return 0;
+}
 
 int drm_hdcp_enable(struct drm_connector *connector, uint8_t stream_type)
 {
@@ -83,9 +116,8 @@ int drm_hdcp_enable(struct drm_connector *connector, uint8_t stream_type)
 		return ret;
 	}
 
-	/*
-	 * TODO: Invoke the Version specific hdcp_enable
-	 */
+	if (connector->hdcp_state & DRM_HDCP2_SUPPORTED)
+		return drm_hdcp_2_2_enable(hdcp, stream_type);
 
 	return 0;
 }
@@ -260,6 +292,8 @@ static inline int drm_hdcp2_init(struct drm_connector *connector,
 	/* Setting it to Type 0 by default */
 	hdcp->streams[0].stream_type = HDCP_STREAM_TYPE0_CODE;
 
+	INIT_WORK(&hdcp->hdcp2_enable_work, hdcp_2_2_enable_work);
+
 	return 0;
 }
 
diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h
index dac9831..ea18bac 100644
--- a/include/drm/drm_hdcp.h
+++ b/include/drm/drm_hdcp.h
@@ -366,6 +366,12 @@ struct drm_hdcp {
 	uint32_t ver_support_on_plat;
 	uint32_t ver_support_on_panel;
 
+	/*
+	 * HDCP ver last used for Enable. Will help to choose the
+	 * corresponding Version's disable.
+	 */
+	uint32_t spec_ver_used;
+
 	/* HDCP requested state and also the current state */
 	uint64_t req_state;
 
@@ -375,6 +381,8 @@ struct drm_hdcp {
 	const struct drm_hdcp_funcs *hdcp_funcs;
 	const struct drm_hdcp2_funcs *hdcp2_funcs;
 
+	struct work_struct hdcp2_enable_work;
+
 	struct mutex mutex;
 };
 
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-07-12  8:29 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-12  8:28 [RFC v1 00/20] DRM Interfaces for HDCP support Ramalingam C
2017-07-12  8:28 ` [RFC v1 01/20] drm/hdcp: HDCP bitmask property for connectors Ramalingam C
2017-07-12  9:54   ` Daniel Vetter
2017-07-12 14:56     ` [Intel-gfx] " Ramalingam C
2017-07-12 19:10       ` Sean Paul
2017-07-13  6:09         ` Daniel Vetter
2017-07-13  6:54           ` Ramalingam C
2017-07-13  8:45             ` Daniel Vetter
2017-07-13 10:15               ` [Intel-gfx] " Ramalingam C
2017-07-13 10:36                 ` Daniel Vetter
2017-07-13 12:59                   ` Ramalingam C
2017-07-13 19:02                     ` [Intel-gfx] " Daniel Vetter
2017-07-14 10:40                       ` Ramalingam C
2017-07-14 11:21                         ` [RFC v2] drm/hdcp: drm enum property for HDCP State Ramalingam C
2017-07-14 13:55                           ` Sean Paul
2017-07-21 13:02                             ` Ramalingam C
2017-07-24 13:23                               ` Sean Paul
2017-07-24 13:34                                 ` Ramalingam C
2017-07-24 18:12                                 ` [RFC v3] drm/hdcp: drm enum property for CP State Ramalingam C
2017-07-25 12:34                                   ` Sean Paul
2017-07-26  9:54                                     ` Ramalingam C
2017-07-26 14:52                                       ` Sean Paul
2017-07-26 16:51                                         ` C, Ramalingam
2017-07-26 17:54                                           ` Sean Paul
2017-08-02 15:32                                             ` Ramalingam C
2017-08-02 15:53                                               ` [RFC v4] " Ramalingam C
2017-08-05 15:51                                                 ` Ramalingam C
2017-08-07  5:32                                                   ` Ramalingam C
2017-07-13  6:36         ` [Intel-gfx] [RFC v1 01/20] drm/hdcp: HDCP bitmask property for connectors Ramalingam C
2017-07-12  8:28 ` [RFC v1 02/20] drm/hdcp: HDCP SRM blob " Ramalingam C
2017-07-12  8:28 ` [RFC v1 03/20] drm/sysfs: Generate drm uevent with custom string Ramalingam C
2017-07-12  8:28 ` [RFC v1 04/20] drm/hdcp: Struct drm_hdcp for connector's hdcp state Ramalingam C
2017-07-12  8:28 ` [RFC v1 05/20] drm/hdcp: HDCP status code for DRM HDCP stack Ramalingam C
2017-07-12  8:28 ` [RFC v1 06/20] drm/hdcp: display driver callback funcs defined Ramalingam C
2017-07-12  8:28 ` [RFC v1 07/20] drm/hdcp: Initialization of DRM hdcp stack Ramalingam C
2017-07-12  8:28 ` [RFC v1 08/20] drm/hdcp: Add KBuild for DRM HDCP support Ramalingam C
2017-07-12  8:28 ` [RFC v1 09/20] drm/hdcp: Generic enable, disable and late_init Ramalingam C
2017-07-12  8:28 ` [RFC v1 10/20] drm/hdcp: Handler for connector state change Ramalingam C
2017-07-12  8:28 ` [RFC v1 11/20] drm/hdcp: Registering " Ramalingam C
2017-07-12  8:28 ` [RFC v1 12/20] drm/hdcp: Atomic set and get property for hdcp Ramalingam C
2017-07-12  8:28 ` [RFC v1 13/20] drm/hdcp: Updating DRM Property val with HDCP state Ramalingam C
2017-07-12  8:28 ` [RFC v1 14/20] drm/hdcp2.2: HDCP2.2 protocol msg definitions Ramalingam C
2017-07-12  8:28 ` [RFC v1 15/20] drm/hdcp2.2: Display driver service functions Ramalingam C
2017-07-12  8:29 ` [RFC v1 16/20] drm/hdcp2.2: HDCP2.2 Initialization Ramalingam C
2017-07-12  8:29 ` [RFC v1 17/20] drm/hdcp2.2: Definitions of HDMI HDCP2.2 registers Ramalingam C
2017-07-12  8:29 ` [RFC v1 18/20] drm/hdcp2.2: Late_init: Capability probing on panel Ramalingam C
2017-07-12  8:29 ` Ramalingam C [this message]
2017-07-12  8:29 ` [RFC v1 20/20] drm/hdcp2.2: HDCP2.2 disable as a asynchronous work Ramalingam C

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=1499848144-8456-20-git-send-email-ramalingam.c@intel.com \
    --to=ramalingam.c@intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox