From patchwork Wed Mar 25 13:32:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Jiada" X-Patchwork-Id: 11457789 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 7391B1668 for ; Wed, 25 Mar 2020 13:34:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 582E9207FF for ; Wed, 25 Mar 2020 13:34:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727606AbgCYNeR (ORCPT ); Wed, 25 Mar 2020 09:34:17 -0400 Received: from esa3.mentor.iphmx.com ([68.232.137.180]:53108 "EHLO esa3.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727114AbgCYNeR (ORCPT ); Wed, 25 Mar 2020 09:34:17 -0400 IronPort-SDR: 5wsWJMWtX9LDbiqPvV5unguRedTRXQmZtvwooBICE7F98IbOlT06Nw4QlFEj5sxBPFfXC5oYfO P4OCdoNbaevht8SeKMRJpwEbHbSPTYyeFtr49GF4nmXsftXyDoCKUPbi3XcTHAq40UAwIANazM WDYtUYFBHJAs0UsxrkgW2TaiYCTNdH05FRvBiMjyiAAQ2yJoK+XG2zoKgkXNIei/9gEAtsZwAk mRmktCjm2Qk4/YqMW8h6QpRuikS4KxocR6zSo+squzQttD/ylVQHf5aLo+zGCn/oku4VIf6yBj YTk= X-IronPort-AV: E=Sophos;i="5.72,304,1580803200"; d="scan'208";a="47099660" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 25 Mar 2020 05:34:16 -0800 IronPort-SDR: 1H6DIVjY+PBMcml8Khqg7n/ep36rE4UenwmEgNZbjypr/4mKRmdiwBObNPLwfC+2wg/B55Q07d djTX8PnTMjJ+BHYJXvWQz0ioqFRbRDkfwj2IkmVc5qO858a/3Jxka3lULNlEEDArGZTUJ8CmwB 1lmBe9S6P73CBrIJR8y7hlKrq8L10QeQ5DxSPMRLdx56NPaXgfS5/aBnhHJOXDWYvoQzyR8iAn X0zrXgaHEM+P4jnpCQOv1fYxXSeZrZVfR8lmH0PGRYnsb8ew5YfUyCHEtu4I4uFmT5/2TpTt0M 0Qs= From: Jiada Wang To: , , , , , CC: , , , , Subject: [PATCH v9 09/55] Input: atmel_mxt_ts - handle reports from T47 Stylus object Date: Wed, 25 Mar 2020 06:32:48 -0700 Message-ID: <20200325133334.19346-10-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200325133334.19346-1-jiada_wang@mentor.com> References: <20200325133334.19346-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 This patch handles reports from T47 Stylus object 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 d05249b02781..ba58cdd5b76d 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);