AD5313R device and triggered buffer support#3232
AD5313R device and triggered buffer support#3232rodrigo455 wants to merge 15 commits intomirror_ci/jic23/iio/testingfrom
Conversation
This series adds support for the AD5313R 10-bit nanoDAC and triggered
buffer support to the ad5686 DAC driver family, along with a number of
driver cleanups.
Initial patches update the device-tree bindings:
- Add AD5313R compatible entry (SPI variant)
- Add missing AD5673R/AD5677R entries (I2C variant)
- Add LDAC GPIO property for async DAC channel loading
Driver cleanups:
- Refactor include headers (IWYU)
- Switch to devm_mutex_init()
- Drop enum chip id in favor of per-device chip_info structs
exposed to the SPI/I2C bus drivers
- Introduce bus ops struct with a sync() operation for batching
bus transfers
New functionality:
- AD5313R device support
- 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
# Describe the purpose of this series. The information you put here
# will be used by the project maintainer to make a decision whether
# your patches should be reviewed, and in what priority order. Please be
# very detailed and link to any relevant discussions or sites that the
# maintainer can review to better understand your proposed changes. If you
# only have a single patch in your series, the contents of the cover
# letter will be appended to the "under-the-cut" portion of the patch.
# Lines starting with # will be removed from the cover letter. You can
# use them to add notes or reminders to yourself. If you want to use
# markdown headers in your cover letter, start the line with ">#".
# You can add trailers to the cover letter. Any email addresses found in
# these trailers will be added to the addresses specified/generated
# during the b4 send stage. You can also run "b4 prep --auto-to-cc" to
# auto-populate the To: and Cc: trailers based on the code being
# modified.
To: Michael Hennerich <michael.hennerich@analog.com>
To: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
To: devicetree@vger.kernel.org
To: linux-kernel@vger.kernel.org
To: Michael Auchter <michael.auchter@ni.com>
To: linux-hardening@vger.kernel.org
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>
Cc: David Lechner <dlechner@baylibre.com>
Cc: Nuno Sá <nuno.sa@analog.com>
Cc: Andy Shevchenko <andy@kernel.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Kees Cook <kees@kernel.org>
Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
--- b4-submit-tracking ---
# This section is used internally by b4 prep for tracking purposes.
{
"series": {
"revision": 1,
"change-id": "20260325-ad5313r-iio-support-882ad39356e1",
"prefixes": []
}
}
5da2875 to
71cdaf3
Compare
9e516c8 to
9f44ff1
Compare
nunojsa
left a comment
There was a problem hiding this comment.
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!
|
|
||
| ret = spi_sync(spi, &bus_data->msg); | ||
| if (ret) | ||
| return ret; |
There was a problem hiding this comment.
nit: new line
I also wonder if this does not need locking?
Support for AD5673R and AD5677R missing from the device-tree bindings documentation. The devices have different bit resolutions so no fallback compatibles are used. Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Add compatible entry for AD5313R 10-bit nanoDAC. The device has unique combination of channel count, bit resolution and supported command set, so that fallback compatibles are not used. Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Add GPIO property for LDAC pin, used for async loading of DAC channel data. Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Add GPIO property for LDAC pin, used for async loading of DAC channel data. Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Apply IWYU principle, replacing unused/generic headers for specific/missing headers. The resulting include directive list is sorted accordingly. Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Adopt proper mutex lifecycle with devm_mutex_init(), replacing mutex_init(). Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Split chip info table into separate structs and expose them to the spi i2c drivers. That is the preferrable approach and allows for the drivers to have knowledge of the device info before the probe function gets called. Use spi_get_device_match_data() and i2c_get_match_data() to get chip info struct references. Also, missing entries (AD5673R/AD5677R) are added to the i2c of_match table. Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Add of_match table for the SPI device variants to be consistent with the AD5696 I2C driver. Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Add support for AD5313R as a SPI-variant of AD5338R to the AD5686 SPI driver. Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Update device list entries from comment headers for both SPI and I2C driver files and under Kconfig help text. Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Create struct with bus operations, including a sync() operation that will be used to flush multiple channel writes at once. Auxiliary functions ad5686_write() and ad5686_read() are created and ad5686_probe() now receives an ops struct pointer rather than individual read and write functions. Documentation header of ad5686_state struct is updated accordingly (adjusting renamed fields and formatting). Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
If wired LADC, should be held low when unused (pin is active-low), which allows for synchronous DAC updates. This will be used to update all the channels at the same time when adding buffer support. Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
9f44ff1 to
3469c5e
Compare
Use of local SPI bus data to manage a collection of SPI transfers and flush them to the SPI platform driver with the sync() operation. This allows for faster handling of multiple channel DAC writes, avoiding kernel overhead per spi_sync() call, which will be helpful when enabling triggered buffer support. Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Trigger handler is implemented by leveraging the LDAC gpio when it is available. Multiple channel writes can be flushed at once with the sync() operation. Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
3469c5e to
4c5c47c
Compare
59be8ec to
58a740e
Compare
5546c65 to
aa19856
Compare
Automated Kernel Review — AD5313R IIO DAC SeriesCI run: https://github.com/analogdevicesinc/linux/actions/runs/24441066096 Reviewed commits Build passes cleanly for ARM ( 🐛 Bug:
|
1d05b45 to
815fd21
Compare
PR Description
This series adds support for the AD5313R 10-bit nanoDAC and triggered
buffer support to the ad5686 DAC driver family, along with a number of
driver cleanups.
Initial patches update the device-tree bindings:
Driver cleanups:
exposed to the SPI/I2C bus drivers
bus transfers
New functionality:
all channel writes atomically
PR Type
PR Checklist