Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9940188ybi; Wed, 24 Jul 2019 12:42:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxN4lgA7jiYtx1skgAsOaV5eQ/x57kaNA5vBg0twD1KLD68Os6ZRF3swDv081VxkexQU84n X-Received: by 2002:a65:5082:: with SMTP id r2mr57004462pgp.170.1563997360944; Wed, 24 Jul 2019 12:42:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563997360; cv=none; d=google.com; s=arc-20160816; b=mZXLD2bmdkhtep+BJ/TYR8wqwkx7wga3lu0OiiJDuZOuuZMUK/ZOHirL1v0idG00E6 jtu7jLSqyOr0y9VyIJeKgIhK0mBE7iNSweYmnw4JwEhsSqkdZ0r+wGRRq5mfsSuYlqzt oIeT1YLys50UXOOeJdQoybJGgpqHYKinyLR0MMaCgcZqHGG3suoTEuzV1bIPIFzANI2F 7KUf48JrcSMx9aih2tlIinO5c4T3UecGaRqxEEaPpGu0I/Lq9tNkT59aPGr69Qj9I1V6 8TVzEQsRzoA1foFeqIdym5PJYeIjaNqSTC8r/82vU15RDv2QqSyuHo1avy/8pn5CwWt6 S0yQ== 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=wWBMl42y7pmoEiBrNTIP+lkzA6+8PAM8b/9wudCfKQ8=; b=PW7dEaimDZWu9piqw9TeozCxxSx/snK0LTctEwMzY0h/ye6EtlYhugR36nC1RBBqBE /jK/iMYNakE/Cze+ZRxMIJngfLqxHLL8RxTALxjzgpNQFWM4IXS2KMu8ouj3P1nxjdSm zdeHlblv/6QU6/u48bC+zrc6jaWD/qMYizUYHpb6E9HEgjTo3Wh6oU61I6eYgwrBD+53 WwqlQfNi3pI9nzM2E8/vu31VZhhWIfVWq+6reEtRs2KrJWmTY1PdhkMZaj2kdgw1TcQJ Nvrg1Vw8dKPdi3s0O229OI1U0ePJ7RU+jQyMUW+UkYYKSIKXQlsKHNWTqFzpFmeji+DG q4tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tGgcPzoQ; 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 y11si14928442pgo.115.2019.07.24.12.42.26; Wed, 24 Jul 2019 12:42:40 -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=tGgcPzoQ; 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 S2390105AbfGXTk5 (ORCPT + 99 others); Wed, 24 Jul 2019 15:40:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:42154 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390104AbfGXTkz (ORCPT ); Wed, 24 Jul 2019 15:40:55 -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 A68BB22BE8; Wed, 24 Jul 2019 19:40:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563997254; bh=nKto/EPIAuJFqNBxyMRvz0xlj6sK3zP+mzqMEBWLOaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tGgcPzoQEYsrcLN41J7aJC95ke/voIu/nHGio5/rcRjLbO8dt41o24Lpgc+n+ZP43 eioJPmPVKAE7QrMwKTNl7ssyG963SyOG6yaFY9s3Htbl1KzbX5rceswVcPFD303KIW RZH2DusT/DrP08nG1f79UYltJRSZXbfz+4YoIpAQ= 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.2 373/413] HID: wacom: generic: Correct pad syncing Date: Wed, 24 Jul 2019 21:21:04 +0200 Message-Id: <20190724191801.949342897@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@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 @@ -2117,14 +2117,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, @@ -2700,9 +2698,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); @@ -2716,7 +2712,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; @@ -2732,6 +2728,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); @@ -2755,6 +2753,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)