diff mbox series

[5.10.y-cip,11/25] drm: rcar-du: rzg2l_mipi_dsi: Reorder bridge attach

Message ID 20231207142502.401651-12-biju.das.jz@bp.renesas.com (mailing list archive)
State Accepted
Headers show
Series Add RZ/G2L DSI support | expand

Commit Message

Biju Das Dec. 7, 2023, 2:24 p.m. UTC
Add the drm_bridge_add() in probe and update rzg2l_mipi_dsi_attach()
to find the next bridge and attach the bridge. This allows DU to probe
with all the connected devices on 5.10 cip kernel.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c
index aa95b85a2964..50777ed767a7 100644
--- a/drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c
+++ b/drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c
@@ -527,6 +527,15 @@  static int rzg2l_mipi_dsi_attach(struct drm_bridge *bridge,
 				 enum drm_bridge_attach_flags flags)
 {
 	struct rzg2l_mipi_dsi *dsi = bridge_to_rzg2l_mipi_dsi(bridge);
+	int ret;
+
+	dsi->next_bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node,
+						  1, 0);
+	if (IS_ERR(dsi->next_bridge)) {
+		ret = PTR_ERR(dsi->next_bridge);
+		dev_err(dsi->dev, "failed to get next bridge: %d\n", ret);
+		return ret;
+	}
 
 	return drm_bridge_attach(bridge->encoder, dsi->next_bridge, bridge,
 				 flags);
@@ -607,7 +616,6 @@  static int rzg2l_mipi_dsi_host_attach(struct mipi_dsi_host *host,
 				      struct mipi_dsi_device *device)
 {
 	struct rzg2l_mipi_dsi *dsi = host_to_rzg2l_mipi_dsi(host);
-	int ret;
 
 	if (device->lanes > dsi->num_data_lanes) {
 		dev_err(dsi->dev,
@@ -629,16 +637,6 @@  static int rzg2l_mipi_dsi_host_attach(struct mipi_dsi_host *host,
 	dsi->format = device->format;
 	dsi->mode_flags = device->mode_flags;
 
-	dsi->next_bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node,
-						  1, 0);
-	if (IS_ERR(dsi->next_bridge)) {
-		ret = PTR_ERR(dsi->next_bridge);
-		dev_err(dsi->dev, "failed to get next bridge: %d\n", ret);
-		return ret;
-	}
-
-	drm_bridge_add(&dsi->bridge);
-
 	return 0;
 }
 
@@ -772,6 +770,8 @@  static int rzg2l_mipi_dsi_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto err_pm_disable;
 
+	drm_bridge_add(&dsi->bridge);
+
 	return 0;
 
 err_phy: