From: "Nuno Sá" <noname.nuno@gmail.com>
To: Christofer Jonason <christofer.jonason@guidelinegeo.com>,
jic23@kernel.org
Cc: lars@metafoo.de, dlechner@baylibre.com, nuno.sa@analog.com,
andy@kernel.org, michal.simek@amd.com,
victor.jonsson@guidelinegeo.com, linux-iio@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] iio: adc: xilinx-xadc: Fix sequencer mode in postdisable for dual mux
Date: Wed, 04 Mar 2026 11:40:58 +0000 [thread overview]
Message-ID: <7888782857fca26d6562c5cf1807fc7488c9dde8.camel@gmail.com> (raw)
In-Reply-To: <20260304090727.1800289-1-christofer.jonason@guidelinegeo.com>
On Wed, 2026-03-04 at 10:07 +0100, Christofer Jonason wrote:
> xadc_postdisable() unconditionally sets the sequencer to continuous
> mode. For dual external multiplexer configurations this is incorrect:
> simultaneous sampling mode is required so that ADC-A samples through
> the mux on VAUX[0-7] while ADC-B simultaneously samples through the
> mux on VAUX[8-15]. In continuous mode only ADC-A is active, so
> VAUX[8-15] channels return incorrect data.
>
> Since postdisable is also called from xadc_probe() to set the initial
> idle state, the wrong sequencer mode is active from the moment the
> driver loads.
>
> The preenable path already uses xadc_get_seq_mode() which returns
> SIMULTANEOUS for dual mux. Fix postdisable to do the same.
>
> Fixes: bdc8cda1d010 ("iio:adc: Add Xilinx XADC driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Christofer Jonason <christofer.jonason@guidelinegeo.com>
> ---
From a code standpoint:
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
> Changes in v2:
> - Align continuation line to opening parenthesis (Andy)
> drivers/iio/adc/xilinx-xadc-core.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
> index e257c1b94..3980dfacb 100644
> --- a/drivers/iio/adc/xilinx-xadc-core.c
> +++ b/drivers/iio/adc/xilinx-xadc-core.c
> @@ -817,6 +817,7 @@ static int xadc_postdisable(struct iio_dev *indio_dev)
> {
> struct xadc *xadc = iio_priv(indio_dev);
> unsigned long scan_mask;
> + int seq_mode;
> int ret;
> int i;
>
> @@ -824,6 +825,12 @@ static int xadc_postdisable(struct iio_dev *indio_dev)
> for (i = 0; i < indio_dev->num_channels; i++)
> scan_mask |= BIT(indio_dev->channels[i].scan_index);
>
> + /*
> + * Use the correct sequencer mode for the idle state: simultaneous
> + * mode for dual external mux configurations, continuous otherwise.
> + */
> + seq_mode = xadc_get_seq_mode(xadc, scan_mask);
> +
> /* Enable all channels and calibration */
> ret = xadc_write_adc_reg(xadc, XADC_REG_SEQ(0), scan_mask & 0xffff);
> if (ret)
> @@ -834,11 +841,11 @@ static int xadc_postdisable(struct iio_dev *indio_dev)
> return ret;
>
> ret = xadc_update_adc_reg(xadc, XADC_REG_CONF1, XADC_CONF1_SEQ_MASK,
> - XADC_CONF1_SEQ_CONTINUOUS);
> + seq_mode);
> if (ret)
> return ret;
>
> - return xadc_power_adc_b(xadc, XADC_CONF1_SEQ_CONTINUOUS);
> + return xadc_power_adc_b(xadc, seq_mode);
> }
>
> static int xadc_preenable(struct iio_dev *indio_dev)
next prev parent reply other threads:[~2026-03-04 11:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 9:07 [PATCH v2] iio: adc: xilinx-xadc: Fix sequencer mode in postdisable for dual mux Christofer Jonason
2026-03-04 11:40 ` Nuno Sá [this message]
2026-03-04 13:40 ` Andy Shevchenko
2026-03-07 12:41 ` Jonathan Cameron
2026-03-10 7:42 ` Michal Simek
2026-03-25 8:04 ` Christofer Jonason
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=7888782857fca26d6562c5cf1807fc7488c9dde8.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=andy@kernel.org \
--cc=christofer.jonason@guidelinegeo.com \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=nuno.sa@analog.com \
--cc=stable@vger.kernel.org \
--cc=victor.jonsson@guidelinegeo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox