diff options
author | Mark Brown <broonie@kernel.org> | 2021-06-14 13:40:41 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-06-14 13:40:41 +0300 |
commit | 2bce8174f79e5972d880480b83ea19bee9acc5f6 (patch) | |
tree | 8fc6967b13f9eb0c4710a68222ffb481056db938 /drivers/regulator/core.c | |
parent | 2e11737a772b95c6587df73f216eec1762431432 (diff) | |
parent | 380d2b2d5a0491e47dfa250b40e3d849a922871d (diff) | |
download | linux-2bce8174f79e5972d880480b83ea19bee9acc5f6.tar.xz |
Merge tag 'for-5.14-regulator' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into regulator-5.14
regulator: Changes for v5.14-rc1
This adds regulator_sync_voltage_rdev(), which is used as a dependency
for new Tegra power domain code.
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r-- | drivers/regulator/core.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 47f2d9a3707c..4d1463d2361a 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -4095,6 +4095,29 @@ int regulator_set_voltage_time_sel(struct regulator_dev *rdev, } EXPORT_SYMBOL_GPL(regulator_set_voltage_time_sel); +int regulator_sync_voltage_rdev(struct regulator_dev *rdev) +{ + int ret; + + regulator_lock(rdev); + + if (!rdev->desc->ops->set_voltage && + !rdev->desc->ops->set_voltage_sel) { + ret = -EINVAL; + goto out; + } + + /* balance only, if regulator is coupled */ + if (rdev->coupling_desc.n_coupled > 1) + ret = regulator_balance_voltage(rdev, PM_SUSPEND_ON); + else + ret = -EOPNOTSUPP; + +out: + regulator_unlock(rdev); + return ret; +} + /** * regulator_sync_voltage - re-apply last regulator output voltage * @regulator: regulator source |