From: jjhiblot@traphandler.com (Jean-Jacques Hiblot)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] at91: gpio: use gpiolib API to mark a GPIO used as an IRQ
Date: Wed, 22 Jan 2014 13:39:00 +0100 [thread overview]
Message-ID: <1390394341-12548-1-git-send-email-jjhiblot@traphandler.com> (raw)
When an IRQ is started on a GPIO line, mark this GPIO as IRQ in
the gpiolib so we can keep track of the usage centrally.
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
---
arch/arm/mach-at91/gpio.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index a5afcf7..6176b4b 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -577,8 +577,32 @@ static int alt_gpio_irq_type(struct irq_data *d, unsigned type)
return 0;
}
+static unsigned int gpio_irq_startup(struct irq_data *d)
+{
+ struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d);
+ unsigned pin = d->hwirq;
+ int ret;
+
+ ret = gpio_lock_as_irq(&at91_gpio->chip, pin);
+ if (ret) {
+ dev_err(at91_gpio->chip.dev, "unable to lock pind %lu IRQ\n",
+ d->hwirq);
+ return ret;
+ }
+ return 0;
+}
+static void gpio_irq_shutdown(struct irq_data *d)
+{
+ struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d);
+ unsigned pin = d->hwirq;
+
+ gpio_unlock_as_irq(&at91_gpio->chip, pin);
+}
+
static struct irq_chip gpio_irqchip = {
.name = "GPIO",
+ .irq_shutdown = gpio_irq_shutdown,
+ .irq_startup = gpio_irq_startup,
.irq_disable = gpio_irq_mask,
.irq_mask = gpio_irq_mask,
.irq_unmask = gpio_irq_unmask,
--
1.8.5.2
next reply other threads:[~2014-01-22 12:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-22 12:39 Jean-Jacques Hiblot [this message]
2014-01-22 12:39 ` [PATCH 2/2] at91: pinctrl: use gpiolib API to mark a GPIO used as an IRQ Jean-Jacques Hiblot
2014-01-22 12:49 ` Gregory CLEMENT
2014-01-22 12:47 ` [PATCH 1/2] at91: gpio: " Gregory CLEMENT
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=1390394341-12548-1-git-send-email-jjhiblot@traphandler.com \
--to=jjhiblot@traphandler.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