From: Philipp Zabel <p.zabel@pengutronix.de>
To: Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] regmap: irq: Acknowledge also interrupts that are masked
Date: Mon, 22 Jul 2013 13:11:14 +0200 [thread overview]
Message-ID: <1374491474.4355.12.camel@pizza.hi.pengutronix.de> (raw)
In-Reply-To: <20130722100856.GQ9858@sirena.org.uk>
Hi Mark,
Am Montag, den 22.07.2013, 11:08 +0100 schrieb Mark Brown:
> On Mon, Jul 22, 2013 at 11:24:52AM +0200, Philipp Zabel wrote:
> > In case the hardware interrupt mask register does not prevent the chip level
> > irq from being asserted by the corresponding interrupt status bit, stray
> > masked interrupts should to be acknowledged, too.
>
> > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> > ---
> > I have seen GPI interrupts trigger on DA9063 trigger after being masked during
> > initialization, and once the status bits are set, the interrupt handler routine
> > never clears them, which keeps the chip irq line asserted forever.
>
> This can't be the standard behaviour since it breaks expectations as to
> what happens for masked interrupts. Though based on your description of
> the problem it sounds like a quirk to ack interrupts immediately after
> masking them might do the trick instead of the full on always ack
> behaviour.
thanks, this seems to work, too:
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 1643e88..4c99ed8 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -418,6 +418,24 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
reg, ret);
goto err_alloc;
}
+
+ /* Ack masked but set interrupts */
+ reg = chip->status_base +
+ (i * map->reg_stride * d->irq_reg_stride);
+ ret = regmap_read(map, reg, &d->status_buf[i]);
+ if (ret != 0) {
+ dev_err(map->dev, "Failed to read IRQ status: %d\n",
+ ret);
+ goto err_alloc;
+ }
+
+ reg = chip->ack_base +
+ (i * map->reg_stride * d->irq_reg_stride);
+ ret = regmap_write(map, reg, d->status_buf[i] & d->mask_buf[i]);
+ if (ret != 0) {
+ dev_err(map->dev, "Failed to ack 0x%x: %d\n", reg, ret);
+ goto err_alloc;
+ }
}
/* Wake is disabled by default */
--
1.8.3.2
Can something like this be done unconditionally, or should I add a quirk
flag to regmap_irq_chip?
regards
Philipp
next prev parent reply other threads:[~2013-07-22 11:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-22 9:24 Philipp Zabel
2013-07-22 10:08 ` Mark Brown
2013-07-22 11:11 ` Philipp Zabel [this message]
2013-07-22 13:30 ` Mark Brown
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=1374491474.4355.12.camel@pizza.hi.pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=broonie@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®