Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5825880ybv; Wed, 12 Feb 2020 00:45:12 -0800 (PST) X-Google-Smtp-Source: APXvYqz3wZAfgspqQ3REaYN/U5ZvErEOep0TD4CbvHeR0DZUgaBanJBEXTYSgS/tStZvzfA5cl9Y X-Received: by 2002:aca:c256:: with SMTP id s83mr5658722oif.57.1581497112455; Wed, 12 Feb 2020 00:45:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581497112; cv=none; d=google.com; s=arc-20160816; b=UQJp6TUcVVW6HIUGDIxzVvU2gD5gIMPTg40oeZE1fZEgy093FEf6PdlL6lEdSfP3NP DHucccYRFh5aFcU1vBY5hsQs/zu6c8jsAj/lZ4wK4ADm1aoWMuKF/dVvOVnynKFWtaPe r2nMl00qpeuhZs9GHfQj6209TDZ1BgyMdzFugdIQd0/EGaxTVJSwzPskg1gxFAOisdo2 N8GqqeRvMFYFB33HQ9MUNEv2R7vzCGSFwYE7z0Drkmny7gvJYcdsJXXhqrg1Z3T3Er4S 2CYAOoTgNRsNsGEW5/TAY/hYlNY8tU2lBiUEK1021/n+/8/g11ad20FIEUgHZsAm8fUI hAsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=csnPpkTXC88pxTQgWfmKg+NyTU9MKHR9D0dq8WApqSs=; b=TBkvTgyJVKH5UDuSXZVSbK7WOZRMHFykiCopiZavS7lAFGUMX0OW4WHd/TL2bYrQ4v Z8u4HLP4YJsGtRoywLJYd0+FkO0f2DIJhrzxvP6LdUh2WsV612EEaevAr95KbOYXWBZV TkSqQM9+Di1Xx66li7cDq2NA+3WzOXeapjBYoKqAc9O80+esjVK7MYIxbarXEbPBctw9 OeGuch4CHZCnzm8uHt9ow3xxbMc+tP0ZdkjeKZO9fImvjvGvV9OXiaMWRHxCCuN2zSyQ FdD/CIPj3/+EZPjPodqvMKDaS5/lCSetRYLjgLIPz+DTnVe1vDZvcKkfPV56Rz017TCF KNng== 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 p22si3423053otq.132.2020.02.12.00.45.00; Wed, 12 Feb 2020 00:45:12 -0800 (PST) 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 S1728606AbgBLIoh (ORCPT + 99 others); Wed, 12 Feb 2020 03:44:37 -0500 Received: from esa2.mentor.iphmx.com ([68.232.141.98]:45653 "EHLO esa2.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728512AbgBLIog (ORCPT ); Wed, 12 Feb 2020 03:44:36 -0500 X-Greylist: delayed 305 seconds by postgrey-1.27 at vger.kernel.org; Wed, 12 Feb 2020 03:44:36 EST IronPort-SDR: BUBzl1JKQiAPFzFFO/w/mkAqVgOyIaWId8fnIPQx1o5lDPFeMTP6VGzUHEjipej8gXyEnJ/7UT cc5efMUthOTG0qwpOygSv65fehbzBOAEyC+JLxcItXwQn+o5V0ngygpNQpbtPaBEA0mPd1DAZo w8t/DJoHJd7IxSM47IAY98InicT47eLA6UnN373fM72vcpiUsssktsCkE6ReGo2NgVRdDP3PGW TdUiuF7PUbvdevYSRJgVVZurQ41+rbhN5PelLUDdqrLOsq/5d69JhtU5cG0rLYdpOYgO7hrcDy 3u4= X-IronPort-AV: E=Sophos;i="5.70,428,1574150400"; d="scan'208";a="45686168" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 12 Feb 2020 00:43:33 -0800 IronPort-SDR: 2cer1NyDuyBdF6oOgYBHjI0rd7mCendWmkAn77dsCyTRuc44OhjWM3H/wM/opyfPEEQ08ZDvOx uoMnzGRNywnRttCqW17sWKtPpwJpXyk9W8cj6YtoqbliGYnlFKvkyYxAIFkmmYQecm2eDHpT5Q Bj4WQ3A241ICQtEstAzANnzLrNZoD87xo5Pnm8dPIVrNDq/+OClZ466RKOGYMN5BLpF3HlbIu+ p32Lajdgr9QxN+yMPnagyfukheSlGUY569kXi+8NyK0GBIzs+gmifaCNOCnZytMvOBbAviq+Ga tzU= From: Jiada Wang To: , , , , , CC: , , , , Subject: [PATCH v7 09/48] Input: atmel_mxt_ts - handle reports from T47 Stylus object Date: Wed, 12 Feb 2020 00:41:39 -0800 Message-ID: <20200212084218.32344-10-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200212084218.32344-1-jiada_wang@mentor.com> References: <20200212084218.32344-1-jiada_wang@mentor.com> MIME-Version: 1.0 Content-Type: text/plain 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 e0e9e6770bc5..bb88bc8ce817 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.17.1