Skip to content

Commit 0a3b517

Browse files
jmaneyrol-invnjic23
authored andcommitted
iio: imu: inv_mpu6050: fix interrupt status read for old buggy chips
Interrupt status read seems to be broken on some old MPU-6050 like chips. Fix by reverting to previous driver behavior bypassing interrupt status read. This is working because these chips are not supporting WoM and data ready is the only interrupt source. Fixes: 5537f65 ("iio: imu: inv_mpu6050: add new interrupt handler for WoM events") Cc: [email protected] Signed-off-by: Jean-Baptiste Maneyrol <[email protected]> Tested-by: Svyatoslav Ryhel <[email protected]> # LG P895 Tested-by: Andreas Westman Dorcsak <[email protected]> # LG P880 Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
1 parent f242967 commit 0a3b517

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,20 @@ static irqreturn_t inv_mpu6050_interrupt_handle(int irq, void *p)
248248
int result;
249249

250250
switch (st->chip_type) {
251+
case INV_MPU6000:
251252
case INV_MPU6050:
253+
case INV_MPU9150:
254+
/*
255+
* WoM is not supported and interrupt status read seems to be broken for
256+
* some chips. Since data ready is the only interrupt, bypass interrupt
257+
* status read and always assert data ready bit.
258+
*/
259+
wom_bits = 0;
260+
int_status = INV_MPU6050_BIT_RAW_DATA_RDY_INT;
261+
goto data_ready_interrupt;
252262
case INV_MPU6500:
253263
case INV_MPU6515:
254264
case INV_MPU6880:
255-
case INV_MPU6000:
256-
case INV_MPU9150:
257265
case INV_MPU9250:
258266
case INV_MPU9255:
259267
wom_bits = INV_MPU6500_BIT_WOM_INT;
@@ -279,6 +287,7 @@ static irqreturn_t inv_mpu6050_interrupt_handle(int irq, void *p)
279287
}
280288
}
281289

290+
data_ready_interrupt:
282291
/* handle raw data interrupt */
283292
if (int_status & INV_MPU6050_BIT_RAW_DATA_RDY_INT) {
284293
indio_dev->pollfunc->timestamp = st->it_timestamp;

0 commit comments

Comments
 (0)