Skip to content

Extend device support for AD5686 driver #3232

Open
rodrigo455 wants to merge 103 commits into
mirror_ci/jic23/iio/testingfrom
staging/ad5313r-jic23-testing
Open

Extend device support for AD5686 driver #3232
rodrigo455 wants to merge 103 commits into
mirror_ci/jic23/iio/testingfrom
staging/ad5313r-jic23-testing

Conversation

@rodrigo455
Copy link
Copy Markdown
Collaborator

@rodrigo455 rodrigo455 commented Apr 1, 2026

PR Description

This series adds support for multiple nanoDAC parts, adding triggered
buffer and gain control support to the ad5686 DAC driver family, along
with a number of driver cleanups and fixes.

Initial patches update the device-tree bindings:

  • Add compatible entries for missing and new parts;
  • Add GPIO properties for RESET, GAIN and LDAC pins;
  • Add missing power supplies properties.

Driver cleanups and fixes:

  • Refactor include headers (IWYU);
  • Switch to device managed mutex initialization;
  • Drop enum chip id in favor of per-device chip_info structs;
  • Fix voltage reference control on single-channel devices;
  • Fix powerdown control on dual-channel devices;
  • Introduce bus ops struct with a sync() operation for batching
    bus transfers.

New functionality:

  • Device support for: AD5316R, AD5675, AD5697R, AD5313R, AD5317R,
    AD5674, AD5679, AD5687, AD5687R, AD5689 and AD5689R;
  • Consume optional reset and new power supplies;
  • LDAC GPIO handling (active-low, held low when unused);
  • SPI bus sync() implementation for batching multiple transfers;
  • Triggered buffer support, leveraging LDAC and sync() to flush
    all channel writes atomically;
  • Gain control support through the scale property.

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

@rodrigo455 rodrigo455 changed the title Staging/ad5313r jic23 testing AD5313R device and triggered buffer support Apr 1, 2026
@gastmaier gastmaier force-pushed the mirror_ci/jic23/iio/testing branch from 5da2875 to 71cdaf3 Compare April 1, 2026 23:59
@rodrigo455 rodrigo455 force-pushed the staging/ad5313r-jic23-testing branch from 9e516c8 to 9f44ff1 Compare April 2, 2026 07:22
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.

Looks mostly good! Some things more relevant to change but I would say it's mostly upstream ready.

Thanks for taking care of this and bringing one more driver up to date!

Comment thread Documentation/devicetree/bindings/iio/dac/adi,ad5686.yaml
Comment thread Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml
Comment thread Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml Outdated
Comment thread drivers/iio/dac/ad5686-spi.c
Comment thread drivers/iio/dac/ad5686-spi.c
Comment thread drivers/iio/dac/ad5686-spi.c Outdated

ret = spi_sync(spi, &bus_data->msg);
if (ret)
return ret;
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.

nit: new line

I also wonder if this does not need locking?

Comment thread drivers/iio/dac/ad5686-spi.c Outdated
Comment thread drivers/iio/dac/ad5686.c Outdated
Comment thread drivers/iio/dac/ad5686.c Outdated
Comment thread drivers/iio/dac/ad5686.c Outdated
@nunojsa nunojsa mentioned this pull request Apr 2, 2026
8 tasks
@rodrigo455 rodrigo455 force-pushed the staging/ad5313r-jic23-testing branch 2 times, most recently from 3469c5e to 4c5c47c Compare April 2, 2026 14:32
@gastmaier gastmaier force-pushed the mirror_ci/jic23/iio/testing branch 7 times, most recently from 59be8ec to 58a740e Compare April 9, 2026 00:12
@gastmaier gastmaier force-pushed the mirror_ci/jic23/iio/testing branch 3 times, most recently from 8ccfdb1 to 5d18d61 Compare April 12, 2026 00:10
Check return value of iio_compute_scan_bytes() as it can return an
error.

The result is moved to an output parameter while we are touching this
as we will need to add a second output parameter in a later change.

The return type of iio_buffer_update_bytes_per_datum() also had to be
changed to propagate the error.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Most of the supported devices rely on a GAIN pin to control a 2x
multiplier applied to the output voltage. Other devices, e.g. the
single-channel ones, provides a gain control through a bit field in the
control register. Some designs might have the GAIN pin hardwired to
VDD/VLOGIC or GND, which would still be fine for this patch, that allows
the scale property to be configurable with two available options. In
read_raw() and write_raw() implementations mutex guards are used to allow
early returns.

Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Support for AD5316R, AD5673R, AD5675, AD5677R and AD5697R missing from the
device-tree bindings documentation. These devices have different bit
resolutions or different number of channels so no fallback compatibles
are used.

Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Add compatible entries for AD5313R, AD5317R, AD5674, AD5679, AD5687,
AD5687R, AD5689, AD5689R. These devices have unique combination of channel
count, bit resolution and supported command set, so that fallback
compatibles are not used. Also, a small copy-and-paste error is fixed to
the title field.

Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Add support for AD5313R, AD5317R, AD5674, AD5679, AD5687, AD5687R, AD5689,
AD5689R to the AD5686 SPI driver. Also adding support for AD5316R, AD5675,
AD5697R to the AD5696 I2C driver. This includes the creation of seven chip
info struct instances and reuse of existing ones.

Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Update device list entries in Kconfig and remove device description from
file headers. One can rely on the ID table(s) to check for supported
devices. Adjust comment header accordingly and update update Copyright
notice in comment file headers with the current year.

Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
@rodrigo455 rodrigo455 force-pushed the staging/ad5313r-jic23-testing branch from 2474435 to ad5f1d1 Compare April 23, 2026 15:54
@gastmaier gastmaier force-pushed the mirror_ci/jic23/iio/testing branch 7 times, most recently from 850d20b to 590b70f Compare April 30, 2026 00:12
@gastmaier gastmaier force-pushed the mirror_ci/jic23/iio/testing branch 8 times, most recently from c2f48c4 to d16d458 Compare May 8, 2026 00:01
@gastmaier gastmaier force-pushed the mirror_ci/jic23/iio/testing branch from d16d458 to 4783e10 Compare May 9, 2026 00:13
@nunojsa
Copy link
Copy Markdown
Collaborator

nunojsa commented May 9, 2026

@rodrigo455, I lost a bit track of this one upstream! Was it accepted already? If so, please update this PR

@rodrigo455
Copy link
Copy Markdown
Collaborator Author

@rodrigo455, I lost a bit track of this one upstream! Was it accepted already? If so, please update this PR

Hi @nunojsa, a patch series is broken down into three now:

  • Fixes and cleanups
  • New features (triggered buffer and gain control)
  • Extend device support

The first one is on its way, but fixes are pending to be merged first so the cleanups can go in.

@gastmaier gastmaier force-pushed the mirror_ci/jic23/iio/testing branch 6 times, most recently from 90f0e0f to 0aebd74 Compare May 15, 2026 00:10
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.