soc: rockchip: cpuinfo: Support building as module

Enable building rockchip-cpuinfo driver as a module.

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I1484794a0a844e45a4c20cf4ea0f0ed6f16873a1
This commit is contained in:
Tao Huang
2020-07-14 19:06:19 +08:00
parent 60cf304989
commit 7bb3c2ecbd
3 changed files with 15 additions and 2 deletions

View File

@@ -15,7 +15,7 @@ config ANDROID_VERSION
The value is 0xAABBCCRR, corresponding to Android A.B.C release R The value is 0xAABBCCRR, corresponding to Android A.B.C release R
config ROCKCHIP_CPUINFO config ROCKCHIP_CPUINFO
bool "Rockchip cpuinfo support" tristate "Rockchip cpuinfo support"
depends on (ROCKCHIP_EFUSE || ROCKCHIP_OTP) && (ARM64 || ARM) depends on (ROCKCHIP_EFUSE || ROCKCHIP_OTP) && (ARM64 || ARM)
default y default y
help help

View File

@@ -178,10 +178,23 @@ static int __init rockchip_soc_id_init(void)
return 0; return 0;
} }
#ifndef MODULE
pure_initcall(rockchip_soc_id_init); pure_initcall(rockchip_soc_id_init);
#endif
static int __init rockchip_cpuinfo_init(void) static int __init rockchip_cpuinfo_init(void)
{ {
#ifdef MODULE
rockchip_soc_id_init();
#endif
return platform_driver_register(&rockchip_cpuinfo_driver); return platform_driver_register(&rockchip_cpuinfo_driver);
} }
subsys_initcall_sync(rockchip_cpuinfo_init); subsys_initcall_sync(rockchip_cpuinfo_init);
static void __exit rockchip_cpuinfo_exit(void)
{
platform_driver_unregister(&rockchip_cpuinfo_driver);
}
module_exit(rockchip_cpuinfo_exit);
MODULE_LICENSE("GPL");

View File

@@ -24,7 +24,7 @@
#define ROCKCHIP_CPU_RK3288 0x32880000 #define ROCKCHIP_CPU_RK3288 0x32880000
#define ROCKCHIP_CPU_RK3308 0x33080000 #define ROCKCHIP_CPU_RK3308 0x33080000
#ifdef CONFIG_ROCKCHIP_CPUINFO #if IS_ENABLED(CONFIG_ROCKCHIP_CPUINFO)
extern unsigned long rockchip_soc_id; extern unsigned long rockchip_soc_id;