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, 11 const char *con_id, 12 unsigned int idx, 13 unsigned long *lookupflags); 14 struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np, 15 const char *list_name, int index, enum of_gpio_flags *flags); 16 int of_gpiochip_add(struct gpio_chip *gc); 17 void of_gpiochip_remove(struct gpio_chip *gc); 18 int of_gpio_get_count(struct device *dev, const char *con_id); 19 bool of_gpio_need_valid_mask(struct gpio_chip *gc); 20 #else 21 static inline struct gpio_desc *of_find_gpio(struct device *dev, 22 const char *con_id, 23 unsigned int idx, 24 unsigned long *lookupflags) 25 { 26 return ERR_PTR(-ENOENT); 27 } 28 static inline struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np, 29 const char *list_name, int index, enum of_gpio_flags *flags) 30 { 31 return ERR_PTR(-ENOENT); 32 } 33 static inline int of_gpiochip_add(struct gpio_chip *gc) { return 0; } 34 static inline void of_gpiochip_remove(struct gpio_chip *gc) { } 35 static inline int of_gpio_get_count(struct device *dev, const char *con_id) 36 { 37 return 0; 38 } 39 static inline bool of_gpio_need_valid_mask(struct gpio_chip *gc) 40 { 41 return false; 42 } 43 #endif /* CONFIG_OF_GPIO */ 44 45 #endif /* GPIOLIB_OF_H */ 46