Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 14014000.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: 4c932840db1d ("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>

authored by

Chen-Yu Tsai and committed by
Chun-Kuang Hu
21465e73 1384cc00

+9 -14
+9 -14
drivers/gpu/drm/mediatek/mtk_dpi.c
··· 836 836 enum drm_bridge_attach_flags flags) 837 837 { 838 838 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 - } 853 839 854 840 return drm_bridge_attach(encoder, dpi->next_bridge, 855 841 &dpi->bridge, flags); ··· 1304 1318 dpi->irq = platform_get_irq(pdev, 0); 1305 1319 if (dpi->irq < 0) 1306 1320 return dpi->irq; 1321 + 1322 + dpi->next_bridge = devm_drm_of_get_bridge(dpi->dev, dpi->dev->of_node, 1, -1); 1323 + if (IS_ERR(dpi->next_bridge) && PTR_ERR(dpi->next_bridge) == -ENODEV) { 1324 + /* Old devicetree has only one endpoint */ 1325 + dpi->next_bridge = devm_drm_of_get_bridge(dpi->dev, dpi->dev->of_node, 0, 0); 1326 + } 1327 + if (IS_ERR(dpi->next_bridge)) 1328 + return dev_err_probe(dpi->dev, PTR_ERR(dpi->next_bridge), 1329 + "Failed to get bridge\n"); 1307 1330 1308 1331 platform_set_drvdata(pdev, dpi); 1309 1332