054e8e3
Bugzilla: 1089583
054e8e3
Upstream-status: Sent for 3.15
054e8e3
054e8e3
From 4cebb979af8d7bd1ec463406eaf57a44bd5b9f04 Mon Sep 17 00:00:00 2001
054e8e3
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
054e8e3
Date: Tue, 22 Apr 2014 11:21:00 -0400
054e8e3
Subject: [PATCH] HID: rmi: do not handle touchscreens through hid-rmi
054e8e3
054e8e3
Currently, hid-rmi drives every Synaptics product, but the touchscreens
054e8e3
on the Windows tablets should be handled through hid-multitouch.
054e8e3
054e8e3
Instead of providing a long list of PIDs, rely on the scan_report
054e8e3
capability to detect which should go to hid-multitouch, and which
054e8e3
should not go to hid-rmi.
054e8e3
054e8e3
We introduce a generic HID_GROUP_HAVE_SPECIAL_DRIVER which can be reused
054e8e3
amoung other drivers if they want to have a catch rule but still
054e8e3
have multitouch devices handled through hid-multitouch.
054e8e3
054e8e3
related bug:
054e8e3
https://bugzilla.kernel.org/show_bug.cgi?id=74241
054e8e3
https://bugzilla.redhat.com/show_bug.cgi?id=1089583
054e8e3
054e8e3
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
054e8e3
---
054e8e3
 drivers/hid/hid-core.c | 10 ++++++++--
054e8e3
 drivers/hid/hid-rmi.c  |  6 ++++--
054e8e3
 include/linux/hid.h    | 13 +++++++++++++
054e8e3
 3 files changed, 25 insertions(+), 4 deletions(-)
054e8e3
054e8e3
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
054e8e3
index 6ba2fd0..ea18639 100644
054e8e3
--- a/drivers/hid/hid-core.c
054e8e3
+++ b/drivers/hid/hid-core.c
054e8e3
@@ -776,6 +776,14 @@ static int hid_scan_report(struct hid_device *hid)
054e8e3
 	    (hid->group == HID_GROUP_MULTITOUCH))
054e8e3
 		hid->group = HID_GROUP_MULTITOUCH_WIN_8;
054e8e3
 
054e8e3
+	/*
054e8e3
+	* Vendor specific handlings
054e8e3
+	*/
054e8e3
+	if ((hid->vendor == USB_VENDOR_ID_SYNAPTICS) &&
054e8e3
+	    (hid->group == HID_GROUP_GENERIC))
054e8e3
+		/* hid-rmi should take care of them, not hid-generic */
054e8e3
+		hid->group = HID_GROUP_HAVE_SPECIAL_DRIVER;
054e8e3
+
054e8e3
 	vfree(parser);
054e8e3
 	return 0;
054e8e3
 }
054e8e3
@@ -1840,8 +1848,6 @@ static const struct hid_device_id hid_have_special_driver[] = {
054e8e3
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE) },
054e8e3
 	{ HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_SRWS1) },
054e8e3
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
054e8e3
-	{ HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, HID_ANY_ID) },
054e8e3
-	{ HID_I2C_DEVICE(USB_VENDOR_ID_SYNAPTICS, HID_ANY_ID) },
054e8e3
 	{ HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) },
054e8e3
 	{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) },
054e8e3
 	{ HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) },
054e8e3
diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
054e8e3
index a4f04d4..a97a373 100644
054e8e3
--- a/drivers/hid/hid-rmi.c
054e8e3
+++ b/drivers/hid/hid-rmi.c
054e8e3
@@ -863,8 +863,10 @@ static void rmi_remove(struct hid_device *hdev)
054e8e3
 }
054e8e3
 
054e8e3
 static const struct hid_device_id rmi_id[] = {
054e8e3
-	{ HID_I2C_DEVICE(USB_VENDOR_ID_SYNAPTICS, HID_ANY_ID) },
054e8e3
-	{ HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, HID_ANY_ID) },
054e8e3
+	{ HID_DEVICE(BUS_I2C, HID_GROUP_HAVE_SPECIAL_DRIVER,
054e8e3
+		USB_VENDOR_ID_SYNAPTICS, HID_ANY_ID) },
054e8e3
+	{ HID_DEVICE(BUS_USB, HID_GROUP_HAVE_SPECIAL_DRIVER,
054e8e3
+		USB_VENDOR_ID_SYNAPTICS, HID_ANY_ID) },
054e8e3
 	{ }
054e8e3
 };
054e8e3
 MODULE_DEVICE_TABLE(hid, rmi_id);
054e8e3
diff --git a/include/linux/hid.h b/include/linux/hid.h
054e8e3
index 1b5f1e9..2fdd612 100644
054e8e3
--- a/include/linux/hid.h
054e8e3
+++ b/include/linux/hid.h
054e8e3
@@ -299,6 +299,19 @@ struct hid_item {
054e8e3
 #define HID_GROUP_MULTITOUCH			0x0002
054e8e3
 #define HID_GROUP_SENSOR_HUB			0x0003
054e8e3
 #define HID_GROUP_MULTITOUCH_WIN_8		0x0004
054e8e3
+#define HID_GROUP_HAVE_SPECIAL_DRIVER		0xffff
054e8e3
+/*
054e8e3
+ * HID_GROUP_HAVE_SPECIAL_DRIVER should be used when the device needs to be
054e8e3
+ * scanned in case it is handled by either hid-multitouch, hid-generic,
054e8e3
+ * hid-sensor-hub or any other generic hid driver.
054e8e3
+ *
054e8e3
+ * Devices declared in hid_have_special_driver[] in hid-core.c can use
054e8e3
+ * HID_GROUP_ANY instead because there will be not overlap between their
054e8e3
+ * specific driver and a generic one.
054e8e3
+ *
054e8e3
+ * Note: HID_GROUP_ANY is declared in linux/mod_devicetable.h
054e8e3
+ * and has a value of 0x0000
054e8e3
+ */
054e8e3
 
054e8e3
 /*
054e8e3
  * This is the global environment of the parser. This information is
054e8e3
-- 
054e8e3
1.9.0
054e8e3