gpio_keys.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef _GPIO_KEYS_H
  2. #define _GPIO_KEYS_H
  3. struct device;
  4. /**
  5. * struct gpio_keys_button - configuration parameters
  6. * @code: input event code (KEY_*, SW_*)
  7. * @gpio: %-1 if this key does not support gpio
  8. * @active_low: %true indicates that button is considered
  9. * depressed when gpio is low
  10. * @desc: label that will be attached to button's gpio
  11. * @type: input event type (%EV_KEY, %EV_SW, %EV_ABS)
  12. * @wakeup: configure the button as a wake-up source
  13. * @debounce_interval: debounce ticks interval in msecs
  14. * @can_disable: %true indicates that userspace is allowed to
  15. * disable button via sysfs
  16. * @value: axis value for %EV_ABS
  17. * @irq: Irq number in case of interrupt keys
  18. */
  19. struct gpio_keys_button {
  20. unsigned int code;
  21. int gpio;
  22. int active_low;
  23. const char *desc;
  24. unsigned int type;
  25. int wakeup;
  26. int debounce_interval;
  27. bool can_disable;
  28. int value;
  29. unsigned int irq;
  30. };
  31. /**
  32. * struct gpio_keys_platform_data - platform data for gpio_keys driver
  33. * @buttons: pointer to array of &gpio_keys_button structures
  34. * describing buttons attached to the device
  35. * @nbuttons: number of elements in @buttons array
  36. * @poll_interval: polling interval in msecs - for polling driver only
  37. * @rep: enable input subsystem auto repeat
  38. * @enable: platform hook for enabling the device
  39. * @disable: platform hook for disabling the device
  40. * @name: input device name
  41. */
  42. struct gpio_keys_platform_data {
  43. struct gpio_keys_button *buttons;
  44. int nbuttons;
  45. unsigned int poll_interval;
  46. unsigned int rep:1;
  47. int (*enable)(struct device *dev);
  48. void (*disable)(struct device *dev);
  49. const char *name;
  50. };
  51. #endif