keypad-pxa27x.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_ARCH_PXA27x_KEYPAD_H
  3. #define __ASM_ARCH_PXA27x_KEYPAD_H
  4. #include <linux/input.h>
  5. #include <linux/input/matrix_keypad.h>
  6. #define MAX_MATRIX_KEY_ROWS (8)
  7. #define MAX_MATRIX_KEY_COLS (8)
  8. #define MATRIX_ROW_SHIFT (3)
  9. #define MAX_DIRECT_KEY_NUM (8)
  10. /* pxa3xx keypad platform specific parameters
  11. *
  12. * NOTE:
  13. * 1. direct_key_num indicates the number of keys in the direct keypad
  14. * _plus_ the number of rotary-encoder sensor inputs, this can be
  15. * left as 0 if only rotary encoders are enabled, the driver will
  16. * automatically calculate this
  17. *
  18. * 2. direct_key_map is the key code map for the direct keys, if rotary
  19. * encoder(s) are enabled, direct key 0/1(2/3) will be ignored
  20. *
  21. * 3. rotary can be either interpreted as a relative input event (e.g.
  22. * REL_WHEEL/REL_HWHEEL) or specific keys (e.g. UP/DOWN/LEFT/RIGHT)
  23. *
  24. * 4. matrix key and direct key will use the same debounce_interval by
  25. * default, which should be sufficient in most cases
  26. *
  27. * pxa168 keypad platform specific parameter
  28. *
  29. * NOTE:
  30. * clear_wakeup_event callback is a workaround required to clear the
  31. * keypad interrupt. The keypad wake must be cleared in addition to
  32. * reading the MI/DI bits in the KPC register.
  33. */
  34. struct pxa27x_keypad_platform_data {
  35. /* code map for the matrix keys */
  36. const struct matrix_keymap_data *matrix_keymap_data;
  37. unsigned int matrix_key_rows;
  38. unsigned int matrix_key_cols;
  39. /* direct keys */
  40. int direct_key_num;
  41. unsigned int direct_key_map[MAX_DIRECT_KEY_NUM];
  42. /* the key output may be low active */
  43. int direct_key_low_active;
  44. /* give board a chance to choose the start direct key */
  45. unsigned int direct_key_mask;
  46. /* rotary encoders 0 */
  47. int enable_rotary0;
  48. int rotary0_rel_code;
  49. int rotary0_up_key;
  50. int rotary0_down_key;
  51. /* rotary encoders 1 */
  52. int enable_rotary1;
  53. int rotary1_rel_code;
  54. int rotary1_up_key;
  55. int rotary1_down_key;
  56. /* key debounce interval */
  57. unsigned int debounce_interval;
  58. /* clear wakeup event requirement for pxa168 */
  59. void (*clear_wakeup_event)(void);
  60. };
  61. extern void pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info);
  62. #endif /* __ASM_ARCH_PXA27x_KEYPAD_H */