gpiolib-acpi.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * ACPI helpers for GPIO API
  4. *
  5. * Copyright (C) 2012,2019 Intel Corporation
  6. */
  7. #ifndef GPIOLIB_ACPI_H
  8. #define GPIOLIB_ACPI_H
  9. #include <linux/err.h>
  10. #include <linux/types.h>
  11. #include <linux/gpio/consumer.h>
  12. struct device;
  13. struct fwnode_handle;
  14. struct gpio_chip;
  15. struct gpio_desc;
  16. struct gpio_device;
  17. #ifdef CONFIG_ACPI
  18. void acpi_gpiochip_add(struct gpio_chip *chip);
  19. void acpi_gpiochip_remove(struct gpio_chip *chip);
  20. void acpi_gpiochip_request_interrupts(struct gpio_chip *chip);
  21. void acpi_gpiochip_free_interrupts(struct gpio_chip *chip);
  22. struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
  23. const char *con_id,
  24. unsigned int idx,
  25. enum gpiod_flags *dflags,
  26. unsigned long *lookupflags);
  27. int acpi_gpio_count(const struct fwnode_handle *fwnode, const char *con_id);
  28. #else
  29. static inline void acpi_gpiochip_add(struct gpio_chip *chip) { }
  30. static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { }
  31. static inline void
  32. acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { }
  33. static inline void
  34. acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { }
  35. static inline struct gpio_desc *
  36. acpi_find_gpio(struct fwnode_handle *fwnode, const char *con_id,
  37. unsigned int idx, enum gpiod_flags *dflags,
  38. unsigned long *lookupflags)
  39. {
  40. return ERR_PTR(-ENOENT);
  41. }
  42. static inline int acpi_gpio_count(const struct fwnode_handle *fwnode,
  43. const char *con_id)
  44. {
  45. return -ENODEV;
  46. }
  47. #endif
  48. #endif /* GPIOLIB_ACPI_H */