All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] regulator: Make regulator_sync_voltage() usable by coupled regulators
@ 2021-01-22 17:43 Dmitry Osipenko
  2021-01-22 18:06 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Osipenko @ 2021-01-22 17:43 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Mark Brown, Liam Girdwood,
	Peter Geis, Nicolas Chauvet, Matt Merhar
  Cc: linux-kernel, linux-tegra

Make regulator_sync_voltage() to re-balance voltage state of a coupled
regulators instead of changing the voltage directly.

Tested-by: Peter Geis <pgwipeout@gmail.com> # Ouya T30
Tested-by: Dmitry Osipenko <digetx@gmail.com> # A500 T20 and Nexus7 T30
Tested-by: Nicolas Chauvet <kwizart@gmail.com> # PAZ00 T20
Tested-by: Matt Merhar <mattmerhar@protonmail.com> # Ouya T30
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---

Changelog:

v4: - Now not using goto in the code, like it was suggested by Mark Brown
      in a review comment to v3.

v3: - This patch is factored out from [1] to ease merging of the patches
      that will use the regulator_sync_voltage(). The goal is to get this
      change merged into 5.12, it will remove dependency for the Tegra Core
      power domain driver which will target 5.13.

      [1] https://patchwork.ozlabs.org/project/linux-tegra/list/?series=221130

 drivers/regulator/core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 3ae5ccd9277d..8e197b785a31 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4148,7 +4148,11 @@ int regulator_sync_voltage(struct regulator *regulator)
 	if (ret < 0)
 		goto out;
 
-	ret = _regulator_do_set_voltage(rdev, min_uV, max_uV);
+	/* balance only, if regulator is coupled */
+	if (rdev->coupling_desc.n_coupled > 1)
+		ret = regulator_balance_voltage(rdev, PM_SUSPEND_ON);
+	else
+		ret = _regulator_do_set_voltage(rdev, min_uV, max_uV);
 
 out:
 	regulator_unlock(rdev);
-- 
2.29.2


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

* Re: [PATCH v4] regulator: Make regulator_sync_voltage() usable by coupled regulators
  2021-01-22 17:43 [PATCH v4] regulator: Make regulator_sync_voltage() usable by coupled regulators Dmitry Osipenko
@ 2021-01-22 18:06 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2021-01-22 18:06 UTC (permalink / raw)
  To: Matt Merhar, Nicolas Chauvet, Dmitry Osipenko, Liam Girdwood,
	Thierry Reding, Peter Geis, Jonathan Hunter
  Cc: linux-tegra, linux-kernel

On Fri, 22 Jan 2021 20:43:11 +0300, Dmitry Osipenko wrote:
> Make regulator_sync_voltage() to re-balance voltage state of a coupled
> regulators instead of changing the voltage directly.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: Make regulator_sync_voltage() usable by coupled regulators
      commit: 24be0c715617ed9bfc63fa9483f8bda1214b9763

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

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

end of thread, other threads:[~2021-01-22 18:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-22 17:43 [PATCH v4] regulator: Make regulator_sync_voltage() usable by coupled regulators Dmitry Osipenko
2021-01-22 18:06 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.