1 From b888303c7d23d7bd0c8667cfc657669e5d153fea Mon Sep 17 00:00:00 2001
2 From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
3 Date: Fri, 20 Jan 2023 10:20:34 +0100
4 Subject: [PATCH 02/15] clk: mediatek: cpumux: Propagate struct device where
7 Take a pointer to a struct device in mtk_clk_register_cpumuxes() and
8 propagate the same to mtk_clk_register_cpumux() => clk_hw_register().
9 Even though runtime pm is unlikely to be used with CPU muxes, this
10 helps with code consistency and possibly opens to commonization of
11 some mtk_clk_register_(x) functions.
13 Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
14 Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
15 Reviewed-by: Markus Schneider-Pargmann <msp@baylibre.com>
16 Tested-by: Miles Chen <miles.chen@mediatek.com>
17 Link: https://lore.kernel.org/r/20230120092053.182923-5-angelogioacchino.delregno@collabora.com
18 Tested-by: Mingming Su <mingming.su@mediatek.com>
19 Signed-off-by: Stephen Boyd <sboyd@kernel.org>
21 drivers/clk/mediatek/clk-cpumux.c | 8 ++++----
22 drivers/clk/mediatek/clk-cpumux.h | 2 +-
23 drivers/clk/mediatek/clk-mt2701.c | 2 +-
24 drivers/clk/mediatek/clk-mt6795-infracfg.c | 3 ++-
25 drivers/clk/mediatek/clk-mt7622.c | 4 ++--
26 drivers/clk/mediatek/clk-mt7629.c | 4 ++--
27 drivers/clk/mediatek/clk-mt8173.c | 4 ++--
28 7 files changed, 14 insertions(+), 13 deletions(-)
30 --- a/drivers/clk/mediatek/clk-cpumux.c
31 +++ b/drivers/clk/mediatek/clk-cpumux.c
32 @@ -58,7 +58,7 @@ static const struct clk_ops clk_cpumux_o
35 static struct clk_hw *
36 -mtk_clk_register_cpumux(const struct mtk_composite *mux,
37 +mtk_clk_register_cpumux(struct device *dev, const struct mtk_composite *mux,
38 struct regmap *regmap)
40 struct mtk_clk_cpumux *cpumux;
41 @@ -81,7 +81,7 @@ mtk_clk_register_cpumux(const struct mtk
42 cpumux->regmap = regmap;
43 cpumux->hw.init = &init;
45 - ret = clk_hw_register(NULL, &cpumux->hw);
46 + ret = clk_hw_register(dev, &cpumux->hw);
50 @@ -102,7 +102,7 @@ static void mtk_clk_unregister_cpumux(st
54 -int mtk_clk_register_cpumuxes(struct device_node *node,
55 +int mtk_clk_register_cpumuxes(struct device *dev, struct device_node *node,
56 const struct mtk_composite *clks, int num,
57 struct clk_hw_onecell_data *clk_data)
59 @@ -125,7 +125,7 @@ int mtk_clk_register_cpumuxes(struct dev
63 - hw = mtk_clk_register_cpumux(mux, regmap);
64 + hw = mtk_clk_register_cpumux(dev, mux, regmap);
66 pr_err("Failed to register clk %s: %pe\n", mux->name,
68 --- a/drivers/clk/mediatek/clk-cpumux.h
69 +++ b/drivers/clk/mediatek/clk-cpumux.h
70 @@ -11,7 +11,7 @@ struct clk_hw_onecell_data;
74 -int mtk_clk_register_cpumuxes(struct device_node *node,
75 +int mtk_clk_register_cpumuxes(struct device *dev, struct device_node *node,
76 const struct mtk_composite *clks, int num,
77 struct clk_hw_onecell_data *clk_data);
79 --- a/drivers/clk/mediatek/clk-mt2701.c
80 +++ b/drivers/clk/mediatek/clk-mt2701.c
81 @@ -761,7 +761,7 @@ static void __init mtk_infrasys_init_ear
82 mtk_clk_register_factors(infra_fixed_divs, ARRAY_SIZE(infra_fixed_divs),
85 - mtk_clk_register_cpumuxes(node, cpu_muxes, ARRAY_SIZE(cpu_muxes),
86 + mtk_clk_register_cpumuxes(NULL, node, cpu_muxes, ARRAY_SIZE(cpu_muxes),
89 r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get,
90 --- a/drivers/clk/mediatek/clk-mt6795-infracfg.c
91 +++ b/drivers/clk/mediatek/clk-mt6795-infracfg.c
92 @@ -105,7 +105,8 @@ static int clk_mt6795_infracfg_probe(str
96 - ret = mtk_clk_register_cpumuxes(node, cpu_muxes, ARRAY_SIZE(cpu_muxes), clk_data);
97 + ret = mtk_clk_register_cpumuxes(&pdev->dev, node, cpu_muxes,
98 + ARRAY_SIZE(cpu_muxes), clk_data);
100 goto unregister_gates;
102 --- a/drivers/clk/mediatek/clk-mt7622.c
103 +++ b/drivers/clk/mediatek/clk-mt7622.c
104 @@ -638,8 +638,8 @@ static int mtk_infrasys_init(struct plat
105 mtk_clk_register_gates(&pdev->dev, node, infra_clks,
106 ARRAY_SIZE(infra_clks), clk_data);
108 - mtk_clk_register_cpumuxes(node, infra_muxes, ARRAY_SIZE(infra_muxes),
110 + mtk_clk_register_cpumuxes(&pdev->dev, node, infra_muxes,
111 + ARRAY_SIZE(infra_muxes), clk_data);
113 r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get,
115 --- a/drivers/clk/mediatek/clk-mt7629.c
116 +++ b/drivers/clk/mediatek/clk-mt7629.c
117 @@ -588,8 +588,8 @@ static int mtk_infrasys_init(struct plat
118 mtk_clk_register_gates(&pdev->dev, node, infra_clks,
119 ARRAY_SIZE(infra_clks), clk_data);
121 - mtk_clk_register_cpumuxes(node, infra_muxes, ARRAY_SIZE(infra_muxes),
123 + mtk_clk_register_cpumuxes(&pdev->dev, node, infra_muxes,
124 + ARRAY_SIZE(infra_muxes), clk_data);
126 return of_clk_add_hw_provider(node, of_clk_hw_onecell_get,
128 --- a/drivers/clk/mediatek/clk-mt8173.c
129 +++ b/drivers/clk/mediatek/clk-mt8173.c
130 @@ -892,8 +892,8 @@ static void __init mtk_infrasys_init(str
132 mtk_clk_register_factors(infra_divs, ARRAY_SIZE(infra_divs), clk_data);
134 - mtk_clk_register_cpumuxes(node, cpu_muxes, ARRAY_SIZE(cpu_muxes),
136 + mtk_clk_register_cpumuxes(NULL, node, cpu_muxes,
137 + ARRAY_SIZE(cpu_muxes), clk_data);
139 r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);