提交 78ce6128 编写于 作者: K Krzysztof Kozlowski 提交者: Mark Brown

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: NKrzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: NJavier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 68c5d186
...@@ -99,8 +99,8 @@ static unsigned int max77686_get_opmode_shift(int id) ...@@ -99,8 +99,8 @@ static unsigned int max77686_get_opmode_shift(int id)
} }
} }
/* Some BUCKS supports Normal[ON/OFF] mode during suspend */ /* Some BUCKs and LDOs supports Normal[ON/OFF] mode during suspend */
static int max77686_buck_set_suspend_disable(struct regulator_dev *rdev) static int max77686_set_suspend_disable(struct regulator_dev *rdev)
{ {
unsigned int val, shift; unsigned int val, shift;
struct max77686_data *max77686 = rdev_get_drvdata(rdev); struct max77686_data *max77686 = rdev_get_drvdata(rdev);
...@@ -195,6 +195,9 @@ static int max77686_enable(struct regulator_dev *rdev) ...@@ -195,6 +195,9 @@ static int max77686_enable(struct regulator_dev *rdev)
shift = max77686_get_opmode_shift(id); shift = max77686_get_opmode_shift(id);
if (max77686->opmode[id] == MAX77686_OFF_PWRREQ)
max77686->opmode[id] = MAX77686_NORMAL;
return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
rdev->desc->enable_mask, rdev->desc->enable_mask,
max77686->opmode[id] << shift); max77686->opmode[id] << shift);
...@@ -247,6 +250,7 @@ static struct regulator_ops max77686_ldo_ops = { ...@@ -247,6 +250,7 @@ static struct regulator_ops max77686_ldo_ops = {
.set_voltage_sel = regulator_set_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap,
.set_voltage_time_sel = regulator_set_voltage_time_sel, .set_voltage_time_sel = regulator_set_voltage_time_sel,
.set_suspend_mode = max77686_ldo_set_suspend_mode, .set_suspend_mode = max77686_ldo_set_suspend_mode,
.set_suspend_disable = max77686_set_suspend_disable,
}; };
static struct regulator_ops max77686_buck1_ops = { static struct regulator_ops max77686_buck1_ops = {
...@@ -258,7 +262,7 @@ static struct regulator_ops max77686_buck1_ops = { ...@@ -258,7 +262,7 @@ static struct regulator_ops max77686_buck1_ops = {
.get_voltage_sel = regulator_get_voltage_sel_regmap, .get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap,
.set_voltage_time_sel = regulator_set_voltage_time_sel, .set_voltage_time_sel = regulator_set_voltage_time_sel,
.set_suspend_disable = max77686_buck_set_suspend_disable, .set_suspend_disable = max77686_set_suspend_disable,
}; };
static struct regulator_ops max77686_buck_dvs_ops = { static struct regulator_ops max77686_buck_dvs_ops = {
...@@ -271,7 +275,7 @@ static struct regulator_ops max77686_buck_dvs_ops = { ...@@ -271,7 +275,7 @@ static struct regulator_ops max77686_buck_dvs_ops = {
.set_voltage_sel = regulator_set_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap,
.set_voltage_time_sel = regulator_set_voltage_time_sel, .set_voltage_time_sel = regulator_set_voltage_time_sel,
.set_ramp_delay = max77686_set_ramp_delay, .set_ramp_delay = max77686_set_ramp_delay,
.set_suspend_disable = max77686_buck_set_suspend_disable, .set_suspend_disable = max77686_set_suspend_disable,
}; };
#define regulator_desc_ldo(num) { \ #define regulator_desc_ldo(num) { \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册