All of lore.kernel.org
 help / color / mirror / Atom feed
From: "André Draszik" <git@andred.net>
To: linux-kernel@vger.kernel.org
Cc: "André Draszik" <git@andred.net>,
	"Anson Huang" <Anson.Huang@nxp.com>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Alessandro Zummo" <a.zummo@towertech.it>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	linux-input@vger.kernel.org
Subject: [PATCH 3/3] Input: snvs_pwrkey - only IRQ_HANDLED for our own events
Date: Thu, 30 Jan 2020 20:45:16 +0000	[thread overview]
Message-ID: <20200130204516.4760-3-git@andred.net> (raw)
In-Reply-To: <20200130204516.4760-1-git@andred.net>

The snvs_pwrkey shares the SNVS LPSR status register with the snvs_rtc.

This driver here should only return IRQ_HANDLED if the status register
indicates that the event we're handling in the irq handler was genuinely
intended for this driver. Otheriwse the interrupt subsystem will
assume the interrupt was handled successfully even though it wasn't
at all.

Signed-off-by: André Draszik <git@andred.net>
Cc: Anson Huang <Anson.Huang@nxp.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: linux-input@vger.kernel.org
---
 drivers/input/keyboard/snvs_pwrkey.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
index c29711d8735c..9f51bcc5b5fd 100644
--- a/drivers/input/keyboard/snvs_pwrkey.c
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -80,7 +80,9 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)
 	pm_wakeup_event(input->dev.parent, 0);
 
 	regmap_read(pdata->snvs, SNVS_LPSR_REG, &lp_status);
-	if (lp_status & SNVS_LPSR_SPO) {
+	lp_status &= SNVS_LPSR_SPO;
+
+	if (lp_status) {
 		if (pdata->minor_rev == 0) {
 			/*
 			 * The first generation i.MX6 SoCs only sends an
@@ -96,15 +98,14 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)
 			mod_timer(&pdata->check_timer,
 			          jiffies + msecs_to_jiffies(DEBOUNCE_TIME));
 		}
-	}
 
-	/* clear SPO status */
-	regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
+		regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
+	}
 
 	if (pdata->clk)
 		clk_disable(pdata->clk);
 
-	return IRQ_HANDLED;
+	return lp_status ? IRQ_HANDLED : IRQ_NONE;
 }
 
 static void imx_snvs_pwrkey_act(void *pdata)
-- 
2.23.0.rc1


  parent reply	other threads:[~2020-01-30 20:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-30 20:45 [PATCH 1/3] ARM: dts: imx7s: add snvs clock to pwrkey André Draszik
2020-01-30 20:45 ` [PATCH 2/3] Input: snvs_pwrkey - enable snvs clock as needed André Draszik
2020-02-07  8:10   ` Horia Geanta
2020-02-09 22:38     ` Dmitry Torokhov
2020-02-10  2:03       ` Robin Gong
2020-02-10  6:33         ` Horia Geanta
2020-02-10 17:55           ` Dmitry Torokhov
2020-02-11  1:54             ` Robin Gong
2020-02-11  9:13               ` André Draszik
2020-02-12  0:58                 ` Robin Gong
2020-01-30 20:45 ` André Draszik [this message]
2020-02-06 18:30 ` [PATCH 1/3] ARM: dts: imx7s: add snvs clock to pwrkey Rob Herring
2020-02-07  7:36 ` Horia Geanta

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=20200130204516.4760-3-git@andred.net \
    --to=git@andred.net \
    --cc=Anson.Huang@nxp.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.