From patchwork Thu Feb 10 09:48:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunus Bas X-Patchwork-Id: 541948 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE783C433F5 for ; Thu, 10 Feb 2022 09:48:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238985AbiBJJs4 (ORCPT ); Thu, 10 Feb 2022 04:48:56 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:36358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239018AbiBJJso (ORCPT ); Thu, 10 Feb 2022 04:48:44 -0500 Received: from mickerik.phytec.de (mickerik.phytec.de [195.145.39.210]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F0B31BC for ; Thu, 10 Feb 2022 01:48:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; d=phytec.de; s=a4; c=relaxed/simple; q=dns/txt; i=@phytec.de; t=1644486523; x=1647078523; h=From:Sender:Reply-To:Subject:Date:Message-Id:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=F7rkKagQJXYHpGW0Cswqt02zkInNBCau3cLLv2x4iGE=; b=qjDX5pwL2cUshiK9roLKnDxFhbBnPLxCDNF9sAVSPegmj0A3roW0f8J3dnqKhWwi iswrwqP+A8NoO/k7Qhkz69QgA2PXSwJ5NooURZSJGablqJD+WGOEkehc71kKHrk5 J3R8m041H8cZrjJUQnPtcBRlodXFaqxwg3skwYd1jeU=; X-AuditID: c39127d2-9112070000002a63-db-6204df7befae Received: from idefix.phytec.de (Unknown_Domain [172.16.0.10]) by mickerik.phytec.de (PHYTEC Mail Gateway) with SMTP id D7.36.10851.B7FD4026; Thu, 10 Feb 2022 10:48:43 +0100 (CET) Received: from augenblix2.phytec.de ([172.16.0.56]) by idefix.phytec.de (IBM Domino Release 9.0.1FP7) with ESMTP id 2022021010484333-259562 ; Thu, 10 Feb 2022 10:48:43 +0100 From: Yunus Bas To: dmitry.torokhov@gmail.com, yuehaibing@huawei.com, linux-input@vger.kernel.org Cc: u.kleine-koenig@pengutronix.de, linux-kernel@vger.kernel.org Subject: [PATCH RESEND v2] Input: tsc200x-core - Add axis inversion and swapping support Date: Thu, 10 Feb 2022 10:48:43 +0100 Message-Id: <20220210094843.1889881-1-y.bas@phytec.de> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on Idefix/Phytec(Release 9.0.1FP7|August 17, 2016) at 10.02.2022 10:48:43, Serialize by Router on Idefix/Phytec(Release 9.0.1FP7|August 17, 2016) at 10.02.2022 10:48:43 X-TNEFEvaluated: 1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOLMWRmVeSWpSXmKPExsWyRoCBS7f6PkuSwa6nGhaHF71gtLj56Rur xeVdc9gsbk+czGhx5+tzFgdWj52z7rJ7tBx5y+rR/9fA4/MmuQCWKC6blNSczLLUIn27BK6M E0/3sBWcE6548/4ZcwPjYYEuRk4OCQETibk79jN3MXJxCAlsZZTY8es6E4RznlFi467j7CBV bAKKEudvv2UFsUUEAiUO9vcA2RwczAIOEi195SBhYYEIiSMblzCC2CwCqhKH+neClfMKmEk8 O/WSCWKZvMTMS9/ZIeKCEidnPmEB2SUhcIVR4sDsj2wQRUISpxefZQaxmQW0JZYtfM08gZFv FpKeWUhSCxiZVjEK5WYmZ6cWZWbrFWRUlqQm66WkbmIEBt7hieqXdjD2zfE4xMjEwXiIUYKD WUmE91Q9c5IQb0piZVVqUX58UWlOavEhRmkOFiVx3vs9TIlCAumJJanZqakFqUUwWSYOTqkG Ri3vh1qzUxi4ntabSXOu8/ffNMGkRuREXs+Zb4VmDUkfJy6dEN2WZPHuSojcFUXla8Zv80z2 TnH/JX6LV/D7mdi3n0MiPqpM0/qxTffUhiDt9OJqIbUMPY5tj+KOzXE5tSIq8phTfIZ7ouq/ yTM7M39YVd1IvHuk7K1P+emj2Qce7CvaWbtrixJLcUaioRZzUXEiAMR0ATIqAgAA Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Since Commit ed7c9870c9bc ("Input: of_touchscreen - add support for inverted / swapped axes"), the of_touchscreen interface supports axis inverting and swapping through Devicetree properties. Make use of this feature. Signed-off-by: Yunus Bas --- Changes in v2: - Added additional properties to documentation --- .../devicetree/bindings/input/touchscreen/ti,tsc2005.yaml | 3 +++ drivers/input/touchscreen/tsc200x-core.c | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/input/touchscreen/ti,tsc2005.yaml b/Documentation/devicetree/bindings/input/touchscreen/ti,tsc2005.yaml index 938aab016cc2..166a254c8472 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/ti,tsc2005.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/ti,tsc2005.yaml @@ -54,6 +54,9 @@ properties: touchscreen-max-pressure: true touchscreen-size-x: true touchscreen-size-y: true + touchscreen-inverted-x: true + touchscreen-inverted-y: true + touchscreen-swapped-x-y: true allOf: - $ref: touchscreen.yaml# diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c index 27810f6c69f6..72c7258b93a5 100644 --- a/drivers/input/touchscreen/tsc200x-core.c +++ b/drivers/input/touchscreen/tsc200x-core.c @@ -88,6 +88,8 @@ struct tsc200x { int in_z1; int in_z2; + struct touchscreen_properties prop; + spinlock_t lock; struct timer_list penup_timer; @@ -113,8 +115,7 @@ static void tsc200x_update_pen_state(struct tsc200x *ts, int x, int y, int pressure) { if (pressure) { - input_report_abs(ts->idev, ABS_X, x); - input_report_abs(ts->idev, ABS_Y, y); + touchscreen_report_pos(ts->idev, &ts->prop, x, y, false); input_report_abs(ts->idev, ABS_PRESSURE, pressure); if (!ts->pen_down) { input_report_key(ts->idev, BTN_TOUCH, !!pressure); @@ -533,7 +534,7 @@ int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id, input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_12BIT, TSC200X_DEF_P_FUZZ, 0); - touchscreen_parse_properties(input_dev, false, NULL); + touchscreen_parse_properties(input_dev, false, &ts->prop); /* Ensure the touchscreen is off */ tsc200x_stop_scan(ts);