mirror of
https://github.com/torvalds/linux.git
synced 2024-12-04 18:13:04 +00:00
clk: mediatek: Add divider clocks to mtk_clk_simple_{probe,remove}()
Add support for divider clocks register/unregister in the common mtk_clk_simple_probe() and mtk_clk_simple_remove() functions. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> Tested-by: Miles Chen <miles.chen@mediatek.com> Tested-by: Chen-Yu Tsai <wenst@chromium.org> Link: https://lore.kernel.org/r/20230306140543.1813621-5-angelogioacchino.delregno@collabora.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
parent
65c10c50c9
commit
1fe074b1f1
@ -496,7 +496,7 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev,
|
||||
/* Calculate how many clk_hw_onecell_data entries to allocate */
|
||||
num_clks = mcd->num_clks + mcd->num_composite_clks;
|
||||
num_clks += mcd->num_fixed_clks + mcd->num_factor_clks;
|
||||
num_clks += mcd->num_mux_clks;
|
||||
num_clks += mcd->num_mux_clks + mcd->num_divider_clks;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(num_clks);
|
||||
if (!clk_data)
|
||||
@ -534,11 +534,19 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev,
|
||||
goto unregister_muxes;
|
||||
}
|
||||
|
||||
if (mcd->divider_clks) {
|
||||
r = mtk_clk_register_dividers(mcd->divider_clks,
|
||||
mcd->num_divider_clks,
|
||||
base, mcd->clk_lock, clk_data);
|
||||
if (r)
|
||||
goto unregister_composites;
|
||||
}
|
||||
|
||||
if (mcd->clks) {
|
||||
r = mtk_clk_register_gates(&pdev->dev, node, mcd->clks,
|
||||
mcd->num_clks, clk_data);
|
||||
if (r)
|
||||
goto unregister_composites;
|
||||
goto unregister_dividers;
|
||||
}
|
||||
|
||||
if (mcd->clk_notifier_func) {
|
||||
@ -567,6 +575,10 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev,
|
||||
unregister_clks:
|
||||
if (mcd->clks)
|
||||
mtk_clk_unregister_gates(mcd->clks, mcd->num_clks, clk_data);
|
||||
unregister_dividers:
|
||||
if (mcd->divider_clks)
|
||||
mtk_clk_unregister_dividers(mcd->divider_clks,
|
||||
mcd->num_divider_clks, clk_data);
|
||||
unregister_composites:
|
||||
if (mcd->composite_clks)
|
||||
mtk_clk_unregister_composites(mcd->composite_clks,
|
||||
@ -599,6 +611,9 @@ static int __mtk_clk_simple_remove(struct platform_device *pdev,
|
||||
of_clk_del_provider(node);
|
||||
if (mcd->clks)
|
||||
mtk_clk_unregister_gates(mcd->clks, mcd->num_clks, clk_data);
|
||||
if (mcd->divider_clks)
|
||||
mtk_clk_unregister_dividers(mcd->divider_clks,
|
||||
mcd->num_divider_clks, clk_data);
|
||||
if (mcd->composite_clks)
|
||||
mtk_clk_unregister_composites(mcd->composite_clks,
|
||||
mcd->num_composite_clks, clk_data);
|
||||
|
@ -222,6 +222,8 @@ struct mtk_clk_desc {
|
||||
size_t num_clks;
|
||||
const struct mtk_composite *composite_clks;
|
||||
size_t num_composite_clks;
|
||||
const struct mtk_clk_divider *divider_clks;
|
||||
size_t num_divider_clks;
|
||||
const struct mtk_fixed_clk *fixed_clks;
|
||||
size_t num_fixed_clks;
|
||||
const struct mtk_fixed_factor *factor_clks;
|
||||
|
Loading…
Reference in New Issue
Block a user