summary refs log tree commit diff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2015-06-11 17:37:05 -0700
committerMark Brown <broonie@kernel.org>2015-06-12 13:16:57 +0100
commit57f66b78860968fc7eddc9ce25f8e57f7e5000bd (patch)
tree5ee90fa99fdd1277706faa3bef39522d26ebc4bc /drivers/regulator
parent23c779b9f9161d6568d3b2fca06e70ad182c480c (diff)
downloadlinux-57f66b78860968fc7eddc9ce25f8e57f7e5000bd.tar.gz
regulator: Add soft start support
Some regulators support a "soft start" feature where the voltage
ramps up slowly when the regulator is enabled. Add an op
(set_soft_start) 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')
-rw-r--r--drivers/regulator/core.c8
-rw-r--r--drivers/regulator/of_regulator.c3
2 files changed, 11 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 60fcfba52592..6dfb2d6c19ae 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1059,6 +1059,14 @@ static int set_machine_constraints(struct regulator_dev *rdev,
 		}
 	}
 
+	if (rdev->constraints->soft_start && ops->set_soft_start) {
+		ret = ops->set_soft_start(rdev);
+		if (ret < 0) {
+			rdev_err(rdev, "failed to set soft start\n");
+			goto out;
+		}
+	}
+
 	print_constraints(rdev);
 	return 0;
 out:
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index c3433db0acda..207da037cd2d 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -84,6 +84,9 @@ static void of_get_regulation_constraints(struct device_node *np,
 	if (!ret)
 		constraints->enable_time = pval;
 
+	constraints->soft_start = of_property_read_bool(np,
+					"regulator-soft-start");
+
 	if (!of_property_read_u32(np, "regulator-initial-mode", &pval)) {
 		if (desc && desc->of_map_mode) {
 			ret = desc->of_map_mode(pval);