aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-arm/arch-omap/gpio.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:40:55 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:40:55 -0400
commit85b375a613085b78531ec86369a51c2f3b922f95 (patch)
tree716437d598de92bbd7acaf24622e9a7d74fc209a /include/asm-arm/arch-omap/gpio.h
parentec965350bb98bd291eb34f6ecddfdcfc36da1e6e (diff)
parentcf816ecb533ab96b883dfdc0db174598b5b5c4d2 (diff)
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (212 commits) [ARM] pxa: Phycore pcm-990-specific code for the PXA270 Quick Capture driver [ARM] pxa: V4L2 soc_camera driver for PXA270 [ARM] pxa: restrict availability of pxa2xx PCMCIA drivers [ARM] 5005/1: BAST: Fix kset_name initialiser [ARM] 4967/1: Adds functions to set clkout rate for Samsung S3C2410 [ARM] 4988/1: Add GPIO lib support to the EP93xx [ARM] Add initial sparsemem support [ARM] pxa: initialise PXA devices before platform init code [ARM] 5002/1: tosa: add two more leds [ARM] 5004/1: Tosa: make several unreferenced structures static. [ARM] 5003/1: Shut up sparse warnings [ARM] 4977/2: soc - pxa2xx-ac97 - Add missing clk_enable() [ARM] 4976/1: zylonite: Configure GPIO for WM9713 IRQ line [ARM] 4974/1: Drop unused leds-tosa. [ARM] 4973/1: Tosa: use leds-gpio driver. [ARM] 4972/1: Tosa: convert scoop GPIOs usage to generic gpio code [ARM] 4971/1: pxaficp_ir: provide startup and shutdown hooks [ARM] pxa: lubbock: move mis-placed SPI info [ARM] 4970/1: tosa: correct gpio used for wake up. [ARM] 4966/1: magician: add MFP pin configuration ...
Diffstat (limited to 'include/asm-arm/arch-omap/gpio.h')
-rw-r--r--include/asm-arm/arch-omap/gpio.h57
1 files changed, 15 insertions, 42 deletions
diff --git a/include/asm-arm/arch-omap/gpio.h b/include/asm-arm/arch-omap/gpio.h
index 164da09be095..86621a04cd8f 100644
--- a/include/asm-arm/arch-omap/gpio.h
+++ b/include/asm-arm/arch-omap/gpio.h
@@ -82,62 +82,35 @@ extern void omap_set_gpio_debounce_time(int gpio, int enable);
82 82
83/*-------------------------------------------------------------------------*/ 83/*-------------------------------------------------------------------------*/
84 84
85/* wrappers for "new style" GPIO calls. the old OMAP-specfic ones should 85/* Wrappers for "new style" GPIO calls, using the new infrastructure
86 * eventually be removed (along with this errno.h inclusion), and maybe 86 * which lets us plug in FPGA, I2C, and other implementations.
87 * gpios should put MPUIOs last too. 87 * *
88 * The original OMAP-specfic calls should eventually be removed.
88 */ 89 */
89 90
90#include <asm/errno.h> 91#include <linux/errno.h>
91 92#include <asm-generic/gpio.h>
92static inline int gpio_request(unsigned gpio, const char *label)
93{
94 return omap_request_gpio(gpio);
95}
96
97static inline void gpio_free(unsigned gpio)
98{
99 omap_free_gpio(gpio);
100}
101
102static inline int __gpio_set_direction(unsigned gpio, int is_input)
103{
104 if (cpu_class_is_omap2()) {
105 if (gpio > OMAP_MAX_GPIO_LINES)
106 return -EINVAL;
107 } else {
108 if (gpio > (OMAP_MAX_GPIO_LINES + 16 /* MPUIO */))
109 return -EINVAL;
110 }
111 omap_set_gpio_direction(gpio, is_input);
112 return 0;
113}
114
115static inline int gpio_direction_input(unsigned gpio)
116{
117 return __gpio_set_direction(gpio, 1);
118}
119
120static inline int gpio_direction_output(unsigned gpio, int value)
121{
122 omap_set_gpio_dataout(gpio, value);
123 return __gpio_set_direction(gpio, 0);
124}
125 93
126static inline int gpio_get_value(unsigned gpio) 94static inline int gpio_get_value(unsigned gpio)
127{ 95{
128 return omap_get_gpio_datain(gpio); 96 return __gpio_get_value(gpio);
129} 97}
130 98
131static inline void gpio_set_value(unsigned gpio, int value) 99static inline void gpio_set_value(unsigned gpio, int value)
132{ 100{
133 omap_set_gpio_dataout(gpio, value); 101 __gpio_set_value(gpio, value);
134} 102}
135 103
136#include <asm-generic/gpio.h> /* cansleep wrappers */ 104static inline int gpio_cansleep(unsigned gpio)
105{
106 return __gpio_cansleep(gpio);
107}
137 108
138static inline int gpio_to_irq(unsigned gpio) 109static inline int gpio_to_irq(unsigned gpio)
139{ 110{
140 return OMAP_GPIO_IRQ(gpio); 111 if (gpio < (OMAP_MAX_GPIO_LINES + 16))
112 return OMAP_GPIO_IRQ(gpio);
113 return -EINVAL;
141} 114}
142 115
143static inline int irq_to_gpio(unsigned irq) 116static inline int irq_to_gpio(unsigned irq)