| From cbf82b50df0240cbc72f49c6617cbd4607be2a1d Mon Sep 17 00:00:00 2001 |
| From: Hsin-Yi Wang <hsinyi@chromium.org> |
| Date: Thu, 17 Nov 2022 19:08:02 +0800 |
| Subject: [PATCH] FROMLIST: drm_bridge: register content protect property |
| |
| 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> |
| Reported-by: kernel test robot <lkp@intel.com> |
| |
| (am from https://patchwork.kernel.org/project/dri-devel/patch/20221117110804.1431024-1-hsinyi@chromium.org/) |
| |
| BUG=b:245718396 |
| TEST=manually test on steelix with netflix app |
| UPSTREAM-TASK=b:259350723 |
| |
| Change-Id: I0d790797f003c04ccdbd8700588b3268ebc0355b |
| Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4027392 |
| Tested-by: Hsin-Yi Wang <hsinyi@chromium.org> |
| Reviewed-by: Pin-yen Lin <treapking@chromium.org> |
| Auto-Submit: Hsin-Yi Wang <hsinyi@chromium.org> |
| Reviewed-by: Sean Paul <sean@poorly.run> |
| Commit-Queue: Pin-yen Lin <treapking@chromium.org> |
| --- |
| drivers/gpu/drm/drm_bridge_connector.c | 9 +++++++++ |
| include/drm/drm_bridge.h | 4 ++++ |
| 2 files changed, 13 insertions(+) |
| |
| diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c |
| index 19ae4a177ac386b255a7b182a0cffcb921066e53..d63ffd295960ba90c8e5e1903a78db190c137697 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> |
| @@ -318,6 +319,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) |
| @@ -361,6 +363,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) { |
| @@ -381,6 +386,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); |
| diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h |
| index 42f86327b40a790f71d5d9d92369ce9f053867df..4f44ef0375a9037fc0d0052761e31b205cb213f3 100644 |
| --- a/include/drm/drm_bridge.h |
| +++ b/include/drm/drm_bridge.h |
| @@ -752,6 +752,10 @@ struct drm_bridge { |
| * before the peripheral. |
| */ |
| bool pre_enable_prev_first; |
| + /** |
| + * @support_hdcp: Indicate that the bridge supports HDCP. |
| + */ |
| + bool support_hdcp; |
| /** |
| * @ddc: Associated I2C adapter for DDC access, if any. |
| */ |
| -- |
| 2.38.3 |
| |