Re: [PATCH v2 14/46] drm/mediatek: Add support for MuteX trigger-sources parsing

From: CK Hu (胡俊光)

Date: Thu Oct 29 2026 - 02:53:15 EST


On Tue, 2026-07-14 at 13:43 +0200, AngeloGioacchino Del Regno wrote:
> Add support for getting the Mute-X trigger source ID from the
> devicetree of each component requiring one.
>
> In order to retain compatibility with older devicetrees that are
> not specifying one, add a hardcoded table of Mute-X IDs in the
> mtk_drm_legacy code, and inject all of the hardcoded identifiers
> during initialization in mtk_drm_drv if the MediaTek Mute-X node
> does not have #trigger-source-cells as this implies that the
> driver is surely dealing with an old devicetree.
>
> While at it, also migrate the mtk_disp_ovl_adaptor registration
> mechanism to mtk_drm_legacy and change its platform data to get
> a struct mtk_drm_private instead of mmsys_dev: this is done in
> order to get a handle to the MuteX node in OVL_ADAPTOR, which
> purpose is to get the legacy trigger IDs through, again, tables
> in mtk_drm_legacy.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
> ---

[snip]

> @@ -856,7 +851,6 @@ static int mtk_drm_probe(struct platform_device *pdev)
> struct mtk_mmsys_driver_data *mtk_drm_data;
> struct device_node *node;
> struct component_match *match = NULL;
> - struct platform_device *ovl_adaptor;
> int ret;
> int i;
>
> @@ -904,17 +898,6 @@ static int mtk_drm_probe(struct platform_device *pdev)
> if (!private->all_drm_private)
> return -ENOMEM;
>
> - /* Bringup ovl_adaptor */
> - if (mtk_drm_find_mmsys_comp(private, DDP_COMPONENT_DRM_OVL_ADAPTOR)) {
> - ovl_adaptor = platform_device_register_data(dev, "mediatek-disp-ovl-adaptor",
> - PLATFORM_DEVID_AUTO,
> - (void *)private->mmsys_dev,
> - sizeof(*private->mmsys_dev));
> - mtk_ddp_comp_init(&ovl_adaptor->dev, NULL, &private->hlist,
> - DDP_COMPONENT_DRM_OVL_ADAPTOR);
> - component_match_add(dev, &match, compare_dev, &ovl_adaptor->dev);

Bringup ovl_adaptor is different with latest upstream version,
so rebase on latest code.

> - }
> -
> /* Iterate over sibling DISP function blocks */
> for_each_child_of_node(phandle->parent, node) {
> enum mtk_ddp_comp_type comp_type;
> @@ -979,6 +962,17 @@ static int mtk_drm_probe(struct platform_device *pdev)
> goto err_node;
> }
>
> + /* If mtk-mutex is not a trigger source, this is an old devicetree */
> + if (!of_property_present(private->mutex_node, "#trigger-source-cells")) {
> + ret = mtk_drm_legacy_inject_mutex_trig_ids(&private->hlist, private->mutex_node);
> + if (ret)
> + return ret;

goto err_node;

> + }
> +
> + /* Bringup ovl_adaptor */
> + if (mtk_drm_find_mmsys_comp(private, DDP_COMPONENT_DRM_OVL_ADAPTOR))
> + mtk_drm_legacy_ovl_adaptor_probe(dev, private, &match);
> +
> pm_runtime_enable(dev);
>
> platform_set_drvdata(pdev, private);
>

[snip]

> +
> +static const struct of_device_id mtk_drm_legacy_mtk_mutex_match[] = {
> + { .compatible = "mediatek,mt2701-disp-mutex", .data = &mt2701_legacy_mtx_data },
> + { .compatible = "mediatek,mt2712-disp-mutex", .data = &mt2712_legacy_mtx_data },
> + { .compatible = "mediatek,mt6795-disp-mutex", .data = &mt8173_legacy_mtx_data },
> + { .compatible = "mediatek.mt6893-disp-mutex", .data = &mt6893_legacy_mtx_data },

"mediatek,mt6893-disp-mutex"

Regards,
CK

> + { .compatible = "mediatek,mt8167-disp-mutex", .data = &mt8167_legacy_mtx_data },
> + { .compatible = "mediatek,mt8173-disp-mutex", .data = &mt8173_legacy_mtx_data },
> + { .compatible = "mediatek,mt8183-disp-mutex", .data = &mt8183_legacy_mtx_data },
> + { .compatible = "mediatek,mt8186-disp-mutex", .data = &mt8186_legacy_mtx_data },
> + { .compatible = "mediatek,mt8188-disp-mutex", .data = &mt8188_legacy_mtx_data },
> + { .compatible = "mediatek,mt8192-disp-mutex", .data = &mt8192_legacy_mtx_data },
> + { .compatible = "mediatek,mt8195-disp-mutex", .data = &mt8195_legacy_mtx_data },
> + { .compatible = "mediatek,mt8365-disp-mutex", .data = &mt8365_legacy_mtx_data },
> + { /* sentinel */ },
> +};
> +