f76263e
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
f76263e
Date: Tue, 2 Sep 2014 09:49:18 -0700
f76263e
Subject: [PATCH] Input: synaptics - gate forcepad support by DMI check
f76263e
f76263e
Unfortunately, ForcePad capability is not actually exported over PS/2, so
f76263e
we have to resort to DMI checks.
f76263e
f76263e
Cc: stable@vger.kernel.org
f76263e
Reported-by: Nicole Faerber <nicole.faerber@kernelconcepts.de>
f76263e
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
f76263e
---
f76263e
 drivers/input/mouse/synaptics.c | 22 +++++++++++++++++++++-
f76263e
 drivers/input/mouse/synaptics.h |  8 ++------
f76263e
 2 files changed, 23 insertions(+), 7 deletions(-)
f76263e
f76263e
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
f76263e
index 6394d9b5bfd3..9031a0a28ea4 100644
f76263e
--- a/drivers/input/mouse/synaptics.c
f76263e
+++ b/drivers/input/mouse/synaptics.c
f76263e
@@ -607,6 +607,8 @@ static void synaptics_parse_agm(const unsigned char buf[],
f76263e
 	priv->agm_pending = true;
f76263e
 }
f76263e
 
f76263e
+static bool is_forcepad;
f76263e
+
f76263e
 static int synaptics_parse_hw_state(const unsigned char buf[],
f76263e
 				    struct synaptics_data *priv,
f76263e
 				    struct synaptics_hw_state *hw)
f76263e
@@ -636,7 +638,7 @@ static int synaptics_parse_hw_state(const unsigned char buf[],
f76263e
 		hw->left  = (buf[0] & 0x01) ? 1 : 0;
f76263e
 		hw->right = (buf[0] & 0x02) ? 1 : 0;
f76263e
 
f76263e
-		if (SYN_CAP_FORCEPAD(priv->ext_cap_0c)) {
f76263e
+		if (is_forcepad) {
f76263e
 			/*
f76263e
 			 * ForcePads, like Clickpads, use middle button
f76263e
 			 * bits to report primary button clicks.
f76263e
@@ -1667,11 +1669,29 @@ static const struct dmi_system_id __initconst cr48_dmi_table[] = {
f76263e
 	{ }
f76263e
 };
f76263e
 
f76263e
+static const struct dmi_system_id forcepad_dmi_table[] __initconst = {
f76263e
+#if defined(CONFIG_DMI) && defined(CONFIG_X86)
f76263e
+	{
f76263e
+		.matches = {
f76263e
+			DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
f76263e
+			DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook Folio 1040 G1"),
f76263e
+		},
f76263e
+	},
f76263e
+#endif
f76263e
+	{ }
f76263e
+};
f76263e
+
f76263e
 void __init synaptics_module_init(void)
f76263e
 {
f76263e
 	impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table);
f76263e
 	broken_olpc_ec = dmi_check_system(olpc_dmi_table);
f76263e
 	cr48_profile_sensor = dmi_check_system(cr48_dmi_table);
f76263e
+
f76263e
+	/*
f76263e
+	 * Unfortunately ForcePad capability is not exported over PS/2,
f76263e
+	 * so we have to resort to checking DMI.
f76263e
+	 */
f76263e
+	is_forcepad = dmi_check_system(forcepad_dmi_table);
f76263e
 }
f76263e
 
f76263e
 static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
f76263e
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
f76263e
index fb2e076738ae..1bd01f21783b 100644
f76263e
--- a/drivers/input/mouse/synaptics.h
f76263e
+++ b/drivers/input/mouse/synaptics.h
f76263e
@@ -77,12 +77,9 @@
f76263e
  *					for noise.
f76263e
  * 2	0x08	image sensor		image sensor tracks 5 fingers, but only
f76263e
  *					reports 2.
f76263e
+ * 2	0x01	uniform clickpad	whole clickpad moves instead of being
f76263e
+ *					hinged at the top.
f76263e
  * 2	0x20	report min		query 0x0f gives min coord reported
f76263e
- * 2	0x80	forcepad		forcepad is a variant of clickpad that
f76263e
- *					does not have physical buttons but rather
f76263e
- *					uses pressure above certain threshold to
f76263e
- *					report primary clicks. Forcepads also have
f76263e
- *					clickpad bit set.
f76263e
  */
f76263e
 #define SYN_CAP_CLICKPAD(ex0c)		((ex0c) & 0x100000) /* 1-button ClickPad */
f76263e
 #define SYN_CAP_CLICKPAD2BTN(ex0c)	((ex0c) & 0x000100) /* 2-button ClickPad */
f76263e
@@ -91,7 +88,6 @@
f76263e
 #define SYN_CAP_ADV_GESTURE(ex0c)	((ex0c) & 0x080000)
f76263e
 #define SYN_CAP_REDUCED_FILTERING(ex0c)	((ex0c) & 0x000400)
f76263e
 #define SYN_CAP_IMAGE_SENSOR(ex0c)	((ex0c) & 0x000800)
f76263e
-#define SYN_CAP_FORCEPAD(ex0c)		((ex0c) & 0x008000)
f76263e
 
f76263e
 /* synaptics modes query bits */
f76263e
 #define SYN_MODE_ABSOLUTE(m)		((m) & (1 << 7))
f76263e
-- 
f76263e
1.9.3
f76263e