diff options
author | Krzysztof Kozlowski <k.kozlowski@samsung.com> | 2014-10-29 07:14:52 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-10-31 08:42:52 -0400 |
commit | 78ce612860ce80edbec9171b4a786ce131a9631c (patch) | |
tree | 2045b94a7aa9ed8af775b90dde80ccd260c9ceb6 | |
parent | 68c5d1868bfed0643eb4d2c608cead41f6bf4132 (diff) |
regulator: max77686: Add suspend disable for some LDOs
Some LDOs of Maxim 77686 PMIC support disabling during system suspend
(LDO{2,6,7,8,10,11,12,14,15,16}). This was already implemented as part
of set_suspend_mode function. In that case the mode was one of:
- disable,
- normal mode,
- low power mode.
However there are no bindings for setting the mode during suspend.
Add suspend disable for LDO regulators supporting this. Re-use existing
max77686_buck_set_suspend_disable() function. This helps reducing
energy consumption during system sleep.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | drivers/regulator/max77686.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c index 0c1541754e8c..09b0d8c20a9d 100644 --- a/drivers/regulator/max77686.c +++ b/drivers/regulator/max77686.c | |||
@@ -99,8 +99,8 @@ static unsigned int max77686_get_opmode_shift(int id) | |||
99 | } | 99 | } |
100 | } | 100 | } |
101 | 101 | ||
102 | /* Some BUCKS supports Normal[ON/OFF] mode during suspend */ | 102 | /* Some BUCKs and LDOs supports Normal[ON/OFF] mode during suspend */ |
103 | static int max77686_buck_set_suspend_disable(struct regulator_dev *rdev) | 103 | static int max77686_set_suspend_disable(struct regulator_dev *rdev) |
104 | { | 104 | { |
105 | unsigned int val, shift; | 105 | unsigned int val, shift; |
106 | struct max77686_data *max77686 = rdev_get_drvdata(rdev); | 106 | struct max77686_data *max77686 = rdev_get_drvdata(rdev); |
@@ -195,6 +195,9 @@ static int max77686_enable(struct regulator_dev *rdev) | |||
195 | 195 | ||
196 | shift = max77686_get_opmode_shift(id); | 196 | shift = max77686_get_opmode_shift(id); |
197 | 197 | ||
198 | if (max77686->opmode[id] == MAX77686_OFF_PWRREQ) | ||
199 | max77686->opmode[id] = MAX77686_NORMAL; | ||
200 | |||
198 | return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, | 201 | return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, |
199 | rdev->desc->enable_mask, | 202 | rdev->desc->enable_mask, |
200 | max77686->opmode[id] << shift); | 203 | max77686->opmode[id] << shift); |
@@ -247,6 +250,7 @@ static struct regulator_ops max77686_ldo_ops = { | |||
247 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 250 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
248 | .set_voltage_time_sel = regulator_set_voltage_time_sel, | 251 | .set_voltage_time_sel = regulator_set_voltage_time_sel, |
249 | .set_suspend_mode = max77686_ldo_set_suspend_mode, | 252 | .set_suspend_mode = max77686_ldo_set_suspend_mode, |
253 | .set_suspend_disable = max77686_set_suspend_disable, | ||
250 | }; | 254 | }; |
251 | 255 | ||
252 | static struct regulator_ops max77686_buck1_ops = { | 256 | static struct regulator_ops max77686_buck1_ops = { |
@@ -258,7 +262,7 @@ static struct regulator_ops max77686_buck1_ops = { | |||
258 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 262 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
259 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 263 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
260 | .set_voltage_time_sel = regulator_set_voltage_time_sel, | 264 | .set_voltage_time_sel = regulator_set_voltage_time_sel, |
261 | .set_suspend_disable = max77686_buck_set_suspend_disable, | 265 | .set_suspend_disable = max77686_set_suspend_disable, |
262 | }; | 266 | }; |
263 | 267 | ||
264 | static struct regulator_ops max77686_buck_dvs_ops = { | 268 | static struct regulator_ops max77686_buck_dvs_ops = { |
@@ -271,7 +275,7 @@ static struct regulator_ops max77686_buck_dvs_ops = { | |||
271 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 275 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
272 | .set_voltage_time_sel = regulator_set_voltage_time_sel, | 276 | .set_voltage_time_sel = regulator_set_voltage_time_sel, |
273 | .set_ramp_delay = max77686_set_ramp_delay, | 277 | .set_ramp_delay = max77686_set_ramp_delay, |
274 | .set_suspend_disable = max77686_buck_set_suspend_disable, | 278 | .set_suspend_disable = max77686_set_suspend_disable, |
275 | }; | 279 | }; |
276 | 280 | ||
277 | #define regulator_desc_ldo(num) { \ | 281 | #define regulator_desc_ldo(num) { \ |