zephyr/drivers/regulator
Ionut Catalin Pavel 867c254801 drivers: regulator: common: skip voltage change at init if already valid
The current implementation always sets the voltage before enabling,
even if the current voltage is in the allowed range.

This has some side effects, i.e. for PMIC regulators that are
pre-programmed for a specific value but allow voltage changes during
runtime. The side effect being that the regulator will always be reset
to the lower value of the voltage range at init.

Another usecase would be when a bootloader sets a specific voltage then
loads an application that uses the same driver.

The proposed fix is to evaluate the current voltage and try to bring
the actual voltage in range if the current voltage is not valid
according to the min/max constraints.

Tested on custom SAMD20 board with a custom RK816 PMIC driver.

Signed-off-by: Ionut Catalin Pavel <iocapa@iocapa.com>
2023-03-13 18:33:26 +00:00
..
CMakeLists.txt drivers: regulator: add support for RaspberryPi Pico regulator. 2023-03-02 21:14:34 +01:00
Kconfig drivers: regulator: add support for RaspberryPi Pico regulator. 2023-03-02 21:14:34 +01:00
Kconfig.fake drivers: regulator: add fake driver 2022-12-20 10:15:29 +00:00
Kconfig.fixed
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
Kconfig.rpi_pico drivers: regulator: add support for RaspberryPi Pico regulator. 2023-03-02 21:14:34 +01:00
regulator_common.c drivers: regulator: common: skip voltage change at init if already valid 2023-03-13 18:33:26 +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 drivers: regulator: npm6001: handle LDO0 set voltage correctly 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_rpi_pico.c drivers: regulator: add support for RaspberryPi Pico regulator. 2023-03-02 21:14:34 +01:00
regulator_shell.c drivers: regulator: shell: fix fp number parsing 2023-01-16 16:52:35 +01:00