linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7] regulator: new API for voltage reference supplies
@ 2024-04-29 23:40 David Lechner
  2024-04-29 23:40 ` [PATCH v2 1/7] regulator: devres: add API for reference voltage supplies David Lechner
                   ` (8 more replies)
  0 siblings, 9 replies; 16+ messages in thread
From: David Lechner @ 2024-04-29 23:40 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jean Delvare, Guenter Roeck,
	Jonathan Cameron, Dmitry Torokhov
  Cc: David Lechner, Jonathan Corbet, Support Opensource,
	Cosmin Tanislav, Lars-Peter Clausen, Michael Hennerich,
	Antoniu Miclaus, Greg Kroah-Hartman, linux-doc, linux-kernel,
	linux-hwmon, linux-iio, linux-staging, linux-input,
	Jonathan Cameron

In the IIO subsystem, we noticed a pattern in many drivers where we need
to get, enable and get the voltage of a supply that provides a reference
voltage. In these cases, we only need the voltage and not a handle to
the regulator. Another common pattern is for chips to have an internal
reference voltage that is used when an external reference is not
available. There are also a few drivers outside of IIO that do the same.

So we would like to propose a new regulator consumer API to handle these
specific cases to avoid repeating the same boilerplate code in multiple
drivers.

As an example of how these functions are used, I have included a few
patches to consumer drivers. But to avoid a giant patch bomb, I have
omitted the iio/adc and iio/dac patches I have prepared from this
series. I will send those separately but these will add 36 more users
of devm_regulator_get_enable_read_voltage() in addition to the 6 here.
In total, this will eliminate nearly 1000 lines of similar code and will
simplify writing and reviewing new drivers in the future.

---
Changes in v2:
- Reworked regulator patch to remove dev_err_probe() and properly unwind
- Combined two proposed functions into a single function
- Renamed function to devm_regulator_get_enable_read_voltage() everywhere
- Fixed other feedback on consumer patches (see individual patches)
- Picked up Jonathan's Reviewed-bys (hopefully changes were trivial enough)
- Link to v1: https://lore.kernel.org/r/20240327-regulator-get-enable-get-votlage-v1-0-5f4517faa059@baylibre.com

---
David Lechner (7):
      regulator: devres: add API for reference voltage supplies
      hwmon: (adc128d818) Use devm_regulator_get_enable_read_voltage()
      hwmon: (da9052) Use devm_regulator_get_enable_read_voltage()
      iio: addac: ad74115: Use devm_regulator_get_enable_read_voltage()
      iio: frequency: admv1013: Use devm_regulator_get_enable_read_voltage()
      staging: iio: impedance-analyzer: ad5933: Use devm_regulator_get_enable_read_voltage()
      Input: mpr121: Use devm_regulator_get_enable_read_voltage()

 Documentation/driver-api/driver-model/devres.rst |  1 +
 drivers/hwmon/adc128d818.c                       | 57 +++++++----------------
 drivers/hwmon/da9052-hwmon.c                     | 38 ++++-----------
 drivers/iio/addac/ad74115.c                      | 40 ++++++----------
 drivers/iio/frequency/admv1013.c                 | 40 ++++------------
 drivers/input/keyboard/mpr121_touchkey.c         | 45 ++----------------
 drivers/regulator/devres.c                       | 59 ++++++++++++++++++++++++
 drivers/staging/iio/impedance-analyzer/ad5933.c  | 26 +----------
 include/linux/regulator/consumer.h               |  7 +++
 9 files changed, 124 insertions(+), 189 deletions(-)
---
base-commit: 84c1815e46bdcb8bb0259db3d6cdd934cb70a0e9
change-id: 20240326-regulator-get-enable-get-votlage-5dedf40ff338

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-05-07 21:15 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-29 23:40 [PATCH v2 0/7] regulator: new API for voltage reference supplies David Lechner
2024-04-29 23:40 ` [PATCH v2 1/7] regulator: devres: add API for reference voltage supplies David Lechner
2024-04-30 16:19   ` David Lechner
2024-04-29 23:40 ` [PATCH v2 2/7] hwmon: (adc128d818) Use devm_regulator_get_enable_read_voltage() David Lechner
2024-04-30 16:31   ` Guenter Roeck
2024-04-29 23:40 ` [PATCH v2 3/7] hwmon: (da9052) " David Lechner
2024-04-30 16:34   ` Guenter Roeck
2024-04-29 23:40 ` [PATCH v2 4/7] iio: addac: ad74115: " David Lechner
2024-05-04 11:25   ` Jonathan Cameron
2024-04-29 23:40 ` [PATCH v2 5/7] iio: frequency: admv1013: " David Lechner
2024-04-29 23:40 ` [PATCH v2 6/7] staging: iio: impedance-analyzer: ad5933: " David Lechner
2024-04-29 23:40 ` [PATCH v2 7/7] Input: mpr121: " David Lechner
2024-05-07 21:15   ` Dmitry Torokhov
2024-05-06 14:59 ` (subset) [PATCH v2 0/7] regulator: new API for voltage reference supplies Mark Brown
2024-05-06 16:09   ` David Lechner
2024-05-07 14:58 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).