Skip to contentSkip to conversation

regulator: tps62360: Fix off-by-one shift for ramp_ctrl

PATCH Applied Axel Lin 3 participants 3 messages Apr 23, 2013 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: tps62360: Fix off-by-one shift for ramp_ctrl

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

---
 drivers/regulator/tps62360-regulator.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/tps62360-regulator.c +1 -1
index acbd63f..612919c 100644
@@ -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));
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Axel Lin

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
Quoted 4 lines

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

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

Checked with my latest and it is correct.

maintainer Applied
#2 lore raw
In reply to Axel Lin
Quoted 4 lines · Axel Lin

According to the datasheet[1]

Register 0x06h Description: RmpCtrl (REGISTER ADDRESS: 0x06h Read/Write) BIT[5..7]:

Applied, thanks.