Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: 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
Subject: Re: [PATCH 1/3] dt-bindings: iio: adc: adi,ad7124: Allow specifications of a gpio for irq line
Date: Mon, 28 Oct 2024 18:57:44 +0000	[thread overview]
Message-ID: <20241028185744.3109b300@jic23-huawei> (raw)
In-Reply-To: <e557quqqexisgj423ayhq6wntzx567dikaucckjnduvhvp4esw@bvvg3zcctnox>

On Sun, 27 Oct 2024 22:53:39 +0100
Uwe Kleine-König <u.kleine-koenig@baylibre.com> wrote:

> Hello,
> 
> [dropped Alexandru Tachici from Cc:, the address bounces]
> 
> On Sun, Oct 27, 2024 at 11:54:09AM +0000, Jonathan Cameron wrote:
> > On Thu, 24 Oct 2024 19:17:03 +0200
> > Uwe Kleine-König <u.kleine-koenig@baylibre.com> wrote:
> >   
> > > For the AD7124 chip the logical irq line (̅R̅D̅Y) is physically on the same
> > > pin as the spi MISO output (DOUT) and so reading a register might
> > > trigger an interrupt. For correct operation it's critical that the
> > > actual state of the pin can be read to judge if an interrupt event is a
> > > real one or just a spurious one triggered by toggling the line in its
> > > MISO mode.  
> > 
> > This text should note that this is a limitation with the interrupt controller.
> > The IRQ is disabled when those reads are going on, yet the controller is
> > still detecting the interrupt and reporting it on reenable.
> > I'm not an expert in what the kernel IRQ subsystem requires so maybe
> > this is a valid implementation.  
> 
> This is even the saner option and a controller not triggering might miss
> irqs. Consider the process that triggered a conversion and then calls
> enable_irq() is preempted long enough that the conversion is already
> done when enable_irq() is called. The completion would just time out and
> no measurement reported.

True enough - that race is a possibility, but not all interrupt inputs
are capable of gpio usage whilst setup to received interrupts.

> 
> > > Allow specification of an "interrupt-gpios" property instead of a plain
> > > interrupt. The semantic is that the GPIO's interrupt is to be used as
> > > event source and reading the GPIO can be used to differentiate between a
> > > real event and one triggered by MISO.  
> > 
> > This sort of hack is a bit nasty and if we are going to do it we should
> > allow for double wiring - so to separate GPIO and interrupt pins on the
> > host wired to single pin on the device.
> > 
> > The binding does that by allowing both interrupts and interrupt-gpio
> > but we need to make that explicit in this text. Arguably even when
> > they are the same pin the binding should treat them as independent
> > and the driver should get the gpio from one, and the interrupt from
> > the other.  
> 
> This would also need a code update because currently the interrupt-gpio
> is only used if no interrupt is specified.

Absolutely.  It would require slightly different code.


> 
> > I also definitely need input from Analog Devices folk on this series.  
> 
> Good candidates to comment are still on Cc:
Yeah. I was poking them  :)

> 
> Best regards
> Uwe


  reply	other threads:[~2024-10-28 18:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24 17:17 [PATCH 0/3] iio: adc: ad7124: Make it work on de10-nano Uwe Kleine-König
2024-10-24 17:17 ` [PATCH 1/3] dt-bindings: iio: adc: adi,ad7124: Allow specifications of a gpio for irq line Uwe Kleine-König
2024-10-27 11:54   ` Jonathan Cameron
2024-10-27 21:53     ` Uwe Kleine-König
2024-10-28 18:57       ` Jonathan Cameron [this message]
2024-10-27 20:49   ` Krzysztof Kozlowski
2024-10-27 21:26   ` Rob Herring
2024-10-28  9:51     ` Uwe Kleine-König
2024-10-24 17:17 ` [PATCH 2/3] iio: adc: ad_sigma_delta: Add support for reading irq status using a GPIO Uwe Kleine-König
2024-10-27 12:04   ` Jonathan Cameron
2024-10-24 17:17 ` [PATCH 3/3] iio: adc: ad7124: Disable all channels at probe time Uwe Kleine-König
2024-10-27 11:42   ` Jonathan Cameron
2024-10-27 21:47     ` Uwe Kleine-König

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=20241028185744.3109b300@jic23-huawei \
    --to=jic23@kernel.org \
    --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=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --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