1 /* SPDX-License-Identifier: GPL-2.0 */
2
3 #ifndef GPIOLIB_OF_H
4 #define GPIOLIB_OF_H
5
6 struct gpio_chip;
7 enum of_gpio_flags;
8
9 #ifdef CONFIG_OF_GPIO
10 struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, unsigned int idx, unsigned long *lookupflags);
11 int of_gpiochip_add(struct gpio_chip *gc);
12 void of_gpiochip_remove(struct gpio_chip *gc);
13 int of_gpio_get_count(struct device *dev, const char *con_id);
14 bool of_gpio_need_valid_mask(const struct gpio_chip *gc);
15 void of_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev);
16 #else
of_find_gpio(struct device * dev,const char * con_id,unsigned int idx,unsigned long * lookupflags)17 static inline struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, unsigned int idx,
18 unsigned long *lookupflags)
19 {
20 return ERR_PTR(-ENOENT);
21 }
of_gpiochip_add(struct gpio_chip * gc)22 static inline int of_gpiochip_add(struct gpio_chip *gc)
23 {
24 return 0;
25 }
of_gpiochip_remove(struct gpio_chip * gc)26 static inline void of_gpiochip_remove(struct gpio_chip *gc)
27 {
28 }
of_gpio_get_count(struct device * dev,const char * con_id)29 static inline int of_gpio_get_count(struct device *dev, const char *con_id)
30 {
31 return 0;
32 }
of_gpio_need_valid_mask(const struct gpio_chip * gc)33 static inline bool of_gpio_need_valid_mask(const struct gpio_chip *gc)
34 {
35 return false;
36 }
of_gpio_dev_init(struct gpio_chip * gc,struct gpio_device * gdev)37 static inline void of_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev)
38 {
39 }
40 #endif /* CONFIG_OF_GPIO */
41
42 extern struct notifier_block gpio_of_notifier;
43
44 #endif /* GPIOLIB_OF_H */
45