Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Nuno Sá" <nuno.sa@analog.com>, devicetree@vger.kernel.org
Cc: robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 1/6] iio: adc: ad7887: fix on-chip reference enable logic
Date: Wed, 25 Nov 2026 10:25:06 +0000	[thread overview]
Message-ID: <sashiko-outbox-233116@kernel.org> (raw)
In-Reply-To: <20261125-iio-adi-legacy-platdata-v1-1-54e4c8830b57@analog.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] iio: adc: ad7887: wrong rx_buf offset for CH1 in ad7887_probe()
  [1]
--

commit e57544891ed7d42b994441cf2725e2d373e5b02b
Author: Nuno Sá <nuno.sa@analog.com>

iio: adc: ad7887: fix on-chip reference enable logic

This commit fixes the AD7887_REF_DIS condition in ad7887_probe() so the
on-chip 2.5 V reference is disabled only when an external vref regulator is
present.

> diff --git a/drivers/iio/adc/ad7887.c b/drivers/iio/adc/ad7887.c
> index 827d0c2598ba6..980e6a3030479 100644
> --- a/drivers/iio/adc/ad7887.c
> +++ b/drivers/iio/adc/ad7887.c
> @@ -271,7 +271,7 @@ static int ad7887_probe(struct spi_device *spi)
>  	/* Setup default message */
>  
>  	mode = AD7887_PM_MODE4;
> -	if (!st->reg)
> +	if (st->reg)
>  		mode |= AD7887_REF_DIS;
>  	if (pdata && pdata->en_dual)
>  		mode |= AD7887_DUAL;

[Severity: High]
This problem wasn't introduced by this patch, but in dual-channel mode does
st->xfer[3].rx_buf point to the wrong offset in st->data [1]?

drivers/iio/adc/ad7887.c:ad7887_probe() {
    ...
	if (pdata && pdata->en_dual) {
		...
		st->xfer[3].rx_buf = &st->data[1];
		st->xfer[3].tx_buf = &st->tx_cmd_buf[2];
		st->xfer[3].len = 2;

		spi_message_init(&st->msg[AD7887_CH1]);
		spi_message_add_tail(&st->xfer[3], &st->msg[AD7887_CH1]);
    ...
}

Because indio_dev->available_scan_masks is not set, IIO buffer demuxing is
not used and a single active channel sample must be placed at &st->data[0].
When buffered capture is enabled with only channel 1 active,
ad7887_ring_preenable() selects st->msg[AD7887_CH1], so
ad7887_trigger_handler() writes the conversion result to &st->data[1] while
iio_push_to_buffers_with_timestamp() pushes the stale or zero sample at
&st->data[0] to userspace.

[1] https://sashiko.dev/#/bug/linux-f8b2934e-4d1f-49d5-b745-1e7bf0447de1

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-iio-adi-legacy-platdata-v1-0-54e4c8830b57@analog.com?part=1

  reply	other threads:[~2026-11-25 10:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 10:19 [PATCH 0/6] iio: adc: drop platform data from some ADI ADC drivers Nuno Sá
2026-11-25 10:19 ` [PATCH 1/6] iio: adc: ad7887: fix on-chip reference enable logic Nuno Sá
2026-11-25 10:25   ` sashiko-bot [this message]
2026-11-25 10:19 ` [PATCH 2/6] iio: adc: ad7887: drop platform data support Nuno Sá
2026-11-25 10:19 ` [PATCH 3/6] iio: adc: ad7266: " Nuno Sá
2026-11-25 10:19 ` [PATCH 4/6] iio: adc: ad7791: " Nuno Sá
2026-11-25 10:40   ` Andy Shevchenko
2026-11-25 10:19 ` [PATCH 5/6] dt-bindings: iio: adc: add AD7793 and similar ADCs Nuno Sá
2026-11-25 10:28   ` sashiko-bot
2026-11-25 10:19 ` [PATCH 6/6] iio: adc: ad7793: add firmware support and drop platform data Nuno Sá
2026-11-25 10:33   ` sashiko-bot
2026-11-25 10:43   ` Andy Shevchenko
2026-11-25 10:36 ` [PATCH 0/6] iio: adc: drop platform data from some ADI ADC drivers Arnd Bergmann

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=sashiko-outbox-233116@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --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