Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
79a9becd AC |
2 | #ifndef __LINUX_GPIO_CONSUMER_H |
3 | #define __LINUX_GPIO_CONSUMER_H | |
4 | ||
cdf86cd2 | 5 | #include <linux/bug.h> |
79a9becd AC |
6 | #include <linux/err.h> |
7 | #include <linux/kernel.h> | |
8 | ||
79a9becd | 9 | struct device; |
79a9becd AC |
10 | |
11 | /** | |
12 | * Opaque descriptor for a GPIO. These are obtained using gpiod_get() and are | |
13 | * preferable to the old integer-based handles. | |
14 | * | |
15 | * Contrary to integers, a pointer to a gpio_desc is guaranteed to be valid | |
16 | * until the GPIO is released. | |
17 | */ | |
18 | struct gpio_desc; | |
19 | ||
66858527 RI |
20 | /** |
21 | * Struct containing an array of descriptors that can be obtained using | |
22 | * gpiod_get_array(). | |
23 | */ | |
24 | struct gpio_descs { | |
25 | unsigned int ndescs; | |
26 | struct gpio_desc *desc[]; | |
27 | }; | |
28 | ||
39b2bbe3 AC |
29 | #define GPIOD_FLAGS_BIT_DIR_SET BIT(0) |
30 | #define GPIOD_FLAGS_BIT_DIR_OUT BIT(1) | |
31 | #define GPIOD_FLAGS_BIT_DIR_VAL BIT(2) | |
f926dfc1 | 32 | #define GPIOD_FLAGS_BIT_OPEN_DRAIN BIT(3) |
39b2bbe3 AC |
33 | |
34 | /** | |
35 | * Optional flags that can be passed to one of gpiod_* to configure direction | |
36 | * and output value. These values cannot be OR'd. | |
37 | */ | |
38 | enum gpiod_flags { | |
39 | GPIOD_ASIS = 0, | |
40 | GPIOD_IN = GPIOD_FLAGS_BIT_DIR_SET, | |
41 | GPIOD_OUT_LOW = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT, | |
42 | GPIOD_OUT_HIGH = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT | | |
43 | GPIOD_FLAGS_BIT_DIR_VAL, | |
f926dfc1 LW |
44 | GPIOD_OUT_LOW_OPEN_DRAIN = GPIOD_FLAGS_BIT_DIR_SET | |
45 | GPIOD_FLAGS_BIT_DIR_OUT | GPIOD_FLAGS_BIT_OPEN_DRAIN, | |
46 | GPIOD_OUT_HIGH_OPEN_DRAIN = GPIOD_FLAGS_BIT_DIR_SET | | |
47 | GPIOD_FLAGS_BIT_DIR_OUT | GPIOD_FLAGS_BIT_DIR_VAL | | |
48 | GPIOD_FLAGS_BIT_OPEN_DRAIN, | |
39b2bbe3 AC |
49 | }; |
50 | ||
58b84f6a LW |
51 | #ifdef CONFIG_GPIOLIB |
52 | ||
66858527 RI |
53 | /* Return the number of GPIOs associated with a device / function */ |
54 | int gpiod_count(struct device *dev, const char *con_id); | |
55 | ||
bae48da2 | 56 | /* Acquire and dispose GPIOs */ |
b17d1bf1 | 57 | struct gpio_desc *__must_check gpiod_get(struct device *dev, |
39b2bbe3 AC |
58 | const char *con_id, |
59 | enum gpiod_flags flags); | |
b17d1bf1 | 60 | struct gpio_desc *__must_check gpiod_get_index(struct device *dev, |
bae48da2 | 61 | const char *con_id, |
39b2bbe3 AC |
62 | unsigned int idx, |
63 | enum gpiod_flags flags); | |
b17d1bf1 | 64 | struct gpio_desc *__must_check gpiod_get_optional(struct device *dev, |
39b2bbe3 AC |
65 | const char *con_id, |
66 | enum gpiod_flags flags); | |
b17d1bf1 | 67 | struct gpio_desc *__must_check gpiod_get_index_optional(struct device *dev, |
29a1f233 | 68 | const char *con_id, |
39b2bbe3 AC |
69 | unsigned int index, |
70 | enum gpiod_flags flags); | |
66858527 RI |
71 | struct gpio_descs *__must_check gpiod_get_array(struct device *dev, |
72 | const char *con_id, | |
73 | enum gpiod_flags flags); | |
74 | struct gpio_descs *__must_check gpiod_get_array_optional(struct device *dev, | |
75 | const char *con_id, | |
76 | enum gpiod_flags flags); | |
bae48da2 | 77 | void gpiod_put(struct gpio_desc *desc); |
66858527 | 78 | void gpiod_put_array(struct gpio_descs *descs); |
bae48da2 | 79 | |
b17d1bf1 | 80 | struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, |
39b2bbe3 AC |
81 | const char *con_id, |
82 | enum gpiod_flags flags); | |
b17d1bf1 | 83 | struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, |
bae48da2 | 84 | const char *con_id, |
39b2bbe3 AC |
85 | unsigned int idx, |
86 | enum gpiod_flags flags); | |
b17d1bf1 | 87 | struct gpio_desc *__must_check devm_gpiod_get_optional(struct device *dev, |
39b2bbe3 AC |
88 | const char *con_id, |
89 | enum gpiod_flags flags); | |
29a1f233 | 90 | struct gpio_desc *__must_check |
b17d1bf1 | 91 | devm_gpiod_get_index_optional(struct device *dev, const char *con_id, |
39b2bbe3 | 92 | unsigned int index, enum gpiod_flags flags); |
331758ee RI |
93 | struct gpio_descs *__must_check devm_gpiod_get_array(struct device *dev, |
94 | const char *con_id, | |
95 | enum gpiod_flags flags); | |
96 | struct gpio_descs *__must_check | |
97 | devm_gpiod_get_array_optional(struct device *dev, const char *con_id, | |
98 | enum gpiod_flags flags); | |
bae48da2 | 99 | void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); |
331758ee | 100 | void devm_gpiod_put_array(struct device *dev, struct gpio_descs *descs); |
bae48da2 | 101 | |
8e53b0f1 | 102 | int gpiod_get_direction(struct gpio_desc *desc); |
79a9becd AC |
103 | int gpiod_direction_input(struct gpio_desc *desc); |
104 | int gpiod_direction_output(struct gpio_desc *desc, int value); | |
ef70bbe1 | 105 | int gpiod_direction_output_raw(struct gpio_desc *desc, int value); |
79a9becd AC |
106 | |
107 | /* Value get/set from non-sleeping context */ | |
108 | int gpiod_get_value(const struct gpio_desc *desc); | |
eec1d566 LW |
109 | int gpiod_get_array_value(unsigned int array_size, |
110 | struct gpio_desc **desc_array, int *value_array); | |
79a9becd | 111 | void gpiod_set_value(struct gpio_desc *desc, int value); |
3fff99bc RI |
112 | void gpiod_set_array_value(unsigned int array_size, |
113 | struct gpio_desc **desc_array, int *value_array); | |
79a9becd | 114 | int gpiod_get_raw_value(const struct gpio_desc *desc); |
eec1d566 LW |
115 | int gpiod_get_raw_array_value(unsigned int array_size, |
116 | struct gpio_desc **desc_array, | |
117 | int *value_array); | |
79a9becd | 118 | void gpiod_set_raw_value(struct gpio_desc *desc, int value); |
3fff99bc RI |
119 | void gpiod_set_raw_array_value(unsigned int array_size, |
120 | struct gpio_desc **desc_array, | |
121 | int *value_array); | |
79a9becd AC |
122 | |
123 | /* Value get/set from sleeping context */ | |
124 | int gpiod_get_value_cansleep(const struct gpio_desc *desc); | |
eec1d566 LW |
125 | int gpiod_get_array_value_cansleep(unsigned int array_size, |
126 | struct gpio_desc **desc_array, | |
127 | int *value_array); | |
79a9becd | 128 | void gpiod_set_value_cansleep(struct gpio_desc *desc, int value); |
3fff99bc RI |
129 | void gpiod_set_array_value_cansleep(unsigned int array_size, |
130 | struct gpio_desc **desc_array, | |
131 | int *value_array); | |
79a9becd | 132 | int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc); |
eec1d566 LW |
133 | int gpiod_get_raw_array_value_cansleep(unsigned int array_size, |
134 | struct gpio_desc **desc_array, | |
135 | int *value_array); | |
79a9becd | 136 | void gpiod_set_raw_value_cansleep(struct gpio_desc *desc, int value); |
3fff99bc RI |
137 | void gpiod_set_raw_array_value_cansleep(unsigned int array_size, |
138 | struct gpio_desc **desc_array, | |
139 | int *value_array); | |
79a9becd AC |
140 | |
141 | int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce); | |
142 | ||
143 | int gpiod_is_active_low(const struct gpio_desc *desc); | |
144 | int gpiod_cansleep(const struct gpio_desc *desc); | |
145 | ||
146 | int gpiod_to_irq(const struct gpio_desc *desc); | |
147 | ||
148 | /* Convert between the old gpio_ and new gpiod_ interfaces */ | |
149 | struct gpio_desc *gpio_to_desc(unsigned gpio); | |
150 | int desc_to_gpio(const struct gpio_desc *desc); | |
79a9becd | 151 | |
40b73183 MW |
152 | /* Child properties interface */ |
153 | struct fwnode_handle; | |
154 | ||
155 | struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, | |
537b94da | 156 | const char *propname, int index, |
b2987d74 AS |
157 | enum gpiod_flags dflags, |
158 | const char *label); | |
537b94da BB |
159 | struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev, |
160 | const char *con_id, int index, | |
161 | struct fwnode_handle *child, | |
162 | enum gpiod_flags flags, | |
163 | const char *label); | |
3498d869 | 164 | |
79a9becd AC |
165 | #else /* CONFIG_GPIOLIB */ |
166 | ||
66858527 RI |
167 | static inline int gpiod_count(struct device *dev, const char *con_id) |
168 | { | |
169 | return 0; | |
170 | } | |
171 | ||
b17d1bf1 UKK |
172 | static inline struct gpio_desc *__must_check gpiod_get(struct device *dev, |
173 | const char *con_id, | |
174 | enum gpiod_flags flags) | |
79a9becd AC |
175 | { |
176 | return ERR_PTR(-ENOSYS); | |
177 | } | |
0dbc8b7a | 178 | static inline struct gpio_desc *__must_check |
b17d1bf1 UKK |
179 | gpiod_get_index(struct device *dev, |
180 | const char *con_id, | |
181 | unsigned int idx, | |
182 | enum gpiod_flags flags) | |
79a9becd AC |
183 | { |
184 | return ERR_PTR(-ENOSYS); | |
185 | } | |
29a1f233 TR |
186 | |
187 | static inline struct gpio_desc *__must_check | |
b17d1bf1 UKK |
188 | gpiod_get_optional(struct device *dev, const char *con_id, |
189 | enum gpiod_flags flags) | |
29a1f233 | 190 | { |
22c40367 | 191 | return NULL; |
29a1f233 TR |
192 | } |
193 | ||
194 | static inline struct gpio_desc *__must_check | |
b17d1bf1 UKK |
195 | gpiod_get_index_optional(struct device *dev, const char *con_id, |
196 | unsigned int index, enum gpiod_flags flags) | |
29a1f233 | 197 | { |
22c40367 | 198 | return NULL; |
29a1f233 TR |
199 | } |
200 | ||
66858527 RI |
201 | static inline struct gpio_descs *__must_check |
202 | gpiod_get_array(struct device *dev, const char *con_id, | |
203 | enum gpiod_flags flags) | |
204 | { | |
205 | return ERR_PTR(-ENOSYS); | |
206 | } | |
207 | ||
208 | static inline struct gpio_descs *__must_check | |
209 | gpiod_get_array_optional(struct device *dev, const char *con_id, | |
210 | enum gpiod_flags flags) | |
211 | { | |
22c40367 | 212 | return NULL; |
66858527 RI |
213 | } |
214 | ||
79a9becd AC |
215 | static inline void gpiod_put(struct gpio_desc *desc) |
216 | { | |
217 | might_sleep(); | |
218 | ||
219 | /* GPIO can never have been requested */ | |
220 | WARN_ON(1); | |
221 | } | |
222 | ||
66858527 RI |
223 | static inline void gpiod_put_array(struct gpio_descs *descs) |
224 | { | |
225 | might_sleep(); | |
226 | ||
227 | /* GPIO can never have been requested */ | |
228 | WARN_ON(1); | |
229 | } | |
230 | ||
0dbc8b7a | 231 | static inline struct gpio_desc *__must_check |
b17d1bf1 | 232 | devm_gpiod_get(struct device *dev, |
0dbc8b7a LW |
233 | const char *con_id, |
234 | enum gpiod_flags flags) | |
79a9becd AC |
235 | { |
236 | return ERR_PTR(-ENOSYS); | |
237 | } | |
238 | static inline | |
0dbc8b7a | 239 | struct gpio_desc *__must_check |
b17d1bf1 | 240 | devm_gpiod_get_index(struct device *dev, |
0dbc8b7a LW |
241 | const char *con_id, |
242 | unsigned int idx, | |
243 | enum gpiod_flags flags) | |
79a9becd AC |
244 | { |
245 | return ERR_PTR(-ENOSYS); | |
246 | } | |
29a1f233 TR |
247 | |
248 | static inline struct gpio_desc *__must_check | |
b17d1bf1 | 249 | devm_gpiod_get_optional(struct device *dev, const char *con_id, |
0dbc8b7a | 250 | enum gpiod_flags flags) |
29a1f233 | 251 | { |
22c40367 | 252 | return NULL; |
29a1f233 TR |
253 | } |
254 | ||
255 | static inline struct gpio_desc *__must_check | |
b17d1bf1 | 256 | devm_gpiod_get_index_optional(struct device *dev, const char *con_id, |
0dbc8b7a | 257 | unsigned int index, enum gpiod_flags flags) |
29a1f233 | 258 | { |
22c40367 | 259 | return NULL; |
29a1f233 TR |
260 | } |
261 | ||
331758ee RI |
262 | static inline struct gpio_descs *__must_check |
263 | devm_gpiod_get_array(struct device *dev, const char *con_id, | |
264 | enum gpiod_flags flags) | |
265 | { | |
266 | return ERR_PTR(-ENOSYS); | |
267 | } | |
268 | ||
269 | static inline struct gpio_descs *__must_check | |
270 | devm_gpiod_get_array_optional(struct device *dev, const char *con_id, | |
271 | enum gpiod_flags flags) | |
272 | { | |
22c40367 | 273 | return NULL; |
331758ee RI |
274 | } |
275 | ||
79a9becd | 276 | static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc) |
331758ee RI |
277 | { |
278 | might_sleep(); | |
279 | ||
280 | /* GPIO can never have been requested */ | |
281 | WARN_ON(1); | |
282 | } | |
283 | ||
284 | static inline void devm_gpiod_put_array(struct device *dev, | |
285 | struct gpio_descs *descs) | |
79a9becd AC |
286 | { |
287 | might_sleep(); | |
288 | ||
289 | /* GPIO can never have been requested */ | |
290 | WARN_ON(1); | |
291 | } | |
292 | ||
293 | ||
294 | static inline int gpiod_get_direction(const struct gpio_desc *desc) | |
295 | { | |
296 | /* GPIO can never have been requested */ | |
297 | WARN_ON(1); | |
298 | return -ENOSYS; | |
299 | } | |
300 | static inline int gpiod_direction_input(struct gpio_desc *desc) | |
301 | { | |
302 | /* GPIO can never have been requested */ | |
303 | WARN_ON(1); | |
304 | return -ENOSYS; | |
305 | } | |
306 | static inline int gpiod_direction_output(struct gpio_desc *desc, int value) | |
307 | { | |
308 | /* GPIO can never have been requested */ | |
309 | WARN_ON(1); | |
310 | return -ENOSYS; | |
311 | } | |
ef70bbe1 PZ |
312 | static inline int gpiod_direction_output_raw(struct gpio_desc *desc, int value) |
313 | { | |
314 | /* GPIO can never have been requested */ | |
315 | WARN_ON(1); | |
316 | return -ENOSYS; | |
317 | } | |
79a9becd AC |
318 | |
319 | ||
320 | static inline int gpiod_get_value(const struct gpio_desc *desc) | |
321 | { | |
322 | /* GPIO can never have been requested */ | |
323 | WARN_ON(1); | |
324 | return 0; | |
325 | } | |
eec1d566 LW |
326 | static inline int gpiod_get_array_value(unsigned int array_size, |
327 | struct gpio_desc **desc_array, | |
328 | int *value_array) | |
329 | { | |
330 | /* GPIO can never have been requested */ | |
331 | WARN_ON(1); | |
332 | return 0; | |
333 | } | |
79a9becd AC |
334 | static inline void gpiod_set_value(struct gpio_desc *desc, int value) |
335 | { | |
336 | /* GPIO can never have been requested */ | |
337 | WARN_ON(1); | |
338 | } | |
3fff99bc RI |
339 | static inline void gpiod_set_array_value(unsigned int array_size, |
340 | struct gpio_desc **desc_array, | |
341 | int *value_array) | |
5f424243 RI |
342 | { |
343 | /* GPIO can never have been requested */ | |
344 | WARN_ON(1); | |
345 | } | |
79a9becd AC |
346 | static inline int gpiod_get_raw_value(const struct gpio_desc *desc) |
347 | { | |
348 | /* GPIO can never have been requested */ | |
349 | WARN_ON(1); | |
350 | return 0; | |
351 | } | |
eec1d566 LW |
352 | static inline int gpiod_get_raw_array_value(unsigned int array_size, |
353 | struct gpio_desc **desc_array, | |
354 | int *value_array) | |
355 | { | |
356 | /* GPIO can never have been requested */ | |
357 | WARN_ON(1); | |
358 | return 0; | |
359 | } | |
79a9becd AC |
360 | static inline void gpiod_set_raw_value(struct gpio_desc *desc, int value) |
361 | { | |
362 | /* GPIO can never have been requested */ | |
363 | WARN_ON(1); | |
364 | } | |
3fff99bc RI |
365 | static inline void gpiod_set_raw_array_value(unsigned int array_size, |
366 | struct gpio_desc **desc_array, | |
367 | int *value_array) | |
5f424243 RI |
368 | { |
369 | /* GPIO can never have been requested */ | |
370 | WARN_ON(1); | |
371 | } | |
79a9becd AC |
372 | |
373 | static inline int gpiod_get_value_cansleep(const struct gpio_desc *desc) | |
374 | { | |
375 | /* GPIO can never have been requested */ | |
376 | WARN_ON(1); | |
377 | return 0; | |
378 | } | |
eec1d566 LW |
379 | static inline int gpiod_get_array_value_cansleep(unsigned int array_size, |
380 | struct gpio_desc **desc_array, | |
381 | int *value_array) | |
382 | { | |
383 | /* GPIO can never have been requested */ | |
384 | WARN_ON(1); | |
385 | return 0; | |
386 | } | |
79a9becd AC |
387 | static inline void gpiod_set_value_cansleep(struct gpio_desc *desc, int value) |
388 | { | |
389 | /* GPIO can never have been requested */ | |
390 | WARN_ON(1); | |
391 | } | |
3fff99bc | 392 | static inline void gpiod_set_array_value_cansleep(unsigned int array_size, |
5f424243 RI |
393 | struct gpio_desc **desc_array, |
394 | int *value_array) | |
395 | { | |
396 | /* GPIO can never have been requested */ | |
397 | WARN_ON(1); | |
398 | } | |
79a9becd AC |
399 | static inline int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc) |
400 | { | |
401 | /* GPIO can never have been requested */ | |
402 | WARN_ON(1); | |
403 | return 0; | |
404 | } | |
eec1d566 LW |
405 | static inline int gpiod_get_raw_array_value_cansleep(unsigned int array_size, |
406 | struct gpio_desc **desc_array, | |
407 | int *value_array) | |
408 | { | |
409 | /* GPIO can never have been requested */ | |
410 | WARN_ON(1); | |
411 | return 0; | |
412 | } | |
79a9becd AC |
413 | static inline void gpiod_set_raw_value_cansleep(struct gpio_desc *desc, |
414 | int value) | |
415 | { | |
416 | /* GPIO can never have been requested */ | |
417 | WARN_ON(1); | |
418 | } | |
3fff99bc | 419 | static inline void gpiod_set_raw_array_value_cansleep(unsigned int array_size, |
5f424243 RI |
420 | struct gpio_desc **desc_array, |
421 | int *value_array) | |
422 | { | |
423 | /* GPIO can never have been requested */ | |
424 | WARN_ON(1); | |
425 | } | |
79a9becd AC |
426 | |
427 | static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce) | |
428 | { | |
429 | /* GPIO can never have been requested */ | |
430 | WARN_ON(1); | |
431 | return -ENOSYS; | |
432 | } | |
433 | ||
434 | static inline int gpiod_is_active_low(const struct gpio_desc *desc) | |
435 | { | |
436 | /* GPIO can never have been requested */ | |
437 | WARN_ON(1); | |
438 | return 0; | |
439 | } | |
440 | static inline int gpiod_cansleep(const struct gpio_desc *desc) | |
441 | { | |
442 | /* GPIO can never have been requested */ | |
443 | WARN_ON(1); | |
444 | return 0; | |
445 | } | |
446 | ||
447 | static inline int gpiod_to_irq(const struct gpio_desc *desc) | |
448 | { | |
449 | /* GPIO can never have been requested */ | |
450 | WARN_ON(1); | |
451 | return -EINVAL; | |
452 | } | |
453 | ||
454 | static inline struct gpio_desc *gpio_to_desc(unsigned gpio) | |
455 | { | |
456 | return ERR_PTR(-EINVAL); | |
457 | } | |
c0017ed7 | 458 | |
79a9becd AC |
459 | static inline int desc_to_gpio(const struct gpio_desc *desc) |
460 | { | |
461 | /* GPIO can never have been requested */ | |
462 | WARN_ON(1); | |
463 | return -EINVAL; | |
464 | } | |
79a9becd | 465 | |
496e7ce2 GU |
466 | /* Child properties interface */ |
467 | struct fwnode_handle; | |
468 | ||
a264d10f AS |
469 | static inline |
470 | struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, | |
537b94da | 471 | const char *propname, int index, |
b2987d74 AS |
472 | enum gpiod_flags dflags, |
473 | const char *label) | |
496e7ce2 GU |
474 | { |
475 | return ERR_PTR(-ENOSYS); | |
476 | } | |
477 | ||
537b94da BB |
478 | static inline |
479 | struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev, | |
480 | const char *con_id, int index, | |
481 | struct fwnode_handle *child, | |
482 | enum gpiod_flags flags, | |
483 | const char *label) | |
484 | { | |
485 | return ERR_PTR(-ENOSYS); | |
486 | } | |
487 | ||
488 | #endif /* CONFIG_GPIOLIB */ | |
489 | ||
a264d10f | 490 | static inline |
4b094797 BB |
491 | struct gpio_desc *devm_fwnode_get_gpiod_from_child(struct device *dev, |
492 | const char *con_id, | |
493 | struct fwnode_handle *child, | |
494 | enum gpiod_flags flags, | |
495 | const char *label) | |
496e7ce2 | 496 | { |
537b94da BB |
497 | return devm_fwnode_get_index_gpiod_from_child(dev, con_id, 0, child, |
498 | flags, label); | |
496e7ce2 GU |
499 | } |
500 | ||
79a9becd AC |
501 | #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) |
502 | ||
503 | int gpiod_export(struct gpio_desc *desc, bool direction_may_change); | |
504 | int gpiod_export_link(struct device *dev, const char *name, | |
505 | struct gpio_desc *desc); | |
79a9becd AC |
506 | void gpiod_unexport(struct gpio_desc *desc); |
507 | ||
508 | #else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */ | |
509 | ||
510 | static inline int gpiod_export(struct gpio_desc *desc, | |
511 | bool direction_may_change) | |
512 | { | |
513 | return -ENOSYS; | |
514 | } | |
515 | ||
516 | static inline int gpiod_export_link(struct device *dev, const char *name, | |
517 | struct gpio_desc *desc) | |
518 | { | |
519 | return -ENOSYS; | |
520 | } | |
521 | ||
79a9becd AC |
522 | static inline void gpiod_unexport(struct gpio_desc *desc) |
523 | { | |
524 | } | |
525 | ||
526 | #endif /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */ | |
527 | ||
528 | #endif |