From patchwork Thu Mar 19 14:59:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Jiada" X-Patchwork-Id: 11447323 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 6E5CF913 for ; Thu, 19 Mar 2020 15:01:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 56C4320BED for ; Thu, 19 Mar 2020 15:01:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727893AbgCSPBA (ORCPT ); Thu, 19 Mar 2020 11:01:00 -0400 Received: from esa2.mentor.iphmx.com ([68.232.141.98]:5218 "EHLO esa2.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726871AbgCSPA7 (ORCPT ); Thu, 19 Mar 2020 11:00:59 -0400 IronPort-SDR: Y7bPV8FtReL4o62/wc/UuUYIWX2h61ho6EQEwutN2qJTaXDIG36WXcImzUxYVobQ2BDlQqz6l+ YyveSE4hrd1Mr6Awd7hKuoc9l2xRhTFjauAct++cbG5dWSppHDgazKb88/2XAb194Uu54rTwG6 d56rElj2xysTG9DmaJykNtEIjLhUYrkJ9VH+Bjkz2qAoSzd57WUOxapQmAxVM3EEMgc2q+eQvW 7ZBTS/pxKsUtGddPYj8tMXHwe2wgu+otYa+nw2UnRnTC7HDLUk6EbWIzj0pK+P7WVjT9s5L0fo wfk= X-IronPort-AV: E=Sophos;i="5.70,572,1574150400"; d="scan'208";a="46818602" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 19 Mar 2020 07:00:57 -0800 IronPort-SDR: x14uGwY+wFqudEV6VZB2dBYFjSEQ0lbm5p+WUdtYX59949hbtQnDke1pT1ZzUxw7B83IwK/mAs 6PWB499Ihy+5Qolvk8EtR6AOxSXpcekt1eJlb8HTzEeFuwKWqX8+x0EqXyRZnPVCWGj8BOgged ymnDg/WnJS97VUxk2Zr9NOY/0vapkWbQw7okTQGdpWBqpoGMebYBpVRSOQlobG9FZsoH2rDSV+ MULfFpKG+IiIZkyETbLps9SZIyEril8iV6VddHxrtd+WS+Ii9WdcW320d2Iw9DYqev/yn2hyXQ WDs= From: Jiada Wang To: , , , , , CC: , , , , Subject: [PATCH v8 09/52] Input: atmel_mxt_ts - handle reports from T47 Stylus object Date: Thu, 19 Mar 2020 07:59:33 -0700 Message-ID: <20200319150016.61398-10-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200319150016.61398-1-jiada_wang@mentor.com> References: <20200319150016.61398-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);