[RFC v1 07/20] drm/hdcp: Initialization of DRM hdcp stack

Ramalingam C ramalingam.c at intel.com
Wed Jul 12 08:28:51 UTC 2017


Initialization of the drm hdcp stack drm_hdcp_init is implemented.
This function has to be called by the display driver to get the
DRM support for HDCP.

This function will take the pointers to the drm_hdcp and associated
drm_conenctor. These two entities will be linked. And HDCP version
supported by the Display driver is received as another parameter.
And corresponding callback fucntions can be validated.

Signed-off-by: Ramalingam C <ramalingam.c at intel.com>
---
 drivers/gpu/drm/drm_hdcp.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++
 include/drm/drm_hdcp.h     |  7 +++++
 2 files changed, 82 insertions(+)
 create mode 100644 drivers/gpu/drm/drm_hdcp.c

diff --git a/drivers/gpu/drm/drm_hdcp.c b/drivers/gpu/drm/drm_hdcp.c
new file mode 100644
index 0000000..481bc24
--- /dev/null
+++ b/drivers/gpu/drm/drm_hdcp.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2017 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+/**
+ * Implementation of HDCP stack for DRM
+ */
+#include <linux/errno.h>
+#include <linux/export.h>
+#include <linux/i2c.h>
+#include <drm/drmP.h>
+#include <drm/drm_connector.h>
+#include <drm/drm_hdcp.h>
+#include <drm/drm_dp_helper.h>
+
+/**
+ * @drm_hdcp_init:
+ *	Initialization of the HDCP stack of the DRM
+ *
+ * Return 0 on success else -ve.
+ */
+int drm_hdcp_init(struct drm_connector *connector,
+				struct drm_hdcp *hdcp,
+				uint8_t spec_supported)
+{
+	struct drm_mode_config *config = &connector->dev->mode_config;
+
+	if (!hdcp)
+		return -EINVAL;
+
+	if (!hdcp->hdcp_funcs) {
+		DRM_ERROR("Callback functions are missing\n");
+		return -EINVAL;
+	}
+
+	if (!spec_supported) {
+		DRM_ERROR("HDCP version support is not mentioned\n");
+		return -EINVAL;
+	}
+
+	/* Check for Essential Service Funcs */
+	if (!hdcp->hdcp_funcs->link_write || !hdcp->hdcp_funcs->link_read)
+		return -EINVAL;
+
+	hdcp->ver_support_on_plat = spec_supported;
+
+	connector->hdcp = hdcp;
+	hdcp->connector = connector;
+
+	drm_object_attach_property(&connector->base,
+				   config->hdcp_property,
+				   0);
+
+	mutex_init(&hdcp->mutex);
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_hdcp_init);
diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h
index 2a48ef9..e8136ef 100644
--- a/include/drm/drm_hdcp.h
+++ b/include/drm/drm_hdcp.h
@@ -37,6 +37,9 @@ struct drm_hdcp;
 #define HDCP_1_4_SUPPORT			(1<<0)
 #define HDCP_2_2_SUPPORT			(1<<1)
 
+#define HDCP_STREAM_TYPE0_CODE			0x00
+#define HDCP_STREAM_TYPE1_CODE			0x01
+
 /**
  * @enum hdcp_status Enumeration of all HDCP Status Codes
  */
@@ -154,4 +157,8 @@ struct drm_hdcp {
 					DRM_HDCP_LINK_INTEGRITY_FAILED | \
 					DRM_HDCP_REAUTH_REQUESTED)
 
+/* Functions exported */
+extern int drm_hdcp_init(struct drm_connector *connector,
+					struct drm_hdcp *hdcp,
+					uint8_t spec_supported);
 #endif	/* __DRM_HDCP_H__ */
-- 
2.7.4



More information about the dri-devel mailing list