Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Allow mtk-regulator-coupler to be built as a module
@ 2026-09-03  6:20 Justin Yeh
  2026-09-03  6:20 ` [PATCH 1/2] regulator: core: Export helpers used by regulator couplers Justin Yeh
  2026-09-03  6:20 ` [PATCH 2/2] soc: mediatek: mtk-regulator-coupler: Allow building as a module Justin Yeh
  0 siblings, 2 replies; 4+ messages in thread
From: Justin Yeh @ 2026-09-03  6:20 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: Project_Global_Chrome_Upstream_Group, linux-arm-kernel,
	linux-kernel, linux-mediatek, Justin Yeh

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(-)

-- 
2.45.2



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] regulator: core: Export helpers used by regulator couplers
  2026-09-03  6:20 [PATCH 0/2] Allow mtk-regulator-coupler to be built as a module Justin Yeh
@ 2026-09-03  6:20 ` Justin Yeh
  2026-09-03 23:07   ` Mark Brown
  2026-09-03  6:20 ` [PATCH 2/2] soc: mediatek: mtk-regulator-coupler: Allow building as a module Justin Yeh
  1 sibling, 1 reply; 4+ messages in thread
From: Justin Yeh @ 2026-09-03  6:20 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: Project_Global_Chrome_Upstream_Group, linux-arm-kernel,
	linux-kernel, linux-mediatek, Justin Yeh

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.

Signed-off-by: Justin Yeh <justin.yeh@mediatek.com>
---
 drivers/regulator/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 6a4008f387b5..6b7e613fbaaa 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -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)
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] soc: mediatek: mtk-regulator-coupler: Allow building as a module
  2026-09-03  6:20 [PATCH 0/2] Allow mtk-regulator-coupler to be built as a module Justin Yeh
  2026-09-03  6:20 ` [PATCH 1/2] regulator: core: Export helpers used by regulator couplers Justin Yeh
@ 2026-09-03  6:20 ` Justin Yeh
  1 sibling, 0 replies; 4+ messages in thread
From: Justin Yeh @ 2026-09-03  6:20 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: Project_Global_Chrome_Upstream_Group, linux-arm-kernel,
	linux-kernel, linux-mediatek, Justin Yeh

MTK_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.

Signed-off-by: Justin Yeh <justin.yeh@mediatek.com>
---
 drivers/soc/mediatek/Kconfig | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig
index d7293977f06e..4a2f2bccc213 100644
--- a/drivers/soc/mediatek/Kconfig
+++ b/drivers/soc/mediatek/Kconfig
@@ -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"
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] regulator: core: Export helpers used by regulator couplers
  2026-09-03  6:20 ` [PATCH 1/2] regulator: core: Export helpers used by regulator couplers Justin Yeh
@ 2026-09-03 23:07   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-09-03 23:07 UTC (permalink / raw)
  To: Justin Yeh
  Cc: Liam Girdwood, Matthias Brugger, AngeloGioacchino Del Regno,
	Project_Global_Chrome_Upstream_Group, linux-arm-kernel,
	linux-kernel, linux-mediatek

[-- Attachment #1: Type: text/plain, Size: 420 bytes --]

On Thu, Sep 03, 2026 at 02:20:46PM +0800, Justin Yeh wrote:
> 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.

Acked-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-03 23:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-03  6:20 [PATCH 0/2] Allow mtk-regulator-coupler to be built as a module Justin Yeh
2026-09-03  6:20 ` [PATCH 1/2] regulator: core: Export helpers used by regulator couplers Justin Yeh
2026-09-03 23:07   ` Mark Brown
2026-09-03  6:20 ` [PATCH 2/2] soc: mediatek: mtk-regulator-coupler: Allow building as a module Justin Yeh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox