drm/hdcp: gathering hdcp related code into drm_hdcp.c
authorRamalingam C <ramalingam.c@intel.com>
Tue, 7 May 2019 16:27:40 +0000 (21:57 +0530)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 9 May 2019 07:44:41 +0000 (09:44 +0200)
Considering the significant size of hdcp related code in drm, all
hdcp related codes are moved into separate file called drm_hdcp.c.

v2:
  Rebased.
v2:
  Rebased.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190507162745.25600-7-ramalingam.c@intel.com
drivers/gpu/drm/drm_connector.c
drivers/gpu/drm/drm_hdcp.c
include/drm/drm_connector.h
include/drm/drm_hdcp.h

index 7c0eda9cca600da35c682809c08fbb6369d8c737..764c7903edf60457260fac68a277c9d2d4565875 100644 (file)
@@ -823,13 +823,6 @@ static const struct drm_prop_enum_list drm_tv_subconnector_enum_list[] = {
 DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name,
                 drm_tv_subconnector_enum_list)
 
 DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name,
                 drm_tv_subconnector_enum_list)
 
-static struct drm_prop_enum_list drm_cp_enum_list[] = {
-       { DRM_MODE_CONTENT_PROTECTION_UNDESIRED, "Undesired" },
-       { DRM_MODE_CONTENT_PROTECTION_DESIRED, "Desired" },
-       { DRM_MODE_CONTENT_PROTECTION_ENABLED, "Enabled" },
-};
-DRM_ENUM_NAME_FN(drm_get_content_protection_name, drm_cp_enum_list)
-
 static const struct drm_prop_enum_list hdmi_colorspaces[] = {
        /* For Default case, driver will set the colorspace */
        { DRM_MODE_COLORIMETRY_DEFAULT, "Default" },
 static const struct drm_prop_enum_list hdmi_colorspaces[] = {
        /* For Default case, driver will set the colorspace */
        { DRM_MODE_COLORIMETRY_DEFAULT, "Default" },
@@ -1515,43 +1508,6 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
 }
 EXPORT_SYMBOL(drm_connector_attach_scaling_mode_property);
 
 }
 EXPORT_SYMBOL(drm_connector_attach_scaling_mode_property);
 
