[RFC v4] drm/hdcp: drm enum property for CP State

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

 



Default connector property called "Content Protection" is added to
represent the content protection state of a connector and to
configure the same.

Userspace can request for enable or disable of content protection
on a connector. Set "DESIRED" for Enable and "UNDESIRED" for disable.

Content protection states defined:
	DRM_MODE_CONTENT_PROTECTION_UNSUPPORTED 	- Unsupported
	DRM_MODE_CONTENT_PROTECTION_UNDESIRED		- Undesired
	DRM_MODE_CONTENT_PROTECTION_DESIRED		- Desired
	DRM_MODE_CONTENT_PROTECTION_ENABLED		- Enabled

v2: Redesigned the property to match with CP needs of CrOS [Sean].
v3: Renamed the state names. Header is removed [Sean].
v4: Aligned with existing userspace(CrOS's usage) [Sean].

Signed-off-by: Ramalingam C <ramalingam.c@xxxxxxxxx>
---
 drivers/gpu/drm/drm_connector.c | 24 ++++++++++++++++++++++++
 include/drm/drm_mode_config.h   |  5 +++++
 include/uapi/drm/drm_mode.h     |  7 +++++++
 3 files changed, 36 insertions(+)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 8072e6e4c62c..f4ce0af63ad3 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -617,6 +617,14 @@ static const struct drm_prop_enum_list drm_link_status_enum_list[] = {
 };
 DRM_ENUM_NAME_FN(drm_get_link_status_name, drm_link_status_enum_list)
 
+static const struct drm_prop_enum_list drm_cp_enum_list[] = {
+	{ DRM_MODE_CONTENT_PROTECTION_UNSUPPORTED,	"Unsupported" },
+	{ DRM_MODE_CONTENT_PROTECTION_UNDESIRED,	"Undesired" },
+	{ DRM_MODE_CONTENT_PROTECTION_DESIRED,		"Desired" },
+	{ DRM_MODE_CONTENT_PROTECTION_ENABLED,		"Enabled" },
+};
+DRM_ENUM_NAME_FN(drm_get_cp_status_name, drm_cp_enum_list)
+
 /**
  * drm_display_info_set_bus_formats - set the supported bus formats
  * @info: display info to store bus formats in
@@ -741,6 +749,15 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name,
  *      value of link-status is "GOOD". If something fails during or after modeset,
  *      the kernel driver may set this to "BAD" and issue a hotplug uevent. Drivers
  *      should update this value using drm_mode_connector_set_link_status_property().
+ * Content Protection:
+ *      Connector Content Protection property to indicate the content protection
+ *      status of a connector. Default value is "UNDESIRED". Kernel will set
+ *      to "UNSUPPORTED" if there is no common HDCP ver supported between Src
+ *      and Sink. User space could set this to "DESIRED" to enabled the content
+ *      protection on the connector. If content protection setup process is
+ *      success, kernel will set this property to "ENABLED". To Disable the
+ *      content protection on the connector userspace could set this property to
+ *      "UNDESIRED".
  *
  * Connectors also have one standardized atomic property:
  *
@@ -789,6 +806,13 @@ int drm_connector_create_standard_properties(struct drm_device *dev)
 		return -ENOMEM;
 	dev->mode_config.link_status_property = prop;
 
+	prop = drm_property_create_enum(dev, 0, "Content Protection",
+					drm_cp_enum_list,
+					ARRAY_SIZE(drm_cp_enum_list));
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.cp_property = prop;
+
 	return 0;
 }
 
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 42981711189b..72e2b4e6d51d 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -538,6 +538,11 @@ struct drm_mode_config {
 	 */
 	struct drm_property *link_status_property;
 	/**
+	 * @cp_property: Default connector property for content protection
+	 * status of a connector
+	 */
+	struct drm_property *cp_property;
+	/**
 	 * @plane_type_property: Default plane property to differentiate
 	 * CURSOR, PRIMARY and OVERLAY legacy uses of planes.
 	 */
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 403339f98a92..61685a64cd6a 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -173,6 +173,13 @@ extern "C" {
 		DRM_MODE_REFLECT_X | \
 		DRM_MODE_REFLECT_Y)
 
+/* Content Protection options */
+enum cp_state {
+	DRM_MODE_CONTENT_PROTECTION_UNSUPPORTED = -1,
+	DRM_MODE_CONTENT_PROTECTION_UNDESIRED,
+	DRM_MODE_CONTENT_PROTECTION_DESIRED,
+	DRM_MODE_CONTENT_PROTECTION_ENABLED,
+};
 
 struct drm_mode_modeinfo {
 	__u32 clock;
-- 
2.7.4

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux