This method check that boot_on or always_on is set to 1 and if it is it will try to enable the regulator.
The binding docs aren't clear on what to do but Linux enable the regulator if any of those properties
is set so we want to do the same.
The function first check the status to see if the regulator is already enabled, it then get the voltage
to check if it is in a acceptable range and then enables it.
This will be either called from the regnode_init method (if it's needed by the platform)
or by a SYSINIT at SI_SUB_LAST
Details
- Reviewers
mmel - Group Reviewers
ARM arm64 - Commits
- rS355183: MFC r353917-r353919, r354396-r354397
rS353919: regulator: Add a regnode_set_constraint function
Tested on Pine64-LTS and checked that regulator that are boot_on/always_on will be enabled.
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
The code itself looks OK for me. But I have problem with using its usage as default regulator init method, because:
- it cannot be used by regulators with its own init
- it expect that regulator is accessible early, at registration time. I'm not sure if this is possible in all cases (like I2C and interrupts ..)
But we can declare renamed regnode_method_init() as public (regnode_set_constrains() ????)
and call it from eqivalent of regulator_shutdown() .
For me, this looks like most flexible solution to me. Individual regulators will be able to use this, and we already expect that regulators are accessible at time when regulator_shutdown() is called.
sys/dev/extres/regulator/regulator.c | ||
---|---|---|
243 | .boot_on and .always on are booleans |
Move the code to regnode_set_constraint.
The function can either be called from the regnode init method if the platform allow this or
it will be called in a sysinit so we're sure that all the regulator that needs to be enabled will be.
I'll split the patch in three commits :
- One that adds the regnode_constraint
- One that add the regnode_method_init (useful for regulator that don't need a dedicated init method)
- One for axp81x.