Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Matthias Kaehlcke <mka@chromium.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Matthias Kaehlcke and committed by
Mark Brown
3ffad468 543853de

+31
+6
drivers/regulator/core.c
··· 2767 2767 ramp_delay = rdev->desc->ramp_delay; 2768 2768 else if (rdev->constraints->settling_time) 2769 2769 return rdev->constraints->settling_time; 2770 + else if (rdev->constraints->settling_time_up && 2771 + (new_uV > old_uV)) 2772 + return rdev->constraints->settling_time_up; 2773 + else if (rdev->constraints->settling_time_down && 2774 + (new_uV < old_uV)) 2775 + return rdev->constraints->settling_time_down; 2770 2776 2771 2777 if (ramp_delay == 0) { 2772 2778 rdev_dbg(rdev, "ramp_delay not set\n");
+19
drivers/regulator/of_regulator.c
··· 90 90 if (!ret) 91 91 constraints->settling_time = pval; 92 92 93 + ret = of_property_read_u32(np, "regulator-settling-time-up-us", &pval); 94 + if (!ret) 95 + constraints->settling_time_up = pval; 96 + if (constraints->settling_time_up && constraints->settling_time) { 97 + pr_warn("%s: ambiguous configuration for settling time, ignoring 'regulator-settling-time-up-us'\n", 98 + np->name); 99 + constraints->settling_time_up = 0; 100 + } 101 + 102 + ret = of_property_read_u32(np, "regulator-settling-time-down-us", 103 + &pval); 104 + if (!ret) 105 + constraints->settling_time_down = pval; 106 + if (constraints->settling_time_down && constraints->settling_time) { 107 + pr_warn("%s: ambiguous configuration for settling time, ignoring 'regulator-settling-time-down-us'\n", 108 + np->name); 109 + constraints->settling_time_down = 0; 110 + } 111 + 93 112 ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval); 94 113 if (!ret) 95 114 constraints->enable_time = pval;
+6
include/linux/regulator/machine.h
··· 110 110 * @ramp_delay: Time to settle down after voltage change (unit: uV/us) 111 111 * @settling_time: Time to settle down after voltage change when voltage 112 112 * change is non-linear (unit: microseconds). 113 + * @settling_time_up: Time to settle down after voltage increase when voltage 114 + * change is non-linear (unit: microseconds). 115 + * @settling_time_down : Time to settle down after voltage decrease when 116 + * voltage change is non-linear (unit: microseconds). 113 117 * @active_discharge: Enable/disable active discharge. The enum 114 118 * regulator_active_discharge values are used for 115 119 * initialisation. ··· 156 152 157 153 unsigned int ramp_delay; 158 154 unsigned int settling_time; 155 + unsigned int settling_time_up; 156 + unsigned int settling_time_down; 159 157 unsigned int enable_time; 160 158 161 159 unsigned int active_discharge;