gpio-switch.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * GPIO switch definitions
  3. *
  4. * Copyright (C) 2006 Nokia Corporation
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef __ASM_ARCH_OMAP_GPIO_SWITCH_H
  11. #define __ASM_ARCH_OMAP_GPIO_SWITCH_H
  12. #include <linux/types.h>
  13. /* Cover:
  14. * high -> closed
  15. * low -> open
  16. * Connection:
  17. * high -> connected
  18. * low -> disconnected
  19. * Activity:
  20. * high -> active
  21. * low -> inactive
  22. *
  23. */
  24. #define OMAP_GPIO_SWITCH_TYPE_COVER 0x0000
  25. #define OMAP_GPIO_SWITCH_TYPE_CONNECTION 0x0001
  26. #define OMAP_GPIO_SWITCH_TYPE_ACTIVITY 0x0002
  27. #define OMAP_GPIO_SWITCH_FLAG_INVERTED 0x0001
  28. #define OMAP_GPIO_SWITCH_FLAG_OUTPUT 0x0002
  29. struct omap_gpio_switch {
  30. const char *name;
  31. s16 gpio;
  32. unsigned flags:4;
  33. unsigned type:4;
  34. /* Time in ms to debounce when transitioning from
  35. * inactive state to active state. */
  36. u16 debounce_rising;
  37. /* Same for transition from active to inactive state. */
  38. u16 debounce_falling;
  39. /* notify board-specific code about state changes */
  40. void (* notify)(void *data, int state);
  41. void *notify_data;
  42. };
  43. /* Call at init time only */
  44. extern void omap_register_gpio_switches(const struct omap_gpio_switch *tbl,
  45. int count);
  46. #endif