[PATCH v3] regulator: Make regulator_sync_voltage() usable by coupled regulators

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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

Changelog:

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, 6 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 3ae5ccd9277d..032d4e7df682 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4148,6 +4148,12 @@ int regulator_sync_voltage(struct regulator *regulator)
 	if (ret < 0)
 		goto out;
 
+	/* balance only if there are regulators coupled */
+	if (rdev->coupling_desc.n_coupled > 1) {
+		ret = regulator_balance_voltage(rdev, PM_SUSPEND_ON);
+		goto out;
+	}
+
 	ret = _regulator_do_set_voltage(rdev, min_uV, max_uV);
 
 out:
-- 
2.29.2




[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux