Messages in this thread | | | From | Benjamin Bara <> | Subject | [PATCH RFC v4 00/13] regulator: dynamic voltage monitoring support | Date | Tue, 20 Jun 2023 22:02:53 +0200 |
| |
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/20230616143736.2946173-1-martin.fuzzey@flowbird.group/
--- 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/20230419-dynamic-vmon-v3-0-4179b586d8a1@skidata.com
--- 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, -- Benjamin Bara <benjamin.bara@skidata.com>
| |