From daa5fba89c27a1ac09918177e564e42eb9d44921 Mon Sep 17 00:00:00 2001 From: Zhipeng Wang Date: Thu, 23 Jul 2026 11:05:23 +0900 Subject: [PATCH] pmdomain: imx: scu-pd: allow building as a module 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. Use subsys_initcall() so that when built-in the power domain provider probes before its consumers (e.g. the SCU clock driver at device_initcall level), fixing "failed to attached the power domain" warnings at boot. When built as a module, subsys_initcall() is equivalent to module_init(). No module_exit() is provided because the SCU power domain provider is a system-level resource that cannot be safely removed at runtime. Add MODULE_DEVICE_TABLE() for OF-based module autoloading. Signed-off-by: Zhipeng Wang Reviewed-by: Peng Fan Signed-off-by: Ulf Hansson --- drivers/pmdomain/imx/Kconfig | 2 +- drivers/pmdomain/imx/scu-pd.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/pmdomain/imx/Kconfig b/drivers/pmdomain/imx/Kconfig index 9168d183b0c5..33e1567e5d17 100644 --- a/drivers/pmdomain/imx/Kconfig +++ b/drivers/pmdomain/imx/Kconfig @@ -24,7 +24,7 @@ config IMX9_BLK_CTRL default y 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..e3f9e741daf7 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, }; -builtin_platform_driver(imx_sc_pd_driver); + +static int __init imx_sc_pd_driver_init(void) +{ + return platform_driver_register(&imx_sc_pd_driver); +} +subsys_initcall(imx_sc_pd_driver_init); MODULE_AUTHOR("Dong Aisheng "); MODULE_DESCRIPTION("IMX SCU Power Domain driver");