391 lines · plain
1----------------------2ALPS Touchpad Protocol3----------------------4 5Introduction6------------7Currently the ALPS touchpad driver supports seven protocol versions in use by8ALPS touchpads, called versions 1, 2, 3, 4, 5, 6, 7 and 8.9 10Since roughly mid-2010 several new ALPS touchpads have been released and11integrated into a variety of laptops and netbooks. These new touchpads12have enough behavior differences that the alps_model_data definition13table, describing the properties of the different versions, is no longer14adequate. The design choices were to re-define the alps_model_data15table, with the risk of regression testing existing devices, or isolate16the new devices outside of the alps_model_data table. The latter design17choice was made. The new touchpad signatures are named: "Rushmore",18"Pinnacle", and "Dolphin", which you will see in the alps.c code.19For the purposes of this document, this group of ALPS touchpads will20generically be called "new ALPS touchpads".21 22We experimented with probing the ACPI interface _HID (Hardware ID)/_CID23(Compatibility ID) definition as a way to uniquely identify the24different ALPS variants but there did not appear to be a 1:1 mapping.25In fact, it appeared to be an m:n mapping between the _HID and actual26hardware type.27 28Detection29---------30 31All ALPS touchpads should respond to the "E6 report" command sequence:32E8-E6-E6-E6-E9. An ALPS touchpad should respond with either 00-00-0A or3300-00-64 if no buttons are pressed. The bits 0-2 of the first byte will be 1s34if some buttons are pressed.35 36If the E6 report is successful, the touchpad model is identified using the "E737report" sequence: E8-E7-E7-E7-E9. The response is the model signature and is38matched against known models in the alps_model_data_array.39 40For older touchpads supporting protocol versions 3 and 4, the E7 report41model signature is always 73-02-64. To differentiate between these42versions, the response from the "Enter Command Mode" sequence must be43inspected as described below.44 45The new ALPS touchpads have an E7 signature of 73-03-50 or 73-03-0A but46seem to be better differentiated by the EC Command Mode response.47 48Command Mode49------------50 51Protocol versions 3 and 4 have a command mode that is used to read and write52one-byte device registers in a 16-bit address space. The command sequence53EC-EC-EC-E9 places the device in command mode, and the device will respond54with 88-07 followed by a third byte. This third byte can be used to determine55whether the devices uses the version 3 or 4 protocol.56 57To exit command mode, PSMOUSE_CMD_SETSTREAM (EA) is sent to the touchpad.58 59While in command mode, register addresses can be set by first sending a60specific command, either EC for v3 devices or F5 for v4 devices. Then the61address is sent one nibble at a time, where each nibble is encoded as a62command with optional data. This encoding differs slightly between the v3 and63v4 protocols.64 65Once an address has been set, the addressed register can be read by sending66PSMOUSE_CMD_GETINFO (E9). The first two bytes of the response contains the67address of the register being read, and the third contains the value of the68register. Registers are written by writing the value one nibble at a time69using the same encoding used for addresses.70 71For the new ALPS touchpads, the EC command is used to enter command72mode. The response in the new ALPS touchpads is significantly different,73and more important in determining the behavior. This code has been74separated from the original alps_model_data table and put in the75alps_identify function. For example, there seem to be two hardware init76sequences for the "Dolphin" touchpads as determined by the second byte77of the EC response.78 79Packet Format80-------------81 82In the following tables, the following notation is used::83 84 CAPITALS = stick, miniscules = touchpad85 86?'s can have different meanings on different models, such as wheel rotation,87extra buttons, stick buttons on a dualpoint, etc.88 89PS/2 packet format90------------------91 92::93 94 byte 0: 0 0 YSGN XSGN 1 M R L95 byte 1: X7 X6 X5 X4 X3 X2 X1 X096 byte 2: Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y097 98Note that the device never signals overflow condition.99 100For protocol version 2 devices when the trackpoint is used, and no fingers101are on the touchpad, the M R L bits signal the combined status of both the102pointingstick and touchpad buttons.103 104ALPS Absolute Mode - Protocol Version 1105---------------------------------------106 107::108 109 byte 0: 1 0 0 0 1 x9 x8 x7110 byte 1: 0 x6 x5 x4 x3 x2 x1 x0111 byte 2: 0 ? ? l r ? fin ges112 byte 3: 0 ? ? ? ? y9 y8 y7113 byte 4: 0 y6 y5 y4 y3 y2 y1 y0114 byte 5: 0 z6 z5 z4 z3 z2 z1 z0115 116ALPS Absolute Mode - Protocol Version 2117---------------------------------------118 119::120 121 byte 0: 1 ? ? ? 1 PSM PSR PSL122 byte 1: 0 x6 x5 x4 x3 x2 x1 x0123 byte 2: 0 x10 x9 x8 x7 ? fin ges124 byte 3: 0 y9 y8 y7 1 M R L125 byte 4: 0 y6 y5 y4 y3 y2 y1 y0126 byte 5: 0 z6 z5 z4 z3 z2 z1 z0127 128Protocol Version 2 DualPoint devices send standard PS/2 mouse packets for129the DualPoint Stick. The M, R and L bits signal the combined status of both130the pointingstick and touchpad buttons, except for Dell dualpoint devices131where the pointingstick buttons get reported separately in the PSM, PSR132and PSL bits.133 134Dualpoint device -- interleaved packet format135---------------------------------------------136 137::138 139 byte 0: 1 1 0 0 1 1 1 1140 byte 1: 0 x6 x5 x4 x3 x2 x1 x0141 byte 2: 0 x10 x9 x8 x7 0 fin ges142 byte 3: 0 0 YSGN XSGN 1 1 1 1143 byte 4: X7 X6 X5 X4 X3 X2 X1 X0144 byte 5: Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0145 byte 6: 0 y9 y8 y7 1 m r l146 byte 7: 0 y6 y5 y4 y3 y2 y1 y0147 byte 8: 0 z6 z5 z4 z3 z2 z1 z0148 149Devices which use the interleaving format normally send standard PS/2 mouse150packets for the DualPoint Stick + ALPS Absolute Mode packets for the151touchpad, switching to the interleaved packet format when both the stick and152the touchpad are used at the same time.153 154ALPS Absolute Mode - Protocol Version 3155---------------------------------------156 157ALPS protocol version 3 has three different packet formats. The first two are158associated with touchpad events, and the third is associated with trackstick159events.160 161The first type is the touchpad position packet::162 163 byte 0: 1 ? x1 x0 1 1 1 1164 byte 1: 0 x10 x9 x8 x7 x6 x5 x4165 byte 2: 0 y10 y9 y8 y7 y6 y5 y4166 byte 3: 0 M R L 1 m r l167 byte 4: 0 mt x3 x2 y3 y2 y1 y0168 byte 5: 0 z6 z5 z4 z3 z2 z1 z0169 170Note that for some devices the trackstick buttons are reported in this packet,171and on others it is reported in the trackstick packets.172 173The second packet type contains bitmaps representing the x and y axes. In the174bitmaps a given bit is set if there is a finger covering that position on the175given axis. Thus the bitmap packet can be used for low-resolution multi-touch176data, although finger tracking is not possible. This packet also encodes the177number of contacts (f1 and f0 in the table below)::178 179 byte 0: 1 1 x1 x0 1 1 1 1180 byte 1: 0 x8 x7 x6 x5 x4 x3 x2181 byte 2: 0 y7 y6 y5 y4 y3 y2 y1182 byte 3: 0 y10 y9 y8 1 1 1 1183 byte 4: 0 x14 x13 x12 x11 x10 x9 y0184 byte 5: 0 1 ? ? ? ? f1 f0185 186This packet only appears after a position packet with the mt bit set, and187usually only appears when there are two or more contacts (although188occasionally it's seen with only a single contact).189 190The final v3 packet type is the trackstick packet::191 192 byte 0: 1 1 x7 y7 1 1 1 1193 byte 1: 0 x6 x5 x4 x3 x2 x1 x0194 byte 2: 0 y6 y5 y4 y3 y2 y1 y0195 byte 3: 0 1 TP SW 1 M R L196 byte 4: 0 z6 z5 z4 z3 z2 z1 z0197 byte 5: 0 0 1 1 1 1 1 1198 199TP means Tap SW status when tap processing is enabled or Press status when press200processing is enabled. SW means scroll up when 4 buttons are available.201 202ALPS Absolute Mode - Protocol Version 4203---------------------------------------204 205Protocol version 4 has an 8-byte packet format::206 207 byte 0: 1 ? x1 x0 1 1 1 1208 byte 1: 0 x10 x9 x8 x7 x6 x5 x4209 byte 2: 0 y10 y9 y8 y7 y6 y5 y4210 byte 3: 0 1 x3 x2 y3 y2 y1 y0211 byte 4: 0 ? ? ? 1 ? r l212 byte 5: 0 z6 z5 z4 z3 z2 z1 z0213 byte 6: bitmap data (described below)214 byte 7: bitmap data (described below)215 216The last two bytes represent a partial bitmap packet, with 3 full packets217required to construct a complete bitmap packet. Once assembled, the 6-byte218bitmap packet has the following format::219 220 byte 0: 0 1 x7 x6 x5 x4 x3 x2221 byte 1: 0 x1 x0 y4 y3 y2 y1 y0222 byte 2: 0 0 ? x14 x13 x12 x11 x10223 byte 3: 0 x9 x8 y9 y8 y7 y6 y5224 byte 4: 0 0 0 0 0 0 0 0225 byte 5: 0 0 0 0 0 0 0 y10226 227There are several things worth noting here.228 229 1) In the bitmap data, bit 6 of byte 0 serves as a sync byte to230 identify the first fragment of a bitmap packet.231 232 2) The bitmaps represent the same data as in the v3 bitmap packets, although233 the packet layout is different.234 235 3) There doesn't seem to be a count of the contact points anywhere in the v4236 protocol packets. Deriving a count of contact points must be done by237 analyzing the bitmaps.238 239 4) There is a 3 to 1 ratio of position packets to bitmap packets. Therefore240 MT position can only be updated for every third ST position update, and241 the count of contact points can only be updated every third packet as242 well.243 244So far no v4 devices with tracksticks have been encountered.245 246ALPS Absolute Mode - Protocol Version 5247---------------------------------------248This is basically Protocol Version 3 but with different logic for packet249decode. It uses the same alps_process_touchpad_packet_v3 call with a250specialized decode_fields function pointer to correctly interpret the251packets. This appears to only be used by the Dolphin devices.252 253For single-touch, the 6-byte packet format is::254 255 byte 0: 1 1 0 0 1 0 0 0256 byte 1: 0 x6 x5 x4 x3 x2 x1 x0257 byte 2: 0 y6 y5 y4 y3 y2 y1 y0258 byte 3: 0 M R L 1 m r l259 byte 4: y10 y9 y8 y7 x10 x9 x8 x7260 byte 5: 0 z6 z5 z4 z3 z2 z1 z0261 262For mt, the format is::263 264 byte 0: 1 1 1 n3 1 n2 n1 x24265 byte 1: 1 y7 y6 y5 y4 y3 y2 y1266 byte 2: ? x2 x1 y12 y11 y10 y9 y8267 byte 3: 0 x23 x22 x21 x20 x19 x18 x17268 byte 4: 0 x9 x8 x7 x6 x5 x4 x3269 byte 5: 0 x16 x15 x14 x13 x12 x11 x10270 271ALPS Absolute Mode - Protocol Version 6272---------------------------------------273 274For trackstick packet, the format is::275 276 byte 0: 1 1 1 1 1 1 1 1277 byte 1: 0 X6 X5 X4 X3 X2 X1 X0278 byte 2: 0 Y6 Y5 Y4 Y3 Y2 Y1 Y0279 byte 3: ? Y7 X7 ? ? M R L280 byte 4: Z7 Z6 Z5 Z4 Z3 Z2 Z1 Z0281 byte 5: 0 1 1 1 1 1 1 1282 283For touchpad packet, the format is::284 285 byte 0: 1 1 1 1 1 1 1 1286 byte 1: 0 0 0 0 x3 x2 x1 x0287 byte 2: 0 0 0 0 y3 y2 y1 y0288 byte 3: ? x7 x6 x5 x4 ? r l289 byte 4: ? y7 y6 y5 y4 ? ? ?290 byte 5: z7 z6 z5 z4 z3 z2 z1 z0291 292(v6 touchpad does not have middle button)293 294ALPS Absolute Mode - Protocol Version 7295---------------------------------------296 297For trackstick packet, the format is::298 299 byte 0: 0 1 0 0 1 0 0 0300 byte 1: 1 1 * * 1 M R L301 byte 2: X7 1 X5 X4 X3 X2 X1 X0302 byte 3: Z6 1 Y6 X6 1 Y2 Y1 Y0303 byte 4: Y7 0 Y5 Y4 Y3 1 1 0304 byte 5: T&P 0 Z5 Z4 Z3 Z2 Z1 Z0305 306For touchpad packet, the format is::307 308 packet-fmt b7 b6 b5 b4 b3 b2 b1 b0309 byte 0: TWO & MULTI L 1 R M 1 Y0-2 Y0-1 Y0-0310 byte 0: NEW L 1 X1-5 1 1 Y0-2 Y0-1 Y0-0311 byte 1: Y0-10 Y0-9 Y0-8 Y0-7 Y0-6 Y0-5 Y0-4 Y0-3312 byte 2: X0-11 1 X0-10 X0-9 X0-8 X0-7 X0-6 X0-5313 byte 3: X1-11 1 X0-4 X0-3 1 X0-2 X0-1 X0-0314 byte 4: TWO X1-10 TWO X1-9 X1-8 X1-7 X1-6 X1-5 X1-4315 byte 4: MULTI X1-10 TWO X1-9 X1-8 X1-7 X1-6 Y1-5 1316 byte 4: NEW X1-10 TWO X1-9 X1-8 X1-7 X1-6 0 0317 byte 5: TWO & NEW Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 Y1-5 Y1-4318 byte 5: MULTI Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 F-1 F-0319 320 L: Left button321 R / M: Non-clickpads: Right / Middle button322 Clickpads: When > 2 fingers are down, and some fingers323 are in the button area, then the 2 coordinates reported324 are for fingers outside the button area and these report325 extra fingers being present in the right / left button326 area. Note these fingers are not added to the F field!327 so if a TWO packet is received and R = 1 then there are328 3 fingers down, etc.329 TWO: 1: Two touches present, byte 0/4/5 are in TWO fmt330 0: If byte 4 bit 0 is 1, then byte 0/4/5 are in MULTI fmt331 otherwise byte 0 bit 4 must be set and byte 0/4/5 are332 in NEW fmt333 F: Number of fingers - 3, 0 means 3 fingers, 1 means 4 ...334 335 336ALPS Absolute Mode - Protocol Version 8337---------------------------------------338 339Spoken by SS4 (73 03 14) and SS5 (73 03 28) hardware.340 341The packet type is given by the APD field, bits 4-5 of byte 3.342 343Touchpad packet (APD = 0x2)::344 345 b7 b6 b5 b4 b3 b2 b1 b0346 byte 0: SWM SWR SWL 1 1 0 0 X7347 byte 1: 0 X6 X5 X4 X3 X2 X1 X0348 byte 2: 0 Y6 Y5 Y4 Y3 Y2 Y1 Y0349 byte 3: 0 T&P 1 0 1 0 0 Y7350 byte 4: 0 Z6 Z5 Z4 Z3 Z2 Z1 Z0351 byte 5: 0 0 0 0 0 0 0 0352 353SWM, SWR, SWL: Middle, Right, and Left button states354 355Touchpad 1 Finger packet (APD = 0x0)::356 357 b7 b6 b5 b4 b3 b2 b1 b0358 byte 0: SWM SWR SWL 1 1 X2 X1 X0359 byte 1: X9 X8 X7 1 X6 X5 X4 X3360 byte 2: 0 X11 X10 LFB Y3 Y2 Y1 Y0361 byte 3: Y5 Y4 0 0 1 TAPF2 TAPF1 TAPF0362 byte 4: Zv7 Y11 Y10 1 Y9 Y8 Y7 Y6363 byte 5: Zv6 Zv5 Zv4 0 Zv3 Zv2 Zv1 Zv0364 365TAPF: ???366LFB: ???367 368Touchpad 2 Finger packet (APD = 0x1)::369 370 b7 b6 b5 b4 b3 b2 b1 b0371 byte 0: SWM SWR SWL 1 1 AX6 AX5 AX4372 byte 1: AX11 AX10 AX9 AX8 AX7 AZ1 AY4 AZ0373 byte 2: AY11 AY10 AY9 CONT AY8 AY7 AY6 AY5374 byte 3: 0 0 0 1 1 BX6 BX5 BX4375 byte 4: BX11 BX10 BX9 BX8 BX7 BZ1 BY4 BZ0376 byte 5: BY11 BY10 BY9 0 BY8 BY7 BY5 BY5377 378CONT: A 3-or-4 Finger packet is to follow379 380Touchpad 3-or-4 Finger packet (APD = 0x3)::381 382 b7 b6 b5 b4 b3 b2 b1 b0383 byte 0: SWM SWR SWL 1 1 AX6 AX5 AX4384 byte 1: AX11 AX10 AX9 AX8 AX7 AZ1 AY4 AZ0385 byte 2: AY11 AY10 AY9 OVF AY8 AY7 AY6 AY5386 byte 3: 0 0 1 1 1 BX6 BX5 BX4387 byte 4: BX11 BX10 BX9 BX8 BX7 BZ1 BY4 BZ0388 byte 5: BY11 BY10 BY9 0 BY8 BY7 BY5 BY5389 390OVF: 5th finger detected391