Skip to contentSkip to conversation

regulator: anatop: improve precision of delay time

PATCH New Shawn Guo 3 participants 3 messages Feb 4, 2013 – Feb 8, 2013 Voltage and current regulator framework

lore
Share & tools
lore

Shawn Guo

author
#0 lore raw

PATCH 1/1 regulator: anatop: improve precision of delay time

For cpufreq example, it takes 13 steps (25 mV for one step) to increase vddcore from 0.95 V to 1.275 V, and the time of 64 clock cycles at 24 MHz for one step is ~2.67 uS, so the total delay time would be ~34.71 uS. But the current calculation in the driver gives 39 uS. Change the formula to have the addition of 1 be the last step, so that we can get a more precise delay time. For example above, the new formula will give 35 uS.

---
 drivers/regulator/anatop-regulator.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/regulator/anatop-regulator.c +2 -2
index 0df9c6a..0d4a8cc 100644
@@ -80,8 +80,8 @@ 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 <<
-			val) / LDO_RAMP_UP_FREQ_IN_MHZ + 1);
+		ret = (new_sel - old_sel) * (LDO_RAMP_UP_UNIT_IN_CYCLES <<
+			val) / LDO_RAMP_UP_FREQ_IN_MHZ + 1;
 	}
 
 	return ret;
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 regulator: anatop: improve precision of delay time

Quoted 18 lines · Shawn Guo

For cpufreq example, it takes 13 steps (25 mV for one step) to increase vddcore from 0.95 V to 1.275 V, and the time of 64 clock cycles at 24 MHz for one step is ~2.67 uS, so the total delay time would be ~34.71 uS. But the current calculation in the driver gives 39 uS. Change the formula to have the addition of 1 be the last step, so that we can get a more precise delay time. For example above, the new formula will give 35 uS.

---
 drivers/regulator/anatop-regulator.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/regulator/anatop-regulator.c +0 -0
index 0df9c6a..0d4a8cc 100644

drivers/regulator/anatop-regulator.c static int anatop_regmap_set_voltage_time_sel(struct regulator_dev *reg, · line 84

Quoted 7 lines
drivers/regulator/anatop-regulator.c +2 -2
@@ -80,8 +80,8 @@ 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 <<
-			val) / LDO_RAMP_UP_FREQ_IN_MHZ + 1);
+		ret = (new_sel - old_sel) * (LDO_RAMP_UP_UNIT_IN_CYCLES <<
+			val) / LDO_RAMP_UP_FREQ_IN_MHZ + 1;

Agreed that this formula will make the udelay more precise, the previous formula is considering a program model for udelay margin(the biggest margin is about 9us), maybe we don't need so big margin, 1us may be enough, as the hardware design of this step time is already very conservative.

Quoted 6 lines
drivers/regulator/anatop-regulator.c +0 -0
 	}
 
 	return ret;
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/1 regulator: anatop: improve precision of delay time

In reply to Shawn Guo
Quoted 7 lines · Shawn Guo

For cpufreq example, it takes 13 steps (25 mV for one step) to increase vddcore from 0.95 V to 1.275 V, and the time of 64 clock cycles at 24 MHz for one step is ~2.67 uS, so the total delay time would be ~34.71 uS. But the current calculation in the driver gives 39 uS. Change the formula to have the addition of 1 be the last step, so that we can get a more precise delay time. For example above, the new formula will give 35 uS.

Applied, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130208/71daea00/attachment.sig>