]> err.no Git - linux-2.6/commitdiff
[ARM] 4793/1: S3C24XX: Add IRQ->GPIO pin mapping function
authorBen Dooks <ben-linux@fluff.org>
Mon, 28 Jan 2008 12:01:33 +0000 (13:01 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 28 Jan 2008 13:20:52 +0000 (13:20 +0000)
Add the reverse of s3c2410_gpio_getirq to convert
a IRQ  number into a GPIO pin number.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/plat-s3c24xx/gpio.c
include/asm-arm/arch-s3c2410/hardware.h

index 7cc6faec25d974b98c8ff84ff244bc60835316fb..ee99dcc7f0bd2793524da7f90980264967f3ffcc 100644 (file)
@@ -199,3 +199,19 @@ int s3c2410_gpio_getirq(unsigned int pin)
 }
 
 EXPORT_SYMBOL(s3c2410_gpio_getirq);
+
+int s3c2410_gpio_irq2pin(unsigned int irq)
+{
+       if (irq >= IRQ_EINT0 && irq <= IRQ_EINT3)
+               return S3C2410_GPF0 + (irq - IRQ_EINT0);
+
+       if (irq >= IRQ_EINT4 && irq <= IRQ_EINT7)
+               return S3C2410_GPF4 + (irq - IRQ_EINT4);
+
+       if (irq >= IRQ_EINT8 && irq <= IRQ_EINT23)
+               return S3C2410_GPG0 + (irq - IRQ_EINT8);
+
+       return -EINVAL;
+}
+
+EXPORT_SYMBOL(s3c2410_gpio_irq2pin);
index 20509e4540f6c277861c683505579675d202d263..29592c3ebf22887079c85012b0bb468c7b234a57 100644 (file)
@@ -50,6 +50,17 @@ extern unsigned int s3c2410_gpio_getcfg(unsigned int pin);
 
 extern int s3c2410_gpio_getirq(unsigned int pin);
 
+/* s3c2410_gpio_irq2pin
+ *
+ * turn the given irq number into the corresponding GPIO number
+ *
+ * returns:
+ *     < 0 = no pin
+ *     >=0 = gpio pin number
+*/
+
+extern int s3c2410_gpio_irq2pin(unsigned int irq);
+
 #ifdef CONFIG_CPU_S3C2400
 
 extern int s3c2400_gpio_getirq(unsigned int pin);