Skip to content

Commit c24110a

Browse files
author
Laurent Pinchart
committed
drm: rcar-du: Use drm_bridge_connector_init() helper
Use the drm_bridge_connector_init() helper to create a drm_connector for each output, instead of relying on the bridge drivers doing so. Attach the bridges with the DRM_BRIDGE_ATTACH_NO_CONNECTOR flag to instruct them not to create a connector. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Jacopo Mondi <[email protected]> Tested-by: Kieran Bingham <[email protected]> # On V3U Reviewed-by: Kieran Bingham <[email protected]>
1 parent d0f44e0 commit c24110a

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

drivers/gpu/drm/rcar-du/rcar_du_encoder.c

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/slab.h>
1212

1313
#include <drm/drm_bridge.h>
14+
#include <drm/drm_bridge_connector.h>
1415
#include <drm/drm_crtc.h>
1516
#include <drm/drm_managed.h>
1617
#include <drm/drm_modeset_helper_vtables.h>
@@ -53,7 +54,9 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
5354
struct device_node *enc_node)
5455
{
5556
struct rcar_du_encoder *renc;
57+
struct drm_connector *connector;
5658
struct drm_bridge *bridge;
59+
int ret;
5760

5861
/*
5962
* Locate the DRM bridge from the DT node. For the DPAD outputs, if the
@@ -103,9 +106,22 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
103106

104107
renc->output = output;
105108

106-
/*
107-
* Attach the bridge to the encoder. The bridge will create the
108-
* connector.
109-
*/
110-
return drm_bridge_attach(&renc->base, bridge, NULL, 0);
109+
/* Attach the bridge to the encoder. */
110+
ret = drm_bridge_attach(&renc->base, bridge, NULL,
111+
DRM_BRIDGE_ATTACH_NO_CONNECTOR);
112+
if (ret) {
113+
dev_err(rcdu->dev, "failed to attach bridge for output %u\n",
114+
output);
115+
return ret;
116+
}
117+
118+
/* Create the connector for the chain of bridges. */
119+
connector = drm_bridge_connector_init(&rcdu->ddev, &renc->base);
120+
if (IS_ERR(connector)) {
121+
dev_err(rcdu->dev,
122+
"failed to created connector for output %u\n", output);
123+
return PTR_ERR(connector);
124+
}
125+
126+
return drm_connector_attach_encoder(connector, &renc->base);
111127
}

0 commit comments

Comments
 (0)