diff mbox

[RFC,v1,10/20] drm/hdcp: Handler for connector state change

Message ID 1499848144-8456-11-git-send-email-ramalingam.c@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ramalingam C July 12, 2017, 8:28 a.m. UTC
On hotplug/detection of connector Panel's HDCP capability is probed.
On hot unplug of connector HDCP is diabled, if it has beed enabled.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/drm_hdcp.c | 24 ++++++++++++++++++++++++
 include/drm/drm_hdcp.h     |  9 +++++++++
 2 files changed, 33 insertions(+)
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_hdcp.c b/drivers/gpu/drm/drm_hdcp.c
index ab80370..89c7c5e 100644
--- a/drivers/gpu/drm/drm_hdcp.c
+++ b/drivers/gpu/drm/drm_hdcp.c
@@ -82,6 +82,30 @@  void drm_hdcp_late_init(struct drm_connector *connector)
 }
 
 /**
+ * @drm_hdcp_connector_state_change_handler:
+ *
+ * Handler for the Connector state change.
+ */
+void drm_hdcp_connector_state_change_handler(struct drm_connector *connector)
+{
+	if (!connector->hdcp)
+		return;
+
+	if (connector->status == connector_status_connected) {
+
+		/* Probes the panel capability */
+		drm_hdcp_late_init(connector);
+	} else {
+		drm_hdcp_disable(connector);
+		connector->hdcp->ver_support_on_panel = 0;
+
+		/* Removing support for all versions */
+		connector->hdcp_state &= ~DRM_HDCP_VER_SUPPORT_MASK;
+	}
+}
+EXPORT_SYMBOL(drm_hdcp_connector_state_change_handler);
+
+/**
  * @drm_hdcp_init:
  *	Initialization of the HDCP stack of the DRM
  *
diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h
index e8136ef..89879ff 100644
--- a/include/drm/drm_hdcp.h
+++ b/include/drm/drm_hdcp.h
@@ -157,8 +157,17 @@  struct drm_hdcp {
 					DRM_HDCP_LINK_INTEGRITY_FAILED | \
 					DRM_HDCP_REAUTH_REQUESTED)
 
+#define DRM_HDCP_VER_SUPPORT_SHIFT		12
+#define DRM_HDCP_VER_SUPPORT_MASK		(0xFFULL<< \
+						DRM_HDCP_VER_SUPPORT_SHIFT)
+#define DRM_HDCP_TYPE_SHIFT			4
+#define DRM_HDCP_TYPE_MASK			(0xFFULL<<DRM_HDCP_TYPE_SHIFT)
+
 /* Functions exported */
 extern int drm_hdcp_init(struct drm_connector *connector,
 					struct drm_hdcp *hdcp,
 					uint8_t spec_supported);
+extern void drm_hdcp_connector_state_change_handler(
+				struct drm_connector *connector);
+
 #endif	/* __DRM_HDCP_H__ */