]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix handling of enable counter for shared GPIO line in fixed regulator.
authorMichal Meloun <mmel@FreeBSD.org>
Sat, 16 Jun 2018 08:25:38 +0000 (08:25 +0000)
committerMichal Meloun <mmel@FreeBSD.org>
Sat, 16 Jun 2018 08:25:38 +0000 (08:25 +0000)
commitbcc0decdc98d144587f18312b69862524393c3f8
tree5ca1820e36edf28082a64919ec7302c9fb19e23d
parentf567034d1b9115bd00fafcdd00eef34e8ccdd5c4
Fix handling of enable counter for shared GPIO line in fixed regulator.

For most regulators, the regulator_stop() method can be transformed to
regulator disable. But, in some cases, we needs to maintain shared data
across multiple regulators (e.g. single GPIO pin which works as enable
for multiple regulates). In this case, the implementation of regulator
should perform his own enable counting therefore it is necessary to
distinguish between the regulator enable/disable method (which
increments/decrements enable counter for shared resource) and regulator
stop method (which don't affect it).

So:
- add regnode_stop() method to regulator framework and default it to
  regnode_enable(..., false, ...)
- implement it in regulator_fixed with proper enable counting.

While I'm in, also fix handling of always_on property. If any of regulators
sharing same GPIO pin have it enabled, then none of them can disable regulator.

Tested by: kevans
MFC after: 3 weeks
sys/dev/extres/regulator/regnode_if.m
sys/dev/extres/regulator/regulator.c
sys/dev/extres/regulator/regulator_fixed.c