mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/7] iio: adc: ad7625: add LTC2387 and ADAQ2387x support
@ 2026-11-06 16:05 Nicolae-Daniel Deaconescu
  2026-11-06 16:05 ` [PATCH v3 1/7] pwm: core: add pwm_get_waveform_step_might_sleep() Nicolae-Daniel Deaconescu
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Nicolae-Daniel Deaconescu @ 2026-11-06 16:05 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Uwe Kleine-König, Conor Dooley, Krzysztof Kozlowski,
	Rob Herring, David Lechner, Nuno Sá,
	Andy Shevchenko, Michael Hennerich, Trevor Gamblin,
	Joshua Crofts, Sergiu Cuciurean, linux-iio, devicetree,
	linux-pwm, linux-doc, linux-kernel, Nicolae-Daniel Deaconescu

Hi all,

This adds the LTC2387-16, LTC2387-18, ADAQ23875, ADAQ23876 and ADAQ23878
to the ad7625 driver. v1 added them as a separate ltc2387 driver. After
receiving feedback, v2 refactored the driver into the existing ad7625 and
modified the pwm backend for clear layering. This version gives the parts
a binding of their own.

The parts are single channel differential 16 and 18 bit SAR ADCs, up to
15 MSPS. Like the AD762x and AD796x they are read with two PWMs (CNV and
CLK) and an IIO backend that captures the LVDS data. The differences are
handled as chip data and a few quirks:

- Output is double data rate on one or two lanes (TWOLANES pin), so the
  CLK burst is resolution / 4 or resolution / 2 pulses long.
- The burst has to start at least t_FIRSTCLK after CNV and end at most
  t_LASTCLK after the next CNV, so at high rates it runs into the next
  conversion period. The sampling period is raised until it fits. With two
  lanes 15 MSPS is reachable, with one lane the limit is about 10.9 MSPS
  (16 bit) and 10 MSPS (18 bit) at a 120 MHz PWM clock.
- No EN pins. The second PWM is named "clk" for these parts and keeps
  the name "clk_gate" for the existing parts, as renaming it would change
  their binding.
- The ADAQ modules have a fully differential amplifier in front of the
  ADC, so the scale is divided by its gain. The gain is fixed on the
  ADAQ23875 and pin strapped on the ADAQ23876 and ADAQ23878, so it is
  given in the devicetree (adi,gain-milli).

Patches 1 and 2 add what the driver needs from the PWM. The timing of the
burst has to be placed in whole steps of the PWM, and a rounding function
that rounds down can't tell the consumer how big a step is. It was pointed
out in review that reading the rate from a clock breaks if the PWM provider
has a mandatory divider. So the provider now reports the clock rate and the
number of clock cycles per step.

Patch 3 fixes problems of the existing sampling frequency code that the new
parts would also run into, patch 4 uses the standard unit names, and patch 5
only moves code, so that patch 7 adds the new parts without
touching more of the old code than it has to.

Changes since v2:
- Split the binding into adi,ltc2387.yaml and left adi,ad7625.yaml as it
  was.
- Moved the EN pin setup into a helper in a patch of its own.
- Made the Kconfig prompt, the comment at the top of the driver and
  MODULE_DESCRIPTION() generic, and sorted the part lists by part number.
- Used HZ_PER_MHZ for the maximum rate, and a default gain of
  1 * MILLI instead of a gain without a unit.
- Simplified the gain, reference supply and lane count handling, did not nest
  the rounding checks and replaced min_t() with min().
- Put Context before Returns in the kernel-doc of the new PWM function,
  dropped a redundant check and named the rate clk_rate_Hz.
- Used the standard unit names and macros (vref_mV, HZ_PER_MHZ) for the
  existing code in a patch of its own.
- Included property.h and types.h, and ordered the declarations of the
  new code in reverse christmas tree order.

Changes in v2 (since v1, separate ltc2387 driver):
- Joined to ad7625 (binding, driver, Kconfig and documentation).
- Dropped the clocks property of the ADC, added the PWM waveform step API.
- Compatibles use the adi, prefix and the datasheet part numbers.
- Dropped the x4 parts.
- Fixed The missing return of dev_err_probe() for the initial sampling
 frequency.
- Added the maintainers of the new parts to the AD7625 entry.

AI disclosure: parts of the commit text and the code were checked with an
AI coding assistant (Claude): the first version of the merge into ad7625,
the PWM step API, the timing arithmetic and the test scripts. I reviewed
every change, built it and ran tests on the ADAQ23875 + ZedBoard.

Link to v1: https://lore.kernel.org/all/20261027134409.76824-1-Nicolae-daniel.Deaconescu@analog.com/
Link to v2: https://lore.kernel.org/all/20261104132143.215581-1-Nicolae-daniel.Deaconescu@analog.com/

Nicolae-Daniel Deaconescu (5):
  pwm: core: add pwm_get_waveform_step_might_sleep()
  pwm: axi-pwmgen: report the waveform step
  iio: adc: ad7625: fix sampling frequency handling
  iio: adc: ad7625: use standard unit names
  iio: adc: ad7625: move initial mode setup

Sergiu Cuciurean (2):
  dt-bindings: iio: adc: add adi,ltc2387
  iio: adc: ad7625: add LTC2387 and ADAQ2387x support

 .../bindings/iio/adc/adi,ltc2387.yaml         | 169 +++++++
 Documentation/iio/ad7625.rst                  |  34 +-
 MAINTAINERS                                   |   3 +
 drivers/iio/adc/Kconfig                       |   7 +-
 drivers/iio/adc/ad7625.c                      | 470 ++++++++++++++++--
 drivers/pwm/core.c                            |  65 +++
 drivers/pwm/pwm-axi-pwmgen.c                  |  13 +
 include/linux/pwm.h                           |  34 ++
 8 files changed, 739 insertions(+), 56 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ltc2387.yaml


base-commit: 43ffda3c7f8456bbe641ae8249a077a361b97880
-- 
2.56.0


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

end of thread, other threads:[~2026-11-06 17:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-06 16:05 [PATCH v3 0/7] iio: adc: ad7625: add LTC2387 and ADAQ2387x support Nicolae-Daniel Deaconescu
2026-11-06 16:05 ` [PATCH v3 1/7] pwm: core: add pwm_get_waveform_step_might_sleep() Nicolae-Daniel Deaconescu
2026-11-06 16:05 ` [PATCH v3 2/7] pwm: axi-pwmgen: report the waveform step Nicolae-Daniel Deaconescu
2026-11-06 16:05 ` [PATCH v3 3/7] iio: adc: ad7625: fix sampling frequency handling Nicolae-Daniel Deaconescu
2026-11-06 16:05 ` [PATCH v3 4/7] iio: adc: ad7625: use standard unit names Nicolae-Daniel Deaconescu
2026-11-06 16:05 ` [PATCH v3 5/7] iio: adc: ad7625: move initial mode setup Nicolae-Daniel Deaconescu
2026-11-06 16:05 ` [PATCH v3 6/7] dt-bindings: iio: adc: add adi,ltc2387 Nicolae-Daniel Deaconescu
2026-11-06 17:04   ` Conor Dooley
2026-11-06 16:05 ` [PATCH v3 7/7] iio: adc: ad7625: add LTC2387 and ADAQ2387x support Nicolae-Daniel Deaconescu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®