Skip to content

Commit 21465e7

Browse files
wensChun-Kuang Hu
authored andcommitted
drm/mediatek: dpi: Find next bridge during probe
Trying to find the next bridge and deferring probe in the bridge attach callback is much too late. At this point the driver has already finished probing and is now running the component bind code path. What's even worse is that in the specific case of the DSI host being the last component to be added as part of the dsi_host_attach callback, the code path that this is in: -> devm_drm_of_get_bridge() mtk_dpi_bridge_attach() drm_bridge_attach() mtk_dpi_bind() ... component_add() mtk_dsi_host_attach() anx7625_attach_dsi() anx7625_link_bridge() - done_probing callback for of_dp_aux_populate_bus() of_dp_aux_populate_bus() anx7625_i2c_probe() _cannot_ return probe defer: anx7625 4-0058: [drm:anx7625_bridge_attach] drm attach mediatek-drm mediatek-drm.15.auto: bound 1401400.dsi (ops mtk_dsi_component_ops) mediatek-drm mediatek-drm.15.auto: error -EPROBE_DEFER: failed to attach bridge /soc/dpi@14015000 to encoder TMDS-37 [drm:mtk_dsi_host_attach] *ERROR* failed to add dsi_host component: -517 anx7625 4-0058: [drm:anx7625_link_bridge] *ERROR* fail to attach dsi to host. panel-simple-dp-aux aux-4-0058: DP AUX done_probing() can't defer panel-simple-dp-aux aux-4-0058: probe with driver panel-simple-dp-aux failed with error -22 anx7625 4-0058: [drm:anx7625_i2c_probe] probe done This results in the whole display driver failing to probe. Perhaps this was an attempt to mirror the structure in the DSI driver; but in the DSI driver the next bridge is retrieved in the DSI attach callback, not the bridge attach callback. Move the code finding the next bridge back to the probe function so that deferred probing works correctly. Also rework the fallback to the old OF graph endpoint numbering scheme so that deferred probing logs in both cases. This issue was found on an MT8183 Jacuzzi device with an extra patch enabling the DPI-based external display pipeline. Also tested on an MT8192 Hayato device with both DSI and DPI display pipelines enabled. Fixes: 4c93284 ("drm/mediatek: Implement OF graphs support for display paths") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: CK Hu <ck.hu@mediatek.com> Link: https://patchwork.kernel.org/project/dri-devel/patch/20260114092243.3914836-1-wenst@chromium.org/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
1 parent 1384cc0 commit 21465e7

1 file changed

Lines changed: 9 additions & 14 deletions

File tree

drivers/gpu/drm/mediatek/mtk_dpi.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -836,20 +836,6 @@ static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
836836
enum drm_bridge_attach_flags flags)
837837
{
838838
struct mtk_dpi *dpi = bridge_to_dpi(bridge);
839-
int ret;
840-
841-
dpi->next_bridge = devm_drm_of_get_bridge(dpi->dev, dpi->dev->of_node, 1, -1);
842-
if (IS_ERR(dpi->next_bridge)) {
843-
ret = PTR_ERR(dpi->next_bridge);
844-
if (ret == -EPROBE_DEFER)
845-
return ret;
846-
847-
/* Old devicetree has only one endpoint */
848-
dpi->next_bridge = devm_drm_of_get_bridge(dpi->dev, dpi->dev->of_node, 0, 0);
849-
if (IS_ERR(dpi->next_bridge))
850-
return dev_err_probe(dpi->dev, PTR_ERR(dpi->next_bridge),
851-
"Failed to get bridge\n");
852-
}
853839

854840
return drm_bridge_attach(encoder, dpi->next_bridge,
855841
&dpi->bridge, flags);
@@ -1319,6 +1305,15 @@ static int mtk_dpi_probe(struct platform_device *pdev)
13191305
if (dpi->irq < 0)
13201306
return dpi->irq;
13211307

1308+
dpi->next_bridge = devm_drm_of_get_bridge(dpi->dev, dpi->dev->of_node, 1, -1);
1309+
if (IS_ERR(dpi->next_bridge) && PTR_ERR(dpi->next_bridge) == -ENODEV) {
1310+
/* Old devicetree has only one endpoint */
1311+
dpi->next_bridge = devm_drm_of_get_bridge(dpi->dev, dpi->dev->of_node, 0, 0);
1312+
}
1313+
if (IS_ERR(dpi->next_bridge))
1314+
return dev_err_probe(dpi->dev, PTR_ERR(dpi->next_bridge),
1315+
"Failed to get bridge\n");
1316+
13221317
platform_set_drvdata(pdev, dpi);
13231318

13241319
dpi->bridge.of_node = dev->of_node;

0 commit comments

Comments
 (0)