All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>
Cc: Lorenzo Bianconi
	<lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	lorenzo.bianconi-qxv4g6HH51o@public.gmane.org,
	Linus Walleij
	<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
	Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
Subject: Re: [PATCH 5/9] iio: humidity: hts221: support active-low interrupts
Date: Tue, 11 Jul 2017 19:52:59 +0100	[thread overview]
Message-ID: <20170711195259.3f146762@kernel.org> (raw)
In-Reply-To: <ceef5860-91ee-a922-0dd7-8f2698192b9b-5wv7dgnIgG8@public.gmane.org>

On Mon, 10 Jul 2017 10:36:47 +0100
Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org> wrote:

> Hi Jonathan,
> 
> On 09/07/17 19:39, Jonathan Cameron wrote:
> > On Sun,  9 Jul 2017 18:57:00 +0200
> > Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >   
> >> Add support for active low interrupts (IRQF_TRIGGER_LOW and
> >> IRQF_TRIGGER_FALLING). Configure the device as active high or low
> >> according to the requested irq line.
> >>
> >> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>  
> > Hi Lorenzo,
> > 
> > Sorry, you are getting caught up in a more general question I'd like to 
> > pin down an answer for...
> > 
> > What should we be doing if we have a part that supports both high and
> > low interrupts and/or rising and falling?
> > 
> > We actually have more than one possible thing we are configuring with
> > one parameter.  If we are looking at shared interrupts or level
> > converters it's more than possible we have an inversion going on between
> > the two.   How is this represented to the two ends?
> > 
> > What's the right way of doing this?
> > 
> > I've added a few CCs that I think might chip in on this question!
> > 
> > My personal gut feeling is that the inverter should have explicit
> > representation in the kernel.  We should be able to instantiate an
> > irq_chip which is responsible for flipping it's sense.
> > 
> > You request an active high input on one side and it deals with
> > the active low that needs to be requested upstream.
> > 
> > Chances are I'm missing something and this is already well handled!  
> 
> We already have things like that, such as
> drivers/irqchip/irq-mtk-sysirq.c (whose sole purpose in life is to
> invert interrupt polarity).
> 
> Hope this helps,
> 
> 	M.
Thanks Marc,

I think it would need generalising a fair bit, but in principle that
is doing exactly what is needed (just run with generic irq_chip
callbacks except for irq_set_type).

The registration logic seems rather convoluted, but I haven't yet
dug into why it is like that.  Certainly seems like we should be
able to get away with something rather less involved by not
trying to do it quite so efficiently.  For this particular
case I think we'd probably instantiate an irq chip per inverted
irq (there is no connection between them really).

Now the tricky bit as ever is going to be getting the bindings right.
The ones for the example you give are somewhat device specific.

Jonathan

WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <jic23@kernel.org>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	lorenzo.bianconi@st.com, Linus Walleij <linus.walleij@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>
Subject: Re: [PATCH 5/9] iio: humidity: hts221: support active-low interrupts
Date: Tue, 11 Jul 2017 19:52:59 +0100	[thread overview]
Message-ID: <20170711195259.3f146762@kernel.org> (raw)
In-Reply-To: <ceef5860-91ee-a922-0dd7-8f2698192b9b@arm.com>

On Mon, 10 Jul 2017 10:36:47 +0100
Marc Zyngier <marc.zyngier@arm.com> wrote:

