gpio_keys.h 1.7 KB

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