> Replace the per-ops enable and disable callbacks with one
> mtk_clk_enable() and mtk_clk_disable() that handle a PLL, a mux or a
> gate according to the clock ID, and do nothing for the other types.
>
> The PLL sequences move into mtk_pll_enable() and mtk_pll_disable(),
> and the mux helpers lose their own type check since the callers now
> make it. The checks follow the order of the tables in struct
> mtk_clk_tree. The order does not matter, as the ID ranges of a tree do
> not overlap, including the apmixedsys trees that define gates next to
> their PLLs. Fixed clocks and fixed factors cannot be switched, which is
> what the removed mtk_dummy_enable() and the mux fallback already
> reported.
>
> No functional change.
>
> Signed-off-by: David Lechner <[email protected]>
>
> diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c
> index d93c19c74db..ac173dc48cd 100644
> --- a/drivers/clk/mediatek/clk-mtk.c
> +++ b/drivers/clk/mediatek/clk-mtk.c
> [ ... 100 lines skipped ... ]
> @@ -830,18 +785,40 @@ static int mtk_clk_mux_disable(struct clk *clk)
>       return 0;
>  }
>
> -static int mtk_topckgen_disable(struct clk *clk)
> +static int mtk_clk_enable(struct clk *clk)
>  {
>       struct mtk_clk_priv *priv = dev_get_priv(clk->dev);
>       const struct mtk_clk_tree *tree = priv->tree;
>
> -     if (mtk_clk_id_is_gate(tree, clk->id)) {
> -             const struct mtk_gate *gate = &tree->gates[clk->id - 
> tree->gates_offs];
> +     if (mtk_clk_id_is_pll(tree, clk->id))
> +             return mtk_pll_enable(priv, &tree->plls[clk->id]);
>
> -             return mtk_gate_disable(priv->base, gate);
> -     }
> +     if (mtk_clk_id_is_mux(tree, clk->id))
> +             return mtk_clk_mux_enable(clk);


Nit: for consistency with mtk_pll_enable() and mtk_gate_enable() we
could convert mtk_clk_mux_enable() to take (priv, mux)

-- 
Julien Stephan <[email protected]>

Reply via email to