blob: 0515010a1a25e11837c778f3eb1db3e0766f886b [file] [log] [blame]
Nicholas Flintham1e3d3112013-04-10 10:48:38 +01001#ifndef __LINUX_GPIO_H
2#define __LINUX_GPIO_H
3
4
5#define GPIOF_DIR_OUT (0 << 0)
6#define GPIOF_DIR_IN (1 << 0)
7
8#define GPIOF_INIT_LOW (0 << 1)
9#define GPIOF_INIT_HIGH (1 << 1)
10
11#define GPIOF_IN (GPIOF_DIR_IN)
12#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW)
13#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
14
15#define GPIOF_OPEN_DRAIN (1 << 2)
16
17#define GPIOF_OPEN_SOURCE (1 << 3)
18
19struct gpio {
20 unsigned gpio;
21 unsigned long flags;
22 const char *label;
23};
24
25#ifdef CONFIG_GENERIC_GPIO
26#include <asm/gpio.h>
27
28#else
29
30#include <linux/kernel.h>
31#include <linux/types.h>
32#include <linux/errno.h>
33#include <linux/bug.h>
34
35struct device;
36struct gpio_chip;
37
38static inline bool gpio_is_valid(int number)
39{
40 return false;
41}
42
43static inline int gpio_request(unsigned gpio, const char *label)
44{
45 return -ENOSYS;
46}
47
48static inline int gpio_request_one(unsigned gpio,
49 unsigned long flags, const char *label)
50{
51 return -ENOSYS;
52}
53
54static inline int gpio_request_array(const struct gpio *array, size_t num)
55{
56 return -ENOSYS;
57}
58
59static inline void gpio_free(unsigned gpio)
60{
61 might_sleep();
62
63
64 WARN_ON(1);
65}
66
67static inline void gpio_free_array(const struct gpio *array, size_t num)
68{
69 might_sleep();
70
71
72 WARN_ON(1);
73}
74
75static inline int gpio_direction_input(unsigned gpio)
76{
77 return -ENOSYS;
78}
79
80static inline int gpio_direction_output(unsigned gpio, int value)
81{
82 return -ENOSYS;
83}
84
85static inline int gpio_set_debounce(unsigned gpio, unsigned debounce)
86{
87 return -ENOSYS;
88}
89
90static inline int gpio_get_value(unsigned gpio)
91{
92
93 WARN_ON(1);
94 return 0;
95}
96
97static inline void gpio_set_value(unsigned gpio, int value)
98{
99
100 WARN_ON(1);
101}
102
103static inline int gpio_cansleep(unsigned gpio)
104{
105
106 WARN_ON(1);
107 return 0;
108}
109
110static inline int gpio_get_value_cansleep(unsigned gpio)
111{
112
113 WARN_ON(1);
114 return 0;
115}
116
117static inline void gpio_set_value_cansleep(unsigned gpio, int value)
118{
119
120 WARN_ON(1);
121}
122
123static inline int gpio_export(unsigned gpio, bool direction_may_change)
124{
125
126 WARN_ON(1);
127 return -EINVAL;
128}
129
130static inline int gpio_export_link(struct device *dev, const char *name,
131 unsigned gpio)
132{
133
134 WARN_ON(1);
135 return -EINVAL;
136}
137
138static inline int gpio_sysfs_set_active_low(unsigned gpio, int value)
139{
140
141 WARN_ON(1);
142 return -EINVAL;
143}
144
145static inline void gpio_unexport(unsigned gpio)
146{
147
148 WARN_ON(1);
149}
150
151static inline int gpio_to_irq(unsigned gpio)
152{
153
154 WARN_ON(1);
155 return -EINVAL;
156}
157
158static inline int irq_to_gpio(unsigned irq)
159{
160
161 WARN_ON(1);
162 return -EINVAL;
163}
164
165#endif
166
167#endif