Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Radu Sabau via B4 Relay" <devnull+radu.sabau.analog.com@kernel.org>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v12 4/6] iio: adc: ad4691: add SPI offload support
Date: Tue, 19 May 2026 14:35:10 +0000	[thread overview]
Message-ID: <20260519143510.E1C00C2BCB3@smtp.kernel.org> (raw)
In-Reply-To: <20260519-ad4692-multichannel-sar-adc-driver-v12-4-5b335162aa51@analog.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] Invalid field '.format' in struct iio_scan_type initializer.
- [Low] Comment claims scan_tx_reset length differs between paths, but code uses length 4 in both.
--

commit 7490ce5c597707ce10e439240d92b62db62380e0
Author: Radu Sabau <radu.sabau@analog.com>

iio: adc: ad4691: add SPI offload support

Add SPI offload support to enable DMA-based, CPU-independent data
acquisition using the SPI Engine offload framework.

> diff --git a/drivers/iio/adc/ad4691.c b/drivers/iio/adc/ad4691.c
> index ed60ed5b488c2..a6588292f3c18 100644
> --- a/drivers/iio/adc/ad4691.c
> +++ b/drivers/iio/adc/ad4691.c
[ ... ]
> @@ -139,6 +150,30 @@ struct ad4691_chip_info {
>  		},							\
>  	}
>  
> +/*
> + * Offload path (bits_per_word=16): the SPI Engine assembles received
> + * bits into native 16-bit words before DMA, so samples are in
> + * CPU-native byte order (IIO_CPU). storagebits=16 matches the 16-bit
> + * DMA word size.
> + */
> +#define AD4691_OFFLOAD_CHANNEL(ch)					\
> +	{								\
> +		.type = IIO_VOLTAGE,					\
> +		.indexed = 1,						\
> +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW)		\
> +				    | BIT(IIO_CHAN_INFO_SAMP_FREQ),	\
> +		.info_mask_separate_available =				\
> +				      BIT(IIO_CHAN_INFO_SAMP_FREQ),	\
> +		.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SCALE),	\
> +		.channel = ch,						\
> +		.scan_index = ch,					\
> +		.scan_type = {						\
> +			.format = 'u',					\

Does this cause a build failure? It looks like the member in struct
iio_scan_type is called sign, not format. Initializing .format here
will likely cause the compiler to complain about a missing member.

> +			.realbits = 16,					\
> +			.storagebits = 16,				\
> +		},							\
> +	}
> +
[ ... ]
> @@ -876,6 +1005,218 @@ static const struct iio_buffer_setup_ops ad4691_cnv_burst_buffer_setup_ops = {
[ ... ]
> +static int ad4691_cnv_burst_offload_buffer_postenable(struct iio_dev *indio_dev)
> +{
[ ... ]
> +	/*
> +	 * State reset: single 4-byte write [addr_hi, addr_lo, STATE_RESET_ALL,
> +	 * OSC_EN=1]. ADDR_DESCENDING writes byte[3]=1 to OSC_EN_REG (0x180) as
> +	 * a deliberate side-write, keeping the oscillator enabled.
> +	 * scan_tx_reset is shared with the non-offload path (len=4 here vs
> +	 * len=3 there) since the two paths are mutually exclusive at probe.
> +	 */

Is this comment accurate regarding the lengths?

The non-offload path in ad4691_cnv_burst_buffer_preenable() also appears
to use a 4-byte transfer for scan_tx_reset, setting up all 4 bytes before
passing it to the transfer.

> +	put_unaligned_be16(AD4691_STATE_RESET_REG, st->scan_tx_reset);
> +	st->scan_tx_reset[2] = AD4691_STATE_RESET_ALL;
> +	st->scan_tx_reset[3] = 1;
> +	st->scan_xfers[2 * k].tx_buf = st->scan_tx_reset;
> +	st->scan_xfers[2 * k].len = sizeof(st->scan_tx_reset);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260519-ad4692-multichannel-sar-adc-driver-v12-0-5b335162aa51@analog.com?part=4

  reply	other threads:[~2026-05-19 14:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19 12:20 [PATCH v12 0/6] iio: adc: ad4691: add driver for AD4691 multichannel SAR ADC family Radu Sabau via B4 Relay
2026-05-19 12:20 ` [PATCH v12 1/6] dt-bindings: iio: adc: add AD4691 family Radu Sabau via B4 Relay
2026-05-19 12:28   ` sashiko-bot
2026-05-19 17:26     ` Conor Dooley
2026-05-19 17:26       ` Conor Dooley
2026-05-19 12:20 ` [PATCH v12 2/6] iio: adc: ad4691: add initial driver for " Radu Sabau via B4 Relay
2026-05-19 12:20 ` [PATCH v12 3/6] iio: adc: ad4691: add triggered buffer support Radu Sabau via B4 Relay
2026-05-19 13:42   ` sashiko-bot
2026-05-19 12:20 ` [PATCH v12 4/6] iio: adc: ad4691: add SPI offload support Radu Sabau via B4 Relay
2026-05-19 14:35   ` sashiko-bot [this message]
2026-05-19 12:20 ` [PATCH v12 5/6] iio: adc: ad4691: add oversampling support Radu Sabau via B4 Relay
2026-05-19 15:11   ` sashiko-bot
2026-05-19 12:20 ` [PATCH v12 6/6] docs: iio: adc: ad4691: add driver documentation Radu Sabau via B4 Relay

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=20260519143510.E1C00C2BCB3@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=devnull+radu.sabau.analog.com@kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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