| 
    Zephyr Project API
    3.4.0
    
   A Scalable Open Source RTOS 
   | 
 
Regulator Interface. More...
Modules | |
| ADP5360 Devicetree helpers. | |
| NPM1100 Devicetree helpers. | |
| NPM1300 Devicetree helpers. | |
| NPM6001 Devicetree helpers. | |
| Regulator Parent Interface | |
| Regulator Parent Interface.  | |
Typedefs | |
| typedef uint8_t | regulator_dvs_state_t | 
| typedef uint8_t | regulator_mode_t | 
| typedef uint8_t | regulator_error_flags_t | 
Functions | |
| int | regulator_enable (const struct device *dev) | 
| Enable a regulator.  More... | |
| bool | regulator_is_enabled (const struct device *dev) | 
| Check if a regulator is enabled.  More... | |
| int | regulator_disable (const struct device *dev) | 
| Disable a regulator.  More... | |
| static unsigned int | regulator_count_voltages (const struct device *dev) | 
| Obtain the number of supported voltage levels.  More... | |
| 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.  More... | |
| 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.  More... | |
| int | regulator_set_voltage (const struct device *dev, int32_t min_uv, int32_t max_uv) | 
| Set the output voltage.  More... | |
| static int | regulator_get_voltage (const struct device *dev, int32_t *volt_uv) | 
| Obtain output voltage.  More... | |
| int | regulator_set_current_limit (const struct device *dev, int32_t min_ua, int32_t max_ua) | 
| Set output current limit.  More... | |
| static int | regulator_get_current_limit (const struct device *dev, int32_t *curr_ua) | 
| Get output current limit.  More... | |
| int | regulator_set_mode (const struct device *dev, regulator_mode_t mode) | 
| Set mode.  More... | |
| static int | regulator_get_mode (const struct device *dev, regulator_mode_t *mode) | 
| Get mode.  More... | |
| static int | regulator_get_error_flags (const struct device *dev, regulator_error_flags_t *flags) | 
| Get active error flags.  More... | |
Regulator error flags. | |
| #define | REGULATOR_ERROR_OVER_VOLTAGE BIT(0) | 
| #define | REGULATOR_ERROR_OVER_CURRENT BIT(1) | 
| #define | REGULATOR_ERROR_OVER_TEMP BIT(2) | 
Regulator Interface.
| #define REGULATOR_ERROR_OVER_CURRENT BIT(1) | 
#include <include/zephyr/drivers/regulator.h>
Current is too high.
| #define REGULATOR_ERROR_OVER_TEMP BIT(2) | 
#include <include/zephyr/drivers/regulator.h>
Temperature is too high.
| #define REGULATOR_ERROR_OVER_VOLTAGE BIT(0) | 
#include <include/zephyr/drivers/regulator.h>
Voltage is too high.
| typedef uint8_t regulator_dvs_state_t | 
#include <include/zephyr/drivers/regulator.h>
Opaque type to store regulator DVS states
| typedef uint8_t regulator_error_flags_t | 
#include <include/zephyr/drivers/regulator.h>
Opaque bit map for regulator error flags (see REGULATOR_ERRORS)
| typedef uint8_t regulator_mode_t | 
#include <include/zephyr/drivers/regulator.h>
Opaque type to store regulator modes
#include <include/zephyr/drivers/regulator.h>
Obtain the number of supported voltage levels.
Each voltage level supported by a regulator gets an index, starting from zero. The total number of supported voltage levels can be used together with regulator_list_voltage() to list all supported voltage levels.
| dev | Regulator device instance. | 
| int regulator_disable | ( | const struct device * | dev | ) | 
#include <include/zephyr/drivers/regulator.h>
Disable a regulator.
Release a regulator after a previous regulator_enable() completed successfully. Regulators that are always on, or configured in devicetree with regulator-always-on will always stay enabled, and so this function will always succeed.
This must be invoked at most once for each successful regulator_enable().
| dev | Regulator device instance. | 
| 0 | If regulator has been successfully disabled. | 
| -errno | Negative errno in case of failure. | 
| int regulator_enable | ( | const struct device * | dev | ) | 
#include <include/zephyr/drivers/regulator.h>
Enable a regulator.
Reference-counted request that a regulator be turned on. A regulator is considered "on" when it has reached a stable/usable state. Regulators that are always on, or configured in devicetree with regulator-always-on will always stay enabled, and so this function will always succeed.
| dev | Regulator device instance | 
| 0 | If regulator has been successfully enabled. | 
| -errno | Negative errno in case of failure. | 
      
  | 
  inlinestatic | 
