OSDN Git Service

iio: adc: ina2xx: Use a monotonic clock for delay calculation
authorStefan Brüns <stefan.bruens@rwth-aachen.de>
Mon, 1 Jan 2018 01:24:42 +0000 (02:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Jan 2018 15:03:42 +0000 (16:03 +0100)
commit8ea2a63869517271f7356241015a3edf3efb77a5
tree91a8e8fa46ff2f3d4e1a2be9eeab24c41db82309
parent08e2e51f9acf9d2ab0437721aed71de53bd334e6
iio: adc: ina2xx: Use a monotonic clock for delay calculation

The iio timestamp clock is user selectable and may be non-monotonic. Also,
only part of the acquisition time is measured, thus the delay was longer
than intended.

Use a monotonic timestamp to track the time for the next poll iteration.
The timestamp is advanced by the sampling interval each iteration. In case
the conversion overrruns the register readout (i.e. fast sampling combined
with a slow bus), one or multiple samples will be dropped.

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>
drivers/iio/adc/ina2xx-adc.c