Lines Matching refs:gpio

11 int __mcfgpio_get_value(unsigned gpio);
12 void __mcfgpio_set_value(unsigned gpio, int value);
13 int __mcfgpio_direction_input(unsigned gpio);
14 int __mcfgpio_direction_output(unsigned gpio, int value);
15 int __mcfgpio_request(unsigned gpio);
16 void __mcfgpio_free(unsigned gpio);
19 #include <linux/gpio.h>
23 static inline int __gpio_get_value(unsigned gpio)
25 if (gpio < MCFGPIO_PIN_MAX)
26 return __mcfgpio_get_value(gpio);
31 static inline void __gpio_set_value(unsigned gpio, int value)
33 if (gpio < MCFGPIO_PIN_MAX)
34 __mcfgpio_set_value(gpio, value);
37 static inline int __gpio_to_irq(unsigned gpio)
42 static inline int gpio_direction_input(unsigned gpio)
44 if (gpio < MCFGPIO_PIN_MAX)
45 return __mcfgpio_direction_input(gpio);
50 static inline int gpio_direction_output(unsigned gpio, int value)
52 if (gpio < MCFGPIO_PIN_MAX)
53 return __mcfgpio_direction_output(gpio, value);
58 static inline int gpio_request(unsigned gpio, const char *label)
60 if (gpio < MCFGPIO_PIN_MAX)
61 return __mcfgpio_request(gpio);
66 static inline void gpio_free(unsigned gpio)
68 if (gpio < MCFGPIO_PIN_MAX)
69 __mcfgpio_free(gpio);
121 #define mcfgpio_bit(gpio) (1 << ((gpio) % MCFGPIO_PORTSIZE))
122 #define mcfgpio_port(gpio) ((gpio) / MCFGPIO_PORTSIZE)
146 #define MCFGPIO_SETR_PORT(gpio) (MCFGPIO_SETR + \
147 mcfgpio_port(gpio - MCFGPIO_SCR_START))
149 #define MCFGPIO_CLRR_PORT(gpio) (MCFGPIO_CLRR + \
150 mcfgpio_port(gpio - MCFGPIO_SCR_START))
155 #define MCFGPIO_SETR_PORT(gpio) 0
156 #define MCFGPIO_CLRR_PORT(gpio) 0
163 /* return the port pin data register for a gpio */
164 static inline u32 __mcfgpio_ppdr(unsigned gpio)
170 if (gpio < 16)
172 else if (gpio < 32)
177 if (gpio < 32)
186 if (gpio < 8)
189 else if (gpio < 16)
191 else if (gpio < 24)
193 else if (gpio < 32)
195 else if (gpio < 40)
200 return MCFGPIO_PPDR + mcfgpio_port(gpio - MCFGPIO_SCR_START);
206 /* return the port output data register for a gpio */
207 static inline u32 __mcfgpio_podr(unsigned gpio)
213 if (gpio < 16)
215 else if (gpio < 32)
220 if (gpio < 32)
229 if (gpio < 8)
232 else if (gpio < 16)
234 else if (gpio < 24)
236 else if (gpio < 32)
238 else if (gpio < 40)
243 return MCFGPIO_PODR + mcfgpio_port(gpio - MCFGPIO_SCR_START);
249 /* return the port direction data register for a gpio */
250 static inline u32 __mcfgpio_pddr(unsigned gpio)
256 if (gpio < 16)
258 else if (gpio < 32)
263 if (gpio < 32)
272 if (gpio < 8)
275 else if (gpio < 16)
277 else if (gpio < 24)
279 else if (gpio < 32)
281 else if (gpio < 40)
286 return MCFGPIO_PDDR + mcfgpio_port(gpio - MCFGPIO_SCR_START);