HomeFreeBSD

Fix handling of enable counter for shared GPIO line in fixed regulator.

Description

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

Details

Provenance
mmelAuthored on
Parents
rS335248: biosdisk.c: fix type in debug printf
Branches
Unknown
Tags
Unknown