Commit 3ffad468 authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Mark Brown

regulator: Allow for asymmetric settling times

Some regulators have different settling times for voltage increases and
decreases. To avoid a time penalty on the faster transition allow for
different settings for up- and downward transitions.
Signed-off-by: default avatarMatthias Kaehlcke <mka@chromium.org>
Acked-by: default avatarLaxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 543853de
...@@ -2767,6 +2767,12 @@ static int _regulator_set_voltage_time(struct regulator_dev *rdev, ...@@ -2767,6 +2767,12 @@ static int _regulator_set_voltage_time(struct regulator_dev *rdev,
ramp_delay = rdev->desc->ramp_delay; ramp_delay = rdev->desc->ramp_delay;
else if (rdev->constraints->settling_time) else if (rdev->constraints->settling_time)
return rdev->constraints->settling_time; return rdev->constraints->settling_time;
else if (rdev->constraints->settling_time_up &&
(new_uV > old_uV))
return rdev->constraints->settling_time_up;
else if (rdev->constraints->settling_time_down &&
(new_uV < old_uV))
return rdev->constraints->settling_time_down;
if (ramp_delay == 0) { if (ramp_delay == 0) {
rdev_dbg(rdev, "ramp_delay not set\n"); rdev_dbg(rdev, "ramp_delay not set\n");
......
...@@ -90,6 +90,25 @@ static void of_get_regulation_constraints(struct device_node *np, ...@@ -90,6 +90,25 @@ static void of_get_regulation_constraints(struct device_node *np,
if (!ret) if (!ret)
constraints->settling_time = pval; constraints->settling_time = pval;
ret = of_property_read_u32(np, "regulator-settling-time-up-us", &pval);
if (!ret)
constraints->settling_time_up = pval;
if (constraints->settling_time_up && constraints->settling_time) {
pr_warn("%s: ambiguous configuration for settling time, ignoring 'regulator-settling-time-up-us'\n",
np->name);
constraints->settling_time_up = 0;
}
ret = of_property_read_u32(np, "regulator-settling-time-down-us",
&pval);
if (!ret)
constraints->settling_time_down = pval;
if (constraints->settling_time_down && constraints->settling_time) {
pr_warn("%s: ambiguous configuration for settling time, ignoring 'regulator-settling-time-down-us'\n",
np->name);
constraints->settling_time_down = 0;
}
ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval); ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval);
if (!ret) if (!ret)
constraints->enable_time = pval; constraints->enable_time = pval;
......
...@@ -110,6 +110,10 @@ struct regulator_state { ...@@ -110,6 +110,10 @@ struct regulator_state {
* @ramp_delay: Time to settle down after voltage change (unit: uV/us) * @ramp_delay: Time to settle down after voltage change (unit: uV/us)
* @settling_time: Time to settle down after voltage change when voltage * @settling_time: Time to settle down after voltage change when voltage
* change is non-linear (unit: microseconds). * change is non-linear (unit: microseconds).
* @settling_time_up: Time to settle down after voltage increase when voltage
* change is non-linear (unit: microseconds).
* @settling_time_down : Time to settle down after voltage decrease when
* voltage change is non-linear (unit: microseconds).
* @active_discharge: Enable/disable active discharge. The enum * @active_discharge: Enable/disable active discharge. The enum
* regulator_active_discharge values are used for * regulator_active_discharge values are used for
* initialisation. * initialisation.
...@@ -152,6 +156,8 @@ struct regulation_constraints { ...@@ -152,6 +156,8 @@ struct regulation_constraints {
unsigned int ramp_delay; unsigned int ramp_delay;
unsigned int settling_time; unsigned int settling_time;
unsigned int settling_time_up;
unsigned int settling_time_down;
unsigned int enable_time; unsigned int enable_time;
unsigned int active_discharge; unsigned int active_discharge;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment