diff mbox series

drm/mediatek: mtk-dpi: register content protect property

Message ID 20221019061936.3599965-1-hsinyi@chromium.org (mailing list archive)
State New, archived
Headers show
Series drm/mediatek: mtk-dpi: register content protect property | expand

Commit Message

Hsin-Yi Wang Oct. 19, 2022, 6:19 a.m. UTC
Register content protect property in drm so that bridge can update
the property from userspace request.

HDCP property needs to be created after the connecter is initialized
and before the connector is registered. Since some bridge may be
attached without connector, register this property in drm driver if
CONFIG_DRM_DISPLAY_HDCP_HELPER is defined.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
---
Context: https://lore.kernel.org/lkml/20221012042030.573466-1-hsinyi@chromium.org/T/
---
 drivers/gpu/drm/mediatek/mtk_dpi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 508a6d994e831..3374ebe82aeb2 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -18,6 +18,7 @@ 
 
 #include <video/videomode.h>
 
+#include <drm/display/drm_hdcp_helper.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_bridge.h>
 #include <drm/drm_bridge_connector.h>
@@ -799,6 +800,15 @@  static int mtk_dpi_bind(struct device *dev, struct device *master, void *data)
 		ret = PTR_ERR(dpi->connector);
 		goto err_cleanup;
 	}
+
+#if defined(CONFIG_DRM_DISPLAY_HDCP_HELPER)
+	ret = drm_connector_attach_content_protection_property(dpi->connector, true);
+	if (ret) {
+		dev_err(dev, "attach content protection: %d\n", ret);
+		return ret;
+	}
+#endif
+
 	drm_connector_attach_encoder(dpi->connector, &dpi->encoder);
 
 	return 0;