public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH 3/5] iio: xilinx-xadc: Fix sequencer configuration for aux channels in simultaneous mode
Date: Sun, 5 Apr 2020 13:13:48 +0100	[thread overview]
Message-ID: <20200405131348.6eb332af@archlinux> (raw)
In-Reply-To: <20200403132717.24682-3-lars@metafoo.de>

On Fri,  3 Apr 2020 15:27:15 +0200
Lars-Peter Clausen <lars@metafoo.de> wrote:

> The XADC has two internal ADCs. Depending on the mode it is operating in
> either one or both of them are used. The device manual calls this
> continuous (one ADC) and simultaneous (both ADCs) mode.
> 
> The meaning of the sequencing register for the aux channels changes
> depending on the mode.
> 
> In continuous mode each bit corresponds to one of the 16 aux channels. And
> the single ADC will convert them one by one in order.
> 
> In simultaneous mode the aux channels are split into two groups the first 8
> channels are assigned to the first ADC and the other 8 channels to the
> second ADC. The upper 8 bits of the sequencing register are unused and the
> lower 8 bits control both ADCs. This means a bit needs to be set if either
> the corresponding channel from the first group or the second group (or
> both) are set.
> 
> Currently the driver does not have the special handling required for
> simultaneous mode. Add it.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

Looks fine, but sounds like a fix, so when was the problem introduced?

Thanks,

Jonathan

> ---
>  drivers/iio/adc/xilinx-xadc-core.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
> index 04a2a609ced4..4acababda4d5 100644
> --- a/drivers/iio/adc/xilinx-xadc-core.c
> +++ b/drivers/iio/adc/xilinx-xadc-core.c
> @@ -798,6 +798,16 @@ static int xadc_preenable(struct iio_dev *indio_dev)
>  	if (ret)
>  		goto err;
>  
> +	/*
> +	 * In simultaneous mode the upper and lower aux channels are samples at
> +	 * the same time. In this mode the upper 8 bits in the sequencer
> +	 * register are don't care and the lower 8 bits control two channels
> +	 * each. As such we must set the bit if either the channel in the lower
> +	 * group or the upper group is enabled.
> +	 */
> +	if (seq_mode == XADC_CONF1_SEQ_SIMULTANEOUS)
> +		scan_mask = ((scan_mask >> 8) | scan_mask) & 0xff0000;
> +
>  	ret = xadc_write_adc_reg(xadc, XADC_REG_SEQ(1), scan_mask >> 16);
>  	if (ret)
>  		goto err;


  reply	other threads:[~2020-04-05 12:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 13:27 [PATCH 1/5] iio: xilinx-xadc: Fix ADC-B powerdown Lars-Peter Clausen
2020-04-03 13:27 ` [PATCH 2/5] iio: xilinx-xadc: Fix clearing interrupt when enabling trigger Lars-Peter Clausen
2020-04-05 12:11   ` Jonathan Cameron
2020-04-03 13:27 ` [PATCH 3/5] iio: xilinx-xadc: Fix sequencer configuration for aux channels in simultaneous mode Lars-Peter Clausen
2020-04-05 12:13   ` Jonathan Cameron [this message]
2020-04-03 13:27 ` [PATCH 4/5] iio: xilinx-xadc: Make sure not exceed maximum samplerate Lars-Peter Clausen
2020-04-05 12:15   ` Jonathan Cameron
2020-04-03 13:27 ` [PATCH 5/5] iio: xilinx-xadc: Fix typo Lars-Peter Clausen
2020-04-05 12:17   ` Jonathan Cameron
2020-04-05 12:10 ` [PATCH 1/5] iio: xilinx-xadc: Fix ADC-B powerdown Jonathan Cameron
2020-04-05 12:13   ` Lars-Peter Clausen
2020-04-05 12:26     ` Jonathan Cameron
2020-04-05 12:29       ` Lars-Peter Clausen
2020-04-05 17:20         ` 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=20200405131348.6eb332af@archlinux \
    --to=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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