Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1410035 > unrolled thread

[PATCH RFT] regulator: tps51632: Fix setting ramp delay

Started byAxel Lin <axel.lin@ingics.com>
First post2016-05-31 11:30 +0200
Last post2016-05-31 19:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH RFT] regulator: tps51632: Fix setting ramp delay Axel Lin <axel.lin@ingics.com> - 2016-05-31 11:30 +0200
    Re: [PATCH RFT] regulator: tps51632: Fix setting ramp delay Laxman Dewangan <ldewangan@nvidia.com> - 2016-05-31 13:40 +0200
    Applied "regulator: tps51632: Fix setting ramp delay" to the regulator tree Mark Brown <broonie@kernel.org> - 2016-05-31 19:50 +0200

#1410035 — [PATCH RFT] regulator: tps51632: Fix setting ramp delay

FromAxel Lin <axel.lin@ingics.com>
Date2016-05-31 11:30 +0200
Subject[PATCH RFT] regulator: tps51632: Fix setting ramp delay
Message-ID<rEO9Q-Rc-21@gated-at.bofh.it>
According to the datasheet:

SLEW Register(Address = 07h)
b7      b6      b5      b4      b3      b2      b1      b0
48mV/us 42mV/us 36mV/us 30mV/us 24mV/us 18mV/us 12mV/us 6mV/us

Current code does not set correct slew rate in some cases:
e.g. Assume ramp_delay is 10000, current code sets slew register to 6mV/us.
Fix the logic to set slew register.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/tps51632-regulator.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/tps51632-regulator.c b/drivers/regulator/tps51632-regulator.c
index 572816e..c139890 100644
--- a/drivers/regulator/tps51632-regulator.c
+++ b/drivers/regulator/tps51632-regulator.c
@@ -94,11 +94,14 @@ static int tps51632_dcdc_set_ramp_delay(struct regulator_dev *rdev,
 		int ramp_delay)
 {
 	struct tps51632_chip *tps = rdev_get_drvdata(rdev);
-	int bit = ramp_delay/6000;
+	int bit;
 	int ret;
 
-	if (bit)
-		bit--;
+	if (ramp_delay == 0)
+		bit = 0;
+	else
+		bit = DIV_ROUND_UP(ramp_delay, 6000) - 1;
+
 	ret = regmap_write(tps->regmap, TPS51632_SLEW_REGS, BIT(bit));
 	if (ret < 0)
 		dev_err(tps->dev, "SLEW reg write failed, err %d\n", ret);
-- 
2.5.0

[toc] | [next] | [standalone]


#1410187

FromLaxman Dewangan <ldewangan@nvidia.com>
Date2016-05-31 13:40 +0200
Message-ID<rEQbE-27e-7@gated-at.bofh.it>
In reply to#1410035
On Tuesday 31 May 2016 02:56 PM, Axel Lin wrote:
> According to the datasheet:
>
> SLEW Register(Address = 07h)
> b7      b6      b5      b4      b3      b2      b1      b0
> 48mV/us 42mV/us 36mV/us 30mV/us 24mV/us 18mV/us 12mV/us 6mV/us
>
> Current code does not set correct slew rate in some cases:
> e.g. Assume ramp_delay is 10000, current code sets slew register to 6mV/us.
> Fix the logic to set slew register.
>

Setting register to nearest faster ramp side, the change looks fine.

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

[toc] | [prev] | [next] | [standalone]


#1410499 — Applied "regulator: tps51632: Fix setting ramp delay" to the regulator tree

FromMark Brown <broonie@kernel.org>
Date2016-05-31 19:50 +0200
SubjectApplied "regulator: tps51632: Fix setting ramp delay" to the regulator tree
Message-ID<rEVXI-5Js-27@gated-at.bofh.it>
In reply to#1410035
The patch

   regulator: tps51632: Fix setting ramp delay

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 c714a588fc39dc8c8f70014f5691217717983fb3 Mon Sep 17 00:00:00 2001
From: Axel Lin <axel.lin@ingics.com>
Date: Tue, 31 May 2016 17:26:00 +0800
Subject: [PATCH] regulator: tps51632: Fix setting ramp delay

According to the datasheet:

SLEW Register(Address = 07h)
b7      b6      b5      b4      b3      b2      b1      b0
48mV/us 42mV/us 36mV/us 30mV/us 24mV/us 18mV/us 12mV/us 6mV/us

Current code does not set correct slew rate in some cases:
e.g. Assume ramp_delay is 10000, current code sets slew register to 6mV/us.
Fix the logic to set slew register.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/regulator/tps51632-regulator.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/tps51632-regulator.c b/drivers/regulator/tps51632-regulator.c
index 572816e30095..c139890c1514 100644
--- a/drivers/regulator/tps51632-regulator.c
+++ b/drivers/regulator/tps51632-regulator.c
@@ -94,11 +94,14 @@ static int tps51632_dcdc_set_ramp_delay(struct regulator_dev *rdev,
 		int ramp_delay)
 {
 	struct tps51632_chip *tps = rdev_get_drvdata(rdev);
-	int bit = ramp_delay/6000;
+	int bit;
 	int ret;
 
-	if (bit)
-		bit--;
+	if (ramp_delay == 0)
+		bit = 0;
+	else
+		bit = DIV_ROUND_UP(ramp_delay, 6000) - 1;
+
 	ret = regmap_write(tps->regmap, TPS51632_SLEW_REGS, BIT(bit));
 	if (ret < 0)
 		dev_err(tps->dev, "SLEW reg write failed, err %d\n", ret);
-- 
2.8.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web