* [PATCH v4 0/6] synaptics: match PNP-Id is not sufficient for min/max quirks
@ 2015-02-06 15:44 Benjamin Tissoires
2015-02-06 15:44 ` [PATCH v4 1/6] Input: synaptics - Split synaptics_resolution(), query first Benjamin Tissoires
` (5 more replies)
0 siblings, 6 replies; 12+ messages in thread
From: Benjamin Tissoires @ 2015-02-06 15:44 UTC (permalink / raw)
To: Dmitry Torokhov, Daniel Martin; +Cc: Hans de Goede, linux-input, linux-kernel
Hi,
Here is the v4 of Daniel's patch series regarding
https://bugzilla.kernel.org/show_bug.cgi?id=91541
I am resending the whole series to add the "cc: stable@" flags and
to fix v3 5/5 which did not applied properly on top of input.git/for-next.
Cheers,
Benjamin
Benjamin Tissoires (1):
Input: synaptics - Skip quirks when post-2013 dimensions
Daniel Martin (5):
Input: synaptics - Split synaptics_resolution(), query first
Input: synaptics - Log queried and quirked dimension values
Input: synaptics - Query min dimensions for fw v8.1
Input: synaptics - Remove obsolete min/max quirk for X240
Input: synaptics - Support min/max board id in min_max_pnpid_table
drivers/input/mouse/synaptics.c | 79 +++++++++++++++++++++++++++++++++--------
1 file changed, 64 insertions(+), 15 deletions(-)
--
2.1.0
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v4 1/6] Input: synaptics - Split synaptics_resolution(), query first
2015-02-06 15:44 [PATCH v4 0/6] synaptics: match PNP-Id is not sufficient for min/max quirks Benjamin Tissoires
@ 2015-02-06 15:44 ` Benjamin Tissoires
2015-03-09 6:41 ` Dmitry Torokhov
2015-02-06 15:44 ` [PATCH v4 2/6] Input: synaptics - Log queried and quirked dimension values Benjamin Tissoires
` (4 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Benjamin Tissoires @ 2015-02-06 15:44 UTC (permalink / raw)
To: Dmitry Torokhov, Daniel Martin; +Cc: Hans de Goede, linux-input, linux-kernel
From: Daniel Martin <consume.noise@gmail.com>
Split the function synaptics_resolution() into
synaptics_resolution() and synaptics_quirks().
synaptics_resolution() will be called before synaptics_quirks() to query
dimensions and resolutions before overwriting them with quirks.
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Martin <consume.noise@gmail.com>
---
v2: Removed SYN_ID_MAJOR() check from synaptics_quirks().
drivers/input/mouse/synaptics.c | 37 +++++++++++++++++++++++++------------
1 file changed, 25 insertions(+), 12 deletions(-)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 7e705ee..8c2b343 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -346,7 +346,6 @@ static int synaptics_resolution(struct psmouse *psmouse)
{
struct synaptics_data *priv = psmouse->private;
unsigned char resp[3];
- int i;
if (SYN_ID_MAJOR(priv->identity) < 4)
return 0;
@@ -358,17 +357,6 @@ static int synaptics_resolution(struct psmouse *psmouse)
}
}
- for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
- if (psmouse_matches_pnp_id(psmouse,
- min_max_pnpid_table[i].pnp_ids)) {
- priv->x_min = min_max_pnpid_table[i].x_min;
- priv->x_max = min_max_pnpid_table[i].x_max;
- priv->y_min = min_max_pnpid_table[i].y_min;
- priv->y_max = min_max_pnpid_table[i].y_max;
- return 0;
- }
- }
-
if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 &&
SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) {
if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MAX_COORDS, resp)) {
@@ -394,6 +382,29 @@ static int synaptics_resolution(struct psmouse *psmouse)
return 0;
}
+/*
+ * Apply quirk(s) if the hardware matches
+ */
+
+static int synaptics_quirks(struct psmouse *psmouse)
+{
+ struct synaptics_data *priv = psmouse->private;
+ int i;
+
+ for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
+ if (psmouse_matches_pnp_id(psmouse,
+ min_max_pnpid_table[i].pnp_ids)) {
+ priv->x_min = min_max_pnpid_table[i].x_min;
+ priv->x_max = min_max_pnpid_table[i].x_max;
+ priv->y_min = min_max_pnpid_table[i].y_min;
+ priv->y_max = min_max_pnpid_table[i].y_max;
+ break;
+ }
+ }
+
+ return 0;
+}
+
static int synaptics_query_hardware(struct psmouse *psmouse)
{
if (synaptics_identify(psmouse))
@@ -408,6 +419,8 @@ static int synaptics_query_hardware(struct psmouse *psmouse)
return -1;
if (synaptics_resolution(psmouse))
return -1;
+ if (synaptics_quirks(psmouse))
+ return -1;
return 0;
}
--
2.1.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v4 2/6] Input: synaptics - Log queried and quirked dimension values
2015-02-06 15:44 [PATCH v4 0/6] synaptics: match PNP-Id is not sufficient for min/max quirks Benjamin Tissoires
2015-02-06 15:44 ` [PATCH v4 1/6] Input: synaptics - Split synaptics_resolution(), query first Benjamin Tissoires
@ 2015-02-06 15:44 ` Benjamin Tissoires
2015-03-09 6:43 ` Dmitry Torokhov
2015-02-06 15:44 ` [PATCH v4 3/6] Input: synaptics - Query min dimensions for fw v8.1 Benjamin Tissoires
` (3 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Benjamin Tissoires @ 2015-02-06 15:44 UTC (permalink / raw)
To: Dmitry Torokhov, Daniel Martin; +Cc: Hans de Goede, linux-input, linux-kernel
From: Daniel Martin <consume.noise@gmail.com>
Logging the dimension values we queried (info) and the values we use
from a quirk to overwrite (warn) can be helpful for debugging.
This partly relates to bug:
https://bugzilla.kernel.org/show_bug.cgi?id=91541
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Martin <consume.noise@gmail.com>
---
drivers/input/mouse/synaptics.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 8c2b343..0485e6b 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -365,6 +365,10 @@ static int synaptics_resolution(struct psmouse *psmouse)
} else {
priv->x_max = (resp[0] << 5) | ((resp[1] & 0x0f) << 1);
priv->y_max = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3);
+ psmouse_info(psmouse,
+ "queried max coordinates: "
+ "x [..%d], y [..%d]\n",
+ priv->x_max, priv->y_max);
}
}
@@ -376,6 +380,10 @@ static int synaptics_resolution(struct psmouse *psmouse)
} else {
priv->x_min = (resp[0] << 5) | ((resp[1] & 0x0f) << 1);
priv->y_min = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3);
+ psmouse_info(psmouse,
+ "queried min coordinates: "
+ "x [%d..], y [%d..]\n",
+ priv->x_min, priv->y_min);
}
}
@@ -398,6 +406,11 @@ static int synaptics_quirks(struct psmouse *psmouse)
priv->x_max = min_max_pnpid_table[i].x_max;
priv->y_min = min_max_pnpid_table[i].y_min;
priv->y_max = min_max_pnpid_table[i].y_max;
+ psmouse_warn(psmouse,
+ "quirked min/max coordinates: "
+ "x [%d..%d], y [%d..%d]\n",
+ priv->x_min, priv->x_max,
+ priv->y_min, priv->y_max);
break;
}
}
--
2.1.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v4 3/6] Input: synaptics - Query min dimensions for fw v8.1
2015-02-06 15:44 [PATCH v4 0/6] synaptics: match PNP-Id is not sufficient for min/max quirks Benjamin Tissoires
2015-02-06 15:44 ` [PATCH v4 1/6] Input: synaptics - Split synaptics_resolution(), query first Benjamin Tissoires
2015-02-06 15:44 ` [PATCH v4 2/6] Input: synaptics - Log queried and quirked dimension values Benjamin Tissoires
@ 2015-02-06 15:44 ` Benjamin Tissoires
2015-02-06 18:14 ` Benjamin Tissoires
2015-02-06 15:44 ` [PATCH v4 4/6] Input: synaptics - Remove obsolete min/max quirk for X240 Benjamin Tissoires
` (2 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Benjamin Tissoires @ 2015-02-06 15:44 UTC (permalink / raw)
To: Dmitry Torokhov, Daniel Martin; +Cc: Hans de Goede, linux-input, linux-kernel
From: Daniel Martin <consume.noise@gmail.com>
Query the min dimensions even if the check
SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7
fails, but we know that the firmware version 8.1 is safe.
With that we don't need quirks for post-2013 models anymore as they
expose correct min and max dimensions.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=91541
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Martin <consume.noise@gmail.com>
re-order the tests to check SYN_CAP_MIN_DIMENSIONS even on FW 8.1
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
v2: Don't use a list for safe firmwares.
drivers/input/mouse/synaptics.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 0485e6b..19dc87f 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -372,8 +372,13 @@ static int synaptics_resolution(struct psmouse *psmouse)
}
}
- if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 &&
- SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c)) {
+ if (SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c) &&
+ (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 ||
+ /* Firmware v8.1 doesn't stand the previous checks, though has
+ * been proven to report correct min coordinates.
+ * https://bugzilla.kernel.org/show_bug.cgi?id=91541 */
+ (SYN_ID_MAJOR(priv->identity) == 8 &&
+ SYN_ID_MINOR(priv->identity) == 1))) {
if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MIN_COORDS, resp)) {
psmouse_warn(psmouse,
"device claims to have min coordinates query, but I'm not able to read it.\n");
--
2.1.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v4 4/6] Input: synaptics - Remove obsolete min/max quirk for X240
2015-02-06 15:44 [PATCH v4 0/6] synaptics: match PNP-Id is not sufficient for min/max quirks Benjamin Tissoires
` (2 preceding siblings ...)
2015-02-06 15:44 ` [PATCH v4 3/6] Input: synaptics - Query min dimensions for fw v8.1 Benjamin Tissoires
@ 2015-02-06 15:44 ` Benjamin Tissoires
2015-02-06 15:44 ` [PATCH v4 5/6] Input: synaptics - Support min/max board id in min_max_pnpid_table Benjamin Tissoires
2015-02-06 15:44 ` [PATCH v4 6/6] Input: synaptics - Skip quirks when post-2013 dimensions Benjamin Tissoires
5 siblings, 0 replies; 12+ messages in thread
From: Benjamin Tissoires @ 2015-02-06 15:44 UTC (permalink / raw)
To: Dmitry Torokhov, Daniel Martin; +Cc: Hans de Goede, linux-input, linux-kernel
From: Daniel Martin <consume.noise@gmail.com>
The firmware of the X240 (LEN0035, 2013/12) exposes the same values
x [1232..5710], y [1156..4696]
as the quirk applies.
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Martin <consume.noise@gmail.com>
---
drivers/input/mouse/synaptics.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 19dc87f..359e26d 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -134,7 +134,7 @@ static const struct min_max_quirk min_max_pnpid_table[] = {
1024, 5052, 2258, 4832
},
{
- (const char * const []){"LEN0035", "LEN0042", NULL},
+ (const char * const []){"LEN0042", NULL},
1232, 5710, 1156, 4696
},
{
--
2.1.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v4 5/6] Input: synaptics - Support min/max board id in min_max_pnpid_table
2015-02-06 15:44 [PATCH v4 0/6] synaptics: match PNP-Id is not sufficient for min/max quirks Benjamin Tissoires
` (3 preceding siblings ...)
2015-02-06 15:44 ` [PATCH v4 4/6] Input: synaptics - Remove obsolete min/max quirk for X240 Benjamin Tissoires
@ 2015-02-06 15:44 ` Benjamin Tissoires
2015-02-06 15:44 ` [PATCH v4 6/6] Input: synaptics - Skip quirks when post-2013 dimensions Benjamin Tissoires
5 siblings, 0 replies; 12+ messages in thread
From: Benjamin Tissoires @ 2015-02-06 15:44 UTC (permalink / raw)
To: Dmitry Torokhov, Daniel Martin; +Cc: Hans de Goede, linux-input, linux-kernel
From: Daniel Martin <daniel.martin@secunet.com>
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 wildcard.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=91541
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Martin <daniel.martin@secunet.com>
---
drivers/input/mouse/synaptics.c | 44 +++++++++++++++++++++++++++++------------
1 file changed, 31 insertions(+), 13 deletions(-)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 359e26d..b02000f 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -123,32 +123,41 @@ void synaptics_reset(struct psmouse *psmouse)
static bool cr48_profile_sensor;
+#define ANY_BOARD_ID 0
struct min_max_quirk {
const char * const *pnp_ids;
+ struct {
+ unsigned long int min, max;
+ } board_id;
int x_min, x_max, y_min, y_max;
};
static const struct min_max_quirk min_max_pnpid_table[] = {
{
(const char * const []){"LEN0033", NULL},
+ {ANY_BOARD_ID, ANY_BOARD_ID},
1024, 5052, 2258, 4832
},
{
(const char * const []){"LEN0042", NULL},
+ {ANY_BOARD_ID, ANY_BOARD_ID},
1232, 5710, 1156, 4696
},
{
(const char * const []){"LEN0034", "LEN0036", "LEN0037",
"LEN0039", "LEN2002", "LEN2004",
NULL},
+ {ANY_BOARD_ID, ANY_BOARD_ID},
1024, 5112, 2024, 4832
},
{
(const char * const []){"LEN2001", NULL},
+ {ANY_BOARD_ID, ANY_BOARD_ID},
1024, 5022, 2508, 4832
},
{
(const char * const []){"LEN2006", NULL},
+ {ANY_BOARD_ID, ANY_BOARD_ID},
1264, 5675, 1171, 4688
},
{ }
@@ -405,19 +414,28 @@ static int synaptics_quirks(struct psmouse *psmouse)
int i;
for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
- if (psmouse_matches_pnp_id(psmouse,
- min_max_pnpid_table[i].pnp_ids)) {
- priv->x_min = min_max_pnpid_table[i].x_min;
- priv->x_max = min_max_pnpid_table[i].x_max;
- priv->y_min = min_max_pnpid_table[i].y_min;
- priv->y_max = min_max_pnpid_table[i].y_max;
- psmouse_warn(psmouse,
- "quirked min/max coordinates: "
- "x [%d..%d], y [%d..%d]\n",
- priv->x_min, priv->x_max,
- priv->y_min, priv->y_max);
- break;
- }
+ if (!psmouse_matches_pnp_id(psmouse,
+ min_max_pnpid_table[i].pnp_ids))
+ continue;
+
+ if (min_max_pnpid_table[i].board_id.min != ANY_BOARD_ID &&
+ priv->board_id < min_max_pnpid_table[i].board_id.min)
+ continue;
+
+ if (min_max_pnpid_table[i].board_id.max != ANY_BOARD_ID &&
+ priv->board_id > min_max_pnpid_table[i].board_id.max)
+ continue;
+
+ priv->x_min = min_max_pnpid_table[i].x_min;
+ priv->x_max = min_max_pnpid_table[i].x_max;
+ priv->y_min = min_max_pnpid_table[i].y_min;
+ priv->y_max = min_max_pnpid_table[i].y_max;
+ psmouse_warn(psmouse,
+ "quirked min/max coordinates: "
+ "x [%d..%d], y [%d..%d]\n",
+ priv->x_min, priv->x_max,
+ priv->y_min, priv->y_max);
+ break;
}
return 0;
--
2.1.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v4 6/6] Input: synaptics - Skip quirks when post-2013 dimensions
2015-02-06 15:44 [PATCH v4 0/6] synaptics: match PNP-Id is not sufficient for min/max quirks Benjamin Tissoires
` (4 preceding siblings ...)
2015-02-06 15:44 ` [PATCH v4 5/6] Input: synaptics - Support min/max board id in min_max_pnpid_table Benjamin Tissoires
@ 2015-02-06 15:44 ` Benjamin Tissoires
5 siblings, 0 replies; 12+ messages in thread
From: Benjamin Tissoires @ 2015-02-06 15:44 UTC (permalink / raw)
To: Dmitry Torokhov, Daniel Martin; +Cc: Hans de Goede, linux-input, linux-kernel
post-2013 Lenovo laptops provide correct min/max dimensions, which
are different with the ones currently quirked.
According to https://bugzilla.kernel.org/show_bug.cgi?id=91541
The following board ids are assigned in the post-2013 touchpads:
t440p/t440s: LEN0036 -> 2964/2962
t540p: LEN0034 -> 2964
Using 2961 as the common minimum makes these 3 laptops OK. We may need
to update those values later if other pnp_ids has a lower board_id.
Cc: stable@vger.kernel.org
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
drivers/input/mouse/synaptics.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index b02000f..d5c120b 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -147,7 +147,7 @@ static const struct min_max_quirk min_max_pnpid_table[] = {
(const char * const []){"LEN0034", "LEN0036", "LEN0037",
"LEN0039", "LEN2002", "LEN2004",
NULL},
- {ANY_BOARD_ID, ANY_BOARD_ID},
+ {ANY_BOARD_ID, 2961},
1024, 5112, 2024, 4832
},
{
--
2.1.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v4 3/6] Input: synaptics - Query min dimensions for fw v8.1
2015-02-06 15:44 ` [PATCH v4 3/6] Input: synaptics - Query min dimensions for fw v8.1 Benjamin Tissoires
@ 2015-02-06 18:14 ` Benjamin Tissoires
2015-02-07 8:50 ` Hans de Goede
0 siblings, 1 reply; 12+ messages in thread
From: Benjamin Tissoires @ 2015-02-06 18:14 UTC (permalink / raw)
To: Dmitry Torokhov, Daniel Martin; +Cc: Hans de Goede, linux-input, linux-kernel
On 02/06/2015 10:44 AM, Benjamin Tissoires wrote:
> From: Daniel Martin <consume.noise@gmail.com>
>
> Query the min dimensions even if the check
> SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7
> fails, but we know that the firmware version 8.1 is safe.
>
> With that we don't need quirks for post-2013 models anymore as they
> expose correct min and max dimensions.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=91541
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniel Martin <consume.noise@gmail.com>
> re-order the tests to check SYN_CAP_MIN_DIMENSIONS even on FW 8.1
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
> v2: Don't use a list for safe firmwares.
>
> drivers/input/mouse/synaptics.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> index 0485e6b..19dc87f 100644
> --- a/drivers/input/mouse/synaptics.c
> +++ b/drivers/input/mouse/synaptics.c
> @@ -372,8 +372,13 @@ static int synaptics_resolution(struct psmouse *psmouse)
> }
> }
>
> - if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 &&
> - SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c)) {
> + if (SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c) &&
> + (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 ||
> + /* Firmware v8.1 doesn't stand the previous checks, though has
> + * been proven to report correct min coordinates.
> + * https://bugzilla.kernel.org/show_bug.cgi?id=91541 */
> + (SYN_ID_MAJOR(priv->identity) == 8 &&
> + SYN_ID_MINOR(priv->identity) == 1))) {
Hmm... this can be actually read as:
+ SYN_ID_FULL(priv->identity) == 0x801)) {
Cheers,
Benjamin
> if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MIN_COORDS, resp)) {
> psmouse_warn(psmouse,
> "device claims to have min coordinates query, but I'm not able to read it.\n");
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 3/6] Input: synaptics - Query min dimensions for fw v8.1
2015-02-06 18:14 ` Benjamin Tissoires
@ 2015-02-07 8:50 ` Hans de Goede
2015-03-09 6:43 ` Dmitry Torokhov
0 siblings, 1 reply; 12+ messages in thread
From: Hans de Goede @ 2015-02-07 8:50 UTC (permalink / raw)
To: Benjamin Tissoires, Dmitry Torokhov, Daniel Martin
Cc: linux-input, linux-kernel
Hi,
On 02/06/2015 07:14 PM, Benjamin Tissoires wrote:
>
>
> On 02/06/2015 10:44 AM, Benjamin Tissoires wrote:
>> From: Daniel Martin <consume.noise@gmail.com>
>>
>> Query the min dimensions even if the check
>> SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7
>> fails, but we know that the firmware version 8.1 is safe.
>>
>> With that we don't need quirks for post-2013 models anymore as they
>> expose correct min and max dimensions.
>>
>> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=91541
>>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Daniel Martin <consume.noise@gmail.com>
>> re-order the tests to check SYN_CAP_MIN_DIMENSIONS even on FW 8.1
>> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
>> ---
>> v2: Don't use a list for safe firmwares.
>>
>> drivers/input/mouse/synaptics.c | 9 +++++++--
>> 1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
>> index 0485e6b..19dc87f 100644
>> --- a/drivers/input/mouse/synaptics.c
>> +++ b/drivers/input/mouse/synaptics.c
>> @@ -372,8 +372,13 @@ static int synaptics_resolution(struct psmouse *psmouse)
>> }
>> }
>>
>> - if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 &&
>> - SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c)) {
>> + if (SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c) &&
>> + (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 ||
>> + /* Firmware v8.1 doesn't stand the previous checks, though has
>> + * been proven to report correct min coordinates.
>> + * https://bugzilla.kernel.org/show_bug.cgi?id=91541 */
>> + (SYN_ID_MAJOR(priv->identity) == 8 &&
>> + SYN_ID_MINOR(priv->identity) == 1))) {
>
> Hmm... this can be actually read as:
> + SYN_ID_FULL(priv->identity) == 0x801)) {
And "checks" should be just "check" as the firmware check only is or-ed
together with the >= 7 check (which is intentional but the comment suggests
wrongly that it overrides both check_s_ .
Other then that the entire series looks good and is:
Acked-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
>
> Cheers,
> Benjamin
>
>> if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MIN_COORDS, resp)) {
>> psmouse_warn(psmouse,
>> "device claims to have min coordinates query, but I'm not able to read it.\n");
>>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 1/6] Input: synaptics - Split synaptics_resolution(), query first
2015-02-06 15:44 ` [PATCH v4 1/6] Input: synaptics - Split synaptics_resolution(), query first Benjamin Tissoires
@ 2015-03-09 6:41 ` Dmitry Torokhov
0 siblings, 0 replies; 12+ messages in thread
From: Dmitry Torokhov @ 2015-03-09 6:41 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Daniel Martin, Hans de Goede, linux-input, linux-kernel
On Fri, Feb 06, 2015 at 10:44:54AM -0500, Benjamin Tissoires wrote:
> From: Daniel Martin <consume.noise@gmail.com>
>
> Split the function synaptics_resolution() into
> synaptics_resolution() and synaptics_quirks().
>
> synaptics_resolution() will be called before synaptics_quirks() to query
> dimensions and resolutions before overwriting them with quirks.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniel Martin <consume.noise@gmail.com>
> ---
>
> v2: Removed SYN_ID_MAJOR() check from synaptics_quirks().
>
> drivers/input/mouse/synaptics.c | 37 +++++++++++++++++++++++++------------
> 1 file changed, 25 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> index 7e705ee..8c2b343 100644
> --- a/drivers/input/mouse/synaptics.c
> +++ b/drivers/input/mouse/synaptics.c
> @@ -346,7 +346,6 @@ static int synaptics_resolution(struct psmouse *psmouse)
> {
> struct synaptics_data *priv = psmouse->private;
> unsigned char resp[3];
> - int i;
>
> if (SYN_ID_MAJOR(priv->identity) < 4)
> return 0;
> @@ -358,17 +357,6 @@ static int synaptics_resolution(struct psmouse *psmouse)
> }
> }
>
> - for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
> - if (psmouse_matches_pnp_id(psmouse,
> - min_max_pnpid_table[i].pnp_ids)) {
> - priv->x_min = min_max_pnpid_table[i].x_min;
> - priv->x_max = min_max_pnpid_table[i].x_max;
> - priv->y_min = min_max_pnpid_table[i].y_min;
> - priv->y_max = min_max_pnpid_table[i].y_max;
> - return 0;
> - }
> - }
> -
> if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 &&
> SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) {
> if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MAX_COORDS, resp)) {
> @@ -394,6 +382,29 @@ static int synaptics_resolution(struct psmouse *psmouse)
> return 0;
> }
>
> +/*
> + * Apply quirk(s) if the hardware matches
> + */
> +
> +static int synaptics_quirks(struct psmouse *psmouse)
This function does not seem to ever failing and does not access the
hardware so I switched it to be void.
Thanks.
> +{
> + struct synaptics_data *priv = psmouse->private;
> + int i;
> +
> + for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
> + if (psmouse_matches_pnp_id(psmouse,
> + min_max_pnpid_table[i].pnp_ids)) {
> + priv->x_min = min_max_pnpid_table[i].x_min;
> + priv->x_max = min_max_pnpid_table[i].x_max;
> + priv->y_min = min_max_pnpid_table[i].y_min;
> + priv->y_max = min_max_pnpid_table[i].y_max;
> + break;
> + }
> + }
> +
> + return 0;
> +}
> +
> static int synaptics_query_hardware(struct psmouse *psmouse)
> {
> if (synaptics_identify(psmouse))
> @@ -408,6 +419,8 @@ static int synaptics_query_hardware(struct psmouse *psmouse)
> return -1;
> if (synaptics_resolution(psmouse))
> return -1;
> + if (synaptics_quirks(psmouse))
> + return -1;
>
> return 0;
> }
> --
> 2.1.0
>
--
Dmitry
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 2/6] Input: synaptics - Log queried and quirked dimension values
2015-02-06 15:44 ` [PATCH v4 2/6] Input: synaptics - Log queried and quirked dimension values Benjamin Tissoires
@ 2015-03-09 6:43 ` Dmitry Torokhov
0 siblings, 0 replies; 12+ messages in thread
From: Dmitry Torokhov @ 2015-03-09 6:43 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Daniel Martin, Hans de Goede, linux-input, linux-kernel
On Fri, Feb 06, 2015 at 10:44:55AM -0500, Benjamin Tissoires wrote:
> From: Daniel Martin <consume.noise@gmail.com>
>
> Logging the dimension values we queried (info) and the values we use
> from a quirk to overwrite (warn) can be helpful for debugging.
Warnings should be sed when something goes wrong, not during normal
operations. Switched all to info and merged split strings.
Thanks.
>
> This partly relates to bug:
> https://bugzilla.kernel.org/show_bug.cgi?id=91541
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniel Martin <consume.noise@gmail.com>
> ---
> drivers/input/mouse/synaptics.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> index 8c2b343..0485e6b 100644
> --- a/drivers/input/mouse/synaptics.c
> +++ b/drivers/input/mouse/synaptics.c
> @@ -365,6 +365,10 @@ static int synaptics_resolution(struct psmouse *psmouse)
> } else {
> priv->x_max = (resp[0] << 5) | ((resp[1] & 0x0f) << 1);
> priv->y_max = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3);
> + psmouse_info(psmouse,
> + "queried max coordinates: "
> + "x [..%d], y [..%d]\n",
> + priv->x_max, priv->y_max);
> }
> }
>
> @@ -376,6 +380,10 @@ static int synaptics_resolution(struct psmouse *psmouse)
> } else {
> priv->x_min = (resp[0] << 5) | ((resp[1] & 0x0f) << 1);
> priv->y_min = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3);
> + psmouse_info(psmouse,
> + "queried min coordinates: "
> + "x [%d..], y [%d..]\n",
> + priv->x_min, priv->y_min);
> }
> }
>
> @@ -398,6 +406,11 @@ static int synaptics_quirks(struct psmouse *psmouse)
> priv->x_max = min_max_pnpid_table[i].x_max;
> priv->y_min = min_max_pnpid_table[i].y_min;
> priv->y_max = min_max_pnpid_table[i].y_max;
> + psmouse_warn(psmouse,
> + "quirked min/max coordinates: "
> + "x [%d..%d], y [%d..%d]\n",
> + priv->x_min, priv->x_max,
> + priv->y_min, priv->y_max);
> break;
> }
> }
> --
> 2.1.0
>
--
Dmitry
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 3/6] Input: synaptics - Query min dimensions for fw v8.1
2015-02-07 8:50 ` Hans de Goede
@ 2015-03-09 6:43 ` Dmitry Torokhov
0 siblings, 0 replies; 12+ messages in thread
From: Dmitry Torokhov @ 2015-03-09 6:43 UTC (permalink / raw)
To: Hans de Goede
Cc: Benjamin Tissoires, Daniel Martin, linux-input, linux-kernel
On Sat, Feb 07, 2015 at 09:50:57AM +0100, Hans de Goede wrote:
> Hi,
>
> On 02/06/2015 07:14 PM, Benjamin Tissoires wrote:
> >
> >
> > On 02/06/2015 10:44 AM, Benjamin Tissoires wrote:
> >> From: Daniel Martin <consume.noise@gmail.com>
> >>
> >> Query the min dimensions even if the check
> >> SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7
> >> fails, but we know that the firmware version 8.1 is safe.
> >>
> >> With that we don't need quirks for post-2013 models anymore as they
> >> expose correct min and max dimensions.
> >>
> >> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=91541
> >>
> >> Cc: stable@vger.kernel.org
> >> Signed-off-by: Daniel Martin <consume.noise@gmail.com>
> >> re-order the tests to check SYN_CAP_MIN_DIMENSIONS even on FW 8.1
> >> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> >> ---
> >> v2: Don't use a list for safe firmwares.
> >>
> >> drivers/input/mouse/synaptics.c | 9 +++++++--
> >> 1 file changed, 7 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> >> index 0485e6b..19dc87f 100644
> >> --- a/drivers/input/mouse/synaptics.c
> >> +++ b/drivers/input/mouse/synaptics.c
> >> @@ -372,8 +372,13 @@ static int synaptics_resolution(struct psmouse *psmouse)
> >> }
> >> }
> >>
> >> - if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 &&
> >> - SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c)) {
> >> + if (SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c) &&
> >> + (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 ||
> >> + /* Firmware v8.1 doesn't stand the previous checks, though has
> >> + * been proven to report correct min coordinates.
> >> + * https://bugzilla.kernel.org/show_bug.cgi?id=91541 */
> >> + (SYN_ID_MAJOR(priv->identity) == 8 &&
> >> + SYN_ID_MINOR(priv->identity) == 1))) {
> >
> > Hmm... this can be actually read as:
> > + SYN_ID_FULL(priv->identity) == 0x801)) {
>
> And "checks" should be just "check" as the firmware check only is or-ed
> together with the >= 7 check (which is intentional but the comment suggests
> wrongly that it overrides both check_s_ .
>
> Other then that the entire series looks good and is:
>
> Acked-by: Hans de Goede <hdegoede@redhat.com>
Adjusted to use SYN_ID_FULL and adjusted the comment as well.
>
> Regards,
>
> Hans
>
>
> >
> > Cheers,
> > Benjamin
> >
> >> if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MIN_COORDS, resp)) {
> >> psmouse_warn(psmouse,
> >> "device claims to have min coordinates query, but I'm not able to read it.\n");
> >>
--
Dmitry
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-03-09 6:43 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-06 15:44 [PATCH v4 0/6] synaptics: match PNP-Id is not sufficient for min/max quirks Benjamin Tissoires
2015-02-06 15:44 ` [PATCH v4 1/6] Input: synaptics - Split synaptics_resolution(), query first Benjamin Tissoires
2015-03-09 6:41 ` Dmitry Torokhov
2015-02-06 15:44 ` [PATCH v4 2/6] Input: synaptics - Log queried and quirked dimension values Benjamin Tissoires
2015-03-09 6:43 ` Dmitry Torokhov
2015-02-06 15:44 ` [PATCH v4 3/6] Input: synaptics - Query min dimensions for fw v8.1 Benjamin Tissoires
2015-02-06 18:14 ` Benjamin Tissoires
2015-02-07 8:50 ` Hans de Goede
2015-03-09 6:43 ` Dmitry Torokhov
2015-02-06 15:44 ` [PATCH v4 4/6] Input: synaptics - Remove obsolete min/max quirk for X240 Benjamin Tissoires
2015-02-06 15:44 ` [PATCH v4 5/6] Input: synaptics - Support min/max board id in min_max_pnpid_table Benjamin Tissoires
2015-02-06 15:44 ` [PATCH v4 6/6] Input: synaptics - Skip quirks when post-2013 dimensions Benjamin Tissoires
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.