From: David Lechner <dlechner@baylibre.com>
To: "Michael Hennerich" <Michael.Hennerich@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Mark Brown" <broonie@kernel.org>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, linux-spi@vger.kernel.org,
David Lechner <dlechner@baylibre.com>
Subject: [PATCH v3 12/12] iio: adc: ad7173: add SPI offload support
Date: Tue, 01 Jul 2025 16:38:00 -0500 [thread overview]
Message-ID: <20250701-iio-adc-ad7173-add-spi-offload-support-v3-12-42abb83e3dac@baylibre.com> (raw)
In-Reply-To: <20250701-iio-adc-ad7173-add-spi-offload-support-v3-0-42abb83e3dac@baylibre.com>
Enable SPI offload support for the AD7173 ADC driver.
The scan_type used for SPI offload is assuming that we are using the
ad411x_ad717x HDL project [1] which always stores data words in 32-bits.
Link: https://analogdevicesinc.github.io/hdl/projects/ad411x_ad717x/index.html [1]
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
drivers/iio/adc/ad7173.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c
index 010339c2b7044da4b36dc894a38a145c2fcccd6a..580d4bf3366b193fa0f13d0a28886d390e1295b8 100644
--- a/drivers/iio/adc/ad7173.c
+++ b/drivers/iio/adc/ad7173.c
@@ -748,6 +748,7 @@ static const struct ad_sigma_delta_info ad7173_sigma_delta_info_4_slots = {
.set_mode = ad7173_set_mode,
.has_registers = true,
.has_named_irqs = true,
+ .supports_spi_offload = true,
.addr_shift = 0,
.read_mask = BIT(6),
.status_ch_mask = GENMASK(3, 0),
@@ -764,6 +765,7 @@ static const struct ad_sigma_delta_info ad7173_sigma_delta_info_8_slots = {
.set_mode = ad7173_set_mode,
.has_registers = true,
.has_named_irqs = true,
+ .supports_spi_offload = true,
.addr_shift = 0,
.read_mask = BIT(6),
.status_ch_mask = GENMASK(3, 0),
@@ -1585,6 +1587,11 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev)
if (st->info->data_reg_only_16bit)
chan_arr[chan_index].scan_type = ad4113_scan_type;
+ if (ad_sigma_delta_has_spi_offload(&st->sd)) {
+ chan_arr[chan_index].scan_type.storagebits = 32;
+ chan_arr[chan_index].scan_type.endianness = IIO_CPU;
+ }
+
chan_index++;
}
@@ -1675,6 +1682,12 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev)
if (st->info->data_reg_only_16bit)
chan_arr[chan_index].scan_type = ad4113_scan_type;
+ /* Assuming SPI offload is ad411x_ad717x HDL project. */
+ if (ad_sigma_delta_has_spi_offload(&st->sd)) {
+ chan_arr[chan_index].scan_type.storagebits = 32;
+ chan_arr[chan_index].scan_type.endianness = IIO_CPU;
+ }
+
chan_index++;
}
return 0;
--
2.43.0
next prev parent reply other threads:[~2025-07-01 21:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-01 21:37 [PATCH v3 00/12] iio: adc: ad7173: add SPI offload support David Lechner
2025-07-01 21:37 ` [PATCH v3 01/12] iio: adc: ad_sigma_delta: don't overallocate scan buffer David Lechner
2025-07-01 21:37 ` [PATCH v3 02/12] iio: adc: ad_sigma_delta: sort includes David Lechner
2025-07-01 21:37 ` [PATCH v3 03/12] iio: adc: ad_sigma_delta: use u8 instead of uint8_t David Lechner
2025-07-01 21:37 ` [PATCH v3 04/12] iio: adc: ad_sigma_delta: use sizeof() in ALIGN() David Lechner
2025-07-01 21:37 ` [PATCH v3 05/12] iio: adc: ad_sigma_delta: use BITS_TO_BYTES() macro David Lechner
2025-07-01 21:37 ` [PATCH v3 06/12] iio: adc: ad_sigma_delta: audit included headers David Lechner
2025-07-01 21:37 ` [PATCH v3 07/12] iio: adc: ad_sigma_delta: refactor setting read address David Lechner
2025-07-01 21:37 ` [PATCH v3 08/12] iio: adc: ad_sigma_delta: use spi_optimize_message() David Lechner
2025-07-01 21:37 ` [PATCH v3 09/12] dt-bindings: trigger-source: add ADI Util Sigma-Delta SPI David Lechner
2025-07-01 21:37 ` [PATCH v3 10/12] spi: offload trigger: add ADI Util Sigma-Delta SPI driver David Lechner
2025-07-02 7:57 ` Nuno Sá
2025-07-02 12:37 ` David Lechner
2025-07-01 21:37 ` [PATCH v3 11/12] iio: adc: ad_sigma_delta: add SPI offload support David Lechner
2025-07-01 21:38 ` David Lechner [this message]
2025-07-02 7:58 ` [PATCH v3 00/12] iio: adc: ad7173: " Nuno Sá
2025-07-02 8:04 ` Andy Shevchenko
2025-07-06 10:04 ` Jonathan Cameron
2025-07-06 10:05 ` Jonathan Cameron
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=20250701-iio-adc-ad7173-add-spi-offload-support-v3-12-42abb83e3dac@baylibre.com \
--to=dlechner@baylibre.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).