From: Jonathan Santos <Jonathan.Santos@analog.com>
To: <linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: Jonathan Santos <Jonathan.Santos@analog.com>,
<dlechner@baylibre.com>, <nuno.sa@analog.com>,
<michael.hennerich@analog.com>, <broonie@kernel.org>,
<jonath4nns@gmail.com>, <marcelo.schmitt1@gmail.com>,
<andriy.shevchenko@intel.com>
Subject: [PATCH v3 0/6] spi: add multi-CS and multi-chip aggregation support
Date: Mon, 17 Aug 2026 20:32:10 -0300 [thread overview]
Message-ID: <cover.1786973376.git.Jonathan.Santos@analog.com> (raw)
This series adds support to multi-CS devices and ancillary device with
lanes, to enable the multi-device setup described in [1], where multiple
AD7768-1 ADCs are wired to the same controller in a synchronized sampling
configuration, and the limitation noted in [2], where no SPI controller
completely handles logical chip selects beyond the first one.
The first part of the set addresses multi-CS support. Some SPI controllers
can assert multiple chip selects simultaneously, but the existing code
hardcoded CS index 0 in both spi_set_cs() and of_spi_parse_dt(),
preventing this from working. The spi device name pattern is modified to
include all active CS lines, so multi-CS devices are distinguishable in
sysfs.
The second part introduces spi_new_ancillary_device_with_lane() and its
devm variant, used here to create subdevices that binds the CS with a
correspondent rx and tx lane from the parent device. With that we can
handle each device individually when there are separate data lanes.
The last part uses the above infrastructure in the AD7768-1 driver to
support aggregating multiple chips as a single IIO device. The number of
sub-devices is derived from spi->num_rx_lanes. IIO channels are
allocated dynamically, buffered capture is restricted to the full-device
scan mask, and SPI offload mode enables SPI_MULTI_LANE_MODE_STRIPE to
interleave samples from all lanes into the DMA stream.
---
v3 summary:
* Added new patch to document the properties for multidevice support on
ad7768-1 bindings.
* Refactored "spi: introduce SPI ancillary device with lanes" patch
to reduce duplicated code using helper functions.
* Modified channel mask allocation on ad7768_parse_aaf_gain() to get
a static value, Since we assume the family is single channel. Added a
comment explaining.
* Link to v2: https://lore.kernel.org/linux-spi/cover.1785725359.git.Jonathan.Santos@analog.com/T/#t
v2 summary:
* Removed the per-transfer CS mask patches, the devices will be
individually handled by the ancillary device feature.
* Removed dynamic multilane selection patches. The lane is bound to the
CS using the new spi_new_ancillary_device_with_lane() feature.
* Included a use case patch modifying the AD7768-1 driver to support
multidevice aggregation.
* Link to v1: https://lore.kernel.org/linux-spi/cover.1783729282.git.Jonathan.Santos@analog.com/T/#t
OBS: The ancillary device approach was chosen over per-transfer CS masks
because it has better integrattion with regmap. Both approaches require
multiple regmap instances, but the CS mask approach would additionally
require custom read/write functions to route transfers to the correct CS,
while ancillary devices handle this more transparently.
David suggested adding an ancillary device field to spi_message, I guess to
enable dynamic CS-lane selection. For now, using one ancillary device per
chip for individual access and the main SPI device for simultaneous access
seems to be sufficient. The dynamic approach can be implemented in the future
if needed.
---
[1]: https://lore.kernel.org/linux-iio/af0EGv172ZMl%2F6N5@JSANTO12-L01.ad.analog.com/T/#t
[2]: https://lore.kernel.org/all/20250915183725.219473-1-jonas.gorski@gmail.com/
Jonathan Santos (6):
dt-bindings: iio: adc: ad7768-1: Document multidevice support
spi: support simultaneous assertion of multiple CS
spi: expand device name to include all CS lines for multi-CS devices
spi: introduce SPI ancillary device with lanes
spi: spi-engine-ex: Add support for multi-CS devices
iio: adc: ad7768-1: add support for multiple chip aggregation
.../bindings/iio/adc/adi,ad7768-1.yaml | 78 +++++++++-
drivers/iio/adc/ad7768-1.c | 100 +++++++++++--
drivers/spi/spi-axi-spi-engine.c | 22 ++-
drivers/spi/spi.c | 135 +++++++++++++++---
include/linux/spi/spi.h | 8 ++
5 files changed, 305 insertions(+), 38 deletions(-)
base-commit: 350d1fb9204b13c5f95e511e98b8bcb47574d425
--
2.34.1
next reply other threads:[~2026-08-17 23:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 23:32 Jonathan Santos [this message]
2026-08-17 23:32 ` [PATCH v3 1/6] dt-bindings: iio: adc: ad7768-1: Document multidevice support Jonathan Santos
2026-08-18 6:46 ` Krzysztof Kozlowski
2026-08-17 23:32 ` [PATCH v3 2/6] spi: support simultaneous assertion of multiple CS Jonathan Santos
2026-08-18 6:39 ` Andy Shevchenko
2026-08-17 23:32 ` [PATCH v3 3/6] spi: expand device name to include all CS lines for multi-CS devices Jonathan Santos
2026-08-18 6:45 ` Andy Shevchenko
2026-08-17 23:33 ` [PATCH v3 4/6] spi: introduce SPI ancillary device with lanes Jonathan Santos
2026-08-18 6:53 ` Andy Shevchenko
2026-08-17 23:33 ` [PATCH v3 5/6] spi: spi-engine-ex: Add support for multi-CS devices Jonathan Santos
2026-08-18 7:01 ` Andy Shevchenko
2026-08-17 23:33 ` [PATCH v3 6/6] iio: adc: ad7768-1: add support for multiple chip aggregation Jonathan Santos
2026-08-18 7:10 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1786973376.git.Jonathan.Santos@analog.com \
--to=jonathan.santos@analog.com \
--cc=andriy.shevchenko@intel.com \
--cc=broonie@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jonath4nns@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=marcelo.schmitt1@gmail.com \
--cc=michael.hennerich@analog.com \
--cc=nuno.sa@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.