linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/2] drm_bridge: register content protect property
@ 2022-11-02 11:11 Hsin-Yi Wang
  2022-11-02 11:11 ` [PATCH v3 2/2] drm/bridge: anx7625: " Hsin-Yi Wang
  2022-11-11 17:18 ` [PATCH v3 1/2] drm_bridge: " Sean Paul
  0 siblings, 2 replies; 4+ messages in thread
From: Hsin-Yi Wang @ 2022-11-02 11:11 UTC (permalink / raw)
  To: Douglas Anderson, Sean Paul
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Daniel Vetter, dri-devel, linux-kernel

Some bridges are able to update HDCP status from userspace request if
they support HDCP.

HDCP property is the same as other connector properties that needs to be
created after the connecter is initialized and before the connector is
registered.

If there exists a bridge that supports HDCP, add the property to the
bridge connector.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
---
v2->v3:
Only register the property when there exists any bridge that supports
hdcp.
---
 drivers/gpu/drm/drm_bridge_connector.c | 8 ++++++++
 include/drm/drm_bridge.h               | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c
index 1c7d936523df5..b4fb5da0b963f 100644
--- a/drivers/gpu/drm/drm_bridge_connector.c
+++ b/drivers/gpu/drm/drm_bridge_connector.c
@@ -7,6 +7,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 
+#include <drm/display/drm_hdcp_helper.h>
 #include <drm/drm_atomic_state_helper.h>
 #include <drm/drm_bridge.h>
 #include <drm/drm_bridge_connector.h>
@@ -333,6 +334,7 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
 	struct i2c_adapter *ddc = NULL;
 	struct drm_bridge *bridge, *panel_bridge = NULL;
 	int connector_type;
+	bool support_hdcp = false;
 
 	bridge_connector = kzalloc(sizeof(*bridge_connector), GFP_KERNEL);
 	if (!bridge_connector)
@@ -376,6 +378,9 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
 
 		if (drm_bridge_is_panel(bridge))
 			panel_bridge = bridge;
+
+		if (bridge->support_hdcp)
+			support_hdcp = true;
 	}
 
 	if (connector_type == DRM_MODE_CONNECTOR_Unknown) {
@@ -398,6 +403,9 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
 	if (panel_bridge)
 		drm_panel_bridge_set_orientation(connector, panel_bridge);
 
+	if (support_hdcp && IS_ENABLED(CONFIG_DRM_DISPLAY_HDCP_HELPER))
+		drm_connector_attach_content_protection_property(connector, true);
+
 	return connector;
 }
 EXPORT_SYMBOL_GPL(drm_bridge_connector_init);
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 6b65b0dfb4fb4..1d2ab70f3436a 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -768,6 +768,10 @@ struct drm_bridge {
 	 * modes.
 	 */
 	bool interlace_allowed;
+	/**
+	 * @support_hdcp: Indicate that the bridge supports HDCP.
+	 */
+	bool support_hdcp;
 	/**
 	 * @ddc: Associated I2C adapter for DDC access, if any.
 	 */
-- 
2.38.0.135.g90850a2211-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 2/2] drm/bridge: anx7625: register content protect property
  2022-11-02 11:11 [PATCH v3 1/2] drm_bridge: register content protect property Hsin-Yi Wang
@ 2022-11-02 11:11 ` Hsin-Yi Wang
  2022-11-11 17:18   ` Sean Paul
  2022-11-11 17:18 ` [PATCH v3 1/2] drm_bridge: " Sean Paul
  1 sibling, 1 reply; 4+ messages in thread
From: Hsin-Yi Wang @ 2022-11-02 11:11 UTC (permalink / raw)
  To: Douglas Anderson, Sean Paul
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Daniel Vetter, dri-devel, linux-kernel

Set support_hdcp so the connector can register content protect proterty
when it's initializing.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index b0ff1ecb80a50..0636ac59c7399 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -2680,6 +2680,7 @@ static int anx7625_i2c_probe(struct i2c_client *client,
 	platform->bridge.type = platform->pdata.panel_bridge ?
 				    DRM_MODE_CONNECTOR_eDP :
 				    DRM_MODE_CONNECTOR_DisplayPort;
+	platform->bridge.support_hdcp = true;
 
 	drm_bridge_add(&platform->bridge);
 
-- 
2.38.0.135.g90850a2211-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/2] drm_bridge: register content protect property
  2022-11-02 11:11 [PATCH v3 1/2] drm_bridge: register content protect property Hsin-Yi Wang
  2022-11-02 11:11 ` [PATCH v3 2/2] drm/bridge: anx7625: " Hsin-Yi Wang
