[v7,1/3] drm_bridge: register content protect property
Commit Message
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>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
---
v6->v7: remove reported by bot tag
---
drivers/gpu/drm/drm_bridge_connector.c | 9 +++++++++
include/drm/drm_bridge.h | 4 ++++
2 files changed, 13 insertions(+)
@@ -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,10 @@ 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_REACHABLE(CONFIG_DRM_DISPLAY_HELPER) &&
+ IS_ENABLED(CONFIG_DRM_DISPLAY_HDCP_HELPER))
+ drm_connector_attach_content_protection_property(connector, true);
+
return connector;
}
EXPORT_SYMBOL_GPL(drm_bridge_connector_init);
@@ -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.
*/