]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: adc: ad7768-1: remove switch to one-shot mode
authorJonathan Santos <Jonathan.Santos@analog.com>
Mon, 23 Feb 2026 11:59:35 +0000 (08:59 -0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 1 Mar 2026 12:07:05 +0000 (12:07 +0000)
wideband low ripple FIR Filter is not available in one-shot mode. In
order to make direct reads work for all filter options, remove the
switch for one-shot mode and guarantee device is always in continuous
conversion mode.

Fixes: fb1d3b24ebf5 ("iio: adc: ad7768-1: add filter type and oversampling ratio attributes")
Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7768-1.c

index 4cb63ab4768a7835191cf8e60bf0f2d30392f76e..a927ae288fbb828f81649c505d6518867a755c8c 100644 (file)
@@ -463,17 +463,8 @@ static int ad7768_scan_direct(struct iio_dev *indio_dev)
        struct ad7768_state *st = iio_priv(indio_dev);
        int readval, ret;
 
-       ret = ad7768_set_mode(st, AD7768_ONE_SHOT);
-       if (ret < 0)
-               return ret;
-
        reinit_completion(&st->completion);
 
-       /* One-shot mode requires a SYNC pulse to generate a new sample */
-       ret = ad7768_send_sync_pulse(st);
-       if (ret)
-               return ret;
-
        ret = wait_for_completion_timeout(&st->completion,
                                          msecs_to_jiffies(1000));
        if (!ret)
@@ -492,14 +483,6 @@ static int ad7768_scan_direct(struct iio_dev *indio_dev)
        if (st->oversampling_ratio == 8)
                readval >>= 8;
 
-       /*
-        * Any SPI configuration of the AD7768-1 can only be
-        * performed in continuous conversion mode.
-        */
-       ret = ad7768_set_mode(st, AD7768_CONTINUOUS);
-       if (ret < 0)
-               return ret;
-
        return readval;
 }
 
@@ -1248,6 +1231,10 @@ static int ad7768_setup(struct iio_dev *indio_dev)
                        return ret;
        }
 
+       ret = ad7768_set_mode(st, AD7768_CONTINUOUS);
+       if (ret)
+               return ret;
+
        /* For backwards compatibility, try the adi,sync-in-gpios property */
        st->gpio_sync_in = devm_gpiod_get_optional(&st->spi->dev, "adi,sync-in",
                                                   GPIOD_OUT_LOW);