PebbleOS
Loading...
Searching...
No Matches
regulator.h File Reference
#include <stdint.h>
#include <pbl/device.h>
#include <pbl/kernel/mutex.h>

Data Structures

struct  pbl_regulator_ops
 Regulator driver operations. More...
 
struct  pbl_regulator
 A power rail. More...
 

Macros

#define PBL_REGULATOR_STATE_DEFINE(sym)
 Define the class state of regulator sym, for the PBL_*_REGULATOR_DEFINE() macro of a driver.
 
#define PBL_REGULATOR_INIT(sym, _name, _parent, _ops, _always_on)
 Initializer for the struct pbl_regulator of regulator sym.
 

Functions

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.
 
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.
 
bool pbl_regulator_is_enabled (const struct pbl_regulator *reg)
 Check whether a rail is on.