Skip to content

Commit 8326bb5

Browse files
committed
Input: ALPS - split protocol data from model info
In preparation of reworking the way we set protocol parameters let's split certain protocol items from alps_model_info into a separate structure. Tested-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent fb2dd7a commit 8326bb5

File tree

2 files changed

+46
-38
lines changed

2 files changed

+46
-38
lines changed

drivers/input/mouse/alps.c

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -102,32 +102,32 @@ static const struct alps_nibble_commands alps_v6_nibble_commands[] = {
102102
#define ALPS_BUTTONPAD 0x200 /* device is a clickpad */
103103

104104
static const struct alps_model_info alps_model_data[] = {
105-
{ { 0x32, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Toshiba Salellite Pro M10 */
106-
{ { 0x33, 0x02, 0x0a }, 0x00, ALPS_PROTO_V1, 0x88, 0xf8, 0 }, /* UMAX-530T */
107-
{ { 0x53, 0x02, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 },
108-
{ { 0x53, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 },
109-
{ { 0x60, 0x03, 0xc8 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 }, /* HP ze1115 */
110-
{ { 0x63, 0x02, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 },
111-
{ { 0x63, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 },
112-
{ { 0x63, 0x02, 0x28 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 }, /* Fujitsu Siemens S6010 */
113-
{ { 0x63, 0x02, 0x3c }, 0x00, ALPS_PROTO_V2, 0x8f, 0x8f, ALPS_WHEEL }, /* Toshiba Satellite S2400-103 */
114-
{ { 0x63, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xef, 0xef, ALPS_FW_BK_1 }, /* NEC Versa L320 */
115-
{ { 0x63, 0x02, 0x64 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 },
116-
{ { 0x63, 0x03, 0xc8 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D800 */
117-
{ { 0x73, 0x00, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_DUALPOINT }, /* ThinkPad R61 8918-5QG */
118-
{ { 0x73, 0x02, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, 0 },
119-
{ { 0x73, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 }, /* Ahtec Laptop */
120-
{ { 0x20, 0x02, 0x0e }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* XXX */
121-
{ { 0x22, 0x02, 0x0a }, 0x00, ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT },
122-
{ { 0x22, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */
105+
{ { 0x32, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } }, /* Toshiba Salellite Pro M10 */
106+
{ { 0x33, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V1, 0x88, 0xf8, 0 } }, /* UMAX-530T */
107+
{ { 0x53, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
108+
{ { 0x53, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
109+
{ { 0x60, 0x03, 0xc8 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } }, /* HP ze1115 */
110+
{ { 0x63, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
111+
{ { 0x63, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
112+
{ { 0x63, 0x02, 0x28 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 } }, /* Fujitsu Siemens S6010 */
113+
{ { 0x63, 0x02, 0x3c }, 0x00, { ALPS_PROTO_V2, 0x8f, 0x8f, ALPS_WHEEL } }, /* Toshiba Satellite S2400-103 */
114+
{ { 0x63, 0x02, 0x50 }, 0x00, { ALPS_PROTO_V2, 0xef, 0xef, ALPS_FW_BK_1 } }, /* NEC Versa L320 */
115+
{ { 0x63, 0x02, 0x64 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
116+
{ { 0x63, 0x03, 0xc8 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } }, /* Dell Latitude D800 */
117+
{ { 0x73, 0x00, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_DUALPOINT } }, /* ThinkPad R61 8918-5QG */
118+
{ { 0x73, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, 0 } },
119+
{ { 0x73, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_FW_BK_2 } }, /* Ahtec Laptop */
120+
{ { 0x20, 0x02, 0x0e }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } }, /* XXX */
121+
{ { 0x22, 0x02, 0x0a }, 0x00, { ALPS_PROTO_V2, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT } },
122+
{ { 0x22, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT } }, /* Dell Latitude D600 */
123123
/* Dell Latitude E5500, E6400, E6500, Precision M4400 */
124-
{ { 0x62, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf,
125-
ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED },
126-
{ { 0x73, 0x00, 0x14 }, 0x00, ALPS_PROTO_V6, 0xff, 0xff, ALPS_DUALPOINT }, /* Dell XT2 */
127-
{ { 0x73, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */
128-
{ { 0x52, 0x01, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff,
129-
ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */
130-
{ { 0x73, 0x02, 0x64 }, 0x8a, ALPS_PROTO_V4, 0x8f, 0x8f, 0 },
124+
{ { 0x62, 0x02, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xcf, 0xcf,
125+
ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED } },
126+
{ { 0x73, 0x00, 0x14 }, 0x00, { ALPS_PROTO_V6, 0xff, 0xff, ALPS_DUALPOINT } }, /* Dell XT2 */
127+
{ { 0x73, 0x02, 0x50 }, 0x00, { ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS } }, /* Dell Vostro 1400 */
128+
{ { 0x52, 0x01, 0x14 }, 0x00, { ALPS_PROTO_V2, 0xff, 0xff,
129+
ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED } }, /* Toshiba Tecra A11-11L */
130+
{ { 0x73, 0x02, 0x64 }, 0x8a, { ALPS_PROTO_V4, 0x8f, 0x8f, 0 } },
131131
};
132132

133133
static void alps_set_abs_params_st(struct alps_data *priv,
@@ -2264,12 +2264,12 @@ static int alps_match_table(struct psmouse *psmouse, struct alps_data *priv,
22642264
(!model->command_mode_resp ||
22652265
model->command_mode_resp == ec[2])) {
22662266

2267-
priv->proto_version = model->proto_version;
2267+
priv->proto_version = model->protocol_info.version;
22682268
alps_set_defaults(priv);
22692269

2270-
priv->flags = model->flags;
2271-
priv->byte0 = model->byte0;
2272-
priv->mask0 = model->mask0;
2270+
priv->flags = model->protocol_info.flags;
2271+
priv->byte0 = model->protocol_info.byte0;
2272+
priv->mask0 = model->protocol_info.mask0;
22732273

22742274
return 0;
22752275
}

drivers/input/mouse/alps.h

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,29 @@ enum V7_PACKET_ID {
4646
V7_PACKET_ID_UNKNOWN,
4747
};
4848

49+
/**
50+
* struct alps_protocol_info - information about protocol used by a device
51+
* @version: Indicates V1/V2/V3/...
52+
* @byte0: Helps figure out whether a position report packet matches the
53+
* known format for this model. The first byte of the report, ANDed with
54+
* mask0, should match byte0.
55+
* @mask0: The mask used to check the first byte of the report.
56+
* @flags: Additional device capabilities (passthrough port, trackstick, etc.).
57+
*/
58+
struct alps_protocol_info {
59+
u16 version;
60+
u8 byte0, mask0;
61+
unsigned int flags;
62+
};
63+
4964
/**
5065
* struct alps_model_info - touchpad ID table
5166
* @signature: E7 response string to match.
5267
* @command_mode_resp: For V3/V4 touchpads, the final byte of the EC response
5368
* (aka command mode response) identifies the firmware minor version. This
5469
* can be used to distinguish different hardware models which are not
5570
* uniquely identifiable through their E7 responses.
56-
* @proto_version: Indicates V1/V2/V3/...
57-
* @byte0: Helps figure out whether a position report packet matches the
58-
* known format for this model. The first byte of the report, ANDed with
59-
* mask0, should match byte0.
60-
* @mask0: The mask used to check the first byte of the report.
61-
* @flags: Additional device capabilities (passthrough port, trackstick, etc.).
71+
* @protocol_info: information about protcol used by the device.
6272
*
6373
* Many (but not all) ALPS touchpads can be identified by looking at the
6474
* values returned in the "E7 report" and/or the "EC report." This table
@@ -67,9 +77,7 @@ enum V7_PACKET_ID {
6777
struct alps_model_info {
6878
u8 signature[3];
6979
u8 command_mode_resp;
70-
u16 proto_version;
71-
u8 byte0, mask0;
72-
unsigned int flags;
80+
struct alps_protocol_info protocol_info;
7381
};
7482

7583
/**

0 commit comments

Comments
 (0)