Skip to content

Commit

Permalink
regulator: s2mpa01: Fix accidental enable of buck4 ramp delay
Browse files Browse the repository at this point in the history
S2MPA01 supports enabling/disabling ramp delay only for buck[1234].
Other bucks have ramp delay enabled always.

However the bit shift for enabling buck4 ramp delay in register is equal
to 0. When ramp delay was set for the bucks unsupporting enable/disable
(buck[56789] and buck10), the ramp delay for buck4 was also enabled.

Fixes: f7b1a8d ("regulator: s2mpa01: Don't check enable_shift before setting enable ramp rate")
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Krzysztof Kozlowski authored and Mark Brown committed May 17, 2014
1 parent c9eaa44 commit 51e2fc0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions drivers/regulator/s2mpa01.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,15 @@ static int s2mpa01_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
if (!ramp_enable)
goto ramp_disable;

ret = regmap_update_bits(rdev->regmap, S2MPA01_REG_RAMP1,
1 << enable_shift, 1 << enable_shift);
if (ret) {
dev_err(&rdev->dev, "failed to enable ramp rate\n");
return ret;
/* Ramp delay can be enabled/disabled only for buck[1234] */
if (rdev_get_id(rdev) >= S2MPA01_BUCK1 &&
rdev_get_id(rdev) <= S2MPA01_BUCK4) {
ret = regmap_update_bits(rdev->regmap, S2MPA01_REG_RAMP1,
1 << enable_shift, 1 << enable_shift);
if (ret) {
dev_err(&rdev->dev, "failed to enable ramp rate\n");
return ret;
}
}

ramp_val = get_ramp_delay(ramp_delay);
Expand Down

0 comments on commit 51e2fc0

Please sign in to comment.