Skip to contentSkip to conversation

iio: imu: inv_mpu6050: Fix probe() failure on older ACPI based machines

PATCH Applied Hans de Goede 5 participants 5 messages Jun 18, 2018 – Jun 24, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: imu: inv_mpu6050: Fix probe() failure on older ACPI based machines

Commit 5ec6486daa98 ("iio:imu: inv_mpu6050: support more interrupt types") causes inv_mpu_core_probe() to fail if the IRQ does not have a trigger-type setup.

This happens on machines where the mpu6050 is enumerated through ACPI and an older Interrupt type ACPI resource is used for the interrupt, rather then a GpioInt type type, causing the mpu6050 driver to no longer work there. This happens on e.g. the Asus T100TA.

This commits makes the mpu6050 fallback to the old IRQF_TRIGGER_RISING default if the irq-type is not setup, fixing this.

Fixes 5ec6486daa98 ("iio:imu: inv_mpu6050: support more interrupt types")
Cc Martin Kelly <[email protected]>
Cc Jean-Baptiste Maneyrol <[email protected]>
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +2 -0
index f9c0624505a2..42618fe4f83e 100644
@@ -959,6 +959,8 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
 	}
 
 	irq_type = irqd_get_trigger_type(desc);
+	if (!irq_type)
+		irq_type = IRQF_TRIGGER_RISING;
 	if (irq_type == IRQF_TRIGGER_RISING)
 		st->irq_mask = INV_MPU6050_ACTIVE_HIGH;
 	else if (irq_type == IRQF_TRIGGER_FALLING)
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 26 lines · Hans de Goede

Commit 5ec6486daa98 ("iio:imu: inv_mpu6050: support more interrupt types") causes inv_mpu_core_probe() to fail if the IRQ does not have a trigger-type setup.

This happens on machines where the mpu6050 is enumerated through ACPI and an older Interrupt type ACPI resource is used for the interrupt, rather then a GpioInt type type, causing the mpu6050 driver to no longer work there. This happens on e.g. the Asus T100TA.

This commits makes the mpu6050 fallback to the old IRQF_TRIGGER_RISING default if the irq-type is not setup, fixing this.

Fixes 5ec6486daa98 ("iio:imu: inv_mpu6050: support more interrupt types")
Cc Martin Kelly <[email protected]>
Cc Jean-Baptiste Maneyrol <[email protected]>
---
  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +0 -0
index f9c0624505a2..42618fe4f83e 100644

drivers/iio/imu/inv_mpu6050/inv_mpu_core.c int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name, · line 966

Quoted 8 lines
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +2 -0
@@ -959,6 +959,8 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
  	}
 
  	irq_type = irqd_get_trigger_type(desc);
+	if (!irq_type)
+		irq_type = IRQF_TRIGGER_RISING;
  	if (irq_type == IRQF_TRIGGER_RISING)
  		st->irq_mask = INV_MPU6050_ACTIVE_HIGH;
  	else if (irq_type == IRQF_TRIGGER_FALLING)

Thanks, good catch! I had thought that irqd_get_trigger_type would work the same universally, but I see I was mistaken.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Hans de Goede

From: Hans de Goede <[email protected]>
Sent: Monday, June 18, 2018 18:09
To: Jonathan Cameron
Cc: Hans de Goede; Hartmut Knaack; Lars-Peter Clausen; Peter Meerwald-Stadl= er; [email protected]; Martin Kelly; Jean-Baptiste Maneyrol
Subject: [PATCH 4.18 REGRESSION fix] iio: imu: inv_mpu6050: Fix probe() fai= lure on older ACPI based machines
=A0=20

CAUTION: This email originated from outside of the organization. Please mak= e sure the sender is who they say they are and do not click links or open a= ttachments unless you recognize the sender and know the content is safe.

Commit 5ec6486daa98 ("iio:imu: inv_mpu6050: support more interrupt types") causes inv_mpu_core_probe() to fail if the IRQ does not have a trigger-type setup.

This happens on machines where the mpu6050 is enumerated through ACPI and an older Interrupt type ACPI resource is used for the interrupt, rather then a GpioInt type type, causing the mpu6050 driver to no longer work there. This happens on e.g. the Asus T100TA.

This commits makes the mpu6050 fallback to the old IRQF_TRIGGER_RISING default if the irq-type is not setup, fixing this.

Fixes 5ec6486daa98 ("iio:imu: inv_mpu6050: support more interrupt types")
Cc Martin Kelly <[email protected]>
Cc Jean-Baptiste Maneyrol <[email protected]>

---
=A0drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 ++ =A01 file changed, 2 insertions(+)

