]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: adc: ad7173: fix num_slots
authorDavid Lechner <dlechner@baylibre.com>
Sun, 6 Jul 2025 18:53:08 +0000 (13:53 -0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 16 Jul 2025 07:47:35 +0000 (08:47 +0100)
commit92c247216918fcaa64244248ee38a0f1d342278c
tree7d16d77c88921d0c3a9fc40c08a332365fb5a5d0
parent0eb8d7b25397330beab8ee62c681975b79f37223
iio: adc: ad7173: fix num_slots

Fix the num_slots value for most chips in the ad7173 driver. The correct
value is the number of CHANNELx registers on the chip.

In commit 4310e15b3140 ("iio: adc: ad7173: don't make copy of
ad_sigma_delta_info struct"), we refactored struct ad_sigma_delta_info
to be static const data instead of being dynamically populated during
driver probe. However, there was an existing bug in commit 76a1e6a42802
("iio: adc: ad7173: add AD7173 driver") where num_slots was incorrectly
set to the number of CONFIGx registers instead of the number of
CHANNELx registers. This bug was partially propagated to the refactored
code in that the 16-channel chips were only given 8 slots instead of
16 although we did managed to fix the 8-channel chips and one of the
4-channel chips in that commit. However, we botched two of the 4-channel
chips and ended up incorrectly giving them 8 slots during the
refactoring.

This patch fixes that mistake on the 4-channel chips and also
corrects the 16-channel chips to have 16 slots.

Fixes: 4310e15b3140 ("iio: adc: ad7173: don't make copy of ad_sigma_delta_info struct")
Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250706-iio-adc-ad7173-fix-num_slots-on-most-chips-v3-1-d1f5453198a7@baylibre.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7173.c