From: Anatolij Gustschin <agust@denx.de>
To: linuxppc-dev@lists.ozlabs.org
Cc: Anatolij Gustschin <agust@denx.de>
Subject: [PATCH] powerpc/5121: pdm360ng: fix touch irq if 8xxx gpio driver is enabled
Date: Wed, 15 Sep 2010 22:12:57 +0200 [thread overview]
Message-ID: <1284581577-2217-1-git-send-email-agust@denx.de> (raw)
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@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
next reply other threads:[~2010-09-15 20:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-15 20:12 Anatolij Gustschin [this message]
2010-09-16 2:38 ` [PATCH] powerpc/5121: pdm360ng: fix touch irq if 8xxx gpio driver is enabled Grant Likely
2010-09-25 20:22 ` Anatolij Gustschin
2010-10-27 13:40 ` Grant Likely
2010-10-14 14:55 ` Anatolij Gustschin
2010-10-16 3:52 ` Grant Likely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1284581577-2217-1-git-send-email-agust@denx.de \
--to=agust@denx.de \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).