linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean-Baptiste Maneyrol <JManeyrol@invensense.com>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Hartmut Knaack" <knaack.h@gmx.de>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Peter Meerwald-Stadler" <pmeerw@pmeerw.net>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iio: imu/mpu6050: support dual-edge IRQ
Date: Mon, 6 Jan 2020 09:42:00 +0000	[thread overview]
Message-ID: <MN2PR12MB33737F067F25B2F7477C4FE5C43C0@MN2PR12MB3373.namprd12.prod.outlook.com> (raw)
In-Reply-To: <e03daea84ce5fe5e79311a07fee4636c2a884a8e.1578156240.git.mirq-linux@rere.qmqm.pl>

Hello Michal,

interesting, thanks a lot.

It would be far better to simply delete the warning log for spurious interrupt. I was thinking that it would only be triggered by a real bug somewhere. I wasn't thinking about systems with any-edge trigger like yours.

So just delete the warn message and no need to add the irq_ignore_spurious logic and variable.

Thanks,
JB

From: linux-iio-owner@vger.kernel.org <linux-iio-owner@vger.kernel.org> on behalf of Michał Mirosław <mirq-linux@rere.qmqm.pl>

Sent: Saturday, January 4, 2020 17:44

To: Jonathan Cameron <jic23@kernel.org>; Hartmut Knaack <knaack.h@gmx.de>; Lars-Peter Clausen <lars@metafoo.de>; Peter Meerwald-Stadler <pmeerw@pmeerw.net>

Cc: linux-iio@vger.kernel.org <linux-iio@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>

Subject: [PATCH] iio: imu/mpu6050: support dual-edge IRQ

 


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



Make mpu6050 usable on platforms which provide only any-edge interrupts.



Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>

---

 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 3 ++-

 drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h  | 1 +

 drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 6 ++++--

 3 files changed, 7 insertions(+), 3 deletions(-)



diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c

index 0686e41bb8a1..36b6a3922d15 100644

--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c

+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c

@@ -1239,9 +1239,10 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,

         }

 

         irq_type = irqd_get_trigger_type(desc);

+       st->irq_ignore_spurious = irq_type == (IRQF_TRIGGER_RISING|IRQF_TRIGGER_FALLING);

         if (!irq_type)

                 irq_type = IRQF_TRIGGER_RISING;

-       if (irq_type == IRQF_TRIGGER_RISING)

+       if (irq_type == IRQF_TRIGGER_RISING || st->irq_ignore_spurious)

                 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_iio.h b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h

index b096e010d4ee..94ee7b18b198 100644

--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h

+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h

@@ -158,6 +158,7 @@ struct inv_mpu6050_state {

         struct regmap *map;

         int irq;

         u8 irq_mask;

+       u8 irq_ignore_spurious;

         unsigned skip_samples;

         s64 chip_period;

         s64 it_timestamp;

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c

index 10d16ec5104b..52f02de3d9b0 100644

--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c

+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c

@@ -184,8 +184,10 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)

                 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 (!st->irq_ignore_spurious)

+                       dev_warn(regmap_get_device(st->map),

+                                "spurious interrupt with status 0x%x\n",

+                                int_status);

                 goto end_session;

         }

 

-- 

2.20.1




  reply	other threads:[~2020-01-06  9:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-04 16:44 [PATCH] iio: imu/mpu6050: support dual-edge IRQ Michał Mirosław
2020-01-06  9:42 ` Jean-Baptiste Maneyrol [this message]
2020-01-06 11:17   ` [PATCH v2] " Michał Mirosław
2020-01-06 16:13     ` Jean-Baptiste Maneyrol
2020-01-11 12:10     ` Jonathan Cameron
2020-01-11 15:07       ` Michał Mirosław
2020-01-13 22:15         ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MN2PR12MB33737F067F25B2F7477C4FE5C43C0@MN2PR12MB3373.namprd12.prod.outlook.com \
    --to=jmaneyrol@invensense.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).