diff options
author | Daniel Martin <daniel.martin@secunet.com> | 2015-03-09 01:29:15 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-03-09 02:33:16 -0400 |
commit | 5b3089ddb540401c1ad2e385a03d7e89ff954585 (patch) | |
tree | 4d2d523b5d940a5d2f0a026664d32fa72f5905bd /drivers/input | |
parent | b05f4d1c332a22f98c037fa64f249aa30877adaf (diff) |
Input: synaptics - support min/max board id in min_max_pnpid_table
Add a min/max range for board ids to the min/max coordinates quirk. This
makes it possible to restrict quirks to specific models based upon their
board id. The define ANY_BOARD_ID (0) serves as a wild card.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=91541
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Martin <daniel.martin@secunet.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/mouse/synaptics.c | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index af686a82b02b..a900a385e5c3 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -120,32 +120,41 @@ void synaptics_reset(struct psmouse *psmouse) | |||
120 | 120 | ||
121 | static bool cr48_profile_sensor; | 121 | static bool cr48_profile_sensor; |
122 | 122 | ||
123 | #define ANY_BOARD_ID 0 | ||
123 | struct min_max_quirk { | 124 | struct min_max_quirk { |
124 | const char * const *pnp_ids; | 125 | const char * const *pnp_ids; |
126 | struct { | ||
127 | unsigned long int min, max; | ||
128 | } board_id; | ||
125 | int x_min, x_max, y_min, y_max; | 129 | int x_min, x_max, y_min, y_max; |
126 | }; | 130 | }; |
127 | 131 | ||
128 | static const struct min_max_quirk min_max_pnpid_table[] = { | 132 | static const struct min_max_quirk min_max_pnpid_table[] = { |
129 | { | 133 | { |
130 | (const char * const []){"LEN0033", NULL}, | 134 | (const char * const []){"LEN0033", NULL}, |
135 | {ANY_BOARD_ID, ANY_BOARD_ID}, | ||
131 | 1024, 5052, 2258, 4832 | 136 | 1024, 5052, 2258, 4832 |
132 | }, | 137 | }, |
133 | { | 138 | { |
134 | (const char * const []){"LEN0042", NULL}, | 139 | (const char * const []){"LEN0042", NULL}, |
140 | {ANY_BOARD_ID, ANY_BOARD_ID}, | ||
135 | 1232, 5710, 1156, 4696 | 141 | 1232, 5710, 1156, 4696 |
136 | }, | 142 | }, |
137 | { | 143 | { |
138 | (const char * const []){"LEN0034", "LEN0036", "LEN0037", | 144 | (const char * const []){"LEN0034", "LEN0036", "LEN0037", |
139 | "LEN0039", "LEN2002", "LEN2004", | 145 | "LEN0039", "LEN2002", "LEN2004", |
140 | NULL}, | 146 | NULL}, |
147 | {ANY_BOARD_ID, ANY_BOARD_ID}, | ||
141 | 1024, 5112, 2024, 4832 | 148 | 1024, 5112, 2024, 4832 |
142 | }, | 149 | }, |
143 | { | 150 | { |
144 | (const char * const []){"LEN2001", NULL}, | 151 | (const char * const []){"LEN2001", NULL}, |
152 | {ANY_BOARD_ID, ANY_BOARD_ID}, | ||
145 | 1024, 5022, 2508, 4832 | 153 | 1024, 5022, 2508, 4832 |
146 | }, | 154 | }, |
147 | { | 155 | { |
148 | (const char * const []){"LEN2006", NULL}, | 156 | (const char * const []){"LEN2006", NULL}, |
157 | {ANY_BOARD_ID, ANY_BOARD_ID}, | ||
149 | 1264, 5675, 1171, 4688 | 158 | 1264, 5675, 1171, 4688 |
150 | }, | 159 | }, |
151 | { } | 160 | { } |
@@ -401,18 +410,27 @@ static void synaptics_apply_quirks(struct psmouse *psmouse) | |||
401 | int i; | 410 | int i; |
402 | 411 | ||
403 | for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) { | 412 | for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) { |
404 | if (psmouse_matches_pnp_id(psmouse, | 413 | if (!psmouse_matches_pnp_id(psmouse, |
405 | min_max_pnpid_table[i].pnp_ids)) { | 414 | min_max_pnpid_table[i].pnp_ids)) |
406 | priv->x_min = min_max_pnpid_table[i].x_min; | 415 | continue; |
407 | priv->x_max = min_max_pnpid_table[i].x_max; | 416 | |
408 | priv->y_min = min_max_pnpid_table[i].y_min; | 417 | if (min_max_pnpid_table[i].board_id.min != ANY_BOARD_ID && |
409 | priv->y_max = min_max_pnpid_table[i].y_max; | 418 | priv->board_id < min_max_pnpid_table[i].board_id.min) |
410 | psmouse_info(psmouse, | 419 | continue; |
411 | "quirked min/max coordinates: x [%d..%d], y [%d..%d]\n", | 420 | |
412 | priv->x_min, priv->x_max, | 421 | if (min_max_pnpid_table[i].board_id.max != ANY_BOARD_ID && |
413 | priv->y_min, priv->y_max); | 422 | priv->board_id > min_max_pnpid_table[i].board_id.max) |
414 | break; | 423 | continue; |
415 | } | 424 | |
425 | priv->x_min = min_max_pnpid_table[i].x_min; | ||
426 | priv->x_max = min_max_pnpid_table[i].x_max; | ||
427 | priv->y_min = min_max_pnpid_table[i].y_min; | ||
428 | priv->y_max = min_max_pnpid_table[i].y_max; | ||
429 | psmouse_info(psmouse, | ||
430 | "quirked min/max coordinates: x [%d..%d], y [%d..%d]\n", | ||
431 | priv->x_min, priv->x_max, | ||
432 | priv->y_min, priv->y_max); | ||
433 | break; | ||
416 | } | 434 | } |
417 | } | 435 | } |
418 | 436 | ||