From patchwork Fri Nov 22 08:23:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Jiada" X-Patchwork-Id: 11257371 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 608F214C0 for ; Fri, 22 Nov 2019 08:24:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B77120717 for ; Fri, 22 Nov 2019 08:24:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726861AbfKVIYk (ORCPT ); Fri, 22 Nov 2019 03:24:40 -0500 Received: from esa4.mentor.iphmx.com ([68.232.137.252]:4441 "EHLO esa4.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbfKVIYi (ORCPT ); Fri, 22 Nov 2019 03:24:38 -0500 IronPort-SDR: 3D+5cfH5tl/qS+vsitVBvRv22jNk4Y0tkfDDWEYXe3hEUuMTL4xfvOLQ/ZTl9MEBcwEHCR04dH Hvo+zR7oylZyKszzbSNdu0f45Omq1AfYy2QOsk6fiWl7389nlbj1x30KqHOOW7R/ec+U3n53if rRcObCvXitWqfIijhGg2X+mQjqJvzj6kQJdC7jRfM8GxqADeD8aEq6Ur7qahRpb5btLR+ZROf5 h4ClDXMbB5ADtLiSOjdtF2jlZ4AEHJqQb9H6w+ik25s85inVUJEDNdU7LzKD5SpY0tsrcqtsCo UE8= X-IronPort-AV: E=Sophos;i="5.69,229,1571731200"; d="scan'208";a="43457558" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 22 Nov 2019 00:24:38 -0800 IronPort-SDR: 381xu3DF+4Cgovhpec0OSIUUYMasd0L/LUbJpsD4nSSh2UZpE8rIfzLhTdqMy+K98PvjW+B5GS JdkYindOeGzcFTrr+MrKUjg8vA9oxEVf1OxCcZQD2W8alZWa4N9QzfER1H7EUbrpRCaxffERGL HpRqHKX2747vE0Kwd17ux/Ps+E455+fil7A9jXM2mNNIrhIXnAHKDHkdif3M3ydfPGQ8zIpZrV ppPAw/zLQY1hGoMLww5+fF7ipvP2pY+uZmIWb956ZIl+4lwSz+L8bkC7Sbb7URPheVyipUR2ag uj8= From: Jiada Wang To: , , , , CC: , , , , Subject: [PATCH v6 09/48] Input: atmel_mxt_ts - handle reports from T47 Stylus object Date: Fri, 22 Nov 2019 17:23:23 +0900 Message-ID: <20191122082402.18173-10-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191122082402.18173-1-jiada_wang@mentor.com> References: <20191122082402.18173-1-jiada_wang@mentor.com> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Nick Dyer Signed-off-by: Nick Dyer Acked-by: Benson Leung Acked-by: Yufeng Shen (cherry picked from ndyer/linux/for-upstream commit 56405a5ea08eb34cfe83f3121867c9de0a5c48c1) Signed-off-by: George G. Davis Signed-off-by: Jiada Wang --- drivers/input/touchscreen/atmel_mxt_ts.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 2df3104e94b9..661bfe4a43b9 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -823,6 +823,7 @@ static void mxt_proc_t9_message(struct mxt_data *data, u8 *message) int area; int amplitude; u8 vector; + int tool; id = message[0] - data->T9_reportid_min; status = message[1]; @@ -836,6 +837,7 @@ static void mxt_proc_t9_message(struct mxt_data *data, u8 *message) y >>= 2; area = message[5]; + amplitude = message[6]; vector = message[7]; @@ -865,12 +867,20 @@ static void mxt_proc_t9_message(struct mxt_data *data, u8 *message) mxt_input_sync(data); } + /* A size of zero indicates touch is from a linked T47 Stylus */ + if (area == 0) { + area = MXT_TOUCH_MAJOR_DEFAULT; + tool = MT_TOOL_PEN; + } else { + tool = MT_TOOL_FINGER; + } + /* if active, pressure must be non-zero */ if (!amplitude) amplitude = MXT_PRESSURE_DEFAULT; /* Touch active */ - input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, 1); + input_mt_report_slot_state(input_dev, tool, 1); input_report_abs(input_dev, ABS_MT_POSITION_X, x); input_report_abs(input_dev, ABS_MT_POSITION_Y, y); input_report_abs(input_dev, ABS_MT_PRESSURE, amplitude);