diff options
author | Michael Buesch <mb@bu3sch.de> | 2008-07-25 04:46:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:30 -0400 |
commit | 7444a72effa632fcd8edc566f880d96fe213c73b (patch) | |
tree | 89d3e70c22751a6b00091df2b4dce7202eb3b1f5 /include | |
parent | ff1d5c2f0268f4e32103536e2e65480b5b7b6530 (diff) |
gpiolib: allow user-selection
This patch adds functionality to the gpio-lib subsystem to make it
possible to enable the gpio-lib code even if the architecture code didn't
request to get it built in.
The archtitecture code does still need to implement the gpiolib accessor
functions in its asm/gpio.h file. This patch adds the implementations for
x86 and PPC.
With these changes it is possible to run generic GPIO expansion cards on
every architecture that implements the trivial wrapper functions. Support
for more architectures can easily be added.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: David Brownell <david-b@pacbell.net>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Samuel Ortiz <sameo@openedhand.com>
Cc: Kumar Gala <galak@gate.crashing.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/gpio.h | 2 | ||||
-rw-r--r-- | include/asm-mips/mach-generic/gpio.h | 2 | ||||
-rw-r--r-- | include/asm-powerpc/gpio.h | 4 | ||||
-rw-r--r-- | include/asm-x86/gpio.h | 56 |
4 files changed, 60 insertions, 4 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 1beff5166e53..a3034d20ebd5 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | 5 | ||
6 | #ifdef CONFIG_HAVE_GPIO_LIB | 6 | #ifdef CONFIG_GPIOLIB |
7 | 7 | ||
8 | #include <linux/compiler.h> | 8 | #include <linux/compiler.h> |
9 | 9 | ||
diff --git a/include/asm-mips/mach-generic/gpio.h b/include/asm-mips/mach-generic/gpio.h index e6b376bd9d06..b4e70208da64 100644 --- a/include/asm-mips/mach-generic/gpio.h +++ b/include/asm-mips/mach-generic/gpio.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef __ASM_MACH_GENERIC_GPIO_H | 1 | #ifndef __ASM_MACH_GENERIC_GPIO_H |
2 | #define __ASM_MACH_GENERIC_GPIO_H | 2 | #define __ASM_MACH_GENERIC_GPIO_H |
3 | 3 | ||
4 | #ifdef CONFIG_HAVE_GPIO_LIB | 4 | #ifdef CONFIG_GPIOLIB |
5 | #define gpio_get_value __gpio_get_value | 5 | #define gpio_get_value __gpio_get_value |
6 | #define gpio_set_value __gpio_set_value | 6 | #define gpio_set_value __gpio_set_value |
7 | #define gpio_cansleep __gpio_cansleep | 7 | #define gpio_cansleep __gpio_cansleep |
diff --git a/include/asm-powerpc/gpio.h b/include/asm-powerpc/gpio.h index 77ad3a890f30..ea04632399d8 100644 --- a/include/asm-powerpc/gpio.h +++ b/include/asm-powerpc/gpio.h | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
18 | #include <asm-generic/gpio.h> | 18 | #include <asm-generic/gpio.h> |
19 | 19 | ||
20 | #ifdef CONFIG_HAVE_GPIO_LIB | 20 | #ifdef CONFIG_GPIOLIB |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * We don't (yet) implement inlined/rapid versions for on-chip gpios. | 23 | * We don't (yet) implement inlined/rapid versions for on-chip gpios. |
@@ -51,6 +51,6 @@ static inline int irq_to_gpio(unsigned int irq) | |||
51 | return -EINVAL; | 51 | return -EINVAL; |
52 | } | 52 | } |
53 | 53 | ||
54 | #endif /* CONFIG_HAVE_GPIO_LIB */ | 54 | #endif /* CONFIG_GPIOLIB */ |
55 | 55 | ||
56 | #endif /* __ASM_POWERPC_GPIO_H */ | 56 | #endif /* __ASM_POWERPC_GPIO_H */ |
diff --git a/include/asm-x86/gpio.h b/include/asm-x86/gpio.h index ff87fca0caf9..116e9147fe66 100644 --- a/include/asm-x86/gpio.h +++ b/include/asm-x86/gpio.h | |||
@@ -1,6 +1,62 @@ | |||
1 | /* | ||
2 | * Generic GPIO API implementation for x86. | ||
3 | * | ||
4 | * Derived from the generic GPIO API for powerpc: | ||
5 | * | ||
6 | * Copyright (c) 2007-2008 MontaVista Software, Inc. | ||
7 | * | ||
8 | * Author: Anton Vorontsov <avorontsov@ru.mvista.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | */ | ||
15 | |||
1 | #ifndef _ASM_I386_GPIO_H | 16 | #ifndef _ASM_I386_GPIO_H |
2 | #define _ASM_I386_GPIO_H | 17 | #define _ASM_I386_GPIO_H |
3 | 18 | ||
19 | #ifdef CONFIG_X86_RDC321X | ||
4 | #include <gpio.h> | 20 | #include <gpio.h> |
21 | #else /* CONFIG_X86_RDC321X */ | ||
22 | |||
23 | #include <asm-generic/gpio.h> | ||
24 | |||
25 | #ifdef CONFIG_GPIOLIB | ||
26 | |||
27 | /* | ||
28 | * Just call gpiolib. | ||
29 | */ | ||
30 | static inline int gpio_get_value(unsigned int gpio) | ||
31 | { | ||
32 | return __gpio_get_value(gpio); | ||
33 | } | ||
34 | |||
35 | static inline void gpio_set_value(unsigned int gpio, int value) | ||
36 | { | ||
37 | __gpio_set_value(gpio, value); | ||
38 | } | ||
39 | |||
40 | static inline int gpio_cansleep(unsigned int gpio) | ||
41 | { | ||
42 | return __gpio_cansleep(gpio); | ||
43 | } | ||
44 | |||
45 | /* | ||
46 | * Not implemented, yet. | ||
47 | */ | ||
48 | static inline int gpio_to_irq(unsigned int gpio) | ||
49 | { | ||
50 | return -ENOSYS; | ||
51 | } | ||
52 | |||
53 | static inline int irq_to_gpio(unsigned int irq) | ||
54 | { | ||
55 | return -EINVAL; | ||
56 | } | ||
57 | |||
58 | #endif /* CONFIG_GPIOLIB */ | ||
59 | |||
60 | #endif /* CONFIG_X86_RDC321X */ | ||
5 | 61 | ||
6 | #endif /* _ASM_I386_GPIO_H */ | 62 | #endif /* _ASM_I386_GPIO_H */ |