82e1eb9
From: Andrew Duggan <aduggan@synaptics.com>
82e1eb9
Date: Tue, 16 Jun 2015 14:08:41 -0700
82e1eb9
Subject: [PATCH] HID: rmi: Disable populating F30 when the touchpad has
82e1eb9
 physical buttons
82e1eb9
82e1eb9
Physical buttons do not use F30 to report their state and in some cases the
82e1eb9
data reported in F30 is incorrect and inconsistent with what is reported by
82e1eb9
the HID descriptor. When physical buttons are present, ignore F30 and let
82e1eb9
hid-input report buttons based on what is defined in the HID descriptor.
82e1eb9
82e1eb9
Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
82e1eb9
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
82e1eb9
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
82e1eb9
---
82e1eb9
 drivers/hid/hid-rmi.c | 9 ++++++---
82e1eb9
 1 file changed, 6 insertions(+), 3 deletions(-)
82e1eb9
82e1eb9
diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
82e1eb9
index 49d4fe4f5987..702aafe30d11 100644
82e1eb9
--- a/drivers/hid/hid-rmi.c
82e1eb9
+++ b/drivers/hid/hid-rmi.c
82e1eb9
@@ -850,6 +850,7 @@ static int rmi_populate_f30(struct hid_device *hdev)
82e1eb9
 
82e1eb9
 static int rmi_populate(struct hid_device *hdev)
82e1eb9
 {
82e1eb9
+	struct rmi_data *data = hid_get_drvdata(hdev);
82e1eb9
 	int ret;
82e1eb9
 
82e1eb9
 	ret = rmi_scan_pdt(hdev);
82e1eb9
@@ -864,9 +865,11 @@ static int rmi_populate(struct hid_device *hdev)
82e1eb9
 		return ret;
82e1eb9
 	}
82e1eb9
 
82e1eb9
-	ret = rmi_populate_f30(hdev);
82e1eb9
-	if (ret)
82e1eb9
-		hid_warn(hdev, "Error while initializing F30 (%d).\n", ret);
82e1eb9
+	if (!(data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS)) {
82e1eb9
+		ret = rmi_populate_f30(hdev);
82e1eb9
+		if (ret)
82e1eb9
+			hid_warn(hdev, "Error while initializing F30 (%d).\n", ret);
82e1eb9
+	}
82e1eb9
 
82e1eb9
 	return 0;
82e1eb9
 }