From: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: Devicetree Discuss
<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>,
Mark Brown
<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
Subject: Re: Configurable interrupt sources, and DT bindings
Date: Wed, 30 Nov 2011 07:41:35 -0600 [thread overview]
Message-ID: <4ED6328F.80100@gmail.com> (raw)
In-Reply-To: <74CDBE0F657A3D45AFBB94109FB122FF174FDAFD60-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
On 11/29/2011 08:24 PM, Stephen Warren wrote:
> Rob Herring wrote at Monday, November 28, 2011 4:24 PM:
>> On 11/28/2011 04:29 PM, Stephen Warren wrote:
>>> Many interrupt sinks support various of active high/low, rising/falling
>>> edge. This can already be configured by setting #interrupt-cells
>>> appropriately, and defining an interrupt-controller-specific binding for
>>> the additional cells.
>>>
>>> At least some interrupt sources have similar configurability in HW. An
>>> example is the WM8903 audio codec, which can generate both active high
>>> and active low interrupt signals.
>>>
>>> One possibility is to describe this directly in the binding for each
>>> interrupt source....
> ...
>>> However, given that interrupt sinks already know which signaling methods
>>> they support, and may be configured to accept a specific method per
>>> interrupt input using extra interrupt cells, perhaps the solution isn't
>>> to create a binding that the interrupt sink parses in isolation, but
>>> rather to create a new API within the kernel where the interrupt source
>>> can query the interrupt sink for a list of supported signaling methods,
>>> and pick one that it also supports, and use it. This list could be
>>> restricted based on the interrupts property's extra cells.
>>>
>>> What are people's thoughts here; should we go down this
>>> auto-configuration route, or just explicitly configure interrupt sources
>>> using a binding other than the interrupts property?
>>>
>>> Related, having this negotiation followed by a request_irq() passing the
>>> flags back to the sink seems a little redundant, but I suppose if the
>>> sink is configurable and unconstrained, this is necessary.
>>
>> I think adding another property is the wrong approach. The information
>> is already there in the interrupt binding. irq_create_of_mapping almost
>> does what you need. Perhaps it could be extended to return the type as
>> part of the irq resource. There are already defined resource bits for this:
>>
>> /* PnP IRQ specific bits (IORESOURCE_BITS) */
>> #define IORESOURCE_IRQ_HIGHEDGE (1<<0)
>> #define IORESOURCE_IRQ_LOWEDGE (1<<1)
>> #define IORESOURCE_IRQ_HIGHLEVEL (1<<2)
>> #define IORESOURCE_IRQ_LOWLEVEL (1<<3)
>>
>> It may be a bit problematic to change irq_create_of_mapping as Sparc has
>> a different version.
>
> Taking a look at the code, I think it can work like this:
>
> * Except for SPARC, irq_of_parse_and_map() calls irq_create_of_mapping(),
> which calls the IRQ chip's dt_translate() function which can return the
> type from the interrupt specifier in DT, and if it did, the type is
> passed to irq_set_irq_type().
>
> * SPARC's custom irq_of_parse_and_map() doesn't call irq_set_irq_type()
> as far as I can tell. I think we can just ignore this for now; if SPARC
> wants to participate in this scheme, its custom irq_of_parse_and_map()
> could be enhanced appropriately.
>
> * I assert that all IRQ chips that want to participate must define an
> interrupt specifier DT binding that defines the trigger type; e.g.
> that implemented by using irq_domain_add_simple() and #interrupt-cells
> greater than 1.
>
> * I assert that all IRQ chips that want to participate must call
> irqd_set_trigger_type() from their irq_set_type op. This will cache the
> type for later access. This call is missing from Tegra's GPIO interrupt
> controller, but can easily be added.
>
> * Create a new function that drivers can call on their Linux interrupt ID,
> which internally calls irqd_get_trigger_type(). This will return the
> configured type, and they can adjust their interrupt output pin
> appropriately, or fail to probe if they can't support the selected type.
>
> * We can probably remove any platform data fields that configure a device's
> interrupt output type (e.g. WM8903 has an irq_active_low field in pdata)
> and replace it with this scheme. If that won't work, we can have drivers
> call the new API only when instantiated from DT, so they continue to
> work unchanged in the non-DT case.
>
> Does that sound like a reasonable solution? If so, I can start hooking this
> together.
Sounds good to me.
Rob
next prev parent reply other threads:[~2011-11-30 13:41 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-28 22:29 Configurable interrupt sources, and DT bindings Stephen Warren
[not found] ` <4ED40B5F.6030603-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-11-28 22:47 ` Mark Brown
2011-11-28 23:23 ` Rob Herring
[not found] ` <4ED417F2.1030900-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-11-29 11:20 ` Mark Brown
2011-11-30 2:24 ` Stephen Warren
[not found] ` <74CDBE0F657A3D45AFBB94109FB122FF174FDAFD60-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-11-30 5:31 ` David Gibson
2011-11-30 13:41 ` Rob Herring [this message]
2011-11-29 1:30 ` David Gibson
[not found] ` <20111129013055.GH3508-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2011-11-29 10:55 ` Mark Brown
[not found] ` <20111129105538.GC2851-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-11-30 5:13 ` David Gibson
[not found] ` <20111130051349.GG5435-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2011-11-30 9:33 ` Mark Brown
[not found] ` <20111130093305.GB2791-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-11-30 13:31 ` David Gibson
[not found] ` <20111130133140.GL5435-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2011-12-01 11:07 ` Mark Brown
[not found] ` <20111201110738.GA2915-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-12-02 5:38 ` David Gibson
[not found] ` <20111202053814.GH5427-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2011-12-02 11:27 ` Mark Brown
[not found] ` <20111202112722.GG8245-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-12-02 12:24 ` David Gibson
[not found] ` <20111202122418.GI5427-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2011-12-02 13:34 ` Mark Brown
[not found] ` <20111202133413.GR8245-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-12-02 14:31 ` David Gibson
[not found] ` <20111202143107.GJ5427-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2011-12-02 14:55 ` Mark Brown
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=4ED6328F.80100@gmail.com \
--to=robherring2-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=swarren-DDmLM1+adcrQT0dZR+AlfA@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).