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