From patchwork Fri Mar 4 07:55:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sangwon Jee X-Patchwork-Id: 8499881 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B3F479F659 for ; Fri, 4 Mar 2016 07:55:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C51EC201C8 for ; Fri, 4 Mar 2016 07:55:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4536C201C7 for ; Fri, 4 Mar 2016 07:55:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752069AbcCDHzs (ORCPT ); Fri, 4 Mar 2016 02:55:48 -0500 Received: from sbs.melfas.com ([39.118.242.30]:13320 "EHLO sbs.melfas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751080AbcCDHzr (ORCPT ); Fri, 4 Mar 2016 02:55:47 -0500 Received: from unknown (HELO localhost.localdomain) (jeesw@melfas.com@172.16.10.138) by 172.16.0.30 with ESMTP; 4 Mar 2016 16:55:20 +0900 X-Original-SENDERIP: 172.16.10.138 X-Original-MAILFROM: jeesw@melfas.com X-Original-RCPTTO: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, jeesw@melfas.com From: Sangwon Jee To: dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org, jeesw@melfas.com Subject: Input: melfas_mip4 - add resolution reporting Date: Fri, 4 Mar 2016 16:55:01 +0900 Message-Id: <1457078101-3190-1-git-send-email-jeesw@melfas.com> X-Mailer: git-send-email 1.9.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add resolution(pixels per mm) value registers and resolution reporting by input_abs_set_res. Signed-off-by: Sangwon Jee --- drivers/input/touchscreen/melfas_mip4.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c index b8e9ead..2a879e4b 100644 --- a/drivers/input/touchscreen/melfas_mip4.c +++ b/drivers/input/touchscreen/melfas_mip4.c @@ -33,7 +33,7 @@ /***************************************************************** * Protocol - * Version : MIP 4.0 Rev 4.4 + * Version : MIP 4.0 Rev 4.6 *****************************************************************/ /* Address */ @@ -52,6 +52,11 @@ #define MIP4_R1_INFO_NODE_NUM_X 0x14 #define MIP4_R1_INFO_NODE_NUM_Y 0x15 #define MIP4_R1_INFO_KEY_NUM 0x16 +#define MIP4_R1_INFO_PRESSURE_NUM 0x17 +#define MIP4_R1_INFO_LENGTH_X 0x18 +#define MIP4_R1_INFO_LENGTH_Y 0x1A +#define MIP4_R1_INFO_PPM_X 0x1C +#define MIP4_R1_INFO_PPM_Y 0x1D #define MIP4_R1_INFO_VERSION_BOOT 0x20 #define MIP4_R1_INFO_VERSION_CORE 0x22 #define MIP4_R1_INFO_VERSION_APP 0x24 @@ -158,6 +163,8 @@ struct mip4_ts { u8 node_x; u8 node_y; u8 node_key; + unsigned int ppm_x; + unsigned int ppm_y; struct mip4_fw_version fw_version; @@ -242,7 +249,7 @@ static int mip4_query_device(struct mip4_ts *ts) { int error; u8 cmd[2]; - u8 buf[8]; + u8 buf[14]; /* Product name */ cmd[0] = MIP4_R0_INFO; @@ -269,7 +276,7 @@ static int mip4_query_device(struct mip4_ts *ts) /* Resolution */ cmd[0] = MIP4_R0_INFO; cmd[1] = MIP4_R1_INFO_RESOLUTION_X; - error = mip4_i2c_xfer(ts, cmd, sizeof(cmd), buf, 7); + error = mip4_i2c_xfer(ts, cmd, sizeof(cmd), buf, 14); if (error) { dev_warn(&ts->client->dev, "Failed to retrieve touchscreen parameters: %d\n", @@ -287,6 +294,11 @@ static int mip4_query_device(struct mip4_ts *ts) "node_x: %d, node_y: %d, node_key: %d\n", ts->node_x, ts->node_y, ts->node_key); + ts->ppm_x = buf[12]; + ts->ppm_y = buf[13]; + dev_dbg(&ts->client->dev, "ppm_x: %d, ppm_y: %d\n", + ts->ppm_x, ts->ppm_y); + /* Key ts */ if (ts->node_key > 0) ts->key_num = ts->node_key; @@ -1095,6 +1107,10 @@ exit_bl: input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, ts->max_y, 0, 0); input_set_abs_params(ts->input, ABS_X, 0, ts->max_x, 0, 0); input_set_abs_params(ts->input, ABS_Y, 0, ts->max_y, 0, 0); + input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->ppm_x); + input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->ppm_y); + input_abs_set_res(ts->input, ABS_X, ts->ppm_x); + input_abs_set_res(ts->input, ABS_Y, ts->ppm_y); return error ? error : 0; } @@ -1377,6 +1393,8 @@ static int mip4_probe(struct i2c_client *client, const struct i2c_device_id *id) MIP4_TOUCH_MAJOR_MIN, MIP4_TOUCH_MAJOR_MAX, 0, 0); input_set_abs_params(input, ABS_MT_TOUCH_MINOR, MIP4_TOUCH_MINOR_MIN, MIP4_TOUCH_MINOR_MAX, 0, 0); + input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->ppm_x); + input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->ppm_y); error = input_mt_init_slots(input, MIP4_MAX_FINGERS, INPUT_MT_DIRECT); if (error) @@ -1494,6 +1512,6 @@ static struct i2c_driver mip4_driver = { module_i2c_driver(mip4_driver); MODULE_DESCRIPTION("MELFAS MIP4 Touchscreen"); -MODULE_VERSION("2016.01.13"); +MODULE_VERSION("2016.03.03"); MODULE_AUTHOR("Sangwon Jee "); MODULE_LICENSE("GPL");