]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iio: adc: ad7124: fix temperature channel
authorDavid Lechner <dlechner@baylibre.com>
Fri, 10 Oct 2025 20:24:31 +0000 (15:24 -0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 13 Oct 2025 07:38:09 +0000 (08:38 +0100)
commite2cc390a6629c76924a2740c54b144b9b28fca59
tree9567192062e323116424c522af9da0657498782f
parent21553258b94861a73d7f2cf15469d69240e1170d
iio: adc: ad7124: fix temperature channel

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@analog.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7124.c