Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4314254ybc; Fri, 22 Nov 2019 00:27:17 -0800 (PST) X-Google-Smtp-Source: APXvYqxY05sWVpX3JnW3yfAGJWWkJCwUZnpAK9OclHpw8LXV28d71dRAtUFjIwaiiiyh/ol0P/JI X-Received: by 2002:a17:906:5a83:: with SMTP id l3mr20876279ejq.194.1574411237087; Fri, 22 Nov 2019 00:27:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574411237; cv=none; d=google.com; s=arc-20160816; b=n9mGNZ3srwMDpR/vLbgKfvZin+M0WJC5RinvDOBMoBFnBBkT3EGX+PJLb7X4vuTizo b9ap+CuejnbGxJhYd6p7i/kw9eUm/ndgJ6Gc9Eq1JrA51Nrx4+nRjn3rkqB/s3whq0RO OUzCesu2Z/cQG9DsG/huiYOdaOomtnSS8VBUkcKYJ6RPLhLFJsc+qfqyzTlF3BQzuQJ9 nxjSkm4mf+Y344lDqZW07q4UwF5hqlV/IzNrX7ASFRREXrnEP5YIPxZOpzEGHHbOs7cZ FDwm1XWTrVv5OBV6CCvVDe2D5zQrQp5GGMl/LT+YC+IXVIU84SSPNt2DuS21637FkShc hjjQ== 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=wcdGrEweNAERXGqrSqaKO3LptNoV5PRa8aSlCMlmiv8=; b=qgmW2iW7f1IhHQWeh/5JQfhVi9Jxi/JCfWItmCQ1X7Oa4hyu5/TRu8RVoh+lqAaf2R 3omvKlDB/na9otnXEtJUIhLU0Z62RIZSYf8r+r/qRlLR7f6Co9Z1y3AtKmAUbG6IS0t/ 1XTEAmXTil6kJeZ6fK5kA2M+yv1hN++3n+DZ21b1DOGPEp8l08SErU8tbylBpnF6Mi15 3SIODhbt/I2vtBSURfRmkcP5gzyDoBl45F15X4Zev4gc3I3og/5IRdkdrTBvWC+hgi3f XZAwBaHtjSTvW8tUaii1mMDaaNsOo85VL19UfmkxIFXCVIdoilSQ2zZfuBI+LfEsXLtr Z0Cg== 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 d6si3824086edo.349.2019.11.22.00.26.52; Fri, 22 Nov 2019 00:27:17 -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 S1727193AbfKVIYk (ORCPT + 99 others); Fri, 22 Nov 2019 03:24:40 -0500 Received: from esa4.mentor.iphmx.com ([68.232.137.252]:4441 "EHLO esa4.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbfKVIYi (ORCPT ); Fri, 22 Nov 2019 03:24:38 -0500 IronPort-SDR: 3D+5cfH5tl/qS+vsitVBvRv22jNk4Y0tkfDDWEYXe3hEUuMTL4xfvOLQ/ZTl9MEBcwEHCR04dH Hvo+zR7oylZyKszzbSNdu0f45Omq1AfYy2QOsk6fiWl7389nlbj1x30KqHOOW7R/ec+U3n53if rRcObCvXitWqfIijhGg2X+mQjqJvzj6kQJdC7jRfM8GxqADeD8aEq6Ur7qahRpb5btLR+ZROf5 h4ClDXMbB5ADtLiSOjdtF2jlZ4AEHJqQb9H6w+ik25s85inVUJEDNdU7LzKD5SpY0tsrcqtsCo UE8= X-IronPort-AV: E=Sophos;i="5.69,229,1571731200"; d="scan'208";a="43457558" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 22 Nov 2019 00:24:38 -0800 IronPort-SDR: 381xu3DF+4Cgovhpec0OSIUUYMasd0L/LUbJpsD4nSSh2UZpE8rIfzLhTdqMy+K98PvjW+B5GS JdkYindOeGzcFTrr+MrKUjg8vA9oxEVf1OxCcZQD2W8alZWa4N9QzfER1H7EUbrpRCaxffERGL HpRqHKX2747vE0Kwd17ux/Ps+E455+fil7A9jXM2mNNIrhIXnAHKDHkdif3M3ydfPGQ8zIpZrV ppPAw/zLQY1hGoMLww5+fF7ipvP2pY+uZmIWb956ZIl+4lwSz+L8bkC7Sbb7URPheVyipUR2ag uj8= From: Jiada Wang To: , , , , CC: , , , , Subject: [PATCH v6 09/48] Input: atmel_mxt_ts - handle reports from T47 Stylus object Date: Fri, 22 Nov 2019 17:23:23 +0900 Message-ID: <20191122082402.18173-10-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191122082402.18173-1-jiada_wang@mentor.com> References: <20191122082402.18173-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 2df3104e94b9..661bfe4a43b9 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