[PATCH RFC 0/2] regulator: dynamic voltage monitoring support
From: Benjamin Bara
Date: Thu Apr 20 2023 - 06:32:37 EST
Hi!
This series targets the "automatic" state handling of voltage monitors
when the state of the monitored regulator is changed. This is e.g.
necessary for the da9063, which reaches an invalid state (!PWR_OK) if
the voltage monitor is not disabled before the regulator is disabled.
The problem could also be tackled inside of the driver's "state change
ops" (.enable(), .disable(), ...) but I thought it might be a good idea
to have a "common framework" independent of the driver's implementation.
Not sure if a good idea, therefore RFC.
For now, 1/2 implements so-called "monitoring constraints", but for now
only for under- and overvoltage monitoring.
2/2 depends on [1], which implements (static) voltage monitoring for the
da9063. It shows a basic example how to use these constraints.
What's not targeted (for now) are possibly required delay times between
monitor state change and regulator state change. For the da9063, these
are not required but I can imagine there are other regulators where they
might be needed?
Possible next step:
"regulators-{uv,ov}-{warn,error,protection}-enable" dt property on chip
level, with either 1 or 0, to en-/disable the dynamic voltage monitoring
for every regulator of the chip. This would require the regulator's
set_{over,under}_voltage_protection() to work with limit = 1.
Thanks & best regards,
Benjamin
[1] https://lore.kernel.org/all/20230403-da9063-disable-unused-v3-0-cc4dc698864c@xxxxxxxxxxx/
---
Benjamin Bara (2):
regulator: introduce regulator monitoring constraints
regulator: da9063: disable monitoring while regulator is off
drivers/regulator/core.c | 155 +++++++++++++++++++++++++++++++----
drivers/regulator/da9063-regulator.c | 17 +++-
include/linux/regulator/machine.h | 34 ++++++++
3 files changed, 190 insertions(+), 16 deletions(-)
---
base-commit: 6a8f57ae2eb07ab39a6f0ccad60c760743051026
change-id: 20230419-dynamic-vmon-e08daa0ac7ad
Best regards,
--
Benjamin Bara <benjamin.bara@xxxxxxxxxxx>