gpio_tilt.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifndef _INPUT_GPIO_TILT_H
  2. #define _INPUT_GPIO_TILT_H
  3. /**
  4. * struct gpio_tilt_axis - Axis used by the tilt switch
  5. * @axis: Constant describing the axis, e.g. ABS_X
  6. * @min: minimum value for abs_param
  7. * @max: maximum value for abs_param
  8. * @fuzz: fuzz value for abs_param
  9. * @flat: flat value for abs_param
  10. */
  11. struct gpio_tilt_axis {
  12. int axis;
  13. int min;
  14. int max;
  15. int fuzz;
  16. int flat;
  17. };
  18. /**
  19. * struct gpio_tilt_state - state description
  20. * @gpios: bitfield of gpio target-states for the value
  21. * @axes: array containing the axes settings for the gpio state
  22. * The array indizes must correspond to the axes defined
  23. * in platform_data
  24. *
  25. * This structure describes a supported axis settings
  26. * and the necessary gpio-state which represent it.
  27. *
  28. * The n-th bit in the bitfield describes the state of the n-th GPIO
  29. * from the gpios-array defined in gpio_regulator_config below.
  30. */
  31. struct gpio_tilt_state {
  32. int gpios;
  33. int *axes;
  34. };
  35. /**
  36. * struct gpio_tilt_platform_data
  37. * @gpios: Array containing the gpios determining the tilt state
  38. * @nr_gpios: Number of gpios
  39. * @axes: Array of gpio_tilt_axis descriptions
  40. * @nr_axes: Number of axes
  41. * @states: Array of gpio_tilt_state entries describing
  42. * the gpio state for specific tilts
  43. * @nr_states: Number of states available
  44. * @debounce_interval: debounce ticks interval in msecs
  45. * @poll_interval: polling interval in msecs - for polling driver only
  46. * @enable: callback to enable the tilt switch
  47. * @disable: callback to disable the tilt switch
  48. *
  49. * This structure contains gpio-tilt-switch configuration
  50. * information that must be passed by platform code to the
  51. * gpio-tilt input driver.
  52. */
  53. struct gpio_tilt_platform_data {
  54. struct gpio *gpios;
  55. int nr_gpios;
  56. struct gpio_tilt_axis *axes;
  57. int nr_axes;
  58. struct gpio_tilt_state *states;
  59. int nr_states;
  60. int debounce_interval;
  61. unsigned int poll_interval;
  62. int (*enable)(struct device *dev);
  63. void (*disable)(struct device *dev);
  64. };
  65. #endif