regulator: bd71828: Don't overwrite runtime voltages
authorMatti Vaittinen <mazziesaccount@gmail.com>
Thu, 16 May 2024 08:54:41 +0000 (11:54 +0300)
committerMark Brown <broonie@kernel.org>
Thu, 16 May 2024 12:36:41 +0000 (13:36 +0100)
commit0f9f7c63c415e287cd57b5c98be61eb320dedcfc
tree1f9ef7855f12c1bb561992a09bad6059f3d273ee
parent4e70b26c873dfff317039458a6ea66314bbdce99
regulator: bd71828: Don't overwrite runtime voltages

Some of the regulators on the BD71828 have common voltage setting for
RUN/SUSPEND/IDLE/LPSR states. The enable control can be set for each
state though.

The driver allows setting the voltage values for these states via
device-tree. As a side effect, setting the voltages for
SUSPEND/IDLE/LPSR will also change the RUN level voltage which is not
desired and can break the system.

The comment in code reflects this behaviour, but it is likely to not
make people any happier. The right thing to do is to allow setting the
enable/disable state at SUSPEND/IDLE/LPSR via device-tree, but to
disallow setting state specific voltages for those regulators.

BUCK1 is a bit different. It only shares the SUSPEND and LPSR state
voltages. The former behaviour of allowing to silently overwrite the
SUSPEND state voltage by LPSR state voltage is also changed here so that
the SUSPEND voltage is prioritized over LPSR voltage.

Prevent setting PMIC state specific voltages for regulators which do not
support it.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Fixes: 522498f8cb8c ("regulator: bd71828: Basic support for ROHM bd71828 PMIC regulators")
Link: https://msgid.link/r/e1883ae1e3ae5668f1030455d4750923561f3d68.1715848512.git.mazziesaccount@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/bd71828-regulator.c