blob: fd098169fe87ed0b92aecd23b46e7a9a790bafad [file] [log] [blame]
Alexandre Courbot79a9bec2013-10-17 10:21:36 -07001#ifndef __LINUX_GPIO_CONSUMER_H
2#define __LINUX_GPIO_CONSUMER_H
3
Arnd Bergmanncdf86cd22014-05-08 15:42:25 +02004#include <linux/bug.h>
Alexandre Courbot79a9bec2013-10-17 10:21:36 -07005#include <linux/err.h>
6#include <linux/kernel.h>
7
Alexandre Courbot79a9bec2013-10-17 10:21:36 -07008struct device;
Alexandre Courbot79a9bec2013-10-17 10:21:36 -07009
10/**
11 * Opaque descriptor for a GPIO. These are obtained using gpiod_get() and are
12 * preferable to the old integer-based handles.
13 *
14 * Contrary to integers, a pointer to a gpio_desc is guaranteed to be valid
15 * until the GPIO is released.
16 */
17struct gpio_desc;
18
Rojhalat Ibrahim66858522015-02-11 17:27:58 +010019/**
20 * Struct containing an array of descriptors that can be obtained using
21 * gpiod_get_array().
22 */
23struct gpio_descs {
24 unsigned int ndescs;
25 struct gpio_desc *desc[];
26};
27
Alexandre Courbot39b2bbe2014-07-25 23:38:36 +090028#define GPIOD_FLAGS_BIT_DIR_SET BIT(0)
29#define GPIOD_FLAGS_BIT_DIR_OUT BIT(1)
30#define GPIOD_FLAGS_BIT_DIR_VAL BIT(2)
31
32/**
33 * Optional flags that can be passed to one of gpiod_* to configure direction
34 * and output value. These values cannot be OR'd.
35 */
36enum gpiod_flags {
37 GPIOD_ASIS = 0,
38 GPIOD_IN = GPIOD_FLAGS_BIT_DIR_SET,
39 GPIOD_OUT_LOW = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT,
40 GPIOD_OUT_HIGH = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT |
41 GPIOD_FLAGS_BIT_DIR_VAL,
42};
43
Linus Walleij58b84f62014-08-19 12:00:53 -050044#ifdef CONFIG_GPIOLIB
45
Rojhalat Ibrahim66858522015-02-11 17:27:58 +010046/* Return the number of GPIOs associated with a device / function */
47int gpiod_count(struct device *dev, const char *con_id);
48
Alexandre Courbotbae48da2013-10-17 10:21:38 -070049/* Acquire and dispose GPIOs */
Alexandre Courbot39b2bbe2014-07-25 23:38:36 +090050struct gpio_desc *__must_check __gpiod_get(struct device *dev,
51 const char *con_id,
52 enum gpiod_flags flags);
Alexandre Courbot39b2bbe2014-07-25 23:38:36 +090053struct gpio_desc *__must_check __gpiod_get_index(struct device *dev,
Alexandre Courbotbae48da2013-10-17 10:21:38 -070054 const char *con_id,
Alexandre Courbot39b2bbe2014-07-25 23:38:36 +090055 unsigned int idx,
56 enum gpiod_flags flags);
Alexandre Courbot39b2bbe2014-07-25 23:38:36 +090057struct gpio_desc *__must_check __gpiod_get_optional(struct device *dev,
58 const char *con_id,
59 enum gpiod_flags flags);
Alexandre Courbot39b2bbe2014-07-25 23:38:36 +090060struct gpio_desc *__must_check __gpiod_get_index_optional(struct device *dev,
Thierry Reding29a1f2332014-04-25 17:10:06 +020061 const char *con_id,
Alexandre Courbot39b2bbe2014-07-25 23:38:36 +090062 unsigned int index,
63 enum gpiod_flags flags);
Rojhalat Ibrahim66858522015-02-11 17:27:58 +010064struct gpio_descs *__must_check gpiod_get_array(struct device *dev,
65 const char *con_id,
66 enum gpiod_flags flags);
67struct gpio_descs *__must_check gpiod_get_array_optional(struct device *dev,
68 const char *con_id,
69 enum gpiod_flags flags);
Alexandre Courbotbae48da2013-10-17 10:21:38 -070070void gpiod_put(struct gpio_desc *desc);
Rojhalat Ibrahim66858522015-02-11 17:27:58 +010071void gpiod_put_array(struct gpio_descs *descs);
Alexandre Courbotbae48da2013-10-17 10:21:38 -070072
Alexandre Courbot39b2bbe2014-07-25 23:38:36 +090073struct gpio_desc *__must_check __devm_gpiod_get(struct device *dev,
74 const char *con_id,
75 enum gpiod_flags flags);
Alexandre Courbot39b2bbe2014-07-25 23:38:36 +090076struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev,
Alexandre Courbotbae48da2013-10-17 10:21:38 -070077 const char *con_id,
Alexandre Courbot39b2bbe2014-07-25 23:38:36 +090078 unsigned int idx,
79 enum gpiod_flags flags);
Alexandre Courbot39b2bbe2014-07-25 23:38:36 +090080struct gpio_desc *__must_check __devm_gpiod_get_optional(struct device *dev,
81 const char *con_id,
82 enum gpiod_flags flags);
Thierry Reding29a1f2332014-04-25 17:10:06 +020083struct gpio_desc *__must_check
Alexandre Courbot39b2bbe2014-07-25 23:38:36 +090084__devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
85 unsigned int index, enum gpiod_flags flags);
Rojhalat Ibrahim331758e2015-02-11 17:28:02 +010086struct gpio_descs *__must_check devm_gpiod_get_array(struct device *dev,
87 const char *con_id,
88 enum gpiod_flags flags);
89struct gpio_descs *__must_check
90devm_gpiod_get_array_optional(struct device *dev, const char *con_id,
91 enum gpiod_flags flags);
Alexandre Courbotbae48da2013-10-17 10:21:38 -070092void devm_gpiod_put(struct device *dev, struct gpio_desc *desc);
Rojhalat Ibrahim331758e2015-02-11 17:28:02 +010093void devm_gpiod_put_array(struct device *dev, struct gpio_descs *descs);
Alexandre Courbotbae48da2013-10-17 10:21:38 -070094
Alexandre Courbot8e53b0f2014-11-25 17:16:31 +090095int gpiod_get_direction(struct gpio_desc *desc);
Alexandre Courbot79a9bec2013-10-17 10:21:36 -070096int gpiod_direction_input(struct gpio_desc *desc);
97int gpiod_direction_output(struct gpio_desc *desc, int value);
Philipp Zabelef70bbe2014-01-07 12:34:11 +010098int gpiod_direction_output_raw(struct gpio_desc *desc, int value);
Alexandre Courbot79a9bec2013-10-17 10:21:36 -070099
100/* Value get/set from non-sleeping context */
101int gpiod_get_value(const struct gpio_desc *desc);
102void gpiod_set_value(struct gpio_desc *desc, int value);
Rojhalat Ibrahim3fff99b2015-05-13 11:04:56 +0200103void gpiod_set_array_value(unsigned int array_size,
104 struct gpio_desc **desc_array, int *value_array);
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700105int gpiod_get_raw_value(const struct gpio_desc *desc);
106void gpiod_set_raw_value(struct gpio_desc *desc, int value);
Rojhalat Ibrahim3fff99b2015-05-13 11:04:56 +0200107void gpiod_set_raw_array_value(unsigned int array_size,
108 struct gpio_desc **desc_array,
109 int *value_array);
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700110
111/* Value get/set from sleeping context */
112int gpiod_get_value_cansleep(const struct gpio_desc *desc);
113void gpiod_set_value_cansleep(struct gpio_desc *desc, int value);
Rojhalat Ibrahim3fff99b2015-05-13 11:04:56 +0200114void gpiod_set_array_value_cansleep(unsigned int array_size,
115 struct gpio_desc **desc_array,
116 int *value_array);
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700117int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc);
118void gpiod_set_raw_value_cansleep(struct gpio_desc *desc, int value);
Rojhalat Ibrahim3fff99b2015-05-13 11:04:56 +0200119void gpiod_set_raw_array_value_cansleep(unsigned int array_size,
120 struct gpio_desc **desc_array,
121 int *value_array);
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700122
123int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce);
124
125int gpiod_is_active_low(const struct gpio_desc *desc);
126int gpiod_cansleep(const struct gpio_desc *desc);
127
128int gpiod_to_irq(const struct gpio_desc *desc);
129
130/* Convert between the old gpio_ and new gpiod_ interfaces */
131struct gpio_desc *gpio_to_desc(unsigned gpio);
132int desc_to_gpio(const struct gpio_desc *desc);
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700133
Mika Westerberg40b73182014-10-21 13:33:59 +0200134/* Child properties interface */
135struct fwnode_handle;
136
137struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
138 const char *propname);
139struct gpio_desc *devm_get_gpiod_from_child(struct device *dev,
Olliver Schinagl1feb57a2015-01-21 22:33:46 +0100140 const char *con_id,
Mika Westerberg40b73182014-10-21 13:33:59 +0200141 struct fwnode_handle *child);
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700142#else /* CONFIG_GPIOLIB */
143
Rojhalat Ibrahim66858522015-02-11 17:27:58 +0100144static inline int gpiod_count(struct device *dev, const char *con_id)
145{
146 return 0;
147}
148
Linus Walleij0dbc8b72014-09-01 15:15:40 +0200149static inline struct gpio_desc *__must_check __gpiod_get(struct device *dev,
150 const char *con_id,
151 enum gpiod_flags flags)
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700152{
153 return ERR_PTR(-ENOSYS);
154}
Linus Walleij0dbc8b72014-09-01 15:15:40 +0200155static inline struct gpio_desc *__must_check
156__gpiod_get_index(struct device *dev,
157 const char *con_id,
158 unsigned int idx,
159 enum gpiod_flags flags)
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700160{
161 return ERR_PTR(-ENOSYS);
162}
Thierry Reding29a1f2332014-04-25 17:10:06 +0200163
164static inline struct gpio_desc *__must_check
Linus Walleij0dbc8b72014-09-01 15:15:40 +0200165__gpiod_get_optional(struct device *dev, const char *con_id,
166 enum gpiod_flags flags)
Thierry Reding29a1f2332014-04-25 17:10:06 +0200167{
168 return ERR_PTR(-ENOSYS);
169}
170
171static inline struct gpio_desc *__must_check
Linus Walleij0dbc8b72014-09-01 15:15:40 +0200172__gpiod_get_index_optional(struct device *dev, const char *con_id,
173 unsigned int index, enum gpiod_flags flags)
Thierry Reding29a1f2332014-04-25 17:10:06 +0200174{
175 return ERR_PTR(-ENOSYS);
176}
177
Rojhalat Ibrahim66858522015-02-11 17:27:58 +0100178static inline struct gpio_descs *__must_check
179gpiod_get_array(struct device *dev, const char *con_id,
180 enum gpiod_flags flags)
181{
182 return ERR_PTR(-ENOSYS);
183}
184
185static inline struct gpio_descs *__must_check
186gpiod_get_array_optional(struct device *dev, const char *con_id,
187 enum gpiod_flags flags)
188{
189 return ERR_PTR(-ENOSYS);
190}
191
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700192static inline void gpiod_put(struct gpio_desc *desc)
193{
194 might_sleep();
195
196 /* GPIO can never have been requested */
197 WARN_ON(1);
198}
199
Rojhalat Ibrahim66858522015-02-11 17:27:58 +0100200static inline void gpiod_put_array(struct gpio_descs *descs)
201{
202 might_sleep();
203
204 /* GPIO can never have been requested */
205 WARN_ON(1);
206}
207
Linus Walleij0dbc8b72014-09-01 15:15:40 +0200208static inline struct gpio_desc *__must_check
209__devm_gpiod_get(struct device *dev,
210 const char *con_id,
211 enum gpiod_flags flags)
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700212{
213 return ERR_PTR(-ENOSYS);
214}
215static inline
Linus Walleij0dbc8b72014-09-01 15:15:40 +0200216struct gpio_desc *__must_check
217__devm_gpiod_get_index(struct device *dev,
218 const char *con_id,
219 unsigned int idx,
220 enum gpiod_flags flags)
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700221{
222 return ERR_PTR(-ENOSYS);
223}
Thierry Reding29a1f2332014-04-25 17:10:06 +0200224
225static inline struct gpio_desc *__must_check
Linus Walleij0dbc8b72014-09-01 15:15:40 +0200226__devm_gpiod_get_optional(struct device *dev, const char *con_id,
227 enum gpiod_flags flags)
Thierry Reding29a1f2332014-04-25 17:10:06 +0200228{
229 return ERR_PTR(-ENOSYS);
230}
231
232static inline struct gpio_desc *__must_check
Linus Walleij0dbc8b72014-09-01 15:15:40 +0200233__devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
234 unsigned int index, enum gpiod_flags flags)
Thierry Reding29a1f2332014-04-25 17:10:06 +0200235{
236 return ERR_PTR(-ENOSYS);
237}
238
Rojhalat Ibrahim331758e2015-02-11 17:28:02 +0100239static inline struct gpio_descs *__must_check
240devm_gpiod_get_array(struct device *dev, const char *con_id,
241 enum gpiod_flags flags)
242{
243 return ERR_PTR(-ENOSYS);
244}
245
246static inline struct gpio_descs *__must_check
247devm_gpiod_get_array_optional(struct device *dev, const char *con_id,
248 enum gpiod_flags flags)
249{
250 return ERR_PTR(-ENOSYS);
251}
252
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700253static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc)
254{
255 might_sleep();
256
257 /* GPIO can never have been requested */
258 WARN_ON(1);
259}
260
Rojhalat Ibrahim331758e2015-02-11 17:28:02 +0100261static inline void devm_gpiod_put_array(struct device *dev,
262 struct gpio_descs *descs)
263{
264 might_sleep();
265
266 /* GPIO can never have been requested */
267 WARN_ON(1);
268}
269
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700270
271static inline int gpiod_get_direction(const struct gpio_desc *desc)
272{
273 /* GPIO can never have been requested */
274 WARN_ON(1);
275 return -ENOSYS;
276}
277static inline int gpiod_direction_input(struct gpio_desc *desc)
278{
279 /* GPIO can never have been requested */
280 WARN_ON(1);
281 return -ENOSYS;
282}
283static inline int gpiod_direction_output(struct gpio_desc *desc, int value)
284{
285 /* GPIO can never have been requested */
286 WARN_ON(1);
287 return -ENOSYS;
288}
Philipp Zabelef70bbe2014-01-07 12:34:11 +0100289static inline int gpiod_direction_output_raw(struct gpio_desc *desc, int value)
290{
291 /* GPIO can never have been requested */
292 WARN_ON(1);
293 return -ENOSYS;
294}
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700295
296
297static inline int gpiod_get_value(const struct gpio_desc *desc)
298{
299 /* GPIO can never have been requested */
300 WARN_ON(1);
301 return 0;
302}
303static inline void gpiod_set_value(struct gpio_desc *desc, int value)
304{
305 /* GPIO can never have been requested */
306 WARN_ON(1);
307}
Rojhalat Ibrahim3fff99b2015-05-13 11:04:56 +0200308static inline void gpiod_set_array_value(unsigned int array_size,
309 struct gpio_desc **desc_array,
310 int *value_array)
Rojhalat Ibrahim5f424242014-11-04 17:12:06 +0100311{
312 /* GPIO can never have been requested */
313 WARN_ON(1);
314}
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700315static inline int gpiod_get_raw_value(const struct gpio_desc *desc)
316{
317 /* GPIO can never have been requested */
318 WARN_ON(1);
319 return 0;
320}
321static inline void gpiod_set_raw_value(struct gpio_desc *desc, int value)
322{
323 /* GPIO can never have been requested */
324 WARN_ON(1);
325}
Rojhalat Ibrahim3fff99b2015-05-13 11:04:56 +0200326static inline void gpiod_set_raw_array_value(unsigned int array_size,
327 struct gpio_desc **desc_array,
328 int *value_array)
Rojhalat Ibrahim5f424242014-11-04 17:12:06 +0100329{
330 /* GPIO can never have been requested */
331 WARN_ON(1);
332}
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700333
334static inline int gpiod_get_value_cansleep(const struct gpio_desc *desc)
335{
336 /* GPIO can never have been requested */
337 WARN_ON(1);
338 return 0;
339}
340static inline void gpiod_set_value_cansleep(struct gpio_desc *desc, int value)
341{
342 /* GPIO can never have been requested */
343 WARN_ON(1);
344}
Rojhalat Ibrahim3fff99b2015-05-13 11:04:56 +0200345static inline void gpiod_set_array_value_cansleep(unsigned int array_size,
Rojhalat Ibrahim5f424242014-11-04 17:12:06 +0100346 struct gpio_desc **desc_array,
347 int *value_array)
348{
349 /* GPIO can never have been requested */
350 WARN_ON(1);
351}
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700352static inline int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc)
353{
354 /* GPIO can never have been requested */
355 WARN_ON(1);
356 return 0;
357}
358static inline void gpiod_set_raw_value_cansleep(struct gpio_desc *desc,
359 int value)
360{
361 /* GPIO can never have been requested */
362 WARN_ON(1);
363}
Rojhalat Ibrahim3fff99b2015-05-13 11:04:56 +0200364static inline void gpiod_set_raw_array_value_cansleep(unsigned int array_size,
Rojhalat Ibrahim5f424242014-11-04 17:12:06 +0100365 struct gpio_desc **desc_array,
366 int *value_array)
367{
368 /* GPIO can never have been requested */
369 WARN_ON(1);
370}
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700371
372static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
373{
374 /* GPIO can never have been requested */
375 WARN_ON(1);
376 return -ENOSYS;
377}
378
379static inline int gpiod_is_active_low(const struct gpio_desc *desc)
380{
381 /* GPIO can never have been requested */
382 WARN_ON(1);
383 return 0;
384}
385static inline int gpiod_cansleep(const struct gpio_desc *desc)
386{
387 /* GPIO can never have been requested */
388 WARN_ON(1);
389 return 0;
390}
391
392static inline int gpiod_to_irq(const struct gpio_desc *desc)
393{
394 /* GPIO can never have been requested */
395 WARN_ON(1);
396 return -EINVAL;
397}
398
399static inline struct gpio_desc *gpio_to_desc(unsigned gpio)
400{
401 return ERR_PTR(-EINVAL);
402}
403static inline int desc_to_gpio(const struct gpio_desc *desc)
404{
405 /* GPIO can never have been requested */
406 WARN_ON(1);
407 return -EINVAL;
408}
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700409
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700410#endif /* CONFIG_GPIOLIB */
411
Linus Walleij0dbc8b72014-09-01 15:15:40 +0200412/*
413 * Vararg-hacks! This is done to transition the kernel to always pass
414 * the options flags argument to the below functions. During a transition
415 * phase these vararg macros make both old-and-newstyle code compile,
416 * but when all calls to the elder API are removed, these should go away
417 * and the __gpiod_get() etc functions above be renamed just gpiod_get()
418 * etc.
419 */
420#define __gpiod_get(dev, con_id, flags, ...) __gpiod_get(dev, con_id, flags)
Olliver Schinagld34541b2015-01-07 09:44:57 +0100421#define gpiod_get(varargs...) __gpiod_get(varargs, GPIOD_ASIS)
Linus Walleij0dbc8b72014-09-01 15:15:40 +0200422#define __gpiod_get_index(dev, con_id, index, flags, ...) \
423 __gpiod_get_index(dev, con_id, index, flags)
Olliver Schinagld34541b2015-01-07 09:44:57 +0100424#define gpiod_get_index(varargs...) __gpiod_get_index(varargs, GPIOD_ASIS)
Linus Walleij0dbc8b72014-09-01 15:15:40 +0200425#define __gpiod_get_optional(dev, con_id, flags, ...) \
426 __gpiod_get_optional(dev, con_id, flags)
Olliver Schinagld34541b2015-01-07 09:44:57 +0100427#define gpiod_get_optional(varargs...) __gpiod_get_optional(varargs, GPIOD_ASIS)
Linus Walleij0dbc8b72014-09-01 15:15:40 +0200428#define __gpiod_get_index_optional(dev, con_id, index, flags, ...) \
429 __gpiod_get_index_optional(dev, con_id, index, flags)
430#define gpiod_get_index_optional(varargs...) \
Olliver Schinagld34541b2015-01-07 09:44:57 +0100431 __gpiod_get_index_optional(varargs, GPIOD_ASIS)
Linus Walleij0dbc8b72014-09-01 15:15:40 +0200432#define __devm_gpiod_get(dev, con_id, flags, ...) \
433 __devm_gpiod_get(dev, con_id, flags)
Olliver Schinagld34541b2015-01-07 09:44:57 +0100434#define devm_gpiod_get(varargs...) __devm_gpiod_get(varargs, GPIOD_ASIS)
Linus Walleij0dbc8b72014-09-01 15:15:40 +0200435#define __devm_gpiod_get_index(dev, con_id, index, flags, ...) \
436 __devm_gpiod_get_index(dev, con_id, index, flags)
Olliver Schinagld34541b2015-01-07 09:44:57 +0100437#define devm_gpiod_get_index(varargs...) \
438 __devm_gpiod_get_index(varargs, GPIOD_ASIS)
Linus Walleij0dbc8b72014-09-01 15:15:40 +0200439#define __devm_gpiod_get_optional(dev, con_id, flags, ...) \
440 __devm_gpiod_get_optional(dev, con_id, flags)
441#define devm_gpiod_get_optional(varargs...) \
Olliver Schinagld34541b2015-01-07 09:44:57 +0100442 __devm_gpiod_get_optional(varargs, GPIOD_ASIS)
Linus Walleij0dbc8b72014-09-01 15:15:40 +0200443#define __devm_gpiod_get_index_optional(dev, con_id, index, flags, ...) \
444 __devm_gpiod_get_index_optional(dev, con_id, index, flags)
445#define devm_gpiod_get_index_optional(varargs...) \
Olliver Schinagld34541b2015-01-07 09:44:57 +0100446 __devm_gpiod_get_index_optional(varargs, GPIOD_ASIS)
Linus Walleij0dbc8b72014-09-01 15:15:40 +0200447
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700448#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS)
449
450int gpiod_export(struct gpio_desc *desc, bool direction_may_change);
451int gpiod_export_link(struct device *dev, const char *name,
452 struct gpio_desc *desc);
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700453void gpiod_unexport(struct gpio_desc *desc);
454
455#else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */
456
457static inline int gpiod_export(struct gpio_desc *desc,
458 bool direction_may_change)
459{
460 return -ENOSYS;
461}
462
463static inline int gpiod_export_link(struct device *dev, const char *name,
464 struct gpio_desc *desc)
465{
466 return -ENOSYS;
467}
468
Alexandre Courbot79a9bec2013-10-17 10:21:36 -0700469static inline void gpiod_unexport(struct gpio_desc *desc)
470{
471}
472
473#endif /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */
474
475#endif