Linus Walleij | f626d6d | 2019-07-17 09:10:01 +0200 | [diff] [blame] | 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); |
Linus Walleij | f626d6d | 2019-07-17 09:10:01 +0200 | [diff] [blame] | 14 | int of_gpiochip_add(struct gpio_chip *gc); |
| 15 | void of_gpiochip_remove(struct gpio_chip *gc); |
| 16 | int of_gpio_get_count(struct device *dev, const char *con_id); |
Stephen Boyd | 49281a2 | 2019-08-01 00:28:26 +0200 | [diff] [blame] | 17 | bool of_gpio_need_valid_mask(const struct gpio_chip *gc); |
Linus Walleij | f626d6d | 2019-07-17 09:10:01 +0200 | [diff] [blame] | 18 | #else |
| 19 | static 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 Walleij | f626d6d | 2019-07-17 09:10:01 +0200 | [diff] [blame] | 26 | static inline int of_gpiochip_add(struct gpio_chip *gc) { return 0; } |
| 27 | static inline void of_gpiochip_remove(struct gpio_chip *gc) { } |
| 28 | static inline int of_gpio_get_count(struct device *dev, const char *con_id) |
| 29 | { |
| 30 | return 0; |
| 31 | } |
Stephen Boyd | 49281a2 | 2019-08-01 00:28:26 +0200 | [diff] [blame] | 32 | static inline bool of_gpio_need_valid_mask(const struct gpio_chip *gc) |
Linus Walleij | f626d6d | 2019-07-17 09:10:01 +0200 | [diff] [blame] | 33 | { |
| 34 | return false; |
| 35 | } |
| 36 | #endif /* CONFIG_OF_GPIO */ |
| 37 | |
| 38 | #endif /* GPIOLIB_OF_H */ |