linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
To: Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>
Cc: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
	Linus Walleij
	<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Jassi Brar
	<jaswinder.singh-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
	Masami Hiramatsu
	<mhiramat-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	David Daney <david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>,
	Linux Kernel Mailing List
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH v4 2/6] irqdomain: clear trigger type in irq_domain_push_irq()
Date: Sat, 9 Sep 2017 00:09:35 +0900	[thread overview]
Message-ID: <CAK7LNARed8aubiOERk_oJSWr_ZFMSdkVuDnZGCgn8Jc2kUA_KA@mail.gmail.com> (raw)
In-Reply-To: <a3e38f20-007b-1065-7999-95e2264f2155-5wv7dgnIgG8@public.gmane.org>

Hi Marc,


2017-09-07 21:25 GMT+09:00 Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>:
> On 07/09/17 12:41, Masahiro Yamada wrote:
>> Prior to the addition of irq_domain_push_irq(), the hierarchy
>> IRQ domain always allocates IRQs from the outer-most domain.
>> Each irqchip usually calls irq_domain_alloc_irqs_parent(),
>> ascending the topology up to the root irqchip.
>>
>> The brand-new function irq_domain_push_irq() allows us to allocate
>> IRQs for parent domain first, then add a child irq_data to the
>> tail of the chain.
>>
>> For the new use-case, if the parent sets a temporary trigger type,
>> it may differ from the type requested to the outer-most irqchip,
>> then irq_create_fwspec_mapping() warns "type mismatch, failed to map..."
>>
>> Clear the trigger type when a new irq_data is connected to the chain.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
>> ---
>>
>> Changes in v4:
>>   - Newly added
>>
>>
>>  kernel/irq/irqdomain.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
>> index da3e0b6..18d11b9 100644
>> --- a/kernel/irq/irqdomain.c
>> +++ b/kernel/irq/irqdomain.c
>> @@ -1532,6 +1532,9 @@ int irq_domain_push_irq(struct irq_domain *domain, int virq, void *arg)
>>       tail_irq_data->chip = NULL;
>>       tail_irq_data->chip_data = NULL;
>>
>> +     /* clear the trigger type to avoid "type mismatch" error */
>> +     irqd_set_trigger_type(tail_irq_data, IRQ_TYPE_NONE);
>> +
>
> This feels wrong. The initial interrupt hierarchy does have a set
> trigger, because it has been configured already, and switching it to
> NONE is hiding the fact that you're setting it to another, conflicting
> value.
>
> Your new fwspec should have a type that is really compatible with with
> the underlying interrupt, however "temporary". If it is not, you have a
> problem.
>


My motivation is to describe interrupt connection by
DT property, like follows:

interrupts = <48 4>, <49 4>, <50 4>, <51 4>,
        <52 4>, <53 4>, <54 4>, <55 4>,
        <56 4>, <57 4>, <58 4>, <59 4>,
        <60 4>, <61 4>, <62 4>, <63 4>,
        <154 4>, <155 4>, <156 4>, <157 4>,
        <158 4>;


The number of cells is fixed, so I need to
give something as the second parameter.

The "4" may not be a real trigger type,
it is just a temporal value to fill the space.


The device may pass a different trigger type
when it calls gpio_to_irq() && request_irq().
I cannot know the real trigger type until the device is probed.


Having said that, if this is a bad idea,
I will consider a different approach for my GPIO driver.


-- 
Best Regards
Masahiro Yamada
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-09-08 15:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-07 11:41 [PATCH v4 0/6] irqdomain, gpio: expand irq_domain_push_irq() for DT use and use it for GPIO Masahiro Yamada
2017-09-07 11:41 ` [PATCH v4 1/6] irqdomain: rename variables in irq_domain_{push,pop}_irq() Masahiro Yamada
2017-09-07 12:47   ` Marc Zyngier
2017-09-07 17:45     ` David Daney
2017-09-08 15:05       ` Masahiro Yamada
2017-09-07 11:41 ` [PATCH v4 3/6] irqdomain: move IRQ_DOMAIN_NAME_ALLOCATED define to the original position Masahiro Yamada
2017-09-07 12:04   ` Marc Zyngier
2017-09-08 15:10     ` Masahiro Yamada
     [not found] ` <1504784522-26841-1-git-send-email-yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
2017-09-07 11:41   ` [PATCH v4 2/6] irqdomain: clear trigger type in irq_domain_push_irq() Masahiro Yamada
2017-09-07 12:25     ` Marc Zyngier
     [not found]       ` <a3e38f20-007b-1065-7999-95e2264f2155-5wv7dgnIgG8@public.gmane.org>
2017-09-08 15:09         ` Masahiro Yamada [this message]
2017-09-07 11:42   ` [PATCH v4 4/6] irqdomain: set irq domain flags before the irq domain becomes visible Masahiro Yamada
2017-09-07 11:42 ` [PATCH v4 5/6] irqdomain: add IRQ_DOMAIN_FLAG_NO_CREATE flag Masahiro Yamada
2017-09-07 11:42 ` [PATCH v4 6/6] gpio: uniphier: add UniPhier GPIO controller driver Masahiro Yamada
     [not found]   ` <1504784522-26841-7-git-send-email-yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
2017-09-07 19:41     ` Rob Herring
     [not found]       ` <CAL_Jsq+Da1=myQGEpA_0f+dEU0Rk6RB3BJHVCzq0M0MyJ3UDoQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-09-08 15:14         ` Masahiro Yamada
2017-09-11 20:15           ` Rob Herring
2017-09-10 12:13   ` kbuild test robot
2017-09-12 14:03   ` Linus Walleij
2017-09-12 15:44     ` David Daney
     [not found]       ` <7e46f2a3-114f-0c34-d3c5-49e6422b9200-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2017-09-13  8:31         ` Masahiro Yamada
2017-09-07 12:39 ` [PATCH v4 0/6] irqdomain, gpio: expand irq_domain_push_irq() for DT use and use it for GPIO Marc Zyngier
2017-09-08 15:06   ` Masahiro Yamada

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=CAK7LNARed8aubiOERk_oJSWr_ZFMSdkVuDnZGCgn8Jc2kUA_KA@mail.gmail.com \
    --to=yamada.masahiro-uwylwvc0a2jby3ivrkzq2a@public.gmane.org \
    --cc=david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
    --cc=jaswinder.singh-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=marc.zyngier-5wv7dgnIgG8@public.gmane.org \
    --cc=mhiramat-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@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 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).