aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2021-06-14 11:40:41 +0100
committerMark Brown <broonie@kernel.org>2021-06-14 11:40:41 +0100
commit2bce8174f79e5972d880480b83ea19bee9acc5f6 (patch)
tree8fc6967b13f9eb0c4710a68222ffb481056db938 /drivers/regulator/core.c
parentregulator: fan53880: Fix vsel_mask setting for FAN53880_BUCK (diff)
parentregulator: core: Add regulator_sync_voltage_rdev() (diff)
downloadlinux-dev-2bce8174f79e5972d880480b83ea19bee9acc5f6.tar.xz
linux-dev-2bce8174f79e5972d880480b83ea19bee9acc5f6.zip
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.c23
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