clk: mediatek: clk-mtk: Register MFG notifier in mtk_clk_simple_probe()
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Fri, 20 Jan 2023 09:20:48 +0000 (10:20 +0100)
committerStephen Boyd <sboyd@kernel.org>
Tue, 31 Jan 2023 00:45:48 +0000 (16:45 -0800)
In preparation for commonizing topckgen probe on various MediaTek SoCs
clock drivers, add the ability to register the MFG MUX notifier in
mtk_clk_simple_probe() by passing a custom notifier register function
pointer, as this function will be slightly different across different
SoCs.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: Miles Chen <miles.chen@mediatek.com>
Link: https://lore.kernel.org/r/20230120092053.182923-19-angelogioacchino.delregno@collabora.com
Tested-by: Mingming Su <mingming.su@mediatek.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/mediatek/clk-mtk.c
drivers/clk/mediatek/clk-mtk.h

index 281d30d6cb2b0fc8c02468ff293b49557f7fb92c..c90c0a6b501b90d2416894098abccec4062c09f0 100644 (file)
@@ -534,6 +534,14 @@ int mtk_clk_simple_probe(struct platform_device *pdev)
                        goto unregister_composites;
        }
 
+       if (mcd->clk_notifier_func) {
+               struct clk *mfg_mux = clk_data->hws[mcd->mfg_clk_idx]->clk;
+
+               r = mcd->clk_notifier_func(&pdev->dev, mfg_mux);
+               if (r)
+                       goto unregister_clks;
+       }
+
        r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
        if (r)
                goto unregister_clks;
index 1bdaa0acb909233647652db1ec3a4baed221206f..41f4fa3b0c212338e2d0ec7faa4efaa46d728fa8 100644 (file)
@@ -231,6 +231,9 @@ struct mtk_clk_desc {
        const struct mtk_clk_rst_desc *rst_desc;
        spinlock_t *clk_lock;
        bool shared_io;
+
+       int (*clk_notifier_func)(struct device *dev, struct clk *clk);
+       unsigned int mfg_clk_idx;
 };
 
 int mtk_clk_simple_probe(struct platform_device *pdev);