linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] regulator: DT: Add properties for asymmetric settling times
@ 2017-05-01 18:37 Matthias Kaehlcke
  2017-05-01 18:37 ` [PATCH v2 2/2] regulator: Allow " Matthias Kaehlcke
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Matthias Kaehlcke @ 2017-05-01 18:37 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Laxman Dewangan, Rob Herring, Mark Rutland
  Cc: linux-kernel, devicetree, Douglas Anderson, Brian Norris,
	Matthias Kaehlcke

Some regulators have different settling times for voltage increases and
decreases. Add DT properties to define separate settling times for up-
and downward voltage changes.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
Changes in v2:
- Moved DT binding doc to separate patch
- Don't remove settling_time property

 Documentation/devicetree/bindings/regulator/regulator.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt b/Documentation/devicetree/bindings/regulator/regulator.txt
index d18edb075e1c..378f6dc8b8bd 100644
--- a/Documentation/devicetree/bindings/regulator/regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/regulator.txt
@@ -24,6 +24,14 @@ Optional properties:
 - regulator-settling-time-us: Settling time, in microseconds, for voltage
   change if regulator have the constant time for any level voltage change.
   This is useful when regulator have exponential voltage change.
+- regulator-settling-time-up-us: Settling time, in microseconds, for voltage
+  increase if the regulator needs a constant time to settle after voltage
+  increases of any level. This is useful for regulators with exponential
+  voltage changes.
+- regulator-settling-time-down-us: Settling time, in microseconds, for voltage
+  decrease if the regulator needs a constant time to settle after voltage
+  decreases of any level. This is useful for regulators with exponential
+  voltage changes.
 - regulator-soft-start: Enable soft start so that voltage ramps slowly
 - regulator-state-mem sub-root node for Suspend-to-RAM mode
   : suspend to memory, the device goes to sleep, but all data stored in memory,
-- 
2.13.0.rc0.306.g87b477812d-goog

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] regulator: Allow for asymmetric settling times
  2017-05-01 18:37 [PATCH v2 1/2] regulator: DT: Add properties for asymmetric settling times Matthias Kaehlcke
@ 2017-05-01 18:37 ` Matthias Kaehlcke
  2017-05-02  6:53   ` Laxman Dewangan
  2017-05-14 10:16   ` Mark Brown
  2017-05-02  6:51 ` [PATCH v2 1/2] regulator: DT: Add properties " Laxman Dewangan
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 8+ messages in thread
From: Matthias Kaehlcke @ 2017-05-01 18:37 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Laxman Dewangan, Rob Herring, Mark Rutland
  Cc: linux-kernel, devicetree, Douglas Anderson, Brian Norris,
	Matthias Kaehlcke

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>
---
Changes in v2:
- Don't remove settling_time property
- Split DT bindings doc into separate patch

 drivers/regulator/core.c          | 6 ++++++
 drivers/regulator/of_regulator.c  | 9 +++++++++
 include/linux/regulator/machine.h | 6 ++++++
 3 files changed, 21 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 811096b23143..7836f07431d8 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2775,6 +2775,12 @@ static int _regulator_set_voltage_time(struct regulator_dev *rdev,
 		ramp_delay = rdev->desc->ramp_delay;
 	else if (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) {
 		rdev_dbg(rdev, "ramp_delay not set\n");
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 09d677d5d3f0..b0a007c349ef 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -90,6 +90,15 @@ static void of_get_regulation_constraints(struct device_node *np,
 	if (!ret)
 		constraints->settling_time = pval;
 
+	ret = of_property_read_u32(np, "regulator-settling-time-up-us", &pval);
+	if (!ret)
+		constraints->settling_time_up = pval;
+
+	ret = of_property_read_u32(np, "regulator-settling-time-down-us",
+				   &pval);
+	if (!ret)
+		constraints->settling_time_down = pval;
+
 	ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval);
 	if (!ret)
 		constraints->enable_time = pval;
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 117699d1f7df..9cd4fef37203 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -110,6 +110,10 @@ struct regulator_state {
  * @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).
+ * @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
  *		      regulator_active_discharge values are used for
  *		      initialisation.
@@ -152,6 +156,8 @@ struct regulation_constraints {
 
 	unsigned int ramp_delay;
 	unsigned int settling_time;
+	unsigned int settling_time_up;
+	unsigned int settling_time_down;
 	unsigned int enable_time;
 
 	unsigned int active_discharge;
-- 
2.13.0.rc0.306.g87b477812d-goog

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/2] regulator: DT: Add properties for asymmetric settling times
  2017-05-01 18:37 [PATCH v2 1/2] regulator: DT: Add properties for asymmetric settling times Matthias Kaehlcke
  2017-05-01 18:37 ` [PATCH v2 2/2] regulator: Allow " Matthias Kaehlcke
