drm/tilcdc: Add support for DRM_BRIDGE_ATTACH_NO_CONNECTOR

Convert the driver to use the DRM_BRIDGE_ATTACH_NO_CONNECTOR flag when
attaching bridges. This modernizes the driver by delegating connector
creation to the bridge subsystem through drm_bridge_connector_init()
instead of manually searching for connectors created by the bridge.

The custom tilcdc_encoder_find_connector() function is removed and
replaced with the standard drm_bridge_connector infrastructure, which
simplifies the code and aligns with current DRM bridge best practices.

This change is safe as there are now no in-tree devicetrees that
connect tilcdc to bridges which do not support the
DRM_BRIDGE_ATTACH_NO_CONNECTOR flag.

Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Kory Maincent (TI.com) <kory.maincent@bootlin.com>
Link: https://patch.msgid.link/20260123-feature_tilcdc-v5-25-5a44d2aa3f6f@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
This commit is contained in:
Kory Maincent (TI.com)
2026-01-23 17:12:43 +01:00
committed by Luca Ceresoli
parent c76a8be4fe
commit 400a84e1f7
2 changed files with 18 additions and 21 deletions

View File

@@ -6,6 +6,8 @@ config DRM_TILCDC
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
select DRM_BRIDGE
select DRM_DISPLAY_HELPER
select DRM_BRIDGE_CONNECTOR
select DRM_PANEL_BRIDGE
select VIDEOMODE_HELPERS
select BACKLIGHT_CLASS_DEVICE

View File

@@ -8,45 +8,40 @@
#include <drm/drm_atomic_helper.h>
#include <drm/drm_bridge.h>
#include <drm/drm_bridge_connector.h>
#include <drm/drm_of.h>
#include <drm/drm_simple_kms_helper.h>
#include "tilcdc_drv.h"
#include "tilcdc_encoder.h"
static
struct drm_connector *tilcdc_encoder_find_connector(struct drm_device *ddev,
struct drm_encoder *encoder)
{
struct drm_connector *connector;
list_for_each_entry(connector, &ddev->mode_config.connector_list, head) {
if (drm_connector_has_possible_encoder(connector, encoder))
return connector;
}
drm_err(ddev, "No connector found for %s encoder (id %d)\n",
encoder->name, encoder->base.id);
return NULL;
}
static
int tilcdc_attach_bridge(struct drm_device *ddev, struct drm_bridge *bridge)
{
struct tilcdc_drm_private *priv = ddev_to_tilcdc_priv(ddev);
struct drm_connector *connector;
int ret;
priv->encoder->base.possible_crtcs = BIT(0);
ret = drm_bridge_attach(&priv->encoder->base, bridge, NULL, 0);
ret = drm_bridge_attach(&priv->encoder->base, bridge, NULL,
DRM_BRIDGE_ATTACH_NO_CONNECTOR);
if (ret)
return ret;
priv->connector = tilcdc_encoder_find_connector(ddev, &priv->encoder->base);
if (!priv->connector)
return -ENODEV;
connector = drm_bridge_connector_init(ddev, &priv->encoder->base);
if (IS_ERR(connector)) {
drm_err(ddev, "bridge_connector create failed\n");
return PTR_ERR(connector);
}
ret = drm_connector_attach_encoder(connector, &priv->encoder->base);
if (ret) {
drm_err(ddev, "attaching encoder to connector failed\n");
return ret;
}
priv->connector = connector;
return 0;
}