Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2044576ybb; Sun, 29 Mar 2020 20:54:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtY8uAk4cF9UkHtam3ItunP651IUdUy2Wd//vIVIYnmBOOahmeOiGGhsfIvf07fOu5dCcLn X-Received: by 2002:aca:fd09:: with SMTP id b9mr6479020oii.88.1585540487206; Sun, 29 Mar 2020 20:54:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585540487; cv=none; d=google.com; s=arc-20160816; b=nYP8BqJ6mi4aCvpm+LZLVVvEVAfQQCa0ca9apz07rSWOBAcNNAO3BqQTSKxVfc5KVN b9o/XwAyFTmxPRPkFZqYXBaa1VN7+vJ7qNmF4uRlbEMh6G2VBsKVZKTlq/amKQjV3xN7 9h/QaRQsuHJC5DKkXn5WhtcFQXh+YBQrhtLg/z2PvC/0bWZoJrYyopFtNQeJw1Ia6fAT NA4G6cVa0rV7Jpj4bGiJGJJeiCMxsIjWSsYpkxM7MjiSL/pc0rHtp7Bt/1TwBeeBHpD4 QuBExTk+p6Bh+srOiBAwxSra85sS6UOTloQLPg3+8uirP8jKv6q74QIPc1gClzyIl7eS StsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=TdyVsaUG7tAypiXXkRxUKeQLba9ZoyiJDTV67rlOD2I=; b=R9zwObDy/4MtNKT/nqFVYgy2dC1UxVTQYxIBWlN+ZGyBBPj4qEv6dCE6l/lXhzKstP eaewiNa5TngNYA3SDZZqQ7BzcXo18tbUonwGIHmc+VrU1+s708gD8xeyVrySkgQlEW08 mBz8HXseOE35F+kkooFxzxWVtr1FD7LgBcFv1x0z/gyw12QFRrSd8TXsJo3Rqa6Q/jk/ 3s6UeCJZLFgAfxlPAu5SbgsF9I9C0gw31ROZVKh2Y4NUtSnP8LTqzzqOo+cHBuMqe76h 5vo2c76K50Qju1sHGg48Iqt9jAZQ9iiBvGl5yswn2BLH2+VE4L4tHPpjKqV+erwkcN0t YyNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@who-t.net header.s=fm2 header.b=dklptqjT; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="iC3wY/dN"; 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 e13si6164978oom.86.2020.03.29.20.54.33; Sun, 29 Mar 2020 20:54:47 -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; dkim=pass header.i=@who-t.net header.s=fm2 header.b=dklptqjT; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="iC3wY/dN"; 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 S1729344AbgC3Dro (ORCPT + 99 others); Sun, 29 Mar 2020 23:47:44 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:53757 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728490AbgC3Dro (ORCPT ); Sun, 29 Mar 2020 23:47:44 -0400 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id A8315581112; Sun, 29 Mar 2020 23:47:40 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Sun, 29 Mar 2020 23:47:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=who-t.net; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=TdyVsaUG7tAypiXXkRxUKeQLba9 ZoyiJDTV67rlOD2I=; b=dklptqjTjWaFCCIHO+7pzpX/NBMtwO+TUwjWZlhr5so kvzoWWkpmK4UWsm6ckcINY60BtLT6mKED+A9V7eSV70WyvOoYadDFaO/TpXkcRXN +syr8oPw4ihilgrRfLuepBINIKhYsEVmRVka1+DLvn2vyNp576teYXpNIePKSSSo DTDUcoVM6ywsuiYtkDUmENM4ps3hlhHzlBfLntGyVbgUZO2zMziwraIst5XS6GxU DXKV+I2E+m1FHZARYkFuVYYopG7NsKuwDZFIrzvjEz0EAuxxGPb2Go4YCxlXcPR4 N9MwE0L+qa+U7RQMsGu5uRl4HYZgn1k/rYcyMxl5FhQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=TdyVsa UG7tAypiXXkRxUKeQLba9ZoyiJDTV67rlOD2I=; b=iC3wY/dNd5vMOGlrpllxnB CtsVHVM/USY+X2gtB8t8VrJUJ60MwlqHcyBLw6frxXqwJ9UGSTWJVYr7XpuYhsWT k5b6rhUipfyDbaZwHJk8OYELzof9odj6lSgz93o5Z8JaTT5E9oCzBGqSMyyL8KZE RPbsVg+bvy/DZOxk/PAbd59S0nxHgDxImBSvOj+wq0eGbVWFR8XzuVCmnh487l4t WQajJGldHiSYMlLC81tPzVBR1pZyUTZu1F27svU87JQkEoi1cUhu5mEA02lQ2Y6s x/lkOCmCpfW3LTkVYD3K1yqFYp6lXV9wsXPPcDIqbRJ02qEXdb2XlKqrfNgTZa2Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudeigedgjeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefrvghtvghr ucfjuhhtthgvrhgvrhcuoehpvghtvghrrdhhuhhtthgvrhgvrhesfihhohdqthdrnhgvth eqnecukfhppeduudejrddvtddrjedurddutdelnecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrhhhuthhtvghrvghrseifhhhoqd htrdhnvght X-ME-Proxy: Received: from jelly (117-20-71-109.751447.bne.nbn.aussiebb.net [117.20.71.109]) by mail.messagingengine.com (Postfix) with ESMTPA id 6BDAE328005D; Sun, 29 Mar 2020 23:47:36 -0400 (EDT) Date: Mon, 30 Mar 2020 13:47:32 +1000 From: Peter Hutterer To: "Johnny.Chuang" Cc: 'Johnny Chuang' , 'Dmitry Torokhov' , 'Benjamin Tissoires' , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, 'Rob Schonberger' , 'James Chen' , 'Jennifer Tsai' , 'Paul Liang' , 'Jeff Chuang' Subject: Re: [PATCH] Input: elants_i2c - support palm detection Message-ID: <20200330034732.GA156101@jelly> References: <1585209525-6047-1-git-send-email-johnny.chuang.emc@gmail.com> <20200329021436.GA68168@jelly> <001501d6062e$849afb60$8dd0f220$@emc.com.tw> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <001501d6062e$849afb60$8dd0f220$@emc.com.tw> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 30, 2020 at 08:59:51AM +0800, Johnny.Chuang wrote: > > -----Original Message----- > > From: Peter Hutterer [mailto:peter.hutterer@who-t.net] > > Sent: Sunday, March 29, 2020 10:15 AM > > To: Johnny Chuang > > Cc: Dmitry Torokhov; Benjamin Tissoires; linux-kernel@vger.kernel.org; > > linux-input@vger.kernel.org; Rob Schonberger; Johnny Chuang; James Chen; > > Jennifer Tsai; Paul Liang; Jeff Chuang > > Subject: Re: [PATCH] Input: elants_i2c - support palm detection > > > > On Thu, Mar 26, 2020 at 03:58:45PM +0800, Johnny Chuang wrote: > > > From: Johnny Chuang > > > > > > Elan define finger/palm detection on the least significant bit of byte > 33. > > > The default value is 1 for all firmwares, which report as > MT_TOOL_FINGER. > > > If firmware support palm detection, the bit will change to 0 and > > > report as MT_TOOL_PALM when firmware detecting palm. > > > > > > Signed-off-by: Johnny Chuang > > > --- > > > drivers/input/touchscreen/elants_i2c.c | 11 ++++++++++- > > > 1 file changed, 10 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/input/touchscreen/elants_i2c.c > > > b/drivers/input/touchscreen/elants_i2c.c > > > index 14c577c..3b4d9eb3 100644 > > > --- a/drivers/input/touchscreen/elants_i2c.c > > > +++ b/drivers/input/touchscreen/elants_i2c.c > > > @@ -73,6 +73,7 @@ > > > #define FW_POS_STATE 1 > > > #define FW_POS_TOTAL 2 > > > #define FW_POS_XY 3 > > > +#define FW_POS_TOOL_TYPE 33 > > > #define FW_POS_CHECKSUM 34 > > > #define FW_POS_WIDTH 35 > > > #define FW_POS_PRESSURE 45 > > > @@ -842,6 +843,7 @@ static void elants_i2c_mt_event(struct elants_data > > > *ts, u8 *buf) { > > > struct input_dev *input = ts->input; > > > unsigned int n_fingers; > > > + unsigned int tool_type; > > > u16 finger_state; > > > int i; > > > > > > @@ -852,6 +854,12 @@ static void elants_i2c_mt_event(struct elants_data > > *ts, u8 *buf) > > > dev_dbg(&ts->client->dev, > > > "n_fingers: %u, state: %04x\n", n_fingers, finger_state); > > > > > > + /* Note: all fingers have the same tool type */ > > > + if (buf[FW_POS_TOOL_TYPE] & 0x01) > > > + tool_type = MT_TOOL_FINGER; > > > + else > > > + tool_type = MT_TOOL_PALM; > > > + > > > for (i = 0; i < MAX_CONTACT_NUM && n_fingers; i++) { > > > if (finger_state & 1) { > > > unsigned int x, y, p, w; > > > @@ -867,7 +875,7 @@ static void elants_i2c_mt_event(struct elants_data > > *ts, u8 *buf) > > > i, x, y, p, w); > > > > > > input_mt_slot(input, i); > > > - input_mt_report_slot_state(input, MT_TOOL_FINGER, > true); > > > + input_mt_report_slot_state(input, tool_type, true); > > > input_event(input, EV_ABS, ABS_MT_POSITION_X, x); > > > input_event(input, EV_ABS, ABS_MT_POSITION_Y, y); > > > input_event(input, EV_ABS, ABS_MT_PRESSURE, p); @@ > > -1307,6 +1315,7 > > > @@ static int elants_i2c_probe(struct i2c_client *client, > > > input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, ts->y_max, 0, > > 0); > > > input_set_abs_params(ts->input, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); > > > input_set_abs_params(ts->input, ABS_MT_PRESSURE, 0, 255, 0, 0); > > > + input_set_abs_params(ts->input, ABS_MT_TOOL_TYPE, 0, > > MT_TOOL_MAX, 0, > > > +0); > > > > if you're only reporting pen and palm, can we set this to MT_TOOL_PALM > > instead? Otherwise you're indicating you may also send MT_TOOL_DIAL which > > is unlikely on this hardware :) > > > > Yes, we do not have MT_TOOL_DIAL on touch screen. > So I need to modify MT_TOOL_MAX to MT_TOOL_PALM, right? yes please. Cheers, Peter > > > Reviewed-by: Peter Hutterer otherwise > > > > Cheers, > > Peter > > > > > input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res); > > > input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res); > > > input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, 1); > > > -- > > > 2.7.4 > > > >