gpiolib-of.h 1.3 KB

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