@ 2017-05-02  6:51 ` Laxman Dewangan
  2017-05-08 14:08 ` Rob Herring
  2017-05-17  9:53 ` Applied "regulator: DT: Add properties for asymmetric settling times" to the regulator tree Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Laxman Dewangan @ 2017-05-02  6:51 UTC (permalink / raw)
  To: Matthias Kaehlcke, Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland
  Cc: linux-kernel, devicetree, Douglas Anderson, Brian Norris


On Tuesday 02 May 2017 12:07 AM, Matthias Kaehlcke wrote:
> Some regulators have different settling times for voltage increases and
> decreases. Add DT properties to define separate settling times for up-
> and downward voltage changes.
>
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> ---

Acked-by: Laxman Dewangan <ldewangan@nvidia.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] regulator: Allow for asymmetric settling times
  2017-05-01 18:37 ` [PATCH v2 2/2] regulator: Allow " Matthias Kaehlcke
@ 2017-05-02  6:53   ` Laxman Dewangan
  2017-05-14 10:16   ` Mark Brown
  1 sibling, 0 replies; 8+ messages in thread
From: Laxman Dewangan @ 2017-05-02  6:53 UTC (permalink / raw)
  To: Matthias Kaehlcke, Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland
  Cc: linux-kernel, devicetree, Douglas Anderson, Brian Norris


On Tuesday 02 May 2017 12:07 AM, Matthias Kaehlcke wrote:
> 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>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/2] regulator: DT: Add properties for asymmetric settling times
  2017-05-01 18:37 [PATCH v2 1/2] regulator: DT: Add properties for asymmetric settling times Matthias Kaehlcke
  2017-05-01 18:37 ` [PATCH v2 2/2] regulator: Allow " Matthias Kaehlcke
  2017-05-02  6:51 ` [PATCH v2 1/2] regulator: DT: Add properties " Laxman Dewangan
@ 2017-05-08 14:08 ` Rob Herring
  2017-05-17  9:53 ` Applied "regulator: DT: Add properties for asymmetric settling times" to the regulator tree Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2017-05-08 14:08 UTC (permalink / raw)
  To: Matthias Kaehlcke
  Cc: Liam Girdwood, Mark Brown, Laxman Dewangan, Mark Rutland,
	linux-kernel, devicetree, Douglas Anderson, Brian Norris

On Mon, May 01, 2017 at 11:37:14AM -0700, Matthias Kaehlcke wrote:
> Some regulators have different settling times for voltage increases and
> decreases. Add DT properties to define separate settling times for up-
> and downward voltage changes.
> 
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> ---
> Changes in v2:
> - Moved DT binding doc to separate patch
> - Don't remove settling_time property
> 
>  Documentation/devicetree/bindings/regulator/regulator.txt | 8 ++++++++
>  1 file changed, 8 insertions(+)

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] regulator: Allow for asymmetric settling times
  2017-05-01 18:37 ` [PATCH v2 2/2] regulator: Allow " Matthias Kaehlcke
  2017-05-02  6:53   ` Laxman Dewangan
@ 2017-05-14 10:16   ` Mark Brown
  2017-05-15 22:55     ` Matthias Kaehlcke
  1 sibling, 1 reply; 8+ messages in thread
From: Mark Brown @ 2017-05-14 10:16 UTC (permalink / raw)
  To: Matthias Kaehlcke
  Cc: Liam Girdwood, Laxman Dewangan, Rob Herring, Mark Rutland,
	linux-kernel, devicetree, Douglas Anderson, Brian Norris

