From patchwork Tue Sep 22 09:39:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Stefan_Riedm=C3=BCller?= X-Patchwork-Id: 11792013 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A0AA139F for ; Tue, 22 Sep 2020 09:54:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E92D32388B for ; Tue, 22 Sep 2020 09:54:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=temperror (0-bit key) header.d=phytec.de header.i=@phytec.de header.b="BiycNBTr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726513AbgIVJyW (ORCPT ); Tue, 22 Sep 2020 05:54:22 -0400 Received: from mickerik.phytec.de ([195.145.39.210]:47164 "EHLO mickerik.phytec.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726353AbgIVJyW (ORCPT ); Tue, 22 Sep 2020 05:54:22 -0400 X-Greylist: delayed 915 seconds by postgrey-1.27 at vger.kernel.org; Tue, 22 Sep 2020 05:54:21 EDT DKIM-Signature: v=1; a=rsa-sha256; d=phytec.de; s=a1; c=relaxed/simple; q=dns/txt; i=@phytec.de; t=1600767544; x=1603359544; 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=gBdQ4nNU4LkVwgCAoPqPWR+JZVeyyiWG4BrFHfAS0SQ=; b=BiycNBTrW1uKR/TUyxJXEkO1sKjodzuyxmEFOu/aGWNLOH5WAroQO7a73kPgbq1P HTEIhZfxN2GPQXRGuaUkU6J4GpARd832eZMCX5bS15rJXfWl4aPU4kwvrX8vGvCy HzZd4Qvyx/T7O+HyXq55I45OR94E33v3CPMSB7zBQRM=; X-AuditID: c39127d2-253ff70000001c25-d1-5f69c638ed81 Received: from idefix.phytec.de (Unknown_Domain [172.16.0.10]) by mickerik.phytec.de (PHYTEC Mail Gateway) with SMTP id AD.07.07205.836C96F5; Tue, 22 Sep 2020 11:39:04 +0200 (CEST) Received: from lws-riedmueller.phytec.de ([172.16.23.108]) by idefix.phytec.de (IBM Domino Release 9.0.1FP7) with ESMTP id 2020092211390466-474099 ; Tue, 22 Sep 2020 11:39:04 +0200 From: Stefan Riedmueller To: Dmitry Torokhov Cc: Lee Jones , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Stefan Riedmueller Subject: [PATCH] Input: stmpe: Add axis inversion and swapping capability Date: Tue, 22 Sep 2020 11:39:03 +0200 Message-Id: <20200922093903.157232-1-s.riedmueller@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 22.09.2020 11:39:04, Serialize by Router on Idefix/Phytec(Release 9.0.1FP7|August 17, 2016) at 22.09.2020 11:39:04 X-TNEFEvaluated: 1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOLMWRmVeSWpSXmKPExsWyRoCBS9fiWGa8wc2/+haHF71gtLj/9Sij xabH11gtbn76xmpxedccNgdWj52z7rJ73Lm2h81j85J6j8+b5AJYorhsUlJzMstSi/TtErgy jszYxl6wg7/i2OcW9gbGmbxdjBwcEgImEj3dPl2MXBxCAtsYJSa/XcYO4VxjlDjT/5epi5GT g03ASGLBtEYwW0RAX2L77F+MIEXMApsZJX60vWAGSQgLeEps/bKWFcRmEVCV+Nu3jw1kA6+A rcTWNhOQsISAvMTMS9/ZQWxeAUGJkzOfsIDMkRC4wijR/2AdI0SRkMTpxWfBZjILaEssW/ia eQIj3ywkPbOQpBYwMq1iFMrNTM5OLcrM1ivIqCxJTdZLSd3ECAy8wxPVL+1g7JvjcYiRiYPx EKMEB7OSCK+aUXq8EG9KYmVValF+fFFpTmrxIUZpDhYlcd4NvCVhQgLpiSWp2ampBalFMFkm Dk6pBsalK5of7D129nTXT37HC9mXFxrHZ9611ZZ5kp7t+ESI08zH75fQi0j5+VkXaza7aecf vXNXX2TJq7b3aR0qBVPqPa4tOKHSo8CZ6sgdbCrHdFgwMSNWVSFrNddL81LDzOtLVp8WZ5W/ /+rK+yQzxz2KvZoLi+7WN6+N3KkZsv9msGfalrtH/iqxFGckGmoxFxUnAgDQlXCtKgIAAA== Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Make use of generic touchscreen_properties structure to add axis inversion and swapping capabilities. It's configurable via devicetree properties: touchscreen-inverted-x touchscreen-inverted-y touchscreen-swapped-x-y Signed-off-by: Stefan Riedmueller --- drivers/input/touchscreen/stmpe-ts.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c index 7e16fcfe3b95..cd747725589b 100644 --- a/drivers/input/touchscreen/stmpe-ts.c +++ b/drivers/input/touchscreen/stmpe-ts.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -72,6 +73,7 @@ struct stmpe_touch { struct input_dev *idev; struct delayed_work work; struct device *dev; + struct touchscreen_properties prop; u8 ave_ctrl; u8 touch_det_delay; u8 settling; @@ -150,8 +152,7 @@ static irqreturn_t stmpe_ts_handler(int irq, void *data) y = ((data_set[1] & 0xf) << 8) | data_set[2]; z = data_set[3]; - 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, z); input_report_key(ts->idev, BTN_TOUCH, 1); input_sync(ts->idev); @@ -337,6 +338,8 @@ static int stmpe_input_probe(struct platform_device *pdev) input_set_abs_params(idev, ABS_Y, 0, XY_MASK, 0, 0); input_set_abs_params(idev, ABS_PRESSURE, 0x0, 0xff, 0, 0); + touchscreen_parse_properties(idev, false, &ts->prop); + error = input_register_device(idev); if (error) { dev_err(&pdev->dev, "Could not register input device\n");