[PATCH] drm/mediatek: dpi: Find next bridge during probe

Chun-Kuang Hu chunkuang.hu at kernel.org
Sun Jan 18 15:38:37 PST 2026


Hi, Chen-yu:

Chen-Yu Tsai <wenst at chromium.org> 於 2026年1月14日週三 上午9:23寫道:
>
> 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 at 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.

Applied to mediatek-drm-fixes [1], thanks.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-fixes

Regards,
Chun-Kuang.

>
> Fixes: 4c932840db1d ("drm/mediatek: Implement OF graphs support for display paths")
> Signed-off-by: Chen-Yu Tsai <wenst at chromium.org>
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 23 +++++++++--------------
>  1 file changed, 9 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 61cab32e213a..53360b5d12ba 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -836,20 +836,6 @@ static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
>                                  enum drm_bridge_attach_flags flags)
>  {
>         struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> -       int ret;
> -
> -       dpi->next_bridge = devm_drm_of_get_bridge(dpi->dev, dpi->dev->of_node, 1, -1);
> -       if (IS_ERR(dpi->next_bridge)) {
> -               ret = PTR_ERR(dpi->next_bridge);
> -               if (ret == -EPROBE_DEFER)
> -                       return ret;
> -
> -               /* Old devicetree has only one endpoint */
> -               dpi->next_bridge = devm_drm_of_get_bridge(dpi->dev, dpi->dev->of_node, 0, 0);
> -               if (IS_ERR(dpi->next_bridge))
> -                       return dev_err_probe(dpi->dev, PTR_ERR(dpi->next_bridge),
> -                                            "Failed to get bridge\n");
> -       }
>
>         return drm_bridge_attach(encoder, dpi->next_bridge,
>                                  &dpi->bridge, flags);
> @@ -1319,6 +1305,15 @@ static int mtk_dpi_probe(struct platform_device *pdev)
>         if (dpi->irq < 0)
>                 return dpi->irq;
>
> +       dpi->next_bridge = devm_drm_of_get_bridge(dpi->dev, dpi->dev->of_node, 1, -1);
> +       if (IS_ERR(dpi->next_bridge) && PTR_ERR(dpi->next_bridge) == -ENODEV) {
> +               /* Old devicetree has only one endpoint */
> +               dpi->next_bridge = devm_drm_of_get_bridge(dpi->dev, dpi->dev->of_node, 0, 0);
> +       }
> +       if (IS_ERR(dpi->next_bridge))
> +               return dev_err_probe(dpi->dev, PTR_ERR(dpi->next_bridge),
> +                                    "Failed to get bridge\n");
> +
>         platform_set_drvdata(pdev, dpi);
>
>         dpi->bridge.of_node = dev->of_node;
> --
> 2.52.0.457.g6b5491de43-goog
>



More information about the linux-arm-kernel mailing list