summaryrefslogtreecommitdiff
path: root/drivers/iio/imu/bmi160
diff options
context:
space:
mode:
authorMartin Kelly <martin@martingkelly.com>2019-02-02 13:56:00 -0800
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2019-02-09 15:24:27 +0000
commit0a3f50e4d698e3d46ce10171dcd076c927bb60a8 (patch)
tree2070a154e04ab6377050df1b6e172522589c0588 /drivers/iio/imu/bmi160
parentb7905e4c5731636a2148039288bdc77599c14d6a (diff)
iio:bmi160: use iio_pollfunc_store_time
Currently, we snap the timestamp after reading from the buffer and processing the event. When the IIO poll function is triggered by an interrupt, we can get a slightly more accurate timestamp by snapping it prior to reading the data, since the data was already generated prior to entering the trigger handler. This is not going to make a huge difference, but we might as well improve slightly. Do this by using iio_pollfunc_store_time as other drivers do. Signed-off-by: Martin Kelly <martin@martingkelly.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/imu/bmi160')
-rw-r--r--drivers/iio/imu/bmi160/bmi160_core.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c
index 007f7c532ac4..f3c5b86a281e 100644
--- a/drivers/iio/imu/bmi160/bmi160_core.c
+++ b/drivers/iio/imu/bmi160/bmi160_core.c
@@ -425,8 +425,7 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p)
buf[j++] = sample;
}
- iio_push_to_buffers_with_timestamp(indio_dev, buf,
- iio_get_time_ns(indio_dev));
+ iio_push_to_buffers_with_timestamp(indio_dev, buf, pf->timestamp);
done:
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
@@ -834,7 +833,8 @@ int bmi160_core_probe(struct device *dev, struct regmap *regmap,
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &bmi160_info;
- ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL,
+ ret = devm_iio_triggered_buffer_setup(dev, indio_dev,
+ iio_pollfunc_store_time,
bmi160_trigger_handler, NULL);
if (ret < 0)
return ret;