From: Yannick Brosseau <yannick.brosseau@gmail.com>
To: jic23@kernel.org, lars@metafoo.de, mcoquelin.stm32@gmail.com,
alexandre.torgue@foss.st.com, fabrice.gasnier@foss.st.com,
olivier.moysan@foss.st.com
Cc: paul@crapouillou.net, linux-iio@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Yannick Brosseau <yannick.brosseau@gmail.com>
Subject: [PATCH 2/2] iio: adc: stm32: Fix check for spurious IRQs on STM32F4
Date: Fri, 6 May 2022 18:56:17 -0400 [thread overview]
Message-ID: <20220506225617.1774604-3-yannick.brosseau@gmail.com> (raw)
In-Reply-To: <20220506225617.1774604-1-yannick.brosseau@gmail.com>
The check for spurious IRQs introduced in 695e2f5c289bb assumed that the bits
in the control and status registers are aligned. This is true for the H7 and MP1
version, but not the F4.
Instead of comparing both registers bitwise, we check the bit in the status and control
for each interrupt we are interested in.
Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
---
drivers/iio/adc/stm32-adc.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index a68ecbda6480..5b0f138333ee 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
@@ -1422,9 +1422,10 @@ static irqreturn_t stm32_adc_threaded_isr(int irq, void *data)
return IRQ_HANDLED;
}
- if (!(status & mask))
+ if(!((status & regs->isr_eoc.mask) && (mask & regs->ier_eoc.mask)) ||
+ ((status & regs->isr_ovr.mask) && (mask & regs->ier_ovr.mask)))
dev_err_ratelimited(&indio_dev->dev,
- "Unexpected IRQ: IER=0x%08x, ISR=0x%08x\n",
+ "Unexpected IRQ: CR1/IER=0x%08x, SR/ISR=0x%08x\n",
mask, status);
return IRQ_NONE;
@@ -1438,7 +1439,9 @@ static irqreturn_t stm32_adc_isr(int irq, void *data)
u32 status = stm32_adc_readl(adc, regs->isr_eoc.reg);
u32 mask = stm32_adc_readl(adc, regs->ier_eoc.reg);
- if (!(status & mask))
+ /* Check that we have the interrupt we care about are enabled and active */
+ if(!((status & regs->isr_eoc.mask) && (mask & regs->ier_eoc.mask)) ||
+ ((status & regs->isr_ovr.mask) && (mask & regs->ier_ovr.mask)))
return IRQ_WAKE_THREAD;
if (status & regs->isr_ovr.mask) {
--
2.36.0
next prev parent reply other threads:[~2022-05-06 22:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-06 22:56 [PATCH 0/2] iio: adc: stm32: Fix ADC IRQ handling " Yannick Brosseau
2022-05-06 22:56 ` [PATCH 1/2] iio: adc: stm32: Iterate through all ADCs in irq handler Yannick Brosseau
2022-05-13 13:05 ` Fabrice Gasnier
2022-05-06 22:56 ` Yannick Brosseau [this message]
2022-05-07 14:19 ` [PATCH 2/2] iio: adc: stm32: Fix check for spurious IRQs on STM32F4 Jonathan Cameron
2022-05-13 13:13 ` Fabrice Gasnier
2022-05-06 23:05 ` [PATCH 0/2] iio: adc: stm32: Fix ADC IRQ handling " Paul Cercueil
2022-05-07 13:58 ` 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=20220506225617.1774604-3-yannick.brosseau@gmail.com \
--to=yannick.brosseau@gmail.com \
--cc=alexandre.torgue@foss.st.com \
--cc=fabrice.gasnier@foss.st.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=olivier.moysan@foss.st.com \
--cc=paul@crapouillou.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
all inboxes | Powered by JetHome®