[PATCH v2 0/2] regulator: fix pickable ranges vsel caching

From: Matti Vaittinen
Date: Mon May 20 2024 - 08:31:53 EST


This series addresses a potential problem where the voltage selector for
pickable-ranges is used in same fashion as a 'apply-bit'. Eg, when a
regulator voltage is changed so that also the range changes, the effect
of the range and voltage selector change is not taken into account until
the voltage selector is written to hardware. In such case caching the
voltage-selector value will cause the voltage range change to not change
the actual output voltage.

Patch 1 addresses this issue by adding a flag to regulator desc to
advertise this behaviour and by always writing the VSEL register value to
hardware if range was changed.

Patch 2 sets that flag to Texsas instrument's tps6287x driver because,
according to the data-sheet, the TI's PMICs VSEL register must be always
written after the range has been changed. Please note that this has not
been tested in TI's hardware but the concept is only quickly verified on
ROHM's BD71851. All testing is appreciated.

Revision history:
- v2:
- Change series name to reflect content that is still not
merged.
- Drop already applied patches.
- Add patch fixing TI's tps2687x.
- Don't bypass cache for pickable-ranges users who don't have.
the 'VSEL as apply' behaviour.
- Bypass cache only if range was changed.
- v1:
https://lore.kernel.org/all/cover.1715848512.git.mazziesaccount@xxxxxxxxx/

series is base on regulator/for-next

---

Matti Vaittinen (2):
regulator: pickable ranges: don't always cache vsel
regulator: tps6287x: Force writing VSEL bit

drivers/regulator/helpers.c | 43 ++++++++++++++++++--------
drivers/regulator/tps6287x-regulator.c | 1 +
include/linux/regulator/driver.h | 3 ++
3 files changed, 34 insertions(+), 13 deletions(-)

--
2.45.1


--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]

Attachment: signature.asc
Description: PGP signature