#include <include/zephyr/drivers/regulator.h>
Get output current limit.
| dev | Regulator device instance. | |
| [out] | curr_ua | Where output current limit will be stored. | 
| 0 | If successful. | 
| -ENOSYS | If function is not implemented. | 
| -errno | In case of any other error. | 
      
  | 
  inlinestatic | 
#include <include/zephyr/drivers/regulator.h>
Get active error flags.
| dev | Regulator device instance. | |
| [out] | flags | Where error flags will be stored. | 
| 0 | If successful. | 
| -ENOSYS | If function is not implemented. | 
| -errno | In case of any other error. | 
      
  | 
  inlinestatic | 
#include <include/zephyr/drivers/regulator.h>
Get mode.
| dev | Regulator device instance. | |
| [out] | mode | Where mode will be stored. | 
| 0 | If successful. | 
| -ENOSYS | If function is not implemented. | 
| -errno | In case of any other error. | 
#include <include/zephyr/drivers/regulator.h>
Obtain output voltage.
| dev | Regulator device instance. | |
| [out] | volt_uv | Where configured output voltage will be stored. | 
| 0 | If successful | 
| -ENOSYS | If function is not implemented. | 
| -errno | In case of any other error. | 
#include <include/zephyr/drivers/regulator.h>
Check if a regulator is enabled.
| dev | Regulator device instance. | 
| true | If regulator is enabled. | 
| false | If regulator is disabled. | 
#include <include/zephyr/drivers/regulator.h>
Check if a voltage within a window is supported.
| dev | Regulator device instance. | 
| min_uv | Minimum voltage in microvolts. | 
| max_uv | maximum voltage in microvolts. | 
| true | If voltage is supported. | 
| false | If voltage is not supported. | 
      
  | 
  inlinestatic | 
#include <include/zephyr/drivers/regulator.h>
Obtain the value of a voltage given an index.
Each voltage level supported by a regulator gets an index, starting from zero. Together with regulator_count_voltages(), this function can be used to iterate over all supported voltages.
| dev | Regulator device instance. | |
| idx | Voltage index. | |
| [out] | volt_uv | Where voltage for the given index will be stored, in microvolts. | 
| 0 | If index corresponds to a supported voltage.  | 
| -EINVAL | If index does not correspond to a supported voltage.  | 
#include <include/zephyr/drivers/regulator.h>
Set output current limit.
The output current limit will be configured to the closest supported output current limit. regulator_get_current_limit() can be used to obtain the actual configured current limit. Current may be limited using current-min-microamp and/or current-max-microamp in Devicetree.
| dev | Regulator device instance. | 
| min_ua | Minimum acceptable current limit in microamps. | 
| max_ua | Maximum acceptable current limit in microamps. | 
| 0 | If successful. | 
| -EINVAL | If the given current limit window is not valid. | 
| -ENOSYS | If function is not implemented. | 
| -errno | In case of any other error. | 
| int regulator_set_mode | ( | const struct device * | dev, | 
| regulator_mode_t | mode | ||
| ) | 
#include <include/zephyr/drivers/regulator.h>
Set mode.
Regulators can support multiple modes in order to permit different voltage configuration or better power savings. This API will apply a mode for the regulator. Allowed modes may be limited using regulator-allowed-modes devicetree property.
| dev | Regulator device instance. | 
| mode | Mode to select for this regulator. | 
| 0 | If successful. | 
| -ENOTSUP | If mode is not supported. | 
| -ENOSYS | If function is not implemented. | 
| -errno | In case of any other error. | 
#include <include/zephyr/drivers/regulator.h>
Set the output voltage.
The output voltage will be configured to the closest supported output voltage. regulator_get_voltage() can be used to obtain the actual configured voltage. The voltage will be applied to the active or selected mode. Output voltage may be limited using regulator-min-microvolt and/or regulator-max-microvolt in devicetree.
| dev | Regulator device instance. | 
| min_uv | Minimum acceptable voltage in microvolts. | 
| max_uv | Maximum acceptable voltage in microvolts. | 
| 0 | If successful. | 
| -EINVAL | If the given voltage window is not valid. | 
| -ENOSYS | If function is not implemented. | 
| -errno | In case of any other error. |