aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-sa1100/generic.c
diff options
context:
space:
mode:
authorPhilipp Zabel <philipp.zabel@gmail.com>2007-02-20 13:58:20 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-20 17:10:16 -0800
commit5b7e42b2d38e4c4d0cb105a2ad83d43f6957f59e (patch)
tree76758cee84ef63ab138943a2597b645ce58462cb /arch/arm/mach-sa1100/generic.c
parentadff264fe66d78a166dc887f861e7273d0cb1654 (diff)
[PATCH] GPIO API: SA1100 wrapper cleanup
Based on the discussion last december (http://lkml.org/lkml/2006/12/20/241), this patch - adds gpio_direction_input/output functions to generic.c instead of making them inline, - fixes comment and includes and uses inline functions instead of macros in gpio.h Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/arm/mach-sa1100/generic.c')
-rw-r--r--arch/arm/mach-sa1100/generic.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index e510295c258..192a5a26cf2 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -138,6 +138,36 @@ unsigned long long sched_clock(void)
return v;
}
+int gpio_direction_input(unsigned gpio)
+{
+ unsigned long flags;
+
+ if (gpio > GPIO_MAX)
+ return -EINVAL;
+
+ local_irq_save(flags);
+ GPDR &= ~GPIO_GPIO(gpio);
+ local_irq_restore(flags);
+ return 0;
+}
+
+EXPORT_SYMBOL(gpio_direction_input);
+
+int gpio_direction_output(unsigned gpio)
+{
+ unsigned long flags;
+
+ if (gpio > GPIO_MAX)
+ return -EINVAL;
+
+ local_irq_save(flags);
+ GPDR |= GPIO_GPIO(gpio);
+ local_irq_restore(flags);
+ return 0;
+}
+
+EXPORT_SYMBOL(gpio_direction_output);
+
/*
* Default power-off for SA1100
*/