[v5,09/12] drm/hdcp: update content protection property with uevent

Submitted by Ramalingam C on April 18, 2019, 8:58 a.m.

Details

Message ID 20190418085805.5648-10-ramalingam.c@intel.com
State New
Headers show
Series "HDCP2.2 Phase II" ( rev: 7 6 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Ramalingam C April 18, 2019, 8:58 a.m.
drm function is defined and exported to update a connector's
content protection property state and to generate a uevent along
with it.

v2:
  Update only when state is different from old one.

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

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/drm_hdcp.c b/drivers/gpu/drm/drm_hdcp.c
index a0960507e4ff..5640c4e744fe 100644
--- a/drivers/gpu/drm/drm_hdcp.c
+++ b/drivers/gpu/drm/drm_hdcp.c
@@ -415,3 +415,19 @@  int drm_connector_attach_content_protection_property(
 	return 0;
 }
 EXPORT_SYMBOL(drm_connector_attach_content_protection_property);
+
+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);
diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h
index 145c81ba1e09..9457c7ec0d37 100644
--- a/include/drm/drm_hdcp.h
+++ b/include/drm/drm_hdcp.h
@@ -304,4 +304,6 @@  struct drm_connector;
 bool drm_hdcp_ksvs_revocated(struct drm_device *dev, u8 *ksvs, u32 ksv_count);
 int drm_connector_attach_content_protection_property(
 		struct drm_connector *connector, bool hdcp_content_type);
+void drm_hdcp_update_content_protection(struct drm_connector *connector,
+					u64 val);
 #endif

Comments

On Thu, Apr 18, 2019 at 02:28:02PM +0530, Ramalingam C wrote:
> drm function is defined and exported to update a connector's
> content protection property state and to generate a uevent along
> with it.
> 
> v2:
>   Update only when state is different from old one.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  drivers/gpu/drm/drm_hdcp.c | 16 ++++++++++++++++
>  include/drm/drm_hdcp.h     |  2 ++
>  2 files changed, 18 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_hdcp.c b/drivers/gpu/drm/drm_hdcp.c
> index a0960507e4ff..5640c4e744fe 100644
> --- a/drivers/gpu/drm/drm_hdcp.c
> +++ b/drivers/gpu/drm/drm_hdcp.c
> @@ -415,3 +415,19 @@ int drm_connector_attach_content_protection_property(
>  	return 0;
>  }
>  EXPORT_SYMBOL(drm_connector_attach_content_protection_property);
> +

Needs kerneldoc. Plus I think a note in the attach function that sets up
hdcp for a connector that it should be used.

Plus we need an ack from userspace people (weston?) that they're using
this new uapi and are happy with it.

> +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);

With all that addressed has my Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h
> index 145c81ba1e09..9457c7ec0d37 100644
> --- a/include/drm/drm_hdcp.h
> +++ b/include/drm/drm_hdcp.h
> @@ -304,4 +304,6 @@ struct drm_connector;
>  bool drm_hdcp_ksvs_revocated(struct drm_device *dev, u8 *ksvs, u32 ksv_count);
>  int drm_connector_attach_content_protection_property(
>  		struct drm_connector *connector, bool hdcp_content_type);
> +void drm_hdcp_update_content_protection(struct drm_connector *connector,
> +					u64 val);
>  #endif
> -- 
> 2.19.1
>