Skip to content

Commit 00c877c

Browse files
ldewanganbroonie
authored andcommitted
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>
1 parent 272b98c commit 00c877c

4 files changed

Lines changed: 15 additions & 0 deletions

File tree

‎Documentation/devicetree/bindings/regulator/regulator.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ Optional properties:
1414
- regulator-ramp-delay: ramp delay for regulator(in uV/uS)
1515
For hardwares which support disabling ramp rate, it should be explicitly
1616
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.
1722

1823
Deprecated properties:
1924
- regulator-compatible: If a regulator chip contains multiple

‎drivers/regulator/core.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
11861186

11871187
static int _regulator_get_enable_time(struct regulator_dev *rdev)
11881188
{
1189+
if (rdev->constraints && rdev->constraints->enable_time)
1190+
return rdev->constraints->enable_time;
11891191
if (!rdev->desc->ops->enable_time)
11901192
return rdev->desc->enable_time;
11911193
return rdev->desc->ops->enable_time(rdev);

‎drivers/regulator/of_regulator.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ static void of_get_regulation_constraints(struct device_node *np,
2323
const __be32 *min_uA, *max_uA, *ramp_delay;
2424
struct property *prop;
2525
struct regulation_constraints *constraints = &(*init_data)->constraints;
26+
int ret;
27+
u32 pval;
2628

2729
constraints->name = of_get_property(np, "regulator-name", NULL);
2830

@@ -73,6 +75,10 @@ static void of_get_regulation_constraints(struct device_node *np,
7375
else
7476
constraints->ramp_disable = true;
7577
}
78+
79+
ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval);
80+
if (!ret)
81+
constraints->enable_time = pval;
7682
}
7783

7884
/**

‎include/linux/regulator/machine.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ struct regulator_state {
9595
* @initial_state: Suspend state to set by default.
9696
* @initial_mode: Mode to set at startup.
9797
* @ramp_delay: Time to settle down after voltage change (unit: uV/us)
98+
* @enable_time: Turn-on time of the rails (unit: microseconds)
9899
*/
99100
struct regulation_constraints {
100101

@@ -129,6 +130,7 @@ struct regulation_constraints {
129130
unsigned int initial_mode;
130131

131132
unsigned int ramp_delay;
133+
unsigned int enable_time;
132134

133135
/* constraint flags */
134136
unsigned always_on:1; /* regulator never off when system is on */

0 commit comments

Comments
 (0)