diff options
Diffstat (limited to 'include/asm-arm/arch-omap/gpio.h')
-rw-r--r-- | include/asm-arm/arch-omap/gpio.h | 57 |
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> | |
92 | static inline int gpio_request(unsigned gpio, const char *label) | ||
93 | { | ||
94 | return omap_request_gpio(gpio); | ||
95 | } | ||
96 | |||
97 | static inline void gpio_free(unsigned gpio) | ||
98 | { | ||
99 | omap_free_gpio(gpio); | ||
100 | } | ||
101 | |||
102 | static 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 | |||
115 | static inline int gpio_direction_input(unsigned gpio) | ||
116 | { | ||
117 | return __gpio_set_direction(gpio, 1); | ||
118 | } | ||
119 | |||
120 | static 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 | ||
126 | static inline int gpio_get_value(unsigned gpio) | 94 | static 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 | ||
131 | static inline void gpio_set_value(unsigned gpio, int value) | 99 | static 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 */ | 104 | static inline int gpio_cansleep(unsigned gpio) |
105 | { | ||
106 | return __gpio_cansleep(gpio); | ||
107 | } | ||
137 | 108 | ||
138 | static inline int gpio_to_irq(unsigned gpio) | 109 | static 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 | ||
143 | static inline int irq_to_gpio(unsigned irq) | 116 | static inline int irq_to_gpio(unsigned irq) |