[v2,16/23] clk: mediatek: mt8186: Join top_adj_div and top_muxes
Commit Message
Like done for MT8192, join the two to register them in one shot, as
there's no point in doing that separately from one another.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/clk/mediatek/clk-mt8186-topckgen.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
Comments
On Fri, Dec 23, 2022 at 5:43 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Like done for MT8192, join the two to register them in one shot, as
> there's no point in doing that separately from one another.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
> drivers/clk/mediatek/clk-mt8186-topckgen.c | 15 ++-------------
> 1 file changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/clk/mediatek/clk-mt8186-topckgen.c b/drivers/clk/mediatek/clk-mt8186-topckgen.c
> index d05143891b69..63befb1f492d 100644
> --- a/drivers/clk/mediatek/clk-mt8186-topckgen.c
> +++ b/drivers/clk/mediatek/clk-mt8186-topckgen.c
> @@ -669,9 +669,6 @@ static struct mtk_composite top_muxes[] = {
> MUX(CLK_TOP_APLL_I2S4_MCK_SEL, "apll_i2s4_mck_sel", apll_mck_parents, 0x0320, 19, 1),
> MUX(CLK_TOP_APLL_TDMOUT_MCK_SEL, "apll_tdmout_mck_sel", apll_mck_parents,
> 0x0320, 20, 1),
> -};
> -
> -static const struct mtk_composite top_adj_divs[] = {
> DIV_GATE(CLK_TOP_APLL12_CK_DIV0, "apll12_div0", "apll_i2s0_mck_sel",
> 0x0320, 0, 0x0328, 8, 0),
> DIV_GATE(CLK_TOP_APLL12_CK_DIV1, "apll12_div1", "apll_i2s1_mck_sel",
> @@ -747,26 +744,19 @@ static int clk_mt8186_topck_probe(struct platform_device *pdev)
> if (r)
> goto unregister_muxes;
>
> - r = mtk_clk_register_composites(top_adj_divs, ARRAY_SIZE(top_adj_divs), base,
> - &mt8186_clk_lock, clk_data, &pdev->dev);
> - if (r)
> - goto unregister_composite_muxes;
> -
> r = clk_mt8186_reg_mfg_mux_notifier(&pdev->dev,
> clk_data->hws[CLK_TOP_MFG]->clk);
> if (r)
> - goto unregister_composite_divs;
> + goto unregister_composite_muxes;
>
> r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
> if (r)
> - goto unregister_composite_divs;
> + goto unregister_composite_muxes;
>
> platform_set_drvdata(pdev, clk_data);
>
> return r;
>
> -unregister_composite_divs:
> - mtk_clk_unregister_composites(top_adj_divs, ARRAY_SIZE(top_adj_divs), clk_data);
> unregister_composite_muxes:
> mtk_clk_unregister_composites(top_muxes, ARRAY_SIZE(top_muxes), clk_data);
> unregister_muxes:
> @@ -787,7 +777,6 @@ static int clk_mt8186_topck_remove(struct platform_device *pdev)
>
> of_clk_del_provider(node);
> mtk_clk_unregister_composites(top_adj_divs, ARRAY_SIZE(top_adj_divs), clk_data);
> - mtk_clk_unregister_composites(top_muxes, ARRAY_SIZE(top_muxes), clk_data);
Wrong line? Not sure how this would've compiled.
> mtk_clk_unregister_muxes(top_mtk_muxes, ARRAY_SIZE(top_mtk_muxes), clk_data);
> mtk_clk_unregister_factors(top_divs, ARRAY_SIZE(top_divs), clk_data);
> mtk_clk_unregister_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), clk_data);
> --
> 2.39.0
>
@@ -669,9 +669,6 @@ static struct mtk_composite top_muxes[] = {
MUX(CLK_TOP_APLL_I2S4_MCK_SEL, "apll_i2s4_mck_sel", apll_mck_parents, 0x0320, 19, 1),
MUX(CLK_TOP_APLL_TDMOUT_MCK_SEL, "apll_tdmout_mck_sel", apll_mck_parents,
0x0320, 20, 1),
-};
-
-static const struct mtk_composite top_adj_divs[] = {
DIV_GATE(CLK_TOP_APLL12_CK_DIV0, "apll12_div0", "apll_i2s0_mck_sel",
0x0320, 0, 0x0328, 8, 0),
DIV_GATE(CLK_TOP_APLL12_CK_DIV1, "apll12_div1", "apll_i2s1_mck_sel",
@@ -747,26 +744,19 @@ static int clk_mt8186_topck_probe(struct platform_device *pdev)
if (r)
goto unregister_muxes;
- r = mtk_clk_register_composites(top_adj_divs, ARRAY_SIZE(top_adj_divs), base,
- &mt8186_clk_lock, clk_data, &pdev->dev);
- if (r)
- goto unregister_composite_muxes;
-
r = clk_mt8186_reg_mfg_mux_notifier(&pdev->dev,
clk_data->hws[CLK_TOP_MFG]->clk);
if (r)
- goto unregister_composite_divs;
+ goto unregister_composite_muxes;
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r)
- goto unregister_composite_divs;
+ goto unregister_composite_muxes;
platform_set_drvdata(pdev, clk_data);
return r;
-unregister_composite_divs:
- mtk_clk_unregister_composites(top_adj_divs, ARRAY_SIZE(top_adj_divs), clk_data);
unregister_composite_muxes:
mtk_clk_unregister_composites(top_muxes, ARRAY_SIZE(top_muxes), clk_data);
unregister_muxes:
@@ -787,7 +777,6 @@ static int clk_mt8186_topck_remove(struct platform_device *pdev)
of_clk_del_provider(node);
mtk_clk_unregister_composites(top_adj_divs, ARRAY_SIZE(top_adj_divs), clk_data);
- mtk_clk_unregister_composites(top_muxes, ARRAY_SIZE(top_muxes), clk_data);
mtk_clk_unregister_muxes(top_mtk_muxes, ARRAY_SIZE(top_mtk_muxes), clk_data);
mtk_clk_unregister_factors(top_divs, ARRAY_SIZE(top_divs), clk_data);
mtk_clk_unregister_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), clk_data);