On 8/30/25 1:43 PM, Jonathan Cameron wrote: > On Fri, 29 Aug 2025 21:40:24 -0300 > Marcelo Schmitt <marcelo.schmitt@xxxxxxxxxx> 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@xxxxxxxxxx> > > 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. I had the same feeling. I have some hardware I can test later this week.