zephyr/drivers/regulator
Gerard Marull-Paretas e086738b88 sys: linear_range: allow out-of-range values/windows
The existing linear_range API did not allow values or windows outside of
the linear range (returned -EINVAL). With this change values are allowed
outside of the range, being adjusted to the edge values (min/max)
instead. In the case of windows, it is allowed to have partial
intersection. In both cases, the API assigns a valid index (nearest) and
returns -ERANGE. This change is useful because the main client of the
linear range API, regulators, needs such behavior. For example, If an
application specifies a voltage range from 1.0V to 1.5V and the
regulator supports from 1.2V to 2.7V, the regulator can configure a
voltage that satisfies the condition: 1.2V.  With the current API, the
input would be refused because 1.0V lies outside of the 1.2V-2.7V range.

Also, for constant ranges, the minimum index is returned.

Tests have been updated/extended accordingly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-16 16:52:35 +01:00
..
CMakeLists.txt drivers: regulator: npm1100: add initial support 2023-01-12 19:07:05 +01:00
Kconfig drivers: regulator: npm1100: add initial support 2023-01-12 19:07:05 +01:00
Kconfig.fake drivers: regulator: add fake driver 2022-12-20 10:15:29 +00:00
Kconfig.fixed drivers: regulator: Update Kconfig 2022-08-17 09:58:55 -05:00
Kconfig.npm1100 drivers: regulator: npm1100: add initial support 2023-01-12 19:07:05 +01:00
Kconfig.npm6001 drivers: regulator: initial driver for nPM6001 2022-12-16 11:26:47 +01:00
Kconfig.pca9420 drivers: regulator: pca9420: store common config in parent device 2022-11-29 11:54:31 +01:00
regulator_common.c drivers: regulator: common: allow to specify on by default 2023-01-09 16:19:09 +00:00
regulator_fake.c drivers: regulator: common: allow to specify on by default 2023-01-09 16:19:09 +00:00
regulator_fixed.c drivers: regulator: common: allow to specify on by default 2023-01-09 16:19:09 +00:00
regulator_npm1100.c drivers: regulator: npm1100: regulator device may be unused 2023-01-13 16:14:35 +01:00
regulator_npm6001.c sys: linear_range: allow out-of-range values/windows 2023-01-16 16:52:35 +01:00
regulator_pca9420.c sys: linear_range: allow out-of-range values/windows 2023-01-16 16:52:35 +01:00
regulator_shell.c drivers: regulator: shell: fix isdigit() usage 2023-01-04 11:19:25 +01:00