Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10426687ybi; Wed, 24 Jul 2019 23:01:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOLV96i90XGcLU2LSszvQnBb/bTAvWM0//1Ewcjq2qO2ldqO3tPcF66arFtyZh5hd2oXEa X-Received: by 2002:a17:902:b48f:: with SMTP id y15mr90956067plr.268.1564034499992; Wed, 24 Jul 2019 23:01:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564034499; cv=none; d=google.com; s=arc-20160816; b=P9lYFLvks1Xl0jG3D/irRgn9Q3Dm3o5qw0dPf4CxPzH336/8scSBp0DvAxJeZ5Q9Op wpZiu6wNT0Gg5yq7bf3a5tGlCZYdZ5OnDACwFBr8WUrwHA9qlzYEsNfH9v0H3l0w35An 1mmeI+9iRmpqadG+LsHI3RS5oa4XsTE6DN8eB+XIKVG2/NUunRxoEPMpJyOsb9vLXddi nMjrUHYru/RNPuhiECtQHgnddAN80bpM7MnZs/6I2LpHoqGi2pfXOx2a358j9Gnbi2Jl 4LxyXlp7+jFMImKa3kC0jsb2EQu4BhWWIVxvTPJeupErI8QEs7cbXfVRttoCylhKdD1K xivg== 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=Aa/H0BtOkESHTPolAR7S16a6g8IwbXsCQNrDHkt1l5I=; b=aIf81c7LIhqTc9blnn7XhkPlJgSqZeefQa7kOGPebZx2tjYV9rUE4BGiiMijUgw7B7 HiM/4GxoSIEwV8BEMJq9vQU0idoNmz8stIRTF3XxAjreC/6ZCH03nkrmW39SK/EBWjxz 7JFvwG6se9MVB2InAQlXLcW8uoSOBF9qHWGPmrv06qT49nuUVyFrpu8JUeiAtdRkjmCE aJQdZs939hVGuZt5vx0RTmBKNNPaF4H9jZJ9S8nwC3reTMLt2WOKDZZSudUu0hDUA/kC PeQIjgruOFKKPQkGXa/r0Mkaaqvl1S0b+YpqjJcSGhtDTPq+pSQuHI384/flbMQfboIr Ef0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sN+q5aZN; 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 g13si18107880pgk.369.2019.07.24.23.01.24; Wed, 24 Jul 2019 23:01:39 -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=sN+q5aZN; 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 S2405179AbfGYFpZ (ORCPT + 99 others); Thu, 25 Jul 2019 01:45:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:60848 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405170AbfGYFpW (ORCPT ); Thu, 25 Jul 2019 01:45:22 -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 8388822C7C; Thu, 25 Jul 2019 05:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033522; bh=+SOm2GP64ol7LdusIEc1ruqk5JMEVzMl6CLf2mVi3yA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sN+q5aZN0kIbJeyDHDmQAAj/vS2P8NDrVZOPVlaR3lq2/r7P8GGEQJT5/rFaXNShE dRHJQQpfkHryvRpxkb0ofz4WvmSLM3lqmaHy/WGqkIyCwvQuYcx2TvTZwRxvREMWBR BcivxVc9uhoMJXYbOGIqcRc/ERVl/B0awT+dvME4= 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 4.19 237/271] HID: wacom: generic: Correct pad syncing Date: Wed, 24 Jul 2019 21:21:46 +0200 Message-Id: <20190724191715.468938498@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@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 @@ -2119,14 +2119,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, @@ -2723,9 +2721,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); @@ -2739,7 +2735,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; @@ -2755,6 +2751,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); @@ -2778,6 +2776,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)