@ 2022-11-11 17:18 ` Sean Paul
  1 sibling, 0 replies; 4+ messages in thread
From: Sean Paul @ 2022-11-11 17:18 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Douglas Anderson, Sean Paul, Thomas Zimmermann, linux-kernel, dri-devel

On Wed, Nov 02, 2022 at 07:11:46PM +0800, Hsin-Yi Wang wrote:
> Some bridges are able to update HDCP status from userspace request if
> they support HDCP.
> 
> HDCP property is the same as other connector properties that needs to be
> created after the connecter is initialized and before the connector is
> registered.
> 
> If there exists a bridge that supports HDCP, add the property to the
> bridge connector.
> 

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> ---
> v2->v3:
> Only register the property when there exists any bridge that supports
> hdcp.
> ---
>  drivers/gpu/drm/drm_bridge_connector.c | 8 ++++++++
>  include/drm/drm_bridge.h               | 4 ++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c
> index 1c7d936523df5..b4fb5da0b963f 100644
> --- a/drivers/gpu/drm/drm_bridge_connector.c
> +++ b/drivers/gpu/drm/drm_bridge_connector.c
> @@ -7,6 +7,7 @@
>  #include <linux/module.h>
>  #include <linux/slab.h>
>  
> +#include <drm/display/drm_hdcp_helper.h>
>  #include <drm/drm_atomic_state_helper.h>
>  #include <drm/drm_bridge.h>
>  #include <drm/drm_bridge_connector.h>
> @@ -333,6 +334,7 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
>  	struct i2c_adapter *ddc = NULL;
>  	struct drm_bridge *bridge, *panel_bridge = NULL;
>  	int connector_type;
> +	bool support_hdcp = false;
>  
>  	bridge_connector = kzalloc(sizeof(*bridge_connector), GFP_KERNEL);
>  	if (!bridge_connector)
> @@ -376,6 +378,9 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
>  
>  		if (drm_bridge_is_panel(bridge))
>  			panel_bridge = bridge;
> +
> +		if (bridge->support_hdcp)
> +			support_hdcp = true;
>  	}
>  
>  	if (connector_type == DRM_MODE_CONNECTOR_Unknown) {
> @@ -398,6 +403,9 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
>  	if (panel_bridge)
>  		drm_panel_bridge_set_orientation(connector, panel_bridge);
>  
> +	if (support_hdcp && IS_ENABLED(CONFIG_DRM_DISPLAY_HDCP_HELPER))
> +		drm_connector_attach_content_protection_property(connector, true);
> +
>  	return connector;
>  }
>  EXPORT_SYMBOL_GPL(drm_bridge_connector_init);
> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
> index 6b65b0dfb4fb4..1d2ab70f3436a 100644
> --- a/include/drm/drm_bridge.h
> +++ b/include/drm/drm_bridge.h
> @@ -768,6 +768,10 @@ struct drm_bridge {
>  	 * modes.
>  	 */
>  	bool interlace_allowed;
> +	/**
> +	 * @support_hdcp: Indicate that the bridge supports HDCP.
> +	 */
> +	bool support_hdcp;
>  	/**
>  	 * @ddc: Associated I2C adapter for DDC access, if any.
>  	 */
> -- 
> 2.38.0.135.g90850a2211-goog
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 2/2] drm/bridge: anx7625: register content protect property
  2022-11-02 11:11 ` [PATCH v3 2/2] drm/bridge: anx7625: " Hsin-Yi Wang
@ 2022-11-11 17:18   ` Sean Paul
  0 siblings, 0 replies; 4+ messages in thread
From: Sean Paul @ 2022-11-11 17:18 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Douglas Anderson, Sean Paul, Thomas Zimmermann, linux-kernel, dri-devel

On Wed, Nov 02, 2022 at 07:11:47PM +0800, Hsin-Yi Wang wrote:
> Set support_hdcp so the connector can register content protect proterty
> when it's initializing.
> 

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> ---
>  drivers/gpu/drm/bridge/analogix/anx7625.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
> index b0ff1ecb80a50..0636ac59c7399 100644
> --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> @@ -2680,6 +2680,7 @@ static int anx7625_i2c_probe(struct i2c_client *client,
>  	platform->bridge.type = platform->pdata.panel_bridge ?
>  				    DRM_MODE_CONNECTOR_eDP :
>  				    DRM_MODE_CONNECTOR_DisplayPort;
> +	platform->bridge.support_hdcp = true;
>  
>  	drm_bridge_add(&platform->bridge);
>  
> -- 
> 2.38.0.135.g90850a2211-goog
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-11 17:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-02 11:11 [PATCH v3 1/2] drm_bridge: register content protect property Hsin-Yi Wang
2022-11-02 11:11 ` [PATCH v3 2/2] drm/bridge: anx7625: " Hsin-Yi Wang
2022-11-11 17:18   ` Sean Paul
2022-11-11 17:18 ` [PATCH v3 1/2] drm_bridge: " Sean Paul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).