2 * ALPS touchpad PS/2 mouse driver
4 * Copyright (c) 2003 Peter Osterlund <petero2@telia.com>
5 * Copyright (c) 2005 Vojtech Pavlik <vojtech@suse.cz>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
15 #include <linux/input/mt.h>
17 #define ALPS_PROTO_V1 1
18 #define ALPS_PROTO_V2 2
19 #define ALPS_PROTO_V3 3
20 #define ALPS_PROTO_V4 4
21 #define ALPS_PROTO_V5 5
22 #define ALPS_PROTO_V6 6
26 #define DOLPHIN_COUNT_PER_ELECTRODE 64
27 #define DOLPHIN_PROFILE_XOFFSET 8 /* x-electrode offset */
28 #define DOLPHIN_PROFILE_YOFFSET 1 /* y-electrode offset */
31 * struct alps_model_info - touchpad ID table
32 * @signature: E7 response string to match.
33 * @command_mode_resp: For V3/V4 touchpads, the final byte of the EC response
34 * (aka command mode response) identifies the firmware minor version. This
35 * can be used to distinguish different hardware models which are not
36 * uniquely identifiable through their E7 responses.
37 * @proto_version: Indicates V1/V2/V3/...
38 * @byte0: Helps figure out whether a position report packet matches the
39 * known format for this model. The first byte of the report, ANDed with
40 * mask0, should match byte0.
41 * @mask0: The mask used to check the first byte of the report.
42 * @flags: Additional device capabilities (passthrough port, trackstick, etc.).
44 * Many (but not all) ALPS touchpads can be identified by looking at the
45 * values returned in the "E7 report" and/or the "EC report." This table
46 * lists a number of such touchpads.
48 struct alps_model_info
{
49 unsigned char signature
[3];
50 unsigned char command_mode_resp
;
51 unsigned char proto_version
;
52 unsigned char byte0
, mask0
;
57 * struct alps_nibble_commands - encodings for register accesses
58 * @command: PS/2 command used for the nibble
59 * @data: Data supplied as an argument to the PS/2 command, if applicable
61 * The ALPS protocol uses magic sequences to transmit binary data to the
62 * touchpad, as it is generally not OK to send arbitrary bytes out the
63 * PS/2 port. Each of the sequences in this table sends one nibble of the
64 * register address or (write) data. Different versions of the ALPS protocol
65 * use slightly different encodings.
67 struct alps_nibble_commands
{
72 struct alps_bitmap_point
{
78 * struct alps_fields - decoded version of the report packet
79 * @x_map: Bitmap of active X positions for MT.
80 * @y_map: Bitmap of active Y positions for MT.
81 * @fingers: Number of fingers for MT.
82 * @pressure: Pressure.
83 * @st: position for ST.
84 * @mt: position for MT.
85 * @first_mp: Packet is the first of a multi-packet report.
86 * @is_mp: Packet is part of a multi-packet report.
87 * @left: Left touchpad button is active.
88 * @right: Right touchpad button is active.
89 * @middle: Middle touchpad button is active.
90 * @ts_left: Left trackstick button is active.
91 * @ts_right: Right trackstick button is active.
92 * @ts_middle: Middle trackstick button is active.
100 struct input_mt_pos st
;
101 struct input_mt_pos mt
[MAX_TOUCHES
];
103 unsigned int first_mp
:1;
104 unsigned int is_mp
:1;
107 unsigned int right
:1;
108 unsigned int middle
:1;
110 unsigned int ts_left
:1;
111 unsigned int ts_right
:1;
112 unsigned int ts_middle
:1;
116 * struct alps_data - private data structure for the ALPS driver
117 * @dev2: "Relative" device used to report trackstick or mouse activity.
118 * @phys: Physical path for the relative device.
119 * @nibble_commands: Command mapping used for touchpad register accesses.
120 * @addr_command: Command used to tell the touchpad that a register address
122 * @proto_version: Indicates V1/V2/V3/...
123 * @byte0: Helps figure out whether a position report packet matches the
124 * known format for this model. The first byte of the report, ANDed with
125 * mask0, should match byte0.
126 * @mask0: The mask used to check the first byte of the report.
127 * @fw_ver: cached copy of firmware version (EC report)
128 * @flags: Additional device capabilities (passthrough port, trackstick, etc.).
129 * @x_max: Largest possible X position value.
130 * @y_max: Largest possible Y position value.
131 * @x_bits: Number of X bits in the MT bitmap.
132 * @y_bits: Number of Y bits in the MT bitmap.
133 * @hw_init: Protocol-specific hardware init function.
134 * @process_packet: Protocol-specific function to process a report packet.
135 * @decode_fields: Protocol-specific function to read packet bitfields.
136 * @set_abs_params: Protocol-specific function to configure the input_dev.
137 * @prev_fin: Finger bit from previous packet.
138 * @multi_packet: Multi-packet data in progress.
139 * @multi_data: Saved multi-packet data.
140 * @f: Decoded packet data fields.
141 * @quirks: Bitmap of ALPS_QUIRK_*.
142 * @timer: Timer for flushing out the final report packet in the stream.
145 struct input_dev
*dev2
;
148 /* these are autodetected when the device is identified */
149 const struct alps_nibble_commands
*nibble_commands
;
151 unsigned char proto_version
;
152 unsigned char byte0
, mask0
;
153 unsigned char fw_ver
[3];
160 int (*hw_init
)(struct psmouse
*psmouse
);
161 void (*process_packet
)(struct psmouse
*psmouse
);
162 int (*decode_fields
)(struct alps_fields
*f
, unsigned char *p
,
163 struct psmouse
*psmouse
);
164 void (*set_abs_params
)(struct alps_data
*priv
, struct input_dev
*dev1
);
168 unsigned char multi_data
[6];
169 struct alps_fields f
;
171 struct timer_list timer
;
174 #define ALPS_QUIRK_TRACKSTICK_BUTTONS 1 /* trakcstick buttons in trackstick packet */
176 #ifdef CONFIG_MOUSE_PS2_ALPS
177 int alps_detect(struct psmouse
*psmouse
, bool set_properties
);
178 int alps_init(struct psmouse
*psmouse
);
180 inline int alps_detect(struct psmouse
*psmouse
, bool set_properties
)
184 inline int alps_init(struct psmouse
*psmouse
)
188 #endif /* CONFIG_MOUSE_PS2_ALPS */
This page took 0.037708 seconds and 6 git commands to generate.