FROMLIST: drm: Add Content Protection properties to drm
Add new standard connector properties to track whether content protection (ex: hdcp) is desired by userspace. There are two properties involved, "Content Protection" and "Content Protection KSV". The "Content Protection" property allows userspace to request protection on a connector. Set "Desired" to enable, "Undesired" to disable. The "Content Protection KSV" property reflects the current state of protection. If the KSV is 0, the connection is not protected. Once the driver has enabled protection, it will update the the value with the KSV (or similarly unique identifier, if not using HDCP) of the first-hop device (sink or repeater). Signed-off-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Yakir Yang <ykk@rock-chips.com> (am from https://patchwork.kernel.org/patch/5439871/) BUG=chrome-os-partner:34741 TEST=Tested on veyron_pinky, ensured the sysfs file showed up, and reflected the correct setting. Change-Id: I4ba8d11a93b4aa3cd5226500589f31eb2a307656 Reviewed-on: https://chromium-review.googlesource.com/266854 Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Commit-Queue: Yakir Yang <ykk@rock-chips.com> Tested-by: Yakir Yang <ykk@rock-chips.com>
This commit is contained in:
committed by
ChromeOS Commit Bot
parent
4ab1ae08c8
commit
919d44d7a9
@@ -180,6 +180,13 @@ static const struct drm_prop_enum_list drm_plane_type_enum_list[] =
|
||||
{ DRM_PLANE_TYPE_CURSOR, "Cursor" },
|
||||
};
|
||||
|
||||
static struct drm_prop_enum_list drm_cp_enum_list[] = {
|
||||
{ DRM_MODE_CONTENT_PROTECTION_UNDESIRED, "Undesired" },
|
||||
{ DRM_MODE_CONTENT_PROTECTION_DESIRED, "Desired" },
|
||||
};
|
||||
|
||||
DRM_ENUM_NAME_FN(drm_get_content_protection_name, drm_cp_enum_list)
|
||||
|
||||
/*
|
||||
* Optional properties
|
||||
*/
|
||||
@@ -1828,6 +1835,16 @@ static int drm_mode_create_standard_connector_properties(struct drm_device *dev)
|
||||
return -ENOMEM;
|
||||
dev->mode_config.prop_mode = prop;
|
||||
|
||||
prop = drm_property_create_enum(dev, 0,
|
||||
"Content Protection", drm_cp_enum_list,
|
||||
ARRAY_SIZE(drm_cp_enum_list));
|
||||
dev->mode_config.content_protection_property = prop;
|
||||
|
||||
prop = drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE,
|
||||
"Content Protection KSV", 0,
|
||||
0xFFFFFFFFFF);
|
||||
dev->mode_config.content_protection_ksv_property = prop;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -213,6 +213,48 @@ static ssize_t enabled_show(struct device *device,
|
||||
"disabled");
|
||||
}
|
||||
|
||||
static ssize_t content_protection_show(struct device *device,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct drm_connector *connector = to_drm_connector(device);
|
||||
struct drm_device *dev = connector->dev;
|
||||
struct drm_property *prop;
|
||||
uint64_t cp;
|
||||
int ret;
|
||||
|
||||
prop = dev->mode_config.content_protection_property;
|
||||
if (!prop)
|
||||
return 0;
|
||||
|
||||
ret = drm_object_property_get_value(&connector->base, prop, &cp);
|
||||
if (ret)
|
||||
return 0;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%s\n",
|
||||
drm_get_content_protection_name((int)cp));
|
||||
}
|
||||
|
||||
static ssize_t content_protection_ksv_show(struct device *device,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct drm_connector *connector = to_drm_connector(device);
|
||||
struct drm_device *dev = connector->dev;
|
||||
struct drm_property *prop;
|
||||
uint64_t ksv;
|
||||
int ret;
|
||||
|
||||
prop = dev->mode_config.content_protection_ksv_property;
|
||||
if (!prop)
|
||||
return 0;
|
||||
|
||||
ret = drm_object_property_get_value(&connector->base, prop, &ksv);
|
||||
if (ret)
|
||||
return 0;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%llx\n", ksv);
|
||||
}
|
||||
|
||||
static ssize_t edid_show(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr, char *buf, loff_t off,
|
||||
size_t count)
|
||||
@@ -343,6 +385,8 @@ static struct device_attribute connector_attrs[] = {
|
||||
__ATTR_RO(enabled),
|
||||
__ATTR_RO(dpms),
|
||||
__ATTR_RO(modes),
|
||||
__ATTR_RO(content_protection),
|
||||
__ATTR_RO(content_protection_ksv),
|
||||
};
|
||||
|
||||
/* These attributes are for both DVI-I connectors and all types of tv-out. */
|
||||
|
||||
@@ -930,6 +930,8 @@ struct drm_mode_config {
|
||||
struct drm_property *dpms_property;
|
||||
struct drm_property *path_property;
|
||||
struct drm_property *plane_type_property;
|
||||
struct drm_property *content_protection_property;
|
||||
struct drm_property *content_protection_ksv_property;
|
||||
|
||||
/* DVI-I properties */
|
||||
struct drm_property *dvi_i_subconnector_property;
|
||||
@@ -1093,6 +1095,7 @@ extern const char *drm_get_connector_name(const struct drm_connector *connector)
|
||||
extern const char *drm_get_connector_status_name(enum drm_connector_status status);
|
||||
extern const char *drm_get_subpixel_order_name(enum subpixel_order order);
|
||||
extern const char *drm_get_dpms_name(int val);
|
||||
extern const char *drm_get_content_protection_name(int val);
|
||||
extern const char *drm_get_dvi_i_subconnector_name(int val);
|
||||
extern const char *drm_get_dvi_i_select_name(int val);
|
||||
extern const char *drm_get_tv_subconnector_name(int val);
|
||||
|
||||
@@ -81,6 +81,10 @@
|
||||
#define DRM_MODE_DPMS_SUSPEND 2
|
||||
#define DRM_MODE_DPMS_OFF 3
|
||||
|
||||
/* Content Protection Flags */
|
||||
#define DRM_MODE_CONTENT_PROTECTION_UNDESIRED 0
|
||||
#define DRM_MODE_CONTENT_PROTECTION_DESIRED 1
|
||||
|
||||
/* Scaling mode options */
|
||||
#define DRM_MODE_SCALE_NONE 0 /* Unmodified timing (display or
|
||||
software can still scale) */
|
||||
|
||||
Reference in New Issue
Block a user