Skip to content

Commit

Permalink
gpio: mcp23s08: Add simple IRQ support for SPI devices
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexander Stein authored and Linus Walleij committed Nov 27, 2014
1 parent 9c0b04b commit a231b88
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/gpio/gpio-mcp23s08.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit a231b88

Please sign in to comment.