blob: 9768831b1fe2f25ba88e04fa120cd4dc9e48543a [file] [log] [blame]
Linus Walleijf626d6d2019-07-17 09:10:01 +02001/* SPDX-License-Identifier: GPL-2.0 */
2
3#ifndef GPIOLIB_OF_H
4#define GPIOLIB_OF_H
5
6struct gpio_chip;
7enum of_gpio_flags;
8
9#ifdef CONFIG_OF_GPIO
10struct gpio_desc *of_find_gpio(struct device *dev,
11 const char *con_id,
12 unsigned int idx,
13 unsigned long *lookupflags);
Linus Walleijf626d6d2019-07-17 09:10:01 +020014int of_gpiochip_add(struct gpio_chip *gc);
15void of_gpiochip_remove(struct gpio_chip *gc);
16int of_gpio_get_count(struct device *dev, const char *con_id);
Stephen Boyd49281a22019-08-01 00:28:26 +020017bool of_gpio_need_valid_mask(const struct gpio_chip *gc);
Linus Walleijf626d6d2019-07-17 09:10:01 +020018#else
19static inline struct gpio_desc *of_find_gpio(struct device *dev,
20 const char *con_id,
21 unsigned int idx,
22 unsigned long *lookupflags)
23{
24 return ERR_PTR(-ENOENT);
25}
Linus Walleijf626d6d2019-07-17 09:10:01 +020026static inline int of_gpiochip_add(struct gpio_chip *gc) { return 0; }
27static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
28static inline int of_gpio_get_count(struct device *dev, const char *con_id)
29{
30 return 0;
31}
Stephen Boyd49281a22019-08-01 00:28:26 +020032static inline bool of_gpio_need_valid_mask(const struct gpio_chip *gc)
Linus Walleijf626d6d2019-07-17 09:10:01 +020033{
34 return false;
35}
36#endif /* CONFIG_OF_GPIO */
37
38#endif /* GPIOLIB_OF_H */