Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2912048ybb; Mon, 30 Mar 2020 15:54:37 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsuenlomag2ufN6xT2iKwM52LJRKda0f5DAy0YNL+wFmEiOAYi/YJD8NpuyfXUCoZQzgQcX X-Received: by 2002:a9d:3a1:: with SMTP id f30mr10576298otf.215.1585608877370; Mon, 30 Mar 2020 15:54:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585608877; cv=none; d=google.com; s=arc-20160816; b=pcgaqbquvm5x6ce5myYvRewMtYM2T5GTG6BhFD5s0ZfqgWMbI4wqMeK8d6h3hBjU/w 6RYXcPF8rsS5ggKL2qcuPq8TkW9dtwpfDS5PTpTVcseT+HDKHVpFMcqVNqlLJbroTvfK LeEzAU9oVvJXqZX29XNQdtGl9iv+2gbPrNN3muJYCul3IMug4jZjhHDQKT2N2epmGs6f yE9FhMI0LMsdLHbEwyI6oZSelWFxebOjzVsyZmpTAicJTms2yUd83iJXM7FUIHxcTEig fTslRzESRMlnaMAYm1p5S594IyCL8ttFvk0aTYw5eBEbyk1Zns65Zn1RRM4lrewZktt9 V9eQ== 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=HGd294u5H5KRbHXSdx/5SoSLy5jZH78irSdihADxUxY=; b=MtPaiMa+jVHG3JYEgTxF0eitfU0QtWWpjECeURMz0bXpt0YwLFKI1oii9V3Tiyf3Ol SRBc2v6PVIHPFtvMa7NnL2B5l1zpFtRPX4XRqf1YXei04EbKu2jjvOez8ZfW/SvoB3v6 ydU1mYiH27Au420ruw0lL5lUYw4JObTqIyTuoRcpEVTuhqg/f4fDzEMXcficCrn4Ckmo QBDYCzlYp0zagt2EgMmRvBOAVwRgL/tDTD1gS+EI3S3p8Ol6hdS5VUWHucxnvZXkBn9x rP9Dc2TasV4uFFogSwh9mZ04wqvIU6BRzkC3tEEsqNqRQcncoM++Im6oiPotWKFPyuyL kbrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@who-t.net header.s=fm2 header.b=cqx9Hxbs; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=QpTaz5p2; 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 e21si1886856oie.144.2020.03.30.15.54.24; Mon, 30 Mar 2020 15:54:37 -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=cqx9Hxbs; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=QpTaz5p2; 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 S1729069AbgC3Wx3 (ORCPT + 99 others); Mon, 30 Mar 2020 18:53:29 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:52673 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728876AbgC3Wx3 (ORCPT ); Mon, 30 Mar 2020 18:53:29 -0400 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id 0F7635803DB; Mon, 30 Mar 2020 18:53:28 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 30 Mar 2020 18:53:28 -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=HGd294u5H5KRbHXSdx/5SoSLy5j ZH78irSdihADxUxY=; b=cqx9Hxbs0iHJkNpHFbp53kVBHrAjNMkCNcCzSbFVQqi dVgVBMTlolA4Bhs2+X6nXTk/GxRNraNaIf6y3HKji/tikdbvcxVjDm6BcyGzDzFK 7e2v+VzbjU+ovJh2G93wh+KYz7aa6pbYEKzTXFFI9adjbMPW7V4TaYl7VRhQyZrr ZBPRC4OgDKABOtua6PamFJP6FyoFCkjefxE8rb5dOSvzje5DbpwjWbuNhlz6zRCC Cv5qURhpaHvM3GcdqDEstRFslUDL05Y42+3YCuRCgf9lgnoIDr+xptCkUtSY3Kby 662NCSy4H8LVpeSkwsCPwqWfo2xEpQm124voJf4r+fQ== 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=HGd294 u5H5KRbHXSdx/5SoSLy5jZH78irSdihADxUxY=; b=QpTaz5p2XPetDa0qFpFkmu glNuBWqoduY5rAUtV10DQt96mPfEdieL081JquZKDh3HOedNvZ5at+AppZgQNusW JFsVTt0YNuM7Jt3PhFJZKU/apPU8nJAekofbEGtxlopAIi8/y4pxVvEq0pbkEAYb SwL1mn09I1H1YZDWLtStzGMgD6n04KkmWFIZjw1MDuKRWOQtLimNasMrrEKZgZCk gO6afIGsQxVmqKi5zrJ2OuEovJmIygEqUme7VzI0s7WrSh6XcnxemzIddWAzp8kE KMnN7gwyXc5EBPSATzuoWkSLqX4akNSkbPW+JCFyhRff3xH0XSJ+8s9NfLAGJtCg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudeiiedgudegucetufdoteggodetrfdotf 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 5EDE0306CA79; Mon, 30 Mar 2020 18:53:22 -0400 (EDT) Date: Tue, 31 Mar 2020 08:53:17 +1000 From: Peter Hutterer 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 v2] Input: elants_i2c - support palm detection Message-ID: <20200330225317.GB169282@jelly> References: <1585551756-29066-1-git-send-email-johnny.chuang.emc@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1585551756-29066-1-git-send-email-johnny.chuang.emc@gmail.com> 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 03:02:36PM +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 Reviewed-by: Peter Hutterer Cheers, Peter > --- > Changes in v2: > - Modify MT_TOOL_MAX to MT_TOOL_PALM > > 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..93211fe 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_PALM, 0, 0); > 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 >