-/**
- * drm_connector_attach_content_protection_property - attach content protection
- * property
- *
- * @connector: connector to attach CP property on.
- *
- * This is used to add support for content protection on select connectors.
- * Content Protection is intentionally vague to allow for different underlying
- * technologies, however it is most implemented by HDCP.
- *
- * The content protection will be set to &drm_connector_state.content_protection
- *
- * Returns:
- * Zero on success, negative errno on failure.
- */
-int drm_connector_attach_content_protection_property(
-               struct drm_connector *connector)
-{
-       struct drm_device *dev = connector->dev;
-       struct drm_property *prop =
-                       dev->mode_config.content_protection_property;
-
-       if (!prop)
-               prop = drm_property_create_enum(dev, 0, "Content Protection",
-                                               drm_cp_enum_list,
-                                               ARRAY_SIZE(drm_cp_enum_list));
-       if (!prop)
-               return -ENOMEM;
-
-       drm_object_attach_property(&connector->base, prop,
-                                  DRM_MODE_CONTENT_PROTECTION_UNDESIRED);
-       dev->mode_config.content_protection_property = prop;
-
-       return 0;
-}
-EXPORT_SYMBOL(drm_connector_attach_content_protection_property);
-
 /**
  * drm_mode_create_aspect_ratio_property - create aspect ratio property
  * @dev: DRM device
 /**
  * drm_mode_create_aspect_ratio_property - create aspect ratio property
  * @dev: DRM device
index 5e5409505c31132c4a1e4818cfb8de6c699fbadb..0da7b3718bad6d9ee4f632e2cf30a87f8ea62f9c 100644 (file)
@@ -17,6 +17,9 @@
 #include <drm/drm_sysfs.h>
 #include <drm/drm_print.h>
 #include <drm/drm_device.h>
 #include <drm/drm_sysfs.h>
 #include <drm/drm_print.h>
 #include <drm/drm_device.h>
+#include <drm/drm_property.h>
+#include <drm/drm_mode_object.h>
+#include <drm/drm_connector.h>
 
 struct hdcp_srm {
        u32 revoked_ksv_cnt;
 
 struct hdcp_srm {
        u32 revoked_ksv_cnt;
@@ -331,3 +334,47 @@ void drm_teardown_hdcp_srm(struct class *drm_class)
                kfree(srm_data);
        }
 }
                kfree(srm_data);
        }
 }
+
+static struct drm_prop_enum_list drm_cp_enum_list[] = {
+       { DRM_MODE_CONTENT_PROTECTION_UNDESIRED, "Undesired" },
+       { DRM_MODE_CONTENT_PROTECTION_DESIRED, "Desired" },
+       { DRM_MODE_CONTENT_PROTECTION_ENABLED, "Enabled" },
+};
+DRM_ENUM_NAME_FN(drm_get_content_protection_name, drm_cp_enum_list)
+
+/**
+ * drm_connector_attach_content_protection_property - attach content protection
+ * property
+ *
+ * @connector: connector to attach CP property on.
+ *
+ * This is used to add support for content protection on select connectors.
+ * Content Protection is intentionally vague to allow for different underlying
+ * technologies, however it is most implemented by HDCP.
+ *
+ * The content protection will be set to &drm_connector_state.content_protection
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_connector_attach_content_protection_property(
+               struct drm_connector *connector)
+{
+       struct drm_device *dev = connector->dev;
+       struct drm_property *prop =
+                       dev->mode_config.content_protection_property;
+
+       if (!prop)
+               prop = drm_property_create_enum(dev, 0, "Content Protection",
+                                               drm_cp_enum_list,
+                                               ARRAY_SIZE(drm_cp_enum_list));
+       if (!prop)
+               return -ENOMEM;
+
+       drm_object_attach_property(&connector->base, prop,
+                                  DRM_MODE_CONTENT_PROTECTION_UNDESIRED);
+       dev->mode_config.content_protection_property = prop;
+
+       return 0;
+}
+EXPORT_SYMBOL(drm_connector_attach_content_protection_property);
index 5e41942e5679d152f1166f46665469805c69e856..da9e1f087fe4e81dc1f36ebe5fdb8e27e04b91fd 100644 (file)
@@ -1339,8 +1339,6 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
                                               u32 scaling_mode_mask);
 int drm_connector_attach_vrr_capable_property(
                struct drm_connector *connector);
                                               u32 scaling_mode_mask);
 int drm_connector_attach_vrr_capable_property(
                struct drm_connector *connector);
-int drm_connector_attach_content_protection_property(
-               struct drm_connector *connector);
 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
 int drm_mode_create_colorspace_property(struct drm_connector *connector);
 int drm_mode_create_content_type_property(struct drm_device *dev);
 int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
 int drm_mode_create_colorspace_property(struct drm_connector *connector);
 int drm_mode_create_content_type_property(struct drm_device *dev);
index 2f0335d0a50fbf5301b64363a8fefb5c8c93d3db..13771a496e2b7d9c0abee98524ca2b4e23a8addf 100644 (file)
@@ -286,7 +286,10 @@ struct hdcp_srm_header {
 } __packed;
 
 struct drm_device;
 } __packed;
 
 struct drm_device;
+struct drm_connector;
 
 bool drm_hdcp_check_ksvs_revoked(struct drm_device *dev,
                                 u8 *ksvs, u32 ksv_count);
 
 bool drm_hdcp_check_ksvs_revoked(struct drm_device *dev,
                                 u8 *ksvs, u32 ksv_count);
+int drm_connector_attach_content_protection_property(
+               struct drm_connector *connector);
 #endif
 #endif