[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6e1fe1015235ae7d7eb9ef2526fd64b6d6d628d7.camel@gmail.com>
Date: Mon, 06 Mar 2023 14:32:18 +0100
From: Nuno Sá <noname.nuno@...il.com>
To: Masahiro Honda <honda@...hatrax.com>,
Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Jonathan Cameron <jic23@...nel.org>
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Fix IRQ issue by setting IRQ_DISABLE_UNLAZY flag
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@...hatrax.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á
Powered by blists - more mailing lists