From patchwork Tue Mar 31 10:50:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Jiada" X-Patchwork-Id: 207998 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, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 AD35EC2BA15 for ; Tue, 31 Mar 2020 10:51:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8D5B4214D8 for ; Tue, 31 Mar 2020 10:51:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730408AbgCaKvb (ORCPT ); Tue, 31 Mar 2020 06:51:31 -0400 Received: from esa4.mentor.iphmx.com ([68.232.137.252]:43515 "EHLO esa4.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730595AbgCaKvb (ORCPT ); Tue, 31 Mar 2020 06:51:31 -0400 IronPort-SDR: kQIX7DTzQPOLzxOxGhsYNcbpFOUXdIK9qfr6TZnzEJeLUIfTjQKecy3b14B2Uc7S+c3020z2Jt WKonRITSWglWrmbXYwev84ImENOjWZhVFyBSl/T8Yljmh8gT1LpmijLKWDohY9/y8oD3DIohQ5 om68vR4ty3pAS5i29n00N8sQNn/QaWMQjcT9LbMHwbar9dtYFy+sAHywumLB6oSqXL++80z0zv pNTV1Y5wC7CIoV5g/7hcyaQvv329+1Jn0u/zYlCKHZNJFajB+j+p8lBvVboZapt7uwgoEHgfID blU= X-IronPort-AV: E=Sophos;i="5.72,327,1580803200"; d="scan'208";a="47330735" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 31 Mar 2020 02:51:30 -0800 IronPort-SDR: e6uBJNHe7NEccN2Pu4rtFvVqePZyvDONhmq21jAMhhjPSdmyoT3OLZR5Uu7EwKMIseeVYSsWIt tH4/Vu4VLTa57D9Ry5osoCgtjEunCqS4HvWReKfajeipTeCEtrjpe4XwxDdkmv03TckmAUYgDM HtMyUrL7yEWQTTVszIWx/RvkOXpNJO6vQXJe61VqESKY3lkle8eMOR6IM8XAyEcXB50P3tjm7W 54TkemYrNlaOfDaGIK4HlHB86TOJNg8eI7a5emkHU9GDrRU+8LzKCj2OrndGqOwnGlT7GIqUbL zPk= From: Jiada Wang To: , , , , CC: , , , , Subject: [PATCH v10 09/55] Input: atmel_mxt_ts - handle reports from T47 Stylus object Date: Tue, 31 Mar 2020 03:50:05 -0700 Message-ID: <20200331105051.58896-10-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200331105051.58896-1-jiada_wang@mentor.com> References: <20200331105051.58896-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);