iio:core: timestamping clock selection support

Adds a new per-device sysfs attribute "current_timestamp_clock" to allow
userspace to select a particular POSIX clock for buffered samples and
events timestamping.

Following clocks, as listed in clock_gettime(2), are supported:
CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW,
CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE, CLOCK_BOOTTIME and
CLOCK_TAI.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Acked-by: Sanchayan Maity <maitysanchayan@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
Gregor Boirie
2016-03-09 19:05:49 +01:00
committed by Jonathan Cameron
parent eaaa7ec71b
commit bc2b7dab62
69 changed files with 327 additions and 114 deletions

View File

@@ -62,7 +62,7 @@ irqreturn_t st_sensors_trigger_handler(int irq, void *p)
if (sdata->hw_irq_trigger)
timestamp = sdata->hw_timestamp;
else
timestamp = iio_get_time_ns();
timestamp = iio_get_time_ns(indio_dev);
len = st_sensors_get_buffer_element(indio_dev, sdata->buffer_data);
if (len < 0)

View File

@@ -29,7 +29,7 @@ irqreturn_t st_sensors_irq_handler(int irq, void *p)
struct st_sensor_data *sdata = iio_priv(indio_dev);
/* Get the time stamp as close in time as possible */
sdata->hw_timestamp = iio_get_time_ns();
sdata->hw_timestamp = iio_get_time_ns(indio_dev);
return IRQ_WAKE_THREAD;
}