Commit 8bcf024f authored by Stefan Brüns's avatar Stefan Brüns Committed by Greg Kroah-Hartman

iio: adc: ina2xx: Do not udelay for several seconds

The conversion time can be up to 16 seconds (8 ms per channel, 2 channels,
1024 times averaging).
Signed-off-by: default avatarStefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c68013f3
...@@ -764,7 +764,7 @@ static int ina2xx_capture_thread(void *data) ...@@ -764,7 +764,7 @@ static int ina2xx_capture_thread(void *data)
struct iio_dev *indio_dev = data; struct iio_dev *indio_dev = data;
struct ina2xx_chip_info *chip = iio_priv(indio_dev); struct ina2xx_chip_info *chip = iio_priv(indio_dev);
int sampling_us = SAMPLING_PERIOD(chip); 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 * Poll a bit faster than the chip internal Fs, in case
...@@ -778,8 +778,10 @@ static int ina2xx_capture_thread(void *data) ...@@ -778,8 +778,10 @@ static int ina2xx_capture_thread(void *data)
if (buffer_us < 0) if (buffer_us < 0)
return buffer_us; return buffer_us;
if (sampling_us > buffer_us) if (sampling_us > buffer_us) {
udelay(sampling_us - buffer_us); delay_us = sampling_us - buffer_us;
usleep_range(delay_us, (delay_us * 3) >> 1);
}
} while (!kthread_should_stop()); } while (!kthread_should_stop());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment