Skip to content

iio: adc: ad4691: fixes and devicetree#3302

Open
RaduSabau1 wants to merge 2 commits into
mainfrom
fix/ad4691
Open

iio: adc: ad4691: fixes and devicetree#3302
RaduSabau1 wants to merge 2 commits into
mainfrom
fix/ad4691

Conversation

@RaduSabau1
Copy link
Copy Markdown
Collaborator

@RaduSabau1 RaduSabau1 commented Apr 30, 2026

PR Description

Lore: https://patchwork.kernel.org/project/linux-iio/cover/20260529-ad4692-multichannel-sar-adc-driver-v14-0-e93c2747dc1f@analog.com/

PR Type

  • Bug fix (a change that fixes an issue)
  • New feature (a change that adds new functionality)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

  • I have conducted a self-review of my own code changes
  • I have compiled my changes, including the documentation
  • I have tested the changes on the relevant hardware
  • I have updated the documentation outside this repo accordingly
  • I have provided links for the relevant upstream lore

Copy link
Copy Markdown
Collaborator

@nunojsa nunojsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor nit!

* CK_IO06: CNV (PWM trigger output, CNV_CLOCK_MODE and CNV_BURST_MODE only)
* CK_IO04: RESETn
*
* Copyright (C) 2025 Analog Devices Inc.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2026

@RaduSabau1 RaduSabau1 marked this pull request as draft May 4, 2026 12:17
@RaduSabau1
Copy link
Copy Markdown
Collaborator Author

Marking this as draft until (the following) upstream patches are approved.

Update the driver to match the current upstream revision.

Move sampling_frequency and oversampling_ratio from per-channel separate
attributes to shared_by_all. All channels share a single OSR and
oscillator frequency target; replace the per-channel u8 osr[16] array
with a single unsigned int osr. Precompute samp_freq_avail tables at
probe time (one row per OSR entry) to avoid recomputing them on every
read_avail call.

Add dedicated offload channel arrays (AD4691_OFFLOAD_CHANNEL,
AD4691_OFFLOAD_MANUAL_CHANNEL) with IIO_CPU endianness for the DMA path
where bits_per_word=16 causes the SPI Engine to produce native 16-bit
words, distinct from the software-path IIO_BE arrays.

Remove the ad4691_offload_state struct and fold its fields directly into
ad4691_state, simplifying the offload setup path.

Add AD4691_EXIT_COMMAND (0x5000) and an ad4691_transfer() helper for
raw 16-bit SPI frames. ad4691_exit_conversion_mode() now sends the
proper exit command in manual mode instead of clearing MANUAL_MODE via
regmap.

Split the CNV burst buffer lifecycle: move IRQ enable/disable from
preenable/postdisable to postenable/predisable to prevent a race where
a DATA_READY assertion could arrive before the IIO poll function is
registered. Add irq_enabled tracking, a trigger reenable callback, and
switch to a non-threaded hardirq handler since only disable_irq_nosync()
and iio_trigger_poll() are called from it.

Signed-off-by: Radu Sabau <radu.sabau@analog.com>
Add initial device-tree file for AD4692 corresponding the the
current HDL project which uses SPI Offload.

Signed-off-by: Radu Sabau <radu.sabau@analog.com>
@RaduSabau1 RaduSabau1 marked this pull request as ready for review June 2, 2026 11:47
@RaduSabau1
Copy link
Copy Markdown
Collaborator Author

This PR is now ready for review. Lore link has been updated for the last accepted version of the driver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants