linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v8 00/10] Support ROHM BD79124 ADC
@ 2025-03-17 15:49 Matti Vaittinen
  2025-03-17 15:50 ` [PATCH v8 01/10] dt-bindings: ROHM BD79124 ADC/GPO Matti Vaittinen
                   ` (9 more replies)
  0 siblings, 10 replies; 23+ messages in thread
From: Matti Vaittinen @ 2025-03-17 15:49 UTC (permalink / raw)
  To: Matti Vaittinen, Matti Vaittinen
  Cc: Javier Carrasco, linux-arm-kernel, Samuel Holland, Sakari Ailus,
	netdev, Rob Herring, Matti Vaittinen, Herve Codina,
	Thomas Bonnefille, Jernej Skrabec, Nuno Sa, Laurent Pinchart,
	linux-media, Jonathan Cameron, Claudiu Manoil, devicetree,
	Marcelo Schmitt, Lad Prabhakar, Mauro Carvalho Chehab,
	Heikki Krogerus, David S. Miller, Lars-Peter Clausen, linux-acpi,
	linux-renesas-soc, linux-iio, Krzysztof Kozlowski, linux-kernel,
	linux-sunxi, Eric Dumazet, Conor Dooley, Danilo Krummrich,
	Olivier Moysan, Trevor Gamblin, Ramona Alexandra Nechita,
	Paul Elder, Greg Kroah-Hartman, Matteo Martelli, Guillaume Stols,
	Alisa-Dariana Roman, Jakub Kicinski, Andy Shevchenko,
	AngeloGioacchino Del Regno, Dumitru Ceclan, Paolo Abeni,
	Rafael J. Wysocki, Andrew Lunn, David Lechner, Chen-Yu Tsai,
	Daniel Scally

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

Support ROHM BD79124 ADC.

This series adds also couple of IIO ADC helper functions for parsing the
channel information from the device tree. There are also new helpers
included for iterating and counting firmware child nodes with a specific
name.

Series does also convert couple of drivers to use these helpers. The
rzg2l_adc and the sun20i-gpadc are converted to use the new ADC helper.

The gianfar driver under net and the thp7312 under media/i2c are added as
first users of the newly added "named child node" -helpers.

There has been some discussion about how useful these ADC helpers are,
and whether they should support also differential and single ended channel
configurations. This version does not include support for those - with the
benefit of reduced complexity and easier to use API.

NOTE: Patches 4,5,9 and 10 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:

v7 => v8:
  property helpers:
    - Fix the example in fwnode_get_named_child_node_count() documentation
      to use the fwnode_get_named_child_node_count() and not the
      device_get_named_child_node_count()
    - Fix the rest of the new macro's indentiations
  adc helpers:
    - Treat 0 ADC channels as an error in
      devm_iio_adc_device_alloc_chaninfo_se().
  rzg2l_adc / sun20i-gpadc:
    - Drop zero channels check from the ADC drivers using
      devm_iio_adc_device_alloc_chaninfo_se()
  BD79124:
    - Use unsigned for regmap values
    - Commit message fine tuning
    - Check devm_mutex_init() return value
    - Handle 'ALL pins as ADC or GPO' cleanly in BD79124 driver
    - BD79124 styling / typofixes

v6 => v7:
 - Inline device_get_named_child_node_count()
 - Fix kernel-doc for fwnode_get_named_child_node_count()
 - Minor styling fixes
 More accurate changelog in individual patches.

v5 => v6:
 - Drop applied patch
 - Add *_for_each_named_child_* iterators
 - Add a patch converting the thp7312 driver to use the new helper
 - Styling and minor things pointed by reviewers

v4 => v5: Fixes as per various review comments. Most notably:
 - Drop the patch making the TI's ADC driver to respect device tree.
 - Add (RFC) patch converting gianfar driver to use new name child-node
   counting API as suggested by Andy.
 - Add fwnode_get_child_node_count_named() as suggested by Rob.
 - rebase to v6.14-rc5
 More accurate changelog in individual patches.

