Message ID | CAJuYYwRO+AS=WmQfNAe8L6Gi5Dm4VsCuVqk3X5Nb8uUYAdLnJQ@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Sun, Dec 04, 2011 at 06:51:23PM +0530, Thomas Abraham wrote: > For regulators that are not turned on by bootloader, and which require > 'apply_uV' constraint, is there any alternative for turning on the > regulator when using dt? If the regulator isn't software managed then always_on covers this - the regulator core will enable any always_on regulators that haven't been enabled already. > /* do we need to apply the constraint voltage */ > - if (rdev->constraints->apply_uV && > - rdev->constraints->min_uV == rdev->constraints->max_uV) { > + if ((rdev->constraints->apply_uV && > + rdev->constraints->min_uV == rdev->constraints->max_uV) || > + (!rdev->constraints->boot_on && rdev->constraints->always_on)) { > ret = _regulator_do_set_voltage(rdev, > rdev->constraints->min_uV, > rdev->constraints->max_uV); I'm not sure I understand the intended logic there. Voltage constraints and enable/disable constraints are orthogonal here.
Hi Mark, On 4 December 2011 21:24, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote: > On Sun, Dec 04, 2011 at 06:51:23PM +0530, Thomas Abraham wrote: > >> For regulators that are not turned on by bootloader, and which require >> 'apply_uV' constraint, is there any alternative for turning on the >> regulator when using dt? > > If the regulator isn't software managed then always_on covers this - the > regulator core will enable any always_on regulators that haven't been > enabled already. Thanks for the hint. I was trying to deal with a regulator that was not software managed but also required the voltage level to be set to certain level. That was possible with 'apply_uV' constraint in non-dt case. Anyway, I have modified the code to manage the regulator and this works fine in dt case as well without the 'apply_uV' constraint. > >> /* do we need to apply the constraint voltage */ >> - if (rdev->constraints->apply_uV && >> - rdev->constraints->min_uV == rdev->constraints->max_uV) { >> + if ((rdev->constraints->apply_uV && >> + rdev->constraints->min_uV == rdev->constraints->max_uV) || >> + (!rdev->constraints->boot_on && rdev->constraints->always_on)) { >> ret = _regulator_do_set_voltage(rdev, >> rdev->constraints->min_uV, >> rdev->constraints->max_uV); > > I'm not sure I understand the intended logic there. Voltage constraints > and enable/disable constraints are orthogonal here. Ok. I guess the above change is incorrect then. Thanks, Thomas.
On Mon, Dec 05, 2011 at 02:40:50PM +0530, Thomas Abraham wrote: > On 4 December 2011 21:24, Mark Brown > > If the regulator isn't software managed then always_on covers this - the > > regulator core will enable any always_on regulators that haven't been > > enabled already. > Thanks for the hint. I was trying to deal with a regulator that was > not software managed but also required the voltage level to be set to > certain level. That was possible with 'apply_uV' constraint in non-dt > case. Anyway, I have modified the code to manage the regulator and > this works fine in dt case as well without the 'apply_uV' constraint. With the regulator device tree bindings if the regulator is configured to run a single voltage the bindings will set apply_uV unconditionally so there's no need for a separate constraint.
On 5 December 2011 16:04, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote: > On Mon, Dec 05, 2011 at 02:40:50PM +0530, Thomas Abraham wrote: >> On 4 December 2011 21:24, Mark Brown > >> > If the regulator isn't software managed then always_on covers this - the >> > regulator core will enable any always_on regulators that haven't been >> > enabled already. > >> Thanks for the hint. I was trying to deal with a regulator that was >> not software managed but also required the voltage level to be set to >> certain level. That was possible with 'apply_uV' constraint in non-dt >> case. Anyway, I have modified the code to manage the regulator and >> this works fine in dt case as well without the 'apply_uV' constraint. > > With the regulator device tree bindings if the regulator is configured > to run a single voltage the bindings will set apply_uV unconditionally > so there's no need for a separate constraint. > Sorry if I have missed this, but I could not find 'apply_uV' being set as you described in the v5 of the regulator-dt patchset. Thanks, Thomas.
On Mon, Dec 05, 2011 at 04:14:40PM +0530, Thomas Abraham wrote: > On 5 December 2011 16:04, Mark Brown > > With the regulator device tree bindings if the regulator is configured > > to run a single voltage the bindings will set apply_uV unconditionally > > so there's no need for a separate constraint. > Sorry if I have missed this, but I could not find 'apply_uV' being set > as you described in the v5 of the regulator-dt patchset. Yes, looks like Rajendra missed that - just fixed it.
On 5 December 2011 16:27, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote: > On Mon, Dec 05, 2011 at 04:14:40PM +0530, Thomas Abraham wrote: >> On 5 December 2011 16:04, Mark Brown > >> > With the regulator device tree bindings if the regulator is configured >> > to run a single voltage the bindings will set apply_uV unconditionally >> > so there's no need for a separate constraint. > >> Sorry if I have missed this, but I could not find 'apply_uV' being set >> as you described in the v5 of the regulator-dt patchset. > > Yes, looks like Rajendra missed that - just fixed it. > Thanks Mark. Could you please push your change. Regards, Thomas.
On Monday 05 December 2011 04:27 PM, Mark Brown wrote: > On Mon, Dec 05, 2011 at 04:14:40PM +0530, Thomas Abraham wrote: >> On 5 December 2011 16:04, Mark Brown > >>> With the regulator device tree bindings if the regulator is configured >>> to run a single voltage the bindings will set apply_uV unconditionally >>> so there's no need for a separate constraint. > >> Sorry if I have missed this, but I could not find 'apply_uV' being set >> as you described in the v5 of the regulator-dt patchset. > > Yes, looks like Rajendra missed that - just fixed it. Thanks Mark, I certainly seem to have missed it.
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 5baa196..25a6781 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -816,8 +816,9 @@ static int machine_constraints_voltage(struct regulator_dev *rdev, int ret; /* do we need to apply the constraint voltage */ - if (rdev->constraints->apply_uV && - rdev->constraints->min_uV == rdev->constraints->max_uV) { + if ((rdev->constraints->apply_uV && + rdev->constraints->min_uV == rdev->constraints->max_uV) || + (!rdev->constraints->boot_on && rdev->constraints->always_on)) { ret = _regulator_do_set_voltage(rdev, rdev->constraints->min_uV,