Commit | Line | Data |
---|---|---|
7560fa60 DB |
1 | #ifndef __LINUX_GPIO_H |
2 | #define __LINUX_GPIO_H | |
3 | ||
4 | /* see Documentation/gpio.txt */ | |
5 | ||
6 | #ifdef CONFIG_GENERIC_GPIO | |
7 | #include <asm/gpio.h> | |
8 | ||
9 | #else | |
10 | ||
3d599d1c | 11 | #include <linux/kernel.h> |
6ea0205b DB |
12 | #include <linux/types.h> |
13 | #include <linux/errno.h> | |
14 | ||
7560fa60 DB |
15 | /* |
16 | * Some platforms don't support the GPIO programming interface. | |
17 | * | |
18 | * In case some driver uses it anyway (it should normally have | |
19 | * depended on GENERIC_GPIO), these routines help the compiler | |
20 | * optimize out much GPIO-related code ... or trigger a runtime | |
21 | * warning when something is wrongly called. | |
22 | */ | |
23 | ||
24 | static inline int gpio_is_valid(int number) | |
25 | { | |
26 | return 0; | |
27 | } | |
28 | ||
29 | static inline int gpio_request(unsigned gpio, const char *label) | |
30 | { | |
31 | return -ENOSYS; | |
32 | } | |
33 | ||
34 | static inline void gpio_free(unsigned gpio) | |
35 | { | |
3d599d1c UKK |
36 | might_sleep(); |
37 | ||
7560fa60 DB |
38 | /* GPIO can never have been requested */ |
39 | WARN_ON(1); | |
40 | } | |
41 | ||
42 | static inline int gpio_direction_input(unsigned gpio) | |
43 | { | |
44 | return -ENOSYS; | |
45 | } | |
46 | ||
47 | static inline int gpio_direction_output(unsigned gpio, int value) | |
48 | { | |
49 | return -ENOSYS; | |
50 | } | |
51 | ||
52 | static inline int gpio_get_value(unsigned gpio) | |
53 | { | |
54 | /* GPIO can never have been requested or set as {in,out}put */ | |
55 | WARN_ON(1); | |
56 | return 0; | |
57 | } | |
58 | ||
59 | static inline void gpio_set_value(unsigned gpio, int value) | |
60 | { | |
61 | /* GPIO can never have been requested or set as output */ | |
62 | WARN_ON(1); | |
63 | } | |
64 | ||
65 | static inline int gpio_cansleep(unsigned gpio) | |
66 | { | |
67 | /* GPIO can never have been requested or set as {in,out}put */ | |
68 | WARN_ON(1); | |
69 | return 0; | |
70 | } | |
71 | ||
72 | static inline int gpio_get_value_cansleep(unsigned gpio) | |
73 | { | |
74 | /* GPIO can never have been requested or set as {in,out}put */ | |
75 | WARN_ON(1); | |
76 | return 0; | |
77 | } | |
78 | ||
79 | static inline void gpio_set_value_cansleep(unsigned gpio, int value) | |
80 | { | |
81 | /* GPIO can never have been requested or set as output */ | |
82 | WARN_ON(1); | |
83 | } | |
84 | ||
d8f388d8 DB |
85 | static inline int gpio_export(unsigned gpio, bool direction_may_change) |
86 | { | |
87 | /* GPIO can never have been requested or set as {in,out}put */ | |
88 | WARN_ON(1); | |
89 | return -EINVAL; | |
90 | } | |
91 | ||
92 | static inline void gpio_unexport(unsigned gpio) | |
93 | { | |
94 | /* GPIO can never have been exported */ | |
95 | WARN_ON(1); | |
96 | } | |
97 | ||
7560fa60 DB |
98 | static inline int gpio_to_irq(unsigned gpio) |
99 | { | |
100 | /* GPIO can never have been requested or set as input */ | |
101 | WARN_ON(1); | |
102 | return -EINVAL; | |
103 | } | |
104 | ||
105 | static inline int irq_to_gpio(unsigned irq) | |
106 | { | |
107 | /* irq can never have been returned from gpio_to_irq() */ | |
108 | WARN_ON(1); | |
109 | return -EINVAL; | |
110 | } | |
111 | ||
112 | #endif | |
113 | ||
114 | #endif /* __LINUX_GPIO_H */ |