]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
regulator: Add settling time for non-linear voltage transition
authorLaxman Dewangan <ldewangan@nvidia.com>
Tue, 4 Apr 2017 13:29:50 +0000 (18:59 +0530)
committerMark Brown <broonie@kernel.org>
Wed, 5 Apr 2017 17:25:10 +0000 (18:25 +0100)
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>
drivers/regulator/core.c
drivers/regulator/of_regulator.c
include/linux/regulator/machine.h

index 04baac9a165bbb56da292a51d0a56055947861e0..3a641d64f8e1ac84e002e2adf37ab37a3fb04b13 100644 (file)
@@ -2753,6 +2753,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");
index 4f613ec995004dc04aa62bef738091bdaf38093d..09d677d5d3f02b6dea295c8379df2cc03d8e8577 100644 (file)
@@ -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;
index ad3e5158e586dc841e9cd37492ec7104d60e7a81..598a493b39270e555dab9f52bd9e83205bcf085e 100644 (file)
@@ -108,6 +108,8 @@ struct regulator_state {
  * @initial_state: Suspend state to set by default.
  * @initial_mode: Mode to set at startup.
  * @ramp_delay: Time to settle down after voltage change (unit: uV/us)
+ * @settling_time: Time to settle down after voltage change when voltage
+ *                change is non-linear (unit: microseconds).
  * @active_discharge: Enable/disable active discharge. The enum
  *                   regulator_active_discharge values are used for
  *                   initialisation.
@@ -149,6 +151,7 @@ struct regulation_constraints {
        unsigned int initial_mode;
 
        unsigned int ramp_delay;
+       unsigned int settling_time;
        unsigned int enable_time;
 
        unsigned int active_discharge;