gpiolib.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Internal GPIO functions.
  3. *
  4. * Copyright (C) 2013, Intel Corporation
  5. * Author: Mika Westerberg <mika.westerberg@linux.intel.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef GPIOLIB_H
  12. #define GPIOLIB_H
  13. #include <linux/err.h>
  14. #include <linux/device.h>
  15. /**
  16. * struct acpi_gpio_info - ACPI GPIO specific information
  17. * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
  18. * @active_low: in case of @gpioint, the pin is active low
  19. */
  20. struct acpi_gpio_info {
  21. bool gpioint;
  22. bool active_low;
  23. };
  24. #ifdef CONFIG_ACPI
  25. void acpi_gpiochip_add(struct gpio_chip *chip);
  26. void acpi_gpiochip_remove(struct gpio_chip *chip);
  27. struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index,
  28. struct acpi_gpio_info *info);
  29. #else
  30. static inline void acpi_gpiochip_add(struct gpio_chip *chip) { }
  31. static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { }
  32. static inline struct gpio_desc *
  33. acpi_get_gpiod_by_index(struct device *dev, int index,
  34. struct acpi_gpio_info *info)
  35. {
  36. return ERR_PTR(-ENOSYS);
  37. }
  38. #endif
  39. #endif /* GPIOLIB_H */