提交 cacf90f2 编写于 作者: M Mark Brown 提交者: Liam Girdwood

regulator: Allow boot_on regulators to be disabled by clients

Rather than incrementing the reference count for boot_on regulators
(which prevents them being disabled later on) simply force the
regulator to be enabled when applying the constraints. Previously
boot_on was essentially equivalent to always_on.
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: NLiam Girdwood <lrg@slimlogic.co.uk>
上级 221a7c7c
...@@ -776,10 +776,6 @@ static int set_machine_constraints(struct regulator_dev *rdev, ...@@ -776,10 +776,6 @@ static int set_machine_constraints(struct regulator_dev *rdev,
} }
} }
/* are we enabled at boot time by firmware / bootloader */
if (rdev->constraints->boot_on)
rdev->use_count = 1;
/* do we need to setup our suspend state */ /* do we need to setup our suspend state */
if (constraints->initial_state) { if (constraints->initial_state) {
ret = suspend_prepare(rdev, constraints->initial_state); ret = suspend_prepare(rdev, constraints->initial_state);
...@@ -808,11 +804,10 @@ static int set_machine_constraints(struct regulator_dev *rdev, ...@@ -808,11 +804,10 @@ static int set_machine_constraints(struct regulator_dev *rdev,
} }
} }
/* if always_on is set then turn the regulator on if it's not /* If the constraints say the regulator should be on at this point
* already on. */ * and we have control then make sure it is enabled.
if (constraints->always_on && ops->enable && */
((ops->is_enabled && !ops->is_enabled(rdev)) || if ((constraints->always_on || constraints->boot_on) && ops->enable) {
(!ops->is_enabled && !constraints->boot_on))) {
ret = ops->enable(rdev); ret = ops->enable(rdev);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "%s: failed to enable %s\n", printk(KERN_ERR "%s: failed to enable %s\n",
......
...@@ -73,7 +73,9 @@ struct regulator_state { ...@@ -73,7 +73,9 @@ struct regulator_state {
* *
* @always_on: Set if the regulator should never be disabled. * @always_on: Set if the regulator should never be disabled.
* @boot_on: Set if the regulator is enabled when the system is initially * @boot_on: Set if the regulator is enabled when the system is initially
* started. * started. If the regulator is not enabled by the hardware or
* bootloader then it will be enabled when the constraints are
* applied.
* @apply_uV: Apply the voltage constraint when initialising. * @apply_uV: Apply the voltage constraint when initialising.
* *
* @input_uV: Input voltage for regulator when supplied by another regulator. * @input_uV: Input voltage for regulator when supplied by another regulator.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册