Skip to contentSkip to conversation

regulator: anatop-regulator: Also provide a delay when voltage decreases

RFC In review Fabio Estevam 2 participants 2 messages Dec 20, 2013 – Dec 21, 2013 Voltage and current regulator framework

lore
Share & tools
lore
#0 lore raw

RFC 1/1 regulator: anatop-regulator: Also provide a delay when voltage decreases

From: Fabio Estevam <[email protected]>

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.

---
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(-)
drivers/regulator/anatop-regulator.c +2 -2
index 7d7c05e..843c5d1 100644
@@ -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;
 	}
 
Signature · 1 line
1.8.1.2
maintainer
#1 lore raw
Quoted 2 lines · Fabio Estevam

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.