gpio_keys.h 1.7 KB

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