]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
soc: mediatek: mtk-dvfsrc: Get and Enable DVFSRC clock
authorNicolas Frattaroli <nicolas.frattaroli@collabora.com>
Mon, 24 Nov 2025 11:06:58 +0000 (12:06 +0100)
committerAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Thu, 8 Jan 2026 09:27:49 +0000 (10:27 +0100)
The DVFSRC has a clock on all platforms.

Get and enable it in the probe function, so that Linux's common clock
framework knows we're a user of it.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
drivers/soc/mediatek/mtk-dvfsrc.c

index 3a83fd4baf54f69ab570cdc21e5b2c8473503701..a43d6f9139141fb89369aa46890a79f498ebb09a 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/arm-smccc.h>
 #include <linux/bitfield.h>
+#include <linux/clk.h>
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of.h>
@@ -83,6 +84,7 @@ struct dvfsrc_opp_desc {
 struct dvfsrc_soc_data;
 struct mtk_dvfsrc {
        struct device *dev;
+       struct clk *clk;
        struct platform_device *icc;
        struct platform_device *regulator;
        const struct dvfsrc_soc_data *dvd;
@@ -650,6 +652,11 @@ static int mtk_dvfsrc_probe(struct platform_device *pdev)
        if (IS_ERR(dvfsrc->regs))
                return PTR_ERR(dvfsrc->regs);
 
+       dvfsrc->clk = devm_clk_get_enabled(&pdev->dev, NULL);
+       if (IS_ERR(dvfsrc->clk))
+               return dev_err_probe(&pdev->dev, PTR_ERR(dvfsrc->clk),
+                                    "Couldn't get and enable DVFSRC clock\n");
+
        arm_smccc_smc(MTK_SIP_DVFSRC_VCOREFS_CONTROL, MTK_SIP_DVFSRC_INIT,
                      0, 0, 0, 0, 0, 0, &ares);
        if (ares.a0)