Commit bb5a45d4 authored by Ramalingam C's avatar Ramalingam C

drm/hdcp: update content protection property with uevent

drm function is defined and exported to update a connector's
content protection property state and to generate a uevent along
with it.

Pekka have completed the Weston DRM-backend review in
https://gitlab.freedesktop.org/wayland/weston/merge_requests/48
and the UAPI for HDCP 2.2 looks good.

The userspace is accepted in Weston.

v2:
  Update only when state is different from old one.
v3:
  KDoc is added [Daniel]
v4:
  KDoc is extended bit more [pekka]
v5:
  Uevent usage is documented at kdoc of "Content Protection" also
  [pekka]
Signed-off-by: default avatarRamalingam C <ramalingam.c@intel.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: default avatarPekka Paalanen <pekka.paalanen@collabora.com>
Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/320963/?series=57232&rev=14
parent 6fe2ce06
...@@ -983,10 +983,19 @@ static const struct drm_prop_enum_list hdmi_colorspaces[] = { ...@@ -983,10 +983,19 @@ static const struct drm_prop_enum_list hdmi_colorspaces[] = {
* - If the state is DESIRED, kernel should attempt to re-authenticate the * - If the state is DESIRED, kernel should attempt to re-authenticate the
* link whenever possible. This includes across disable/enable, dpms, * link whenever possible. This includes across disable/enable, dpms,
* hotplug, downstream device changes, link status failures, etc.. * hotplug, downstream device changes, link status failures, etc..
* - Userspace is responsible for polling the property to determine when * - Kernel sends uevent with the connector id and property id through
* the value transitions from ENABLED to DESIRED. This signifies the link * @drm_hdcp_update_content_protection, upon below kernel triggered
* is no longer protected and userspace should take appropriate action * scenarios:
* (whatever that might be). * DESIRED -> ENABLED (authentication success)
* ENABLED -> DESIRED (termination of authentication)
* - Please note no uevents for userspace triggered property state changes,
* which can't fail such as
* DESIRED/ENABLED -> UNDESIRED
* UNDESIRED -> DESIRED
* - Userspace is responsible for polling the property or listen to uevents
* to determine when the value transitions from ENABLED to DESIRED.
* This signifies the link is no longer protected and userspace should
* take appropriate action (whatever that might be).
* *
* HDCP Content Type: * HDCP Content Type:
* This Enum property is used by the userspace to declare the content type * This Enum property is used by the userspace to declare the content type
......
...@@ -374,6 +374,10 @@ DRM_ENUM_NAME_FN(drm_get_hdcp_content_type_name, ...@@ -374,6 +374,10 @@ DRM_ENUM_NAME_FN(drm_get_hdcp_content_type_name,
* *
* The content protection will be set to &drm_connector_state.content_protection * The content protection will be set to &drm_connector_state.content_protection
* *
* When kernel triggered content protection state change like DESIRED->ENABLED
* and ENABLED->DESIRED, will use drm_hdcp_update_content_protection() to update
* the content protection state of a connector.
*
* Returns: * Returns:
* Zero on success, negative errno on failure. * Zero on success, negative errno on failure.
*/ */
...@@ -414,3 +418,33 @@ int drm_connector_attach_content_protection_property( ...@@ -414,3 +418,33 @@ int drm_connector_attach_content_protection_property(
return 0; return 0;
} }
EXPORT_SYMBOL(drm_connector_attach_content_protection_property); EXPORT_SYMBOL(drm_connector_attach_content_protection_property);
/**
* drm_hdcp_update_content_protection - Updates the content protection state
* of a connector
*
* @connector: drm_connector on which content protection state needs an update
* @val: New state of the content protection property
*
* This function can be used by display drivers, to update the kernel triggered
* content protection state changes of a drm_connector such as DESIRED->ENABLED
* and ENABLED->DESIRED. No uevent for DESIRED->UNDESIRED or ENABLED->UNDESIRED,
* as userspace is triggering such state change and kernel performs it without
* fail.This function update the new state of the property into the connector's
* state and generate an uevent to notify the userspace.
*/
void drm_hdcp_update_content_protection(struct drm_connector *connector,
u64 val)
{
struct drm_device *dev = connector->dev;
struct drm_connector_state *state = connector->state;
WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
if (state->content_protection == val)
return;
state->content_protection = val;
drm_sysfs_connector_status_event(connector,
dev->mode_config.content_protection_property);
}
EXPORT_SYMBOL(drm_hdcp_update_content_protection);
...@@ -292,6 +292,8 @@ bool drm_hdcp_check_ksvs_revoked(struct drm_device *dev, ...@@ -292,6 +292,8 @@ bool drm_hdcp_check_ksvs_revoked(struct drm_device *dev,
u8 *ksvs, u32 ksv_count); u8 *ksvs, u32 ksv_count);
int drm_connector_attach_content_protection_property( int drm_connector_attach_content_protection_property(
struct drm_connector *connector, bool hdcp_content_type); struct drm_connector *connector, bool hdcp_content_type);
void drm_hdcp_update_content_protection(struct drm_connector *connector,
u64 val);
/* Content Type classification for HDCP2.2 vs others */ /* Content Type classification for HDCP2.2 vs others */
#define DRM_MODE_HDCP_CONTENT_TYPE0 0 #define DRM_MODE_HDCP_CONTENT_TYPE0 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment