summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorMark Brown2009-02-26 20:24:19 +0100
committerLiam Girdwood2009-03-31 10:56:24 +0200
commita308466c24b4f42bab6945026e938874d22cde50 (patch)
tree7eea151552bacfa580099cb6f9a32a9140d65c89 /drivers/regulator/core.c
parentregulator: Suggest use of datasheet supply or pin names for consumers (diff)
downloadkernel-qcow2-linux-a308466c24b4f42bab6945026e938874d22cde50.tar.gz
kernel-qcow2-linux-a308466c24b4f42bab6945026e938874d22cde50.tar.xz
kernel-qcow2-linux-a308466c24b4f42bab6945026e938874d22cde50.zip
regulator: Allow regulators to set the initial operating mode
This is useful when wishing to run in a fixed operating mode that isn't the default. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index d55a25a6fab2..75abcd85e51b 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -724,6 +724,23 @@ static int set_machine_constraints(struct regulator_dev *rdev,
}
}
+ if (constraints->initial_mode) {
+ if (!ops->set_mode) {
+ printk(KERN_ERR "%s: no set_mode operation for %s\n",
+ __func__, name);
+ ret = -EINVAL;
+ goto out;
+ }
+
+ ret = ops->set_mode(rdev, constraints->initial_mode);
+ if (ret < 0) {
+ printk(KERN_ERR
+ "%s: failed to set initial mode for %s: %d\n",
+ __func__, name, ret);
+ goto out;
+ }
+ }
+
/* if always_on is set then turn the regulator on if it's not
* already on. */
if (constraints->always_on && ops->enable &&