summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2017-04-04 18:59:50 +0530
committerTao Huang <huangtao@rock-chips.com>2018-03-22 11:14:38 +0800
commit2fbdff89ce2f130650ec54bf68ec772f6d675970 (patch)
treebdadcd2052b1ff28cfd68bf26ee55bd4c90be050 /drivers
parenta21f433fab5625c835de9b47b971bc95d2b6e2b1 (diff)
UPSTREAM: 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. Change-Id: I3b3b8b173beaa3ecbc959b241c791d0816e5b7d2 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Tao Huang <huangtao@rock-chips.com> (cherry picked from commit d6c1dc3f52e3a65f35c58433ba57d14c0bad902f)
Diffstat (limited to 'drivers')
-rw-r--r--drivers/regulator/core.c2
-rw-r--r--drivers/regulator/of_regulator.c4
2 files changed, 6 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 2952da3fa6fe..0b2bb5093e19 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2781,6 +2781,8 @@ static int _regulator_set_voltage_time(struct regulator_dev *rdev,
ramp_delay = rdev->constraints->ramp_delay;
else if (rdev->desc->ramp_delay)
ramp_delay = rdev->desc->ramp_delay;
+ else if (rdev->constraints->settling_time)
+ return rdev->constraints->settling_time;
if (ramp_delay == 0) {
rdev_dbg(rdev, "ramp_delay not set\n");
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index cd828dbf9d52..b67f9d160b7c 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,
constraints->ramp_disable = true;
}
+ ret = of_property_read_u32(np, "regulator-settling-time-us", &pval);
+ if (!ret)
+ constraints->settling_time = pval;
+
ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval);
if (!ret)
constraints->enable_time = pval;