[PATCH v4 06/19] soc: mediatek: Add runtime PM and top clocks and async controls for MMSYS
CK Hu (胡俊光)
ck.hu at mediatek.com
Mon Sep 15 19:01:55 PDT 2025
On Thu, 2025-08-28 at 16:07 +0800, Paul Chen wrote:
> From: Nancy Lin <nancy.lin at mediatek.com>
>
> - Add initialization of top clocks and async clocks for each MMSYS.
> - Add PM runtime control and new functions to manage these clocks.
> - Add functions to set these clocks according to the default
> configuration of the corresponding MMSYS.
>
> Signed-off-by: Nancy Lin <nancy.lin at mediatek.com>
> Signed-off-by: Paul-pl Chen <paul-pl.chen at mediatek.com>
> ---
[snip]
> void mtk_mmsys_ddp_connect(struct device *dev,
> enum mtk_ddp_comp_id cur,
> enum mtk_ddp_comp_id next)
> @@ -390,7 +491,7 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
> struct platform_device *clks;
> struct platform_device *drm;
> struct mtk_mmsys *mmsys;
> - int ret;
> + int ret, i;
>
> mmsys = devm_kzalloc(dev, sizeof(*mmsys), GFP_KERNEL);
> if (!mmsys)
> @@ -432,6 +533,49 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
> return PTR_ERR(clks);
> mmsys->clks_pdev = clks;
>
> + if (mmsys->data->num_top_clk) {
> + struct device_node *node;
> +
> + node = of_get_child_by_name(dev->of_node, "top");
You should define this in binding document.
> + if (!node) {
> + dev_err(&pdev->dev, "Couldn't find top node\n");
> + return -EINVAL;
> + }
> +
> + mmsys->top_clk = devm_kmalloc_array(dev, mmsys->data->num_top_clk,
> + sizeof(*mmsys->top_clk), GFP_KERNEL);
> + if (!mmsys->top_clk)
> + return -ENOMEM;
> +
> + for (i = 0; i < mmsys->data->num_top_clk; i++) {
> + mmsys->top_clk[i] = of_clk_get(node, i);
> + if (IS_ERR(mmsys->top_clk[i]))
> + return PTR_ERR(mmsys->top_clk[i]);
> + }
> + }
> +
> + if (mmsys->data->num_async_info) {
> + struct device_node *node;
> +
> + node = of_get_child_by_name(dev->of_node, "async");
You should define this in binding document.
Regards,
CK
> + if (!node) {
> + dev_err(&pdev->dev, "Couldn't find async node\n");
> + return -EINVAL;
> + }
> +
> + mmsys->async_clk = devm_kmalloc_array(dev, mmsys->data->num_async_info,
> + sizeof(*mmsys->async_clk), GFP_KERNEL);
> + if (!mmsys->async_clk)
> + return -ENOMEM;
> + mmsys->num_async_clk = mmsys->data->num_async_info;
> +
> + for (i = 0; i < mmsys->num_async_clk; i++) {
> + mmsys->async_clk[i] = of_clk_get(node, i);
> + if (IS_ERR(mmsys->async_clk[i]))
> + return PTR_ERR(mmsys->async_clk[i]);
> + }
> + }
> +
> if (mmsys->data->is_vppsys)
> goto out_probe_done;
>
> @@ -443,6 +587,9 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
> }
> mmsys->drm_pdev = drm;
>
> + if (of_property_present(dev->of_node, "power-domains"))
> + pm_runtime_enable(dev);
> +
> out_probe_done:
> return 0;
> }
>
More information about the Linux-mediatek
mailing list