[PATCH 3/4] Keyboard driver janitor work
Holger Freyther
zecke at openmoko.org
Tue Apr 8 22:47:26 CEST 2008
From 874de2289dba5eaadb80c84c99a0182bcfeddbfd Mon Sep 17 00:00:00 2001
From: Holger Freyther <zecke at openmoko.org>
Date: Tue, 8 Apr 2008 22:37:40 +0200
Subject: [PATCH] Implement irq_to_gpio for the s3c2410.
Signed-Off-By: Holger Freyther <zecke at openmoko.org>
---
arch/arm/plat-s3c24xx/gpio.c | 17 +++++++++++++++++
include/asm-arm/arch-s3c2410/gpio.h | 1 +
include/asm-arm/arch-s3c2410/hardware.h | 2 ++
3 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-s3c24xx/gpio.c b/arch/arm/plat-s3c24xx/gpio.c
index 0c3a8bb..63a4842 100644
--- a/arch/arm/plat-s3c24xx/gpio.c
+++ b/arch/arm/plat-s3c24xx/gpio.c
@@ -189,6 +189,23 @@ int s3c2410_gpio_getirq(unsigned int pin)
EXPORT_SYMBOL(s3c2410_gpio_getirq);
+int s3c2410_irq_to_gpio(unsigned int irq)
+{
+ /* not valid interrupts */
+ if (irq > 15 + IRQ_EINT8)
+ return -1;
+
+ if (irq < IRQ_EINT4)
+ return (irq - IRQ_EINT0) + S3C2410_GPF0;
+
+ if (irq < IRQ_EINT8)
+ return (irq - IRQ_EINT4) + S3C2410_GPF4;
+
+ return (irq - IRQ_EINT8) + S3C2410_GPG0;
+}
+
+EXPORT_SYMBOL(s3c2410_irq_to_gpio);
+
static void pretty_dump(u32 cfg, u32 state, u32 pull,
const char ** function_names_2,
const char ** function_names_3,
diff --git a/include/asm-arm/arch-s3c2410/gpio.h
b/include/asm-arm/arch-s3c2410/gpio.h
index 7583895..9c8a338 100644
--- a/include/asm-arm/arch-s3c2410/gpio.h
+++ b/include/asm-arm/arch-s3c2410/gpio.h
@@ -61,6 +61,7 @@ static inline int gpio_direction_output(unsigned gpio, int
value)
#define gpio_to_irq(gpio) s3c2400_gpio_getirq(gpio)
#else
#define gpio_to_irq(gpio) s3c2410_gpio_getirq(gpio)
+#define irq_to_gpio(irq) s3c2410_irq_to_gpio(irq)
#endif
/* FIXME implement irq_to_gpio() */
diff --git a/include/asm-arm/arch-s3c2410/hardware.h
b/include/asm-arm/arch-s3c2410/hardware.h
index 6dadf58..caea511 100644
--- a/include/asm-arm/arch-s3c2410/hardware.h
+++ b/include/asm-arm/arch-s3c2410/hardware.h
@@ -50,6 +50,8 @@ extern unsigned int s3c2410_gpio_getcfg(unsigned int pin);
extern int s3c2410_gpio_getirq(unsigned int pin);
+extern int s3c2410_irq_to_gpio(unsigned int irq);
+
#ifdef CONFIG_CPU_S3C2400
extern int s3c2400_gpio_getirq(unsigned int pin);
--
1.5.4.rc3.24.gb53139
More information about the openmoko-kernel
mailing list