[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200331105051.58896-10-jiada_wang@mentor.com>
Date: Tue, 31 Mar 2020 03:50:05 -0700
From: Jiada Wang <jiada_wang@...tor.com>
To: <nick@...anahar.org>, <dmitry.torokhov@...il.com>,
<jikos@...nel.org>, <benjamin.tissoires@...hat.com>,
<bsz@...ihalf.com>
CC: <linux-input@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<erosca@...adit-jv.com>, <Andrew_Gabbasov@...tor.com>,
<jiada_wang@...tor.com>
Subject: [PATCH v10 09/55] Input: atmel_mxt_ts - handle reports from T47 Stylus object
From: Nick Dyer <nick.dyer@...ev.co.uk>
This patch handles reports from T47 Stylus object
Signed-off-by: Nick Dyer <nick.dyer@...ev.co.uk>
Acked-by: Benson Leung <bleung@...omium.org>
Acked-by: Yufeng Shen <miletus@...omium.org>
(cherry picked from ndyer/linux/for-upstream commit 56405a5ea08eb34cfe83f3121867c9de0a5c48c1)
Signed-off-by: George G. Davis <george_davis@...tor.com>
Signed-off-by: Jiada Wang <jiada_wang@...tor.com>
---
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
Powered by blists - more mailing lists