From: "Uwe Kleine-König" <Uwe.Kleine-Koenig@digi.com>
To: David Brownell <dbrownell@users.sourceforge.net>
Cc: <linux-kernel@vger.kernel.org>
Subject: configure gpio for interrupt function
Date: Tue, 27 May 2008 15:02:36 +0200 [thread overview]
Message-ID: <20080527130236.GA18546@digi.com> (raw)
Hello David,
I want to use a driver that in turn uses the gpio API (i.e.
drivers/input/keyboard/gpio_keys.c). My problem with that is, that my
machine[1]'s external irqs don't fit into the GPIO API model. The main
problem is that gpio_direction_input isn't enough to get an irq.
I need to explicitly set the gpio to an EXT_IRQ function.
(I can workaround that because the EXT_IRQ function allows to read the
state of the gpio. So I can use the EXT_IRQ function if input is
requested.)
Another problem is that I cannot implement irq_to_gpio correctly,
because several gpio's share the same irq.
(Note this makes the workaround above less reliable. Consider two
gpios sharing the same irq. I cannot assert that only one of them can
trigger the interrupt.)
So I suggest to extend the gpio API with two functions like:
int gpio_direction_inputirq(unsigned gpio, unsigned flags);
void gpio_ackirq(unsigned gpio);
with flags being similar to the IRQF_TRIGGER_* defines in
include/linux/interrupt.h. I need gpio_ackirq because ns9xxx requires
that an edge triggered irq is acknowledged separatly in the "External
Interrupt X Control register"[2]. (If you have better names ...)
Moreover this makes the API more flexible because the irq type can be
configured.
OTOH I'd like to deprecate irq_to_gpio. $(git grep -l irq_to_gpio
drivers) suggests that this function is only used in two places. One of
them[3] is AT91 specific, the other[4] seems specific for the
RouterBoard 532.
(There are some other users below arch/, but I expect no breakage here.
I expect that every arch that uses the function have it implemented
anyhow.)
What do you think?
Best regards
Uwe
[1] http://www.digi.com/products/embeddedsolutions/ns9215.jsp
Interesting sections are "Pinout -> General purpose I/O (GPIO)" and
"I/O Control Module". E.g. GPIO4's func1 is "Ext Int Ch 2"
[2] System Control Module -> External Interrupt 03 Control register
[3] drivers/mmc/host/at91_mci.c
[4] drivers/ata/pata_rb532_cf.c
--
Uwe Kleine-König, Software Engineer
Digi International GmbH Branch Breisach, Küferstrasse 8, 79206 Breisach, Germany
Tax: 315/5781/0242 / VAT: DE153662976 / Reg. Amtsgericht Dortmund HRB 13962
next reply other threads:[~2008-05-27 13:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-27 13:02 Uwe Kleine-König [this message]
2008-05-27 20:49 ` configure gpio for interrupt function David Brownell
2008-05-28 7:17 ` Uwe Kleine-König
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=20080527130236.GA18546@digi.com \
--to=uwe.kleine-koenig@digi.com \
--cc=dbrownell@users.sourceforge.net \
--cc=linux-kernel@vger.kernel.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