From patchwork Wed Feb 12 08:41:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Jiada" X-Patchwork-Id: 208216 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77CD4C2BA83 for ; Wed, 12 Feb 2020 08:44:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 56A8420661 for ; Wed, 12 Feb 2020 08:44:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728540AbgBLIoh (ORCPT ); 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 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 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);