v3 => v4:
 - Drop the ADC helper support for differential channels
 - Drop the ADC helper for getting only channel IDs by fwnode.
 - "Promote" the function counting the number of child nodes with a
   specific name to the property.h (As suggested by Jonathan).
 - Add ADC helpers to a namespace.
 - Rebase on v6.14-rc3
 - More minor changes described in individual patches.

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 (10):
  dt-bindings: ROHM BD79124 ADC/GPO
  property: Add functions to iterate named child
  iio: adc: add helpers for parsing ADC nodes
  iio: adc: rzg2l_adc: Use adc-helpers
  iio: adc: sun20i-gpadc: Use adc-helpers
  iio: adc: Support ROHM BD79124 ADC
  MAINTAINERS: Add IIO ADC helpers
  MAINTAINERS: Add ROHM BD79124 ADC/GPO
  net: gianfar: Use device_get_child_node_count_named()
  media: thp7312: Use helper for iterating named child nodes

 .../bindings/iio/adc/rohm,bd79124.yaml        |  114 ++
 MAINTAINERS                                   |   12 +
 drivers/base/property.c                       |   27 +
 drivers/iio/adc/Kconfig                       |   17 +
 drivers/iio/adc/Makefile                      |    3 +
 drivers/iio/adc/industrialio-adc.c            |   82 ++
 drivers/iio/adc/rohm-bd79124.c                | 1138 +++++++++++++++++
 drivers/iio/adc/rzg2l_adc.c                   |   39 +-
 drivers/iio/adc/sun20i-gpadc-iio.c            |   39 +-
 drivers/media/i2c/thp7312.c                   |    8 +-
 drivers/net/ethernet/freescale/gianfar.c      |   17 +-
 include/linux/iio/adc-helpers.h               |   27 +
 include/linux/property.h                      |   24 +
 13 files changed, 1481 insertions(+), 66 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: 7eb172143d5508b4da468ed59ee857c6e5e01da6
-- 
2.48.1


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

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

end of thread, other threads:[~2025-03-30 16:08 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-17 15:49 [PATCH v8 00/10] Support ROHM BD79124 ADC Matti Vaittinen
2025-03-17 15:50 ` [PATCH v8 01/10] dt-bindings: ROHM BD79124 ADC/GPO Matti Vaittinen
2025-03-17 15:50 ` [PATCH v8 02/10] property: Add functions to iterate named child Matti Vaittinen
2025-03-18 15:24   ` Sakari Ailus
2025-03-19  6:02     ` Matti Vaittinen
2025-03-19 15:23       ` Sakari Ailus
2025-03-20  6:43         ` Matti Vaittinen
2025-03-30 16:07           ` Jonathan Cameron
2025-03-17 15:50 ` [PATCH v8 03/10] iio: adc: add helpers for parsing ADC nodes Matti Vaittinen
2025-03-17 16:01   ` Andy Shevchenko
2025-03-17 15:51 ` [PATCH v8 04/10] iio: adc: rzg2l_adc: Use adc-helpers Matti Vaittinen
2025-03-17 16:02   ` Andy Shevchenko
2025-03-17 15:51 ` [PATCH v8 05/10] iio: adc: sun20i-gpadc: " Matti Vaittinen
2025-03-17 16:03   ` Andy Shevchenko
2025-03-17 15:51 ` [PATCH v8 06/10] iio: adc: Support ROHM BD79124 ADC Matti Vaittinen
2025-03-17 16:43   ` Andy Shevchenko
2025-03-18  7:35     ` Matti Vaittinen
2025-03-17 15:51 ` [PATCH v8 07/10] MAINTAINERS: Add IIO ADC helpers Matti Vaittinen
2025-03-17 15:51 ` [PATCH v8 08/10] MAINTAINERS: Add ROHM BD79124 ADC/GPO Matti Vaittinen
2025-03-17 15:52 ` [PATCH net-next v8 09/10] net: gianfar: Use device_get_child_node_count_named() Matti Vaittinen
2025-03-19 16:07   ` Simon Horman
2025-03-20  6:12     ` Matti Vaittinen
2025-03-17 15:52 ` [PATCH v8 10/10] media: thp7312: Use helper for iterating named child nodes Matti Vaittinen

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