summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAlex Frid <afrid@nvidia.com>2011-07-20 15:04:06 -0700
committerVarun Colbert <vcolbert@nvidia.com>2011-07-22 17:43:08 -0700
commit956fdd6b24e7f3edda2de2d6d71a4d1cb1552556 (patch)
tree55e96744eae171831085b79ba67423910dd627ff /drivers
parent28ac81f7287f782cf40bbb2d7a468317a4c12ec5 (diff)
regulator: Expand regulator notifier events
Add regulator enable notifications (not sent by the current code). Add voltage notifications sent only if regulator output is actually changed (keep intact existing voltage change notification that is sent unconditionally - even if voltage change was not allowed by constraints, or no actual change since regulator is disabled): PRE_ENABLE Regulator is to be enabled POST_ENABLE Regulator was enabled OUT_PRECHANGE Regulator is enabled and its voltage is to be changed OUT_POSTCHANGE Regulator is enabled and its voltage was changed Bug 853132 Change-Id: I2759ada1c5d1e43f746f6c866f9b3c203b68aed6 Reviewed-on: http://git-master/r/42262 Tested-by: Aleksandr Frid <afrid@nvidia.com> Reviewed-by: Scott Williams <scwilliams@nvidia.com> Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: Karan Jhavar <kjhavar@nvidia.com> Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/regulator/core.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 49deeaefb13c..8791bbef4587 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1340,6 +1340,8 @@ static int _regulator_enable(struct regulator_dev *rdev)
}
trace_regulator_enable(rdev_get_name(rdev));
+ _notifier_call_chain(
+ rdev, REGULATOR_EVENT_PRE_ENABLE, NULL);
/* Allow the regulator to ramp; it would be useful
* to extend this for bulk operations so that the
@@ -1357,6 +1359,8 @@ static int _regulator_enable(struct regulator_dev *rdev)
udelay(delay);
}
+ _notifier_call_chain(
+ rdev, REGULATOR_EVENT_POST_ENABLE, NULL);
trace_regulator_enable_complete(rdev_get_name(rdev));
} else if (ret < 0) {
@@ -1672,8 +1676,16 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
if (ret < 0)
goto out;
+ if (_regulator_is_enabled(rdev))
+ _notifier_call_chain(
+ rdev, REGULATOR_EVENT_OUT_PRECHANGE, NULL);
+
ret = rdev->desc->ops->set_voltage(rdev, min_uV, max_uV);
+ if (_regulator_is_enabled(rdev))
+ _notifier_call_chain(
+ rdev, REGULATOR_EVENT_OUT_POSTCHANGE, NULL);
+
trace_regulator_set_voltage_complete(rdev_get_name(rdev), -1);
out: