[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aLbuqQ-1hhLGvsPZ@debian-BULLSEYE-live-builder-AMD64>
Date: Tue, 2 Sep 2025 10:18:33 -0300
From: Marcelo Schmitt <marcelo.schmitt1@...il.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: Marcelo Schmitt <marcelo.schmitt@...log.com>, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
devicetree@...r.kernel.org, linux-spi@...r.kernel.org,
Michael.Hennerich@...log.com, nuno.sa@...log.com,
eblanc@...libre.com, dlechner@...libre.com, andy@...nel.org,
corbet@....net, robh@...nel.org, krzk+dt@...nel.org,
conor+dt@...nel.org, broonie@...nel.org,
Jonathan.Cameron@...wei.com, andriy.shevchenko@...ux.intel.com,
ahaslam@...libre.com
Subject: Re: [PATCH 01/15] iio: adc: ad4030: Fix _scale for when oversampling
is enabled
Hi Jonathan,
Thanks for having a look at this.
Comment inline.
On 08/30, Jonathan Cameron wrote:
> On Fri, 29 Aug 2025 21:40:24 -0300
> Marcelo Schmitt <marcelo.schmitt@...log.com> wrote:
>
> > Previously, the AD4030 driver was using the number of scan realbits for the
> > voltage channel to derive the scale to millivolts. Though, when sample
> > averaging is enabled (oversampling_ratio > 1), the number of scan realbits
> > for the channel is set to 30 and doesn't match the amount of conversion
> > precision bits. Due to that, the calculated channel scale did not correctly
> > scale raw sample data to millivolt units in those cases. Use chip specific
> > precision bits to derive the correct channel _scale on every and all
> > channel configuration.
> >
> > Fixes: dc78e71d7c15 ("iio: adc: ad4030: remove some duplicate code")
> > Signed-off-by: Marcelo Schmitt <marcelo.schmitt@...log.com>
>
> Hi Marcelo
>
> I was assuming that when this said 'averaging' it actually meant
> summing (there is a note about using the upper precision bits to get the same
> scaling which is what we'd expect it were simply summing over X samples).
>
> So given that we don't divide back down to get the original scaling I'm
> not following how this works.
>
> E.g. If we 'averaged' just 2 values of 3 then we'd go from a value of 3 to
> one of 6. Therefore I'd expect the scale to halve as each lsb represents
> half the voltage it did when we weren't averaging those 2 samples.
This makes sense and thank you for explaining it to me.
I did some more test and debugging on the remote setup and found out the device
was not correctly configured for averaging data on my tests for v1. I need to
tweak a few more things in the driver to get both device registers and spi
transfer configuration good for offload with averaging mode. I'll reply with
more details if I find something unexpected, or drop this patch on v2.
Thanks,
Marcelo
Powered by blists - more mailing lists