summaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorBenson Leung <bleung@chromium.org>2016-03-11 14:19:49 -0800
committerJiri Kosina <jkosina@suse.cz>2016-03-14 10:00:00 +0100
commitd3e69b9a04f8e42de1b4132218567b027d368bb5 (patch)
treef3f7efda01f034d415a9649af5c9a39eb064515f /drivers/hid
parent45c5c6828214605eaefa6755c47bd1a2c7eb203e (diff)
HID: multitouch: Release all touch slots on reset_resume
When resetting a device (especially after power loss) it is unlikely that the firmware will keep the contact tracking data for the previous touches and will be able to reconcile it with the new contacts, so let's release all slots on reset resume as start anew. Signed-off-by: Benson Leung <bleung@chromium.org> Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-multitouch.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index a20fc604ffd8..60e85f3861ee 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -1150,8 +1150,30 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
}
#ifdef CONFIG_PM
+static void mt_release_contacts(struct hid_device *hid)
+{
+ struct hid_input *hidinput;
+
+ list_for_each_entry(hidinput, &hid->inputs, list) {
+ struct input_dev *input_dev = hidinput->input;
+ struct input_mt *mt = input_dev->mt;
+ int i;
+
+ if (mt) {
+ for (i = 0; i < mt->num_slots; i++) {
+ input_mt_slot(input_dev, i);
+ input_mt_report_slot_state(input_dev,
+ MT_TOOL_FINGER,
+ false);
+ }
+ input_sync(input_dev);
+ }
+ }
+}
+
static int mt_reset_resume(struct hid_device *hdev)
{
+ mt_release_contacts(hdev);
mt_set_maxcontacts(hdev);
mt_set_input_mode(hdev);
return 0;