sound:starfive:spdif:Remove apb0 clock controller
authorXingyu Wu <xingyu.wu@starfivetech.com>
Sat, 30 Jul 2022 10:29:12 +0000 (18:29 +0800)
committerXingyu Wu <xingyu.wu@starfivetech.com>
Mon, 1 Aug 2022 08:24:56 +0000 (16:24 +0800)
apb0 is the parent of spdif-apb clock and it should
not be got and enabled. And audio_root and mclk_inner
is divider clock, they should not be enabled.

Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
arch/riscv/boot/dts/starfive/jh7110.dtsi
sound/soc/starfive/starfive_spdif.c
sound/soc/starfive/starfive_spdif.h

index 4398f04..0e04fe0 100755 (executable)
                        reg = <0x0 0x100a0000 0x0 0x1000>;
                        clocks = <&clkgen JH7110_SPDIF_CLK_APB>,
                                 <&clkgen JH7110_SPDIF_CLK_CORE>,
-                                <&clkgen JH7110_APB0>,
                                 <&clkgen JH7110_AUDIO_ROOT>,
                                 <&clkgen JH7110_MCLK_INNER>;
-                       clock-names = "spdif-apb", "spdif-core", "apb0",
+                       clock-names = "spdif-apb", "spdif-core",
                                      "audroot", "mclk_inner";
                        resets = <&rstgen RSTN_U0_CDNS_SPDIF_APB>;
                        reset-names = "rst_apb";
index 6255c08..cf066cf 100755 (executable)
@@ -215,7 +215,6 @@ static int sf_spdif_clks_get(struct platform_device *pdev,
        static struct clk_bulk_data clks[] = {
                { .id = "spdif-apb" },          /* clock-names in dts file */
                { .id = "spdif-core" },
-               { .id = "apb0" },
                { .id = "audroot" },
                { .id = "mclk_inner"},
        };
@@ -223,9 +222,8 @@ static int sf_spdif_clks_get(struct platform_device *pdev,
 
        spdif->spdif_apb = clks[0].clk;
        spdif->spdif_core = clks[1].clk;
-       spdif->apb0_clk = clks[2].clk;
-       spdif->audio_root = clks[3].clk;
-       spdif->mclk_inner = clks[4].clk;
+       spdif->audio_root = clks[2].clk;
+       spdif->mclk_inner = clks[3].clk;
        return ret;
 }
 
@@ -262,54 +260,29 @@ static int sf_spdif_clk_init(struct platform_device *pdev,
                goto disable_core_clk;
        }
 
-       ret = clk_prepare_enable(spdif->apb0_clk);
-       if (ret) {
-               dev_err(&pdev->dev, "failed to prepare enable apb0_clk\n");
-               goto disable_apb0_clk;
-       }
-
-       ret = clk_prepare_enable(spdif->audio_root);
-       if (ret) {
-               dev_err(&pdev->dev, "failed to prepare enable spdif->audio_root\n");
-               goto disable_audroot_clk;
-       }
-
        ret = clk_set_rate(spdif->audio_root, 204800000);
        if (ret) {
                dev_err(&pdev->dev, "failed to set rate for spdif audroot ret=%d\n", ret);
-               goto disable_audroot_clk;
-       }
-
-       ret = clk_prepare_enable(spdif->mclk_inner);
-       if (ret) {
-               dev_err(&pdev->dev, "failed to prepare enable spdif->mclk_inner\n");
-               goto disable_mclk_clk;
+               goto disable_core_clk;
        }
 
        ret = clk_set_rate(spdif->mclk_inner, 8192000);
        if (ret) {
                dev_err(&pdev->dev, "failed to set rate for spdif mclk_inner ret=%d\n", ret);
-               goto disable_mclk_clk;
+               goto disable_core_clk;
        }
 
        dev_dbg(&pdev->dev, "spdif->spdif_apb = %lu\n", clk_get_rate(spdif->spdif_apb));
        dev_dbg(&pdev->dev, "spdif->spdif_core = %lu\n", clk_get_rate(spdif->spdif_core));
-       dev_dbg(&pdev->dev, "spdif->apb0_clk = %lu\n", clk_get_rate(spdif->apb0_clk));
 
        ret = reset_control_deassert(spdif->rst_apb);
        if (ret) {
                dev_err(&pdev->dev, "failed to deassert apb\n");
-               goto disable_mclk_clk;
+               goto disable_core_clk;
        }
 
        return 0;
 
-disable_mclk_clk:
-       clk_disable_unprepare(spdif->mclk_inner);
-disable_audroot_clk:
-       clk_disable_unprepare(spdif->audio_root);
-disable_apb0_clk:
-       clk_disable_unprepare(spdif->apb0_clk);
 disable_core_clk:
        clk_disable_unprepare(spdif->spdif_core);
 disable_apb_clk:
index 24542f9..9120a17 100755 (executable)
@@ -151,7 +151,6 @@ struct sf_spdif_dev {
        unsigned int rx_ptr;
        struct clk *spdif_apb;
        struct clk *spdif_core;
-       struct clk *apb0_clk;
        struct clk *audio_root;
        struct clk *mclk_inner;
        struct reset_control *rst_apb;