regulator: Make regulator_sync_voltage() usable by coupled regulators
PATCH v3 1/1 regulator: Make regulator_sync_voltage() usable by coupled regulators
Make regulator_sync_voltage() to re-balance voltage state of a coupled regulators instead of changing the voltage directly.
---
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(+)
drivers/regulator/core.c +6 -0
@@ -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:
Signature · 1 line
2.29.2
Mark Brown
maintainerdrivers/regulator/core.c int regulator_sync_voltage(struct regulator *regulator) · line 4159
Quoted 9 lines · Dmitry Osipenko
drivers/regulator/core.c +6
-0+/* 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:
This would be clearer written as an if/else rather than using the goto.
22.01.2021 16:40, Mark Brown пишет:
Quoted 10 lines · Dmitry Osipenko
Quoted 9 lines
drivers/regulator/core.c +6
-0+/* 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);
Quoted 4 lines
Quoted 1 line
out:
This would be clearer written as an if/else rather than using the goto.
I'll make v4, thanks.