From: Stephen Warren <swarren@nvidia.com>
To: Rob Herring <robherring2@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Liam Girdwood <lrg@ti.com>, Chris Ball <cjb@laptop.org>,
"ccross@android.com" <ccross@android.com>,
"olof@lixom.net" <olof@lixom.net>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: RE: [PATCH 1/3] irq: If an IRQ is a GPIO, request and configure it
Date: Thu, 4 Aug 2011 21:05:01 -0700 [thread overview]
Message-ID: <74CDBE0F657A3D45AFBB94109FB122FF049F171EC4@HQMAIL01.nvidia.com> (raw)
In-Reply-To: <4E3B4D73.9030505@gmail.com>
Rob Herring wrote at Thursday, August 04, 2011 7:55 PM:
> On 08/04/2011 06:00 PM, Stephen Warren wrote:
> > Many IRQs are associated with GPIO pins. When the pin is used as an IRQ,
> > it can't be used as anything else; it should be requested. Enhance the
> > core interrupt code to call gpio_request() and gpio_direction_input() for
> > any IRQ that is also a GPIO. This prevents duplication of these calls in
> > each driver that uses an IRQ.
...
> > diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
...
> > @@ -978,6 +979,16 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
> > old = *old_ptr;
> > } while (old);
> > shared = 1;
> > + } else {
> > + gpio = irq_to_gpio(irq);
>
> If you read the documentation for gpio, it is not recommended to use
> irq_to_gpio. There's only a handful of users. Part of the problem is it
> is platform specific and the gpio core cannot convert irq to gpio
> number
It seems like that's a soluble problem though?
I was thinking about adding a to_gpio function to struct irq_chip, as
the inverse of struct gpio_chip's to_irq. Then, presumably any platform
would be able to convert back from IRQ to GPIO, provided the platform
called a new __irq_to_gpio from the platform-specific gpio_to_irq, just
like most gpio_to_irq implementations defer to __gpio_to_irq.
I ended up not doing that in this patchset, since Tegra's gpio_to_irq
function already works for the IRQs/GPIOs that were relevant for my
testing, and I wanted to post a simple patch first to driver discussion.
> Here is the relevant section:
>
> Non-error values returned from irq_to_gpio() would most commonly be used
> with gpio_get_value(), for example to initialize or update driver state
> when the IRQ is edge-triggered. Note that some platforms don't support
> this reverse mapping, so you should avoid using it.
--
nvpublic
next prev parent reply other threads:[~2011-08-05 4:05 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-04 23:00 [RFC PATCH 0/3] " Stephen Warren
2011-08-04 23:00 ` [PATCH 1/3] irq: " Stephen Warren
2011-08-05 0:01 ` Mark Brown
2011-08-05 3:53 ` Stephen Warren
2011-08-05 5:35 ` Mark Brown
2011-08-05 8:06 ` Ben Dooks
2011-08-05 8:29 ` Mark Brown
2011-08-05 15:29 ` Stephen Warren
2011-08-05 16:15 ` Mark Brown
2011-08-05 1:54 ` Rob Herring
2011-08-05 4:05 ` Stephen Warren [this message]
2011-08-05 7:58 ` Ben Dooks
2011-09-02 8:36 ` Thomas Gleixner
2011-09-02 15:24 ` Stephen Warren
2011-09-02 15:34 ` Stephen Warren
2011-09-02 15:50 ` Thomas Gleixner
2011-08-04 23:00 ` [PATCH 2/3] mmc: tegra: Don't gpio_request GPIOs used as IRQs Stephen Warren
2011-08-04 23:00 ` [PATCH 3/3] ASoC: jack_add_gpios: " Stephen Warren
2011-08-05 7:55 ` [RFC PATCH 0/3] If an IRQ is a GPIO, request and configure it Ben Dooks
2011-08-05 9:40 ` Russell King - ARM Linux
2011-08-05 10:30 ` Ben Dooks
2011-08-05 20:25 ` Linus Walleij
2011-08-05 15:43 ` Stephen Warren
2011-08-05 19:15 ` Russell King - ARM Linux
2011-08-05 19:33 ` Stephen Warren
2011-08-05 21:40 ` Russell King - ARM Linux
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=74CDBE0F657A3D45AFBB94109FB122FF049F171EC4@HQMAIL01.nvidia.com \
--to=swarren@nvidia.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=ccross@android.com \
--cc=cjb@laptop.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=lrg@ti.com \
--cc=olof@lixom.net \
--cc=robherring2@gmail.com \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®