> Hi Jonathan,
> 
> On 09/07/17 19:39, Jonathan Cameron wrote:
> > On Sun,  9 Jul 2017 18:57:00 +0200
> > Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
> >   
> >> Add support for active low interrupts (IRQF_TRIGGER_LOW and
> >> IRQF_TRIGGER_FALLING). Configure the device as active high or low
> >> according to the requested irq line.
> >>
> >> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>  
> > Hi Lorenzo,
> > 
> > Sorry, you are getting caught up in a more general question I'd like to 
> > pin down an answer for...
> > 
> > What should we be doing if we have a part that supports both high and
> > low interrupts and/or rising and falling?
> > 
> > We actually have more than one possible thing we are configuring with
> > one parameter.  If we are looking at shared interrupts or level
> > converters it's more than possible we have an inversion going on between
> > the two.   How is this represented to the two ends?
> > 
> > What's the right way of doing this?
> > 
> > I've added a few CCs that I think might chip in on this question!
> > 
> > My personal gut feeling is that the inverter should have explicit
> > representation in the kernel.  We should be able to instantiate an
> > irq_chip which is responsible for flipping it's sense.
> > 
> > You request an active high input on one side and it deals with
> > the active low that needs to be requested upstream.
> > 
> > Chances are I'm missing something and this is already well handled!  
> 
> We already have things like that, such as
> drivers/irqchip/irq-mtk-sysirq.c (whose sole purpose in life is to
> invert interrupt polarity).
> 
> Hope this helps,
> 
> 	M.
Thanks Marc,

I think it would need generalising a fair bit, but in principle that
is doing exactly what is needed (just run with generic irq_chip
callbacks except for irq_set_type).

The registration logic seems rather convoluted, but I haven't yet
dug into why it is like that.  Certainly seems like we should be
able to get away with something rather less involved by not
trying to do it quite so efficiently.  For this particular
case I think we'd probably instantiate an irq chip per inverted
irq (there is no connection between them really).

Now the tricky bit as ever is going to be getting the bindings right.
The ones for the example you give are somewhat device specific.

