diff options
author | Thierry Reding <treding@nvidia.com> | 2021-06-01 12:13:52 +0200 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2021-06-01 12:13:52 +0200 |
commit | 241ed23c4df6ab409fba0e965a86719ceb223a1d (patch) | |
tree | f8a9fe33fd48baa69b263ccd533b472c9b20fac2 /drivers | |
parent | 6efb943b8616ec53a5e444193dccf1af9ad627b5 (diff) | |
parent | 380d2b2d5a0491e47dfa250b40e3d849a922871d (diff) |
Merge branch 'for-5.14/regulator' into for-5.14/soc
Diffstat (limited to 'drivers')
-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 f192bf19492e..ead0b6d2af45 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -4105,6 +4105,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 |