Skip to content

RFC regulator: dynamic voltage monitoring support

Benjamin Bara lkml 4 versions – In review

Get series with b4
b4 am [email protected] change-id 20230419-dynamic-vmon-e08daa0ac7ad

Versions newest first

  1. v4 RFC Latest13 patches 15 repliesIn review
  2. v3 RFC5 patches 5 repliesSuperseded
  3. v2 RFC2 patches 1 replySuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v1 RFC2 patches7 repliesSuperseded

Changes in v4 from the cover letter

- introduce helper to handle the monitor state according to the workarounds
- split up commits per workaround implementation
- don't disable monitors of disabled regulators anymore
- implement monitor getter for the da9063
- workarounds are now per-monitor instead of "global"
- require defined ops for workarounds
- ensure that active monitoring is known on regulators with workarounds
- re-enable monitors only if they were disabled
- Link to v3: https://lore.kernel.org/r/[email protected]

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13regulator: da9063: fix null pointer deref with partial DT configdrivers/regulator/da9063-regulator.c+6 -30 replies
2/13regulator: add getter for active monitorsinclude/linux/regulator/driver.h+10 -02 replies
3/13regulator: da9063: implement get_active_protections()drivers/regulator/da9063-regulator.c+20 -00 replies
4/13regulator: bd718x7: implement get_active_protections()drivers/regulator/bd718x7-regulator.c+60 -141 reply
5/13regulator: introduce properties for monitoring workaroundsinclude/linux/regulator/driver.h+18 -01 reply
6/13regulator: set required ops for monitoring workaroundsdrivers/regulator/core.c+34 -01 reply
7/13regulator: find active protections during initializationdrivers/regulator/core.c+41 -04 replies
8/13regulator: move monitor handling into own functiondrivers/regulator/core.c+178 -561 reply
9/13regulator: implement mon_disable_reg_disableddrivers/regulator/core.c+14 -52 replies
10/13regulator: implement mon_disable_reg_set_{higher,lower}drivers/regulator/core.c+37 -41 reply
11/13regulator: implement mon_unsupported_reg_modesdrivers/regulator/core.c+13 -01 reply
12/13regulator: da9063: let the core handle the monitorsdrivers/regulator/da9063-regulator.c+4 -00 replies
13/13regulator: bd718x7: let the core handle the monitorsdrivers/regulator/bd718x7-regulator.c+10 -1261 reply

Reviews trailers per patch

6 of 13 patches have a Reviewed-by or Acked-by.

PatchMatti Vaittinen
1/13
2/13R-b
3/13
4/13R-b
5/13R-b
6/13R-b
7/13
8/13
9/13
10/13
11/13R-b
12/13
13/13A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH RFC v4 00/13] regulator: dynamic voltage monitoring support

Hi!

This series targets the "automatic" state handling of 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.

After feedback from Matti, the new approach doesn't disable the monitors of disabled regulators anymore (except the respective workaround property is set). Additionally, the core differs between initialization and "workaround handling" when it comes to -EOPNOTSUPP.

1/13 is temporary implemented by me now and fixes a bug found by Martin
Fuzzey [1] which can be removed once a follow-up is received.
2/13 introduces a new op to read out the active monitors. 3/13 implements the new op for the da9063.
4/13 implements the new op for the bd718x7 (untested).
5/13 introduces the new "workaround properties".
6/13 ensure that the required regulator ops are implemented. 7/13 find all active regulator monitors the DT is not aware of. 8/13 factors out the existing monitor handling into an own function. {9,10,11}/13 implements the workaround properties in the core. 12/13 implements mon_disable_reg_disabled for da9063.
13/13 implements mon_disable_reg_set_higher for bd718x7 (untested).

As far as I could tell from the implementations, the other two PMICs with voltage protection support (max597x, bd9576) don't require workarounds.

Thanks & best regards,
Benjamin

[1] https://lore.kernel.org/all/[email protected]/

---
Changes in v4:
- introduce helper to handle the monitor state according to the workarounds
- split up commits per workaround implementation
- don't disable monitors of disabled regulators anymore
- implement monitor getter for the da9063
- workarounds are now per-monitor instead of "global"
- require defined ops for workarounds
- ensure that active monitoring is known on regulators with workarounds
- re-enable monitors only if they were disabled
- Link to v3: https://lore.kernel.org/r/[email protected]

---
Benjamin Bara (13):
regulator: da9063: fix null pointer deref with partial DT config
regulator: add getter for active monitors
regulator: da9063: implement get_active_protections()
regulator: bd718x7: implement get_active_protections()
regulator: introduce properties for monitoring workarounds
regulator: set required ops for monitoring workarounds
regulator: find active protections during initialization
regulator: move monitor handling into own function
regulator: implement mon_disable_reg_disabled
regulator: implement mon_disable_reg_set_{higher,lower}
regulator: implement mon_unsupported_reg_modes
regulator: da9063: let the core handle the monitors
regulator: bd718x7: let the core handle the monitors

 drivers/regulator/bd718x7-regulator.c | 210 +++++++------------
 drivers/regulator/core.c              | 370 ++++++++++++++++++++++++++++------
 drivers/regulator/da9063-regulator.c  |  33 ++-
 include/linux/regulator/driver.h      |  28 +++
 4 files changed, 439 insertions(+), 202 deletions(-)

---
base-commit: f1fcbaa18b28dec10281551dfe6ed3a3ed80e3d6
change-id: 20230419-dynamic-vmon-e08daa0ac7ad

Best regards,

Signature · 1 line
Benjamin Bara <[email protected]>