[PATCH 2/2] iio: gyro: mpu3050: Store timestamp in poll function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If something other than the MPU3050 itself is using this
trigger, the timestamp needs to be stored in the poll
function.

Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
---
 drivers/iio/gyro/mpu3050-core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c
index 0d0850945d3a..b892487394ea 100644
--- a/drivers/iio/gyro/mpu3050-core.c
+++ b/drivers/iio/gyro/mpu3050-core.c
@@ -457,7 +457,7 @@ static int mpu3050_write_raw(struct iio_dev *indio_dev,
 
 static irqreturn_t mpu3050_trigger_handler(int irq, void *p)
 {
-	const struct iio_poll_func *pf = p;
+	struct iio_poll_func *pf = p;
 	struct iio_dev *indio_dev = pf->indio_dev;
 	struct mpu3050 *mpu3050 = iio_priv(indio_dev);
 	int ret;
@@ -482,6 +482,9 @@ static irqreturn_t mpu3050_trigger_handler(int irq, void *p)
 	else
 		timestamp = iio_get_time_ns(indio_dev);
 
+	/* Someone else may be using us as trigger */
+	pf->timestamp = timestamp;
+
 	mutex_lock(&mpu3050->lock);
 
 	/* Using the hardware IRQ trigger? Check the buffer then. */
-- 
2.26.2




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux