[PATCH] powerpc/5121: pdm360ng: fix touch irq if 8xxx gpio driver is enabled
Anatolij Gustschin
agust at denx.de
Thu Sep 16 06:12:57 EST 2010
Enabling the MPC8xxx GPIO driver with MPC512x GPIO extension
breaks touch screen support on this board since the GPIO
interrupt will be mapped to 8xxx GPIO irq host resulting in
a not requestable interrupt in the touch screen driver. Fix
it by mapping the touch interrupt on 8xxx GPIO irq host.
Signed-off-by: Anatolij Gustschin <agust at denx.de>
---
arch/powerpc/platforms/512x/pdm360ng.c | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/512x/pdm360ng.c b/arch/powerpc/platforms/512x/pdm360ng.c
index 0575e85..558eb9e 100644
--- a/arch/powerpc/platforms/512x/pdm360ng.c
+++ b/arch/powerpc/platforms/512x/pdm360ng.c
@@ -27,6 +27,7 @@
#include <linux/spi/ads7846.h>
#include <linux/spi/spi.h>
#include <linux/notifier.h>
+#include <asm/gpio.h>
static void *pdm360ng_gpio_base;
@@ -50,7 +51,7 @@ static struct ads7846_platform_data pdm360ng_ads7846_pdata = {
.irq_flags = IRQF_TRIGGER_LOW,
};
-static int __init pdm360ng_penirq_init(void)
+static int pdm360ng_penirq_init(void)
{
struct device_node *np;
@@ -73,6 +74,9 @@ static int __init pdm360ng_penirq_init(void)
return 0;
}
+#define GPIO_NR(x) (ARCH_NR_GPIOS - 32 + (x))
+#define PENDOWN_GPIO GPIO_NR(25)
+
static int pdm360ng_touchscreen_notifier_call(struct notifier_block *nb,
unsigned long event, void *__dev)
{
@@ -80,7 +84,24 @@ static int pdm360ng_touchscreen_notifier_call(struct notifier_block *nb,
if ((event == BUS_NOTIFY_ADD_DEVICE) &&
of_device_is_compatible(dev->of_node, "ti,ads7846")) {
+ struct spi_device *spi = to_spi_device(dev);
+ int gpio = PENDOWN_GPIO;
+
dev->platform_data = &pdm360ng_ads7846_pdata;
+ if (pdm360ng_penirq_init())
+ return NOTIFY_DONE;
+
+ if (gpio_request_one(gpio, GPIOF_IN, "ads7845_pen_down") < 0) {
+ pr_err("Failed to request GPIO %d for "
+ "ads7845 pen down IRQ\n", gpio);
+ return NOTIFY_DONE;
+ }
+ spi->irq = gpio_to_irq(gpio);
+ if (spi->irq < 0) {
+ pr_err("Can't map GPIO IRQ\n");
+ gpio_free(gpio);
+ return NOTIFY_DONE;
+ }
return NOTIFY_OK;
}
return NOTIFY_DONE;
@@ -92,9 +113,6 @@ static struct notifier_block pdm360ng_touchscreen_nb = {
static void __init pdm360ng_touchscreen_init(void)
{
- if (pdm360ng_penirq_init())
- return;
-
bus_register_notifier(&spi_bus_type, &pdm360ng_touchscreen_nb);
}
#else
--
1.7.0.4
More information about the Linuxppc-dev
mailing list