]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio: adc: ad7124: Fix 3dB filter frequency reading
authorUwe Kleine-König <u.kleine-koenig@baylibre.com>
Mon, 17 Mar 2025 11:52:47 +0000 (12:52 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:05:16 +0000 (11:05 +0100)
[ Upstream commit 8712e4986e7ce42a14c762c4c350f290989986a5 ]

The sinc4 filter has a factor 0.23 between Output Data Rate and f_{3dB}
and for sinc3 the factor is 0.272 according to the data sheets for
ad7124-4 (Rev. E.) and ad7124-8 (Rev. F).

Fixes: cef2760954cf ("iio: adc: ad7124: add 3db filter")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Link: https://patch.msgid.link/20250317115247.3735016-6-u.kleine-koenig@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/adc/ad7124.c

index 31c8cb3bf811b6d00e3fe89a19e9097824dc520f..c018437177ba69d617509c974506bc52af94ae03 100644 (file)
@@ -297,9 +297,9 @@ static int ad7124_get_3db_filter_freq(struct ad7124_state *st,
 
        switch (st->channels[channel].cfg.filter_type) {
        case AD7124_SINC3_FILTER:
-               return DIV_ROUND_CLOSEST(fadc * 230, 1000);
+               return DIV_ROUND_CLOSEST(fadc * 272, 1000);
        case AD7124_SINC4_FILTER:
-               return DIV_ROUND_CLOSEST(fadc * 262, 1000);
+               return DIV_ROUND_CLOSEST(fadc * 230, 1000);
        default:
                return -EINVAL;
        }