[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <74CDBE0F657A3D45AFBB94109FB122FF049F171EC4@HQMAIL01.nvidia.com>
Date: Thu, 4 Aug 2011 21:05:01 -0700
From: Stephen Warren <swarren@...dia.com>
To: Rob Herring <robherring2@...il.com>
CC: Thomas Gleixner <tglx@...utronix.de>,
Mark Brown <broonie@...nsource.wolfsonmicro.com>,
Liam Girdwood <lrg@...com>, Chris Ball <cjb@...top.org>,
"ccross@...roid.com" <ccross@...roid.com>,
"olof@...om.net" <olof@...om.net>,
"alsa-devel@...a-project.org" <alsa-devel@...a-project.org>,
"linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-tegra@...r.kernel.org" <linux-tegra@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>
Subject: RE: [PATCH 1/3] irq: If an IRQ is a GPIO, request and configure it
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists