Committer: Michael Beasley <mike@snafu.setup>
[mikesnafu-overlay.git] / include / asm-avr32 / arch-at32ap / gpio.h
blob0180f584ef03d81cc432197e4a23f29eecc2f873
1 #ifndef __ASM_AVR32_ARCH_GPIO_H
2 #define __ASM_AVR32_ARCH_GPIO_H
4 #include <linux/compiler.h>
5 #include <asm/irq.h>
8 /* Some GPIO chips can manage IRQs; some can't. The exact numbers can
9 * be changed if needed, but for the moment they're not configurable.
11 #define ARCH_NR_GPIOS (NR_GPIO_IRQS + 2 * 32)
14 /* Arch-neutral GPIO API, supporting both "native" and external GPIOs. */
15 #include <asm-generic/gpio.h>
17 static inline int gpio_get_value(unsigned int gpio)
19 return __gpio_get_value(gpio);
22 static inline void gpio_set_value(unsigned int gpio, int value)
24 __gpio_set_value(gpio, value);
27 static inline int gpio_cansleep(unsigned int gpio)
29 return __gpio_cansleep(gpio);
33 static inline int gpio_to_irq(unsigned int gpio)
35 if (gpio < NR_GPIO_IRQS)
36 return gpio + GPIO_IRQ_BASE;
37 return -EINVAL;
40 static inline int irq_to_gpio(unsigned int irq)
42 return irq - GPIO_IRQ_BASE;
45 #endif /* __ASM_AVR32_ARCH_GPIO_H */