From: Linus Walleij <linus.walleij@linaro.org>
To: Lars Poeschel <larsi@wh2.tu-dresden.de>
Cc: Lars Poeschel <poeschel@lemonage.de>,
Rob Herring <rob.herring@calxeda.com>,
Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
"ijc+devicetree@hellion.org.uk" <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>, Rob Landley <rob@landley.net>,
Alexandre Courbot <gnurou@gmail.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH] gpio: mcp23s08: Add irq functionality for i2c chips
Date: Tue, 7 Jan 2014 19:50:47 +0100 [thread overview]
Message-ID: <CACRpkdYqLamX6P=0he2Swy=_io2u6SKjGHPNziMdDj2j+UR+Uw@mail.gmail.com> (raw)
In-Reply-To: <1389103548-23458-1-git-send-email-larsi@wh2.tu-dresden.de>
On Tue, Jan 7, 2014 at 3:05 PM, Lars Poeschel <larsi@wh2.tu-dresden.de> wrote:
> From: Lars Poeschel <poeschel@lemonage.de>
>
> This adds interrupt functionality for i2c chips to the driver.
> They can act as a interrupt-controller and generate interrupts, if
> the inputs change.
> This is tested on a mcp23017 chip.
>
> Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
(...)
> u8 addr;
>
> u16 cache[11];
> + u16 irq_rise;
> + u16 irq_fall;
> + int irq;
> /* lock protects the cached values */
> struct mutex lock;
> + struct mutex irq_lock;
> + struct irq_domain *irq_domain;
(...)
> +static int mcp23s08_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
> +{
> + struct mcp23s08 *mcp = container_of(chip, struct mcp23s08, chip);
> +
> + return irq_create_mapping(mcp->irq_domain, offset);
We have recently established that the mapping shall not be created in
gpio_to_irq().
Instead call irq_create_mapping() for all valid IRQ lines in probe() and
use irq_find_mapping() here.
> +static struct irq_chip mcp23s08_irq_chip = {
> + .name = "gpio-mcp23xxx",
> + .irq_mask = mcp23s08_irq_mask,
> + .irq_unmask = mcp23s08_irq_unmask,
> + .irq_set_type = mcp23s08_irq_set_type,
> + .irq_bus_lock = mcp23s08_irq_bus_lock,
> + .irq_bus_sync_unlock = mcp23s08_irq_bus_unlock,
> +};
Add irq_startup() and irq_shutdown() hooks in accordance with something
like this patch:
http://marc.info/?l=linux-gpio&m=138571851304612&w=2
The important thing is that you call
gpio_lock_as_irq()/gpio_unlock_as_irq()
Yours,
Linus Walleij
prev parent reply other threads:[~2014-01-07 18:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-07 14:05 [PATCH] gpio: mcp23s08: Add irq functionality for i2c chips Lars Poeschel
2014-01-07 16:00 ` Mark Rutland
2014-01-07 18:50 ` Linus Walleij [this message]
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='CACRpkdYqLamX6P=0he2Swy=_io2u6SKjGHPNziMdDj2j+UR+Uw@mail.gmail.com' \
--to=linus.walleij@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=gnurou@gmail.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=larsi@wh2.tu-dresden.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=poeschel@lemonage.de \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
/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;
as well as URLs for NNTP newsgroup(s).