summaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>2014-05-06 08:37:37 +0200
committerMark Brown <broonie@linaro.org>2014-05-17 14:28:09 +0100
commit51e2fc0a251ba64c68207e4c6f6ac33c891b2465 (patch)
tree8f6870b1112fa6a6b0a4c751bdde3f6cb25dc7de /drivers/regulator
parentc9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff)
downloadlinux-51e2fc0a251ba64c68207e4c6f6ac33c891b2465.tar.gz
linux-51e2fc0a251ba64c68207e4c6f6ac33c891b2465.tar.bz2
linux-51e2fc0a251ba64c68207e4c6f6ac33c891b2465.zip
regulator: s2mpa01: Fix accidental enable of buck4 ramp delay
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: f7b1a8dc1c1c ("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>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/s2mpa01.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/regulator/s2mpa01.c b/drivers/regulator/s2mpa01.c
index f19a30f0fb42..cab1a2b9efc5 100644
--- a/drivers/regulator/s2mpa01.c
+++ b/drivers/regulator/s2mpa01.c
@@ -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);