acpi_gpio.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef _LINUX_ACPI_GPIO_H_
  2. #define _LINUX_ACPI_GPIO_H_
  3. #include <linux/device.h>
  4. #include <linux/err.h>
  5. #include <linux/errno.h>
  6. #include <linux/gpio.h>
  7. #include <linux/gpio/consumer.h>
  8. /**
  9. * struct acpi_gpio_info - ACPI GPIO specific information
  10. * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
  11. */
  12. struct acpi_gpio_info {
  13. bool gpioint;
  14. };
  15. #ifdef CONFIG_GPIO_ACPI
  16. struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index,
  17. struct acpi_gpio_info *info);
  18. void acpi_gpiochip_request_interrupts(struct gpio_chip *chip);
  19. void acpi_gpiochip_free_interrupts(struct gpio_chip *chip);
  20. #else /* CONFIG_GPIO_ACPI */
  21. static inline struct gpio_desc *
  22. acpi_get_gpiod_by_index(struct device *dev, int index,
  23. struct acpi_gpio_info *info)
  24. {
  25. return ERR_PTR(-ENOSYS);
  26. }
  27. static inline void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { }
  28. static inline void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { }
  29. #endif /* CONFIG_GPIO_ACPI */
  30. static inline int acpi_get_gpio_by_index(struct device *dev, int index,
  31. struct acpi_gpio_info *info)
  32. {
  33. struct gpio_desc *desc = acpi_get_gpiod_by_index(dev, index, info);
  34. if (IS_ERR(desc))
  35. return PTR_ERR(desc);
  36. return desc_to_gpio(desc);
  37. }
  38. #endif /* _LINUX_ACPI_GPIO_H_ */