Skip to content

Commit 5ec8cbb

Browse files
inochisadlan17
authored andcommitted
clk: spacemit: Respect Kconfig setting when building modules
Currently, the SPACEMIT_CCU entry is only a switch for enabling entry SPACEMIT_K1_CCU. It does not guide the build for common clock codes even if it is a tristate entry. This makes this entry useless. Change the Makefile to add a separate build for common clock logic, so the SPACEMIT_CCU entry takes effect, also add necessary MODULE_LICENSE()/MODULE_DESCRIPTION()/EXPORT_SYMBOL() for the module build. Fixes: 1b72c59 ("clk: spacemit: Add clock support for SpacemiT K1 SoC") Signed-off-by: Inochi Amaoto <inochiama@gmail.com> Reviewed-by: Yixun Lan <dlan@gentoo.org> Link: https://lore.kernel.org/r/20251219012819.440972-2-inochiama@gmail.com Signed-off-by: Yixun Lan <dlan@gentoo.org>
1 parent 8f0b4cc commit 5ec8cbb

6 files changed

Lines changed: 25 additions & 2 deletions

File tree

drivers/clk/spacemit/Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# SPDX-License-Identifier: GPL-2.0
22

3-
obj-$(CONFIG_SPACEMIT_K1_CCU) = spacemit-ccu-k1.o
4-
spacemit-ccu-k1-y = ccu_pll.o ccu_mix.o ccu_ddn.o
3+
obj-$(CONFIG_SPACEMIT_CCU) += spacemit-ccu.o
4+
spacemit-ccu-y += ccu_common.o
5+
spacemit-ccu-y += ccu_pll.o
6+
spacemit-ccu-y += ccu_mix.o
7+
spacemit-ccu-y += ccu_ddn.o
8+
9+
obj-$(CONFIG_SPACEMIT_K1_CCU) += spacemit-ccu-k1.o
510
spacemit-ccu-k1-y += ccu-k1.o

drivers/clk/spacemit/ccu-k1.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,7 @@ static struct platform_driver k1_ccu_driver = {
12041204
};
12051205
module_platform_driver(k1_ccu_driver);
12061206

1207+
MODULE_IMPORT_NS("CLK_SPACEMIT");
12071208
MODULE_DESCRIPTION("SpacemiT K1 CCU driver");
12081209
MODULE_AUTHOR("Haylen Chu <heylenay@4d2.org>");
12091210
MODULE_LICENSE("GPL");

drivers/clk/spacemit/ccu_common.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
3+
#include <linux/module.h>
4+
5+
MODULE_DESCRIPTION("SpacemiT CCU common clock driver");
6+
MODULE_LICENSE("GPL");

drivers/clk/spacemit/ccu_ddn.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,4 @@ const struct clk_ops spacemit_ccu_ddn_ops = {
8484
.determine_rate = ccu_ddn_determine_rate,
8585
.set_rate = ccu_ddn_set_rate,
8686
};
87+
EXPORT_SYMBOL_NS_GPL(spacemit_ccu_ddn_ops, "CLK_SPACEMIT");

drivers/clk/spacemit/ccu_mix.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,24 +198,28 @@ const struct clk_ops spacemit_ccu_gate_ops = {
198198
.enable = ccu_gate_enable,
199199
.is_enabled = ccu_gate_is_enabled,
200200
};
201+
EXPORT_SYMBOL_NS_GPL(spacemit_ccu_gate_ops, "CLK_SPACEMIT");
201202

202203
const struct clk_ops spacemit_ccu_factor_ops = {
203204
.determine_rate = ccu_factor_determine_rate,
204205
.recalc_rate = ccu_factor_recalc_rate,
205206
.set_rate = ccu_factor_set_rate,
206207
};
208+
EXPORT_SYMBOL_NS_GPL(spacemit_ccu_factor_ops, "CLK_SPACEMIT");
207209

208210
const struct clk_ops spacemit_ccu_mux_ops = {
209211
.determine_rate = ccu_mix_determine_rate,
210212
.get_parent = ccu_mux_get_parent,
211213
.set_parent = ccu_mux_set_parent,
212214
};
215+
EXPORT_SYMBOL_NS_GPL(spacemit_ccu_mux_ops, "CLK_SPACEMIT");
213216

214217
const struct clk_ops spacemit_ccu_div_ops = {
215218
.determine_rate = ccu_mix_determine_rate,
216219
.recalc_rate = ccu_div_recalc_rate,
217220
.set_rate = ccu_mix_set_rate,
218221
};
222+
EXPORT_SYMBOL_NS_GPL(spacemit_ccu_div_ops, "CLK_SPACEMIT");
219223

220224
const struct clk_ops spacemit_ccu_factor_gate_ops = {
221225
.disable = ccu_gate_disable,
@@ -226,6 +230,7 @@ const struct clk_ops spacemit_ccu_factor_gate_ops = {
226230
.recalc_rate = ccu_factor_recalc_rate,
227231
.set_rate = ccu_factor_set_rate,
228232
};
233+
EXPORT_SYMBOL_NS_GPL(spacemit_ccu_factor_gate_ops, "CLK_SPACEMIT");
229234

230235
const struct clk_ops spacemit_ccu_mux_gate_ops = {
231236
.disable = ccu_gate_disable,
@@ -236,6 +241,7 @@ const struct clk_ops spacemit_ccu_mux_gate_ops = {
236241
.get_parent = ccu_mux_get_parent,
237242
.set_parent = ccu_mux_set_parent,
238243
};
244+
EXPORT_SYMBOL_NS_GPL(spacemit_ccu_mux_gate_ops, "CLK_SPACEMIT");
239245

240246
const struct clk_ops spacemit_ccu_div_gate_ops = {
241247
.disable = ccu_gate_disable,
@@ -246,6 +252,7 @@ const struct clk_ops spacemit_ccu_div_gate_ops = {
246252
.recalc_rate = ccu_div_recalc_rate,
247253
.set_rate = ccu_mix_set_rate,
248254
};
255+
EXPORT_SYMBOL_NS_GPL(spacemit_ccu_div_gate_ops, "CLK_SPACEMIT");
249256

250257
const struct clk_ops spacemit_ccu_mux_div_gate_ops = {
251258
.disable = ccu_gate_disable,
@@ -259,6 +266,7 @@ const struct clk_ops spacemit_ccu_mux_div_gate_ops = {
259266
.recalc_rate = ccu_div_recalc_rate,
260267
.set_rate = ccu_mix_set_rate,
261268
};
269+
EXPORT_SYMBOL_NS_GPL(spacemit_ccu_mux_div_gate_ops, "CLK_SPACEMIT");
262270

263271
const struct clk_ops spacemit_ccu_mux_div_ops = {
264272
.get_parent = ccu_mux_get_parent,
@@ -268,3 +276,4 @@ const struct clk_ops spacemit_ccu_mux_div_ops = {
268276
.recalc_rate = ccu_div_recalc_rate,
269277
.set_rate = ccu_mix_set_rate,
270278
};
279+
EXPORT_SYMBOL_NS_GPL(spacemit_ccu_mux_div_ops, "CLK_SPACEMIT");

drivers/clk/spacemit/ccu_pll.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,4 @@ const struct clk_ops spacemit_ccu_pll_ops = {
157157
.determine_rate = ccu_pll_determine_rate,
158158
.is_enabled = ccu_pll_is_enabled,
159159
};
160+
EXPORT_SYMBOL_NS_GPL(spacemit_ccu_pll_ops, "CLK_SPACEMIT");

0 commit comments

Comments
 (0)