Commit graph

9 commits

Author SHA1 Message Date
Balaji Srinivasan d9b3ffa5ea drivers: regulator: npm6001: Fix compiler warning
This patch fixes a compiler warning about the val being used
uninitialized. The previously present if check did not seem to satisfy
compiler. Hence the val is now explictly initialized.

Signed-off-by: Balaji Srinivasan <balaji.srinivasan@nordicsemi.no>
2024-05-13 09:54:48 -05:00
Gerard Marull-Paretas 9494981181 drivers: regulator: npm6001: remove common device
Common device part is now handled by the nPM6001 MFD device driver.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-24 19:39:55 -04:00
Gerard Marull-Paretas 5521db3576 drivers: regulator: npm6001: format code
Format code using clang-format. This will ease incoming refactor.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-24 19:39:55 -04:00
Gerard Marull-Paretas 0c28da26ba drivers: regulator: npm6001: handle LDO0 set voltage correctly
Even if the regulator is fixed, allow valid voltage input (1.8V).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-16 16:52:35 +01:00
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
Gerard Marull-Paretas a6575e5834 drivers: regulator: npm6001: add support for BUCK1/2 disable
BUCK1/2 are defined as "always on" regulators, however, there is a
special override register that allows to turn them on/off.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-09 16:19:09 +00:00
Gerard Marull-Paretas 7feb008c85 drivers: regulator: common: allow to specify on by default
Some regulators are enabled by default, however, such condition cannot
be captured now by the regulator driver API. Refactor
regulator_common_init_enable to regulator_common_init (enable removed,
as it also sets mode) and add a new argument to specify such condition.
With this change, regulator_disable() and regulator_is_enabled() work as
expected without a first call to regulator_enable().

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-09 16:19:09 +00:00
Gerard Marull-Paretas 5ec95ef35e drivers: regulator: npm6001: add support for get_mode
Allow to query operating mode on each BUCK converter (PWM or
Hysteretic).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-27 13:12:55 +01:00
Gerard Marull-Paretas 7568749c8c drivers: regulator: initial driver for nPM6001
Add initial driver for the nPM6001 PMIC.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-16 11:26:47 +01:00