drivers: regulator: improve regulator_get_current_limit
- Function returns now the value by reference, similar to voltage counterparts. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
8db7e046c5
commit
2bd6d50934
3 changed files with 15 additions and 9 deletions
|
@ -308,16 +308,19 @@ static int regulator_pca9420_get_voltage(const struct device *dev,
|
|||
* Part of the extended regulator consumer API
|
||||
* Gets the set current limit for the regulator
|
||||
*/
|
||||
static int regulator_pca9420_get_current_limit(const struct device *dev)
|
||||
static int regulator_pca9420_get_current_limit(const struct device *dev,
|
||||
int32_t *curr_ua)
|
||||
{
|
||||
const struct regulator_pca9420_config *config = dev->config;
|
||||
const struct regulator_pca9420_common_config *cconfig = config->parent->config;
|
||||
|
||||
if (cconfig->vin_ilim_ua == 0U) {
|
||||
return config->max_ua;
|
||||
*curr_ua = config->max_ua;
|
||||
} else {
|
||||
*curr_ua = MIN(config->max_ua, cconfig->vin_ilim_ua);
|
||||
}
|
||||
|
||||
return MIN(config->max_ua, cconfig->vin_ilim_ua);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int regulator_pca9420_set_mode(const struct device *dev, uint32_t mode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue