aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/include/mach/gpio.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/include/mach/gpio.h')
-rw-r--r--arch/arm/mach-pxa/include/mach/gpio.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h
index 48ef925ffb3b..c4639502efca 100644
--- a/arch/arm/mach-pxa/include/mach/gpio.h
+++ b/arch/arm/mach-pxa/include/mach/gpio.h
@@ -103,7 +103,20 @@
103 103
104#define gpio_to_bank(gpio) ((gpio) >> 5) 104#define gpio_to_bank(gpio) ((gpio) >> 5)
105#define gpio_to_irq(gpio) IRQ_GPIO(gpio) 105#define gpio_to_irq(gpio) IRQ_GPIO(gpio)
106#define irq_to_gpio(irq) IRQ_TO_GPIO(irq) 106
107static inline int irq_to_gpio(unsigned int irq)
108{
109 int gpio;
110
111 if (irq == IRQ_GPIO0 || irq == IRQ_GPIO1)
112 return irq - IRQ_GPIO0;
113
114 gpio = irq - PXA_GPIO_IRQ_BASE;
115 if (gpio >= 2 && gpio < NR_BUILTIN_GPIO)
116 return gpio;
117
118 return -1;
119}
107 120
108#ifdef CONFIG_CPU_PXA26x 121#ifdef CONFIG_CPU_PXA26x
109/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted, 122/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,