From patchwork Mon May 27 16:07:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Middelschulte, Leif" X-Patchwork-Id: 10963379 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 424F076 for ; Mon, 27 May 2019 16:15:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 324BD28501 for ; Mon, 27 May 2019 16:15:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2634D2850F; Mon, 27 May 2019 16:15:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C390628501 for ; Mon, 27 May 2019 16:15:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726517AbfE0QPV (ORCPT ); Mon, 27 May 2019 12:15:21 -0400 Received: from ironport.klsmartin.com ([212.211.191.11]:19886 "EHLO ironport.klsmartin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726432AbfE0QPV (ORCPT ); Mon, 27 May 2019 12:15:21 -0400 X-Greylist: delayed 429 seconds by postgrey-1.27 at vger.kernel.org; Mon, 27 May 2019 12:15:19 EDT X-IronPort-AV: E=Sophos;i="5.60,519,1549926000"; d="scan'208";a="1674680" Received: from unknown (HELO hera.klsmartin.com) ([172.30.5.66]) by ironport.klsmartin.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 27 May 2019 18:08:13 +0200 Received: from SUMMAIL01.UMK.KLS.zentral ([172.25.1.63]) by hera.klsmartin.com (8.14.3/8.13.1/SuSE Linux 0.7) with ESMTP id x4RG84Do028497; Mon, 27 May 2019 18:08:06 +0200 Received: from UML026.UMK.KLS.zentral (172.25.2.60) by SUMMAIL01.UMK.KLS.zentral (172.25.1.63) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 27 May 2019 18:08:06 +0200 From: Leif Middelschulte To: , CC: , , , Leif Middelschulte Subject: [PATCH 01/10] dt-bindings: input: touchscreen: stmpe: add touch window configuration Date: Mon, 27 May 2019 18:07:27 +0200 Message-ID: <20190527160736.30569-2-leif.middelschulte@klsmartin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190527160736.30569-1-leif.middelschulte@klsmartin.com> References: <20190527160736.30569-1-leif.middelschulte@klsmartin.com> MIME-Version: 1.0 X-Originating-IP: [172.25.2.60] X-KSE-ServerInfo: SUMMAIL01.UMK.KLS.zentral, 9 X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 27.05.2019 13:23:00 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The STMPE811 is able to only monitor a subwindow of the entire screen. Touches outside of this window are neglected. This change adds the corresponding documentation. Signed-off-by: Leif Middelschulte --- .../devicetree/bindings/input/touchscreen/stmpe.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt index c549924603d2..04962e2e1ad0 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt @@ -33,6 +33,13 @@ Optional properties: - st,i-drive : current limit value of the touchscreen drivers 0 -> 20 mA (typical 35mA max) 1 -> 50 mA (typical 80 mA max) +- st,window-tracking : An u12 array that allows to pre-set a sub-window in the touchscreen. + Any touch position that is outside the sub-window is discarded + (top-right x, top-right y, bottom-left x, bottom-left y). + The given window also affects the value range (limits) set + within the input subsystem which, in turn, affects + the input resolution calculation on both axes. + Optional properties common with MFD (deprecated): - st,sample-time : ADC conversion time in number of clock. @@ -101,6 +108,8 @@ stmpe811@41 { * current limit value */ st,i-drive = <1>; + /* enable entire window */ + st,window-tracking = /bits/ 16 <4095 4095 0 0>; }; stmpe_adc { compatible = "st,stmpe-adc"; From patchwork Mon May 27 16:07:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Middelschulte, Leif" X-Patchwork-Id: 10963381 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 81AF91395 for ; Mon, 27 May 2019 16:15:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7089E28501 for ; Mon, 27 May 2019 16:15:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64A5B2850F; Mon, 27 May 2019 16:15:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA02B28501 for ; Mon, 27 May 2019 16:15:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726645AbfE0QPX (ORCPT ); Mon, 27 May 2019 12:15:23 -0400 Received: from ironport.klsmartin.com ([212.211.191.11]:19886 "EHLO ironport.klsmartin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726432AbfE0QPX (ORCPT ); Mon, 27 May 2019 12:15:23 -0400 X-Greylist: delayed 429 seconds by postgrey-1.27 at vger.kernel.org; Mon, 27 May 2019 12:15:19 EDT X-IronPort-AV: E=Sophos;i="5.60,519,1549926000"; d="scan'208";a="1674681" Received: from unknown (HELO hera.klsmartin.com) ([172.30.5.66]) by ironport.klsmartin.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 27 May 2019 18:08:16 +0200 Received: from SUMMAIL01.UMK.KLS.zentral ([172.25.1.63]) by hera.klsmartin.com (8.14.3/8.13.1/SuSE Linux 0.7) with ESMTP id x4RG87iI028503; Mon, 27 May 2019 18:08:09 +0200 Received: from UML026.UMK.KLS.zentral (172.25.2.60) by SUMMAIL01.UMK.KLS.zentral (172.25.1.63) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 27 May 2019 18:08:09 +0200 From: Leif Middelschulte To: , CC: , , , Leif Middelschulte Subject: [PATCH 02/10] Input: stmpe-ts - implement touch window configuration support Date: Mon, 27 May 2019 18:07:28 +0200 Message-ID: <20190527160736.30569-3-leif.middelschulte@klsmartin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190527160736.30569-1-leif.middelschulte@klsmartin.com> References: <20190527160736.30569-1-leif.middelschulte@klsmartin.com> MIME-Version: 1.0 X-Originating-IP: [172.25.2.60] X-KSE-ServerInfo: SUMMAIL01.UMK.KLS.zentral, 9 X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 27.05.2019 13:23:00 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Touch window tracking allows to pre-set a sub-window in the touchscreen area such that any touch position that is outside the sub-window is discarded. Signed-off-by: Leif Middelschulte --- drivers/input/touchscreen/stmpe-ts.c | 96 +++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c index cf9c9aa39f6e..6917237bd6c6 100644 --- a/drivers/input/touchscreen/stmpe-ts.c +++ b/drivers/input/touchscreen/stmpe-ts.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -35,6 +36,10 @@ #define STMPE_REG_FIFO_TH 0x4A #define STMPE_REG_FIFO_STA 0x4B #define STMPE_REG_FIFO_SIZE 0x4C +#define STMPE_REG_WDW_TR_X 0x42 +#define STMPE_REG_WDW_TR_Y 0x44 +#define STMPE_REG_WDW_BL_X 0x46 +#define STMPE_REG_WDW_BL_Y 0x48 #define STMPE_REG_TSC_DATA_XYZ 0x52 #define STMPE_REG_TSC_FRACTION_Z 0x56 #define STMPE_REG_TSC_I_DRIVE 0x58 @@ -82,6 +87,22 @@ struct stmpe_touch { u8 settling; u8 fraction_z; u8 i_drive; + struct { + struct { + u16 x; + u16 y; + } top_right; + struct { + u16 x; + u16 y; + } bottom_left; + } wdw; + bool wdw_from_dt; + struct touchscreen_properties props; + struct { + u32 x; + u32 y; + } min; }; static int __stmpe_reset_fifo(struct stmpe *stmpe) @@ -128,6 +149,27 @@ static void stmpe_work(struct work_struct *work) input_sync(ts->idev); } +static void stmpe_update_range_values(struct stmpe_touch *ts) +{ + u8 data_set[2]; + /* + * Calculate max_x and max_y based on window size configuration read + * from touchscreen controller + */ + stmpe_block_read(ts->stmpe, STMPE_REG_WDW_TR_X, 2, data_set); + ts->wdw.top_right.x = (data_set[0] << 8) | (data_set[1]); + stmpe_block_read(ts->stmpe, STMPE_REG_WDW_TR_Y, 2, data_set); + ts->wdw.top_right.y = (data_set[0] << 8) | (data_set[1]); + stmpe_block_read(ts->stmpe, STMPE_REG_WDW_BL_X, 2, data_set); + ts->wdw.bottom_left.x = (data_set[0] << 8) | (data_set[1]); + stmpe_block_read(ts->stmpe, STMPE_REG_WDW_BL_Y, 2, data_set); + ts->wdw.bottom_left.y = (data_set[0] << 8) | (data_set[1]); + ts->min.x = ts->wdw.bottom_left.x; + ts->min.y = ts->wdw.bottom_left.y; + ts->props.max_x = ts->wdw.top_right.x; + ts->props.max_y = ts->wdw.top_right.y; +} + static irqreturn_t stmpe_ts_handler(int irq, void *data) { u8 data_set[4]; @@ -212,6 +254,44 @@ static int stmpe_init_hw(struct stmpe_touch *ts) return ret; } + if (ts->wdw_from_dt) { + u8 data_set[2]; + + data_set[0] = ts->wdw.top_right.x >> 8; + data_set[1] = ts->wdw.top_right.x; + ret = stmpe_block_write(ts->stmpe, + STMPE_REG_WDW_TR_X, 2, data_set); + if (ret) { + dev_err(dev, "Could not configure touchscreen window's top right x value\n"); + return ret; + } + data_set[0] = ts->wdw.top_right.y >> 8; + data_set[1] = ts->wdw.top_right.y; + ret = stmpe_block_write(ts->stmpe, + STMPE_REG_WDW_TR_Y, 2, data_set); + if (ret) { + dev_err(dev, "Could not configure touchscreen window's top right y value\n"); + return ret; + } + data_set[0] = ts->wdw.bottom_left.x >> 8; + data_set[1] = ts->wdw.bottom_left.x; + ret = stmpe_block_write(ts->stmpe, + STMPE_REG_WDW_BL_X, 2, data_set); + if (ret) { + dev_err(dev, "Could not configure touchscreen window's bottom left x value\n"); + return ret; + } + data_set[0] = ts->wdw.bottom_left.y >> 8; + data_set[1] = ts->wdw.bottom_left.y; + ret = stmpe_block_write(ts->stmpe, + STMPE_REG_WDW_BL_Y, 2, data_set); + if (ret) { + dev_err(dev, "Could not configure touchscreen window's bottom left y value\n"); + return ret; + } + } + stmpe_update_range_values(ts); + ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_I_DRIVE, STMPE_I_DRIVE(0xff), STMPE_I_DRIVE(ts->i_drive)); if (ret) { @@ -264,6 +344,7 @@ static void stmpe_ts_get_platform_info(struct platform_device *pdev, { struct device_node *np = pdev->dev.of_node; u32 val; + u16 wdw[4]; if (np) { if (!of_property_read_u32(np, "st,sample-time", &val)) @@ -284,6 +365,15 @@ static void stmpe_ts_get_platform_info(struct platform_device *pdev, ts->fraction_z = val; if (!of_property_read_u32(np, "st,i-drive", &val)) ts->i_drive = val; + if (!of_property_read_u16_array(np, "st,window-tracking", + wdw, 4)) { + ts->wdw.top_right.x = wdw[0] & XY_MASK; + ts->wdw.top_right.y = wdw[1] & XY_MASK; + ts->wdw.bottom_left.x = wdw[2] & XY_MASK; + ts->wdw.bottom_left.y = wdw[3] & XY_MASK; + ts->wdw_from_dt = true; + } + touchscreen_parse_properties(ts->idev, false, &ts->props); } } @@ -338,8 +428,10 @@ static int stmpe_input_probe(struct platform_device *pdev) input_set_drvdata(idev, ts); input_set_capability(idev, EV_KEY, BTN_TOUCH); - input_set_abs_params(idev, ABS_X, 0, XY_MASK, 0, 0); - input_set_abs_params(idev, ABS_Y, 0, XY_MASK, 0, 0); + input_set_abs_params(idev, + ABS_X, ts->min.x, ts->props.max_x, 0, 0); + input_set_abs_params(idev, + ABS_Y, ts->min.y, ts->props.max_y, 0, 0); input_set_abs_params(idev, ABS_PRESSURE, 0x0, 0xff, 0, 0); error = input_register_device(idev); From patchwork Mon May 27 16:07:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Middelschulte, Leif" X-Patchwork-Id: 10963383 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2A2F11395 for ; Mon, 27 May 2019 16:15:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18EA628501 for ; Mon, 27 May 2019 16:15:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D34E2850F; Mon, 27 May 2019 16:15:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A83D928501 for ; Mon, 27 May 2019 16:15:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726667AbfE0QP0 (ORCPT ); Mon, 27 May 2019 12:15:26 -0400 Received: from ironport.klsmartin.com ([212.211.191.11]:19886 "EHLO ironport.klsmartin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726432AbfE0QP0 (ORCPT ); Mon, 27 May 2019 12:15:26 -0400 X-Greylist: delayed 429 seconds by postgrey-1.27 at vger.kernel.org; Mon, 27 May 2019 12:15:19 EDT X-IronPort-AV: E=Sophos;i="5.60,519,1549926000"; d="scan'208";a="1674682" Received: from unknown (HELO hera.klsmartin.com) ([172.30.5.66]) by ironport.klsmartin.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 27 May 2019 18:08:19 +0200 Received: from SUMMAIL01.UMK.KLS.zentral ([172.25.1.63]) by hera.klsmartin.com (8.14.3/8.13.1/SuSE Linux 0.7) with ESMTP id x4RG8Asg028506; Mon, 27 May 2019 18:08:12 +0200 Received: from UML026.UMK.KLS.zentral (172.25.2.60) by SUMMAIL01.UMK.KLS.zentral (172.25.1.63) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 27 May 2019 18:08:12 +0200 From: Leif Middelschulte To: , CC: , , , Leif Middelschulte Subject: [PATCH 03/10] dt-bindings: input: touchscreen: stmpe: add resolution support Date: Mon, 27 May 2019 18:07:29 +0200 Message-ID: <20190527160736.30569-4-leif.middelschulte@klsmartin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190527160736.30569-1-leif.middelschulte@klsmartin.com> References: <20190527160736.30569-1-leif.middelschulte@klsmartin.com> MIME-Version: 1.0 X-Originating-IP: [172.25.2.60] X-KSE-ServerInfo: SUMMAIL01.UMK.KLS.zentral, 9 X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 27.05.2019 13:23:00 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This documents the support for specifying the screen size in milimeter and its impact on resolution calculation. Signed-off-by: Leif Middelschulte --- Documentation/devicetree/bindings/input/touchscreen/stmpe.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt index 04962e2e1ad0..d20dc5a7d8ad 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt @@ -39,6 +39,10 @@ Optional properties: The given window also affects the value range (limits) set within the input subsystem which, in turn, affects the input resolution calculation on both axes. +- touchscreen-x-mm : horizontal length in mm of the touchscreen. It affects + the input resolution calculation on the horizontal axis. +- touchscreen-y-mm : vertical length in mm of the touchscreen. It affects + the input resolution calculation on the vertical axis. Optional properties common with MFD (deprecated): From patchwork Mon May 27 16:07:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Middelschulte, Leif" X-Patchwork-Id: 10963385 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1F8B876 for ; Mon, 27 May 2019 16:15:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DAB428501 for ; Mon, 27 May 2019 16:15:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01F3B2850F; Mon, 27 May 2019 16:15:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A79B28501 for ; Mon, 27 May 2019 16:15:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726683AbfE0QP2 (ORCPT ); Mon, 27 May 2019 12:15:28 -0400 Received: from ironport.klsmartin.com ([212.211.191.11]:19886 "EHLO ironport.klsmartin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726432AbfE0QP2 (ORCPT ); Mon, 27 May 2019 12:15:28 -0400 X-Greylist: delayed 429 seconds by postgrey-1.27 at vger.kernel.org; Mon, 27 May 2019 12:15:19 EDT X-IronPort-AV: E=Sophos;i="5.60,519,1549926000"; d="scan'208";a="1674683" Received: from unknown (HELO hera.klsmartin.com) ([172.30.5.66]) by ironport.klsmartin.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 27 May 2019 18:08:22 +0200 Received: from SUMMAIL01.UMK.KLS.zentral ([172.25.1.63]) by hera.klsmartin.com (8.14.3/8.13.1/SuSE Linux 0.7) with ESMTP id x4RG8DfK028509; Mon, 27 May 2019 18:08:15 +0200 Received: from UML026.UMK.KLS.zentral (172.25.2.60) by SUMMAIL01.UMK.KLS.zentral (172.25.1.63) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 27 May 2019 18:08:15 +0200 From: Leif Middelschulte To: , CC: , , , Leif Middelschulte Subject: [PATCH 04/10] Input: stmpe-ts - implement resolution support Date: Mon, 27 May 2019 18:07:30 +0200 Message-ID: <20190527160736.30569-5-leif.middelschulte@klsmartin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190527160736.30569-1-leif.middelschulte@klsmartin.com> References: <20190527160736.30569-1-leif.middelschulte@klsmartin.com> MIME-Version: 1.0 X-Originating-IP: [172.25.2.60] X-KSE-ServerInfo: SUMMAIL01.UMK.KLS.zentral, 9 X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 27.05.2019 13:23:00 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The resolution is calculated based on the devicetree property `touchscreen-{x,y}-mm`. It matches the prosa definition given in uapi/linux/input.h. Beware that the resolution is affected, if window-tracking parameters are applied. Signed-off-by: Leif Middelschulte --- drivers/input/touchscreen/stmpe-ts.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c index 6917237bd6c6..1f11043a04df 100644 --- a/drivers/input/touchscreen/stmpe-ts.c +++ b/drivers/input/touchscreen/stmpe-ts.c @@ -102,7 +102,7 @@ struct stmpe_touch { struct { u32 x; u32 y; - } min; + } size_in_mm, min; }; static int __stmpe_reset_fifo(struct stmpe *stmpe) @@ -346,6 +346,10 @@ static void stmpe_ts_get_platform_info(struct platform_device *pdev, u32 val; u16 wdw[4]; + // use sensible (with regards to calculations) default values + ts->size_in_mm.x = 1; + ts->size_in_mm.y = 1; + if (np) { if (!of_property_read_u32(np, "st,sample-time", &val)) ts->stmpe->sample_time = val; @@ -373,6 +377,10 @@ static void stmpe_ts_get_platform_info(struct platform_device *pdev, ts->wdw.bottom_left.y = wdw[3] & XY_MASK; ts->wdw_from_dt = true; } + if (!of_property_read_u32(np, "touchscreen-x-mm", &val)) + ts->size_in_mm.x = val; + if (!of_property_read_u32(np, "touchscreen-y-mm", &val)) + ts->size_in_mm.y = val; touchscreen_parse_properties(ts->idev, false, &ts->props); } } @@ -384,6 +392,7 @@ static int stmpe_input_probe(struct platform_device *pdev) struct input_dev *idev; int error; int ts_irq; + int resolution; ts_irq = platform_get_irq_byname(pdev, "FIFO_TH"); if (ts_irq < 0) @@ -430,8 +439,12 @@ static int stmpe_input_probe(struct platform_device *pdev) input_set_capability(idev, EV_KEY, BTN_TOUCH); input_set_abs_params(idev, ABS_X, ts->min.x, ts->props.max_x, 0, 0); + resolution = (ts->props.max_x - ts->min.x) / ts->size_in_mm.x; + input_abs_set_res(idev, ABS_X, resolution); input_set_abs_params(idev, ABS_Y, ts->min.y, ts->props.max_y, 0, 0); + resolution = (ts->props.max_y - ts->min.y) / ts->size_in_mm.y; + input_abs_set_res(idev, ABS_Y, resolution); input_set_abs_params(idev, ABS_PRESSURE, 0x0, 0xff, 0, 0); error = input_register_device(idev); From patchwork Mon May 27 16:19:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Middelschulte, Leif" X-Patchwork-Id: 10963387 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ABB7276 for ; Mon, 27 May 2019 16:20:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96F5F28385 for ; Mon, 27 May 2019 16:20:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B6BA284E9; Mon, 27 May 2019 16:20:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23C7028385 for ; Mon, 27 May 2019 16:20:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726457AbfE0QUM (ORCPT ); Mon, 27 May 2019 12:20:12 -0400 Received: from ironport.klsmartin.com ([212.211.191.11]:28603 "EHLO ironport.klsmartin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725991AbfE0QUM (ORCPT ); Mon, 27 May 2019 12:20:12 -0400 X-IronPort-AV: E=Sophos;i="5.60,519,1549926000"; d="scan'208";a="1674793" Received: from unknown (HELO hera.klsmartin.com) ([172.30.5.66]) by ironport.klsmartin.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 27 May 2019 18:20:11 +0200 Received: from SUMMAIL01.UMK.KLS.zentral ([172.25.1.63]) by hera.klsmartin.com (8.14.3/8.13.1/SuSE Linux 0.7) with ESMTP id x4RGK32s002844; Mon, 27 May 2019 18:20:05 +0200 Received: from UML026.UMK.KLS.zentral (172.25.2.60) by SUMMAIL01.UMK.KLS.zentral (172.25.1.63) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 27 May 2019 18:20:05 +0200 From: Leif Middelschulte To: , CC: , , , Leif Middelschulte Subject: [PATCH 05/10] dt-bindings: input: touchscreen: stmpe: add XY mode Date: Mon, 27 May 2019 18:19:33 +0200 Message-ID: <20190527161938.31871-1-leif.middelschulte@klsmartin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190527160736.30569-1-leif.middelschulte@klsmartin.com> References: <20190527160736.30569-1-leif.middelschulte@klsmartin.com> MIME-Version: 1.0 X-Originating-IP: [172.25.2.60] X-KSE-ServerInfo: SUMMAIL01.UMK.KLS.zentral, 9 X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 27.05.2019 13:23:00 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This change documents the support of another input data acquisition mode (XY). This mode is mostly relevant in the context of/combination with the tracking index. Signed-off-by: Leif Middelschulte Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/input/touchscreen/stmpe.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt index d20dc5a7d8ad..aee1abf06ddb 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt @@ -28,6 +28,9 @@ Optional properties: 5 -> 10 ms 6 -> 50 ms 7 -> 100 ms +- st,op-mod : Axis information acquisition operating mode (Default is 0) + 0 -> XYZ + 1 -> XY - st,fraction-z : Length of the fractional part in z (recommended is 7) (fraction-z ([0..7]) = Count of the fractional part) - st,i-drive : current limit value of the touchscreen drivers From patchwork Mon May 27 16:19:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Middelschulte, Leif" X-Patchwork-Id: 10963389 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E9F9718A6 for ; Mon, 27 May 2019 16:20:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA24528623 for ; Mon, 27 May 2019 16:20:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEB71284D2; Mon, 27 May 2019 16:20:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43DBA281E1 for ; Mon, 27 May 2019 16:20:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726483AbfE0QUP (ORCPT ); Mon, 27 May 2019 12:20:15 -0400 Received: from ironport.klsmartin.com ([212.211.191.11]:28603 "EHLO ironport.klsmartin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725991AbfE0QUP (ORCPT ); Mon, 27 May 2019 12:20:15 -0400 X-IronPort-AV: E=Sophos;i="5.60,519,1549926000"; d="scan'208";a="1674794" Received: from unknown (HELO hera.klsmartin.com) ([172.30.5.66]) by ironport.klsmartin.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 27 May 2019 18:20:14 +0200 Received: from SUMMAIL01.UMK.KLS.zentral ([172.25.1.63]) by hera.klsmartin.com (8.14.3/8.13.1/SuSE Linux 0.7) with ESMTP id x4RGK6Vl002847; Mon, 27 May 2019 18:20:08 +0200 Received: from UML026.UMK.KLS.zentral (172.25.2.60) by SUMMAIL01.UMK.KLS.zentral (172.25.1.63) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 27 May 2019 18:20:08 +0200 From: Leif Middelschulte To: , CC: , , , Leif Middelschulte Subject: [PATCH 06/10] Input: stmpe-ts - implement XY acquisition mode Date: Mon, 27 May 2019 18:19:34 +0200 Message-ID: <20190527161938.31871-2-leif.middelschulte@klsmartin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190527161938.31871-1-leif.middelschulte@klsmartin.com> References: <20190527160736.30569-1-leif.middelschulte@klsmartin.com> <20190527161938.31871-1-leif.middelschulte@klsmartin.com> MIME-Version: 1.0 X-Originating-IP: [172.25.2.60] X-KSE-ServerInfo: SUMMAIL01.UMK.KLS.zentral, 9 X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 27.05.2019 13:23:00 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP While the default acquisition covers the pressure (z) too, the XY mode is only concerend with the horizontal and vertical input position acquisition. It uses dedicated registers for each axes to do so, while the XYZ acquisition packs the read values more densely. Signed-off-by: Leif Middelschulte --- drivers/input/touchscreen/stmpe-ts.c | 45 ++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c index 1f11043a04df..152aac8b3ab7 100644 --- a/drivers/input/touchscreen/stmpe-ts.c +++ b/drivers/input/touchscreen/stmpe-ts.c @@ -40,11 +40,14 @@ #define STMPE_REG_WDW_TR_Y 0x44 #define STMPE_REG_WDW_BL_X 0x46 #define STMPE_REG_WDW_BL_Y 0x48 +#define STMPE_REG_TSC_DATA_X 0x4D +#define STMPE_REG_TSC_DATA_Y 0x4F #define STMPE_REG_TSC_DATA_XYZ 0x52 #define STMPE_REG_TSC_FRACTION_Z 0x56 #define STMPE_REG_TSC_I_DRIVE 0x58 #define OP_MOD_XYZ 0 +#define OP_MOD_XY 1 #define STMPE_TSC_CTRL_TSC_EN (1<<0) @@ -87,6 +90,7 @@ struct stmpe_touch { u8 settling; u8 fraction_z; u8 i_drive; + u8 op_mod; struct { struct { u16 x; @@ -174,6 +178,7 @@ static irqreturn_t stmpe_ts_handler(int irq, void *data) { u8 data_set[4]; int x, y, z; + bool report_pressure = false; struct stmpe_touch *ts = data; /* @@ -191,18 +196,35 @@ static irqreturn_t stmpe_ts_handler(int irq, void *data) stmpe_set_bits(ts->stmpe, STMPE_REG_TSC_CTRL, STMPE_TSC_CTRL_TSC_EN, 0); - stmpe_block_read(ts->stmpe, STMPE_REG_TSC_DATA_XYZ, 4, data_set); - - x = (data_set[0] << 4) | (data_set[1] >> 4); - y = ((data_set[1] & 0xf) << 8) | data_set[2]; - z = data_set[3]; + switch (ts->op_mod) { + case OP_MOD_XYZ: + stmpe_block_read(ts->stmpe, + STMPE_REG_TSC_DATA_XYZ, 4, data_set); + x = (data_set[0] << 4) | (data_set[1] >> 4); + y = ((data_set[1] & 0xf) << 8) | data_set[2]; + z = data_set[3]; + report_pressure = true; + break; + case OP_MOD_XY: + stmpe_block_read(ts->stmpe, + STMPE_REG_TSC_DATA_X, 2, data_set); + x = (data_set[0] << 8) | (data_set[1]); + stmpe_block_read(ts->stmpe, + STMPE_REG_TSC_DATA_Y, 2, data_set); + y = (data_set[0] << 8) | (data_set[1]); + break; + default: + goto _skip_input_events; + } input_report_abs(ts->idev, ABS_X, x); input_report_abs(ts->idev, ABS_Y, y); - input_report_abs(ts->idev, ABS_PRESSURE, z); + if (report_pressure) + input_report_abs(ts->idev, ABS_PRESSURE, z); input_report_key(ts->idev, BTN_TOUCH, 1); input_sync(ts->idev); +_skip_input_events: /* flush the FIFO after we have read out our values. */ __stmpe_reset_fifo(ts->stmpe); @@ -219,7 +241,7 @@ static irqreturn_t stmpe_ts_handler(int irq, void *data) static int stmpe_init_hw(struct stmpe_touch *ts) { int ret; - u8 tsc_cfg, tsc_cfg_mask; + u8 tsc_cfg, tsc_cfg_mask, tsc_ctrl, tsc_ctrl_mask; struct stmpe *stmpe = ts->stmpe; struct device *dev = ts->dev; @@ -306,10 +328,13 @@ static int stmpe_init_hw(struct stmpe_touch *ts) return ret; } + tsc_ctrl = STMPE_OP_MODE(ts->op_mod); + tsc_ctrl_mask = STMPE_OP_MODE(0xff); + ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_CTRL, - STMPE_OP_MODE(0xff), STMPE_OP_MODE(OP_MOD_XYZ)); + tsc_ctrl_mask, tsc_ctrl); if (ret) { - dev_err(dev, "Could not set mode\n"); + dev_err(dev, "Could not set control registers\n"); return ret; } @@ -357,6 +382,8 @@ static void stmpe_ts_get_platform_info(struct platform_device *pdev, ts->stmpe->mod_12b = val; if (!of_property_read_u32(np, "st,ref-sel", &val)) ts->stmpe->ref_sel = val; + if (!of_property_read_u32(np, "st,op-mod", &val)) + ts->op_mod = val; if (!of_property_read_u32(np, "st,adc-freq", &val)) ts->stmpe->adc_freq = val; if (!of_property_read_u32(np, "st,ave-ctrl", &val)) From patchwork Mon May 27 16:19:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Middelschulte, Leif" X-Patchwork-Id: 10963395 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 46EBC76 for ; Mon, 27 May 2019 16:20:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37190282E8 for ; Mon, 27 May 2019 16:20:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2BC822842E; Mon, 27 May 2019 16:20:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64983282E8 for ; Mon, 27 May 2019 16:20:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726517AbfE0QUS (ORCPT ); Mon, 27 May 2019 12:20:18 -0400 Received: from ironport.klsmartin.com ([212.211.191.11]:28603 "EHLO ironport.klsmartin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725991AbfE0QUS (ORCPT ); Mon, 27 May 2019 12:20:18 -0400 X-IronPort-AV: E=Sophos;i="5.60,519,1549926000"; d="scan'208";a="1674795" Received: from unknown (HELO hera.klsmartin.com) ([172.30.5.66]) by ironport.klsmartin.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 27 May 2019 18:20:16 +0200 Received: from SUMMAIL01.UMK.KLS.zentral ([172.25.1.63]) by hera.klsmartin.com (8.14.3/8.13.1/SuSE Linux 0.7) with ESMTP id x4RGK9Uh003285; Mon, 27 May 2019 18:20:11 +0200 Received: from UML026.UMK.KLS.zentral (172.25.2.60) by SUMMAIL01.UMK.KLS.zentral (172.25.1.63) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 27 May 2019 18:20:11 +0200 From: Leif Middelschulte To: , CC: , , , Leif Middelschulte Subject: [PATCH 07/10] dt-bindings: input: touchscreen: stmpe: add axes inversion and swap Date: Mon, 27 May 2019 18:19:35 +0200 Message-ID: <20190527161938.31871-3-leif.middelschulte@klsmartin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190527161938.31871-1-leif.middelschulte@klsmartin.com> References: <20190527160736.30569-1-leif.middelschulte@klsmartin.com> <20190527161938.31871-1-leif.middelschulte@klsmartin.com> MIME-Version: 1.0 X-Originating-IP: [172.25.2.60] X-KSE-ServerInfo: SUMMAIL01.UMK.KLS.zentral, 9 X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 27.05.2019 13:23:00 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This driver too supports coordinate inversion on X,Y axes and axes swapping via the common properties defined in touchscreen.txt Signed-off-by: Leif Middelschulte --- Documentation/devicetree/bindings/input/touchscreen/stmpe.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt index aee1abf06ddb..09d2d4f288cc 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt @@ -42,6 +42,10 @@ Optional properties: The given window also affects the value range (limits) set within the input subsystem which, in turn, affects the input resolution calculation on both axes. +- touchscreen-inverted-x: X axis is inverted (boolean) +- touchscreen-inverted-y: Y axis is inverted (boolean) +- touchscreen-swapped-x-y: X and Y axis are swapped (boolean) + Swapping is done after inverting the axis - touchscreen-x-mm : horizontal length in mm of the touchscreen. It affects the input resolution calculation on the horizontal axis. - touchscreen-y-mm : vertical length in mm of the touchscreen. It affects From patchwork Mon May 27 16:19:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Middelschulte, Leif" X-Patchwork-Id: 10963391 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0F4081395 for ; Mon, 27 May 2019 16:20:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F391E281E1 for ; Mon, 27 May 2019 16:20:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E71982869F; Mon, 27 May 2019 16:20:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EF5828305 for ; Mon, 27 May 2019 16:20:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726645AbfE0QUU (ORCPT ); Mon, 27 May 2019 12:20:20 -0400 Received: from ironport.klsmartin.com ([212.211.191.11]:28603 "EHLO ironport.klsmartin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725991AbfE0QUU (ORCPT ); Mon, 27 May 2019 12:20:20 -0400 X-IronPort-AV: E=Sophos;i="5.60,519,1549926000"; d="scan'208";a="1674796" Received: from unknown (HELO hera.klsmartin.com) ([172.30.5.66]) by ironport.klsmartin.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 27 May 2019 18:20:19 +0200 Received: from SUMMAIL01.UMK.KLS.zentral ([172.25.1.63]) by hera.klsmartin.com (8.14.3/8.13.1/SuSE Linux 0.7) with ESMTP id x4RGKCFl003473; Mon, 27 May 2019 18:20:14 +0200 Received: from UML026.UMK.KLS.zentral (172.25.2.60) by SUMMAIL01.UMK.KLS.zentral (172.25.1.63) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 27 May 2019 18:20:14 +0200 From: Leif Middelschulte To: , CC: , , , Leif Middelschulte Subject: [PATCH 08/10] Input: stmpe-ts - axes inversion and swapping Date: Mon, 27 May 2019 18:19:36 +0200 Message-ID: <20190527161938.31871-4-leif.middelschulte@klsmartin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190527161938.31871-1-leif.middelschulte@klsmartin.com> References: <20190527160736.30569-1-leif.middelschulte@klsmartin.com> <20190527161938.31871-1-leif.middelschulte@klsmartin.com> MIME-Version: 1.0 X-Originating-IP: [172.25.2.60] X-KSE-ServerInfo: SUMMAIL01.UMK.KLS.zentral, 9 X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 27.05.2019 13:23:00 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This implements inversion and swapping of the reported X and Y input values, configurable via the corresponding devicetree properties binding. Signed-off-by: Leif Middelschulte --- drivers/input/touchscreen/stmpe-ts.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c index 152aac8b3ab7..1d114278e7e9 100644 --- a/drivers/input/touchscreen/stmpe-ts.c +++ b/drivers/input/touchscreen/stmpe-ts.c @@ -217,8 +217,12 @@ static irqreturn_t stmpe_ts_handler(int irq, void *data) goto _skip_input_events; } - input_report_abs(ts->idev, ABS_X, x); - input_report_abs(ts->idev, ABS_Y, y); + if (ts->props.invert_x) + x -= ts->min.x; + if (ts->props.invert_y) + y -= ts->min.y; + + touchscreen_report_pos(ts->idev, &ts->props, x, y, false); if (report_pressure) input_report_abs(ts->idev, ABS_PRESSURE, z); input_report_key(ts->idev, BTN_TOUCH, 1); From patchwork Mon May 27 16:19:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Middelschulte, Leif" X-Patchwork-Id: 10963393 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4CC741902 for ; Mon, 27 May 2019 16:20:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36B7B281E1 for ; Mon, 27 May 2019 16:20:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A93D28305; Mon, 27 May 2019 16:20:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B912B28385 for ; Mon, 27 May 2019 16:20:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726657AbfE0QUX (ORCPT ); Mon, 27 May 2019 12:20:23 -0400 Received: from ironport.klsmartin.com ([212.211.191.11]:28603 "EHLO ironport.klsmartin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725991AbfE0QUX (ORCPT ); Mon, 27 May 2019 12:20:23 -0400 X-IronPort-AV: E=Sophos;i="5.60,519,1549926000"; d="scan'208";a="1674797" Received: from unknown (HELO hera.klsmartin.com) ([172.30.5.66]) by ironport.klsmartin.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 27 May 2019 18:20:22 +0200 Received: from SUMMAIL01.UMK.KLS.zentral ([172.25.1.63]) by hera.klsmartin.com (8.14.3/8.13.1/SuSE Linux 0.7) with ESMTP id x4RGKFII003476; Mon, 27 May 2019 18:20:17 +0200 Received: from UML026.UMK.KLS.zentral (172.25.2.60) by SUMMAIL01.UMK.KLS.zentral (172.25.1.63) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 27 May 2019 18:20:17 +0200 From: Leif Middelschulte To: , CC: , , , Leif Middelschulte Subject: [PATCH 09/10] dt-bindings: input: touchscreen: stmpe: add tracking index Date: Mon, 27 May 2019 18:19:37 +0200 Message-ID: <20190527161938.31871-5-leif.middelschulte@klsmartin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190527161938.31871-1-leif.middelschulte@klsmartin.com> References: <20190527160736.30569-1-leif.middelschulte@klsmartin.com> <20190527161938.31871-1-leif.middelschulte@klsmartin.com> MIME-Version: 1.0 X-Originating-IP: [172.25.2.60] X-KSE-ServerInfo: SUMMAIL01.UMK.KLS.zentral, 9 X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 27.05.2019 13:23:00 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The tracking index is a "minimum" distance two touch points need to have in order for the second to be valid. This adds the corresponding binding property documentation. Signed-off-by: Leif Middelschulte --- .../bindings/input/touchscreen/stmpe.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt index 09d2d4f288cc..8696af35a7b8 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt @@ -42,6 +42,21 @@ Optional properties: The given window also affects the value range (limits) set within the input subsystem which, in turn, affects the input resolution calculation on both axes. +- st,tracking-index : Minimal distance between the current touch position and the previous + touch position. If the distance is shorter than the tracking + index, it is discarded. The tracking is calculated by summation + of the horizontal and vertical movement. + If pressure reporting is enabled (X/Y/Z), an increase in pressure + override the movement tracking and report the new data set, even + if X/Y is within the previous tracking index. + 0 -> disabled + 1 -> 4 + 4 -> 8 + 3 -> 16 + 4 -> 32 + 5 -> 64 + 6 -> 92 + 7 -> 127 - touchscreen-inverted-x: X axis is inverted (boolean) - touchscreen-inverted-y: Y axis is inverted (boolean) - touchscreen-swapped-x-y: X and Y axis are swapped (boolean) From patchwork Mon May 27 16:22:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Middelschulte, Leif" X-Patchwork-Id: 10963401 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CFC541395 for ; Mon, 27 May 2019 16:23:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEDF2287EF for ; Mon, 27 May 2019 16:23:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B34C728803; Mon, 27 May 2019 16:23:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56B86287F9 for ; Mon, 27 May 2019 16:23:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726435AbfE0QXJ (ORCPT ); Mon, 27 May 2019 12:23:09 -0400 Received: from ironport.klsmartin.com ([212.211.191.11]:18754 "EHLO ironport.klsmartin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725991AbfE0QXB (ORCPT ); Mon, 27 May 2019 12:23:01 -0400 X-IronPort-AV: E=Sophos;i="5.60,519,1549926000"; d="scan'208";a="1674811" Received: from unknown (HELO hera.klsmartin.com) ([172.30.5.66]) by ironport.klsmartin.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 27 May 2019 18:22:59 +0200 Received: from SUMMAIL01.UMK.KLS.zentral ([172.25.1.63]) by hera.klsmartin.com (8.14.3/8.13.1/SuSE Linux 0.7) with ESMTP id x4RGMpYO004696; Mon, 27 May 2019 18:22:53 +0200 Received: from UML026.UMK.KLS.zentral (172.25.2.60) by SUMMAIL01.UMK.KLS.zentral (172.25.1.63) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 27 May 2019 18:22:54 +0200 From: Leif Middelschulte To: , CC: , , , Leif Middelschulte Subject: [PATCH 10/10] Input: stmpe-ts - implement tracking index Date: Mon, 27 May 2019 18:22:25 +0200 Message-ID: <20190527162225.32136-1-leif.middelschulte@klsmartin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190527160736.30569-1-leif.middelschulte@klsmartin.com> References: <20190527160736.30569-1-leif.middelschulte@klsmartin.com> MIME-Version: 1.0 X-Originating-IP: [172.25.2.60] X-KSE-ServerInfo: SUMMAIL01.UMK.KLS.zentral, 9 X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 27.05.2019 13:23:00 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The tracking index specifies an minimum distance between two touchpoints so that the latter will be discarded, if the distance falls short of the configured value. Beware: When using the XYZ acquisition mode, an increase in pressure leads to a position report anyway. Signed-off-by: Leif Middelschulte --- drivers/input/touchscreen/stmpe-ts.c | 5 +++-- include/linux/mfd/stmpe.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c index 1d114278e7e9..ec1bbc19562e 100644 --- a/drivers/input/touchscreen/stmpe-ts.c +++ b/drivers/input/touchscreen/stmpe-ts.c @@ -91,6 +91,7 @@ struct stmpe_touch { u8 fraction_z; u8 i_drive; u8 op_mod; + u8 tracking_index; struct { struct { u16 x; @@ -332,8 +333,8 @@ static int stmpe_init_hw(struct stmpe_touch *ts) return ret; } - tsc_ctrl = STMPE_OP_MODE(ts->op_mod); - tsc_ctrl_mask = STMPE_OP_MODE(0xff); + tsc_ctrl = STMPE_TRACK(ts->tracking_index) | STMPE_OP_MODE(ts->op_mod); + tsc_ctrl_mask = STMPE_TRACK(0xff) | STMPE_OP_MODE(0xff); ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_CTRL, tsc_ctrl_mask, tsc_ctrl); diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h index 07f55aac9390..4e3217b0237a 100644 --- a/include/linux/mfd/stmpe.h +++ b/include/linux/mfd/stmpe.h @@ -16,6 +16,7 @@ #define STMPE_ADC_FREQ(x) (x & 0x3) #define STMPE_AVE_CTRL(x) ((x & 0x3) << 6) #define STMPE_DET_DELAY(x) ((x & 0x7) << 3) +#define STMPE_TRACK(x) ((x & 0x7) << 4) #define STMPE_SETTLING(x) (x & 0x7) #define STMPE_FRACTION_Z(x) (x & 0x7) #define STMPE_I_DRIVE(x) (x & 0x1)