drivers: regulator: s/uV/uv and s/uA/ua
Zephyr coding style uses all-lowercase. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
6d744d3dd2
commit
f7cb0933fc
2 changed files with 46 additions and 46 deletions
|
@ -36,8 +36,8 @@ struct regulator_config {
|
||||||
int num_modes;
|
int num_modes;
|
||||||
uint8_t vsel_reg;
|
uint8_t vsel_reg;
|
||||||
uint8_t vsel_mask;
|
uint8_t vsel_mask;
|
||||||
int32_t max_uV;
|
int32_t max_uv;
|
||||||
int32_t min_uV;
|
int32_t min_uv;
|
||||||
uint8_t enable_reg;
|
uint8_t enable_reg;
|
||||||
uint8_t enable_mask;
|
uint8_t enable_mask;
|
||||||
uint8_t enable_val;
|
uint8_t enable_val;
|
||||||
|
@ -56,8 +56,8 @@ struct regulator_config {
|
||||||
};
|
};
|
||||||
|
|
||||||
static int regulator_pca9420_is_supported_voltage(const struct device *dev,
|
static int regulator_pca9420_is_supported_voltage(const struct device *dev,
|
||||||
int32_t min_uV,
|
int32_t min_uv,
|
||||||
int32_t max_uV);
|
int32_t max_uv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a register from the PMIC
|
* Reads a register from the PMIC
|
||||||
|
@ -133,22 +133,22 @@ static int32_t regulator_get_voltage_offset(const struct device *dev,
|
||||||
* another target mode.
|
* another target mode.
|
||||||
*/
|
*/
|
||||||
static int regulator_set_voltage_offset(const struct device *dev,
|
static int regulator_set_voltage_offset(const struct device *dev,
|
||||||
int32_t min_uV, int32_t max_uV,
|
int32_t min_uv, int32_t max_uv,
|
||||||
uint32_t off)
|
uint32_t off)
|
||||||
{
|
{
|
||||||
const struct regulator_config *config = dev->config;
|
const struct regulator_config *config = dev->config;
|
||||||
struct regulator_data *data = dev->data;
|
struct regulator_data *data = dev->data;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if (!regulator_pca9420_is_supported_voltage(dev, min_uV, max_uV) ||
|
if (!regulator_pca9420_is_supported_voltage(dev, min_uv, max_uv) ||
|
||||||
min_uV > max_uV) {
|
min_uv > max_uv) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
/* Find closest supported voltage */
|
/* Find closest supported voltage */
|
||||||
while (i < config->num_voltages && min_uV > data->voltages[i].uV) {
|
while (i < config->num_voltages && min_uv > data->voltages[i].uV) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (data->voltages[i].uV > max_uV) {
|
if (data->voltages[i].uV > max_uv) {
|
||||||
LOG_DBG("Regulator could not satisfy voltage range, too narrow");
|
LOG_DBG("Regulator could not satisfy voltage range, too narrow");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -207,12 +207,12 @@ static int32_t regulator_pca9420_list_voltages(const struct device *dev,
|
||||||
* Returns true if the regulator supports a voltage in the given range.
|
* Returns true if the regulator supports a voltage in the given range.
|
||||||
*/
|
*/
|
||||||
static int regulator_pca9420_is_supported_voltage(const struct device *dev,
|
static int regulator_pca9420_is_supported_voltage(const struct device *dev,
|
||||||
int32_t min_uV,
|
int32_t min_uv,
|
||||||
int32_t max_uV)
|
int32_t max_uv)
|
||||||
{
|
{
|
||||||
const struct regulator_config *config = dev->config;
|
const struct regulator_config *config = dev->config;
|
||||||
|
|
||||||
return !((config->max_uV < min_uV) || (config->min_uV > max_uV));
|
return !((config->max_uv < min_uv) || (config->min_uv > max_uv));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -220,9 +220,9 @@ static int regulator_pca9420_is_supported_voltage(const struct device *dev,
|
||||||
* Sets the output voltage to the closest supported voltage value
|
* Sets the output voltage to the closest supported voltage value
|
||||||
*/
|
*/
|
||||||
static int regulator_pca9420_set_voltage(const struct device *dev,
|
static int regulator_pca9420_set_voltage(const struct device *dev,
|
||||||
int32_t min_uV, int32_t max_uV)
|
int32_t min_uv, int32_t max_uv)
|
||||||
{
|
{
|
||||||
return regulator_set_voltage_offset(dev, min_uV, max_uV, 0);
|
return regulator_set_voltage_offset(dev, min_uv, max_uv, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ static int32_t regulator_pca9420_get_voltage(const struct device *dev)
|
||||||
* Set the current limit for this device
|
* Set the current limit for this device
|
||||||
*/
|
*/
|
||||||
static int regulator_pca9420_set_current_limit(const struct device *dev,
|
static int regulator_pca9420_set_current_limit(const struct device *dev,
|
||||||
int32_t min_uA, int32_t max_uA)
|
int32_t min_ua, int32_t max_ua)
|
||||||
{
|
{
|
||||||
const struct regulator_config *config = dev->config;
|
const struct regulator_config *config = dev->config;
|
||||||
struct regulator_data *data = dev->data;
|
struct regulator_data *data = dev->data;
|
||||||
|
@ -252,11 +252,11 @@ static int regulator_pca9420_set_current_limit(const struct device *dev,
|
||||||
}
|
}
|
||||||
/* Locate the desired current limit */
|
/* Locate the desired current limit */
|
||||||
while (i < config->num_current_levels &&
|
while (i < config->num_current_levels &&
|
||||||
min_uA > data->current_levels[i].uA) {
|
min_ua > data->current_levels[i].uA) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (i == config->num_current_levels ||
|
if (i == config->num_current_levels ||
|
||||||
data->current_levels[i].uA > max_uA) {
|
data->current_levels[i].uA > max_ua) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
/* Set the current limit */
|
/* Set the current limit */
|
||||||
|
@ -301,8 +301,8 @@ static int regulator_pca9420_get_current_limit(const struct device *dev)
|
||||||
* with the regulator_pca9420_set_mode api
|
* with the regulator_pca9420_set_mode api
|
||||||
*/
|
*/
|
||||||
static int regulator_pca9420_set_mode_voltage(const struct device *dev,
|
static int regulator_pca9420_set_mode_voltage(const struct device *dev,
|
||||||
uint32_t mode, int32_t min_uV,
|
uint32_t mode, int32_t min_uv,
|
||||||
int32_t max_uV)
|
int32_t max_uv)
|
||||||
{
|
{
|
||||||
const struct regulator_config *config = dev->config;
|
const struct regulator_config *config = dev->config;
|
||||||
uint8_t i, sel_off;
|
uint8_t i, sel_off;
|
||||||
|
@ -322,7 +322,7 @@ static int regulator_pca9420_set_mode_voltage(const struct device *dev,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
sel_off = ((mode & PMIC_MODE_OFFSET_MASK) >> PMIC_MODE_OFFSET_SHIFT);
|
sel_off = ((mode & PMIC_MODE_OFFSET_MASK) >> PMIC_MODE_OFFSET_SHIFT);
|
||||||
return regulator_set_voltage_offset(dev, min_uV, max_uV, sel_off);
|
return regulator_set_voltage_offset(dev, min_uv, max_uv, sel_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -570,8 +570,8 @@ static const struct regulator_driver_api api = {
|
||||||
.enable_reg = DT_PROP(node, enable_reg), \
|
.enable_reg = DT_PROP(node, enable_reg), \
|
||||||
.enable_mask = DT_PROP(node, enable_mask), \
|
.enable_mask = DT_PROP(node, enable_mask), \
|
||||||
.enable_val = DT_PROP(node, enable_val), \
|
.enable_val = DT_PROP(node, enable_val), \
|
||||||
.min_uV = DT_PROP(node, min_uv), \
|
.min_uv = DT_PROP(node, min_uv), \
|
||||||
.max_uV = DT_PROP(node, max_uv), \
|
.max_uv = DT_PROP(node, max_uv), \
|
||||||
.ilim_reg = DT_PROP_OR(node, ilim_reg, 0), \
|
.ilim_reg = DT_PROP_OR(node, ilim_reg, 0), \
|
||||||
.ilim_mask = DT_PROP_OR(node, ilim_mask, 0), \
|
.ilim_mask = DT_PROP_OR(node, ilim_mask, 0), \
|
||||||
.enable_inverted = DT_PROP(node, enable_inverted), \
|
.enable_inverted = DT_PROP(node, enable_inverted), \
|
||||||
|
|
|
@ -35,17 +35,17 @@ __subsystem struct regulator_driver_api {
|
||||||
int (*count_modes)(const struct device *dev);
|
int (*count_modes)(const struct device *dev);
|
||||||
int32_t (*list_voltages)(const struct device *dev,
|
int32_t (*list_voltages)(const struct device *dev,
|
||||||
unsigned int selector);
|
unsigned int selector);
|
||||||
int (*is_supported_voltage)(const struct device *dev, int32_t min_uV,
|
int (*is_supported_voltage)(const struct device *dev, int32_t min_uv,
|
||||||
int32_t max_uV);
|
int32_t max_uv);
|
||||||
int (*set_voltage)(const struct device *dev, int32_t min_uV,
|
int (*set_voltage)(const struct device *dev, int32_t min_uv,
|
||||||
int32_t max_uV);
|
int32_t max_uv);
|
||||||
int32_t (*get_voltage)(const struct device *dev);
|
int32_t (*get_voltage)(const struct device *dev);
|
||||||
int (*set_current_limit)(const struct device *dev, int32_t min_uA,
|
int (*set_current_limit)(const struct device *dev, int32_t min_ua,
|
||||||
int32_t max_uA);
|
int32_t max_ua);
|
||||||
int (*get_current_limit)(const struct device *dev);
|
int (*get_current_limit)(const struct device *dev);
|
||||||
int (*set_mode)(const struct device *dev, uint32_t mode);
|
int (*set_mode)(const struct device *dev, uint32_t mode);
|
||||||
int (*set_mode_voltage)(const struct device *dev, uint32_t mode,
|
int (*set_mode_voltage)(const struct device *dev, uint32_t mode,
|
||||||
int32_t min_uV, int32_t max_uV);
|
int32_t min_uv, int32_t max_uv);
|
||||||
int32_t (*get_mode_voltage)(const struct device *dev, uint32_t mode);
|
int32_t (*get_mode_voltage)(const struct device *dev, uint32_t mode);
|
||||||
int (*mode_disable)(const struct device *dev, uint32_t mode);
|
int (*mode_disable)(const struct device *dev, uint32_t mode);
|
||||||
int (*mode_enable)(const struct device *dev, uint32_t mode);
|
int (*mode_enable)(const struct device *dev, uint32_t mode);
|
||||||
|
@ -180,15 +180,15 @@ static inline int32_t regulator_list_voltages(const struct device *dev,
|
||||||
* @brief Check if a voltage range is supported.
|
* @brief Check if a voltage range is supported.
|
||||||
*
|
*
|
||||||
* @param dev Regulator device instance.
|
* @param dev Regulator device instance.
|
||||||
* @param min_uV Minimum voltage in microvolts.
|
* @param min_uv Minimum voltage in microvolts.
|
||||||
* @param max_uV maximum voltage in microvolts.
|
* @param max_uv maximum voltage in microvolts.
|
||||||
*
|
*
|
||||||
* @retval 0 If successful.
|
* @retval 0 If successful.
|
||||||
* @retval -ENOSYS If function is not implemented.
|
* @retval -ENOSYS If function is not implemented.
|
||||||
* @retval -errno In case of any other error.
|
* @retval -errno In case of any other error.
|
||||||
*/
|
*/
|
||||||
static inline int regulator_is_supported_voltage(const struct device *dev,
|
static inline int regulator_is_supported_voltage(const struct device *dev,
|
||||||
int32_t min_uV, int32_t max_uV)
|
int32_t min_uv, int32_t max_uv)
|
||||||
{
|
{
|
||||||
const struct regulator_driver_api *api =
|
const struct regulator_driver_api *api =
|
||||||
(const struct regulator_driver_api *)dev->api;
|
(const struct regulator_driver_api *)dev->api;
|
||||||
|
@ -197,7 +197,7 @@ static inline int regulator_is_supported_voltage(const struct device *dev,
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return api->is_supported_voltage(dev, min_uV, max_uV);
|
return api->is_supported_voltage(dev, min_uv, max_uv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -208,15 +208,15 @@ static inline int regulator_is_supported_voltage(const struct device *dev,
|
||||||
* voltage.
|
* voltage.
|
||||||
*
|
*
|
||||||
* @param dev Regulator device instance.
|
* @param dev Regulator device instance.
|
||||||
* @param min_uV Minimum acceptable voltage in microvolts.
|
* @param min_uv Minimum acceptable voltage in microvolts.
|
||||||
* @param max_uV Maximum acceptable voltage in microvolts.
|
* @param max_uv Maximum acceptable voltage in microvolts.
|
||||||
*
|
*
|
||||||
* @retval 0 If successful.
|
* @retval 0 If successful.
|
||||||
* @retval -ENOSYS If function is not implemented.
|
* @retval -ENOSYS If function is not implemented.
|
||||||
* @retval -errno In case of any other error.
|
* @retval -errno In case of any other error.
|
||||||
*/
|
*/
|
||||||
static inline int regulator_set_voltage(const struct device *dev,
|
static inline int regulator_set_voltage(const struct device *dev,
|
||||||
int32_t min_uV, int32_t max_uV)
|
int32_t min_uv, int32_t max_uv)
|
||||||
{
|
{
|
||||||
const struct regulator_driver_api *api =
|
const struct regulator_driver_api *api =
|
||||||
(const struct regulator_driver_api *)dev->api;
|
(const struct regulator_driver_api *)dev->api;
|
||||||
|
@ -225,7 +225,7 @@ static inline int regulator_set_voltage(const struct device *dev,
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return api->set_voltage(dev, min_uV, max_uV);
|
return api->set_voltage(dev, min_uv, max_uv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -251,15 +251,15 @@ static inline int32_t regulator_get_voltage(const struct device *dev)
|
||||||
* @brief Set output current limit.
|
* @brief Set output current limit.
|
||||||
*
|
*
|
||||||
* @param dev Regulator device instance.
|
* @param dev Regulator device instance.
|
||||||
* @param min_uA Minimum acceptable current limit in microamps.
|
* @param min_ua Minimum acceptable current limit in microamps.
|
||||||
* @param max_uA Maximum acceptable current limit in microamps.
|
* @param max_ua Maximum acceptable current limit in microamps.
|
||||||
*
|
*
|
||||||
* @retval 0 If successful.
|
* @retval 0 If successful.
|
||||||
* @retval -ENOSYS If function is not implemented.
|
* @retval -ENOSYS If function is not implemented.
|
||||||
* @retval -errno In case of any other error.
|
* @retval -errno In case of any other error.
|
||||||
*/
|
*/
|
||||||
static inline int regulator_set_current_limit(const struct device *dev,
|
static inline int regulator_set_current_limit(const struct device *dev,
|
||||||
int32_t min_uA, int32_t max_uA)
|
int32_t min_ua, int32_t max_ua)
|
||||||
{
|
{
|
||||||
const struct regulator_driver_api *api =
|
const struct regulator_driver_api *api =
|
||||||
(const struct regulator_driver_api *)dev->api;
|
(const struct regulator_driver_api *)dev->api;
|
||||||
|
@ -268,7 +268,7 @@ static inline int regulator_set_current_limit(const struct device *dev,
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return api->set_current_limit(dev, min_uA, max_uA);
|
return api->set_current_limit(dev, min_ua, max_ua);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -327,16 +327,16 @@ static inline int regulator_set_mode(const struct device *dev, uint32_t mode)
|
||||||
*
|
*
|
||||||
* @param dev Regulator device instance.
|
* @param dev Regulator device instance.
|
||||||
* @param mode Regulator mode.
|
* @param mode Regulator mode.
|
||||||
* @param min_uV Minimum acceptable voltage in microvolts.
|
* @param min_uv Minimum acceptable voltage in microvolts.
|
||||||
* @param max_uV Maximum acceptable voltage in microvolts.
|
* @param max_uv Maximum acceptable voltage in microvolts.
|
||||||
*
|
*
|
||||||
* @retval 0 If successful.
|
* @retval 0 If successful.
|
||||||
* @retval -ENOSYS If function is not implemented.
|
* @retval -ENOSYS If function is not implemented.
|
||||||
* @retval -errno In case of any other error.
|
* @retval -errno In case of any other error.
|
||||||
*/
|
*/
|
||||||
static inline int regulator_set_mode_voltage(const struct device *dev,
|
static inline int regulator_set_mode_voltage(const struct device *dev,
|
||||||
uint32_t mode, int32_t min_uV,
|
uint32_t mode, int32_t min_uv,
|
||||||
int32_t max_uV)
|
int32_t max_uv)
|
||||||
{
|
{
|
||||||
const struct regulator_driver_api *api =
|
const struct regulator_driver_api *api =
|
||||||
(const struct regulator_driver_api *)dev->api;
|
(const struct regulator_driver_api *)dev->api;
|
||||||
|
@ -345,7 +345,7 @@ static inline int regulator_set_mode_voltage(const struct device *dev,
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return api->set_mode_voltage(dev, mode, min_uV, max_uV);
|
return api->set_mode_voltage(dev, mode, min_uv, max_uv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue