trackpoint.h 4.8 KB

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