[PATCH v2 08/48] regulator: Make regulator_sync_voltage() usable by coupled regulators

From: Dmitry Osipenko
Date: Thu Dec 17 2020 - 13:13:14 EST


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

Signed-off-by: Dmitry Osipenko <digetx@xxxxxxxxx>
---
drivers/regulator/core.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index ca03d8e70bd1..576efb815eb8 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4131,6 +4131,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