linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: How to create IRQ mappings in a GPIO driver that doesn't control its IRQ domain ?
Date: Thu, 25 Jul 2013 11:45:33 +0200	[thread overview]
Message-ID: <1408178.cxAUTUGJc5@avalon> (raw)
In-Reply-To: <CACRpkdazPX3EbVbLvXQZh0oRBpHoWPK+EkFO75v9zfAXSPCkHA@mail.gmail.com>

Hi Linus,

Thank you for your answer.

On Thursday 25 July 2013 11:20:54 Linus Walleij wrote:
> On Wed, Jul 24, 2013 at 1:21 AM, Laurent Pinchart wrote:
> > Has anyone run into a similar issue ? My gut feeling is that the
> > architecture isn't right somewhere, but I can't really pinpoint where.
> 
> We had a similar situation with the MFDs, where Mark, Lee and Sam came up
> with the solution to include an irqdomain in the MFD cell spawn function:
> 
> extern int mfd_add_devices(struct device *parent, int id,
>                            struct mfd_cell *cells, int n_devs,
>                            struct resource *mem_base,
>                            int irq_base, struct irq_domain *irq_domain);
> 
> When each cell (i.e. a platform device) is created, the irq for that cell
> will be translated with irq_create_mapping() so the cell/platform device
> just get a Linux IRQ it can use and do not need to worry about translating
> it.
> 
> Prior to this we had all sorts of exported translator functions for the IRQs
> exported from each hub driver ---what a mess.
> 
> Can you think about a parent/child relationship making it possible to pass
> the irqs readily translated in this case?

The two devices are independent, so there's no real parent/child relationship. 
However, as Grant proposed, I could list all the interrupts associated with 
GPIOs in the GPIO controller DT node. I would then just call 
irq_of_parse_and_map() in the .to_irq() handler to magically translate the 
GPIO number to a mapped IRQ number.

The number of interrupts can be pretty high (up to 58 in the worst case so 
far), so an alternative would be to specify the interrupt-parent only, and 
call irq_create_of_mapping() directly. What solution would you prefer ?

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2013-07-25  9:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23 23:21 How to create IRQ mappings in a GPIO driver that doesn't control its IRQ domain ? Laurent Pinchart
2013-07-24 20:24 ` Grant Likely
2013-07-25  9:42   ` Laurent Pinchart
2013-07-25  9:20 ` Linus Walleij
2013-07-25  9:45   ` Laurent Pinchart [this message]
2013-07-25 13:15     ` Mark Brown
2013-07-25 13:21       ` Linus Walleij
2013-07-25 13:53         ` Mark Brown
2013-07-25 13:22       ` Laurent Pinchart
2013-07-25 13:55         ` Mark Brown
2013-07-28  5:00         ` Grant Likely
2013-07-31 11:14           ` Laurent Pinchart
2013-07-25 13:19     ` Linus Walleij
2013-07-28 10:07 ` Tomasz Figa
2013-07-31 11:11   ` Laurent Pinchart
2013-07-31 11:29     ` Tomasz Figa

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=1408178.cxAUTUGJc5@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.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).