Interface for regulator drivers.
More...
|
| int | pbl_regulator_dev_init (const struct pbl_device *dev) |
| | Device init of every regulator: applies the driver's init, then switches the rail on if always-on, off otherwise.
|
| |
Interface for regulator drivers.
A driver embeds a struct pbl_regulator in its instance, sets it up with PBL_REGULATOR_STATE_DEFINE() and PBL_REGULATOR_INIT(), and implements the struct pbl_regulator_ops the class calls.
◆ pbl_regulator
| Data Fields |
|
bool |
always_on |
Switched on at init and never off. |
|
struct pbl_device |
dev |
Device. |
|
uint32_t |
enable_time_us |
Time from switching on until the rail is up, in microseconds. |
|
const struct pbl_regulator_ops * |
ops |
Driver operations. |
|
struct pbl_regulator_state * |
state |
Runtime state. |
◆ PBL_REGULATOR_INIT
| #define PBL_REGULATOR_INIT |
( |
|
sym, |
|
|
|
_name, |
|
|
|
_parent, |
|
|
|
_ops, |
|
|
|
_enable_time_us, |
|
|
|
_always_on |
|
) |
| |
Value: { \
.dev = \
.ops = (_ops), \
.state = &sym##_regulator_state, \
.enable_time_us = (_enable_time_us), \
.always_on = (_always_on), \
}
int pbl_regulator_dev_init(const struct pbl_device *dev)
Device init of every regulator: applies the driver's init, then switches the rail on if always-on,...
Initializer for the struct pbl_regulator of regulator sym.
- Parameters
-
| sym | Symbol of the regulator instance, with its state defined by PBL_REGULATOR_STATE_DEFINE(). |
| _name | Name. |
| _parent | Parent device, or NULL. |
| _ops | Driver operations. |
| _enable_time_us | Time from switching on until the rail is up, in microseconds. |
| _always_on | Switched on at init and never off. |
◆ PBL_REGULATOR_STATE_DEFINE
| #define PBL_REGULATOR_STATE_DEFINE |
( |
|
sym | ) |
|
Value:
static struct pbl_regulator_state sym##_regulator_state
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132
Define the class state of regulator sym, for the PBL_*_REGULATOR_DEFINE() macro of a driver.
- Parameters
-
| sym | Symbol of the regulator instance. |
◆ pbl_regulator_dev_init()
| int pbl_regulator_dev_init |
( |
const struct pbl_device * |
dev | ) |
|
Device init of every regulator: applies the driver's init, then switches the rail on if always-on, off otherwise.
- Parameters
-
- Returns
- 0 or a negative errno.