From patchwork Fri Mar 11 22:19:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 8569731 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7A001C0553 for ; Fri, 11 Mar 2016 22:19:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 99E4E20219 for ; Fri, 11 Mar 2016 22:19:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B889220260 for ; Fri, 11 Mar 2016 22:19:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932243AbcCKWTx (ORCPT ); Fri, 11 Mar 2016 17:19:53 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:35677 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932084AbcCKWTw (ORCPT ); Fri, 11 Mar 2016 17:19:52 -0500 Received: by mail-pa0-f44.google.com with SMTP id td3so82607830pab.2; Fri, 11 Mar 2016 14:19:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=7oMVOyVBkGlafXo70m1XXcIR+jJ6UdleyN/0CyN5tZs=; b=oBH301G6g7Mea22JQNX9pLVX1u6ZPjX61VxMtm2WvVQqDTK646j/ts8GTfHAUZ7V4k nqlksLvojSEvURskgy0owiHRUlCaNOLy8kTl5RyC2jWfMFvfeL0BZypweOi6/Kscu0/O b5t224SY0d6+5S0i3DgvuBP0Lgg4ZsTf7UVarf3VtuijrujPhgae7aMnHLd5Q0RZ/rv9 tHtCkyvzpRQPOmrUPy0AqLIKRrM3MGCOMTIAq0x8He1F8oVmrJVJJvn/XP0bmkw8b7FG 3Qb+FraO9gazhEyYCD4WEdw/DVxX5/sJw6cAFxDAzA+3pyCc7Zi8fgofWICH5YtsGL0l D17w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=7oMVOyVBkGlafXo70m1XXcIR+jJ6UdleyN/0CyN5tZs=; b=Q6aDllxM3DNs+7OiO/3CUyeg4C20oJpUsWEZaT7YzmgBW2PXy+dFx4jGfNe9sFwcYR AN3bcK7a+crQbHf3O9R0V7KFazBW5L3b+N1HpKjJELsW8TF3h4BJXxVXdWCW5o+74W5A GEFhJhKSczwjeQZV/0c7kaL7fW8LBy+LvrjKkP441svcMYNfdtvUx84M4JfLhxC/NiQo 03PTLTuDEs7Ep9EgycyEgtiFgd0/E1Nf2eLaYuEt4er+pVudXJMR+zRxG+aOLYmICRTm E4gLqhdQ0NK1nGfKreod+7oo3w1zeH5w0dv+De+QexjONiuNdxeXO8aXz/vXYVyIV8Mb +5ig== X-Gm-Message-State: AD7BkJKJ/BzP2IHGUUjRwuy2TVdIWvNUfz9ql0XijCdGVfZ5TLQLJX1GpDw754e9Vv44AQ== X-Received: by 10.66.255.39 with SMTP id an7mr19406343pad.2.1457734792210; Fri, 11 Mar 2016 14:19:52 -0800 (PST) Received: from dtor-ws ([2620:0:1000:1301:4834:a0eb:97ce:5dec]) by smtp.gmail.com with ESMTPSA id o69sm11803088pfi.14.2016.03.11.14.19.51 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 11 Mar 2016 14:19:51 -0800 (PST) Date: Fri, 11 Mar 2016 14:19:49 -0800 From: Dmitry Torokhov To: Jiri Kosina Cc: Benjamin Tissoires , Benson Leung , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] HID: multitouch: Release all touch slots on reset_resume Message-ID: <20160311221949.GA14029@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Benson Leung 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 Signed-off-by: Dmitry Torokhov Reviewed-by: Benjamin Tissoires --- drivers/hid/hid-multitouch.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 6adb788..e24e33c 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -1148,8 +1148,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;