devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Add support for AD4052 device family
@ 2025-03-06 14:03 Jorge Marques
  2025-03-06 14:03 ` [PATCH 1/4] iio: code: mark iio_dev as const in iio_buffer_enabled Jorge Marques
                   ` (3 more replies)
  0 siblings, 4 replies; 30+ messages in thread
From: Jorge Marques @ 2025-03-06 14:03 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Michael Hennerich,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jonathan Corbet,
	David Lechner
  Cc: linux-iio, linux-kernel, devicetree, linux-doc, Jorge Marques

The AD4052/AD4058/AD4050/AD4056 are versatile, 16-bit/12-bit,
successive approximation register (SAR) analog-to-digital converter (ADC).

The series starts with marking iio_dev as const in iio_buffer_enabled,
to not discard the qualifier when calling from get_current_can_type.
This is required since the size of storage bytes varies if the offload
buffer is used or not.

The scan_type also depends if the oversampling feature is enabled, since
the 16-bit device increases the SPI word size from 16-bit to 24-bit.
Also due to this, the spi message optimization is balanced on the buffer ops,
instead of once per probe.
SPI messages related to exiting the ADC mode, and reading raw values are
never optimized.

The device has autonomous monitoring capabilities, that are exposed as IIO
events. Since register access requires leaving the monitoring
state and returning, device access is blocked until the IIO event is disabled.
An auxiliary method ad4052_iio_device_claim_direct manages the IIO claim
direct as well as the required wait_event boolean.
The device has an internal sampling rate for the autonomous modes,
exposed as the sample_rate attribute.

The device contains two required outputs:

* gp0: Threshold event interrupt on the rising edge.
* gp1: ADC conversion ready signal on the falling edge.
       The user should either invert the signal or set the IRQ as falling edge.

And one optional input:

* cnv: Triggers a conversion, can be replaced by shortening the CNV and
  SPI CS trace.

The devices utilizes PM to enter the low power mode.

The driver can be used with SPI controllers with and without offload support.

A FPGA design is available:
https://analogdevicesinc.github.io/hdl/projects/ad4052_ardz/

The devices datasheet:
https://www.analog.com/media/en/technical-documentation/data-sheets/ad4050-ad4056.pdf
https://www.analog.com/media/en/technical-documentation/data-sheets/ad4052-ad4058.pdf

The unique monitoring capabilities and multiple GPIOs where the decision factor
to have a standalone driver for this device family.

Non-implemented features:

* Status word: First byte of the SPI transfer aligned to the register
  address.
* Averaging mode: Similar to burst averaging mode used in the
  oversampling, but requiring a sequence of CNV triggers for each
  conversion.
* Monitor mode: Similar to trigger mode used in the monitoring mode, but
  doesn't exit to configuration mode on event, being awkward to expose
  to user space. 

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
---
Jorge Marques (4):
      iio: code: mark iio_dev as const in iio_buffer_enabled
      dt-bindings: iio: adc: Add adi,ad4052
      docs: iio: new docs for ad4052 driver
      iio: adc: add support for ad4052

 .../devicetree/bindings/iio/adc/adi,ad4052.yaml    |   80 ++
 Documentation/iio/ad4052.rst                       |   93 ++
 MAINTAINERS                                        |    8 +
 drivers/iio/adc/Kconfig                            |   14 +
 drivers/iio/adc/Makefile                           |    1 +
 drivers/iio/adc/ad4052.c                           | 1289 ++++++++++++++++++++
 drivers/iio/industrialio-core.c                    |    2 +-
 include/linux/iio/iio.h                            |    2 +-
 8 files changed, 1487 insertions(+), 2 deletions(-)
---
base-commit: aac287ec80d71a7ab7e44c936a434625417c3e30
change-id: 20250306-iio-driver-ad4052-a4acc3bb11b3

Best regards,
-- 
Jorge Marques <jorge.marques@analog.com>


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

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

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-06 14:03 [PATCH 0/4] Add support for AD4052 device family Jorge Marques
2025-03-06 14:03 ` [PATCH 1/4] iio: code: mark iio_dev as const in iio_buffer_enabled Jorge Marques
2025-03-06 14:03 ` [PATCH 2/4] dt-bindings: iio: adc: Add adi,ad4052 Jorge Marques
2025-03-06 16:31   ` Conor Dooley
2025-03-08 15:05     ` Jonathan Cameron
2025-03-09 19:43     ` Jorge Marques
2025-03-10 19:35       ` Jonathan Cameron
2025-03-07 10:51   ` David Lechner
2025-03-09 20:11     ` Jorge Marques
2025-03-08 15:10   ` Jonathan Cameron
2025-03-09 20:25     ` Jorge Marques
2025-03-06 14:03 ` [PATCH 3/4] docs: iio: new docs for ad4052 driver Jorge Marques
2025-03-07 10:52   ` David Lechner
2025-03-09 20:49     ` Jorge Marques
2025-03-10 14:31       ` David Lechner
2025-03-10 19:56         ` Jonathan Cameron
2025-03-14 17:34           ` Jorge Marques
2025-03-15 18:24             ` Jonathan Cameron
2025-03-10 19:54       ` Jonathan Cameron
2025-03-14 18:13         ` Jorge Marques
2025-03-14 18:56           ` David Lechner
2025-03-19 16:59             ` Jorge Marques
2025-03-06 14:03 ` [PATCH 4/4] iio: adc: add support for ad4052 Jorge Marques
2025-03-07 12:06   ` kernel test robot
2025-03-07 12:39   ` kernel test robot
2025-03-07 14:22   ` kernel test robot
2025-03-08 16:02   ` Jonathan Cameron
2025-03-10 11:36     ` Jorge Marques
2025-03-08 16:12   ` Christophe JAILLET
2025-03-10 11:37     ` Jorge Marques

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