[kernel] r22658 - in dists/jessie/linux/debian: . patches patches/bugfix/x86
Ben Hutchings
benh at moszumanska.debian.org
Sun May 17 23:30:24 UTC 2015
Author: benh
Date: Sun May 17 23:30:24 2015
New Revision: 22658
Log:
[x86] Input: synaptics: Fix routing of trackpoint buttons on Lenovo 2015 models (Closes: #780862)
Added:
dists/jessie/linux/debian/patches/bugfix/x86/input-synaptics-re-route-tracksticks-buttons-on-the-.patch
dists/jessie/linux/debian/patches/bugfix/x86/input-synaptics-remove-topbuttonpad-property-for-len.patch
dists/jessie/linux/debian/patches/bugfix/x86/input-synaptics-retrieve-the-extended-capabilities-i.patch
Modified:
dists/jessie/linux/debian/changelog
dists/jessie/linux/debian/patches/series
Modified: dists/jessie/linux/debian/changelog
==============================================================================
--- dists/jessie/linux/debian/changelog Sun May 17 23:00:53 2015 (r22657)
+++ dists/jessie/linux/debian/changelog Sun May 17 23:30:24 2015 (r22658)
@@ -154,6 +154,8 @@
- [armhf] mvebu: armada-xp-openblocks-ax3-4: Disable internal RTC
- rtc: hctosys: do not treat lack of RTC device as error
- rtc: hctosys: use function name in the error log
+ * [x86] Input: synaptics: Fix routing of trackpoint buttons on Lenovo
+ 2015 models (Closes: #780862)
[ Ian Campbell ]
* [armhf] Enable support for Freescale SNVS RTC. (Closes: #782364)
Added: dists/jessie/linux/debian/patches/bugfix/x86/input-synaptics-re-route-tracksticks-buttons-on-the-.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/jessie/linux/debian/patches/bugfix/x86/input-synaptics-re-route-tracksticks-buttons-on-the-.patch Sun May 17 23:30:24 2015 (r22658)
@@ -0,0 +1,146 @@
+From: Benjamin Tissoires <benjamin.tissoires at redhat.com>
+Date: Sun, 8 Mar 2015 22:35:41 -0700
+Subject: Input: synaptics - re-route tracksticks buttons on the Lenovo 2015
+ series
+Origin: https://git.kernel.org/linus/cdd9dc195916ef5644cfac079094c3c1d1616e4c
+Bug-Debian: https://bugs.debian.org/780862
+
+The 2015 series of the Lenovo thinkpads added back the hardware buttons on
+top of the touchpad for the trackstick.
+
+Unfortunately, they are wired to the touchpad, and not the trackstick.
+Thus, they are seen as extra buttons from the kernel point of view.
+
+This leads to a problem in user space because extra buttons on synaptics
+devices used to be used as scroll up/down buttons. So in the end, the
+experience for the user is scroll events for buttons left and right when
+using the trackstick. Yay!
+
+Fortunately, the firmware advertises such behavior in the extended
+capability $10, and so we can re-route the buttons through the pass-through
+interface.
+
+Hallelujah-expressed-by: Peter Hutterer <peter.hutterer at who-t.net>
+Signed-off-by: Benjamin Tissoires <benjamin.tissoires at redhat.com>
+Acked-by: Hans de Goede <hdegoede at redhat.com>
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov at gmail.com>
+---
+ drivers/input/mouse/synaptics.c | 47 +++++++++++++++++++++++++++++++----------
+ drivers/input/mouse/synaptics.h | 5 +++++
+ 2 files changed, 41 insertions(+), 11 deletions(-)
+
+--- a/drivers/input/mouse/synaptics.c
++++ b/drivers/input/mouse/synaptics.c
+@@ -577,18 +577,22 @@ static int synaptics_is_pt_packet(unsign
+ return (buf[0] & 0xFC) == 0x84 && (buf[3] & 0xCC) == 0xC4;
+ }
+
+-static void synaptics_pass_pt_packet(struct serio *ptport, unsigned char *packet)
++static void synaptics_pass_pt_packet(struct psmouse *psmouse,
++ struct serio *ptport,
++ unsigned char *packet)
+ {
++ struct synaptics_data *priv = psmouse->private;
+ struct psmouse *child = serio_get_drvdata(ptport);
+
+ if (child && child->state == PSMOUSE_ACTIVATED) {
+- serio_interrupt(ptport, packet[1], 0);
++ serio_interrupt(ptport, packet[1] | priv->pt_buttons, 0);
+ serio_interrupt(ptport, packet[4], 0);
+ serio_interrupt(ptport, packet[5], 0);
+ if (child->pktsize == 4)
+ serio_interrupt(ptport, packet[2], 0);
+- } else
++ } else {
+ serio_interrupt(ptport, packet[1], 0);
++ }
+ }
+
+ static void synaptics_pt_activate(struct psmouse *psmouse)
+@@ -845,6 +849,7 @@ static void synaptics_report_ext_buttons
+ struct input_dev *dev = psmouse->dev;
+ struct synaptics_data *priv = psmouse->private;
+ int ext_bits = (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1;
++ char buf[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ int i;
+
+ if (!SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))
+@@ -855,12 +860,30 @@ static void synaptics_report_ext_buttons
+ !((psmouse->packet[0] ^ psmouse->packet[3]) & 0x02))
+ return;
+
+- for (i = 0; i < ext_bits; i++) {
+- input_report_key(dev, BTN_0 + 2 * i,
+- hw->ext_buttons & (1 << i));
+- input_report_key(dev, BTN_1 + 2 * i,
+- hw->ext_buttons & (1 << (i + ext_bits)));
++ if (!SYN_CAP_EXT_BUTTONS_STICK(priv->ext_cap_10)) {
++ for (i = 0; i < ext_bits; i++) {
++ input_report_key(dev, BTN_0 + 2 * i,
++ hw->ext_buttons & (1 << i));
++ input_report_key(dev, BTN_1 + 2 * i,
++ hw->ext_buttons & (1 << (i + ext_bits)));
++ }
++ return;
+ }
++
++ /*
++ * This generation of touchpads has the trackstick buttons
++ * physically wired to the touchpad. Re-route them through
++ * the pass-through interface.
++ */
++ if (!priv->pt_port)
++ return;
++
++ /* The trackstick expects at most 3 buttons */
++ priv->pt_buttons = SYN_CAP_EXT_BUTTON_STICK_L(hw->ext_buttons) |
++ SYN_CAP_EXT_BUTTON_STICK_R(hw->ext_buttons) << 1 |
++ SYN_CAP_EXT_BUTTON_STICK_M(hw->ext_buttons) << 2;
++
++ synaptics_pass_pt_packet(psmouse, priv->pt_port, buf);
+ }
+
+ static void synaptics_report_buttons(struct psmouse *psmouse,
+@@ -1416,7 +1439,8 @@ static psmouse_ret_t synaptics_process_b
+ if (SYN_CAP_PASS_THROUGH(priv->capabilities) &&
+ synaptics_is_pt_packet(psmouse->packet)) {
+ if (priv->pt_port)
+- synaptics_pass_pt_packet(priv->pt_port, psmouse->packet);
++ synaptics_pass_pt_packet(psmouse, priv->pt_port,
++ psmouse->packet);
+ } else
+ synaptics_process_packet(psmouse);
+
+@@ -1510,8 +1534,9 @@ static void set_input_params(struct psmo
+ __set_bit(BTN_BACK, dev->keybit);
+ }
+
+- for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++)
+- __set_bit(BTN_0 + i, dev->keybit);
++ if (!SYN_CAP_EXT_BUTTONS_STICK(priv->ext_cap_10))
++ for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++)
++ __set_bit(BTN_0 + i, dev->keybit);
+
+ __clear_bit(EV_REL, dev->evbit);
+ __clear_bit(REL_X, dev->relbit);
+--- a/drivers/input/mouse/synaptics.h
++++ b/drivers/input/mouse/synaptics.h
+@@ -111,6 +111,10 @@
+ #define SYN_CAP_EXT_BUTTONS_STICK(ex10) ((ex10) & 0x010000)
+ #define SYN_CAP_SECUREPAD(ex10) ((ex10) & 0x020000)
+
++#define SYN_CAP_EXT_BUTTON_STICK_L(eb) (!!((eb) & 0x01))
++#define SYN_CAP_EXT_BUTTON_STICK_M(eb) (!!((eb) & 0x02))
++#define SYN_CAP_EXT_BUTTON_STICK_R(eb) (!!((eb) & 0x04))
++
+ /* synaptics modes query bits */
+ #define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7))
+ #define SYN_MODE_RATE(m) ((m) & (1 << 6))
+@@ -192,6 +196,7 @@ struct synaptics_data {
+ bool disable_gesture; /* disable gestures */
+
+ struct serio *pt_port; /* Pass-through serio port */
++ unsigned char pt_buttons; /* Pass-through buttons */
+
+ struct synaptics_mt_state mt_state; /* Current mt finger state */
+ bool mt_state_lost; /* mt_state may be incorrect */
Added: dists/jessie/linux/debian/patches/bugfix/x86/input-synaptics-remove-topbuttonpad-property-for-len.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/jessie/linux/debian/patches/bugfix/x86/input-synaptics-remove-topbuttonpad-property-for-len.patch Sun May 17 23:30:24 2015 (r22658)
@@ -0,0 +1,40 @@
+From: Benjamin Tissoires <benjamin.tissoires at redhat.com>
+Date: Sun, 8 Mar 2015 22:34:50 -0700
+Subject: Input: synaptics - remove TOPBUTTONPAD property for Lenovos 2015
+Origin: https://git.kernel.org/linus/3adde1f59195df2965f632e22b31f97fb371612f
+Bug-Debian: https://bugs.debian.org/780862
+
+The 2015 series of the Lenovo thinkpads added back the hardware buttons on
+top of the touchpad for the trackstick.
+
+Unfortunately, Lenovo used the PNPIDs that are supposed to be "5 buttons"
+touchpads, so the new laptops also have the INPUT_PROP_TOPBUTTONPAD. Yay!
+
+Instead of manually removing each of the new ones, or hoping that we know
+all the current ones, we can consider that the PNPIDs list that were given
+contains touchpads that have the trackstick buttons, either physically
+wired to them, or emulated with the top software button property.
+
+Thanks to the extra buttons capability in query $10, we can reliably detect
+the physical buttons from the software ones, and so we can remove the
+TOPBUTTONPAD property even if it was declared as such.
+
+Signed-off-by: Benjamin Tissoires <benjamin.tissoires at redhat.com>
+Acked-by: Hans de Goede <hdegoede at redhat.com>
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov at gmail.com>
+---
+ drivers/input/mouse/synaptics.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/input/mouse/synaptics.c
++++ b/drivers/input/mouse/synaptics.c
+@@ -1519,7 +1519,8 @@ static void set_input_params(struct psmo
+
+ if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
+ __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
+- if (psmouse_matches_pnp_id(psmouse, topbuttonpad_pnp_ids))
++ if (psmouse_matches_pnp_id(psmouse, topbuttonpad_pnp_ids) &&
++ !SYN_CAP_EXT_BUTTONS_STICK(priv->ext_cap_10))
+ __set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit);
+ /* Clickpads report only left button */
+ __clear_bit(BTN_RIGHT, dev->keybit);
Added: dists/jessie/linux/debian/patches/bugfix/x86/input-synaptics-retrieve-the-extended-capabilities-i.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/jessie/linux/debian/patches/bugfix/x86/input-synaptics-retrieve-the-extended-capabilities-i.patch Sun May 17 23:30:24 2015 (r22658)
@@ -0,0 +1,119 @@
+From: Benjamin Tissoires <benjamin.tissoires at redhat.com>
+Date: Sun, 8 Mar 2015 22:34:03 -0700
+Subject: Input: synaptics - retrieve the extended capabilities in query $10
+Origin: https://git.kernel.org/linus/06aa374bc70468b517dd36b95c48c8f391c08a27
+Bug-Debian: https://bugs.debian.org/780862
+
+Newer Synaptics touchpads need to get information from the query $10.
+Retrieve it if available.
+
+Signed-off-by: Benjamin Tissoires <benjamin.tissoires at redhat.com>
+Acked-by: Hans de Goede <hdegoede at redhat.com>
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov at gmail.com>
+---
+ drivers/input/mouse/synaptics.c | 23 ++++++++++++++++++++---
+ drivers/input/mouse/synaptics.h | 23 +++++++++++++++++++++++
+ 2 files changed, 43 insertions(+), 3 deletions(-)
+
+--- a/drivers/input/mouse/synaptics.c
++++ b/drivers/input/mouse/synaptics.c
+@@ -239,11 +239,24 @@ static int synaptics_model_id(struct psm
+ return 0;
+ }
+
++static int synaptics_more_extended_queries(struct psmouse *psmouse)
++{
++ struct synaptics_data *priv = psmouse->private;
++ unsigned char buf[3];
++
++ if (synaptics_send_cmd(psmouse, SYN_QUE_MEXT_CAPAB_10, buf))
++ return -1;
++
++ priv->ext_cap_10 = (buf[0]<<16) | (buf[1]<<8) | buf[2];
++
++ return 0;
++}
++
+ /*
+- * Read the board id from the touchpad
++ * Read the board id and the "More Extended Queries" from the touchpad
+ * The board id is encoded in the "QUERY MODES" response
+ */
+-static int synaptics_board_id(struct psmouse *psmouse)
++static int synaptics_query_modes(struct psmouse *psmouse)
+ {
+ struct synaptics_data *priv = psmouse->private;
+ unsigned char bid[3];
+@@ -255,6 +268,10 @@ static int synaptics_board_id(struct psm
+ if (synaptics_send_cmd(psmouse, SYN_QUE_MODES, bid))
+ return -1;
+ priv->board_id = ((bid[0] & 0xfc) << 6) | bid[1];
++
++ if (SYN_MEXT_CAP_BIT(bid[0]))
++ return synaptics_more_extended_queries(psmouse);
++
+ return 0;
+ }
+
+@@ -444,7 +461,7 @@ static int synaptics_query_hardware(stru
+ return -1;
+ if (synaptics_firmware_id(psmouse))
+ return -1;
+- if (synaptics_board_id(psmouse))
++ if (synaptics_query_modes(psmouse))
+ return -1;
+ if (synaptics_capability(psmouse))
+ return -1;
+--- a/drivers/input/mouse/synaptics.h
++++ b/drivers/input/mouse/synaptics.h
+@@ -22,6 +22,7 @@
+ #define SYN_QUE_EXT_CAPAB_0C 0x0c
+ #define SYN_QUE_EXT_MAX_COORDS 0x0d
+ #define SYN_QUE_EXT_MIN_COORDS 0x0f
++#define SYN_QUE_MEXT_CAPAB_10 0x10
+
+ /* synatics modes */
+ #define SYN_BIT_ABSOLUTE_MODE (1 << 7)
+@@ -53,6 +54,7 @@
+ #define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20)
+ #define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12)
+ #define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16)
++#define SYN_MEXT_CAP_BIT(m) ((m) & (1 << 1))
+
+ /*
+ * The following describes response for the 0x0c query.
+@@ -89,6 +91,26 @@
+ #define SYN_CAP_REDUCED_FILTERING(ex0c) ((ex0c) & 0x000400)
+ #define SYN_CAP_IMAGE_SENSOR(ex0c) ((ex0c) & 0x000800)
+
++/*
++ * The following descibes response for the 0x10 query.
++ *
++ * byte mask name meaning
++ * ---- ---- ------- ------------
++ * 1 0x01 ext buttons are stick buttons exported in the extended
++ * capability are actually meant to be used
++ * by the tracktick (pass-through).
++ * 1 0x02 SecurePad the touchpad is a SecurePad, so it
++ * contains a built-in fingerprint reader.
++ * 1 0xe0 more ext count how many more extented queries are
++ * available after this one.
++ * 2 0xff SecurePad width the width of the SecurePad fingerprint
++ * reader.
++ * 3 0xff SecurePad height the height of the SecurePad fingerprint
++ * reader.
++ */
++#define SYN_CAP_EXT_BUTTONS_STICK(ex10) ((ex10) & 0x010000)
++#define SYN_CAP_SECUREPAD(ex10) ((ex10) & 0x020000)
++
+ /* synaptics modes query bits */
+ #define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7))
+ #define SYN_MODE_RATE(m) ((m) & (1 << 6))
+@@ -156,6 +178,7 @@ struct synaptics_data {
+ unsigned long int capabilities; /* Capabilities */
+ unsigned long int ext_cap; /* Extended Capabilities */
+ unsigned long int ext_cap_0c; /* Ext Caps from 0x0c query */
++ unsigned long int ext_cap_10; /* Ext Caps from 0x10 query */
+ unsigned long int identity; /* Identification */
+ unsigned int x_res, y_res; /* X/Y resolution in units/mm */
+ unsigned int x_max, y_max; /* Max coordinates (from FW) */
Modified: dists/jessie/linux/debian/patches/series
==============================================================================
--- dists/jessie/linux/debian/patches/series Sun May 17 23:00:53 2015 (r22657)
+++ dists/jessie/linux/debian/patches/series Sun May 17 23:30:24 2015 (r22658)
@@ -588,4 +588,7 @@
bugfix/all/access_once/0013-kernel-Change-ASSIGN_ONCE-val-x-to-WRITE_ONCE-x-val.patch
bugfix/arm/arm-mvebu-armada-xp-openblocks-ax3-4-disable-interna.patch
bugfix/all/rtc-hctosys-do-not-treat-lack-of-rtc-device-as-error.patch
+bugfix/x86/input-synaptics-retrieve-the-extended-capabilities-i.patch
+bugfix/x86/input-synaptics-remove-topbuttonpad-property-for-len.patch
+bugfix/x86/input-synaptics-re-route-tracksticks-buttons-on-the-.patch
bugfix/all/rtc-hctosys-use-function-name-in-the-error-log.patch
More information about the Kernel-svn-changes
mailing list