diff options
Diffstat (limited to 'include/asm-avr32/arch-at32ap/gpio.h')
-rw-r--r-- | include/asm-avr32/arch-at32ap/gpio.h | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/include/asm-avr32/arch-at32ap/gpio.h b/include/asm-avr32/arch-at32ap/gpio.h index af7f9535bab3..0180f584ef03 100644 --- a/include/asm-avr32/arch-at32ap/gpio.h +++ b/include/asm-avr32/arch-at32ap/gpio.h | |||
@@ -5,20 +5,36 @@ | |||
5 | #include <asm/irq.h> | 5 | #include <asm/irq.h> |
6 | 6 | ||
7 | 7 | ||
8 | /* Arch-neutral GPIO API */ | 8 | /* Some GPIO chips can manage IRQs; some can't. The exact numbers can |
9 | int __must_check gpio_request(unsigned int gpio, const char *label); | 9 | * be changed if needed, but for the moment they're not configurable. |
10 | void gpio_free(unsigned int gpio); | 10 | */ |
11 | #define ARCH_NR_GPIOS (NR_GPIO_IRQS + 2 * 32) | ||
11 | 12 | ||
12 | int gpio_direction_input(unsigned int gpio); | ||
13 | int gpio_direction_output(unsigned int gpio, int value); | ||
14 | int gpio_get_value(unsigned int gpio); | ||
15 | void gpio_set_value(unsigned int gpio, int value); | ||
16 | 13 | ||
17 | #include <asm-generic/gpio.h> /* cansleep wrappers */ | 14 | /* Arch-neutral GPIO API, supporting both "native" and external GPIOs. */ |
15 | #include <asm-generic/gpio.h> | ||
16 | |||
17 | static inline int gpio_get_value(unsigned int gpio) | ||
18 | { | ||
19 | return __gpio_get_value(gpio); | ||
20 | } | ||
21 | |||
22 | static inline void gpio_set_value(unsigned int gpio, int value) | ||
23 | { | ||
24 | __gpio_set_value(gpio, value); | ||
25 | } | ||
26 | |||
27 | static inline int gpio_cansleep(unsigned int gpio) | ||
28 | { | ||
29 | return __gpio_cansleep(gpio); | ||
30 | } | ||
31 | |||
18 | 32 | ||
19 | static inline int gpio_to_irq(unsigned int gpio) | 33 | static inline int gpio_to_irq(unsigned int gpio) |
20 | { | 34 | { |
21 | return gpio + GPIO_IRQ_BASE; | 35 | if (gpio < NR_GPIO_IRQS) |
36 | return gpio + GPIO_IRQ_BASE; | ||
37 | return -EINVAL; | ||
22 | } | 38 | } |
23 | 39 | ||
24 | static inline int irq_to_gpio(unsigned int irq) | 40 | static inline int irq_to_gpio(unsigned int irq) |