Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / Documentation / input / sentelic.txt
1 Copyright (C) 2002-2011 Sentelic Corporation.
2 Last update: Dec-07-2011
3
4 ==============================================================================
5 * Finger Sensing Pad Intellimouse Mode(scrolling wheel, 4th and 5th buttons)
6 ==============================================================================
7 A) MSID 4: Scrolling wheel mode plus Forward page(4th button) and Backward
8    page (5th button)
9 @1. Set sample rate to 200;
10 @2. Set sample rate to 200;
11 @3. Set sample rate to 80;
12 @4. Issuing the "Get device ID" command (0xF2) and waits for the response;
13 @5. FSP will respond 0x04.
14
15 Packet 1
16    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
17 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
18   1   |Y|X|y|x|1|M|R|L|  2  |X|X|X|X|X|X|X|X|  3 |Y|Y|Y|Y|Y|Y|Y|Y|  4 | | |B|F|W|W|W|W|
19       |---------------|     |---------------|    |---------------|    |---------------|
20
21 Byte 1: Bit7 => Y overflow
22         Bit6 => X overflow
23         Bit5 => Y sign bit
24         Bit4 => X sign bit
25         Bit3 => 1
26         Bit2 => Middle Button, 1 is pressed, 0 is not pressed.
27         Bit1 => Right Button, 1 is pressed, 0 is not pressed.
28         Bit0 => Left Button, 1 is pressed, 0 is not pressed.
29 Byte 2: X Movement(9-bit 2's complement integers)
30 Byte 3: Y Movement(9-bit 2's complement integers)
31 Byte 4: Bit3~Bit0 => the scrolling wheel's movement since the last data report.
32                      valid values, -8 ~ +7
33         Bit4 => 1 = 4th mouse button is pressed, Forward one page.
34                 0 = 4th mouse button is not pressed.
35         Bit5 => 1 = 5th mouse button is pressed, Backward one page.
36                 0 = 5th mouse button is not pressed.
37
38 B) MSID 6: Horizontal and Vertical scrolling.
39 @ Set bit 1 in register 0x40 to 1
40
41 # FSP replaces scrolling wheel's movement as 4 bits to show horizontal and
42   vertical scrolling.
43
44 Packet 1
45    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
46 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
47   1   |Y|X|y|x|1|M|R|L|  2  |X|X|X|X|X|X|X|X|  3 |Y|Y|Y|Y|Y|Y|Y|Y|  4 | | |B|F|r|l|u|d|
48       |---------------|     |---------------|    |---------------|    |---------------|
49
50 Byte 1: Bit7 => Y overflow
51         Bit6 => X overflow
52         Bit5 => Y sign bit
53         Bit4 => X sign bit
54         Bit3 => 1
55         Bit2 => Middle Button, 1 is pressed, 0 is not pressed.
56         Bit1 => Right Button, 1 is pressed, 0 is not pressed.
57         Bit0 => Left Button, 1 is pressed, 0 is not pressed.
58 Byte 2: X Movement(9-bit 2's complement integers)
59 Byte 3: Y Movement(9-bit 2's complement integers)
60 Byte 4: Bit0 => the Vertical scrolling movement downward.
61         Bit1 => the Vertical scrolling movement upward.
62         Bit2 => the Horizontal scrolling movement leftward.
63         Bit3 => the Horizontal scrolling movement rightward.
64         Bit4 => 1 = 4th mouse button is pressed, Forward one page.
65                 0 = 4th mouse button is not pressed.
66         Bit5 => 1 = 5th mouse button is pressed, Backward one page.
67                 0 = 5th mouse button is not pressed.
68
69 C) MSID 7:
70 # FSP uses 2 packets (8 Bytes) to represent Absolute Position.
71   so we have PACKET NUMBER to identify packets.
72   If PACKET NUMBER is 0, the packet is Packet 1.
73   If PACKET NUMBER is 1, the packet is Packet 2.
74   Please count this number in program.
75
76 # MSID6 special packet will be enable at the same time when enable MSID 7.
77
78 ==============================================================================
79 * Absolute position for STL3886-G0.
80 ==============================================================================
81 @ Set bit 2 or 3 in register 0x40 to 1
82 @ Set bit 6 in register 0x40 to 1
83
84 Packet 1 (ABSOLUTE POSITION)
85    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
86 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
87   1   |0|1|V|1|1|M|R|L|  2  |X|X|X|X|X|X|X|X|  3 |Y|Y|Y|Y|Y|Y|Y|Y|  4 |r|l|d|u|X|X|Y|Y|
88       |---------------|     |---------------|    |---------------|    |---------------|
89
90 Byte 1: Bit7~Bit6 => 00, Normal data packet
91                   => 01, Absolute coordination packet
92                   => 10, Notify packet
93         Bit5 => valid bit
94         Bit4 => 1
95         Bit3 => 1
96         Bit2 => Middle Button, 1 is pressed, 0 is not pressed.
97         Bit1 => Right Button, 1 is pressed, 0 is not pressed.
98         Bit0 => Left Button, 1 is pressed, 0 is not pressed.
99 Byte 2: X coordinate (xpos[9:2])
100 Byte 3: Y coordinate (ypos[9:2])
101 Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0])
102         Bit3~Bit2 => X coordinate (ypos[1:0])
103         Bit4 => scroll up
104         Bit5 => scroll down
105         Bit6 => scroll left
106         Bit7 => scroll right
107
108 Notify Packet for G0
109    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
110 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
111   1   |1|0|0|1|1|M|R|L|  2  |C|C|C|C|C|C|C|C|  3 |M|M|M|M|M|M|M|M|  4 |0|0|0|0|0|0|0|0|
112       |---------------|     |---------------|    |---------------|    |---------------|
113
114 Byte 1: Bit7~Bit6 => 00, Normal data packet
115                   => 01, Absolute coordination packet
116                   => 10, Notify packet
117         Bit5 => 0
118         Bit4 => 1
119         Bit3 => 1
120         Bit2 => Middle Button, 1 is pressed, 0 is not pressed.
121         Bit1 => Right Button, 1 is pressed, 0 is not pressed.
122         Bit0 => Left Button, 1 is pressed, 0 is not pressed.
123 Byte 2: Message Type => 0x5A (Enable/Disable status packet)
124         Mode Type => 0xA5 (Normal/Icon mode status)
125 Byte 3: Message Type => 0x00 (Disabled)
126                      => 0x01 (Enabled)
127         Mode Type    => 0x00 (Normal)
128                      => 0x01 (Icon)
129 Byte 4: Bit7~Bit0 => Don't Care
130
131 ==============================================================================
132 * Absolute position for STL3888-Ax.
133 ==============================================================================
134 Packet 1 (ABSOLUTE POSITION)
135    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
136 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
137   1   |0|1|V|A|1|L|0|1|  2  |X|X|X|X|X|X|X|X|  3 |Y|Y|Y|Y|Y|Y|Y|Y|  4 |x|x|y|y|X|X|Y|Y|
138       |---------------|     |---------------|    |---------------|    |---------------|
139
140 Byte 1: Bit7~Bit6 => 00, Normal data packet
141                   => 01, Absolute coordination packet
142                   => 10, Notify packet
143                   => 11, Normal data packet with on-pad click
144         Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up.
145                 When both fingers are up, the last two reports have zero valid
146                 bit.
147         Bit4 => arc
148         Bit3 => 1
149         Bit2 => Left Button, 1 is pressed, 0 is released.
150         Bit1 => 0
151         Bit0 => 1
152 Byte 2: X coordinate (xpos[9:2])
153 Byte 3: Y coordinate (ypos[9:2])
154 Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0])
155         Bit3~Bit2 => X coordinate (ypos[1:0])
156         Bit5~Bit4 => y1_g
157         Bit7~Bit6 => x1_g
158
159 Packet 2 (ABSOLUTE POSITION)
160    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
161 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
162   1   |0|1|V|A|1|R|1|0|  2  |X|X|X|X|X|X|X|X|  3 |Y|Y|Y|Y|Y|Y|Y|Y|  4 |x|x|y|y|X|X|Y|Y|
163       |---------------|     |---------------|    |---------------|    |---------------|
164
165 Byte 1: Bit7~Bit6 => 00, Normal data packet
166                   => 01, Absolute coordinates packet
167                   => 10, Notify packet
168                   => 11, Normal data packet with on-pad click
169         Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up.
170                 When both fingers are up, the last two reports have zero valid
171                 bit.
172         Bit4 => arc
173         Bit3 => 1
174         Bit2 => Right Button, 1 is pressed, 0 is released.
175         Bit1 => 1
176         Bit0 => 0
177 Byte 2: X coordinate (xpos[9:2])
178 Byte 3: Y coordinate (ypos[9:2])
179 Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0])
180         Bit3~Bit2 => X coordinate (ypos[1:0])
181         Bit5~Bit4 => y2_g
182         Bit7~Bit6 => x2_g
183
184 Notify Packet for STL3888-Ax
185    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
186 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
187   1   |1|0|1|P|1|M|R|L|  2  |C|C|C|C|C|C|C|C|  3 |0|0|F|F|0|0|0|i|  4 |r|l|d|u|0|0|0|0|
188       |---------------|     |---------------|    |---------------|    |---------------|
189
190 Byte 1: Bit7~Bit6 => 00, Normal data packet
191                   => 01, Absolute coordinates packet
192                   => 10, Notify packet
193                   => 11, Normal data packet with on-pad click
194         Bit5 => 1
195         Bit4 => when in absolute coordinates mode (valid when EN_PKT_GO is 1):
196                 0: left button is generated by the on-pad command
197                 1: left button is generated by the external button
198         Bit3 => 1
199         Bit2 => Middle Button, 1 is pressed, 0 is not pressed.
200         Bit1 => Right Button, 1 is pressed, 0 is not pressed.
201         Bit0 => Left Button, 1 is pressed, 0 is not pressed.
202 Byte 2: Message Type => 0xB7 (Multi Finger, Multi Coordinate mode)
203 Byte 3: Bit7~Bit6 => Don't care
204         Bit5~Bit4 => Number of fingers
205         Bit3~Bit1 => Reserved
206         Bit0 => 1: enter gesture mode; 0: leaving gesture mode
207 Byte 4: Bit7 => scroll right button
208         Bit6 => scroll left button
209         Bit5 => scroll down button
210         Bit4 => scroll up button
211             * Note that if gesture and additional button (Bit4~Bit7)
212               happen at the same time, the button information will not
213               be sent.
214         Bit3~Bit0 => Reserved
215
216 Sample sequence of Multi-finger, Multi-coordinate mode:
217
218         notify packet (valid bit == 1), abs pkt 1, abs pkt 2, abs pkt 1,
219         abs pkt 2, ..., notify packet (valid bit == 0)
220
221 ==============================================================================
222 * Absolute position for STL3888-B0.
223 ==============================================================================
224 Packet 1(ABSOLUTE POSITION)
225    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
226 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
227   1   |0|1|V|F|1|0|R|L|  2  |X|X|X|X|X|X|X|X|  3 |Y|Y|Y|Y|Y|Y|Y|Y|  4 |r|l|u|d|X|X|Y|Y|
228       |---------------|     |---------------|    |---------------|    |---------------|
229
230 Byte 1: Bit7~Bit6 => 00, Normal data packet
231                   => 01, Absolute coordinates packet
232                   => 10, Notify packet
233                   => 11, Normal data packet with on-pad click
234         Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up.
235                 When both fingers are up, the last two reports have zero valid
236                 bit.
237         Bit4 => finger up/down information. 1: finger down, 0: finger up.
238         Bit3 => 1
239         Bit2 => finger index, 0 is the first finger, 1 is the second finger.
240         Bit1 => Right Button, 1 is pressed, 0 is not pressed.
241         Bit0 => Left Button, 1 is pressed, 0 is not pressed.
242 Byte 2: X coordinate (xpos[9:2])
243 Byte 3: Y coordinate (ypos[9:2])
244 Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0])
245         Bit3~Bit2 => X coordinate (ypos[1:0])
246         Bit4 => scroll down button
247         Bit5 => scroll up button
248         Bit6 => scroll left button
249         Bit7 => scroll right button
250
251 Packet 2 (ABSOLUTE POSITION)
252    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
253 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
254   1   |0|1|V|F|1|1|R|L|  2  |X|X|X|X|X|X|X|X|  3 |Y|Y|Y|Y|Y|Y|Y|Y|  4 |r|l|u|d|X|X|Y|Y|
255       |---------------|     |---------------|    |---------------|    |---------------|
256
257 Byte 1: Bit7~Bit6 => 00, Normal data packet
258                   => 01, Absolute coordination packet
259                   => 10, Notify packet
260                   => 11, Normal data packet with on-pad click
261         Bit5 => Valid bit, 0 means that the coordinate is invalid or finger up.
262                 When both fingers are up, the last two reports have zero valid
263                 bit.
264         Bit4 => finger up/down information. 1: finger down, 0: finger up.
265         Bit3 => 1
266         Bit2 => finger index, 0 is the first finger, 1 is the second finger.
267         Bit1 => Right Button, 1 is pressed, 0 is not pressed.
268         Bit0 => Left Button, 1 is pressed, 0 is not pressed.
269 Byte 2: X coordinate (xpos[9:2])
270 Byte 3: Y coordinate (ypos[9:2])
271 Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0])
272         Bit3~Bit2 => X coordinate (ypos[1:0])
273         Bit4 => scroll down button
274         Bit5 => scroll up button
275         Bit6 => scroll left button
276         Bit7 => scroll right button
277
278 Notify Packet for STL3888-B0
279    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
280 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
281   1   |1|0|1|P|1|M|R|L|  2  |C|C|C|C|C|C|C|C|  3 |0|0|F|F|0|0|0|i|  4 |r|l|u|d|0|0|0|0|
282       |---------------|     |---------------|    |---------------|    |---------------|
283
284 Byte 1: Bit7~Bit6 => 00, Normal data packet
285                   => 01, Absolute coordination packet
286                   => 10, Notify packet
287                   => 11, Normal data packet with on-pad click
288         Bit5 => 1
289         Bit4 => when in absolute coordinates mode (valid when EN_PKT_GO is 1):
290                 0: left button is generated by the on-pad command
291                 1: left button is generated by the external button
292         Bit3 => 1
293         Bit2 => Middle Button, 1 is pressed, 0 is not pressed.
294         Bit1 => Right Button, 1 is pressed, 0 is not pressed.
295         Bit0 => Left Button, 1 is pressed, 0 is not pressed.
296 Byte 2: Message Type => 0xB7 (Multi Finger, Multi Coordinate mode)
297 Byte 3: Bit7~Bit6 => Don't care
298         Bit5~Bit4 => Number of fingers
299         Bit3~Bit1 => Reserved
300         Bit0 => 1: enter gesture mode; 0: leaving gesture mode
301 Byte 4: Bit7 => scroll right button
302         Bit6 => scroll left button
303         Bit5 => scroll up button
304         Bit4 => scroll down button
305             * Note that if gesture and additional button(Bit4~Bit7)
306               happen at the same time, the button information will not
307               be sent.
308         Bit3~Bit0 => Reserved
309
310 Sample sequence of Multi-finger, Multi-coordinate mode:
311
312         notify packet (valid bit == 1), abs pkt 1, abs pkt 2, abs pkt 1,
313         abs pkt 2, ..., notify packet (valid bit == 0)
314
315 ==============================================================================
316 * Absolute position for STL3888-Cx and STL3888-Dx.
317 ==============================================================================
318 Single Finger, Absolute Coordinate Mode (SFAC)
319    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
320 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
321   1   |0|1|0|P|1|M|R|L|  2  |X|X|X|X|X|X|X|X|  3 |Y|Y|Y|Y|Y|Y|Y|Y|  4 |r|l|B|F|X|X|Y|Y|
322       |---------------|     |---------------|    |---------------|    |---------------|
323
324 Byte 1: Bit7~Bit6 => 00, Normal data packet
325                   => 01, Absolute coordinates packet
326                   => 10, Notify packet
327         Bit5 => Coordinate mode(always 0 in SFAC mode):
328                 0: single-finger absolute coordinates (SFAC) mode
329                 1: multi-finger, multiple coordinates (MFMC) mode
330         Bit4 => 0: The LEFT button is generated by on-pad command (OPC)
331                 1: The LEFT button is generated by external button
332                 Default is 1 even if the LEFT button is not pressed.
333         Bit3 => Always 1, as specified by PS/2 protocol.
334         Bit2 => Middle Button, 1 is pressed, 0 is not pressed.
335         Bit1 => Right Button, 1 is pressed, 0 is not pressed.
336         Bit0 => Left Button, 1 is pressed, 0 is not pressed.
337 Byte 2: X coordinate (xpos[9:2])
338 Byte 3: Y coordinate (ypos[9:2])
339 Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0])
340         Bit3~Bit2 => X coordinate (ypos[1:0])
341         Bit4 => 4th mouse button(forward one page)
342         Bit5 => 5th mouse button(backward one page)
343         Bit6 => scroll left button
344         Bit7 => scroll right button
345
346 Multi Finger, Multiple Coordinates Mode (MFMC):
347    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
348 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
349   1   |0|1|1|P|1|F|R|L|  2  |X|X|X|X|X|X|X|X|  3 |Y|Y|Y|Y|Y|Y|Y|Y|  4 |r|l|B|F|X|X|Y|Y|
350       |---------------|     |---------------|    |---------------|    |---------------|
351
352 Byte 1: Bit7~Bit6 => 00, Normal data packet
353                   => 01, Absolute coordination packet
354                   => 10, Notify packet
355         Bit5 => Coordinate mode (always 1 in MFMC mode):
356                 0: single-finger absolute coordinates (SFAC) mode
357                 1: multi-finger, multiple coordinates (MFMC) mode
358         Bit4 => 0: The LEFT button is generated by on-pad command (OPC)
359                 1: The LEFT button is generated by external button
360                 Default is 1 even if the LEFT button is not pressed.
361         Bit3 => Always 1, as specified by PS/2 protocol.
362         Bit2 => Finger index, 0 is the first finger, 1 is the second finger.
363                 If bit 1 and 0 are all 1 and bit 4 is 0, the middle external
364                 button is pressed.
365         Bit1 => Right Button, 1 is pressed, 0 is not pressed.
366         Bit0 => Left Button, 1 is pressed, 0 is not pressed.
367 Byte 2: X coordinate (xpos[9:2])
368 Byte 3: Y coordinate (ypos[9:2])
369 Byte 4: Bit1~Bit0 => Y coordinate (xpos[1:0])
370         Bit3~Bit2 => X coordinate (ypos[1:0])
371         Bit4 => 4th mouse button(forward one page)
372         Bit5 => 5th mouse button(backward one page)
373         Bit6 => scroll left button
374         Bit7 => scroll right button
375
376   When one of the two fingers is up, the device will output four consecutive
377 MFMC#0 report packets with zero X and Y to represent 1st finger is up or
378 four consecutive MFMC#1 report packets with zero X and Y to represent that
379 the 2nd finger is up.  On the other hand, if both fingers are up, the device
380 will output four consecutive single-finger, absolute coordinate(SFAC) packets
381 with zero X and Y.
382
383 Notify Packet for STL3888-Cx/Dx
384    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
385 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
386   1   |1|0|0|P|1|M|R|L|  2  |C|C|C|C|C|C|C|C|  3 |0|0|F|F|0|0|0|i|  4 |r|l|u|d|0|0|0|0|
387       |---------------|     |---------------|    |---------------|    |---------------|
388
389 Byte 1: Bit7~Bit6 => 00, Normal data packet
390                   => 01, Absolute coordinates packet
391                   => 10, Notify packet
392         Bit5 => Always 0
393         Bit4 => 0: The LEFT button is generated by on-pad command(OPC)
394                 1: The LEFT button is generated by external button
395                 Default is 1 even if the LEFT button is not pressed.
396         Bit3 => 1
397         Bit2 => Middle Button, 1 is pressed, 0 is not pressed.
398         Bit1 => Right Button, 1 is pressed, 0 is not pressed.
399         Bit0 => Left Button, 1 is pressed, 0 is not pressed.
400 Byte 2: Message type:
401         0xba => gesture information
402         0xc0 => one finger hold-rotating gesture
403 Byte 3: The first parameter for the received message:
404         0xba => gesture ID (refer to the 'Gesture ID' section)
405         0xc0 => region ID
406 Byte 4: The second parameter for the received message:
407         0xba => N/A
408         0xc0 => finger up/down information
409
410 Sample sequence of Multi-finger, Multi-coordinates mode:
411
412         notify packet (valid bit == 1), MFMC packet 1 (byte 1, bit 2 == 0),
413         MFMC packet 2 (byte 1, bit 2 == 1), MFMC packet 1, MFMC packet 2,
414         ..., notify packet (valid bit == 0)
415
416         That is, when the device is in MFMC mode, the host will receive
417         interleaved absolute coordinate packets for each finger.
418
419 ==============================================================================
420 * FSP Enable/Disable packet
421 ==============================================================================
422    Bit 7 6 5 4 3 2 1 0       7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0      7 6 5 4 3 2 1 0
423 BYTE  |---------------|BYTE |---------------|BYTE|---------------|BYTE|---------------|
424   1   |Y|X|0|0|1|M|R|L|  2  |0|1|0|1|1|0|1|E|  3 | | | | | | | | |  4 | | | | | | | | |
425       |---------------|     |---------------|    |---------------|    |---------------|
426
427 FSP will send out enable/disable packet when FSP receive PS/2 enable/disable
428 command. Host will receive the packet which Middle, Right, Left button will
429 be set. The packet only use byte 0 and byte 1 as a pattern of original packet.
430 Ignore the other bytes of the packet.
431
432 Byte 1: Bit7 => 0, Y overflow
433         Bit6 => 0, X overflow
434         Bit5 => 0, Y sign bit
435         Bit4 => 0, X sign bit
436         Bit3 => 1
437         Bit2 => 1, Middle Button
438         Bit1 => 1, Right Button
439         Bit0 => 1, Left Button
440 Byte 2: Bit7~1 => (0101101b)
441         Bit0 => 1 = Enable
442                 0 = Disable
443 Byte 3: Don't care
444 Byte 4: Don't care (MOUSE ID 3, 4)
445 Byte 5~8: Don't care (Absolute packet)
446
447 ==============================================================================
448 * PS/2 Command Set
449 ==============================================================================
450
451 FSP supports basic PS/2 commanding set and modes, refer to following URL for
452 details about PS/2 commands:
453
454 http://www.computer-engineering.org/ps2mouse/
455
456 ==============================================================================
457 * Programming Sequence for Determining Packet Parsing Flow
458 ==============================================================================
459 1. Identify FSP by reading device ID(0x00) and version(0x01) register
460
461 2a. For FSP version < STL3888 Cx, determine number of buttons by reading
462     the 'test mode status' (0x20) register:
463
464         buttons = reg[0x20] & 0x30
465
466         if buttons == 0x30 or buttons == 0x20:
467                 # two/four buttons
468                 Refer to 'Finger Sensing Pad PS/2 Mouse Intellimouse'
469                 section A for packet parsing detail(ignore byte 4, bit ~ 7)
470         elif buttons == 0x10:
471                 # 6 buttons
472                 Refer to 'Finger Sensing Pad PS/2 Mouse Intellimouse'
473                 section B for packet parsing detail
474         elif buttons == 0x00:
475                 # 6 buttons
476                 Refer to 'Finger Sensing Pad PS/2 Mouse Intellimouse'
477                 section A for packet parsing detail
478
479 2b. For FSP version >= STL3888 Cx:
480         Refer to 'Finger Sensing Pad PS/2 Mouse Intellimouse'
481         section A for packet parsing detail (ignore byte 4, bit ~ 7)
482
483 ==============================================================================
484 * Programming Sequence for Register Reading/Writing
485 ==============================================================================
486
487 Register inversion requirement:
488
489   Following values needed to be inverted(the '~' operator in C) before being
490 sent to FSP:
491
492         0xe8, 0xe9, 0xee, 0xf2, 0xf3 and 0xff.
493
494 Register swapping requirement:
495
496   Following values needed to have their higher 4 bits and lower 4 bits being
497 swapped before being sent to FSP:
498
499         10, 20, 40, 60, 80, 100 and 200.
500
501 Register reading sequence:
502
503         1. send 0xf3 PS/2 command to FSP;
504
505         2. send 0x66 PS/2 command to FSP;
506
507         3. send 0x88 PS/2 command to FSP;
508
509         4. send 0xf3 PS/2 command to FSP;
510
511         5. if the register address being to read is not required to be
512         inverted(refer to the 'Register inversion requirement' section),
513         goto step 6
514
515         5a. send 0x68 PS/2 command to FSP;
516
517         5b. send the inverted register address to FSP and goto step 8;
518
519         6. if the register address being to read is not required to be
520         swapped(refer to the 'Register swapping requirement' section),
521         goto step 7
522
523         6a. send 0xcc PS/2 command to FSP;
524
525         6b. send the swapped register address to FSP and goto step 8;
526
527         7. send 0x66 PS/2 command to FSP;
528
529         7a. send the original register address to FSP and goto step 8;
530
531         8. send 0xe9(status request) PS/2 command to FSP;
532
533         9. the 4th byte of the response read from FSP should be the
534         requested register value(?? indicates don't care byte):
535
536                 host: 0xe9
537                 3888: 0xfa (??) (??) (val)
538
539         * Note that since the Cx release, the hardware will return 1's
540         complement of the register value at the 3rd byte of status request
541         result:
542
543                 host: 0xe9
544                 3888: 0xfa (??) (~val) (val)
545
546 Register writing sequence:
547
548         1. send 0xf3 PS/2 command to FSP;
549
550         2. if the register address being to write is not required to be
551         inverted(refer to the 'Register inversion requirement' section),
552         goto step 3
553
554         2a. send 0x74 PS/2 command to FSP;
555
556         2b. send the inverted register address to FSP and goto step 5;
557
558         3. if the register address being to write is not required to be
559         swapped(refer to the 'Register swapping requirement' section),
560         goto step 4
561
562         3a. send 0x77 PS/2 command to FSP;
563
564         3b. send the swapped register address to FSP and goto step 5;
565
566         4. send 0x55 PS/2 command to FSP;
567
568         4a. send the register address to FSP and goto step 5;
569
570         5. send 0xf3 PS/2 command to FSP;
571
572         6. if the register value being to write is not required to be
573         inverted(refer to the 'Register inversion requirement' section),
574         goto step 7
575
576         6a. send 0x47 PS/2 command to FSP;
577
578         6b. send the inverted register value to FSP and goto step 9;
579
580         7. if the register value being to write is not required to be
581         swapped(refer to the 'Register swapping requirement' section),
582         goto step 8
583
584         7a. send 0x44 PS/2 command to FSP;
585
586         7b. send the swapped register value to FSP and goto step 9;
587
588         8. send 0x33 PS/2 command to FSP;
589
590         8a. send the register value to FSP;
591
592         9. the register writing sequence is completed.
593
594         * Note that since the Cx release, the hardware will return 1's
595         complement of the register value at the 3rd byte of status request
596         result. Host can optionally send another 0xe9 (status request) PS/2
597         command to FSP at the end of register writing to verify that the
598         register writing operation is successful (?? indicates don't care
599         byte):
600
601                 host: 0xe9
602                 3888: 0xfa (??) (~val) (val)
603
604 ==============================================================================
605 * Programming Sequence for Page Register Reading/Writing
606 ==============================================================================
607
608   In order to overcome the limitation of maximum number of registers
609 supported, the hardware separates register into different groups called
610 'pages.' Each page is able to include up to 255 registers.
611
612   The default page after power up is 0x82; therefore, if one has to get
613 access to register 0x8301, one has to use following sequence to switch
614 to page 0x83, then start reading/writing from/to offset 0x01 by using
615 the register read/write sequence described in previous section.
616
617 Page register reading sequence:
618
619         1. send 0xf3 PS/2 command to FSP;
620
621         2. send 0x66 PS/2 command to FSP;
622
623         3. send 0x88 PS/2 command to FSP;
624
625         4. send 0xf3 PS/2 command to FSP;
626
627         5. send 0x83 PS/2 command to FSP;
628
629         6. send 0x88 PS/2 command to FSP;
630
631         7. send 0xe9(status request) PS/2 command to FSP;
632
633         8. the response read from FSP should be the requested page value.
634
635 Page register writing sequence:
636
637         1. send 0xf3 PS/2 command to FSP;
638
639         2. send 0x38 PS/2 command to FSP;
640
641         3. send 0x88 PS/2 command to FSP;
642
643         4. send 0xf3 PS/2 command to FSP;
644
645         5. if the page address being written is not required to be
646         inverted(refer to the 'Register inversion requirement' section),
647         goto step 6
648
649         5a. send 0x47 PS/2 command to FSP;
650
651         5b. send the inverted page address to FSP and goto step 9;
652
653         6. if the page address being written is not required to be
654         swapped(refer to the 'Register swapping requirement' section),
655         goto step 7
656
657         6a. send 0x44 PS/2 command to FSP;
658
659         6b. send the swapped page address to FSP and goto step 9;
660
661         7. send 0x33 PS/2 command to FSP;
662
663         8. send the page address to FSP;
664
665         9. the page register writing sequence is completed.
666
667 ==============================================================================
668 * Gesture ID
669 ==============================================================================
670
671   Unlike other devices which sends multiple fingers' coordinates to host,
672 FSP processes multiple fingers' coordinates internally and convert them
673 into a 8 bits integer, namely 'Gesture ID.'  Following is a list of
674 supported gesture IDs:
675
676         ID      Description
677         0x86    2 finger straight up
678         0x82    2 finger straight down
679         0x80    2 finger straight right
680         0x84    2 finger straight left
681         0x8f    2 finger zoom in
682         0x8b    2 finger zoom out
683         0xc0    2 finger curve, counter clockwise
684         0xc4    2 finger curve, clockwise
685         0x2e    3 finger straight up
686         0x2a    3 finger straight down
687         0x28    3 finger straight right
688         0x2c    3 finger straight left
689         0x38    palm
690
691 ==============================================================================
692 * Register Listing
693 ==============================================================================
694
695   Registers are represented in 16 bits values. The higher 8 bits represent
696 the page address and the lower 8 bits represent the relative offset within
697 that particular page.  Refer to the 'Programming Sequence for Page Register
698 Reading/Writing' section for instructions on how to change current page
699 address.
700
701 offset  width           default r/w     name
702 0x8200  bit7~bit0       0x01    RO      device ID
703
704 0x8201  bit7~bit0               RW      version ID
705                                         0xc1: STL3888 Ax
706                                         0xd0 ~ 0xd2: STL3888 Bx
707                                         0xe0 ~ 0xe1: STL3888 Cx
708                                         0xe2 ~ 0xe3: STL3888 Dx
709
710 0x8202  bit7~bit0       0x01    RO      vendor ID
711
712 0x8203  bit7~bit0       0x01    RO      product ID
713
714 0x8204  bit3~bit0       0x01    RW      revision ID
715
716 0x820b                                  test mode status 1
717         bit3            1       RO      0: rotate 180 degree
718                                         1: no rotation
719                                         *only supported by H/W prior to Cx
720
721 0x820f                                  register file page control
722         bit2            0       RW      1: rotate 180 degree
723                                         0: no rotation
724                                         *supported since Cx
725
726         bit0            0       RW      1 to enable page 1 register files
727                                         *only supported by H/W prior to Cx
728
729 0x8210                          RW      system control 1
730         bit0            1       RW      Reserved, must be 1
731         bit1            0       RW      Reserved, must be 0
732         bit4            0       RW      Reserved, must be 0
733         bit5            1       RW      register clock gating enable
734                                         0: read only, 1: read/write enable
735         (Note that following registers does not require clock gating being
736         enabled prior to write: 05 06 07 08 09 0c 0f 10 11 12 16 17 18 23 2e
737         40 41 42 43.  In addition to that, this bit must be 1 when gesture
738         mode is enabled)
739
740 0x8220                                  test mode status
741         bit5~bit4               RO      number of buttons
742                                         11 => 2, lbtn/rbtn
743                                         10 => 4, lbtn/rbtn/scru/scrd
744                                         01 => 6, lbtn/rbtn/scru/scrd/scrl/scrr
745                                         00 => 6, lbtn/rbtn/scru/scrd/fbtn/bbtn
746                                         *only supported by H/W prior to Cx
747
748 0x8231                          RW      on-pad command detection
749         bit7            0       RW      on-pad command left button down tag
750                                         enable
751                                         0: disable, 1: enable
752                                         *only supported by H/W prior to Cx
753
754 0x8234                          RW      on-pad command control 5
755         bit4~bit0       0x05    RW      XLO in 0s/4/1, so 03h = 0010.1b = 2.5
756         (Note that position unit is in 0.5 scanline)
757                                         *only supported by H/W prior to Cx
758
759         bit7            0       RW      on-pad tap zone enable
760                                         0: disable, 1: enable
761                                         *only supported by H/W prior to Cx
762
763 0x8235                          RW      on-pad command control 6
764         bit4~bit0       0x1d    RW      XHI in 0s/4/1, so 19h = 1100.1b = 12.5
765         (Note that position unit is in 0.5 scanline)
766                                         *only supported by H/W prior to Cx
767
768 0x8236                          RW      on-pad command control 7
769         bit4~bit0       0x04    RW      YLO in 0s/4/1, so 03h = 0010.1b = 2.5
770         (Note that position unit is in 0.5 scanline)
771                                         *only supported by H/W prior to Cx
772
773 0x8237                          RW      on-pad command control 8
774         bit4~bit0       0x13    RW      YHI in 0s/4/1, so 11h = 1000.1b = 8.5
775         (Note that position unit is in 0.5 scanline)
776                                         *only supported by H/W prior to Cx
777
778 0x8240                          RW      system control 5
779         bit1            0       RW      FSP Intellimouse mode enable
780                                         0: disable, 1: enable
781                                         *only supported by H/W prior to Cx
782
783         bit2            0       RW      movement + abs. coordinate mode enable
784                                         0: disable, 1: enable
785         (Note that this function has the functionality of bit 1 even when
786         bit 1 is not set. However, the format is different from that of bit 1.
787         In addition, when bit 1 and bit 2 are set at the same time, bit 2 will
788         override bit 1.)
789                                         *only supported by H/W prior to Cx
790
791         bit3            0       RW      abs. coordinate only mode enable
792                                         0: disable, 1: enable
793         (Note that this function has the functionality of bit 1 even when
794         bit 1 is not set. However, the format is different from that of bit 1.
795         In addition, when bit 1, bit 2 and bit 3 are set at the same time,
796         bit 3 will override bit 1 and 2.)
797                                         *only supported by H/W prior to Cx
798
799         bit5            0       RW      auto switch enable
800                                         0: disable, 1: enable
801                                         *only supported by H/W prior to Cx
802
803         bit6            0       RW      G0 abs. + notify packet format enable
804                                         0: disable, 1: enable
805         (Note that the absolute/relative coordinate output still depends on
806         bit 2 and 3.  That is, if any of those bit is 1, host will receive
807         absolute coordinates; otherwise, host only receives packets with
808         relative coordinate.)
809                                         *only supported by H/W prior to Cx
810
811         bit7            0       RW      EN_PS2_F2: PS/2 gesture mode 2nd
812                                         finger packet enable
813                                         0: disable, 1: enable
814                                         *only supported by H/W prior to Cx
815
816 0x8243                          RW      on-pad control
817         bit0            0       RW      on-pad control enable
818                                         0: disable, 1: enable
819         (Note that if this bit is cleared, bit 3/5 will be ineffective)
820                                         *only supported by H/W prior to Cx
821
822         bit3            0       RW      on-pad fix vertical scrolling enable
823                                         0: disable, 1: enable
824                                         *only supported by H/W prior to Cx
825
826         bit5            0       RW      on-pad fix horizontal scrolling enable
827                                         0: disable, 1: enable
828                                         *only supported by H/W prior to Cx
829
830 0x8290                          RW      software control register 1
831         bit0            0       RW      absolute coordination mode
832                                         0: disable, 1: enable
833                                         *supported since Cx
834
835         bit1            0       RW      gesture ID output
836                                         0: disable, 1: enable
837                                         *supported since Cx
838
839         bit2            0       RW      two fingers' coordinates output
840                                         0: disable, 1: enable
841                                         *supported since Cx
842
843         bit3            0       RW      finger up one packet output
844                                         0: disable, 1: enable
845                                         *supported since Cx
846
847         bit4            0       RW      absolute coordination continuous mode
848                                         0: disable, 1: enable
849                                         *supported since Cx
850
851         bit6~bit5       00      RW      gesture group selection
852                                         00: basic
853                                         01: suite
854                                         10: suite pro
855                                         11: advanced
856                                         *supported since Cx
857
858         bit7            0       RW      Bx packet output compatible mode
859                                         0: disable, 1: enable                                   *supported since Cx
860                                         *supported since Cx
861
862
863 0x833d                          RW      on-pad command control 1
864         bit7            1       RW      on-pad command detection enable
865                                         0: disable, 1: enable
866                                         *supported since Cx
867
868 0x833e                          RW      on-pad command detection
869         bit7            0       RW      on-pad command left button down tag
870                                         enable. Works only in H/W based PS/2
871                                         data packet mode.
872                                         0: disable, 1: enable
873                                         *supported since Cx