devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/9] Support ROHM BD79124 ADC
@ 2025-02-19 12:29 Matti Vaittinen
  2025-02-19 12:30 ` [PATCH v3 1/9] dt-bindings: ROHM BD79124 ADC/GPO Matti Vaittinen
                   ` (8 more replies)
  0 siblings, 9 replies; 32+ messages in thread
From: Matti Vaittinen @ 2025-02-19 12:29 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Matti Vaittinen, Lad Prabhakar,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Hugo Villeneuve,
	Nuno Sa, David Lechner, Javier Carrasco, Andy Shevchenko,
	linux-iio, devicetree, linux-kernel, linux-renesas-soc,
	linux-arm-kernel, linux-sunxi, Linus Walleij

[-- Attachment #1: Type: text/plain, Size: 3797 bytes --]

Support ROHM BD79124 ADC.

This series adds also couple of helper functions for parsing the channel
information from the device tree. There has been some discussion about
how useful these are, and whether they should support also differential
and single ended channel configurations. This version adds support for
those - with the cost of added complexity and somewhat harder to use
API. I've babbled more about that in the patch 2/9. (And, I actually
wonder if I should've returned this to RFC?)

The last couple of patches are examples of drivers which could utilize
these added helpers:
 - 6/9 converts rzg2l_adc to use helpers
 - 7/9 converts sun20i-gpadc to use helpers
 - 9/9 makes the ti-ads7924 to respect the channel specification give in
   the device-tree using these helpers.

patch 8/9 is small simplification for the ti-ads7924, and it can be
taken independently from the rest of the series.

NOTE: Patches 6...9 are untested as I lack of relevant HW. They have
been compile tested only.

The ROHM BD79124 ADC itself is quite usual stuff. 12-bit, 8-channel ADC
with threshold monitoring.

Except that:
 - each ADC input pin can be configured as a general purpose output.
 - manually starting an ADC conversion and reading the result would
   require the I2C _master_ to do clock stretching(!) for the duration
   of the conversion... Let's just say this is not well supported.
 - IC supports 'autonomous measurement mode' and storing latest results
   to the result registers. This mode is used by the driver due to the
   "peculiar" I2C when doing manual reads.

Furthermore, the ADC uses this continuous autonomous measuring,
and the IC keeps producing new 'out of window' IRQs if measurements are
out of window - the driver disables the event for 1 seconds when sending
it to user. This prevents generating storm of events

Revision history:
v2 => v3:
 - Restrict BD79124 channel numbers as suggested by Conor and add
   Conor's Reviewed-by tag.
 - Support differential and single-ended inputs
 - Convert couple of existing drivers to use the added ADC helpers
 - Minor fixes based on reviews
Link to v2:
https://lore.kernel.org/all/cover.1738761899.git.mazziesaccount@gmail.com/

RFC v1 => v2:
 - Drop MFD and pinmux.
 - Automatically re-enable events after 1 second.
 - Export fwnode parsing helpers for finding the ADC channels.

---

Matti Vaittinen (9):
  dt-bindings: ROHM BD79124 ADC/GPO
  iio: adc: add helpers for parsing ADC nodes
  iio: adc: Support ROHM BD79124 ADC
  MAINTAINERS: Add IIO ADC helpers
  MAINTAINERS: Add ROHM BD79124 ADC/GPO
  iio: adc: rzg2l_adc: Use adc-helpers
  iio: adc: sun20i-gpadc: Use adc-helpers
  iio: adc: ti-ads7924 Drop unnecessary function parameters
  iio: adc: ti-ads7924: Respect device tree config

 .../bindings/iio/adc/rohm,bd79124.yaml        |  114 ++
 MAINTAINERS                                   |   12 +
 drivers/iio/adc/Kconfig                       |   15 +
 drivers/iio/adc/Makefile                      |    2 +
 drivers/iio/adc/industrialio-adc.c            |  304 +++++
 drivers/iio/adc/rohm-bd79124.c                | 1162 +++++++++++++++++
 drivers/iio/adc/rzg2l_adc.c                   |   41 +-
 drivers/iio/adc/sun20i-gpadc-iio.c            |   42 +-
 drivers/iio/adc/ti-ads7924.c                  |   85 +-
 include/linux/iio/adc-helpers.h               |   56 +
 10 files changed, 1742 insertions(+), 91 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/rohm,bd79124.yaml
 create mode 100644 drivers/iio/adc/industrialio-adc.c
 create mode 100644 drivers/iio/adc/rohm-bd79124.c
 create mode 100644 include/linux/iio/adc-helpers.h


base-commit: 5bc55a333a2f7316b58edc7573e8e893f7acb532
-- 
2.48.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2025-03-02  2:44 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-19 12:29 [PATCH v3 0/9] Support ROHM BD79124 ADC Matti Vaittinen
2025-02-19 12:30 ` [PATCH v3 1/9] dt-bindings: ROHM BD79124 ADC/GPO Matti Vaittinen
2025-02-19 12:30 ` [PATCH v3 2/9] iio: adc: add helpers for parsing ADC nodes Matti Vaittinen
2025-02-19 20:41   ` Andy Shevchenko
2025-02-20  7:13     ` Matti Vaittinen
2025-02-20 12:41       ` Andy Shevchenko
2025-02-20 13:40         ` Matti Vaittinen
2025-02-20 14:04           ` Andy Shevchenko
2025-02-20 14:21             ` Matti Vaittinen
2025-02-20 14:56               ` Andy Shevchenko
2025-02-21 10:10                 ` Matti Vaittinen
2025-02-21 16:41                   ` Andy Shevchenko
2025-02-22 14:34                     ` Matti Vaittinen
2025-02-22 17:48                     ` Jonathan Cameron
2025-02-23 16:13   ` Jonathan Cameron
2025-02-24 13:45     ` Matti Vaittinen
2025-02-19 12:30 ` [PATCH v3 3/9] iio: adc: Support ROHM BD79124 ADC Matti Vaittinen
2025-02-23 16:28   ` Jonathan Cameron
2025-02-24  6:14     ` Matti Vaittinen
2025-03-02  2:44       ` Jonathan Cameron
2025-02-19 12:30 ` [PATCH v3 4/9] MAINTAINERS: Add IIO ADC helpers Matti Vaittinen
2025-02-19 12:31 ` [PATCH v3 5/9] MAINTAINERS: Add ROHM BD79124 ADC/GPO Matti Vaittinen
2025-02-19 12:31 ` [PATCH v3 6/9] iio: adc: rzg2l_adc: Use adc-helpers Matti Vaittinen
2025-02-19 13:36   ` Matti Vaittinen
2025-02-20 16:07   ` kernel test robot
2025-02-23 16:30   ` Jonathan Cameron
2025-02-24  5:40     ` Matti Vaittinen
2025-02-19 12:31 ` [PATCH v3 7/9] iio: adc: sun20i-gpadc: " Matti Vaittinen
2025-02-20 16:17   ` kernel test robot
2025-02-19 12:32 ` [PATCH v3 8/9] iio: adc: ti-ads7924 Drop unnecessary function parameters Matti Vaittinen
2025-02-19 12:32 ` [PATCH v3 9/9] iio: adc: ti-ads7924: Respect device tree config Matti Vaittinen
2025-03-01  3:06   ` Jonathan Cameron

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).