mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: broonie@kernel.org
Cc: shawn.guo@linaro.org, b20788@freescale.com,
	linux-kernel@vger.kernel.org,
	Fabio Estevam <fabio.estevam@freescale.com>
Subject: [RFC] regulator: anatop-regulator: Also provide a delay when voltage decreases
Date: Fri, 20 Dec 2013 12:48:22 -0200	[thread overview]
Message-ID: <1387550902-6086-1-git-send-email-festevam@gmail.com> (raw)

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


             reply	other threads:[~2013-12-20 14:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-20 14:48 Fabio Estevam [this message]
2013-12-21 14:22 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1387550902-6086-1-git-send-email-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=b20788@freescale.com \
    --cc=broonie@kernel.org \
    --cc=fabio.estevam@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shawn.guo@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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