gpio: add MSIC gpio driver
[deliverable/linux.git] / include / linux / gpio.h
CommitLineData
7560fa60
DB
1#ifndef __LINUX_GPIO_H
2#define __LINUX_GPIO_H
3
4/* see Documentation/gpio.txt */
5
c001fb72
RD
6/* make these flag values available regardless of GPIO kconfig options */
7#define GPIOF_DIR_OUT (0 << 0)
8#define GPIOF_DIR_IN (1 << 0)
9
10#define GPIOF_INIT_LOW (0 << 1)
11#define GPIOF_INIT_HIGH (1 << 1)
12
13#define GPIOF_IN (GPIOF_DIR_IN)
14#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW)
15#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
16
aca5ce14
LD
17/* Gpio pin is open drain */
18#define GPIOF_OPEN_DRAIN (1 << 2)
19
25553ff0
LD
20/* Gpio pin is open source */
21#define GPIOF_OPEN_SOURCE (1 << 3)
22
fc3a1f04
WS
23#define GPIOF_EXPORT (1 << 2)
24#define GPIOF_EXPORT_CHANGEABLE (1 << 3)
25#define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT)
26#define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE)
27
feb83699
MB
28/**
29 * struct gpio - a structure describing a GPIO with configuration
30 * @gpio: the GPIO number
31 * @flags: GPIO configuration as specified by GPIOF_*
32 * @label: a literal description string of this GPIO
33 */
34struct gpio {
35 unsigned gpio;
36 unsigned long flags;
37 const char *label;
38};
39
7560fa60
DB
40#ifdef CONFIG_GENERIC_GPIO
41#include <asm/gpio.h>
42
43#else
44
3d599d1c 45#include <linux/kernel.h>
6ea0205b
DB
46#include <linux/types.h>
47#include <linux/errno.h>
187f1882 48#include <linux/bug.h>
6ea0205b 49
a4177ee7 50struct device;
4e4438b8 51struct gpio_chip;
a4177ee7 52
3474cb3c 53static inline bool gpio_is_valid(int number)
7560fa60 54{
3474cb3c 55 return false;
7560fa60
DB
56}
57
d8a3515e 58static inline int gpio_request(unsigned gpio, const char *label)
7560fa60
DB
59{
60 return -ENOSYS;
61}
62
2c96922a
MB
63static inline int devm_gpio_request(struct device *dev, unsigned gpio,
64 const char *label)
65{
66 return -ENOSYS;
67}
68
323b7fe8 69static inline int gpio_request_one(unsigned gpio,
5f829e40
WS
70 unsigned long flags, const char *label)
71{
72 return -ENOSYS;
73}
74
7c295975 75static inline int gpio_request_array(const struct gpio *array, size_t num)
5f829e40
WS
76{
77 return -ENOSYS;
78}
79
7560fa60
DB
80static inline void gpio_free(unsigned gpio)
81{
3d599d1c
UKK
82 might_sleep();
83
7560fa60 84 /* GPIO can never have been requested */
2c96922a
MB
85 WARN_ON(1);
86}
87
88static inline void devm_gpio_free(struct device *dev, unsigned gpio)
89{
90 might_sleep();
91
92 /* GPIO can never have been requested */
7560fa60
DB
93 WARN_ON(1);
94}
95
7c295975 96static inline void gpio_free_array(const struct gpio *array, size_t num)
5f829e40
WS
97{
98 might_sleep();
99
100 /* GPIO can never have been requested */
101 WARN_ON(1);
102}
103
d8a3515e 104static inline int gpio_direction_input(unsigned gpio)
7560fa60
DB
105{
106 return -ENOSYS;
107}
108
d8a3515e 109static inline int gpio_direction_output(unsigned gpio, int value)
7560fa60
DB
110{
111 return -ENOSYS;
112}
113
c4b5be98
FB
114static inline int gpio_set_debounce(unsigned gpio, unsigned debounce)
115{
116 return -ENOSYS;
117}
118
7560fa60
DB
119static inline int gpio_get_value(unsigned gpio)
120{
121 /* GPIO can never have been requested or set as {in,out}put */
122 WARN_ON(1);
123 return 0;
124}
125
126static inline void gpio_set_value(unsigned gpio, int value)
127{
128 /* GPIO can never have been requested or set as output */
129 WARN_ON(1);
130}
131
132static inline int gpio_cansleep(unsigned gpio)
133{
134 /* GPIO can never have been requested or set as {in,out}put */
135 WARN_ON(1);
136 return 0;
137}
138
139static inline int gpio_get_value_cansleep(unsigned gpio)
140{
141 /* GPIO can never have been requested or set as {in,out}put */
142 WARN_ON(1);
143 return 0;
144}
145
146static inline void gpio_set_value_cansleep(unsigned gpio, int value)
147{
148 /* GPIO can never have been requested or set as output */
149 WARN_ON(1);
150}
151
d8f388d8
DB
152static inline int gpio_export(unsigned gpio, bool direction_may_change)
153{
154 /* GPIO can never have been requested or set as {in,out}put */
155 WARN_ON(1);
156 return -EINVAL;
157}
158
a4177ee7
JN
159static inline int gpio_export_link(struct device *dev, const char *name,
160 unsigned gpio)
161{
162 /* GPIO can never have been exported */
163 WARN_ON(1);
164 return -EINVAL;
165}
166
07697461
JN
167static inline int gpio_sysfs_set_active_low(unsigned gpio, int value)
168{
169 /* GPIO can never have been requested */
170 WARN_ON(1);
171 return -EINVAL;
172}
a4177ee7 173
d8f388d8
DB
174static inline void gpio_unexport(unsigned gpio)
175{
176 /* GPIO can never have been exported */
177 WARN_ON(1);
178}
179
7560fa60
DB
180static inline int gpio_to_irq(unsigned gpio)
181{
182 /* GPIO can never have been requested or set as input */
183 WARN_ON(1);
184 return -EINVAL;
185}
186
187static inline int irq_to_gpio(unsigned irq)
188{
189 /* irq can never have been returned from gpio_to_irq() */
190 WARN_ON(1);
191 return -EINVAL;
192}
193
194#endif
195
196#endif /* __LINUX_GPIO_H */
This page took 0.431918 seconds and 5 git commands to generate.