/drivers/input/mouse/trackpoint.h

http://github.com/mirrors/linux · C Header · 160 lines · 89 code · 26 blank · 45 comment · 0 complexity · 12d7b4a9766270e6bfb59c40819f1e95 MD5 · raw file

  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * IBM TrackPoint PS/2 mouse driver
  4. *
  5. * Stephen Evanchik <evanchsa@gmail.com>
  6. */
  7. #ifndef _TRACKPOINT_H
  8. #define _TRACKPOINT_H
  9. /*
  10. * These constants are from the TrackPoint System
  11. * Engineering documentation Version 4 from IBM Watson
  12. * research:
  13. * http://wwwcssrv.almaden.ibm.com/trackpoint/download.html
  14. */
  15. #define TP_COMMAND 0xE2 /* Commands start with this */
  16. #define TP_READ_ID 0xE1 /* Sent for device identification */
  17. /*
  18. * Valid first byte responses to the "Read Secondary ID" (0xE1) command.
  19. * 0x01 was the original IBM trackpoint, others implement very limited
  20. * subset of trackpoint features.
  21. */
  22. #define TP_VARIANT_IBM 0x01
  23. #define TP_VARIANT_ALPS 0x02
  24. #define TP_VARIANT_ELAN 0x03
  25. #define TP_VARIANT_NXP 0x04
  26. /*
  27. * Commands
  28. */
  29. #define TP_RECALIB 0x51 /* Recalibrate */
  30. #define TP_POWER_DOWN 0x44 /* Can only be undone through HW reset */
  31. #define TP_EXT_DEV 0x21 /* Determines if external device is connected (RO) */
  32. #define TP_EXT_BTN 0x4B /* Read extended button status */
  33. #define TP_POR 0x7F /* Execute Power on Reset */
  34. #define TP_POR_RESULTS 0x25 /* Read Power on Self test results */
  35. #define TP_DISABLE_EXT 0x40 /* Disable external pointing device */
  36. #define TP_ENABLE_EXT 0x41 /* Enable external pointing device */
  37. /*
  38. * Mode manipulation
  39. */
  40. #define TP_SET_SOFT_TRANS 0x4E /* Set mode */
  41. #define TP_CANCEL_SOFT_TRANS 0xB9 /* Cancel mode */
  42. #define TP_SET_HARD_TRANS 0x45 /* Mode can only be set */
  43. /*
  44. * Register oriented commands/properties
  45. */
  46. #define TP_WRITE_MEM 0x81
  47. #define TP_READ_MEM 0x80 /* Not used in this implementation */
  48. /*
  49. * RAM Locations for properties
  50. */
  51. #define TP_SENS 0x4A /* Sensitivity */
  52. #define TP_MB 0x4C /* Read Middle Button Status (RO) */
  53. #define TP_INERTIA 0x4D /* Negative Inertia */
  54. #define TP_SPEED 0x60 /* Speed of TP Cursor */
  55. #define TP_REACH 0x57 /* Backup for Z-axis press */
  56. #define TP_DRAGHYS 0x58 /* Drag Hysteresis */
  57. /* (how hard it is to drag */
  58. /* with Z-axis pressed) */
  59. #define TP_MINDRAG 0x59 /* Minimum amount of force needed */
  60. /* to trigger dragging */
  61. #define TP_THRESH 0x5C /* Minimum value for a Z-axis press */
  62. #define TP_UP_THRESH 0x5A /* Used to generate a 'click' on Z-axis */
  63. #define TP_Z_TIME 0x5E /* How sharp of a press */
  64. #define TP_JENKS_CURV 0x5D /* Minimum curvature for double click */
  65. #define TP_DRIFT_TIME 0x5F /* How long a 'hands off' condition */
  66. /* must last (x*107ms) for drift */
  67. /* correction to occur */
  68. /*
  69. * Toggling Flag bits
  70. */
  71. #define TP_TOGGLE 0x47 /* Toggle command */
  72. #define TP_TOGGLE_MB 0x23 /* Disable/Enable Middle Button */
  73. #define TP_MASK_MB 0x01
  74. #define TP_TOGGLE_EXT_DEV 0x23 /* Disable external device */
  75. #define TP_MASK_EXT_DEV 0x02
  76. #define TP_TOGGLE_DRIFT 0x23 /* Drift Correction */
  77. #define TP_MASK_DRIFT 0x80
  78. #define TP_TOGGLE_BURST 0x28 /* Burst Mode */
  79. #define TP_MASK_BURST 0x80
  80. #define TP_TOGGLE_PTSON 0x2C /* Press to Select */
  81. #define TP_MASK_PTSON 0x01
  82. #define TP_TOGGLE_HARD_TRANS 0x2C /* Alternate method to set Hard Transparency */
  83. #define TP_MASK_HARD_TRANS 0x80
  84. #define TP_TOGGLE_TWOHAND 0x2D /* Two handed */
  85. #define TP_MASK_TWOHAND 0x01
  86. #define TP_TOGGLE_STICKY_TWO 0x2D /* Sticky two handed */
  87. #define TP_MASK_STICKY_TWO 0x04
  88. #define TP_TOGGLE_SKIPBACK 0x2D /* Suppress movement after drag release */
  89. #define TP_MASK_SKIPBACK 0x08
  90. #define TP_TOGGLE_SOURCE_TAG 0x20 /* Bit 3 of the first packet will be set to
  91. to the origin of the packet (external or TP) */
  92. #define TP_MASK_SOURCE_TAG 0x80
  93. #define TP_TOGGLE_EXT_TAG 0x22 /* Bit 3 of the first packet coming from the
  94. external device will be forced to 1 */
  95. #define TP_MASK_EXT_TAG 0x04
  96. /* Power on Self Test Results */
  97. #define TP_POR_SUCCESS 0x3B
  98. /*
  99. * Default power on values
  100. */
  101. #define TP_DEF_SENS 0x80
  102. #define TP_DEF_INERTIA 0x06
  103. #define TP_DEF_SPEED 0x61
  104. #define TP_DEF_REACH 0x0A
  105. #define TP_DEF_DRAGHYS 0xFF
  106. #define TP_DEF_MINDRAG 0x14
  107. #define TP_DEF_THRESH 0x08
  108. #define TP_DEF_UP_THRESH 0xFF
  109. #define TP_DEF_Z_TIME 0x26
  110. #define TP_DEF_JENKS_CURV 0x87
  111. #define TP_DEF_DRIFT_TIME 0x05
  112. /* Toggles */
  113. #define TP_DEF_MB 0x00
  114. #define TP_DEF_PTSON 0x00
  115. #define TP_DEF_SKIPBACK 0x00
  116. #define TP_DEF_EXT_DEV 0x00 /* 0 means enabled */
  117. #define TP_DEF_TWOHAND 0x00
  118. #define TP_DEF_SOURCE_TAG 0x00
  119. #define MAKE_PS2_CMD(params, results, cmd) ((params<<12) | (results<<8) | (cmd))
  120. struct trackpoint_data {
  121. u8 variant_id;
  122. u8 firmware_id;
  123. u8 sensitivity, speed, inertia, reach;
  124. u8 draghys, mindrag;
  125. u8 thresh, upthresh;
  126. u8 ztime, jenks;
  127. u8 drift_time;
  128. /* toggles */
  129. bool press_to_select;
  130. bool skipback;
  131. bool ext_dev;
  132. };
  133. int trackpoint_detect(struct psmouse *psmouse, bool set_properties);
  134. #endif /* _TRACKPOINT_H */