mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC] regulator: anatop-regulator: Also provide a delay when voltage decreases
@ 2013-12-20 14:48 Fabio Estevam
  2013-12-21 14:22 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2013-12-20 14:48 UTC (permalink / raw)
  To: broonie; +Cc: shawn.guo, b20788, linux-kernel, Fabio Estevam

From: Fabio Estevam <fabio.estevam@freescale.com>

Currently we only wait for a delay for the LDO voltages to settle when it goes
from a lower voltage to a higher one.

Also provide the delay when the opposite transition happens.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Hi Anson/Shawn,

I could not find in the reference manual anywhere that says that the delay
should de done only when the voltage increases.


 drivers/regulator/anatop-regulator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index 7d7c05e..843c5d1 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -70,7 +70,7 @@ static int anatop_regmap_set_voltage_time_sel(struct regulator_dev *reg,
 	int ret = 0;
 
 	/* check whether need to care about LDO ramp up speed */
-	if (anatop_reg->delay_bit_width && new_sel > old_sel) {
+	if (anatop_reg->delay_bit_width) {
 		/*
 		 * the delay for LDO ramp up time is
 		 * based on the register setting, we need
@@ -80,7 +80,7 @@ static int anatop_regmap_set_voltage_time_sel(struct regulator_dev *reg,
 		regmap_read(anatop_reg->anatop, anatop_reg->delay_reg, &val);
 		val = (val >> anatop_reg->delay_bit_shift) &
 			((1 << anatop_reg->delay_bit_width) - 1);
-		ret = (new_sel - old_sel) * (LDO_RAMP_UP_UNIT_IN_CYCLES <<
+		ret = abs(new_sel - old_sel) * (LDO_RAMP_UP_UNIT_IN_CYCLES <<
 			val) / LDO_RAMP_UP_FREQ_IN_MHZ + 1;
 	}
 
-- 
1.8.1.2


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

* Re: [RFC] regulator: anatop-regulator: Also provide a delay when voltage decreases
  2013-12-20 14:48 [RFC] regulator: anatop-regulator: Also provide a delay when voltage decreases Fabio Estevam
@ 2013-12-21 14:22 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-12-21 14:22 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: shawn.guo, b20788, linux-kernel, Fabio Estevam

On Fri, Dec 20, 2013 at 12:48:22PM -0200, Fabio Estevam wrote:

> I could not find in the reference manual anywhere that says that the delay
> should de done only when the voltage increases.

The reason this is normally not done is that generally consumers don't
care too much if the supply is too high but will fail if they get an
undervoltage supply so there's not such a great need to wait.

It can also be hard to tell how quickly the voltage will fall.

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

end of thread, other threads:[~2013-12-21 14:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-20 14:48 [RFC] regulator: anatop-regulator: Also provide a delay when voltage decreases Fabio Estevam
2013-12-21 14:22 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome