Linux IIO development
 help / color / mirror / Atom feed
From: "Nuno Sá" <noname.nuno@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Dumitru Ceclan" <dumitru.ceclan@analog.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Nuno Sa" <nuno.sa@analog.com>, "Rob Herring" <robh@kernel.org>
Cc: devicetree@vger.kernel.org, linux-iio@vger.kernel.org
Subject: Re: [PATCH v2 4/4] iio: adc: ad7124: Disable all channels at probe time
Date: Wed, 30 Oct 2024 08:17:51 +0100	[thread overview]
Message-ID: <95f7b9284e6d97fb991f93798758d5b5582fe0d6.camel@gmail.com> (raw)
In-Reply-To: <20241028160748.489596-10-u.kleine-koenig@baylibre.com>

On Mon, 2024-10-28 at 17:07 +0100, Uwe Kleine-König wrote:
> When during a measurement two channels are enabled, two measurements are
> done that are reported sequencially in the DATA register. As the code
> triggered by reading one of the sysfs properties expects that only one
> channel is enabled it only reads the first data set which might or might
> not belong to the intended channel.
> 
> To prevent this situation disable all channels during probe. This fixes
> a problem in practise because the reset default for channel 0 is
> enabled. So all measurements before the first measurement on channel 0
> (which disables channel 0 at the end) might report wrong values.
> 
> Fixes: 7b8d045e497a ("iio: adc: ad7124: allow more than 8 channels")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---

Reviewed-by: Nuno Sa <nuno.sa@analog.com>

>  drivers/iio/adc/ad7124.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c
> index a5d91933f505..749304d38415 100644
> --- a/drivers/iio/adc/ad7124.c
> +++ b/drivers/iio/adc/ad7124.c
> @@ -917,6 +917,9 @@ static int ad7124_setup(struct ad7124_state *st)
>  		 * set all channels to this default value.
>  		 */
>  		ad7124_set_channel_odr(st, i, 10);
> +
> +		/* Disable all channels to prevent unintended conversions. */
> +		ad_sd_write_reg(&st->sd, AD7124_CHANNEL(i), 2, 0);
>  	}
>  
>  	ret = ad_sd_write_reg(&st->sd, AD7124_ADC_CONTROL, 2, st->adc_control);


  reply	other threads:[~2024-10-30  7:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-28 16:07 [PATCH v2 0/4] iio: adc: ad7124: Make it work on de10-nano Uwe Kleine-König
2024-10-28 16:07 ` [PATCH v2 1/4] dt-bindings: iio: adc: adi,ad7124: Use symbolic name for interrupt flag Uwe Kleine-König
2024-10-29  7:36   ` Krzysztof Kozlowski
2024-10-28 16:07 ` [PATCH v2 2/4] dt-bindings: iio: adc: adi,ad7124: Allow specifications of a gpio for irq line Uwe Kleine-König
2024-11-01 19:20   ` Rob Herring
2024-10-28 16:07 ` [PATCH v2 3/4] iio: adc: ad_sigma_delta: Add support for reading irq status using a GPIO Uwe Kleine-König
2024-10-30 13:04   ` Nuno Sá
2024-10-30 20:44     ` Jonathan Cameron
2024-10-31 10:40       ` Uwe Kleine-König
2024-10-31 12:05         ` Nuno Sá
2024-10-31 12:28           ` Nuno Sá
2024-11-04 12:49           ` Uwe Kleine-König
2024-11-04 13:15             ` Nuno Sá
2024-11-05  9:20               ` Uwe Kleine-König
2024-11-05 10:30                 ` Nuno Sá
2024-10-28 16:07 ` [PATCH v2 4/4] iio: adc: ad7124: Disable all channels at probe time Uwe Kleine-König
2024-10-30  7:17   ` Nuno Sá [this message]
2024-10-28 16:38 ` [PATCH v2 0/4] iio: adc: ad7124: Make it work on de10-nano David Lechner
2024-11-18 18:12 ` Uwe Kleine-König
2024-11-23 14:24   ` 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=95f7b9284e6d97fb991f93798758d5b5582fe0d6.camel@gmail.com \
    --to=noname.nuno@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=dumitru.ceclan@analog.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=u.kleine-koenig@baylibre.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