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