diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2015-06-11 17:37:06 -0700 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-06-12 13:18:02 +0100 |
commit | 36e4f839de59b6216a16cdf5c1d3263f4dbd9421 (patch) | |
tree | 5cf5ebd741a210f610ec32ae3a1d1d953c553fe6 /drivers/regulator/core.c | |
parent | 57f66b78860968fc7eddc9ce25f8e57f7e5000bd (diff) | |
download | talos-op-linux-36e4f839de59b6216a16cdf5c1d3263f4dbd9421.tar.gz talos-op-linux-36e4f839de59b6216a16cdf5c1d3263f4dbd9421.zip |
regulator: Add input current limit support
Some regulators can limit their input current (typically annotated
as ilim). Add an op (set_input_current_limit) and a DT property +
constraint to support this.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r-- | drivers/regulator/core.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 6dfb2d6c19ae..ba565416d1d0 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1008,6 +1008,15 @@ static int set_machine_constraints(struct regulator_dev *rdev, if (ret != 0) goto out; + if (rdev->constraints->ilim_uA && ops->set_input_current_limit) { + ret = ops->set_input_current_limit(rdev, + rdev->constraints->ilim_uA); + if (ret < 0) { + rdev_err(rdev, "failed to set input limit\n"); + goto out; + } + } + /* do we need to setup our suspend state */ if (rdev->constraints->initial_state) { ret = suspend_prepare(rdev, rdev->constraints->initial_state); |