Allow mtk-regulator-coupler to be built as a module
Subsystems (2)
cover Allow mtk-regulator-coupler to be built as a module
MTK_REGULATOR_COUPLER can currently only be built into the kernel: it is a bool, and its prompt is hidden unless COMPILE_TEST is set, so on real MediaTek configurations the symbol has no prompt and is forced to its "default ARCH_MEDIATEK" value.
Kernels that ship nearly everything as a module (Android GKI style kernels, but distro kernels have the same shape) cannot use it that way. Two things are in the way:
- the four helpers the coupler calls are declared in include/linux/regulator/coupler.h for coupler implementations to use, but none of them is exported (patch 1);
- the Kconfig symbol is a bool without a usable prompt (patch 2).
With both patches applied, CONFIG_MTK_REGULATOR_COUPLER=m builds and mtk_regulator_coupler.ko loads and registers the coupler. Existing configurations are unaffected: "default ARCH_MEDIATEK" is kept, so they keep building the coupler in.
Justin Yeh (2):
regulator: core: Export helpers used by regulator couplers
soc: mediatek: mtk-regulator-coupler: Allow building as a module
drivers/regulator/core.c | 4 ++++ drivers/soc/mediatek/Kconfig | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-)
Signature · 1 line
2.45.2
PATCH 1/2 regulator: core: Export helpers used by regulator couplers
regulator_check_voltage(), regulator_check_consumers(), regulator_do_balance_voltage() and regulator_coupler_register() are already declared in include/linux/regulator/coupler.h for regulator coupler implementations to use, but none of them is exported. That limits couplers to being built into the kernel.
Export them so that coupler drivers can be built as loadable modules.
--- drivers/regulator/core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/regulator/core.c +4 -0
@@ -462,6 +462,7 @@ int regulator_check_voltage(struct regulator_dev *rdev,return 0 ; } +EXPORT_SYMBOL_GPL (regulator_check_voltage);/* return 0 if the state is valid */ static int regulator_check_states (suspend_state_t state)
@@ -502,6 +503,7 @@ int regulator_check_consumers(struct regulator_dev *rdev,return 0 ; } +EXPORT_SYMBOL_GPL (regulator_check_consumers);/* current constraint check */ static int regulator_check_current_limit(struct regulator_dev *rdev,
@@ -4468,6 +4470,7 @@ int regulator_do_balance_voltage(struct regulator_dev *rdev, out:return ret; } +EXPORT_SYMBOL_GPL (regulator_do_balance_voltage);static int regulator_balance_voltage (struct regulator_dev *rdev,suspend_state_t state)
@@ -5797,6 +5800,7 @@ int regulator_coupler_register(struct regulator_coupler *coupler)return 0 ; } +EXPORT_SYMBOL_GPL (regulator_coupler_register);static struct regulator_coupler *regulator_find_coupler (struct regulator_dev *rdev)
Signature · 1 line
2.45.2
Re: [PATCH 1/2] regulator: core: Export helpers used by regulator couplers
Quoted 5 lines · Justin Yeh
regulator_check_voltage(),regulator_check_consumers(),regulator_do_balance_voltage()andregulator_coupler_register()are already declared ininclude/linux/regulator/coupler.hfor regulator coupler implementations to use, but none of them is exported. That limits couplers to being built into the kernel.
PATCH 2/2 soc: mediatek: mtk-regulator-coupler: Allow building as a module
In reply to Justin YehMTK_REGULATOR_COUPLER is a bool whose prompt is only visible when COMPILE_TEST is set, so on real MediaTek configurations the symbol has no prompt at all and is forced to its default: it can only ever be built in.
Turn it into a visible tristate so that the coupler can also be built as a loadable module, which is what kernels shipping most of their drivers as modules need. The "default ARCH_MEDIATEK" is kept, so existing configurations keep building it in.
While at it, add the help text that the now user-visible prompt was missing.
--- drivers/soc/mediatek/Kconfig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/soc/mediatek/Kconfig +5 -1
@@ -56,9 +56,13 @@ config MTK_PMIC_WRAP hardware to connect the PMIC. config MTK_REGULATOR_COUPLER - bool "MediaTek SoC Regulator Coupler" if COMPILE_TEST + tristate "MediaTek SoC Regulator Coupler" default ARCH_MEDIATEK depends on REGULATOR + help + Say yes here to add support for the MediaTek regulator coupler, + which keeps the GPU supply and its coupled GPU SRAM supply + voltage-balanced on the MediaTek SoCs that need it. config MTK_MMSYS tristate "MediaTek MMSYS Support"
Signature · 1 line
2.45.2
Hi Mark, Liam, Matthias, Angelo,
Gentle ping on this series, sent two weeks ago:
https://lore.kernel.org/all/[email protected]/
Is it OK to pick up as it is, or is there something you would like me to change first?
One note on the routing: patch 2/2 (soc/mediatek Kconfig) depends on the exports added by patch 1/2 (regulator core), so the two have to land in that order - ideally via the same tree.
Thanks,
Justin
Mark Brown
maintainerQuoted 4 lines · Justin Yeh
Hi Mark, Liam, Matthias, Angelo,
Gentle ping on this series, sent two weeks ago:
https://lore.kernel.org/all/[email protected]/
Please don't send content free pings and please allow a reasonable time for review. People get busy, go on holiday, attend conferences and so on so unless there is some reason for urgency (like critical bug fixes) please allow at least a couple of weeks for review. If there have been review comments then people may be waiting for those to be addressed.
Sending content free pings adds to the mail volume (if they are seen at all) which is often the problem and since they can't be reviewed directly if something has gone wrong you'll have to resend the patches anyway, so sending again is generally a better approach though there are some other maintainers who like them - if in doubt look at how patches for the subsystem are normally handled.
Mark Brown
maintainerRe: (subset) [PATCH 0/2] Allow mtk-regulator-coupler to be built as a module
In reply to Justin YehQuoted 8 lines · Justin Yeh
Allow mtk-regulator-coupler to be built as a module
MTK_REGULATOR_COUPLERcan currently only be built into the kernel: it is a bool, and its prompt is hidden unlessCOMPILE_TESTis set, so on real MediaTek configurations the symbol has no prompt and is forced to its "defaultARCH_MEDIATEK" value.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-7.4
Thanks!
[1/2] regulator: core: Export helpers used by regulator couplers
https://git.kernel.org/broonie/regulator/c/59951bd9c6b6
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Mark Brown
maintainerQuoted 4 lines · Justin Yeh
MTK_REGULATOR_COUPLERcan currently only be built into the kernel: it is a bool, and its prompt is hidden unlessCOMPILE_TESTis set, so on real MediaTek configurations the symbol has no prompt and is forced to its "defaultARCH_MEDIATEK" value.
The following changes since commit 940de590b839f71d6dc846160534bf202401b8b7:
Merge tag 'hardening-v7.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux (2026-09-02 16:02:02 -0700)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git tags/regulator-export-coupling-api
for you to fetch changes up to 59951bd9c6b63d4d98539db96becef729ad60b4a:
regulator: core: Export helpers used by regulator couplers (2026-09-25 18:44:46 +0100)
----------------------------------------------------------------
regulator: core: Export helpers used by regulator couplers
regulator_check_voltage(), regulator_check_consumers(), regulator_do_balance_voltage() and regulator_coupler_register() are already declared in include/linux/regulator/coupler.h for regulator coupler implementations to use, but none of them is exported. That limits couplers to being built into the kernel.
Export them so that coupler drivers can be built as loadable modules.
----------------------------------------------------------------
Justin Yeh (1):
regulator: core: Export helpers used by regulator couplers
drivers/regulator/core.c | 4 ++++ 1 file changed, 4 insertions(+)