summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2015-06-11 17:37:04 -0700
committerMark Brown <broonie@kernel.org>2015-06-12 13:09:43 +0100
commit23c779b9f9161d6568d3b2fca06e70ad182c480c (patch)
tree314598f81db70f24dc8ead5f84c708cb8d5f00ef /drivers
parent22a10bca280073f81e9e2d9fed6f90a3bcf00236 (diff)
downloadlinux-23c779b9f9161d6568d3b2fca06e70ad182c480c.tar.bz2
regulator: Add pull down support
Some regulators need to be configured to pull down a resistor when the regulator is disabled. Add an op (set_pull_down) 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')
-rw-r--r--drivers/regulator/core.c8
-rw-r--r--drivers/regulator/of_regulator.c2
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index c8d5e2b05fdf..60fcfba52592 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1051,6 +1051,14 @@ static int set_machine_constraints(struct regulator_dev *rdev,
}
}
+ if (rdev->constraints->pull_down && ops->set_pull_down) {
+ ret = ops->set_pull_down(rdev);
+ if (ret < 0) {
+ rdev_err(rdev, "failed to set pull down\n");
+ goto out;
+ }
+ }
+
print_constraints(rdev);
return 0;
out:
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 482a86f90839..c3433db0acda 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -67,6 +67,8 @@ static void of_get_regulation_constraints(struct device_node *np,
if (!constraints->always_on) /* status change should be possible. */
constraints->valid_ops_mask |= REGULATOR_CHANGE_STATUS;
+ constraints->pull_down = of_property_read_bool(np, "regulator-pull-down");
+
if (of_property_read_bool(np, "regulator-allow-bypass"))
constraints->valid_ops_mask |= REGULATOR_CHANGE_BYPASS;