Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10489361ybi; Thu, 25 Jul 2019 00:12:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwS2pkUHgvte3ZNTW6wGIv+Ss3HThyPJCJ3AzICKk1DcjdyUoPKA9yQV2DzVuKpHI2d3NVI X-Received: by 2002:a17:90a:fa07:: with SMTP id cm7mr57498788pjb.115.1564038776437; Thu, 25 Jul 2019 00:12:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564038776; cv=none; d=google.com; s=arc-20160816; b=PQgVnraxQ+q0aPGOyp0genHpoKLBSzRxQunQvSIGdiCaZx8z/UX2ptcrZhLz7lrAeq OscH7J/lqBtpSf4YZoDjRmfV4jbJf4R0jjlgujbeabliIf8FIuERj3Lg1HFdISd4pMqK Jj98zBSTbV475bqa1vMj2XAqDPAmavB5uao6P2jbq7LmCOCOrTCI7fFpt3zRRbT2IwaY AL9mGn5ORIeipcQ+9KEvhpFG8bvP8xp9uqRh4pD2Ii3KRAOAYAB4/dEMUGuJC2kxG2AI 82SM7Cx0EspJqQnqLZXXJbdojYZqdjYi28YfuXJSHTeS87rpbZKEwncXTueMVLRP3IIl icvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zNjBcJjZ1zgZj5j/g2VD/pPZ582rSAfPewF4Wm201tw=; b=ZzykV/FkLLNYaBrXrMG6CnYM03QlCqpZ29fU4g/sZ7fhSYZ2M354xr6TUIBctpFG1y GqZDy2+A0TCYJF4I8x366u2qE53HXTH3dzFul33OXJVxi8Q+jgYgFbr/jp+VOoHcgThV 54Blr6e0d99Gn2fUGGzz6pONrWUC3Ttqrtar0cAJBiBuOzZTTInMYtBeG4lPzy2rsD82 U050xXwogNCP/AcIMATJPr3gJVuF+D9vCRMZTZbNeosPY1h9LhKCnJ7RVlgpi8tazM8b slb7xQ/nHn6wBzcmapgZUuoPsqhhOJluMOj4P5oyqC9zyAdF2ycNN7OlqeQ1d4LRISS2 rejw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Nt5SGChH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z21si15563079pgu.376.2019.07.25.00.12.42; Thu, 25 Jul 2019 00:12:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Nt5SGChH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392238AbfGXT7d (ORCPT + 99 others); Wed, 24 Jul 2019 15:59:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:46696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405141AbfGXT72 (ORCPT ); Wed, 24 Jul 2019 15:59:28 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6529922ADF; Wed, 24 Jul 2019 19:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563998366; bh=kX32MHwNiAOJS5zlY7QwQjiZTmKuh5XWwTr7NoRvoKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nt5SGChHUala3KCILM0WCkwfPH3xGec7wBd4IVDThEf3VShyNA7fr+SLeCAn/ol/7 mW4Iwdmo4Yieuiq/g4Tg8jD9g/1mDY/bjGec27QIq+7QTD1yn1zipNv4EsSiboRyrp sFiI78Y4VDNN+JyKIpLdMQhNv1+JlXiE0a7/vK+g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaron Armstrong Skomra , Jiri Kosina Subject: [PATCH 5.1 338/371] HID: wacom: generic: Correct pad syncing Date: Wed, 24 Jul 2019 21:21:30 +0200 Message-Id: <20190724191749.129260134@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191724.382593077@linuxfoundation.org> References: <20190724191724.382593077@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aaron Armstrong Skomra commit d4b8efeb46d99a5d02e7f88ac4eaccbe49370770 upstream. Only sync the pad once per report, not once per collection. Also avoid syncing the pad on battery reports. Fixes: f8b6a74719b5 ("HID: wacom: generic: Support multiple tools per report") Cc: # v4.17+ Signed-off-by: Aaron Armstrong Skomra Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman --- drivers/hid/wacom_wac.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2121,14 +2121,12 @@ static void wacom_wac_pad_report(struct bool active = wacom_wac->hid_data.inrange_state != 0; /* report prox for expresskey events */ - if ((wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) && - wacom_wac->hid_data.pad_input_event_flag) { + if (wacom_wac->hid_data.pad_input_event_flag) { input_event(input, EV_ABS, ABS_MISC, active ? PAD_DEVICE_ID : 0); input_sync(input); if (!active) wacom_wac->hid_data.pad_input_event_flag = false; } - } static void wacom_wac_pen_usage_mapping(struct hid_device *hdev, @@ -2704,9 +2702,7 @@ static int wacom_wac_collection(struct h if (report->type != HID_INPUT_REPORT) return -1; - if (WACOM_PAD_FIELD(field) && wacom->wacom_wac.pad_input) - wacom_wac_pad_report(hdev, report, field); - else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) + if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) wacom_wac_pen_report(hdev, report); else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input) wacom_wac_finger_report(hdev, report); @@ -2720,7 +2716,7 @@ void wacom_wac_report(struct hid_device struct wacom_wac *wacom_wac = &wacom->wacom_wac; struct hid_field *field; bool pad_in_hid_field = false, pen_in_hid_field = false, - finger_in_hid_field = false; + finger_in_hid_field = false, true_pad = false; int r; int prev_collection = -1; @@ -2736,6 +2732,8 @@ void wacom_wac_report(struct hid_device pen_in_hid_field = true; if (WACOM_FINGER_FIELD(field)) finger_in_hid_field = true; + if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) + true_pad = true; } wacom_wac_battery_pre_report(hdev, report); @@ -2759,6 +2757,9 @@ void wacom_wac_report(struct hid_device } wacom_wac_battery_report(hdev, report); + + if (true_pad && wacom->wacom_wac.pad_input) + wacom_wac_pad_report(hdev, report, field); } static int wacom_bpt_touch(struct wacom_wac *wacom)