2333e722e19efdc2142c64ceac1a04a04696179d
[openwrt/staging/linusw.git] /
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
5 possible
6
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.
12
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>
20 ---
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(-)
29
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
33 };
34
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)
39 {
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;
44
45 - ret = clk_hw_register(NULL, &cpumux->hw);
46 + ret = clk_hw_register(dev, &cpumux->hw);
47 if (ret) {
48 kfree(cpumux);
49 return ERR_PTR(ret);
50 @@ -102,7 +102,7 @@ static void mtk_clk_unregister_cpumux(st
51 kfree(cpumux);
52 }
53
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)
58 {
59 @@ -125,7 +125,7 @@ int mtk_clk_register_cpumuxes(struct dev
60 continue;
61 }
62
63 - hw = mtk_clk_register_cpumux(mux, regmap);
64 + hw = mtk_clk_register_cpumux(dev, mux, regmap);
65 if (IS_ERR(hw)) {
66 pr_err("Failed to register clk %s: %pe\n", mux->name,
67 hw);
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;
71 struct device_node;
72 struct mtk_composite;
73
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);
78
79 --- a/drivers/clk/mediatek/clk-mt2701.c
80 +++ b/drivers/clk/mediatek/clk-mt2701.c
81 @@ -757,7 +757,7 @@ static void __init mtk_infrasys_init_ear
82 mtk_clk_register_factors(infra_fixed_divs, ARRAY_SIZE(infra_fixed_divs),
83 infra_clk_data);
84
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),
87 infra_clk_data);
88
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
93 if (ret)
94 goto free_clk_data;
95
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);
99 if (ret)
100 goto unregister_gates;
101
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);
107
108 - mtk_clk_register_cpumuxes(node, infra_muxes, ARRAY_SIZE(infra_muxes),
109 - clk_data);
110 + mtk_clk_register_cpumuxes(&pdev->dev, node, infra_muxes,
111 + ARRAY_SIZE(infra_muxes), clk_data);
112
113 r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get,
114 clk_data);
115 --- a/drivers/clk/mediatek/clk-mt7629.c
116 +++ b/drivers/clk/mediatek/clk-mt7629.c
117 @@ -584,8 +584,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);
120
121 - mtk_clk_register_cpumuxes(node, infra_muxes, ARRAY_SIZE(infra_muxes),
122 - clk_data);
123 + mtk_clk_register_cpumuxes(&pdev->dev, node, infra_muxes,
124 + ARRAY_SIZE(infra_muxes), clk_data);
125
126 return of_clk_add_hw_provider(node, of_clk_hw_onecell_get,
127 clk_data);
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
131 clk_data);
132 mtk_clk_register_factors(infra_divs, ARRAY_SIZE(infra_divs), clk_data);
133
134 - mtk_clk_register_cpumuxes(node, cpu_muxes, ARRAY_SIZE(cpu_muxes),
135 - clk_data);
136 + mtk_clk_register_cpumuxes(NULL, node, cpu_muxes,
137 + ARRAY_SIZE(cpu_muxes), clk_data);
138
139 r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
140 if (r)