This offers a similar API to the kernel clock framework. Consumer drivers use get and put operations to acquire and release regulators. Functions are provided to enable and disable the regulator and to get and set the runtime parameters of the regulator.
When requesting regulators consumers use symbolic names for their supplies, such as "Vcc", which are mapped into actual regulator devices by the machine interface.
A stub version of this API is provided when the regulator framework is not in use in order to minimise the need to use ifdefs.
The regulator API provides reference counted enabling and
disabling of regulators. Consumer devices use the
functions to enable and disable regulators. Calls
to the two functions must be balanced.
Note that since multiple consumers may be using a regulator and
machine constraints may not allow the regulator to be disabled
there is no guarantee that calling
regulator_disable will actually cause the
supply provided by the regulator to be disabled. Consumer
drivers should assume that the regulator may be enabled at all