summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBengt Jonsson <bengt.g.jonsson@stericsson.com>2011-11-25 09:13:35 +0100
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 10:59:21 +0200
commit244cecb50ca351cf694d2bc0ba428182a03dd3f6 (patch)
tree077a494aedc18f60cd59a14ae6a6d0457d658906
parent5fef97eb5858d3c138c2c0bda07dcd79ba58f9bd (diff)
regulator: db5500: Correct propagation to power state
This patch solves an issue with the power state count (which is used when CPUidle takes the decision to go to sleep). When a db5500 regulator is enabled/disabled, the power state count should only be updated if there is a change in the regulator state. Normally, this error is not visible because the regulator framework will check if the regulator is enabled before enabling. But if the suspend/resume functionality of the regulator framework is activated, there may be calls to enable even if the regulator is already enabled. ST-Ericsson ID: 398507 ST-Ericsson Linux next: NA ST-Ericsson FOSS-OUT ID: Trivial Change-Id: Ic9a875c6c00119f470ca76de2cedce8204b9cbb8 Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/39924 Reviewed-by: QABUILD Reviewed-by: Vijaya Kumar K-1 <vijay.kilari@stericsson.com> Reviewed-by: Rabin VINCENT <rabin.vincent@stericsson.com> Tested-by: Rabin VINCENT <rabin.vincent@stericsson.com>
-rw-r--r--drivers/regulator/db5500-prcmu.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/regulator/db5500-prcmu.c b/drivers/regulator/db5500-prcmu.c
index bf2aeeee399..189362ab8e0 100644
--- a/drivers/regulator/db5500-prcmu.c
+++ b/drivers/regulator/db5500-prcmu.c
@@ -30,9 +30,11 @@ static int db5500_regulator_enable(struct regulator_dev *rdev)
dev_vdbg(rdev_get_dev(rdev), "regulator-%s-enable\n",
info->desc.name);
- info->is_enabled = true;
- if (!info->exclude_from_power_state)
- power_state_active_enable();
+ if (!info->is_enabled) {
+ info->is_enabled = true;
+ if (!info->exclude_from_power_state)
+ power_state_active_enable();
+ }
return 0;
}
@@ -48,9 +50,11 @@ static int db5500_regulator_disable(struct regulator_dev *rdev)
dev_vdbg(rdev_get_dev(rdev), "regulator-%s-disable\n",
info->desc.name);
- info->is_enabled = false;
- if (!info->exclude_from_power_state)
- ret = power_state_active_disable();
+ if (info->is_enabled) {
+ info->is_enabled = false;
+ if (!info->exclude_from_power_state)
+ ret = power_state_active_disable();
+ }
return ret;
}