Re: [PATCH v2 2/3] iio: adc: ltc2497: add FA/FB line-frequency rejection selection
From: Nuno Sá
Date: Thu Oct 22 2026 - 06:32:54 EST
On Thu, 22 Oct 2026 12:58:19 +0300, Andrei Stancovici <andrei.stancovici@xxxxxxxxxx> wrote:
> The LTC2499 can suppress mains interference at 50Hz, 60Hz, or
> simultaneously at both, which is the power-up default. Expose the
> selection through filter_mode and filter_mode_available. It applies to
> voltage and temperature conversions alike, so the attribute is
> device-wide.
>
> The rejection mode also sets the conversion time and the output rate, so
> both are now tracked per mode. 50Hz-only rejection takes up to 163.5 ms
> at 1x, which the previous 150 ms budget did not cover; a read in that
> mode could reprogram the device mid-conversion and fail with -EIO.
>
> Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/2499fa.pdf
> Signed-off-by: Andrei Stancovici <andrei.stancovici@xxxxxxxxxx>
Just one small thing/nit (see below).
>
>
> diff --git a/drivers/iio/adc/ltc2497-core.c b/drivers/iio/adc/ltc2497-core.c
> index a6e34da83b81..c218d87d3a62 100644
> --- a/drivers/iio/adc/ltc2497-core.c
> +++ b/drivers/iio/adc/ltc2497-core.c
> @@ -211,13 +220,17 @@ static int ltc2497core_read_avail(struct iio_dev *indio_dev,
> const int **vals, int *type, int *length,
> long mask)
> {
> - switch (mask) {
> - case IIO_CHAN_INFO_SAMP_FREQ:
> - *vals = ltc2497core_samp_freq_avail;
> - *type = IIO_VAL_INT_PLUS_MICRO;
> - *length = ARRAY_SIZE(ltc2497core_samp_freq_avail);
> - return IIO_AVAIL_LIST;
> + struct ltc2497core_driverdata *ddata = iio_priv(indio_dev);
>
> + switch (mask) {
> + case IIO_CHAN_INFO_SAMP_FREQ: {
> + guard(mutex)(&ddata->lock);
> +
Now we have a mix of cleanup with mutex_lock() right? Would be nice if
you have a follow up patch bringing some consistency :). But anyways:
Reviewed-by: Nuno Sá <nuno.sa@xxxxxxxxxx>
--
Nuno Sá <nuno.sa@xxxxxxxxxx>