Re: [PATCH v2] iio: adc: ad7124: fix temperature channel

From: Jonathan Cameron

Date: Sun Oct 12 2025 - 15:07:59 EST


On Sun, 12 Oct 2025 14:47:13 +0200
Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx> wrote:

> Hello David,
>
> On Fri, Oct 10, 2025 at 03:24:31PM -0500, David Lechner wrote:
> > Fix temperature channel not working due to gain and offset not being
> > initialized. For channels other than the voltage ones calibration is
> > skipped (which is OK). However that results in the calibration register
> > values tracked in st->channels[i].cfg all being zero. These zeros are
> > later written to hardware before a measurement is made which caused the
> > raw temperature readings to be always 8388608 (0x800000).
> >
> > To fix it, we just make sure the gain and offset values are set to the
> > default values and still return early without doing an internal
> > calibration.
> >
> > While here, add a comment explaining why we don't bother calibrating
> > the temperature channel.
> >
> > Fixes: 47036a03a303 ("iio: adc: ad7124: Implement internal calibration at probe time")
> > Reviewed-by: Marcelo Schmitt <marcelo.schmitt@xxxxxxxxxx>
> > Signed-off-by: David Lechner <dlechner@xxxxxxxxxxxx>
> > ---
> > Changes in v2:
> > - Improved commit message.
> > - Expanded code comment.
>
> I like both improvements, thanks!
>
> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx>

Applied to the temporary branch I'm queuing fixes on until I can rebase on rc1.
+ marked for stable.