xref: /openbmc/linux/include/linux/of_gpio.h (revision fa0dadde)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * OF helpers for the GPIO API
4  *
5  * Copyright (c) 2007-2008  MontaVista Software, Inc.
6  *
7  * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
8  */
9 
10 #ifndef __LINUX_OF_GPIO_H
11 #define __LINUX_OF_GPIO_H
12 
13 #include <linux/compiler.h>
14 #include <linux/gpio/driver.h>
15 #include <linux/gpio.h>		/* FIXME: Shouldn't be here */
16 #include <linux/of.h>
17 
18 struct device_node;
19 
20 #ifdef CONFIG_OF_GPIO
21 
22 extern int of_get_named_gpio(const struct device_node *np,
23 			     const char *list_name, int index);
24 
25 #else /* CONFIG_OF_GPIO */
26 
27 #include <linux/errno.h>
28 
29 /* Drivers may not strictly depend on the GPIO support, so let them link. */
30 static inline int of_get_named_gpio(const struct device_node *np,
31                                    const char *propname, int index)
32 {
33 	return -ENOSYS;
34 }
35 
36 #endif /* CONFIG_OF_GPIO */
37 
38 #endif /* __LINUX_OF_GPIO_H */
39