[PATCH 3/3] iio: gyro: mpu3050: use the helper function

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

 



The MPU-3050 can be used as a trigger for its own triggered buffer
but it is also possible to use an external trigger: a HRTimer or
even a different sensor (!) as trigger. In that case we should not
pick the timestamp from our own interrupt top half even if it is
active.

This could practically happen if some other sensor is using the
MPU-3050 as trigger but the MPU-3050 sensor itself is using e.g.
an HRTimer as trigger. So the trigger is on, but not used by us.

We used to assume that whenever the hardware interrupt is turned
on, we are using it for our own trigger, but this is an
oversimplification.

Handle this logically by using the iio_trigger_using_own() helper.

Cc: Giuseppe Barba <giuseppe.barba@xxxxxx>
Cc: Denis Ciocca <denis.ciocca@xxxxxx>
Cc: Crestez Dan Leonard <leonard.crestez@xxxxxxxxx>
Cc: Gregor Boirie <gregor.boirie@xxxxxxxxxx>
Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
---
This applies on top of the new MPU-3050 driver which is not yet
upstream.
---
 drivers/iio/gyro/mpu3050-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c
index e0fefcccaae1..0a5179c8d37f 100644
--- a/drivers/iio/gyro/mpu3050-core.c
+++ b/drivers/iio/gyro/mpu3050-core.c
@@ -483,7 +483,7 @@ static irqreturn_t mpu3050_trigger_handler(int irq, void *p)
 	 * timestamp here so it will be close in time to the actual values
 	 * read from the registers.
 	 */
-	if (mpu3050->hw_irq_trigger)
+	if (iio_trigger_using_own(indio_dev))
 		timestamp = mpu3050->hw_timestamp;
 	else
 		timestamp = iio_get_time_ns(indio_dev);
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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