Skip to contentSkip to conversation

ads7846: pin change interrupt support

PATCH New [email protected] 1 participant 1 message Jun 10, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/5 ads7846: pin change interrupt support

From: Michael Roth <[email protected]>

Some SoC supports only pin change interrupts on GPIO pins used as irq lines.

The ads7846 core is not affected from the additional irqs on the rising edge because the code accounts touch bounce anyway by kicking in a timer and disabling the irq after the first request and reenabling the irq after a timeout when there is no longer pen down detected.

---

 drivers/input/touchscreen/ads7846.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/input/touchscreen/ads7846.c renamed from drivers/input/touchscreen/ads7846.c~ads7846-pin-change-interrupt-support +9 -3
diff -puN drivers/input/touchscreen/ads7846.c~ads7846-pin-change-interrupt-support drivers/input/touchscreen/ads7846.c
@@ -1150,9 +1150,15 @@ static int __devinit ads7846_probe(struc
 
 	if (request_irq(spi->irq, ads7846_irq, IRQF_TRIGGER_FALLING,
 			spi->dev.driver->name, ts)) {
-		dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq);
-		err = -EBUSY;
-		goto err_free_gpio;
+		dev_info(&spi->dev,
+			"trying pin change workaround on irq %d\n", spi->irq);
+		if (request_irq(spi->irq, ads7846_irq,
+				IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
+				spi->dev.driver->name, ts)) {
+			dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq);
+			err = -EBUSY;
+			goto err_free_gpio;
+		}
 	}
 
 	err = ads784x_hwmon_register(spi, ts);

_