* [PATCH v3] iio: imu/mpu6050: support dual-edge IRQ
@ 2020-01-11 15:19 Michał Mirosław
2020-01-18 13:32 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Michał Mirosław @ 2020-01-11 15:19 UTC (permalink / raw)
To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, Jean-Baptiste Maneyrol
Cc: linux-iio, linux-kernel
Make mpu6050 usable on platforms which provide only any-edge interrupts.
One example of this kind of platform is AT91SAM9G45
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
---
v3: reword commit message
v2: just remove the dev_warn() message
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 +-
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 5 +----
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 2261c6c4ac65..4cfdd19ee4fc 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -1118,7 +1118,7 @@ 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)
+ if (irq_type & IRQF_TRIGGER_RISING) // rising or both-edge
st->irq_mask = INV_MPU6050_ACTIVE_HIGH;
else if (irq_type == IRQF_TRIGGER_FALLING)
st->irq_mask = INV_MPU6050_ACTIVE_LOW;
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
index 72d8c5790076..a8a833f8b99b 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
@@ -180,11 +180,8 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
"failed to ack interrupt\n");
goto flush_fifo;
}
- if (!(int_status & INV_MPU6050_BIT_RAW_DATA_RDY_INT)) {
- dev_warn(regmap_get_device(st->map),
- "spurious interrupt with status 0x%x\n", int_status);
+ if (!(int_status & INV_MPU6050_BIT_RAW_DATA_RDY_INT))
goto end_session;
- }
if (!(st->chip_config.accl_fifo_enable |
st->chip_config.gyro_fifo_enable))
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v3] iio: imu/mpu6050: support dual-edge IRQ
2020-01-11 15:19 [PATCH v3] iio: imu/mpu6050: support dual-edge IRQ Michał Mirosław
@ 2020-01-18 13:32 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2020-01-18 13:32 UTC (permalink / raw)
To: Michał Mirosław
Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
Jean-Baptiste Maneyrol, linux-iio, linux-kernel
On Sat, 11 Jan 2020 16:19:11 +0100
Michał Mirosław <mirq-linux@rere.qmqm.pl> wrote:
> Make mpu6050 usable on platforms which provide only any-edge interrupts.
> One example of this kind of platform is AT91SAM9G45
>
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to see if they can break anything.
Thanks,
Jonathan
>
> ---
> v3: reword commit message
> v2: just remove the dev_warn() message
>
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
> drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 +-
> drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 5 +----
> 2 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> index 2261c6c4ac65..4cfdd19ee4fc 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> @@ -1118,7 +1118,7 @@ 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)
> + if (irq_type & IRQF_TRIGGER_RISING) // rising or both-edge
> st->irq_mask = INV_MPU6050_ACTIVE_HIGH;
> else if (irq_type == IRQF_TRIGGER_FALLING)
> st->irq_mask = INV_MPU6050_ACTIVE_LOW;
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> index 72d8c5790076..a8a833f8b99b 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> @@ -180,11 +180,8 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
> "failed to ack interrupt\n");
> goto flush_fifo;
> }
> - if (!(int_status & INV_MPU6050_BIT_RAW_DATA_RDY_INT)) {
> - dev_warn(regmap_get_device(st->map),
> - "spurious interrupt with status 0x%x\n", int_status);
> + if (!(int_status & INV_MPU6050_BIT_RAW_DATA_RDY_INT))
> goto end_session;
> - }
>
> if (!(st->chip_config.accl_fifo_enable |
> st->chip_config.gyro_fifo_enable))
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-18 13:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-11 15:19 [PATCH v3] iio: imu/mpu6050: support dual-edge IRQ Michał Mirosław
2020-01-18 13:32 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox