From: "Nuno Sá" <noname.nuno@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
David Lechner <dlechner@baylibre.com>,
Dumitru Ceclan <dumitru.ceclan@analog.com>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Nuno Sa <nuno.sa@analog.com>, Rob Herring <robh@kernel.org>,
devicetree@vger.kernel.org, linux-iio@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Russell King <linux@armlinux.org.uk>
Subject: Re: [PATCH v2 3/4] iio: adc: ad_sigma_delta: Add support for reading irq status using a GPIO
Date: Mon, 04 Nov 2024 14:15:49 +0100 [thread overview]
Message-ID: <2760d1a59114d0eec79405c56253aa82268ecba7.camel@gmail.com> (raw)
In-Reply-To: <xka5svqs3jbjiqcz6bacih7hjqzjbrugutjii6qusdbqoxfrp5@5hcv3htsjtlp>
On Mon, 2024-11-04 at 13:49 +0100, Uwe Kleine-König wrote:
> Hello,
>
> [adding rmk to Cc as the docs state that he invented lazy disabling]
>
> On Thu, Oct 31, 2024 at 01:05:21PM +0100, Nuno Sá wrote:
> > On Thu, 2024-10-31 at 11:40 +0100, Uwe Kleine-König wrote:
> > > On Wed, Oct 30, 2024 at 08:44:29PM +0000, Jonathan Cameron wrote:
> > > > On Wed, 30 Oct 2024 14:04:58 +0100
> > > > Nuno Sá <noname.nuno@gmail.com> wrote:
> > > > > Regarding this, I do share some of the concerns already raised by Jonathan.
> > > > > I fear
> > > > > that we're papering around an issue with the IRQ controller rather than
> > > > > being an
> > > > > issue with the device. When I look at irq_disable() docs [1], it feels that
> > > > > we're
> > > > > already doing what we're supposed to do. IOW, we disable the lazy approach
> > > > > so we
> > > > > *should* not get any pending IRQ.
> > >
> > > I think this is wrong and you always have to be prepared to see an irq
> > > triggering that became pending while masked.
>
> I did some research, here are my findings:
>
> https://www.kernel.org/doc/html/v6.12-rc6/core-api/genericirq.html#delayed-interrupt-disable
> reads:
>
> The interrupt is kept enabled and is masked in the flow handler
> when an interrupt event happens. This prevents losing edge
> interrupts on hardware which does not store an edge interrupt
> event while the interrupt is disabled at the hardware level.
>
> This suggests that lazy disabling is needed for some controllers that
> stop their event detection when disabled. I read that as: *Normally* an
> irq event gets pending in hardware while the irq is disabled.
I might be wrong, but I think that the lazy approach is the one for optimization. I
think the reasoning is that __normally__ no more IRQs will come so no need to access
the HW. But also thinking more on the subject and looking at what the lazy approach
is doing, I take back what I said in previous emails. I *think* the expectation for a
received IRQ while the line is masked (or disabled?!), is to keep it as pending (both
on HW - when possible - and in SW).
>
> The lazy disable approach is expected to work fine always, the reason to
> implement non-lazy disabling is "only" a performance optimisation. See
> commit e9849777d0e27cdd2902805be51da73e7c79578c.
Not sure If I understood you correctly, but I think is the other way around?
Also, as said in the commit, I think it also prevents the same interrupt from
happening twice (in some cases).
>
> With the DOUT/̅R̅D̅Y pin the ad7124 (and others) is in this "Unfortunately
> there are devices which do not allow the interrupt to be disabled easily
> at the device level." class.
>
> However that makes me wonder what is the difference between the
> irq_mask() and irq_disable() callbacks defined in struct irq_chip.
Wondering the same...
Thanks for digging into this. This has been a long standing thing with sigma delta
ADCs (I'm fairly sure this discussion about being an issue on the IRQ controller or
not already happened before).
- Nuno Sá
next prev parent reply other threads:[~2024-11-04 13:15 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-28 16:07 [PATCH v2 0/4] iio: adc: ad7124: Make it work on de10-nano Uwe Kleine-König
2024-10-28 16:07 ` [PATCH v2 1/4] dt-bindings: iio: adc: adi,ad7124: Use symbolic name for interrupt flag Uwe Kleine-König
2024-10-29 7:36 ` Krzysztof Kozlowski
2024-10-28 16:07 ` [PATCH v2 2/4] dt-bindings: iio: adc: adi,ad7124: Allow specifications of a gpio for irq line Uwe Kleine-König
2024-11-01 19:20 ` Rob Herring
2024-10-28 16:07 ` [PATCH v2 3/4] iio: adc: ad_sigma_delta: Add support for reading irq status using a GPIO Uwe Kleine-König
2024-10-30 13:04 ` Nuno Sá
2024-10-30 20:44 ` Jonathan Cameron
2024-10-31 10:40 ` Uwe Kleine-König
2024-10-31 12:05 ` Nuno Sá
2024-10-31 12:28 ` Nuno Sá
2024-11-04 12:49 ` Uwe Kleine-König
2024-11-04 13:15 ` Nuno Sá [this message]
2024-11-05 9:20 ` Uwe Kleine-König
2024-11-05 10:30 ` Nuno Sá
2024-10-28 16:07 ` [PATCH v2 4/4] iio: adc: ad7124: Disable all channels at probe time Uwe Kleine-König
2024-10-30 7:17 ` Nuno Sá
2024-10-28 16:38 ` [PATCH v2 0/4] iio: adc: ad7124: Make it work on de10-nano David Lechner
2024-11-18 18:12 ` Uwe Kleine-König
2024-11-23 14:24 ` 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=2760d1a59114d0eec79405c56253aa82268ecba7.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=dumitru.ceclan@analog.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
--cc=tglx@linutronix.de \
--cc=u.kleine-koenig@baylibre.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