Skip to contentSkip to conversation

mfd: stmpe: add OF support for irq-over-gpio

PATCH In review Sean Cross 2 participants 2 messages Aug 19, 2014 – Aug 29, 2014

Subsystems (3)
lore
Share & tools
lore

Sean Cross

author
#0 lore raw

PATCH 1/1 mfd: stmpe: add OF support for irq-over-gpio

When using the STMPE610 or STMPE811 as a platform device, the platform data struct allows for irq_over_gpio to be set. This patch allows for using a GPIO as an IRQ source when using device tree by specifying an irq-gpio property.

---
 Documentation/devicetree/bindings/mfd/stmpe.txt | 1 +
 drivers/mfd/stmpe.c                             | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/mfd/stmpe.txt +1 -0
index 56edb55..3fb68bf 100644
@@ -13,6 +13,7 @@ Optional properties:
  - interrupt-parent             : Specifies which IRQ controller we're connected to
  - wakeup-source                : Marks the input device as wakable
  - st,autosleep-timeout         : Valid entries (ms); 4, 16, 32, 64, 128, 256, 512 and 1024
+ - irq-gpio                     : If present, which GPIO to use for event IRQ
 
 Example:
 
drivers/mfd/stmpe.c +6 -1
index 3b6bfa7..4c42b05 100644
@@ -1122,7 +1122,12 @@ static void stmpe_of_probe(struct stmpe_platform_data *pdata,
 	if (pdata->id < 0)
 		pdata->id = -1;
 
-	pdata->irq_trigger = IRQF_TRIGGER_NONE;
+	pdata->irq_gpio = of_get_named_gpio_flags(np, "irq-gpio", 0,
+				&pdata->irq_trigger);
+	if (gpio_is_valid(pdata->irq_gpio))
+		pdata->irq_over_gpio = 1;
+	else
+		pdata->irq_trigger = IRQF_TRIGGER_NONE;
 
 	of_property_read_u32(np, "st,autosleep-timeout",
 			&pdata->autosleep_timeout);
Signature · 1 line
2.0.0
#1 lore raw
Quoted 10 lines · Sean Cross

When using the STMPE610 or STMPE811 as a platform device, the platform data struct allows for irq_over_gpio to be set. This patch allows for using a GPIO as an IRQ source when using device tree by specifying an irq-gpio property.

---
 Documentation/devicetree/bindings/mfd/stmpe.txt | 1 +
 drivers/mfd/stmpe.c                             | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

See: Documentation/devicetree/bindings/submitting-patches.txt

- You need to break this up into two patches
- You need to CC the DT folks.

Quoted 30 lines
Documentation/devicetree/bindings/mfd/stmpe.txt +1 -0
index 56edb55..3fb68bf 100644
@@ -13,6 +13,7 @@ Optional properties:
  - interrupt-parent             : Specifies which IRQ controller we're connected to
  - wakeup-source                : Marks the input device as wakable
  - st,autosleep-timeout         : Valid entries (ms); 4, 16, 32, 64, 128, 256, 512 and 1024
+ - irq-gpio                     : If present, which GPIO to use for event IRQ
 
 Example:
 
drivers/mfd/stmpe.c +6 -1
index 3b6bfa7..4c42b05 100644
@@ -1122,7 +1122,12 @@ static void stmpe_of_probe(struct stmpe_platform_data *pdata,
 	if (pdata->id < 0)
 		pdata->id = -1;
 
-	pdata->irq_trigger = IRQF_TRIGGER_NONE;
+	pdata->irq_gpio = of_get_named_gpio_flags(np, "irq-gpio", 0,
+				&pdata->irq_trigger);
+	if (gpio_is_valid(pdata->irq_gpio))
+		pdata->irq_over_gpio = 1;
+	else
+		pdata->irq_trigger = IRQF_TRIGGER_NONE;
 
 	of_property_read_u32(np, "st,autosleep-timeout",
 			&pdata->autosleep_timeout);
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog