1Copyright (C) 2002-2011 Sentelic Corporation.
2Last update: Dec-07-2011
3
4==============================================================================
5* Finger Sensing Pad Intellimouse Mode(scrolling wheel, 4th and 5th buttons)
6==============================================================================
7A) 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
15Packet 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
17BYTE  |---------------|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
21Byte 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.
29Byte 2: X Movement(9-bit 2's complement integers)
30Byte 3: Y Movement(9-bit 2's complement integers)
31Byte 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
38B) 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
44Packet 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
46BYTE  |---------------|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
50Byte 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.
58Byte 2: X Movement(9-bit 2's complement integers)
59Byte 3: Y Movement(9-bit 2's complement integers)
60Byte 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
69C) 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
84Packet 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
86BYTE  |---------------|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
90Byte 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.
99Byte 2: X coordinate (xpos[9:2])
100Byte 3: Y coordinate (ypos[9:2])
101Byte 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
108Notify 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
110BYTE  |---------------|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
114Byte 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.
123Byte 2: Message Type => 0x5A (Enable/Disable status packet)
124        Mode Type => 0xA5 (Normal/Icon mode status)
125Byte 3: Message Type => 0x00 (Disabled)
126                     => 0x01 (Enabled)
127        Mode Type    => 0x00 (Normal)
128                     => 0x01 (Icon)
129Byte 4: Bit7~Bit0 => Don't Care
130
131==============================================================================
132* Absolute position for STL3888-Ax.
133==============================================================================
134Packet 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
136BYTE  |---------------|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
140Byte 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
152Byte 2: X coordinate (xpos[9:2])
153Byte 3: Y coordinate (ypos[9:2])
154Byte 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
159Packet 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
161BYTE  |---------------|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
165Byte 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
177Byte 2: X coordinate (xpos[9:2])
178Byte 3: Y coordinate (ypos[9:2])
179Byte 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
184Notify 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
186BYTE  |---------------|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
190Byte 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.
202Byte 2: Message Type => 0xB7 (Multi Finger, Multi Coordinate mode)
203Byte 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
207Byte 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
216Sample 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==============================================================================
224Packet 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
226BYTE  |---------------|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
230Byte 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.
242Byte 2: X coordinate (xpos[9:2])
243Byte 3: Y coordinate (ypos[9:2])
244Byte 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
251Packet 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
253BYTE  |---------------|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
257Byte 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.
269Byte 2: X coordinate (xpos[9:2])
270Byte 3: Y coordinate (ypos[9:2])
271Byte 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
278Notify 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
280BYTE  |---------------|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
284Byte 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.
296Byte 2: Message Type => 0xB7 (Multi Finger, Multi Coordinate mode)
297Byte 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
301Byte 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
310Sample 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==============================================================================
318Single 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
320BYTE  |---------------|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
324Byte 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.
337Byte 2: X coordinate (xpos[9:2])
338Byte 3: Y coordinate (ypos[9:2])
339Byte 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
346Multi 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
348BYTE  |---------------|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
352Byte 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.
367Byte 2: X coordinate (xpos[9:2])
368Byte 3: Y coordinate (ypos[9:2])
369Byte 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
377MFMC#0 report packets with zero X and Y to represent 1st finger is up or
378four consecutive MFMC#1 report packets with zero X and Y to represent that
379the 2nd finger is up.  On the other hand, if both fingers are up, the device
380will output four consecutive single-finger, absolute coordinate(SFAC) packets
381with zero X and Y.
382
383Notify 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
385BYTE  |---------------|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
389Byte 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.
400Byte 2: Message type:
401	0xba => gesture information
402	0xc0 => one finger hold-rotating gesture
403Byte 3: The first parameter for the received message:
404	0xba => gesture ID (refer to the 'Gesture ID' section)
405	0xc0 => region ID
406Byte 4: The second parameter for the received message:
407	0xba => N/A
408	0xc0 => finger up/down information
409
410Sample 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
423BYTE  |---------------|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
427FSP will send out enable/disable packet when FSP receive PS/2 enable/disable
428command. Host will receive the packet which Middle, Right, Left button will
429be set. The packet only use byte 0 and byte 1 as a pattern of original packet.
430Ignore the other bytes of the packet.
431
432Byte 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
440Byte 2: Bit7~1 => (0101101b)
441        Bit0 => 1 = Enable
442		0 = Disable
443Byte 3: Don't care
444Byte 4: Don't care (MOUSE ID 3, 4)
445Byte 5~8: Don't care (Absolute packet)
446
447==============================================================================
448* PS/2 Command Set
449==============================================================================
450
451FSP supports basic PS/2 commanding set and modes, refer to following URL for
452details about PS/2 commands:
453
454http://www.computer-engineering.org/ps2mouse/
455
456==============================================================================
457* Programming Sequence for Determining Packet Parsing Flow
458==============================================================================
4591. Identify FSP by reading device ID(0x00) and version(0x01) register
460
4612a. 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
4792b. 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
487Register inversion requirement:
488
489  Following values needed to be inverted(the '~' operator in C) before being
490sent to FSP:
491
492	0xe8, 0xe9, 0xee, 0xf2, 0xf3 and 0xff.
493
494Register swapping requirement:
495
496  Following values needed to have their higher 4 bits and lower 4 bits being
497swapped before being sent to FSP:
498
499	10, 20, 40, 60, 80, 100 and 200.
500
501Register 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
546Register 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
609supported, 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
613access to register 0x8301, one has to use following sequence to switch
614to page 0x83, then start reading/writing from/to offset 0x01 by using
615the register read/write sequence described in previous section.
616
617Page 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
635Page 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,
672FSP processes multiple fingers' coordinates internally and convert them
673into a 8 bits integer, namely 'Gesture ID.'  Following is a list of
674supported 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
696the page address and the lower 8 bits represent the relative offset within
697that particular page.  Refer to the 'Programming Sequence for Page Register
698Reading/Writing' section for instructions on how to change current page
699address.
700
701offset	width		default	r/w	name
7020x8200	bit7~bit0	0x01	RO	device ID
703
7040x8201	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
7100x8202	bit7~bit0	0x01	RO	vendor ID
711
7120x8203	bit7~bit0	0x01	RO	product ID
713
7140x8204	bit3~bit0	0x01	RW	revision ID
715
7160x820b					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
7210x820f					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
7290x8210				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
7400x8220					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
7480x8231				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
7540x8234				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
7630x8235				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
7680x8236				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
7730x8237				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
7780x8240				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
8160x8243				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
8300x8290				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
8630x833d				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
8680x833e				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
874