Jonathan



  parent reply	other threads:[~2017-07-11 18:52 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-09 16:56 [PATCH 0/9] hts221: add new features and fix power-off procedure Lorenzo Bianconi
2017-07-09 16:56 ` Lorenzo Bianconi
     [not found] ` <20170709165704.26311-1-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-09 16:56   ` [PATCH 1/9] iio: humidity: hts221: refactor write_with_mask code Lorenzo Bianconi
2017-07-09 16:56     ` Lorenzo Bianconi
     [not found]     ` <20170709165704.26311-2-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-09 18:28       ` Jonathan Cameron
2017-07-09 18:28         ` Jonathan Cameron
     [not found]         ` <20170709192827.2c343108-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-07-09 21:18           ` Lorenzo Bianconi
2017-07-09 21:18             ` Lorenzo Bianconi
     [not found]             ` <CAA2SeNJmUFp7WaOsAEq+yLMSKrzQVkhmyMhB2OVWsbBAmv4nCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-07-10 20:47               ` Jonathan Cameron
2017-07-10 20:47                 ` Jonathan Cameron
2017-07-09 16:56   ` [PATCH 2/9] iio: humidity: hts221: move BDU configuration in probe routine Lorenzo Bianconi
2017-07-09 16:56     ` Lorenzo Bianconi
     [not found]     ` <20170709165704.26311-3-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-09 18:29       ` Jonathan Cameron
2017-07-09 18:29         ` Jonathan Cameron
2017-07-09 16:56   ` [PATCH 3/9] iio: humidity: hts221: do not overwrite reserved data during power-down Lorenzo Bianconi
2017-07-09 16:56     ` Lorenzo Bianconi
     [not found]     ` <20170709165704.26311-4-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-09 18:30       ` Jonathan Cameron
2017-07-09 18:30         ` Jonathan Cameron
     [not found]         ` <20170709193042.330fcd60-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-07-09 21:26           ` Lorenzo Bianconi
2017-07-09 21:26             ` Lorenzo Bianconi
2017-07-09 16:56   ` [PATCH 4/9] iio: humidity: hts221: avoid useless ODR reconfiguration Lorenzo Bianconi
2017-07-09 16:56     ` Lorenzo Bianconi
     [not found]     ` <20170709165704.26311-5-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-09 18:32       ` Jonathan Cameron
2017-07-09 18:32         ` Jonathan Cameron
     [not found]         ` <20170709193208.6864b158-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-07-09 21:27           ` Lorenzo Bianconi
2017-07-09 21:27             ` Lorenzo Bianconi
2017-07-09 16:57   ` [PATCH 5/9] iio: humidity: hts221: support active-low interrupts Lorenzo Bianconi
2017-07-09 16:57     ` Lorenzo Bianconi
     [not found]     ` <20170709165704.26311-6-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-09 18:39       ` Jonathan Cameron
2017-07-09 18:39         ` Jonathan Cameron
     [not found]         ` <20170709193951.14caff79-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-07-10  9:36           ` Marc Zyngier
2017-07-10  9:36             ` Marc Zyngier
     [not found]             ` <ceef5860-91ee-a922-0dd7-8f2698192b9b-5wv7dgnIgG8@public.gmane.org>
2017-07-11 18:52               ` Jonathan Cameron [this message]
2017-07-11 18:52                 ` Jonathan Cameron
2017-07-09 16:57   ` [PATCH 6/9] dt-bindings: " Lorenzo Bianconi
2017-07-09 16:57     ` Lorenzo Bianconi
     [not found]     ` <20170709165704.26311-7-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-11  2:49       ` Rob Herring
2017-07-11  2:49         ` Rob Herring
2017-07-09 16:57   ` [PATCH 7/9] iio: humidity: hts221: support open drain mode Lorenzo Bianconi
2017-07-09 16:57     ` Lorenzo Bianconi
2017-07-09 16:57   ` [PATCH 8/9] dt-bindings: " Lorenzo Bianconi
2017-07-09 16:57     ` Lorenzo Bianconi
     [not found]     ` <20170709165704.26311-9-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-11  2:51       ` Rob Herring
2017-07-11  2:51         ` Rob Herring
2017-07-11 18:26         ` Jonathan Cameron
2017-07-11 18:26           ` Jonathan Cameron
     [not found]           ` <20170711192656.7fd08a1c-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-07-11 18:42             ` Rob Herring
2017-07-11 18:42               ` Rob Herring
     [not found]               ` <CAL_JsqJa7JeofpG=66AnVrTP4XtVrp9B4-QoLTyK08GzF4L5uQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-07-11 18:56                 ` Jonathan Cameron
2017-07-11 18:56                   ` Jonathan Cameron
     [not found]                   ` <0462CB71-6762-48F2-99B3-EA62FF81C280-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO@public.gmane.org>
2017-07-15 14:32                     ` Lorenzo Bianconi
2017-07-15 14:32                       ` Lorenzo Bianconi
     [not found]                       ` <CAA2SeN+2T2-G1khRNpNzccesX=cip0ConT11RJRV-HB8Ojk0pA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-07-17 11:49                         ` Jonathan Cameron
2017-07-17 11:49                           ` Jonathan Cameron
2017-07-09 16:57   ` [PATCH 9/9] iio: humidity: hts221: move drdy enable logic in hts221_trig_set_state() Lorenzo Bianconi
2017-07-09 16:57     ` Lorenzo Bianconi
     [not found]     ` <20170709165704.26311-10-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-07-09 18:41       ` Jonathan Cameron
2017-07-09 18:41         ` Jonathan Cameron
     [not found]         ` <20170709194123.39fd6914-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-07-09 21:28           ` Lorenzo Bianconi
2017-07-09 21:28             ` Lorenzo Bianconi
     [not found]             ` <CAA2SeNLhBbTbMGDHyXGN02V4n0RHrwK-Bg0D_q9phpcEa3e7Rw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-07-16  9:45               ` Lorenzo Bianconi
2017-07-16  9:45                 ` Lorenzo Bianconi
     [not found]                 ` <CAA2SeNK6dd=myMk59j1To9GtvBaj1T8XXwcaqrtO8V5s-bM5WQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-07-16 19:50                   ` Jonathan Cameron
2017-07-16 19:50                     ` 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=20170711195259.3f146762@kernel.org \
    --to=jic23-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lorenzo.bianconi-qxv4g6HH51o@public.gmane.org \
    --cc=lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=marc.zyngier-5wv7dgnIgG8@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.