The conversion time can be up to 16 seconds (8 ms per channel, 2 channels,
1024 times averaging).
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        struct iio_dev *indio_dev = data;
        struct ina2xx_chip_info *chip = iio_priv(indio_dev);
        int sampling_us = SAMPLING_PERIOD(chip);
-       int buffer_us;
+       int buffer_us, delay_us;
 
        /*
         * Poll a bit faster than the chip internal Fs, in case
                if (buffer_us < 0)
                        return buffer_us;
 
-               if (sampling_us > buffer_us)
-                       udelay(sampling_us - buffer_us);
+               if (sampling_us > buffer_us) {
+                       delay_us = sampling_us - buffer_us;
+                       usleep_range(delay_us, (delay_us * 3) >> 1);
+               }
 
        } while (!kthread_should_stop());