gpio.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Generic GPIO API implementation for xtensa.
  3. *
  4. * Stolen from x86, which is derived from the generic GPIO API for powerpc:
  5. *
  6. * Copyright (c) 2007-2008 MontaVista Software, Inc.
  7. *
  8. * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. */
  15. #ifndef _ASM_XTENSA_GPIO_H
  16. #define _ASM_XTENSA_GPIO_H
  17. #include <asm-generic/gpio.h>
  18. #ifdef CONFIG_GPIOLIB
  19. /*
  20. * Just call gpiolib.
  21. */
  22. static inline int gpio_get_value(unsigned int gpio)
  23. {
  24. return __gpio_get_value(gpio);
  25. }
  26. static inline void gpio_set_value(unsigned int gpio, int value)
  27. {
  28. __gpio_set_value(gpio, value);
  29. }
  30. static inline int gpio_cansleep(unsigned int gpio)
  31. {
  32. return __gpio_cansleep(gpio);
  33. }
  34. static inline int gpio_to_irq(unsigned int gpio)
  35. {
  36. return __gpio_to_irq(gpio);
  37. }
  38. /*
  39. * Not implemented, yet.
  40. */
  41. static inline int irq_to_gpio(unsigned int irq)
  42. {
  43. return -EINVAL;
  44. }
  45. #endif /* CONFIG_GPIOLIB */
  46. #endif /* _ASM_XTENSA_GPIO_H */