Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3364839ybb; Tue, 31 Mar 2020 03:52:23 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtg+JGDt3iwm9u7TyMSet8l+Ps/lcPrcaXSNzYqqlCblgWT0AC6VSrHZmHPARDVlGDkZ3BV X-Received: by 2002:a4a:7555:: with SMTP id g21mr12827045oof.46.1585651943303; Tue, 31 Mar 2020 03:52:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585651943; cv=none; d=google.com; s=arc-20160816; b=AP4bSQfPxp8eHNp3HuhjCDQoYvcdU+9ltX/F58rnnD3mlChecCGyO6HDe9gIgOTYJQ u7S+4gnHedYegSy8e/pMcUYh8vS1NOZzCOIqRMqUO6/YcGurkzXfCnV/RAKYdL7Aid+F kBOx1asemi1fkwwDooOZ7X0ZzlfvoQ2rxokOmoN5HCyutIwOIGppnBLGNTvwbYni1Drw dL2Ui5UnuqBPWO+irJOJSAD7zWVTzrUbaVjVuuRGBzUYR1V3/pStzSvQMdw615CfoHfm dqx4n9tbkwr3eSnU+WOKVZ8MXVjPMhJ1kxLuMdH9sOY9lZLK2o98feDYhhff++KGQ9Ff 1jkg== 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=7YQG+YA5QRHJawX9Ppt9L1Z9Nw3kTAxF+neWw4FJf5g=; b=Vk7QKVfIbK4TAx81MMZR6CSDD1J6LauPLFgdb8tSl4ZJOdqax1oV1ABXLDJv8CTAqO mTM0U1a2YjzBjicDgcZXDbGIRkRE6GfhWT598CHUZzrO+fJcYgWwBEfcsDZ6BBUudC2h UhER7NW0t5ul5doZ41Wu9tBNVn5S+rnm1ihSK/G6dPhweyulgPytskrRW9Q+y8xxHCPZ MXRfm7WAiVVKy1b7oHqtgxqNe9kxsjTlUCn1kEbqJH7yOoQeAJeiKgAK/2aodNd6ZMKC SPk4ORscemik4Nkoml2ejVj8YlmfoaWaDES8c3DRkqtWtRi6vwjwEasZAChmac/+7m/H 1LHA== 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 z13si5331964oto.214.2020.03.31.03.52.11; Tue, 31 Mar 2020 03:52:23 -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 S1730604AbgCaKvd (ORCPT + 99 others); Tue, 31 Mar 2020 06:51:33 -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 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 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); -- 2.17.1