drivers: regulator: Added initial voltage configuration

The regulator driver has a configured min/max range that is used
to limit set values, and to initialise the regulator.

A new init value has been added, so that the startup voltage can
be higher than the lowest permitted value.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
This commit is contained in:
Andy Sinclair 2023-03-13 13:29:30 +00:00 committed by Carles Cufí
commit a00713bc45
3 changed files with 15 additions and 0 deletions

View file

@ -28,6 +28,13 @@ int regulator_common_init(const struct device *dev, bool is_enabled)
}
}
if (config->init_uv > INT32_MIN) {
ret = regulator_set_voltage(dev, config->init_uv, config->init_uv);
if (ret < 0) {
return ret;
}
}
/* If we have valid range values, we try to match them before enabling */
if ((config->min_uv > INT32_MIN) || (config->max_uv < INT32_MAX)) {