[-- Attachment #1: Type: text/plain, Size: 707 bytes --]

On Mon, May 01, 2017 at 11:37:15AM -0700, Matthias Kaehlcke wrote:

>  	else if (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;

It feels like we should warn if the user mixes specific up/down settling
times with the more general property, can you please send a followup
patch adding a warning for that?  It's not exactly obvious what the
precedence is and may do the wrong thing with an older kernel or
non-Linux OS.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] regulator: Allow for asymmetric settling times
  2017-05-14 10:16   ` Mark Brown
@ 2017-05-15 22:55     ` Matthias Kaehlcke
  0 siblings, 0 replies; 8+ messages in thread
From: Matthias Kaehlcke @ 2017-05-15 22:55 UTC (permalink / raw)
  To: Mark Brown
  Cc: Liam Girdwood, Laxman Dewangan, Rob Herring, Mark Rutland,
	linux-kernel, devicetree, Douglas Anderson, Brian Norris

El Sun, May 14, 2017 at 07:16:52PM +0900 Mark Brown ha dit:

> On Mon, May 01, 2017 at 11:37:15AM -0700, Matthias Kaehlcke wrote:
> 
> >  	else if (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;
> 
> It feels like we should warn if the user mixes specific up/down settling
> times with the more general property, can you please send a followup
> patch adding a warning for that?  It's not exactly obvious what the
> precedence is and may do the wrong thing with an older kernel or
> non-Linux OS.

Sounds good. I'll send out the patch soon.

Thanks

Matthias

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Applied "regulator: DT: Add properties for asymmetric settling times" to the regulator tree
  2017-05-01 18:37 [PATCH v2 1/2] regulator: DT: Add properties for asymmetric settling times Matthias Kaehlcke
                   ` (2 preceding siblings ...)
  2017-05-08 14:08 ` Rob Herring
@ 2017-05-17  9:53 ` Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2017-05-17  9:53 UTC (permalink / raw)
  To: Matthias Kaehlcke
  Cc: Laxman Dewangan, Rob Herring, Mark Brown, Liam Girdwood,
	Mark Brown, Laxman Dewangan, Rob Herring, Mark Rutland,
	linux-kernel, devicetree, Douglas Anderson, Brian Norris,
	linux-kernel

The patch

   regulator: DT: Add properties for asymmetric settling times

has been applied to the regulator tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 543853de356b8ce95d6d99757501d9d5c916ca09 Mon Sep 17 00:00:00 2001
From: Matthias Kaehlcke <mka@chromium.org>
Date: Tue, 16 May 2017 11:43:42 -0700
Subject: [PATCH] regulator: DT: Add properties for asymmetric settling times

Some regulators have different settling times for voltage increases and
decreases. Add DT properties to define separate settling times for up-
and downward voltage changes.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 Documentation/devicetree/bindings/regulator/regulator.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt b/Documentation/devicetree/bindings/regulator/regulator.txt
index d18edb075e1c..378f6dc8b8bd 100644
--- a/Documentation/devicetree/bindings/regulator/regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/regulator.txt
@@ -24,6 +24,14 @@ Optional properties:
 - regulator-settling-time-us: Settling time, in microseconds, for voltage
   change if regulator have the constant time for any level voltage change.
   This is useful when regulator have exponential voltage change.
+- regulator-settling-time-up-us: Settling time, in microseconds, for voltage
+  increase if the regulator needs a constant time to settle after voltage
+  increases of any level. This is useful for regulators with exponential
+  voltage changes.
+- regulator-settling-time-down-us: Settling time, in microseconds, for voltage
+  decrease if the regulator needs a constant time to settle after voltage
+  decreases of any level. This is useful for regulators with exponential
+  voltage changes.
 - regulator-soft-start: Enable soft start so that voltage ramps slowly
 - regulator-state-mem sub-root node for Suspend-to-RAM mode
   : suspend to memory, the device goes to sleep, but all data stored in memory,
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-05-17  9:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-01 18:37 [PATCH v2 1/2] regulator: DT: Add properties for asymmetric settling times Matthias Kaehlcke
2017-05-01 18:37 ` [PATCH v2 2/2] regulator: Allow " Matthias Kaehlcke
2017-05-02  6:53   ` Laxman Dewangan
2017-05-14 10:16   ` Mark Brown
2017-05-15 22:55     ` Matthias Kaehlcke
2017-05-02  6:51 ` [PATCH v2 1/2] regulator: DT: Add properties " Laxman Dewangan
2017-05-08 14:08 ` Rob Herring
2017-05-17  9:53 ` Applied "regulator: DT: Add properties for asymmetric settling times" to the regulator tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).