* [PATCH] regulator: max77686: Don't update max77686->opmode if update register fails
@ 2013-04-27 8:18 Axel Lin
2013-04-28 1:08 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2013-04-27 8:18 UTC (permalink / raw)
To: Mark Brown
Cc: Chiwoong Byun, Jonghwa Lee, Myungjoo Ham, Yadwinder Singh Brar,
Liam Girdwood, linux-kernel
Ensure max77686->opmode always has correct status.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/regulator/max77686.c | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c
index e4586ee..20935b1 100644
--- a/drivers/regulator/max77686.c
+++ b/drivers/regulator/max77686.c
@@ -75,17 +75,20 @@ static int max77686_buck_set_suspend_disable(struct regulator_dev *rdev)
{
unsigned int val;
struct max77686_data *max77686 = rdev_get_drvdata(rdev);
- int id = rdev_get_id(rdev);
+ int ret, id = rdev_get_id(rdev);
if (id == MAX77686_BUCK1)
val = 0x1;
else
val = 0x1 << MAX77686_OPMODE_BUCK234_SHIFT;
+ ret = regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
+ rdev->desc->enable_mask, val);
+ if (ret)
+ return ret;
+
max77686->opmode[id] = val;
- return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
- rdev->desc->enable_mask,
- val);
+ return 0;
}
/* Some LDOs supports [LPM/Normal]ON mode during suspend state */
@@ -94,7 +97,7 @@ static int max77686_set_suspend_mode(struct regulator_dev *rdev,
{
struct max77686_data *max77686 = rdev_get_drvdata(rdev);
unsigned int val;
- int id = rdev_get_id(rdev);
+ int ret, id = rdev_get_id(rdev);
/* BUCK[5-9] doesn't support this feature */
if (id >= MAX77686_BUCK5)
@@ -113,10 +116,13 @@ static int max77686_set_suspend_mode(struct regulator_dev *rdev,
return -EINVAL;
}
+ ret = regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
+ rdev->desc->enable_mask, val);
+ if (ret)
+ return ret;
+
max77686->opmode[id] = val;
- return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
- rdev->desc->enable_mask,
- val);
+ return 0;
}
/* Some LDOs supports LPM-ON/OFF/Normal-ON mode during suspend state */
@@ -125,6 +131,7 @@ static int max77686_ldo_set_suspend_mode(struct regulator_dev *rdev,
{
unsigned int val;
struct max77686_data *max77686 = rdev_get_drvdata(rdev);
+ int ret;
switch (mode) {
case REGULATOR_MODE_STANDBY: /* switch off */
@@ -142,10 +149,13 @@ static int max77686_ldo_set_suspend_mode(struct regulator_dev *rdev,
return -EINVAL;
}
+ ret = regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
+ rdev->desc->enable_mask, val);
+ if (ret)
+ return ret;
+
max77686->opmode[rdev_get_id(rdev)] = val;
- return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
- rdev->desc->enable_mask,
- val);
+ return 0;
}
static int max77686_enable(struct regulator_dev *rdev)
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] regulator: max77686: Don't update max77686->opmode if update register fails
2013-04-27 8:18 [PATCH] regulator: max77686: Don't update max77686->opmode if update register fails Axel Lin
@ 2013-04-28 1:08 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-04-28 1:08 UTC (permalink / raw)
To: Axel Lin
Cc: Chiwoong Byun, Jonghwa Lee, Myungjoo Ham, Yadwinder Singh Brar,
Liam Girdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 129 bytes --]
On Sat, Apr 27, 2013 at 04:18:16PM +0800, Axel Lin wrote:
> Ensure max77686->opmode always has correct status.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-28 1:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-27 8:18 [PATCH] regulator: max77686: Don't update max77686->opmode if update register fails Axel Lin
2013-04-28 1:08 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox