diff options
author | Lars Poeschel <poeschel@lemonage.de> | 2014-01-16 05:44:15 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-01-17 09:30:14 -0500 |
commit | 4e47f91bf741e011a90ceb6241b8d78141709733 (patch) | |
tree | 1febf3cbbf59a1202dc5d944d392ce28b6b851fe /Documentation | |
parent | 785acec3eecf4c21bab9e24afb5d354b57a72e03 (diff) |
gpio: mcp23s08: Add irq functionality for i2c chips
This adds interrupt functionality for i2c chips to the driver.
They can act as a interrupt-controller and generate interrupts, if
the inputs change.
This is tested with a mcp23017 chip on an arm based platform.
v3:
- be a bit more clear that the irq functionality is also available
on spi versions of the chips, but the linux driver does not support
this yet
v2:
- some more word about irq-mirror property in binding doc
- use of_read_bool instead of of_find_property for
"interrupt-contrller" and "irq-mirror"
- cache the "interrupt-controller" for remove function
- do set the irq-mirror bit only if device is marked as
interrupt-controller
- do create the irq mapping and setup of irq_desc of all possible
interrupts in probe path instead of in gpio_to_irq
- mark gpios as in use as interrupts in irq in irq_startup and
unlock it in irq_shutdown
- rename virq to child_irq
- remove dev argument from mcp23s08_irq_setup function
- move gpiochip_add before mcp23s08_irq_setup in probe path
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt b/Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt index daa30174bcc1..3ddc7ccfe5f3 100644 --- a/Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt +++ b/Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt | |||
@@ -38,12 +38,38 @@ Required device specific properties (only for SPI chips): | |||
38 | removed. | 38 | removed. |
39 | - spi-max-frequency = The maximum frequency this chip is able to handle | 39 | - spi-max-frequency = The maximum frequency this chip is able to handle |
40 | 40 | ||
41 | Example I2C: | 41 | Optional properties: |
42 | - #interrupt-cells : Should be two. | ||
43 | - first cell is the pin number | ||
44 | - second cell is used to specify flags. | ||
45 | - interrupt-controller: Marks the device node as a interrupt controller. | ||
46 | NOTE: The interrupt functionality is only supported for i2c versions of the | ||
47 | chips. The spi chips can also do the interrupts, but this is not supported by | ||
48 | the linux driver yet. | ||
49 | |||
50 | Optional device specific properties: | ||
51 | - microchip,irq-mirror: Sets the mirror flag in the IOCON register. Devices | ||
52 | with two interrupt outputs (these are the devices ending with 17 and | ||
53 | those that have 16 IOs) have two IO banks: IO 0-7 form bank 1 and | ||
54 | IO 8-15 are bank 2. These chips have two different interrupt outputs: | ||
55 | One for bank 1 and another for bank 2. If irq-mirror is set, both | ||
56 | interrupts are generated regardless of the bank that an input change | ||
57 | occured on. If it is not set, the interrupt are only generated for the | ||
58 | bank they belong to. | ||
59 | On devices with only one interrupt output this property is useless. | ||
60 | |||
61 | Example I2C (with interrupt): | ||
42 | gpiom1: gpio@20 { | 62 | gpiom1: gpio@20 { |
43 | compatible = "microchip,mcp23017"; | 63 | compatible = "microchip,mcp23017"; |
44 | gpio-controller; | 64 | gpio-controller; |
45 | #gpio-cells = <2>; | 65 | #gpio-cells = <2>; |
46 | reg = <0x20>; | 66 | reg = <0x20>; |
67 | |||
68 | interrupt-parent = <&gpio1>; | ||
69 | interrupts = <17 IRQ_TYPE_LEVEL_LOW>; | ||
70 | interrupt-controller; | ||
71 | #interrupt-cells=<2>; | ||
72 | microchip,irq-mirror; | ||
47 | }; | 73 | }; |
48 | 74 | ||
49 | Example SPI: | 75 | Example SPI: |