elantech.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * Elantech Touchpad driver (v6)
  3. *
  4. * Copyright (C) 2007-2009 Arjan Opmeer <arjan@opmeer.net>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 as published
  8. * by the Free Software Foundation.
  9. *
  10. * Trademarks are the property of their respective owners.
  11. */
  12. #ifndef _ELANTECH_H
  13. #define _ELANTECH_H
  14. /*
  15. * Command values for Synaptics style queries
  16. */
  17. #define ETP_FW_VERSION_QUERY 0x01
  18. #define ETP_CAPABILITIES_QUERY 0x02
  19. /*
  20. * Command values for register reading or writing
  21. */
  22. #define ETP_REGISTER_READ 0x10
  23. #define ETP_REGISTER_WRITE 0x11
  24. /*
  25. * Hardware version 2 custom PS/2 command value
  26. */
  27. #define ETP_PS2_CUSTOM_COMMAND 0xf8
  28. /*
  29. * Times to retry a ps2_command and millisecond delay between tries
  30. */
  31. #define ETP_PS2_COMMAND_TRIES 3
  32. #define ETP_PS2_COMMAND_DELAY 500
  33. /*
  34. * Times to try to read back a register and millisecond delay between tries
  35. */
  36. #define ETP_READ_BACK_TRIES 5
  37. #define ETP_READ_BACK_DELAY 2000
  38. /*
  39. * Register bitmasks for hardware version 1
  40. */
  41. #define ETP_R10_ABSOLUTE_MODE 0x04
  42. #define ETP_R11_4_BYTE_MODE 0x02
  43. /*
  44. * Capability bitmasks
  45. */
  46. #define ETP_CAP_HAS_ROCKER 0x04
  47. /*
  48. * One hard to find application note states that X axis range is 0 to 576
  49. * and Y axis range is 0 to 384 for harware version 1.
  50. * Edge fuzz might be necessary because of bezel around the touchpad
  51. */
  52. #define ETP_EDGE_FUZZ_V1 32
  53. #define ETP_XMIN_V1 ( 0 + ETP_EDGE_FUZZ_V1)
  54. #define ETP_XMAX_V1 (576 - ETP_EDGE_FUZZ_V1)
  55. #define ETP_YMIN_V1 ( 0 + ETP_EDGE_FUZZ_V1)
  56. #define ETP_YMAX_V1 (384 - ETP_EDGE_FUZZ_V1)
  57. /*
  58. * It seems the resolution for hardware version 2 doubled.
  59. * Hence the X and Y ranges are doubled too.
  60. * The bezel around the pad also appears to be smaller
  61. */
  62. #define ETP_EDGE_FUZZ_V2 8
  63. #define ETP_XMIN_V2 ( 0 + ETP_EDGE_FUZZ_V2)
  64. #define ETP_XMAX_V2 (1152 - ETP_EDGE_FUZZ_V2)
  65. #define ETP_YMIN_V2 ( 0 + ETP_EDGE_FUZZ_V2)
  66. #define ETP_YMAX_V2 ( 768 - ETP_EDGE_FUZZ_V2)
  67. /*
  68. * For two finger touches the coordinate of each finger gets reported
  69. * separately but with reduced resolution.
  70. */
  71. #define ETP_2FT_FUZZ 4
  72. #define ETP_2FT_XMIN ( 0 + ETP_2FT_FUZZ)
  73. #define ETP_2FT_XMAX (288 - ETP_2FT_FUZZ)
  74. #define ETP_2FT_YMIN ( 0 + ETP_2FT_FUZZ)
  75. #define ETP_2FT_YMAX (192 - ETP_2FT_FUZZ)
  76. struct elantech_data {
  77. unsigned char reg_10;
  78. unsigned char reg_11;
  79. unsigned char reg_20;
  80. unsigned char reg_21;
  81. unsigned char reg_22;
  82. unsigned char reg_23;
  83. unsigned char reg_24;
  84. unsigned char reg_25;
  85. unsigned char reg_26;
  86. unsigned char debug;
  87. unsigned char capabilities;
  88. unsigned char fw_version_maj;
  89. unsigned char fw_version_min;
  90. unsigned char hw_version;
  91. unsigned char paritycheck;
  92. unsigned char jumpy_cursor;
  93. unsigned char parity[256];
  94. };
  95. #ifdef CONFIG_MOUSE_PS2_ELANTECH
  96. int elantech_detect(struct psmouse *psmouse, int set_properties);
  97. int elantech_init(struct psmouse *psmouse);
  98. #else
  99. static inline int elantech_detect(struct psmouse *psmouse, int set_properties)
  100. {
  101. return -ENOSYS;
  102. }
  103. static inline int elantech_init(struct psmouse *psmouse)
  104. {
  105. return -ENOSYS;
  106. }
  107. #endif /* CONFIG_MOUSE_PS2_ELANTECH */
  108. #endif