drivers/iio/imu/i= renamed from drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +0 -0

nv_mpu6050/inv_mpu_core.c
index f9c0624505a2..42618fe4f83e 100644

drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +0 -0
@@ -959,6 +959,8 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, =

const char *name,
=A0=A0=A0=A0=A0=A0=A0 }

=A0=A0=A0=A0=A0=A0=A0 irq_type =3D irqd_get_trigger_type(desc);

+=A0=A0=A0=A0=A0=A0 if (!irq_type)
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 irq_type =3D IRQF_TRIGGER_RISIN=

G;
=A0=A0=A0=A0=A0=A0=A0 if (irq_type =3D=3D IRQF_TRIGGER_RISING) =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 st->irq_mask =3D INV_MPU6050_= ACTIVE_HIGH;
=A0=A0=A0=A0=A0=A0=A0 else if (irq_type =3D=3D IRQF_TRIGGER_FALLING) --
2.17.1

Good catch indeed, thanks for testing and verifying.

#3 lore raw
In reply to Hans de Goede
Quoted 9 lines · On Mon, 18 Jun 2018 18:09:36 +0200 Hans de Goede <[email protected]> wrote:

Commit 5ec6486daa98 ("iio:imu: inv_mpu6050: support more interrupt types") causes inv_mpu_core_probe() to fail if the IRQ does not have a trigger-type setup.

This happens on machines where the mpu6050 is enumerated through ACPI and an older Interrupt type ACPI resource is used for the interrupt, rather then a GpioInt type type, causing the mpu6050 driver to no longer work there. This happens on e.g. the Asus T100TA.

Quoted 7 lines

This commits makes the mpu6050 fallback to the old IRQF_TRIGGER_RISING default if the irq-type is not setup, fixing this.

Fixes 5ec6486daa98 ("iio:imu: inv_mpu6050: support more interrupt types")
Cc Martin Kelly <[email protected]>
Cc Jean-Baptiste Maneyrol <[email protected]>

Sorry for the delay - traveling this week. Will pick this up over the weekend once I'm back home.

J

Quoted 17 lines
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +2 -0
index f9c0624505a2..42618fe4f83e 100644
@@ -959,6 +959,8 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
 	}
 
 	irq_type = irqd_get_trigger_type(desc);
+	if (!irq_type)
+		irq_type = IRQF_TRIGGER_RISING;
 	if (irq_type == IRQF_TRIGGER_RISING)
 		st->irq_mask = INV_MPU6050_ACTIVE_HIGH;
 	else if (irq_type == IRQF_TRIGGER_FALLING)
maintainer Applied
#4 lore raw
Quoted 15 lines · On Fri, 22 Jun 2018 15:18:27 +0100 Jonathan Cameron…
Quoted 12 lines · On Mon, 18 Jun 2018 18:09:36 +0200 Hans de Goede <[email protected]> wrote:

Commit 5ec6486daa98 ("iio:imu: inv_mpu6050: support more interrupt types") causes inv_mpu_core_probe() to fail if the IRQ does not have a trigger-type setup.

This happens on machines where the mpu6050 is enumerated through ACPI and an older Interrupt type ACPI resource is used for the interrupt, rather then a GpioInt type type, causing the mpu6050 driver to no longer work there. This happens on e.g. the Asus T100TA.

This commits makes the mpu6050 fallback to the old IRQF_TRIGGER_RISING default if the irq-type is not setup, fixing this.

Quoted 7 lines
Quoted 4 lines
Fixes 5ec6486daa98 ("iio:imu: inv_mpu6050: support more interrupt types")
Cc Martin Kelly <[email protected]>
Cc Jean-Baptiste Maneyrol <[email protected]>

Sorry for the delay - traveling this week. Will pick this up over the weekend once I'm back home.

Applied to the fixes-togreg branch of iio.git. Aiming to do a pull request later today.

Thanks,

Jonathan

Quoted 26 lines

J

Quoted 9 lines
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +0 -0
index f9c0624505a2..42618fe4f83e 100644

drivers/iio/imu/inv_mpu6050/inv_mpu_core.c int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name, · line 966

Quoted 8 lines
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +2 -0
@@ -959,6 +959,8 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
 	}
 
 	irq_type = irqd_get_trigger_type(desc);
+	if (!irq_type)
+		irq_type = IRQF_TRIGGER_RISING;
 	if (irq_type == IRQF_TRIGGER_RISING)
 		st->irq_mask = INV_MPU6050_ACTIVE_HIGH;
 	else if (irq_type == IRQF_TRIGGER_FALLING)  

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