From patchwork Wed Jul 27 17:28:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yufeng Shen X-Patchwork-Id: 1012362 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 p6RHSgYg003761 for ; Wed, 27 Jul 2011 17:28:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753769Ab1G0R2g (ORCPT ); Wed, 27 Jul 2011 13:28:36 -0400 Received: from smtp-out.google.com ([216.239.44.51]:7026 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753785Ab1G0R2e (ORCPT ); Wed, 27 Jul 2011 13:28:34 -0400 Received: from wpaz5.hot.corp.google.com (wpaz5.hot.corp.google.com [172.24.198.69]) by smtp-out.google.com with ESMTP id p6RHSJ8e019383; Wed, 27 Jul 2011 10:28:19 -0700 Received: from miletus1.wat.corp.google.com (miletus1.wat.corp.google.com [172.23.176.198]) by wpaz5.hot.corp.google.com with ESMTP id p6RHSHHl022389; Wed, 27 Jul 2011 10:28:17 -0700 Received: by miletus1.wat.corp.google.com (Postfix, from userid 95428) id 1F3CC160BF7; Wed, 27 Jul 2011 13:28:17 -0400 (EDT) From: Yufeng Shen To: linux-input@vger.kernel.org Cc: Dmitry Torokhov , Henrik Rydberg , Iiro Valkonen , Joonyoung Shim , Chris Leech , linux-kernel@vger.kernel.org, Wanlong Gao , Yufeng Shen Subject: [PATCH v2] Input: atmel_mxt_ts - Report pressure information from the driver Date: Wed, 27 Jul 2011 13:28:15 -0400 Message-Id: <1311787695-28147-1-git-send-email-miletus@chromium.org> X-Mailer: git-send-email 1.7.3.1 X-System-Of-Record: true 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]); Wed, 27 Jul 2011 17:28:43 +0000 (UTC) Atmel mxt1386 touch controller has the touch pressure information but the current driver atmel_mxt_ts does not expose it to the user space. This patch makes the driver report the touch pressure information to user space. ChangeLog: v2: fixed indentation as commented by Wanlong Gao Change-Id: Ie0e4683a3cd5ec79222f7682b0ddc24f909af543 --- drivers/input/touchscreen/atmel_mxt_ts.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index ae00604..9bdf4e0 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -244,6 +244,7 @@ struct mxt_finger { int x; int y; int area; + int pressure; }; /* Each client has this additional data */ @@ -536,6 +537,8 @@ static void mxt_input_report(struct mxt_data *data, int single_id) finger[id].x); input_report_abs(input_dev, ABS_MT_POSITION_Y, finger[id].y); + input_report_abs(input_dev, ABS_MT_PRESSURE, + finger[id].pressure); } else { finger[id].status = 0; } @@ -560,6 +563,7 @@ static void mxt_input_touchevent(struct mxt_data *data, int x; int y; int area; + int pressure; /* Check the touch is present on the screen */ if (!(status & MXT_DETECT)) { @@ -584,6 +588,7 @@ static void mxt_input_touchevent(struct mxt_data *data, y = y >> 2; area = message->message[4]; + pressure = message->message[5]; dev_dbg(dev, "[%d] %s x: %d, y: %d, area: %d\n", id, status & MXT_MOVE ? "moved" : "pressed", @@ -594,6 +599,7 @@ static void mxt_input_touchevent(struct mxt_data *data, finger[id].x = x; finger[id].y = y; finger[id].area = area; + finger[id].pressure = pressure; mxt_input_report(data, id); } @@ -1125,6 +1131,8 @@ static int __devinit mxt_probe(struct i2c_client *client, 0, data->max_x, 0, 0); input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, data->max_y, 0, 0); + input_set_abs_params(input_dev, ABS_MT_PRESSURE, + 0, 255, 0, 0); input_set_drvdata(input_dev, data); i2c_set_clientdata(client, data);