From: Grant Likely <grant.likely@linaro.org>
Cc: jgchunter@gmail.com, Santosh Shilimkar <santosh.shilimkar@ti.com>,
Kevin Hilman <khilman@linaro.org>,
Linus Walleij <linus.walleij@linaro.org>,
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>,
eballetbo@gmail.com, thomas.petazzoni@free-electrons.com,
linux-omap@vger.kernel.org,
Florian Vaussard <florian.vaussard@epfl.ch>,
Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Subject: Re: [PATCH v2 2/2] gpio/omap: auto request GPIO as input if used as IRQ via DT
Date: Mon, 24 Jun 2013 13:55:12 +0100 [thread overview]
Message-ID: <20130624125512.0C5283E0A89@localhost> (raw)
In-Reply-To: <1371855054-27958-3-git-send-email-javier.martinez@collabora.co.uk>
On Sat, 22 Jun 2013 00:50:54 +0200, Javier Martinez Canillas <javier.martinez@collabora.co.uk> wrote:
> When an OMAP GPIO is used as an IRQ line, a call to gpio_request()
> has to be made to initialize the OMAP GPIO bank before a driver
> request the IRQ. Otherwise the call to request_irq() fails.
>
> Drives should not be aware of this neither care wether an IRQ line
> is a GPIO or not. They should just request the IRQ and this has to
> be handled by the irq_chip driver.
>
> With the current OMAP GPIO DT binding, if we define:
>
> gpio6: gpio@49058000 {
> compatible = "ti,omap3-gpio";
> reg = <0x49058000 0x200>;
> interrupts = <34>;
> ti,hwmods = "gpio6";
> gpio-controller;
> #gpio-cells = <2>;
> interrupt-controller;
> #interrupt-cells = <2>;
> };
>
> interrupt-parent = <&gpio6>;
> interrupts = <16 8>;
>
> The GPIO is correctly mapped as an IRQ but a call to gpio_request()
> is never made. Since a call to the custom IRQ domain .map function
> handler is made for each GPIO used as an IRQ, the GPIO can be setup
> and configured as input there automatically.
>
> Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> ---
>
> Changes since v1:
> - Split the irq domain mapping function handler and the GPIO
> request in two different patches.
>
> drivers/gpio/gpio-omap.c | 9 +++++++++
> 1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index 31cbe65..5ec6a00 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -1092,6 +1092,8 @@ static int omap_gpio_irq_map(struct irq_domain *d, unsigned int virq,
> irq_hw_number_t hwirq)
> {
> struct gpio_bank *bank = d->host_data;
> + int gpio;
> + int ret;
>
> if (!bank)
> return -EINVAL;
> @@ -1106,6 +1108,13 @@ static int omap_gpio_irq_map(struct irq_domain *d, unsigned int virq,
> handle_simple_irq);
> set_irq_flags(virq, IRQF_VALID);
> }
> +
> + gpio = irq_to_gpio(bank, hwirq);
> + ret = gpio_request_one(gpio, GPIOF_IN, NULL);
> + if (ret) {
> + dev_err(bank->dev, "Could not request GPIO%d\n", gpio);
> + return ret;
> + }
Following from my comment on patch 1, this is the only bit that you'd
want to be conditional on the presence of a DT, not the whole block.
g.
next prev parent reply other threads:[~2013-06-24 12:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <[PATCH v2 0/2]: auto request GPIO as input if used as IRQ via DT>
2013-06-21 22:50 ` (unknown), Javier Martinez Canillas
2013-06-21 22:50 ` [PATCH v2 1/2] gpio/omap: don't create an IRQ mapping for every GPIO on DT Javier Martinez Canillas
2013-06-24 12:53 ` Grant Likely
2013-06-21 22:50 ` [PATCH v2 2/2] gpio/omap: auto request GPIO as input if used as IRQ via DT Javier Martinez Canillas
2013-06-24 12:55 ` Grant Likely [this message]
2013-06-24 13:58 ` Javier Martinez Canillas
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=20130624125512.0C5283E0A89@localhost \
--to=grant.likely@linaro.org \
--cc=eballetbo@gmail.com \
--cc=florian.vaussard@epfl.ch \
--cc=javier.martinez@collabora.co.uk \
--cc=jgchunter@gmail.com \
--cc=khilman@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-omap@vger.kernel.org \
--cc=plagnioj@jcrosoft.com \
--cc=santosh.shilimkar@ti.com \
--cc=thomas.petazzoni@free-electrons.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.