summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-mcp23s08.c
diff options
context:
space:
mode:
authorAlexander Stein <alexander.stein@systec-electronic.com>2014-11-17 09:38:10 +0100
committerLinus Walleij <linus.walleij@linaro.org>2014-11-27 15:01:20 +0100
commita231b88cfc3df120d3882c0be9499970af87f305 (patch)
treea3e8ae80f92cd3b52d59f451842db2db72322db0 /drivers/gpio/gpio-mcp23s08.c
parentgpio: mcp23s08: request a shared interrupt (diff)
downloadlinux-a231b88cfc3df120d3882c0be9499970af87f305.tar.xz
linux-a231b88cfc3df120d3882c0be9499970af87f305.zip
gpio: mcp23s08: Add simple IRQ support for SPI devices
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> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-mcp23s08.c')
-rw-r--r--drivers/gpio/gpio-mcp23s08.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
index 6589438dad57..0d58440eb8da 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);