public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: tps62360: Fix off-by-one shift for ramp_ctrl
@ 2013-04-23  4:35 Axel Lin
  2013-04-23  6:18 ` Laxman Dewangan
  2013-04-23 10:26 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2013-04-23  4:35 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, linux-kernel, Laxman Dewangan

According to the datasheet[1]

Register 0x06h Description: RmpCtrl (REGISTER ADDRESS: 0x06h Read/Write)
BIT[5..7]:
        RMP[2:0] Output voltage ramp timing
        D7-D5   Slope
        000     32mV/us
        001     16mV/us
        010     8mV/us
        ...
        110     0.5mV/us
        111     0.25mV/us

Thus to get correct ramp_ctrl value, we need to right-shift 5 bits.

[1] http://www.ti.com/lit/ds/symlink/tps62360.pdf

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/tps62360-regulator.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/tps62360-regulator.c b/drivers/regulator/tps62360-regulator.c
index acbd63f..612919c 100644
--- a/drivers/regulator/tps62360-regulator.c
+++ b/drivers/regulator/tps62360-regulator.c
@@ -278,7 +278,7 @@ static int tps62360_init_dcdc(struct tps62360_chip *tps,
 			__func__, REG_RAMPCTRL, ret);
 		return ret;
 	}
-	ramp_ctrl = (ramp_ctrl >> 4) & 0x7;
+	ramp_ctrl = (ramp_ctrl >> 5) & 0x7;
 
 	/* ramp mV/us = 32/(2^ramp_ctrl) */
 	tps->desc.ramp_delay = DIV_ROUND_UP(32000, BIT(ramp_ctrl));
-- 
1.7.10.4




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

end of thread, other threads:[~2013-04-23 10:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-23  4:35 [PATCH] regulator: tps62360: Fix off-by-one shift for ramp_ctrl Axel Lin
2013-04-23  6:18 ` Laxman Dewangan
2013-04-23 10:26 ` Mark Brown

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