Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-ks8695/include/mach/gpio.h |
| 3 | * |
| 4 | * Copyright (C) 2006 Andrew Victor |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | |
| 11 | #ifndef __ASM_ARCH_GPIO_H_ |
| 12 | #define __ASM_ARCH_GPIO_H_ |
| 13 | |
Uwe Kleine-König | 9c65685 | 2008-10-29 14:14:54 -0700 | [diff] [blame] | 14 | #include <linux/kernel.h> |
| 15 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 16 | #define KS8695_GPIO_0 0 |
| 17 | #define KS8695_GPIO_1 1 |
| 18 | #define KS8695_GPIO_2 2 |
| 19 | #define KS8695_GPIO_3 3 |
| 20 | #define KS8695_GPIO_4 4 |
| 21 | #define KS8695_GPIO_5 5 |
| 22 | #define KS8695_GPIO_6 6 |
| 23 | #define KS8695_GPIO_7 7 |
| 24 | #define KS8695_GPIO_8 8 |
| 25 | #define KS8695_GPIO_9 9 |
| 26 | #define KS8695_GPIO_10 10 |
| 27 | #define KS8695_GPIO_11 11 |
| 28 | #define KS8695_GPIO_12 12 |
| 29 | #define KS8695_GPIO_13 13 |
| 30 | #define KS8695_GPIO_14 14 |
| 31 | #define KS8695_GPIO_15 15 |
| 32 | |
| 33 | |
| 34 | /* |
| 35 | * Configure GPIO pin as external interrupt source. |
| 36 | */ |
| 37 | int __init_or_module ks8695_gpio_interrupt(unsigned int pin, unsigned int type); |
| 38 | |
| 39 | /* |
| 40 | * Configure the GPIO line as an input. |
| 41 | */ |
| 42 | int __init_or_module gpio_direction_input(unsigned int pin); |
| 43 | |
| 44 | /* |
| 45 | * Configure the GPIO line as an output, with default state. |
| 46 | */ |
| 47 | int __init_or_module gpio_direction_output(unsigned int pin, unsigned int state); |
| 48 | |
| 49 | /* |
| 50 | * Set the state of an output GPIO line. |
| 51 | */ |
| 52 | void gpio_set_value(unsigned int pin, unsigned int state); |
| 53 | |
| 54 | /* |
| 55 | * Read the state of a GPIO line. |
| 56 | */ |
| 57 | int gpio_get_value(unsigned int pin); |
| 58 | |
| 59 | /* |
| 60 | * Map GPIO line to IRQ number. |
| 61 | */ |
| 62 | int gpio_to_irq(unsigned int pin); |
| 63 | |
| 64 | /* |
| 65 | * Map IRQ number to GPIO line. |
| 66 | */ |
| 67 | int irq_to_gpio(unsigned int irq); |
| 68 | |
| 69 | |
| 70 | #include <asm-generic/gpio.h> |
| 71 | |
| 72 | static inline int gpio_request(unsigned int pin, const char *label) |
| 73 | { |
| 74 | return 0; |
| 75 | } |
| 76 | |
| 77 | static inline void gpio_free(unsigned int pin) |
| 78 | { |
Uwe Kleine-König | 9c65685 | 2008-10-29 14:14:54 -0700 | [diff] [blame] | 79 | might_sleep(); |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | #endif |