This patch set makes COMMON_CLK_MEDIATEK and COMMON_CLK_MT6779*
be able to built as kernel modules. Necessary symbols are exported
in this patch.
In previous discussion [1], Stephen commented that there must
be a user before exporting a symbol:
"
Is the mediatek driver compilable as a module? Last time I checked it
wasn't a module. I want an upstream modular driver that uses the symbol.
Otherwise we're exporting symbols when it doesn't need to be.
"
[1] https://lore.kernel.org/patchwork/patch/1278089/
---
Change since v1:
use module_platform_driver() instead of builtin_platform_driver()
Miles Chen (4):
clk: composite: export clk_register_composite
clk: mediatek: support COMMON_CLK_MEDIATEK module build
clk: mediatek: support COMMON_CLK_MT6779 module build
clk: mediatek: use tristate for COMMON_CLK_MEDAITEK and
COMMON_CLK_MT6779
drivers/clk/clk-composite.c | 1 +
drivers/clk/mediatek/Kconfig | 20 ++++++++++----------
drivers/clk/mediatek/clk-apmixed.c | 3 +++
drivers/clk/mediatek/clk-cpumux.c | 3 +++
drivers/clk/mediatek/clk-gate.c | 8 ++++++++
drivers/clk/mediatek/clk-mt6779-aud.c | 4 +++-
drivers/clk/mediatek/clk-mt6779-cam.c | 4 +++-
drivers/clk/mediatek/clk-mt6779-img.c | 4 +++-
drivers/clk/mediatek/clk-mt6779-ipe.c | 4 +++-
drivers/clk/mediatek/clk-mt6779-mfg.c | 4 +++-
drivers/clk/mediatek/clk-mt6779-mm.c | 4 +++-
drivers/clk/mediatek/clk-mt6779-vdec.c | 4 +++-
drivers/clk/mediatek/clk-mt6779-venc.c | 4 +++-
drivers/clk/mediatek/clk-mt6779.c | 2 ++
drivers/clk/mediatek/clk-mtk.c | 8 ++++++++
drivers/clk/mediatek/clk-mux.c | 4 ++++
drivers/clk/mediatek/clk-pll.c | 4 ++++
drivers/clk/mediatek/reset.c | 2 ++
18 files changed, 69 insertions(+), 18 deletions(-)
--
2.18.0
Now we have all necessary exported symbols, change
COMMON_CLK_MEDAITEK and COMMON_CLK_MT6779* to tristate.
Cc: Stephen Boyd <[email protected]>
Cc: Hanks Chen <[email protected]>
Cc: Wendell Lin <[email protected]>
Cc: Lee Jones <[email protected]>
Signed-off-by: Miles Chen <[email protected]>
---
drivers/clk/mediatek/Kconfig | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
index 886e2d9fced5..62ed2054a849 100644
--- a/drivers/clk/mediatek/Kconfig
+++ b/drivers/clk/mediatek/Kconfig
@@ -6,7 +6,7 @@ menu "Clock driver for MediaTek SoC"
depends on ARCH_MEDIATEK || COMPILE_TEST
config COMMON_CLK_MEDIATEK
- bool
+ tristate
select RESET_CONTROLLER
help
MediaTek SoCs' clock support.
@@ -204,7 +204,7 @@ config COMMON_CLK_MT6765_MIPI2BSYS
This driver supports MediaTek MT6765 mipi2bsys clocks.
config COMMON_CLK_MT6779
- bool "Clock driver for MediaTek MT6779"
+ tristate "Clock driver for MediaTek MT6779"
depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST
select COMMON_CLK_MEDIATEK
default ARCH_MEDIATEK && ARM64
@@ -212,49 +212,49 @@ config COMMON_CLK_MT6779
This driver supports MediaTek MT6779 basic clocks.
config COMMON_CLK_MT6779_MMSYS
- bool "Clock driver for MediaTek MT6779 mmsys"
+ tristate "Clock driver for MediaTek MT6779 mmsys"
depends on COMMON_CLK_MT6779
help
This driver supports MediaTek MT6779 mmsys clocks.
config COMMON_CLK_MT6779_IMGSYS
- bool "Clock driver for MediaTek MT6779 imgsys"
+ tristate "Clock driver for MediaTek MT6779 imgsys"
depends on COMMON_CLK_MT6779
help
This driver supports MediaTek MT6779 imgsys clocks.
config COMMON_CLK_MT6779_IPESYS
- bool "Clock driver for MediaTek MT6779 ipesys"
+ tristate "Clock driver for MediaTek MT6779 ipesys"
depends on COMMON_CLK_MT6779
help
This driver supports MediaTek MT6779 ipesys clocks.
config COMMON_CLK_MT6779_CAMSYS
- bool "Clock driver for MediaTek MT6779 camsys"
+ tristate "Clock driver for MediaTek MT6779 camsys"
depends on COMMON_CLK_MT6779
help
This driver supports MediaTek MT6779 camsys clocks.
config COMMON_CLK_MT6779_VDECSYS
- bool "Clock driver for MediaTek MT6779 vdecsys"
+ tristate "Clock driver for MediaTek MT6779 vdecsys"
depends on COMMON_CLK_MT6779
help
This driver supports MediaTek MT6779 vdecsys clocks.
config COMMON_CLK_MT6779_VENCSYS
- bool "Clock driver for MediaTek MT6779 vencsys"
+ tristate "Clock driver for MediaTek MT6779 vencsys"
depends on COMMON_CLK_MT6779
help
This driver supports MediaTek MT6779 vencsys clocks.
config COMMON_CLK_MT6779_MFGCFG
- bool "Clock driver for MediaTek MT6779 mfgcfg"
+ tristate "Clock driver for MediaTek MT6779 mfgcfg"
depends on COMMON_CLK_MT6779
help
This driver supports MediaTek MT6779 mfgcfg clocks.
config COMMON_CLK_MT6779_AUDSYS
- bool "Clock driver for Mediatek MT6779 audsys"
+ tristate "Clock driver for Mediatek MT6779 audsys"
depends on COMMON_CLK_MT6779
help
This driver supports Mediatek MT6779 audsys clocks.
--
2.18.0
To support module build of mediatek clk drivers,
it is necessary to export clk_register_composite.
Cc: Stephen Boyd <[email protected]>
Cc: Hanks Chen <[email protected]>
Cc: Wendell Lin <[email protected]>
Cc: Lee Jones <[email protected]>
Signed-off-by: Miles Chen <[email protected]>
---
drivers/clk/clk-composite.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c
index 0506046a5f4b..c7b97fb0051b 100644
--- a/drivers/clk/clk-composite.c
+++ b/drivers/clk/clk-composite.c
@@ -362,6 +362,7 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
return ERR_CAST(hw);
return hw->clk;
}
+EXPORT_SYMBOL_GPL(clk_register_composite);
struct clk *clk_register_composite_pdata(struct device *dev, const char *name,
const struct clk_parent_data *parent_data,
--
2.18.0
To support COMMON_CLK_MT6779* module build,
add MODULE_LICENSE and export necessary symbols.
Cc: Stephen Boyd <[email protected]>
Cc: Hanks Chen <[email protected]>
Cc: Wendell Lin <[email protected]>
Cc: Lee Jones <[email protected]>
Signed-off-by: Miles Chen <[email protected]>
---
drivers/clk/mediatek/clk-mt6779-aud.c | 4 +++-
drivers/clk/mediatek/clk-mt6779-cam.c | 4 +++-
drivers/clk/mediatek/clk-mt6779-img.c | 4 +++-
drivers/clk/mediatek/clk-mt6779-ipe.c | 4 +++-
drivers/clk/mediatek/clk-mt6779-mfg.c | 4 +++-
drivers/clk/mediatek/clk-mt6779-mm.c | 4 +++-
drivers/clk/mediatek/clk-mt6779-vdec.c | 4 +++-
drivers/clk/mediatek/clk-mt6779-venc.c | 4 +++-
drivers/clk/mediatek/clk-mt6779.c | 2 ++
9 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/drivers/clk/mediatek/clk-mt6779-aud.c b/drivers/clk/mediatek/clk-mt6779-aud.c
index 11b209f95e25..9e889e4c361a 100644
--- a/drivers/clk/mediatek/clk-mt6779-aud.c
+++ b/drivers/clk/mediatek/clk-mt6779-aud.c
@@ -4,6 +4,7 @@
* Author: Wendell Lin <[email protected]>
*/
+#include <linux/module.h>
#include <linux/clk-provider.h>
#include <linux/of.h>
#include <linux/of_address.h>
@@ -114,4 +115,5 @@ static struct platform_driver clk_mt6779_aud_drv = {
},
};
-builtin_platform_driver(clk_mt6779_aud_drv);
+module_platform_driver(clk_mt6779_aud_drv);
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/mediatek/clk-mt6779-cam.c b/drivers/clk/mediatek/clk-mt6779-cam.c
index 244d4208b7fb..7f07a2a139ac 100644
--- a/drivers/clk/mediatek/clk-mt6779-cam.c
+++ b/drivers/clk/mediatek/clk-mt6779-cam.c
@@ -4,6 +4,7 @@
* Author: Wendell Lin <[email protected]>
*/
+#include <linux/module.h>
#include <linux/clk-provider.h>
#include <linux/platform_device.h>
#include <dt-bindings/clock/mt6779-clk.h>
@@ -63,4 +64,5 @@ static struct platform_driver clk_mt6779_cam_drv = {
},
};
-builtin_platform_driver(clk_mt6779_cam_drv);
+module_platform_driver(clk_mt6779_cam_drv);
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/mediatek/clk-mt6779-img.c b/drivers/clk/mediatek/clk-mt6779-img.c
index 26292a45c613..f0961fa1a286 100644
--- a/drivers/clk/mediatek/clk-mt6779-img.c
+++ b/drivers/clk/mediatek/clk-mt6779-img.c
@@ -4,6 +4,7 @@
* Author: Wendell Lin <[email protected]>
*/
+#include <linux/module.h>
#include <linux/clk-provider.h>
#include <linux/platform_device.h>
#include <dt-bindings/clock/mt6779-clk.h>
@@ -55,4 +56,5 @@ static struct platform_driver clk_mt6779_img_drv = {
},
};
-builtin_platform_driver(clk_mt6779_img_drv);
+module_platform_driver(clk_mt6779_img_drv);
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/mediatek/clk-mt6779-ipe.c b/drivers/clk/mediatek/clk-mt6779-ipe.c
index bb519075639c..8c6f3e154bf3 100644
--- a/drivers/clk/mediatek/clk-mt6779-ipe.c
+++ b/drivers/clk/mediatek/clk-mt6779-ipe.c
@@ -4,6 +4,7 @@
* Author: Wendell Lin <[email protected]>
*/
+#include <linux/module.h>
#include <linux/clk-provider.h>
#include <linux/platform_device.h>
#include <dt-bindings/clock/mt6779-clk.h>
@@ -57,4 +58,5 @@ static struct platform_driver clk_mt6779_ipe_drv = {
},
};
-builtin_platform_driver(clk_mt6779_ipe_drv);
+module_platform_driver(clk_mt6779_ipe_drv);
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/mediatek/clk-mt6779-mfg.c b/drivers/clk/mediatek/clk-mt6779-mfg.c
index c6ee2a89c070..9f3372886e6b 100644
--- a/drivers/clk/mediatek/clk-mt6779-mfg.c
+++ b/drivers/clk/mediatek/clk-mt6779-mfg.c
@@ -4,6 +4,7 @@
* Author: Wendell Lin <[email protected]>
*/
+#include <linux/module.h>
#include <linux/clk-provider.h>
#include <linux/platform_device.h>
@@ -52,4 +53,5 @@ static struct platform_driver clk_mt6779_mfg_drv = {
},
};
-builtin_platform_driver(clk_mt6779_mfg_drv);
+module_platform_driver(clk_mt6779_mfg_drv);
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/mediatek/clk-mt6779-mm.c b/drivers/clk/mediatek/clk-mt6779-mm.c
index 059c1a41ac7a..33946e647122 100644
--- a/drivers/clk/mediatek/clk-mt6779-mm.c
+++ b/drivers/clk/mediatek/clk-mt6779-mm.c
@@ -4,6 +4,7 @@
* Author: Wendell Lin <[email protected]>
*/
+#include <linux/module.h>
#include <linux/clk-provider.h>
#include <linux/platform_device.h>
#include <dt-bindings/clock/mt6779-clk.h>
@@ -105,4 +106,5 @@ static struct platform_driver clk_mt6779_mm_drv = {
},
};
-builtin_platform_driver(clk_mt6779_mm_drv);
+module_platform_driver(clk_mt6779_mm_drv);
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/mediatek/clk-mt6779-vdec.c b/drivers/clk/mediatek/clk-mt6779-vdec.c
index 1900da2586a1..f4358844c2e0 100644
--- a/drivers/clk/mediatek/clk-mt6779-vdec.c
+++ b/drivers/clk/mediatek/clk-mt6779-vdec.c
@@ -4,6 +4,7 @@
* Author: Wendell Lin <[email protected]>
*/
+#include <linux/module.h>
#include <linux/clk-provider.h>
#include <linux/platform_device.h>
@@ -64,4 +65,5 @@ static struct platform_driver clk_mt6779_vdec_drv = {
},
};
-builtin_platform_driver(clk_mt6779_vdec_drv);
+module_platform_driver(clk_mt6779_vdec_drv);
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/mediatek/clk-mt6779-venc.c b/drivers/clk/mediatek/clk-mt6779-venc.c
index b41d1f859edc..ff67084af5aa 100644
--- a/drivers/clk/mediatek/clk-mt6779-venc.c
+++ b/drivers/clk/mediatek/clk-mt6779-venc.c
@@ -4,6 +4,7 @@
* Author: Wendell Lin <[email protected]>
*/
+#include <linux/module.h>
#include <linux/clk-provider.h>
#include <linux/platform_device.h>
@@ -55,4 +56,5 @@ static struct platform_driver clk_mt6779_venc_drv = {
},
};
-builtin_platform_driver(clk_mt6779_venc_drv);
+module_platform_driver(clk_mt6779_venc_drv);
+MODULE_LICENSE("GPL");
diff --git a/drivers/clk/mediatek/clk-mt6779.c b/drivers/clk/mediatek/clk-mt6779.c
index 6e0d3a166729..9825385c9f94 100644
--- a/drivers/clk/mediatek/clk-mt6779.c
+++ b/drivers/clk/mediatek/clk-mt6779.c
@@ -4,6 +4,7 @@
* Author: Wendell Lin <[email protected]>
*/
+#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_device.h>
@@ -1314,3 +1315,4 @@ static int __init clk_mt6779_init(void)
}
arch_initcall(clk_mt6779_init);
+MODULE_LICENSE("GPL");
--
2.18.0
Quoting Miles Chen (2021-08-31 09:42:10)
> Now we have all necessary exported symbols, change
> COMMON_CLK_MEDAITEK and COMMON_CLK_MT6779* to tristate.
>
Please squash this with the patch that makes them into modular drivers.
> Cc: Stephen Boyd <[email protected]>
> Cc: Hanks Chen <[email protected]>
> Cc: Wendell Lin <[email protected]>
> Cc: Lee Jones <[email protected]>
> Signed-off-by: Miles Chen <[email protected]>
On Tue, 2021-08-31 at 22:40 -0700, Stephen Boyd wrote:
> Quoting Miles Chen (2021-08-31 09:42:10)
> > Now we have all necessary exported symbols, change
> > COMMON_CLK_MEDAITEK and COMMON_CLK_MT6779* to tristate.
> >
>
> Please squash this with the patch that makes them into modular
> drivers.
No problem.
>
> > Cc: Stephen Boyd <[email protected]>
> > Cc: Hanks Chen <[email protected]>
> > Cc: Wendell Lin <[email protected]>
> > Cc: Lee Jones <[email protected]>
> > Signed-off-by: Miles Chen <[email protected]>