aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2013-09-18 08:48:02 -0400
committerMark Brown <broonie@linaro.org>2013-09-18 12:13:02 -0400
commit00c877c69ba315d6c565a4df51c71b11e82cdeb8 (patch)
tree8b5dcf0d475476da3ee8c2cb310e9bce34e6d30a
parent272b98c6455f00884f0350f775c5342358ebb73f (diff)
regulator: core: add support for configuring turn-on time through constraints
The turn-on time of the regulator depends on the regulator device's electrical characteristics. Sometimes regulator turn-on time also depends on the capacitive load on the given platform and it can be more than the datasheet value. The driver provides the enable-time as per datasheet. Add support for configure the enable ramp time through regulator constraints so that regulator core can take this value for enable time for that regulator. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--Documentation/devicetree/bindings/regulator/regulator.txt5
-rw-r--r--drivers/regulator/core.c2
-rw-r--r--drivers/regulator/of_regulator.c6
-rw-r--r--include/linux/regulator/machine.h2
4 files changed, 15 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt b/Documentation/devicetree/bindings/regulator/regulator.txt
index 2bd8f0978765..e2c7f1e7251a 100644
--- a/Documentation/devicetree/bindings/regulator/regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/regulator.txt
@@ -14,6 +14,11 @@ Optional properties:
14- regulator-ramp-delay: ramp delay for regulator(in uV/uS) 14- regulator-ramp-delay: ramp delay for regulator(in uV/uS)
15 For hardwares which support disabling ramp rate, it should be explicitly 15 For hardwares which support disabling ramp rate, it should be explicitly
16 intialised to zero (regulator-ramp-delay = <0>) for disabling ramp delay. 16 intialised to zero (regulator-ramp-delay = <0>) for disabling ramp delay.
17- regulator-enable-ramp-delay: The time taken, in microseconds, for the supply
18 rail to reach the target voltage, plus/minus whatever tolerance the board
19 design requires. This property describes the total system ramp time
20 required due to the combination of internal ramping of the regulator itself,
21 and board design issues such as trace capacitance and load on the supply.
17 22
18Deprecated properties: 23Deprecated properties:
19- regulator-compatible: If a regulator chip contains multiple 24- regulator-compatible: If a regulator chip contains multiple
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index a01b8b3b70ca..5217c1964c32 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1186,6 +1186,8 @@ overflow_err:
1186 1186
1187static int _regulator_get_enable_time(struct regulator_dev *rdev) 1187static int _regulator_get_enable_time(struct regulator_dev *rdev)
1188{ 1188{
1189 if (rdev->constraints && rdev->constraints->enable_time)
1190 return rdev->constraints->enable_time;
1189 if (!rdev->desc->ops->enable_time) 1191 if (!rdev->desc->ops->enable_time)
1190 return rdev->desc->enable_time; 1192 return rdev->desc->enable_time;
1191 return rdev->desc->ops->enable_time(rdev); 1193 return rdev->desc->ops->enable_time(rdev);
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 7827384680d6..ea4f36f2cbe2 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -23,6 +23,8 @@ static void of_get_regulation_constraints(struct device_node *np,
23 const __be32 *min_uA, *max_uA, *ramp_delay; 23 const __be32 *min_uA, *max_uA, *ramp_delay;
24 struct property *prop; 24 struct property *prop;
25 struct regulation_constraints *constraints = &(*init_data)->constraints; 25 struct regulation_constraints *constraints = &(*init_data)->constraints;
26 int ret;
27 u32 pval;
26 28
27 constraints->name = of_get_property(np, "regulator-name", NULL); 29 constraints->name = of_get_property(np, "regulator-name", NULL);
28 30
@@ -73,6 +75,10 @@ static void of_get_regulation_constraints(struct device_node *np,
73 else 75 else
74 constraints->ramp_disable = true; 76 constraints->ramp_disable = true;
75 } 77 }
78
79 ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval);
80 if (!ret)
81 constraints->enable_time = pval;
76} 82}
77 83
78/** 84/**
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 999b20ce06cf..8108751acb86 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -95,6 +95,7 @@ struct regulator_state {
95 * @initial_state: Suspend state to set by default. 95 * @initial_state: Suspend state to set by default.
96 * @initial_mode: Mode to set at startup. 96 * @initial_mode: Mode to set at startup.
97 * @ramp_delay: Time to settle down after voltage change (unit: uV/us) 97 * @ramp_delay: Time to settle down after voltage change (unit: uV/us)
98 * @enable_time: Turn-on time of the rails (unit: microseconds)
98 */ 99 */
99struct regulation_constraints { 100struct regulation_constraints {
100 101
@@ -129,6 +130,7 @@ struct regulation_constraints {
129 unsigned int initial_mode; 130 unsigned int initial_mode;
130 131
131 unsigned int ramp_delay; 132 unsigned int ramp_delay;
133 unsigned int enable_time;
132 134
133 /* constraint flags */ 135 /* constraint flags */
134 unsigned always_on:1; /* regulator never off when system is on */ 136 unsigned always_on:1; /* regulator never off when system is on */