From: Alexander Stein <alexander.stein@systec-electronic.com>
To: Linus Walleij <linus.walleij@linaro.org>,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>
Cc: Alexander Stein <alexander.stein@systec-electronic.com>,
devicetree@vger.kernel.org, linux-gpio@vger.kernel.org
Subject: [PATCH 2/3] gpio: mcp23s08: Add simple IRQ support for SPI devices
Date: Mon, 17 Nov 2014 09:38:10 +0100 [thread overview]
Message-ID: <1416213491-9775-2-git-send-email-alexander.stein@systec-electronic.com> (raw)
In-Reply-To: <1416213491-9775-1-git-send-email-alexander.stein@systec-electronic.com>
Currently this implementation only supports one IRQ for (all) SPI devices
using the same chip select.
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
drivers/gpio/gpio-mcp23s08.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
index 9295b6e..529025e 100644
--- a/drivers/gpio/gpio-mcp23s08.c
+++ b/drivers/gpio/gpio-mcp23s08.c
@@ -935,11 +935,14 @@ static int mcp23s08_probe(struct spi_device *spi)
return -ENOMEM;
spi_set_drvdata(spi, data);
+ spi->irq = irq_of_parse_and_map(spi->dev.of_node, 0);
+
for (addr = 0; addr < ARRAY_SIZE(pdata->chip); addr++) {
if (!(spi_present_mask & (1 << addr)))
continue;
chips--;
data->mcp[addr] = &data->chip[chips];
+ data->mcp[addr]->irq = spi->irq;
status = mcp23s08_probe_one(data->mcp[addr], &spi->dev, spi,
0x40 | (addr << 1), type, pdata,
addr);
@@ -980,6 +983,8 @@ static int mcp23s08_remove(struct spi_device *spi)
if (!data->mcp[addr])
continue;
+ if (spi->irq && data->mcp[addr]->irq_controller)
+ mcp23s08_irq_teardown(data->mcp[addr]);
gpiochip_remove(&data->mcp[addr]->chip);
}
kfree(data);
--
2.0.4
next prev parent reply other threads:[~2014-11-17 8:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-17 8:38 [PATCH 1/3] gpio: mcp23s08: request a shared interrupt Alexander Stein
2014-11-17 8:38 ` Alexander Stein [this message]
2014-11-27 13:52 ` [PATCH 2/3] gpio: mcp23s08: Add simple IRQ support for SPI devices Linus Walleij
2014-11-17 8:38 ` [PATCH 3/3] gpio: mcp23s08: Add option to configure IRQ as active high Alexander Stein
2014-11-27 13:58 ` Linus Walleij
2014-11-27 14:36 ` Alexander Stein
2014-11-28 15:39 ` Linus Walleij
2014-11-27 13:51 ` [PATCH 1/3] gpio: mcp23s08: request a shared interrupt Linus Walleij
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=1416213491-9775-2-git-send-email-alexander.stein@systec-electronic.com \
--to=alexander.stein@systec-electronic.com \
--cc=devicetree@vger.kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=pawel.moll@arm.com \
--cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).