From patchwork Mon Aug 29 08:28:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JJ Ding X-Patchwork-Id: 1106632 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7T8RQeK010781 for ; Mon, 29 Aug 2011 08:27:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753218Ab1H2I1G (ORCPT ); Mon, 29 Aug 2011 04:27:06 -0400 Received: from emcscan.emc.com.tw ([192.72.220.5]:12004 "EHLO emcscan.emc.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753192Ab1H2I1E (ORCPT ); Mon, 29 Aug 2011 04:27:04 -0400 Received: from unknown (HELO emc.com.tw) ([192.168.10.1]) by emcscan.emc.com.tw with ESMTP; 29 Aug 2011 16:27:00 +0800 Received: from localhost ([192.168.81.59]) by emc.com.tw (8.13.7+Sun/8.13.7) with ESMTP id p7T8QxaN015350; Mon, 29 Aug 2011 16:26:59 +0800 (CST) From: JJ Ding To: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Seth Forshee , Dmitry Torokhov , Aaron Huang , Tom Lin , =?UTF-8?q?=C3=89ric=20Piel?= , Daniel Kurtz , Chase Douglas , Henrik Rydberg , Alessandro Rubini , JJ Ding Subject: [PATCH v4 2/8] Input: elantech - get rid of ETP_2FT_* in elantech.h Date: Mon, 29 Aug 2011 16:28:53 +0800 Message-Id: <1314606539-24722-3-git-send-email-jj_ding@emc.com.tw> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1314606539-24722-1-git-send-email-jj_ding@emc.com.tw> References: <1314606539-24722-1-git-send-email-jj_ding@emc.com.tw> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 29 Aug 2011 08:27:26 +0000 (UTC) For two finger touches the coordinate of each finger gets reported separately but with reduced resolution. With this change, we now have the same range for ST and MT data and scale MT data because it has lower resolution to match ST. Suggested-by: Dmitry Torokhov Signed-off-by: JJ Ding Acked-by: Daniel Kurtz --- drivers/input/mouse/elantech.c | 28 +++++++++++++--------------- drivers/input/mouse/elantech.h | 11 ----------- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index da161da..cd8e2e5 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -273,11 +273,11 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) struct elantech_data *etd = psmouse->private; struct input_dev *dev = psmouse->dev; unsigned char *packet = psmouse->packet; - unsigned int fingers, x1 = 0, y1 = 0, x2 = 0, y2 = 0, width = 0, pres = 0; + unsigned int fingers, x1 = 0, y1 = 0, x2 = 0, y2 = 0; + unsigned int width = 0, pres = 0; /* byte 0: n1 n0 . . . . R L */ fingers = (packet[0] & 0xc0) >> 6; - input_report_key(dev, BTN_TOUCH, fingers != 0); switch (fingers) { case 3: @@ -300,9 +300,6 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) */ y1 = ETP_YMAX_V2 - (((packet[4] & 0x0f) << 8) | packet[5]); - input_report_abs(dev, ABS_X, x1); - input_report_abs(dev, ABS_Y, y1); - pres = (packet[1] & 0xf0) | ((packet[4] & 0xf0) >> 4); width = ((packet[0] & 0x30) >> 2) | ((packet[3] & 0x30) >> 4); break; @@ -314,22 +311,18 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) * byte 0: . . ay8 ax8 . . . . * byte 1: ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0 */ - x1 = ((packet[0] & 0x10) << 4) | packet[1]; + x1 = (((packet[0] & 0x10) << 4) | packet[1]) << 2; /* byte 2: ay7 ay6 ay5 ay4 ay3 ay2 ay1 ay0 */ - y1 = ETP_2FT_YMAX - (((packet[0] & 0x20) << 3) | packet[2]); + y1 = ETP_YMAX_V2 - + ((((packet[0] & 0x20) << 3) | packet[2]) << 2); /* * byte 3: . . by8 bx8 . . . . * byte 4: bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0 */ - x2 = ((packet[3] & 0x10) << 4) | packet[4]; + x2 = (((packet[3] & 0x10) << 4) | packet[4]) << 2; /* byte 5: by7 by8 by5 by4 by3 by2 by1 by0 */ - y2 = ETP_2FT_YMAX - (((packet[3] & 0x20) << 3) | packet[5]); - /* - * For compatibility with the X Synaptics driver scale up - * one coordinate and report as ordinary mouse movent - */ - input_report_abs(dev, ABS_X, x1 << 2); - input_report_abs(dev, ABS_Y, y1 << 2); + y2 = ETP_YMAX_V2 - + ((((packet[3] & 0x20) << 3) | packet[5]) << 2); /* Unknown so just report sensible values */ pres = 127; @@ -337,6 +330,11 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) break; } + input_report_key(dev, BTN_TOUCH, fingers != 0); + if (fingers != 0) { + input_report_abs(dev, ABS_X, x1); + input_report_abs(dev, ABS_Y, y1); + } elantech_report_semi_mt_data(dev, fingers, x1, y1, x2, y2); input_report_key(dev, BTN_TOOL_FINGER, fingers == 1); input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2); diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h index fabb2b9..1c5894e 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h @@ -82,17 +82,6 @@ #define ETP_WMIN_V2 0 #define ETP_WMAX_V2 15 -/* - * For two finger touches the coordinate of each finger gets reported - * separately but with reduced resolution. - */ -#define ETP_2FT_FUZZ 4 - -#define ETP_2FT_XMIN ( 0 + ETP_2FT_FUZZ) -#define ETP_2FT_XMAX (288 - ETP_2FT_FUZZ) -#define ETP_2FT_YMIN ( 0 + ETP_2FT_FUZZ) -#define ETP_2FT_YMAX (192 - ETP_2FT_FUZZ) - struct elantech_data { unsigned char reg_10; unsigned char reg_11;