regulator: palmas: Fix off-by-one for ramp_delay and register value mapping
authorAxel Lin <[email protected]>
Mon, 22 Apr 2013 10:22:49 +0000 (18:22 +0800)
committerMark Brown <[email protected]>
Mon, 22 Apr 2013 12:34:42 +0000 (13:34 +0100)
Datasheet says:
Time Step (TSTEP) selection, when changing the output voltage, the new value is
reached through successive voltage steps (if not bypassed). The equivalent
programmable slew rate of the output voltage is:

TSTEP[1:0]: 00 Jump (no slope control)
TSTEP[1:0]: 01 10mV/us
TSTEP[1:0]: 10 5mV/us (default)
TSTEP[1:0]: 11 2.5mV/us

Signed-off-by: Axel Lin <[email protected]>
Acked-by: Laxman Dewangan <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
drivers/regulator/palmas-regulator.c

index 552ed514ba25c88f18afec07389d40541f984583..1be9c3216974fed7683531337311f79a3fd7fdaa 100644 (file)
@@ -447,9 +447,9 @@ static int palmas_smps_set_ramp_delay(struct regulator_dev *rdev,
 
        if (ramp_delay <= 0)
                reg = 0;
-       else if (ramp_delay < 2500)
+       else if (ramp_delay <= 2500)
                reg = 3;
-       else if (ramp_delay < 5000)
+       else if (ramp_delay <= 5000)
                reg = 2;
        else
                reg = 1;