diff options
author | Alexander Stein <alexander.stein@systec-electronic.com> | 2014-11-17 03:38:10 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-11-27 09:01:20 -0500 |
commit | a231b88cfc3df120d3882c0be9499970af87f305 (patch) | |
tree | a3e8ae80f92cd3b52d59f451842db2db72322db0 /drivers/gpio/gpio-mcp23s08.c | |
parent | 9c0b04bcb3abc8e5dc0731b9b9eabd4a217960c0 (diff) |
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.c | 5 |
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) | |||
935 | return -ENOMEM; | 935 | return -ENOMEM; |
936 | spi_set_drvdata(spi, data); | 936 | spi_set_drvdata(spi, data); |
937 | 937 | ||
938 | spi->irq = irq_of_parse_and_map(spi->dev.of_node, 0); | ||
939 | |||
938 | for (addr = 0; addr < ARRAY_SIZE(pdata->chip); addr++) { | 940 | for (addr = 0; addr < ARRAY_SIZE(pdata->chip); addr++) { |
939 | if (!(spi_present_mask & (1 << addr))) | 941 | if (!(spi_present_mask & (1 << addr))) |
940 | continue; | 942 | continue; |
941 | chips--; | 943 | chips--; |
942 | data->mcp[addr] = &data->chip[chips]; | 944 | data->mcp[addr] = &data->chip[chips]; |
945 | data->mcp[addr]->irq = spi->irq; | ||
943 | status = mcp23s08_probe_one(data->mcp[addr], &spi->dev, spi, | 946 | status = mcp23s08_probe_one(data->mcp[addr], &spi->dev, spi, |
944 | 0x40 | (addr << 1), type, pdata, | 947 | 0x40 | (addr << 1), type, pdata, |
945 | addr); | 948 | addr); |
@@ -980,6 +983,8 @@ static int mcp23s08_remove(struct spi_device *spi) | |||
980 | if (!data->mcp[addr]) | 983 | if (!data->mcp[addr]) |
981 | continue; | 984 | continue; |
982 | 985 | ||
986 | if (spi->irq && data->mcp[addr]->irq_controller) | ||
987 | mcp23s08_irq_teardown(data->mcp[addr]); | ||
983 | gpiochip_remove(&data->mcp[addr]->chip); | 988 | gpiochip_remove(&data->mcp[addr]->chip); |
984 | } | 989 | } |
985 | kfree(data); | 990 | kfree(data); |