Commit a231b88c authored by Alexander Stein's avatar Alexander Stein Committed by Linus Walleij

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: default avatarAlexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 9c0b04bc
...@@ -935,11 +935,14 @@ static int mcp23s08_probe(struct spi_device *spi) ...@@ -935,11 +935,14 @@ static int mcp23s08_probe(struct spi_device *spi)
return -ENOMEM; return -ENOMEM;
spi_set_drvdata(spi, data); 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++) { for (addr = 0; addr < ARRAY_SIZE(pdata->chip); addr++) {
if (!(spi_present_mask & (1 << addr))) if (!(spi_present_mask & (1 << addr)))
continue; continue;
chips--; chips--;
data->mcp[addr] = &data->chip[chips]; data->mcp[addr] = &data->chip[chips];
data->mcp[addr]->irq = spi->irq;
status = mcp23s08_probe_one(data->mcp[addr], &spi->dev, spi, status = mcp23s08_probe_one(data->mcp[addr], &spi->dev, spi,
0x40 | (addr << 1), type, pdata, 0x40 | (addr << 1), type, pdata,
addr); addr);
...@@ -980,6 +983,8 @@ static int mcp23s08_remove(struct spi_device *spi) ...@@ -980,6 +983,8 @@ static int mcp23s08_remove(struct spi_device *spi)
if (!data->mcp[addr]) if (!data->mcp[addr])
continue; continue;
if (spi->irq && data->mcp[addr]->irq_controller)
mcp23s08_irq_teardown(data->mcp[addr]);
gpiochip_remove(&data->mcp[addr]->chip); gpiochip_remove(&data->mcp[addr]->chip);
} }
kfree(data); kfree(data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment