[RFC v1 18/20] drm/hdcp2.2: Late_init: Capability probing on panel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When the platform support HDCP2.2, HDCP2.2 capability is probed
on panel from late_init. If platform and panel support HDCP2.2,
DRM_HDCP2_SUPPORTED bit of HDCP property will be set.

Signed-off-by: Ramalingam C <ramalingam.c@xxxxxxxxx>
---
 drivers/gpu/drm/drm_hdcp.c | 41 ++++++++++++++++++++++++++++++++++++++---
 1 file changed, 38 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_hdcp.c b/drivers/gpu/drm/drm_hdcp.c
index 5441b55..cb20cc9 100644
--- a/drivers/gpu/drm/drm_hdcp.c
+++ b/drivers/gpu/drm/drm_hdcp.c
@@ -162,6 +162,42 @@ int drm_hdcp_set_property(struct drm_connector *connector,
 	return 0;
 }
 
+static void drm_hdcp_2_2_late_init(struct drm_hdcp *hdcp)
+{
+	uint8_t hdcp2version;
+	void *buf;
+	ssize_t receiv, size;
+	unsigned int offset;
+
+	if (hdcp->protocol == WIRED_PROTOCOL_HDMI) {
+		offset = HDMI_HDCP2_REG_VER_OFFSET;
+		buf = (void *)&hdcp2version;
+		size = sizeof(hdcp2version);
+	} else {
+		DRM_ERROR("Unsupported Protocol\n");
+		return;
+	}
+
+	receiv = hdcp->hdcp_funcs->link_read(hdcp, offset, buf, size);
+	if (receiv == size) {
+		mutex_lock(&hdcp->mutex);
+		if (hdcp2version & HDMI_HDCP_2_2_SUPPORT_MASK) {
+			hdcp->ver_support_on_panel |= HDCP_2_2_SUPPORT;
+			hdcp->connector->hdcp_state |= DRM_HDCP2_SUPPORTED;
+
+			DRM_DEBUG("HDMI with HDCP 2.2\n");
+		} else {
+			hdcp->ver_support_on_panel &= ~HDCP_2_2_SUPPORT;
+			hdcp->connector->hdcp_state &= ~DRM_HDCP2_SUPPORTED;
+
+			DRM_DEBUG("HDMI without HDCP 2.2\n");
+		}
+		mutex_unlock(&hdcp->mutex);
+	} else {
+		DRM_ERROR("HDCP Link read failed. Error: %d\n", (int)receiv);
+	}
+}
+
 void drm_hdcp_late_init(struct drm_connector *connector)
 {
 	struct drm_hdcp *hdcp = connector->hdcp;
@@ -169,9 +205,8 @@ void drm_hdcp_late_init(struct drm_connector *connector)
 	if (hdcp->hdcp_funcs->late_init)
 		hdcp->hdcp_funcs->late_init(hdcp);
 
-	/*
-	 * TODO: Invoke the Version specific late_init
-	 */
+	if (hdcp->ver_support_on_plat & HDCP_2_2_SUPPORT)
+		drm_hdcp_2_2_late_init(hdcp);
 }
 
 /**
-- 
2.7.4

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




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux