aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/regulator/core.c17
-rw-r--r--include/linux/regulator/machine.h4
2 files changed, 21 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 &&
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 5aa00ee36a3d..1eb861cf4b2c 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -83,6 +83,7 @@ struct regulator_state {
83 * @state_standby: State for regulator when system is suspended in standby 83 * @state_standby: State for regulator when system is suspended in standby
84 * mode. 84 * mode.
85 * @initial_state: Suspend state to set by default. 85 * @initial_state: Suspend state to set by default.
86 * @initial_mode: Mode to set at startup.
86 */ 87 */
87struct regulation_constraints { 88struct regulation_constraints {
88 89
@@ -111,6 +112,9 @@ struct regulation_constraints {
111 struct regulator_state state_standby; 112 struct regulator_state state_standby;
112 suspend_state_t initial_state; /* suspend state to set at init */ 113 suspend_state_t initial_state; /* suspend state to set at init */
113 114
115 /* mode to set on startup */
116 unsigned int initial_mode;
117
114 /* constriant flags */ 118 /* constriant flags */
115 unsigned always_on:1; /* regulator never off when system is on */ 119 unsigned always_on:1; /* regulator never off when system is on */
116 unsigned boot_on:1; /* bootloader/firmware enabled regulator */ 120 unsigned boot_on:1; /* bootloader/firmware enabled regulator */