diff options
author | Philipp Zabel <philipp.zabel@gmail.com> | 2007-02-20 16:58:20 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-20 20:10:16 -0500 |
commit | 5b7e42b2d38e4c4d0cb105a2ad83d43f6957f59e (patch) | |
tree | 76758cee84ef63ab138943a2597b645ce58462cb /include/asm-arm/arch-sa1100 | |
parent | adff264fe66d78a166dc887f861e7273d0cb1654 (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 'include/asm-arm/arch-sa1100')
-rw-r--r-- | include/asm-arm/arch-sa1100/gpio.h | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/include/asm-arm/arch-sa1100/gpio.h b/include/asm-arm/arch-sa1100/gpio.h index a331fe3f6e48..da7575b0e5d0 100644 --- a/include/asm-arm/arch-sa1100/gpio.h +++ b/include/asm-arm/arch-sa1100/gpio.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/include/asm-arm/arch-pxa/gpio.h | 2 | * linux/include/asm-arm/arch-sa1100/gpio.h |
3 | * | 3 | * |
4 | * SA1100 GPIO wrappers for arch-neutral GPIO calls | 4 | * SA1100 GPIO wrappers for arch-neutral GPIO calls |
5 | * | 5 | * |
@@ -24,11 +24,8 @@ | |||
24 | #ifndef __ASM_ARCH_SA1100_GPIO_H | 24 | #ifndef __ASM_ARCH_SA1100_GPIO_H |
25 | #define __ASM_ARCH_SA1100_GPIO_H | 25 | #define __ASM_ARCH_SA1100_GPIO_H |
26 | 26 | ||
27 | #include <asm/arch/SA-1100.h> | 27 | #include <asm/hardware.h> |
28 | #include <asm/arch/irqs.h> | 28 | #include <asm/irq.h> |
29 | #include <asm/arch/hardware.h> | ||
30 | |||
31 | #include <asm/errno.h> | ||
32 | 29 | ||
33 | static inline int gpio_request(unsigned gpio, const char *label) | 30 | static inline int gpio_request(unsigned gpio, const char *label) |
34 | { | 31 | { |
@@ -40,26 +37,23 @@ static inline void gpio_free(unsigned gpio) | |||
40 | return; | 37 | return; |
41 | } | 38 | } |
42 | 39 | ||
43 | static inline int gpio_direction_input(unsigned gpio) | 40 | extern int gpio_direction_input(unsigned gpio); |
41 | extern int gpio_direction_output(unsigned gpio); | ||
42 | |||
43 | |||
44 | static inline int gpio_get_value(unsigned gpio) | ||
44 | { | 45 | { |
45 | if (gpio > GPIO_MAX) | 46 | return GPLR & GPIO_GPIO(gpio); |
46 | return -EINVAL; | ||
47 | GPDR = (GPDR_In << gpio) 0 | ||
48 | } | 47 | } |
49 | 48 | ||
50 | static inline int gpio_direction_output(unsigned gpio) | 49 | static inline void gpio_set_value(unsigned gpio, int value) |
51 | { | 50 | { |
52 | if (gpio > GPIO_MAX) | 51 | if (value) |
53 | return -EINVAL; | 52 | GPSR = GPIO_GPIO(gpio); |
54 | GPDR = (GPDR_Out << gpio) 0 | 53 | else |
54 | GPCR = GPIO_GPIO(gpio); | ||
55 | } | 55 | } |
56 | 56 | ||
57 | #define gpio_get_value(gpio) \ | ||
58 | (GPLR & GPIO_GPIO(gpio)) | ||
59 | |||
60 | #define gpio_set_value(gpio,value) \ | ||
61 | ((value) ? (GPSR = GPIO_GPIO(gpio)) : (GPCR(gpio) = GPIO_GPIO(gpio))) | ||
62 | |||
63 | #include <asm-generic/gpio.h> /* cansleep wrappers */ | 57 | #include <asm-generic/gpio.h> /* cansleep wrappers */ |
64 | 58 | ||
65 | static inline unsigned gpio_to_irq(unsigned gpio) | 59 | static inline unsigned gpio_to_irq(unsigned gpio) |