Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5140078ybl; Mon, 26 Aug 2019 23:29:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAbbKcoHJiwRY9M57CdyKwJgXuHCVyW3a67AI2Fr7/9SAGl5sw+/qJTlhPI70eNV22kJw3 X-Received: by 2002:a17:902:5a09:: with SMTP id q9mr22631873pli.191.1566887348633; Mon, 26 Aug 2019 23:29:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566887348; cv=none; d=google.com; s=arc-20160816; b=et5bFmGpuaD5stjlvc8m16tntaW7LcFaFkSiX0UZ9nStrJEnHPgvC2OvAw/eTlatkL fqnGMceRofHPeQYjwFHFtZrXq5ij1rwTluWAJJVDh1t3ll6pm8ATdVeyCBKEdXOF1mz4 iH0YZOQUk3F6lOtlKmyoD4RyBybKvfk+i3/ECwLWsqzrRHOKOekpg47XUTXN9ATXV7Fj OumnEsDws8fxHVK97Wp524pdpa0+ZE99Yu4pBItd7fDPTKwrhsPgWyh+EoUQdslcdO67 FzeQf+gMwVKGc9X2MkVKPa1Loiv+Q9kAYqLpl4+TrE5ivDABRFDGg6AMRzl38cntX4O2 adDw== 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 :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=h8XMl9mLT0tHdR/iJhnk8BPU30AqzPN4X217blKu/KI=; b=lUaHrT6VG6mZzMI/aO0eHeS3qwpmKL/ZidmXsXkda+P4uBr0O3vE5TECoZfzA0VhJn GSwz+j2xNusIESKS2aMuAYW6R5OZ2mdJNgp6wCYCmve+VFaI4t87TZfUBmhUR4yyUtQ0 GJLRtqlsUOQmOccJOatNUkckP8qedgaiTmEiFn8o2nKOQEMovLGLPt6hfXYBgM4zuNXR 37UOB67eZjr5VVesoCjPeX09ZaSqDsWS0P7+fPsEeTQVPxwjHnnXPoOYaP5FNVPhUmvo XeS4Cnn28BC4RZrjIGflz72lQdjXnKNGSKG/BX3+4FXpMEjKLdPMTcU/EjLuJnDC8MFz nzMA== ARC-Authentication-Results: i=1; mx.google.com; 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 j20si10723244pgk.115.2019.08.26.23.28.53; Mon, 26 Aug 2019 23:29:08 -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; 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 S1728457AbfH0G1r (ORCPT + 99 others); Tue, 27 Aug 2019 02:27:47 -0400 Received: from esa1.mentor.iphmx.com ([68.232.129.153]:11303 "EHLO esa1.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbfH0G1q (ORCPT ); Tue, 27 Aug 2019 02:27:46 -0400 IronPort-SDR: POiWoD+fjQW1h/3uoVqtOhoRqHREnd7dpebxzHin3cleGS0Loarz4sOrO5dPMXHXcHeY6G/w4G YeFYSHBxn09Sk1OYK0ITupVmuzWbmRMMqAOi67CoBRir/4HGjEM9ojgPL35xQsCiMJkDMmk70n XDNM7kUogt1+cX1AO5Lkqj7VccpzAPcaq/Uz8b6Fb5G3ANfMd1yoQvJZdHCUF/cz68hX6EImlX 61xPJVt7bHb7SLuuPeq7vhlZyF4ZecU2rg830qiL949WOS10je3hBaHqjWeSeDNdZzdWGFhgaG Y0Q= X-IronPort-AV: E=Sophos;i="5.64,436,1559548800"; d="scan'208";a="42589343" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 26 Aug 2019 22:27:45 -0800 IronPort-SDR: S2IbBDh9nCtZwB1J0w2uGhbIH2yOm+9Fpb2dzAXHP+r27qHvwY7fUoWGHEJrrBCY2UnPpkW8sO BfHxqCUVPCn3jpEscZWROaB6cIXy6LQVtGZeEcUGwCfWHcOBsrdUt/H7dYO7a8manjgEqLKutR 9Z4flUOQIHG2NBXg1WT3fgKCFLyOzOqR0EtvC/MB3Bgyd51sU4+g/BLoGxTs0ObUgte12H+QgI Of89BxN3dpIJZIXh2dn01qLnHLM6h2mMZKzvFr7Am0aHNINovnT++Fd/QR2kVQsS9veIeNybp1 X0g= From: Jiada Wang To: , CC: , , , Subject: [PATCH v2 10/49] Input: atmel_mxt_ts - handle reports from T47 Stylus object Date: Tue, 27 Aug 2019 15:27:17 +0900 Message-ID: <20190827062756.20380-1-jiada_wang@mentor.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ClientProxiedBy: svr-orw-mbx-08.mgc.mentorg.com (147.34.90.208) To svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 1d738c488bdd..83dad225458e 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); -- 2.19.2