diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-02-26 14:24:19 -0500 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2009-03-31 04:56:24 -0400 |
commit | a308466c24b4f42bab6945026e938874d22cde50 (patch) | |
tree | 7eea151552bacfa580099cb6f9a32a9140d65c89 /drivers/regulator | |
parent | fe203ddfa5451a13589b1c7da9edab80b7fc06d1 (diff) |
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')
-rw-r--r-- | drivers/regulator/core.c | 17 |
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, | |||
724 | } | 724 | } |
725 | } | 725 | } |
726 | 726 | ||
727 | if (constraints->initial_mode) { | ||
728 | if (!ops->set_mode) { | ||
729 | printk(KERN_ERR "%s: no set_mode operation for %s\n", | ||
730 | __func__, name); | ||
731 | ret = -EINVAL; | ||
732 | goto out; | ||
733 | } | ||
734 | |||
735 | ret = ops->set_mode(rdev, constraints->initial_mode); | ||
736 | if (ret < 0) { | ||
737 | printk(KERN_ERR | ||
738 | "%s: failed to set initial mode for %s: %d\n", | ||
739 | __func__, name, ret); | ||
740 | goto out; | ||
741 | } | ||
742 | } | ||
743 | |||
727 | /* if always_on is set then turn the regulator on if it's not | 744 | /* if always_on is set then turn the regulator on if it's not |
728 | * already on. */ | 745 | * already on. */ |
729 | if (constraints->always_on && ops->enable && | 746 | if (constraints->always_on && ops->enable && |