diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2017-04-04 09:29:50 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-04-05 13:25:10 -0400 |
commit | d6c1dc3f52e3a65f35c58433ba57d14c0bad902f (patch) | |
tree | 9b0d994afe52df7445db81c207fe922842d6f1c4 | |
parent | cfd2cedb482ae29ce13a3db46cc24f0c082ca9cf (diff) |
regulator: Add settling time for non-linear voltage transition
Some regulators (some PWM regulators) have the voltage transition
non-linear i.e. exponentially. On such cases, the settling time
for voltage transition can not be presented in the voltage-ramp-delay.
Add new property for non-linear voltage transition and handle this
in getting the voltage settling time.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | drivers/regulator/core.c | 2 | ||||
-rw-r--r-- | drivers/regulator/of_regulator.c | 4 | ||||
-rw-r--r-- | include/linux/regulator/machine.h | 3 |
3 files changed, 9 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 04baac9a165b..3a641d64f8e1 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -2753,6 +2753,8 @@ static int _regulator_set_voltage_time(struct regulator_dev *rdev, | |||
2753 | ramp_delay = rdev->constraints->ramp_delay; | 2753 | ramp_delay = rdev->constraints->ramp_delay; |
2754 | else if (rdev->desc->ramp_delay) | 2754 | else if (rdev->desc->ramp_delay) |
2755 | ramp_delay = rdev->desc->ramp_delay; | 2755 | ramp_delay = rdev->desc->ramp_delay; |
2756 | else if (rdev->constraints->settling_time) | ||
2757 | return rdev->constraints->settling_time; | ||
2756 | 2758 | ||
2757 | if (ramp_delay == 0) { | 2759 | if (ramp_delay == 0) { |
2758 | rdev_dbg(rdev, "ramp_delay not set\n"); | 2760 | rdev_dbg(rdev, "ramp_delay not set\n"); |
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 4f613ec99500..09d677d5d3f0 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c | |||
@@ -86,6 +86,10 @@ static void of_get_regulation_constraints(struct device_node *np, | |||
86 | constraints->ramp_disable = true; | 86 | constraints->ramp_disable = true; |
87 | } | 87 | } |
88 | 88 | ||
89 | ret = of_property_read_u32(np, "regulator-settling-time-us", &pval); | ||
90 | if (!ret) | ||
91 | constraints->settling_time = pval; | ||
92 | |||
89 | ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval); | 93 | ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval); |
90 | if (!ret) | 94 | if (!ret) |
91 | constraints->enable_time = pval; | 95 | constraints->enable_time = pval; |
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index ad3e5158e586..598a493b3927 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h | |||
@@ -108,6 +108,8 @@ struct regulator_state { | |||
108 | * @initial_state: Suspend state to set by default. | 108 | * @initial_state: Suspend state to set by default. |
109 | * @initial_mode: Mode to set at startup. | 109 | * @initial_mode: Mode to set at startup. |
110 | * @ramp_delay: Time to settle down after voltage change (unit: uV/us) | 110 | * @ramp_delay: Time to settle down after voltage change (unit: uV/us) |
111 | * @settling_time: Time to settle down after voltage change when voltage | ||
112 | * change is non-linear (unit: microseconds). | ||
111 | * @active_discharge: Enable/disable active discharge. The enum | 113 | * @active_discharge: Enable/disable active discharge. The enum |
112 | * regulator_active_discharge values are used for | 114 | * regulator_active_discharge values are used for |
113 | * initialisation. | 115 | * initialisation. |
@@ -149,6 +151,7 @@ struct regulation_constraints { | |||
149 | unsigned int initial_mode; | 151 | unsigned int initial_mode; |
150 | 152 | ||
151 | unsigned int ramp_delay; | 153 | unsigned int ramp_delay; |
154 | unsigned int settling_time; | ||
152 | unsigned int enable_time; | 155 | unsigned int enable_time; |
153 | 156 | ||
154 | unsigned int active_discharge; | 157 | unsigned int active_discharge; |