Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
regulator.h File Reference
#include <errno.h>
#include <stdint.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/sys/util_macro.h>

Go to the source code of this file.

Macros

Regulator error flags.

#define REGULATOR_ERROR_OVER_VOLTAGE   BIT(0)
 Voltage is too high.
 
#define REGULATOR_ERROR_OVER_CURRENT   BIT(1)
 Current is too high.
 
#define REGULATOR_ERROR_OVER_TEMP   BIT(2)
 Temperature is too high.
 

Typedefs

typedef uint8_t regulator_dvs_state_t
 Opaque type to store regulator DVS states.
 
typedef uint8_t regulator_mode_t
 Opaque type to store regulator modes.
 
typedef uint8_t regulator_error_flags_t
 Opaque bit map for regulator error flags (see REGULATOR_ERRORS)
 

Functions

static int regulator_parent_dvs_state_set (const struct device *dev, regulator_dvs_state_t state)
 Set a DVS state.
 
static int regulator_parent_ship_mode (const struct device *dev)
 Enter ship mode.
 
int regulator_enable (const struct device *dev)
 Enable a regulator.
 
bool regulator_is_enabled (const struct device *dev)
 Check if a regulator is enabled.
 
int regulator_disable (const struct device *dev)
 Disable a regulator.
 
static unsigned int regulator_count_voltages (const struct device *dev)
 Obtain the number of supported voltage levels.
 
static int regulator_list_voltage (const struct device *dev, unsigned int idx, int32_t *volt_uv)
 Obtain the value of a voltage given an index.
 
bool regulator_is_supported_voltage (const struct device *dev, int32_t min_uv, int32_t max_uv)
 Check if a voltage within a window is supported.
 
int regulator_set_voltage (const struct device *dev, int32_t min_uv, int32_t max_uv)
 Set the output voltage.
 
static int regulator_get_voltage (const struct device *dev, int32_t *volt_uv)
 Obtain output voltage.
 
static unsigned int regulator_count_current_limits (const struct device *dev)
 Obtain the number of supported current limit levels.
 
static int regulator_list_current_limit (const struct device *dev, unsigned int idx, int32_t *current_ua)
 Obtain the value of a current limit given an index.
 
int regulator_set_current_limit (const struct device *dev, int32_t min_ua, int32_t max_ua)
 Set output current limit.
 
static int regulator_get_current_limit (const struct device *dev, int32_t *curr_ua)
 Get output current limit.
 
int regulator_set_mode (const struct device *dev, regulator_mode_t mode)
 Set mode.
 
static int regulator_get_mode (const struct device *dev, regulator_mode_t *mode)
 Get mode.
 
static int regulator_set_active_discharge (const struct device *dev, bool active_discharge)
 Set active discharge setting.
 
static int regulator_get_active_discharge (const struct device *dev, bool *active_discharge)
 Get active discharge setting.
 
static int regulator_get_error_flags (const struct device *dev, regulator_error_flags_t *flags)
 Get active error flags.