From: "Nuno Sá" <noname.nuno@gmail.com>
To: Masahiro Honda <honda@mechatrax.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix IRQ issue by setting IRQ_DISABLE_UNLAZY flag
Date: Mon, 06 Mar 2023 14:32:18 +0100 [thread overview]
Message-ID: <6e1fe1015235ae7d7eb9ef2526fd64b6d6d628d7.camel@gmail.com> (raw)
In-Reply-To: <20230306044737.862-1-honda@mechatrax.com>
On Mon, 2023-03-06 at 13:47 +0900, Masahiro Honda wrote:
> ADC using ad7793.ko, such as AD7794, may read incorrect data.
> Extra interrupt is pending if the data on DOUT contains a falling
> edge.
> Therefore, wait_for_completion_timeout returns immediately.
> This patch fixes the issue by setting IRQ_DISABLE_UNLAZY flag.
>
> Signed-off-by: Masahiro Honda <honda@mechatrax.com>
> ---
> drivers/iio/adc/ad_sigma_delta.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/iio/adc/ad_sigma_delta.c
> b/drivers/iio/adc/ad_sigma_delta.c
> index d8570f620..364051809 100644
> --- a/drivers/iio/adc/ad_sigma_delta.c
> +++ b/drivers/iio/adc/ad_sigma_delta.c
> @@ -584,6 +584,7 @@ static int devm_ad_sd_probe_trigger(struct device
> *dev, struct iio_dev *indio_de
> init_completion(&sigma_delta->completion);
>
> sigma_delta->irq_dis = true;
> + irq_set_status_flags(sigma_delta->spi->irq,
> IRQ_DISABLE_UNLAZY);
Hmmm this looks to be a very likely issue for any device having to
brute force IRQ disabling by disabling the line (disable_irq()). That
said, I think the commit message can (needs) to be improved. The
message feels a bit confusing to me. Also, having a reference to
commit e9849777d0e2 ("genirq: Add flag to force mask in
disable_irq[_nosync]()")
would be nice to give some background on why this can be an issue.
Another thing that came to my mind is if the data is totally
garbage/wrong or is it just some outstanding sample?
Some research on this also seems to point that we should (need?) call
irq_clear_status_flags(irq, IRQ_DISABLE_UNLAZY) when freeing the IRQ.
I also wonder if we should keep this out of the library and have a per
device config? Sure, this won't make anything wrong but it will hurt
performance. OTOH, even though no one else ever reported this before,
it looks like this can be an issue for all of the supported sigma delta
ADCs.
- Nuno Sá
next prev parent reply other threads:[~2023-03-06 13:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-06 4:47 [PATCH] Fix IRQ issue by setting IRQ_DISABLE_UNLAZY flag Masahiro Honda
2023-03-06 13:32 ` Nuno Sá [this message]
2023-03-07 10:54 ` Masahiro Honda
2023-03-27 9:01 ` Masahiro Honda
2023-03-27 12:28 ` Nuno Sá
2023-03-28 10:55 ` Masahiro Honda
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=6e1fe1015235ae7d7eb9ef2526fd64b6d6d628d7.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=honda@mechatrax.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox