xref: /openbmc/linux/include/linux/of_gpio.h (revision a99cc668)
1af6074fcSRob Herring /* SPDX-License-Identifier: GPL-2.0+ */
2863fbf49SAnton Vorontsov /*
3863fbf49SAnton Vorontsov  * OF helpers for the GPIO API
4863fbf49SAnton Vorontsov  *
5863fbf49SAnton Vorontsov  * Copyright (c) 2007-2008  MontaVista Software, Inc.
6863fbf49SAnton Vorontsov  *
7863fbf49SAnton Vorontsov  * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
8863fbf49SAnton Vorontsov  */
9863fbf49SAnton Vorontsov 
10863fbf49SAnton Vorontsov #ifndef __LINUX_OF_GPIO_H
11863fbf49SAnton Vorontsov #define __LINUX_OF_GPIO_H
12863fbf49SAnton Vorontsov 
13b908b53dSAnton Vorontsov #include <linux/compiler.h>
14046e14afSAndy Shevchenko #include <linux/gpio/driver.h>
15046e14afSAndy Shevchenko #include <linux/gpio.h>		/* FIXME: Shouldn't be here */
1615c9a0acSGrant Likely #include <linux/of.h>
17863fbf49SAnton Vorontsov 
18b908b53dSAnton Vorontsov struct device_node;
19b908b53dSAnton Vorontsov 
20863fbf49SAnton Vorontsov #ifdef CONFIG_OF_GPIO
21863fbf49SAnton Vorontsov 
22*40fc56eeSDmitry Torokhov extern int of_get_named_gpio(const struct device_node *np,
23*40fc56eeSDmitry Torokhov 			     const char *list_name, int index);
24a6b09191SJohn Bonesio 
25a19e3da5SAnton Vorontsov #else /* CONFIG_OF_GPIO */
26863fbf49SAnton Vorontsov 
27046e14afSAndy Shevchenko #include <linux/errno.h>
28046e14afSAndy Shevchenko 
29863fbf49SAnton Vorontsov /* Drivers may not strictly depend on the GPIO support, so let them link. */
of_get_named_gpio(const struct device_node * np,const char * propname,int index)30*40fc56eeSDmitry Torokhov static inline int of_get_named_gpio(const struct device_node *np,
31*40fc56eeSDmitry Torokhov                                    const char *propname, int index)
32863fbf49SAnton Vorontsov {
33f01d9075SAlexandre Courbot 	return -ENOSYS;
34863fbf49SAnton Vorontsov }
35863fbf49SAnton Vorontsov 
36863fbf49SAnton Vorontsov #endif /* CONFIG_OF_GPIO */
37863fbf49SAnton Vorontsov 
38863fbf49SAnton Vorontsov #endif /* __LINUX_OF_GPIO_H */
39