Skip to content

Commit d23d763

Browse files
akemnadejic23
authored andcommitted
iio: imu: inv-mpu9150: fix irq ack preventing irq storms
IRQ needs to be acked. for some odd reasons, reading from irq status does not reliable help, enable acking from any register to be on the safe side and read the irq status register. Comments in the code indicate a known unreliability with that register. The blamed commit was tested with mpu6050 in lg,p895 and lg,p880 according to Tested-bys. But with the MPU9150 in the Epson Moverio BT-200 this leads to irq storms without properly acking the irq. Fixes: 0a3b517 ("iio: imu: inv_mpu6050: fix interrupt status read for old buggy chips") Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 6c8bf4b commit d23d763

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

drivers/iio/imu/inv_mpu6050/inv_mpu_core.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,6 +1943,14 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
19431943
irq_type);
19441944
return -EINVAL;
19451945
}
1946+
1947+
/*
1948+
* Acking interrupts by status register does not work reliably
1949+
* but seem to work when this bit is set.
1950+
*/
1951+
if (st->chip_type == INV_MPU9150)
1952+
st->irq_mask |= INV_MPU6050_INT_RD_CLEAR;
1953+
19461954
device_set_wakeup_capable(dev, true);
19471955

19481956
st->vdd_supply = devm_regulator_get(dev, "vdd");

drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,8 @@ struct inv_mpu6050_state {
390390
/* enable level triggering */
391391
#define INV_MPU6050_LATCH_INT_EN 0x20
392392
#define INV_MPU6050_BIT_BYPASS_EN 0x2
393+
/* allow acking interrupts by any register read */
394+
#define INV_MPU6050_INT_RD_CLEAR 0x10
393395

394396
/* Allowed timestamp period jitter in percent */
395397
#define INV_MPU6050_TS_PERIOD_JITTER 4

drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ static irqreturn_t inv_mpu6050_interrupt_handle(int irq, void *p)
248248
switch (st->chip_type) {
249249
case INV_MPU6000:
250250
case INV_MPU6050:
251-
case INV_MPU9150:
252251
/*
253252
* WoM is not supported and interrupt status read seems to be broken for
254253
* some chips. Since data ready is the only interrupt, bypass interrupt
@@ -257,6 +256,10 @@ static irqreturn_t inv_mpu6050_interrupt_handle(int irq, void *p)
257256
wom_bits = 0;
258257
int_status = INV_MPU6050_BIT_RAW_DATA_RDY_INT;
259258
goto data_ready_interrupt;
259+
case INV_MPU9150:
260+
/* IRQ needs to be acked */
261+
wom_bits = 0;
262+
break;
260263
case INV_MPU6500:
261264
case INV_MPU6515:
262265
case INV_MPU6880:

0 commit comments

Comments
 (0)