[PATCH 2/2] pmdomain: imx: scu-pd: allow building as a module
From: Zhipeng . wang_1
Date: Tue Jul 21 2026 - 06:13:10 EST
From: Zhipeng Wang <zhipeng.wang_1@xxxxxxx>
Convert CONFIG_IMX_SCU_PD from bool to tristate to allow building as a
loadable module. This is needed on Android devices using the Generic
Kernel Image (GKI), where SoC-specific drivers must be built as modules
rather than built into the core kernel image.
For i.MX8Q devices running Android with a GKI kernel, the SCU power
domain driver must be loadable. Without tristate support, power domains
cannot be properly initialized, preventing these systems from
functioning under GKI.
Add MODULE_DEVICE_TABLE() for OF-based module autoloading. When built
as a module, use module_platform_driver(); when built-in, retain
builtin_platform_driver() to preserve the existing initialization
ordering.
Signed-off-by: Zhipeng Wang <zhipeng.wang_1@xxxxxxx>
---
drivers/pmdomain/imx/Kconfig | 2 +-
drivers/pmdomain/imx/scu-pd.c | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/pmdomain/imx/Kconfig b/drivers/pmdomain/imx/Kconfig
index 00203615c65e..472e9dec6bd4 100644
--- a/drivers/pmdomain/imx/Kconfig
+++ b/drivers/pmdomain/imx/Kconfig
@@ -21,7 +21,7 @@ config IMX9_BLK_CTRL
depends on PM_GENERIC_DOMAINS
config IMX_SCU_PD
- bool "IMX SCU Power Domain driver"
+ tristate "IMX SCU Power Domain driver"
depends on IMX_SCU
help
The System Controller Firmware (SCFW) based power domain driver.
diff --git a/drivers/pmdomain/imx/scu-pd.c b/drivers/pmdomain/imx/scu-pd.c
index 3ec33667a308..21c7e2505087 100644
--- a/drivers/pmdomain/imx/scu-pd.c
+++ b/drivers/pmdomain/imx/scu-pd.c
@@ -531,6 +531,7 @@ static const struct of_device_id imx_sc_pd_match[] = {
{ .compatible = "fsl,scu-pd", &imx8qxp_scu_pd},
{ /* sentinel */ }
};
+MODULE_DEVICE_TABLE(of, imx_sc_pd_match);
static struct platform_driver imx_sc_pd_driver = {
.driver = {
@@ -540,7 +541,12 @@ static struct platform_driver imx_sc_pd_driver = {
},
.probe = imx_sc_pd_probe,
};
+
+#ifdef MODULE
+module_platform_driver(imx_sc_pd_driver);
+#else
builtin_platform_driver(imx_sc_pd_driver);
+#endif
MODULE_AUTHOR("Dong Aisheng <aisheng.dong@xxxxxxx>");
MODULE_DESCRIPTION("IMX SCU Power Domain driver");
--
2.34.1