PebbleOS v4.48.0-75-g7416f78a1
Loading...
Searching...
No Matches
Regulator

Power rail class. More...

Modules

 Regulator drivers
 Interface for regulator drivers.
 
 Fixed regulators
 Regulator driver for a rail switched by a GPIO, as a load switch, or always on without one.
 
 nPM1300 regulators
 Regulator rails of the nPM1300, cells of nPM1300.
 
 SF32LB52 PMUC regulators
 Regulator driver for the regulators of the SF32LB52 PMUC.
 
 SF32LB57 PMUC regulators
 Regulator driver for the regulators of the SF32LB57 PMUC.
 

Functions

int pbl_regulator_enable (const struct pbl_regulator *reg)
 Take a reference on a rail, switching it on for the first user.
 
int pbl_regulator_disable (const struct pbl_regulator *reg)
 Drop a reference on a rail, switching it off after the last user.
 
int pbl_regulator_power_cycle (const struct pbl_regulator *reg, uint32_t off_ms)
 Switch a rail off and back on, also if it is always-on.
 
bool pbl_regulator_is_enabled (const struct pbl_regulator *reg)
 Check whether a rail is on.
 

Detailed Description

Power rail class.

A power rail is a struct pbl_regulator device. Consumers enable and disable it with a use count; a rail marked always-on is switched on at init and stays on, and any other rail starts off. Switching a rail on waits its enable time, so the rail is up when the call returns; the time what it feeds needs after that is up to the consumer.

// use the device
int pbl_regulator_enable(const struct pbl_regulator *reg)
Take a reference on a rail, switching it on for the first user.
int pbl_regulator_disable(const struct pbl_regulator *reg)
Drop a reference on a rail, switching it off after the last user.

Function Documentation

◆ pbl_regulator_disable()

int pbl_regulator_disable ( const struct pbl_regulator *  reg)

Drop a reference on a rail, switching it off after the last user.

Must balance a successful pbl_regulator_enable().

Parameters
regRegulator.
Returns
0 or a negative errno.

◆ pbl_regulator_enable()

int pbl_regulator_enable ( const struct pbl_regulator *  reg)

Take a reference on a rail, switching it on for the first user.

Returns once the rail is up.

Parameters
regRegulator.
Returns
0 or a negative errno.

◆ pbl_regulator_is_enabled()

bool pbl_regulator_is_enabled ( const struct pbl_regulator *  reg)

Check whether a rail is on.

Parameters
regRegulator.
Returns
True if the rail is always-on or has users.

◆ pbl_regulator_power_cycle()

int pbl_regulator_power_cycle ( const struct pbl_regulator *  reg,
uint32_t  off_ms 
)

Switch a rail off and back on, also if it is always-on.

For a consumer to reset what the rail feeds. Nothing else on the rail may be in use.

Parameters
regRegulator.
off_msTime off, in milliseconds. Output capacitors keep the rail up for a while.
Returns
0, -EBUSY if the rail has users, or a negative errno.