regulator: Flag uncontrollable regulators as always_on
Mark Brown
maintainerPATCH 1/1 regulator: Flag uncontrollable regulators as always_on
While we currently assume that regulators with no control available are just uncontionally enabled this isn't always as clearly displayed to users as is desirable, for example the code for disabling unused regulators will log that it is about to disable them. Clean this up a bit by setting always_on during constraint evaluation if we have no available mechanism for controlling the regualtor so things that check the constraint will do the right thing.
--- drivers/regulator/core.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/regulator/core.c +18 -0
@@ -1522,6 +1522,24 @@ static int set_machine_constraints(struct regulator_dev *rdev) } } +/* +* If there is no mechanism for controlling the regulator then +* flag it as always_on so we don't end up duplicating checks +* for this so much. Note that we could control the state of +* a supply to control the output on a regulator that has no +* direct control. +*/ +if (!rdev->ena_pin && !ops->enable) { +if (rdev->supply_name && !rdev->supply) +return -EPROBE_DEFER ; + +if (rdev->supply) + rdev->constraints->always_on = + rdev->supply->rdev->constraints->always_on; +else + rdev->constraints->always_on = true; + } +/* If the constraints say the regulator should be on at this point * and we have control then make sure it is enabled. */
Signature · 1 line
2.30.2
Mark Brown
maintainerQuoted 9 lines · Mark Brown
While we currently assume that regulators with no control available are just uncontionally enabled this isn't always as clearly displayed to users as is desirable, for example the code for disabling unused regulators will log that it is about to disable them. Clean this up a bit by setting
always_onduring constraint evaluation if we have no available mechanism for controlling the regualtor so things that check the constraint will do the right thing.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/1] regulator: Flag uncontrollable regulators as always_on
commit: 261f06315cf7c3744731e36bfd8d4434949e3389
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark