/[linux-patches]/genpatches-2.6/trunk/3.0/2625_Input-ALPS-Add-documentation-for-protocol-versions-3.patch
Gentoo

Contents of /genpatches-2.6/trunk/3.0/2625_Input-ALPS-Add-documentation-for-protocol-versions-3.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1982 - (show annotations) (download)
Wed Sep 28 14:30:19 2011 UTC (6 years, 8 months ago) by mpagano
File size: 8496 byte(s)
Adding ALPS patches for new touchpads from Seth Forshee at Ubuntu
1 From 986ad99c2ea79ba04d6f2f739513e721643ec78e Mon Sep 17 00:00:00 2001
2 From: Seth Forshee <seth.forshee@canonical.com>
3 Date: Wed, 14 Sep 2011 11:40:38 -0500
4 Subject: [PATCH 6/8] Input: ALPS - Add documentation for protocol versions 3 and 4
5
6 Also converts from using "old" and "new" to describe the already-known
7 protocols to using "version 1" and "version 2."
8 ---
9 Documentation/input/alps.txt | 134 ++++++++++++++++++++++++++++++++++++++---
10 drivers/input/mouse/alps.c | 9 +++
11 2 files changed, 133 insertions(+), 10 deletions(-)
12
13 diff --git a/Documentation/input/alps.txt b/Documentation/input/alps.txt
14 index e88c921..2768ad1 100644
15 --- a/Documentation/input/alps.txt
16 +++ b/Documentation/input/alps.txt
17 @@ -4,12 +4,9 @@ ALPS Touchpad Protocol
18 Introduction
19 ------------
20
21 -Currently the ALPS touchpad driver supports two protocol versions in use by
22 -ALPS touchpads, the "old" and "new" protocol versions. Fundamentally these
23 -differ only in the format of their event packets (in reality many features may
24 -be found on new protocol devices that aren't found on the old protocol
25 -devices, but these are handled transparently as feature differences rather
26 -than protocol differences).
27 +Currently the ALPS touchpad driver supports four protocol versions in use by
28 +ALPS touchpads, called versions 1, 2, 3, and 4. Information about the various
29 +protocol versions is contained in the following sections.
30
31 Detection
32 ---------
33 @@ -22,6 +19,34 @@ If the E6 report is successful, the touchpad model is identified using the "E7
34 report" sequence: E8-E7-E7-E7-E9. The response is the model signature and is
35 matched against known models in the alps_model_data_array.
36
37 +With protocol versions 3 and 4, the E7 report model signature is always
38 +73-02-64. To differentiate between these versions, the response from the
39 +"Enter Command Mode" sequence must be inspected as described below.
40 +
41 +Command Mode
42 +------------
43 +
44 +Protocol versions 3 and 4 have a command mode that is used to read and write
45 +one-byte device registers in a 16-bit address space. The command sequence
46 +EC-EC-EC-E9 places the device in command mode, and the device will respond
47 +with 88-07 followed by a third byte. This third byte can be used to determine
48 +whether the devices uses the version
49 +3 or 4 protocol.
50 +
51 +To exit command mode, PSMOUSE_CMD_SETSTREAM (EA) is sent to the touchpad.
52 +
53 +While in command mode, register addresses can be set by first sending a
54 +specific command, either EC for v3 devices or F5 for E4 devices. Then the
55 +address is sent one nibble at a time, where each nibble is encoded as a
56 +command with optional data. This enoding differs slightly between the v3 and
57 +v4 protocols.
58 +
59 +Once an address has been set, the addressed register can be read by sending
60 +PSMOUSE_CMD_GETINFO (E9). The first two bytes of the response contains the
61 +address of the register being read, and the third contains the value of the
62 +register. Registers are written by writing the value one nibble at a time
63 +using the same encoding used for addresses.
64 +
65 Packet Format
66 -------------
67
68 @@ -41,8 +66,8 @@ PS/2 packet format
69
70 Note that the device never signals overflow condition.
71
72 -ALPS Absolute Mode - Old Format
73 --------------------------------
74 +ALPS Absolute Mode - Protocol Verion 1
75 +--------------------------------------
76
77 byte 0: 1 0 0 0 1 x9 x8 x7
78 byte 1: 0 x6 x5 x4 x3 x2 x1 x0
79 @@ -51,8 +76,8 @@ ALPS Absolute Mode - Old Format
80 byte 4: 0 y6 y5 y4 y3 y2 y1 y0
81 byte 5: 0 z6 z5 z4 z3 z2 z1 z0
82
83 -ALPS Absolute Mode - New Format
84 --------------------------------
85 +ALPS Absolute Mode - Protocol Version 2
86 +---------------------------------------
87
88 byte 0: 1 ? ? ? 1 ? ? ?
89 byte 1: 0 x6 x5 x4 x3 x2 x1 x0
90 @@ -73,3 +98,92 @@ Dualpoint device -- interleaved packet format
91 byte 6: 0 y9 y8 y7 1 m r l
92 byte 7: 0 y6 y5 y4 y3 y2 y1 y0
93 byte 8: 0 z6 z5 z4 z3 z2 z1 z0
94 +
95 +ALPS Absolute Mode - Protocol Version 3
96 +---------------------------------------
97 +
98 +ALPS protocol version 3 has three different packet formats. The first two are
99 +associated with touchpad events, and the third is associatd with trackstick
100 +events.
101 +
102 +The first type is the touchpad position packet.
103 +
104 + byte 0: 1 ? x1 x0 1 1 1 1
105 + byte 1: 0 x10 x9 x8 x7 x6 x5 x4
106 + byte 2: 0 y10 y9 y8 y7 y6 y5 y4
107 + byte 3: 0 M R L 1 m r l
108 + byte 4: 0 mt x3 x2 y3 y2 y1 y0
109 + byte 5: 0 z6 z5 z4 z3 z2 z1 z0
110 +
111 +Note that for some devices the trackstick buttons are reported in this packet,
112 +and on others it is reported in the trackstick packets.
113 +
114 +The second packet type contains bitmaps representing the x and y axes. In the
115 +bitmaps a given bit is set if there is a finger covering that position on the
116 +given axis. Thus the bitmap packet can be used for low-resolution multi-touch
117 +data, although finger tracking is not possible. This packet also encodes the
118 +number of contacts (f1 and f0 in the table below).
119 +
120 + byte 0: 1 1 x1 x0 1 1 1 1
121 + byte 1: 0 x8 x7 x6 x5 x4 x3 x2
122 + byte 2: 0 y7 y6 y5 y4 y3 y2 y1
123 + byte 3: 0 y10 y9 y8 1 1 1 1
124 + byte 4: 0 x14 x13 x12 x11 x10 x9 y0
125 + byte 5: 0 1 ? ? ? ? f1 f0
126 +
127 +This packet only appears after a position packet with the mt bit set, and
128 +ususally only appears when there are two or more contacts (although
129 +ocassionally it's seen with only a single contact).
130 +
131 +The final v3 packet type is the trackstick packet.
132 +
133 + byte 0: 1 1 x7 y7 1 1 1 1
134 + byte 1: 0 x6 x5 x4 x3 x2 x1 x0
135 + byte 2: 0 y6 y5 y4 y3 y2 y1 y0
136 + byte 3: 0 1 0 0 1 0 0 0
137 + byte 4: 0 z4 z3 z2 z1 z0 ? ?
138 + byte 5: 0 0 1 1 1 1 1 1
139 +
140 +ALPS Absolute Mode - Protocol Version 4
141 +---------------------------------------
142 +
143 +Protocol version 4 has a 9-byte packet format.
144 +
145 + byte 0: 1 ? x1 x0 1 1 1 1
146 + byte 1: 0 x10 x9 x8 x7 x6 x5 x4
147 + byte 2: 0 y10 y9 y8 y7 y6 y5 y4
148 + byte 3: 0 1 x3 x2 y3 y2 y1 y0
149 + byte 4: 0 ? ? ? 1 ? r l
150 + byte 5: 0 z6 z5 z4 z3 z2 z1 z0
151 + byte 6: bitmap data (described below)
152 + byte 7: bitmap data (described below)
153 +
154 +The last two bytes represent a partial bitmap packet, with 3 full packets
155 +required to construct a complete bitmap packet. Once assembled, the 6-byte
156 +bitmap packet has the following format:
157 +
158 + byte 0: 0 1 x7 x6 x5 x4 x3 x2
159 + byte 1: 0 x1 x0 y4 y3 y2 y1 y0
160 + byte 2: 0 ? ? x14 x13 x12 x11 x10
161 + byte 3: 0 x9 x8 y9 y8 y7 y6 y5
162 + byte 4: 0 0 0 0 0 0 0 0
163 + byte 5: 0 0 0 0 0 0 0 y10
164 +
165 +There are several things worth noting here.
166 +
167 + 1) In the bitmap data, bit 6 of byte 0 serves as a sync byte to
168 + identify the first fragment of a bitmap packet.
169 +
170 + 2) The bitmaps represent the same data as in the v3 bitmap packets, although
171 + the packet layout is different.
172 +
173 + 3) There doesn't seem to be a count of the contact points anywhere in the v4
174 + protocol packets. Deriving a count of contact points must be done by
175 + analyzing the bitmaps.
176 +
177 + 4) There is a 3 to 1 ratio of position packets to bitmap packets. Therefore
178 + MT position can only be updated for every third ST position update, and
179 + the count of contact points can only be updated every third packet as
180 + well.
181 +
182 +So far no v4 devices with tracksticks have been encountered.
183 diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
184 index 2615b92..165c7a0 100644
185 --- a/drivers/input/mouse/alps.c
186 +++ b/drivers/input/mouse/alps.c
187 @@ -358,6 +358,15 @@ static void alps_process_touchpad_packet_v3(struct psmouse *psmouse)
188 y = ((packet[2] & 0x7f) << 4) | (packet[4] & 0x0f);
189 z = packet[5] & 0x7f;
190
191 + /*
192 + * Sometimes the hardware sends a single packet with z = 0
193 + * in the middle of a stream. Real releases generate a good
194 + * number of packets with x, y, and z all zero, so these seem
195 + * to be flukes. Ignore them.
196 + */
197 + if (x && y && !z)
198 + return;
199 +
200 if (z >= 64) {
201 input_report_key(dev, BTN_TOUCH, 1);
202 } else {
203 --
204 1.7.4.1
205

  ViewVC Help
Powered by ViewVC 1.1.20