From: Tomasz Kazimierz Motyl <tomasz.motyl666@gmail.com>
To: linus.walleij@linaro.org, bgolaszewski@baylibre.com,
linux-gpio@vger.kernel.org
Cc: butterfly_tm666@yahoo.com, Tomasz Kazimierz Motyl <tomasz.motyl@se.com>
Subject: [PATCH] Record interrupt status when an IRQ is masked
Date: Sat, 20 Jul 2019 04:31:55 -0700 [thread overview]
Message-ID: <20190720113155.12276-1-tomasz.motyl@se.com> (raw)
When one changes the state of any input pins of a PCA9555 chip before
setting up the IRQ mask through i.e. SysFS e.g. echo "both" >
/sys/class/gpio/gpioXYZ/edge the epoll_wait shall not exit on the subsequent
change of the GPIO state. The reason behind it is that the IRQ status is not
being saved when the IRQ is masked.
---
drivers/gpio/gpio-pca953x.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 7e76830b3368..088bef902156 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -716,13 +716,16 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, u8 *pending)
trigger[i] = (cur_stat[i] ^ old_stat[i]) & chip->irq_mask[i];
if (trigger[i])
trigger_seen = true;
+
+ /* We want the current status recorded in the chip->irq stat regardless the
+ * chip->irq_mask setting in order to have a change detected when the interrupt
+ * mask gets changed i.e. echo "both" > /sys/class/gpioXYZ/edge */
+ chip->irq_stat[i] = cur_stat[i];
}
if (!trigger_seen)
return false;
- memcpy(chip->irq_stat, cur_stat, NBANK(chip));
-
for (i = 0; i < NBANK(chip); i++) {
pending[i] = (old_stat[i] & chip->irq_trig_fall[i]) |
(cur_stat[i] & chip->irq_trig_raise[i]);
--
2.17.1
next reply other threads:[~2019-07-20 11:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-20 11:31 Tomasz Kazimierz Motyl [this message]
2019-07-20 19:42 ` [PATCH] Record interrupt status when an IRQ is masked Linus Walleij
2019-10-18 9:18 ` Andy Shevchenko
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=20190720113155.12276-1-tomasz.motyl@se.com \
--to=tomasz.motyl666@gmail.com \
--cc=bgolaszewski@baylibre.com \
--cc=butterfly_tm666@yahoo.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=tomasz.motyl@se.com \
/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