diff options
author | Alex Bee <knaerzche@gmail.com> | 2021-09-13 14:51:08 +0200 |
---|---|---|
committer | Heiko Stuebner <heiko@sntech.de> | 2021-09-21 11:43:29 +0200 |
commit | 2e87bf389e1396b9f1360e1a7cdc27f423f56463 (patch) | |
tree | 06132142be43841ec2f88bc04c5540ab64de2f67 /drivers/gpu/drm/rockchip/rockchip_rgb.c | |
parent | drm/rockchip: handle non-platform devices in rockchip_drm_endpoint_is_subdriver (diff) | |
download | linux-2e87bf389e1396b9f1360e1a7cdc27f423f56463.tar.xz linux-2e87bf389e1396b9f1360e1a7cdc27f423f56463.zip |
drm/rockchip: add DRM_BRIDGE_ATTACH_NO_CONNECTOR flag to drm_bridge_attach
Commit a25b988ff83f ("drm/bridge: Extend bridge API to disable connector creation")
added DRM_BRIDGE_ATTACH_NO_CONNECTOR bridge flag and all bridges handle
this flag in some way since then.
Newly added bridge drivers must no longer contain the connector creation and
will fail probing if this flag isn't set.
In order to be able to connect to those newly added bridges as well,
make use of drm_bridge_connector API and have the connector initialized
by the display controller.
Signed-off-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20210913125108.195704-1-knaerzche@gmail.com
Diffstat (limited to 'drivers/gpu/drm/rockchip/rockchip_rgb.c')
-rw-r--r-- | drivers/gpu/drm/rockchip/rockchip_rgb.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c b/drivers/gpu/drm/rockchip/rockchip_rgb.c index d691d9bef8e7..09be9678f2bd 100644 --- a/drivers/gpu/drm/rockchip/rockchip_rgb.c +++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c @@ -10,6 +10,7 @@ #include <drm/drm_atomic_helper.h> #include <drm/drm_bridge.h> +#include <drm/drm_bridge_connector.h> #include <drm/drm_dp_helper.h> #include <drm/drm_of.h> #include <drm/drm_panel.h> @@ -27,6 +28,7 @@ struct rockchip_rgb { struct drm_device *drm_dev; struct drm_bridge *bridge; struct drm_encoder encoder; + struct drm_connector connector; int output_mode; }; @@ -80,6 +82,7 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev, int ret = 0, child_count = 0; struct drm_panel *panel; struct drm_bridge *bridge; + struct drm_connector *connector; rgb = devm_kzalloc(dev, sizeof(*rgb), GFP_KERNEL); if (!rgb) @@ -142,12 +145,32 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev, rgb->bridge = bridge; - ret = drm_bridge_attach(encoder, rgb->bridge, NULL, 0); + ret = drm_bridge_attach(encoder, rgb->bridge, NULL, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret) goto err_free_encoder; + connector = &rgb->connector; + connector = drm_bridge_connector_init(rgb->drm_dev, encoder); + if (IS_ERR(connector)) { + DRM_DEV_ERROR(drm_dev->dev, + "failed to initialize bridge connector: %pe\n", + connector); + ret = PTR_ERR(connector); + goto err_free_encoder; + } + + ret = drm_connector_attach_encoder(connector, encoder); + if (ret < 0) { + DRM_DEV_ERROR(drm_dev->dev, + "failed to attach encoder: %d\n", ret); + goto err_free_connector; + } + return rgb; +err_free_connector: + drm_connector_cleanup(connector); err_free_encoder: drm_encoder_cleanup(encoder); return ERR_PTR(ret); @@ -157,6 +180,7 @@ EXPORT_SYMBOL_GPL(rockchip_rgb_init); void rockchip_rgb_fini(struct rockchip_rgb *rgb) { drm_panel_bridge_remove(rgb->bridge); + drm_connector_cleanup(&rgb->connector); drm_encoder_cleanup(&rgb->encoder); } EXPORT_SYMBOL_GPL(rockchip_rgb_fini); |