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 drops support for those - with the benefit of reduced complexity and easier to use API. A few of the patches are examples of drivers which could utilize these added helpers: - 4/9 converts rzg2l_adc to use helpers - 5/9 converts sun20i-gpadc to use helpers - 6,7/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 4...7 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: 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@xxxxxxxxx/ 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 device_get_child_node_count_named() iio: adc: add helpers for parsing ADC nodes 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 iio: adc: Support ROHM BD79124 ADC MAINTAINERS: Add IIO ADC helpers MAINTAINERS: Add ROHM BD79124 ADC/GPO .../bindings/iio/adc/rohm,bd79124.yaml | 114 ++ MAINTAINERS | 12 + drivers/base/property.c | 28 + drivers/iio/adc/Kconfig | 18 + drivers/iio/adc/Makefile | 3 + drivers/iio/adc/industrialio-adc.c | 89 ++ drivers/iio/adc/rohm-bd79124.c | 1114 +++++++++++++++++ drivers/iio/adc/rzg2l_adc.c | 38 +- drivers/iio/adc/sun20i-gpadc-iio.c | 38 +- drivers/iio/adc/ti-ads7924.c | 83 +- include/linux/iio/adc-helpers.h | 22 + include/linux/property.h | 2 + 12 files changed, 1470 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: 0ad2507d5d93f39619fc42372c347d6006b64319 -- 2.48.1
Attachment:
signature.asc
Description: PGP signature