From patchwork Wed Dec 20 08:39:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 181535 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2499206dyi; Wed, 20 Dec 2023 00:42:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IGTmzAEmigovE/xnuDxYkBGqjx3bMpQmXx3jxYlqZSFVoJ7unOiSZBr8/5HypW/AKPEIfx8 X-Received: by 2002:a05:6830:1499:b0:6d9:e7db:7b60 with SMTP id s25-20020a056830149900b006d9e7db7b60mr20409370otq.12.1703061729182; Wed, 20 Dec 2023 00:42:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1703061729; cv=pass; d=google.com; s=arc-20160816; b=Do45Gbg1ZJHuDjOKsN/OHKGisgZ5OSCWYBkQZCGk14jz7vatfnzymWSU5NunxyDUpp ibD/DASGpcjGtJsfUnO0Ar1hhKq+xR3tPiwIV/UFpmSiZPMKGwutNOwymVl9cT/r/i1+ VQiDMBAleTbfuRc8okbHqnOY0K7TT4NrpoZqGExim2/h3LrLTkbqN7RSmXntwCNK//K8 5GTGXwa/PAS35oddlZRvMhUOmdV1a46Qj8tu7ct0jh9yyuxRL6kTuSrta0BB7+jfFFHt zBFi/546c4Za9e+CdZiJxB/c3iII6gke1w46t7dRwtZpGuEtOGqW0UAscL7SV5Syiq3x I4Qg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence:cc :to:in-reply-to:references:message-id:content-transfer-encoding :subject:date:from:dkim-signature; bh=mNBswOFiXlpG2TbfJ2Ft81QtpZkhZ31M20XAdc8Qde8=; fh=Q2yKSKQ8R8KEx8rDZBLMysofwwLup8S/+bsFQ+KI0PY=; b=lsJwrFZOWY4SHQuZq6HbCTguTN6jpUnivmxZUVBwKi9OfGl2cEKQBStIttz5uoPtBD uJicOldQQ6fSa5mXRT7h9WDEwRsydkMTS9V1+0bRANTDtWCAYi2iIRkfJEjbMJBQBrui XcOChe7vJs+BR1bX0G1+edR7alzt1kY2oYkqfSiXZQWKR7rGwBEIQVLZQAj5cjkFnFrD 66J6Q5ZR4r8kSZv2/YtDjhomyL2oVnayFsJfcBKjz7/9KcxSYa9UmMXbXcKtpYGLJ/9d d80Y+2NlfBY6BKsVwkfTJXZV9jr0NaeJFjBBhcLs02OnMGdAxCnIIlVRbCAf2x059muI eTBA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=uXIUui8U; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel+bounces-6586-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6586-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id o13-20020a65614d000000b00565f0e9cfbbsi20960693pgv.382.2023.12.20.00.42.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 00:42:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6586-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=uXIUui8U; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel+bounces-6586-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6586-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 750A8B25912 for ; Wed, 20 Dec 2023 08:40:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 58D431DA56; Wed, 20 Dec 2023 08:39:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="uXIUui8U" X-Original-To: linux-kernel@vger.kernel.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2082.outbound.protection.outlook.com [40.107.6.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A43C1C686; Wed, 20 Dec 2023 08:39:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wolfvision.net ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UlyMsD+C1PmuVNRZ/iXIVi9NeTJNcujl0RQqSxMZFU6wItPrfjZN6ECi5IOoJs9kT5o7S7N3jdUnRfFUHdgjegD4x1Mr02ADuPgit6fiODKVc2viOWbMcLODaRRve6u4t3KHTw88eKxRDcHa+zLpEYB58Q8VrUSsDfFTEMFwkB50J7ulqst3iF7nLS7IKSQ8uZpvi6iqHFLLS7o0gQhcnxr5jZNdZI6y+hpn6rhM2o0nxjfSbg02k9npnjRxhpjtx0T6TFd9GmszHFuJm1CHrol9qTiNbNeCttvESj4XZHy1YGdnbQa/GYS0M7I3oSlHwpZl0gR19V3QrJBBS+NWNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mNBswOFiXlpG2TbfJ2Ft81QtpZkhZ31M20XAdc8Qde8=; b=NxmlFyTajD3q7IjBowTb/w9Or25krQnuIgiJMETdGs7N+XIOF0+Cp+sdexSjjNcE3XrFYGXVZLRTz0spG9IFadsorZ0zmmLFA2ST1JrOi5z4wkRx6Oxj54E4fRvlaez9SOFjJcj2jCkJX6aB0p5JRPz6pGqFbWu2SmxweIE1sifcKMo+yDjOUJqga5uiIP+WZU+WhEUiqN9JOokGbli+cKlVHOH9HA/JD89fyyVK4AVBSF1TwPfRR3w1BpHYreIrXRBDVArlo6ko8NMuBLyXX5cJKmCR+m41ofGf80ENiHhSro/zQZQV8b03BRGAkHWBN33JT9GDfDc/LrOkJOKhRQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mNBswOFiXlpG2TbfJ2Ft81QtpZkhZ31M20XAdc8Qde8=; b=uXIUui8UF8/0Ie7jFu/rpR0eCQ82ggqk+tbI9X3bXvTgscjmlpcIS9zIWxq2HSXcWnSgezKpGHG45T3nNX3brnDjO5+dnXqLJOw67j3rYeRG1O8Ydg1jtIzL+8gTw4Lo1wlvY8SBCtdvaoNQ4l4MYO7w0rJnraqaZGaGvHNx1Xg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) by PA4PR08MB6080.eurprd08.prod.outlook.com (2603:10a6:102:ec::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.18; Wed, 20 Dec 2023 08:39:50 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6b40:1e6f:7c94:71dc]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6b40:1e6f:7c94:71dc%4]) with mapi id 15.20.7091.034; Wed, 20 Dec 2023 08:39:50 +0000 From: Javier Carrasco Date: Wed, 20 Dec 2023 09:39:43 +0100 Subject: [PATCH v6 1/4] dt-bindings: touchscreen: add touch-overlay property Message-Id: <20230510-feature-ts_virtobj_patch-v6-1-d8a605975153@wolfvision.net> References: <20230510-feature-ts_virtobj_patch-v6-0-d8a605975153@wolfvision.net> In-Reply-To: <20230510-feature-ts_virtobj_patch-v6-0-d8a605975153@wolfvision.net> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Henrik Rydberg , Bastian Hecht , Michael Riesch Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703061588; l=7052; i=javier.carrasco@wolfvision.net; s=20230509; h=from:subject:message-id; bh=4T+y9c3JEc7F8j2inr9jIbj9OPr2/Ay085PHsKa7Kb0=; b=2KbDQvI5CQBqUY4sULSKuvQ9QltglZfZJ3899y8guJB5x9Ml5uG422mPZoGGWEARpx3SqIXA0 7Idn9/8tKR7Bi1jKHXmfgDGeqBcSra8oWkpvTJOFufttUHwS4G5ITAT X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-ClientProxiedBy: VI1PR0502CA0028.eurprd05.prod.outlook.com (2603:10a6:803:1::41) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|PA4PR08MB6080:EE_ X-MS-Office365-Filtering-Correlation-Id: 08daf1d0-0e49-4648-8c07-08dc01373ac4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Cki6PSJue6tHK9q90+pPaUMgK2vXdN8A7pYxDbF4UqN6TwWJhwRDfinyu1jT+nVUQxmN7+Em6WiUJTfHhY7pyQxLqZF1kVHAXFwPm3kXHplCVy0j4T0Fpo2WZO2/z7cbOkUPQLohw06d0HDiSWzBwUUJiQUda4UJQPt6XNKvdQBbMkGEEK3+T+FedXkWqDVw7CXKhMZU7RgeBWnDEToD4tGhOi0fdv9CTyXUYCV/0QXmDStPIUaUPXTK/ubDfghhd4To/GYn7f6yAF4+mkQkTiLs/n1IrCx93101t6SgSHqMU0OqWpG6Pb/bKB5G0T2gHbI7tsAWMnBW7slP1WOwLqKjPscNEjJbiXbBHfw4d8OU5zOyKTyFP7/exxH1DJwEcuYAPn4jXzKx+LjDgEQqvsM1cHBLxxKiMPfQIf96Q7A316h9BeCe2oE0m7jwUHTAhqLegkGzbTx+QRhULVFc08Ss8IybxdbvNvEIP+O5Dda/2jBPfegLuBdmz2b0gdLbC9U+tLwApuBM9xCVWU8y4rPW7LahKvrNYn66T7n7oDnv5GlzAX3Juwvc3S/XXmFjoYcaeV/aBipTKmaVXEad1m/4mDj+zt2GstUWB3N4OL5JfHcrhEQ5Q5hndhCPTUo7 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR08MB4974.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39850400004)(366004)(346002)(396003)(376002)(136003)(230922051799003)(186009)(64100799003)(1800799012)(451199024)(2616005)(86362001)(6666004)(6506007)(6512007)(52116002)(478600001)(26005)(107886003)(6636002)(316002)(66946007)(66556008)(66476007)(44832011)(6486002)(110136005)(38100700002)(36756003)(2906002)(4326008)(5660300002)(8936002)(8676002)(38350700005)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ozz3JBXchfLwcOc3xww82duAxP37?= =?utf-8?q?CzXhEJGUKslxVBw6YB+9dZ8yYT3RvELJC6s77WJRsGlP3epmwD7ss/Zo+ptcBzmOd?= =?utf-8?q?RuasJt7VqA9CWrGAb0mxll2RuPYek6Zv8GS+QkOfNKDlJ+z4sNhK/JxHYpLFV1RWM?= =?utf-8?q?7SC55vB4K25BAr4W87CExMoq1BWIjn5ffvaGKrfxLxLK6YA72YlxPTY2iozvhOtH/?= =?utf-8?q?qAAr3uFXikKzLwZrBIKHaCLCG/cP348Ru05pfWEgnByguqP5mTOt8Fupv6n+UCdZl?= =?utf-8?q?7T1+XKQvRBMZcrpj84TTZNB2dNJvrvpRTyrXEnhNDluPcaxgDHVp/jQEpOMKI/GfH?= =?utf-8?q?5BOsOchVdcERF63U33SDc1aILaNw81tJjrK0ohJ7FIo9+GvfWphQDDnblWEjATSJN?= =?utf-8?q?A1l1WHZSbLYuDK6386cbzR7PcMr3jk32KvHb22d+9GAceBuEDJof+SqngPNVA+Xnj?= =?utf-8?q?B6/qGPdni5Fm1FDRpMQpEP+MEAHA8I2Hww+1fHrsxlh6rs8QxftEpCTLw8q4rOjFR?= =?utf-8?q?2LkZ6eXHq0yPcU1tJkEvb65A21me7FZaKCfGzHHD/4cKyKJaZUgkid3WzulMf5+Fw?= =?utf-8?q?+Gu+8GuuC31UXqkkTzYfAWVO/fxABEL7nHJYLk1SvHCdcGLE6MEGywj9339abGpeg?= =?utf-8?q?3RkrpybE/aVTE7eGwV6e52O+uWEx/LySyeHOtDw6ZZ7Is33j7jfK7WUHtkUgq44SR?= =?utf-8?q?pPgzreWh0Bo/YfbKzhjDmKPRuJYdym1JHDxH8wa/YGdg9HsYxIeD9DP3sMzzcZaAh?= =?utf-8?q?2SM06uV6njAK+9ZqpZpa8FhbLKusajVRluDB9+xX1qvJh8qMMmy429as2/Kdjmm7B?= =?utf-8?q?u9YuYemtTQJIH9nhlo/9b233ZeFmAqbYo+2APNcla246VZsTdnvpCZWG4MwhJ0EFH?= =?utf-8?q?ZFt/cvsfoyaGudtrYGN4ho9g85s/uwJGFZAOjfw+uJQkYsF1DLZQFT2YQCUFsRsOA?= =?utf-8?q?QSES4pAYHhWWs92rsFhdH4Vqag/vV2LwxwU7EOmmMfPG3CxEiQxUmHyuMdb15+jFG?= =?utf-8?q?UhGDHAt1/9+pAukwNGKNTtE/2DFsAnA8Zm1rL7sSbhj1x+wguyYtzzVXKCrl2J5YI?= =?utf-8?q?QyLKQd/yf2QTZ2WSyxgz9vpXHtLVy0g0zDVJL/QAVpsPbKreb9P2J4YPedRq1XV71?= =?utf-8?q?K9ixj3W0JsTqSsnYJtkLJA8KPPXLtzh+XBpX/qHseons1619OZowAyTEQReEmQ50l?= =?utf-8?q?Nbp9/SERgaKZ6bZBmvxqtzdtkQuurR4f3PInFkq+RPk7r1t09GqjGJkrvDavOpvtI?= =?utf-8?q?DdCjicpfV08j+lxDFW3AD3ZH9ElEAgN6N4o0ZjiGT/QvEc/BIP6zkMt6QkuJXeCqL?= =?utf-8?q?84Kz+mx9iBvs4hedCxu9TK0tnPTutovoT5tRKGhGjiOFkoGmFKUpx3MYT/XWEkJ3t?= =?utf-8?q?vo/t9FrhnhRPruEMQKprxMP8Y4szCLBbgj35zqjjDuv9drbddx6X6N4zmWLAE8olE?= =?utf-8?q?WqCivfJ2a1thyxz+IE//ZoVb5rHRL7MOZGtU/0SbzeIZ+nNPgdCouJ8wdRw8UUF9X?= =?utf-8?q?MlXplFYOIjTla9rz1adamOpmQpxNIk8PZQtbp43CSTeQdYPFY880Jm8=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 08daf1d0-0e49-4648-8c07-08dc01373ac4 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2023 08:39:50.1877 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XqC+aiWp8HWvGTYOy1tu6fhmKJCWE3jSvJMKpwgwI9ero6Ht1J0V5URPWm+qFUwRJBXip9ObGrkeW4qFh83mhErhYQFzV8i5CqPH1w+SQOc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6080 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785789655767956240 X-GMAIL-MSGID: 1785789655767956240 The touch-overlay encompasses a number of touch areas that define a clipped touchscreen area and/or buttons with a specific functionality. A clipped touchscreen area avoids getting events from regions that are physically hidden by overlay frames. For touchscreens with printed overlay buttons, sub-nodes with a suitable key code can be defined to report key events instead of the original touch events. Signed-off-by: Javier Carrasco Reviewed-by: Jeff LaBundy Reviewed-by: Rob Herring --- .../bindings/input/touchscreen/touchscreen.yaml | 119 +++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml index 431c13335c40..d5ac90667bef 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml @@ -87,6 +87,125 @@ properties: touchscreen-y-plate-ohms: description: Resistance of the Y-plate in Ohms + touch-overlay: + description: list of nodes defining segments (touch areas) on the + touchscreen. + + This object can be used to describe a series of segments to + restrict the region within touch events are reported or buttons + with a specific functionality. + + This is of special interest if the touchscreen is shipped with a physical + overlay on top of it with a frame that hides some part of the original + touchscreen area. Printed buttons on that overlay are also a typical + use case. + + A new touchscreen area is defined as a sub-node without a key code. If a + key code is defined in the sub-node, it will be interpreted as a button. + + The x-origin and y-origin properties of a touchscreen area define the + offset of a new origin from where the touchscreen events are referenced. + This offset is applied to the events accordingly. The x-size and y-size + properties define the size of the touchscreen effective area. + + The following example shows a new touchscreen area with the new origin + (0',0') for the touch events generated by the device. + + Touchscreen (full area) + ┌────────────────────────────────────────┐ + │ ┌───────────────────────────────┐ │ + │ │ │ │ + │ ├ y-size │ │ + │ │ │ │ + │ │ touchscreen area │ │ + │ │ (no key code) │ │ + │ │ │ │ + │ │ x-size │ │ + │ ┌└──────────────┴────────────────┘ │ + │(0',0') │ + ┌└────────────────────────────────────────┘ + (0,0) + + where (0',0') = (0+x-origin,0+y-origin) + + Sub-nodes with key codes report the touch events on their surface as key + events instead. + + The following example shows a touchscreen with a single button on it. + + Touchscreen (full area) + ┌───────────────────────────────────┐ + │ │ + │ │ + │ ┌─────────┐ │ + │ │button 0 │ │ + │ │KEY_POWER│ │ + │ └─────────┘ │ + │ │ + │ │ + ┌└───────────────────────────────────┘ + (0,0) + + Segments defining buttons and clipped toushcreen areas can be combined + as shown in the following example. + In that case only the events within the touchscreen area are reported + as touch events. Events within the button areas report their associated + key code. Any events outside the defined areas are ignored. + + Touchscreen (full area) + ┌─────────┬──────────────────────────────┐ + │ │ │ + │ │ ┌───────────────────────┐ │ + │ button 0│ │ │ │ + │KEY_POWER│ │ │ │ + │ │ │ │ │ + ├─────────┤ │ touchscreen area │ │ + │ │ │ (no key code) │ │ + │ │ │ │ │ + │ button 1│ │ │ │ + │ KEY_INFO│ ┌└───────────────────────┘ │ + │ │(0',0') │ + ┌└─────────┴──────────────────────────────┘ + (0,0) + + type: object + + patternProperties: + '^segment-': + type: object + description: + Each segment is represented as a sub-node. + properties: + x-origin: + description: horizontal origin of the node area + $ref: /schemas/types.yaml#/definitions/uint32 + + y-origin: + description: vertical origin of the node area + $ref: /schemas/types.yaml#/definitions/uint32 + + x-size: + description: horizontal resolution of the node area + $ref: /schemas/types.yaml#/definitions/uint32 + + y-size: + description: vertical resolution of the node area + $ref: /schemas/types.yaml#/definitions/uint32 + + label: + $ref: /schemas/types.yaml#/definitions/string + description: descriptive name of the button + + linux,code: true + + required: + - x-origin + - y-origin + - x-size + - y-size + + unevaluatedProperties: false + dependencies: touchscreen-size-x: [ touchscreen-size-y ] touchscreen-size-y: [ touchscreen-size-x ] From patchwork Wed Dec 20 08:39:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 181532 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2498822dyi; Wed, 20 Dec 2023 00:41:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IFCUVTD/f5YevJr5jcuFU7lvfBg3V154PP7wlZcS3FV/7m4NVXbev5upoYfPO5WzMvEGEh5 X-Received: by 2002:a50:bb2e:0:b0:54c:6ac6:21f9 with SMTP id y43-20020a50bb2e000000b0054c6ac621f9mr6354047ede.71.1703061668836; Wed, 20 Dec 2023 00:41:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1703061668; cv=pass; d=google.com; s=arc-20160816; b=RwzFU70hNwQIrYpz5z+/u4fCcKLIuK/TJzLdhz8H0dUNRzafhxYAHI7+5w/kwB/LU+ TP3bxaR3EMFwnhm1c/KWPENhUlQOe1IChYq4Tn/O1yhQEdSewUM1Bdk3T7GSucrmjddU VwtOFBLW+BowAq9XQ0N0XciuOZ8ygsGAQUprue7MqJpDkHf6el8EkSwV2oYNrsobsd4r RJuVyUnEOIM9DJGKWYVxPbcKsTIldSEYy3XYSuM9Ru8LZKwbABEPVjRkckpXBOMYPyFk zABwN15VUbhJcwIXO9Oq4tSsAOYWeqxHgcMjVRZBA9Mi5oKq5DMwrGwK6kaH95HQZld5 91QQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence:cc :to:in-reply-to:references:message-id:content-transfer-encoding :subject:date:from:dkim-signature; bh=AD7ZJu/VWFDfV/tF/+vLXNLqckjUgjKidYG16Xk97Cw=; fh=Q2yKSKQ8R8KEx8rDZBLMysofwwLup8S/+bsFQ+KI0PY=; b=hkAbIZIRgLLWTJIPOVgNPqsyE+N5vyU11/ldNkh3JliiIIEIhpGkBVARVvUJ/fBYlg MLcA9qiPN6VzC/Ar1czqcmI0dLw0S3K0Vhr1V1yFEJdpeCZb2pO41cNaBuerUu3ueRqa YYvXeVFMnh1tGRskV6bOYJilsCWJXQ0uRUTKtvAgj1pkG8+YSge0EFXRdlAh8hb6Ps5C cw+mn9hugZuNjFgEQLA3xOczEE25pihYLc5pxCPXeReZAi+ITyDU8hX1jhtMH6GmdSEE tWwQv/IS4za4mumvU4NwU1eGPyIdMvgtH40A1h8EZ5tfn5NyY623YeKG3yS8LRdJ2YXJ lLGQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=Np0BcqUQ; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel+bounces-6587-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6587-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i6-20020a05640242c600b0054ccccf17fcsi11573784edc.382.2023.12.20.00.41.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 00:41:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6587-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=Np0BcqUQ; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel+bounces-6587-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6587-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4C3151F223A0 for ; Wed, 20 Dec 2023 08:41:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C5DD200BE; Wed, 20 Dec 2023 08:40:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="Np0BcqUQ" X-Original-To: linux-kernel@vger.kernel.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2082.outbound.protection.outlook.com [40.107.6.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E61161CF91; Wed, 20 Dec 2023 08:39:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wolfvision.net ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m26vLmmjO7Huo3uAiNz/nLpvybyV1nf+fbf8cfJI1DllQItdT1MgfvEgjBCAu8h73HAz1rhCpFE6E3gKMH7M2xbvlQlHNivT4wWJyv4Vb3yt8227rI/yJD9g3irmO1AugWXlru5wCUm4XKbRHEsp3oXeL4Pz+/2s/rwhWl81/2ZJ1iqEPe7eacN+0iB9onUL+rob1nLnaYecUWOzvk78/4pmvrXA5ejxLuOlAQpm9+VPjofZhkHMd526Or8C6isRI4R2cCoi7taw8yeJY+otR6+6TlnA/FmoGszpijWYGltkSnScIC3A6rBPsOl3pjZvlYmx684anxBImPJGoM7/ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AD7ZJu/VWFDfV/tF/+vLXNLqckjUgjKidYG16Xk97Cw=; b=KeOlONwDzrXG+/N2ctsqYqFLnR957peWugxqenAxK3fpS0Czfmk4ZpF3q+KRrGZi386J4277i6DiHorn2b5bp68rICvb6sUQZ7YKKpKmfJz7xRyFu0SSovcw5aCyDoKq9Tbnc5YWWrg+akvyWgFlzJqwZxN99r7IiSwFhovin3lglqwWm4ujqes+zVB5phA4XMwXNx8sBZZPFKQJBjC7mhmDCyznskHQsM5NcuJH78u2w+neX2UHVDAzBil1q7462FO5pr7onUOZF4F5AbCyLy7gc5IVaBBg0Yd4Wk8mwied0SbrdC2Ught1Y+vTpq83TyO46MfSxCmkoo1C4GeYfQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AD7ZJu/VWFDfV/tF/+vLXNLqckjUgjKidYG16Xk97Cw=; b=Np0BcqUQd/iIikalLH9p4JB44tSqXci9/Oac5jvg2TmyN507dA/5g3alCSYItZlrqg3WRQjKfvAQAsiE1FDmbv0QaYgSlzG0Eq7tL57bo10bCflOUDGfYeDtdrDiVBwmthZ/xAt1e6s4Op2aosvUOCdT4uwHbKVGWtj/mWeF5yQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) by PA4PR08MB6080.eurprd08.prod.outlook.com (2603:10a6:102:ec::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.18; Wed, 20 Dec 2023 08:39:51 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6b40:1e6f:7c94:71dc]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6b40:1e6f:7c94:71dc%4]) with mapi id 15.20.7091.034; Wed, 20 Dec 2023 08:39:51 +0000 From: Javier Carrasco Date: Wed, 20 Dec 2023 09:39:44 +0100 Subject: [PATCH v6 2/4] Input: touch-overlay - Add touchscreen overlay handling Message-Id: <20230510-feature-ts_virtobj_patch-v6-2-d8a605975153@wolfvision.net> References: <20230510-feature-ts_virtobj_patch-v6-0-d8a605975153@wolfvision.net> In-Reply-To: <20230510-feature-ts_virtobj_patch-v6-0-d8a605975153@wolfvision.net> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Henrik Rydberg , Bastian Hecht , Michael Riesch Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703061588; l=11458; i=javier.carrasco@wolfvision.net; s=20230509; h=from:subject:message-id; bh=tI6v2r0jXUhusYFinMuYKLp27r+Or+RfBkCl79XERDI=; b=J+27Au8m2ZoUTNwpg/0fM7Bivw8AJPhjRbptAiVdquHjR2GLyHqmnFlceIEef+HDClOJD/I0c XLtsfSWsfHXB+vwA47AsJbhG8YRZgfAUS4ex9q2//ClUcal7xq6pvDd X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-ClientProxiedBy: VI1PR0502CA0028.eurprd05.prod.outlook.com (2603:10a6:803:1::41) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|PA4PR08MB6080:EE_ X-MS-Office365-Filtering-Correlation-Id: fd689b33-04d3-4459-847c-08dc01373b5f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /nZQgTMfqmST01cKjlswdW5Pr4pHFvGg7zJ+0Ooek+uiAKRjkS2H2fmf9Mwr79W9COYRVRhc8ijdinnmUUIgZYIgjAJEuFKkpUKmik5uy6sPcDzaMwX7yoOsy2O0qDB44sVr4o/VbYe1Q7ejI5Jdc+r8mHM7k+SVOWgk2EcryheSfphx56J8lVa4QEEhF0MHLrNlrs6DDrNSRfDz3H+2sUPIeUBnnmNfh03PR+EiPGGZYixwWZHYFVZOISdqluCXp9NpZUE7HvE3KqQ4OQo4SDJFpSADKLNS7dgRspqRuF76S90m8sj4Q84178aXMR9+ycUuH0gkgIT2hOyrcSyTDDDMb5zOI4DB8xWtjLUGzKrVE343uHpROYU1+WoSXufemUMKrmPLRihxEXaLS4XWygQzc5x/oqn4Zbx3asH7clugNkCSxt4qlVVEbqry+nlcmGQ1bf2F0sSRcwnfZ8lONlxH5Ciu5dyX74alznUDz8J/7xFdZ68XwDQmpd2tfSuZt7TYT2JTtCe9xJ+giaI9dSkjWlv7PpxwkdpN3S8jIqcfTZMXkP/oMWL12kRMtfD3TrmTytreyZ7ZcOME9BW3itIAJE9FnFZ53ccaljda/XxvsSlYCRAblV8VArOh33Ez X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR08MB4974.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39850400004)(366004)(346002)(396003)(376002)(136003)(230922051799003)(186009)(64100799003)(1800799012)(451199024)(2616005)(86362001)(6666004)(6506007)(6512007)(52116002)(478600001)(26005)(107886003)(6636002)(316002)(66946007)(66556008)(66476007)(44832011)(6486002)(110136005)(83380400001)(38100700002)(36756003)(2906002)(4326008)(30864003)(5660300002)(8936002)(8676002)(38350700005)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Lm/LroWNDsfnq6gGMdOYtL7MP+g6?= =?utf-8?q?ILt0B4vOdcSwXmv8ogNv/vVK2/RCL7QW5i4MjMPASpWJSLuI1Vka9IuWHQI11c/uZ?= =?utf-8?q?6kQDurm+JB2FwA1/VW4yeOJ0cuKcB1as8uOLxIL02lOgF1lC0KWSQy2zlaPRUP9QJ?= =?utf-8?q?SlZftlOyx/mfj6KdGOjrtdtUYJA6FqMZ/z/fbcRMsAedpWlWyATR4smvZu8UPhtMT?= =?utf-8?q?N+LR/mNA9/e4RYFSKlE2Svoyonj6KkwXQjoI8NVtKX8qwth5zxXBcSEiEDACoVsIl?= =?utf-8?q?VSeq1Gjay//OmiHDSKK1yJvTSSzmm0vu/VWleW8yzMHj7e0YKr45sM8Q40AjUiyMn?= =?utf-8?q?ckYyAnRtBTysNCvGj8fo9CErRHRrBvCc0ssO1b09mTrPwCOdbFN9xVDK2WEsdsA1I?= =?utf-8?q?RCd9T5kJvFEGA8TqmOCKXhceg/WJIvezlXewSD77djZkJvnFaad91Maqvk5YGDtAG?= =?utf-8?q?AVtrSAfwBz8P7Kei7G3oG15wHtNqnqcM+0PccJNeYwNqgVhnBDo2VBj5ZQnV+N2G0?= =?utf-8?q?3ZaM+1xcj6CX5x/qmTtsGQKB1gTVdUKUpUMVgf3k/xSYPk3f80f6JK65nZBhWXjvY?= =?utf-8?q?JJPsQJTtm3VxdPl7PsOVv0aIIXwElZ89hk8oaj4f4Qar6zCv6E21vSx3R74Dvr5EN?= =?utf-8?q?8hIlJvRjLzuAN4FhkttguX7iILAumj1q0QYUfaPNY3GbDRTeuN6SpfHqBVMZj4RQU?= =?utf-8?q?ZIe3frguY/vO7BHUO48BD1Cw3f4O6N8KoJnQAHoyxD4yvUSozq+/3Z0PIQnw/OBvl?= =?utf-8?q?ZKYUHWc7wcCUl3dA3B90th7j5jZ1+JoWzFUzrbLfqGRHWquRN1U5sdJu2Ktc/pLhM?= =?utf-8?q?94G8wFQ2RDEevlbg2fRWnjjlSR6ILNSsqCjLQT6MnFbaVd3jWM9izZi0IpZHtJuIg?= =?utf-8?q?9jXh72tKcu4cRsdmSSOKJBPSuHg3TA8tq91uy8qVz46OweUKQhQw4Y7SUT84j9xDL?= =?utf-8?q?aRlNf9Dg8apoT+JE8defImZ0z/imVmKUR9qRFQMv51rgvx4JuC/tiprggpfcx9Ifc?= =?utf-8?q?J0mr1depDbqr89JuflwbEoO73wsbMAgcq5eLBOXUOVScIvk3zOk0scXhdacTaO9Uo?= =?utf-8?q?xVfSJaLdlU4WFvhNober7xN/aJYLpbyBKpUBI4a7dA0L/voLcZb45fthi6GKGGirV?= =?utf-8?q?Aul9itbFruoWzUFjcL6E8f2yPEvGM5gN/I1T5FxqDO+nmNjePcQN04KdLkdGSlatn?= =?utf-8?q?D3piG1c41xvFukUI1Q7mbhbag7kfkapWmEIri18TvFePIjmmTUtMWcodYTXvGZBJs?= =?utf-8?q?/+PABXqsHWxCK+eZF5l33TxmLkY0c3jNvq63Z6rGW0b1CrOxwI9+i8zkni9S0lCzR?= =?utf-8?q?+baaAPWanXZCOl9l/8Pm93aTlIoSVfW3fAdyjzwsHC57Ukl8gIPn4sbi3OeaxvWhK?= =?utf-8?q?dr5vPW2UliCOa6c1eJoST7ixPCUWDeL/T2RWGNUEqn7iQWs1lcRhpgaO9s4/M7ZJc?= =?utf-8?q?qzS6gF1xhvG4rVujoGLjNxiSlcyQOL3rcMyRodKZwArA/ZSgL9DOiqVHk0zLQ9Pqb?= =?utf-8?q?NHtG2CoYPmfcAKuE4rR2Waun3uhwM/e7uvg/a/aLE7VlLx+0OGNMJ4g=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: fd689b33-04d3-4459-847c-08dc01373b5f X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2023 08:39:51.2160 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kx+lg9u1+2eRDjPqb3fh/Q7J6dgfaATuIMABNzH8AeP6PsV4E86sUtKD3mMXaJursPtipvwZsVJb2QtrKZdPtA6YHJPEyA+MhwZ7Y8MJZjs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6080 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785789591991201125 X-GMAIL-MSGID: 1785789591991201125 Some touch devices provide mechanical overlays with different objects like buttons or clipped touchscreen surfaces. In order to support these objects, add a series of helper functions to the input subsystem to transform them into overlay objects via device tree nodes. These overlay objects consume the raw touch events and report the expected input events depending on the object properties. Note that the current implementation allows for multiple definitions of touchscreen areas (regions that report touch events), but only the first one will be used for the touchscreen device that the consumers typically provide. Should the need for multiple touchscreen areas arise, additional touchscreen devices would be required at the consumer side. There is no limitation in the number of touch areas defined as buttons. Signed-off-by: Javier Carrasco --- MAINTAINERS | 7 + drivers/input/Makefile | 2 +- drivers/input/touch-overlay.c | 283 ++++++++++++++++++++++++++++++++++++ include/linux/input/touch-overlay.h | 24 +++ 4 files changed, 315 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 97f51d5ec1cf..3218d8694735 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -22031,6 +22031,13 @@ L: platform-driver-x86@vger.kernel.org S: Maintained F: drivers/platform/x86/toshiba-wmi.c +TOUCH OVERLAY +M: Javier Carrasco +L: linux-input@vger.kernel.org +S: Maintained +F: drivers/input/touch-overlay.c +F: include/linux/input/touch-overlay.h + TPM DEVICE DRIVER M: Peter Huewe M: Jarkko Sakkinen diff --git a/drivers/input/Makefile b/drivers/input/Makefile index c78753274921..393e9f4d00dc 100644 --- a/drivers/input/Makefile +++ b/drivers/input/Makefile @@ -7,7 +7,7 @@ obj-$(CONFIG_INPUT) += input-core.o input-core-y := input.o input-compat.o input-mt.o input-poller.o ff-core.o -input-core-y += touchscreen.o +input-core-y += touchscreen.o touch-overlay.o obj-$(CONFIG_INPUT_FF_MEMLESS) += ff-memless.o obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o diff --git a/drivers/input/touch-overlay.c b/drivers/input/touch-overlay.c new file mode 100644 index 000000000000..0a0646ceb755 --- /dev/null +++ b/drivers/input/touch-overlay.c @@ -0,0 +1,283 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Helper functions for overlay objects on touchscreens + * + * Copyright (c) 2023 Javier Carrasco + */ + +#include +#include +#include +#include +#include +#include + +struct button { + u32 key; + bool pressed; + int slot; +}; + +struct touch_overlay_segment { + struct list_head list; + u32 x_origin; + u32 y_origin; + u32 x_size; + u32 y_size; + struct button *btn; +}; + +static int touch_overlay_get_segment(struct fwnode_handle *segment_node, + struct touch_overlay_segment *segment, + struct input_dev *keypad, + struct device *dev) +{ + int error; + + error = fwnode_property_read_u32(segment_node, "x-origin", + &segment->x_origin); + if (error) + return error; + + error = fwnode_property_read_u32(segment_node, "y-origin", + &segment->y_origin); + if (error) + return error; + + error = fwnode_property_read_u32(segment_node, "x-size", + &segment->x_size); + if (error) + return error; + + error = fwnode_property_read_u32(segment_node, "y-size", + &segment->y_size); + if (error) + return error; + + if (fwnode_property_present(segment_node, "linux,code")) { + segment->btn = devm_kzalloc(dev, sizeof(*segment->btn), + GFP_KERNEL); + if (!segment->btn) + return -ENOMEM; + + error = fwnode_property_read_u32(segment_node, "linux,code", + &segment->btn->key); + if (error) + return error; + + input_set_capability(keypad, EV_KEY, segment->btn->key); + } + + return 0; +} + +/** + * touch_overlay_map - map overlay objects from the device tree and set + * key capabilities if buttons are defined. + * @list: pointer to the list that will hold the segments + * @keypad: pointer to the already allocated input_dev + * + * Returns 0 on success and error number otherwise. + * + * If a keypad input device is provided and overlay buttons are defined, + * its button capabilities are set accordingly. + */ +int touch_overlay_map(struct list_head *list, struct input_dev *keypad) +{ + struct fwnode_handle *overlay, *fw_segment; + struct device *dev = keypad->dev.parent; + struct touch_overlay_segment *segment; + int error; + + overlay = device_get_named_child_node(dev, "touch-overlay"); + if (!overlay) + return 0; + + fwnode_for_each_child_node(overlay, fw_segment) { + segment = devm_kzalloc(dev, sizeof(*segment), GFP_KERNEL); + if (!segment) { + error = -ENOMEM; + goto put_overlay; + } + error = touch_overlay_get_segment(fw_segment, segment, keypad, + dev); + if (error) + goto put_overlay; + + list_add_tail(&segment->list, list); + } + +put_overlay: + fwnode_handle_put(overlay); + return error; +} +EXPORT_SYMBOL(touch_overlay_map); + +/** + * touch_overlay_get_touchscreen_abs - get abs size from the touchscreen area. + * @list: pointer to the list that holds the segments + * @x: horizontal abs + * @y: vertical abs + */ +void touch_overlay_get_touchscreen_abs(struct list_head *list, u16 *x, u16 *y) +{ + struct touch_overlay_segment *segment; + struct list_head *ptr; + + list_for_each(ptr, list) { + segment = list_entry(ptr, struct touch_overlay_segment, list); + if (!segment->btn) { + *x = segment->x_size - 1; + *y = segment->y_size - 1; + break; + } + } +} +EXPORT_SYMBOL(touch_overlay_get_touchscreen_abs); + +static bool touch_overlay_segment_event(struct touch_overlay_segment *seg, + u32 x, u32 y) +{ + if (!seg) + return false; + + if (x >= seg->x_origin && x < (seg->x_origin + seg->x_size) && + y >= seg->y_origin && y < (seg->y_origin + seg->y_size)) + return true; + + return false; +} + +/** + * touch_overlay_mapped_touchscreen - check if a touchscreen area is mapped + * @list: pointer to the list that holds the segments + * + * Returns true if a touchscreen area is mapped or false otherwise. + */ +bool touch_overlay_mapped_touchscreen(struct list_head *list) +{ + struct touch_overlay_segment *segment; + struct list_head *ptr; + + list_for_each(ptr, list) { + segment = list_entry(ptr, struct touch_overlay_segment, list); + if (!segment->btn) + return true; + } + + return false; +} +EXPORT_SYMBOL(touch_overlay_mapped_touchscreen); + +/** + * touch_overlay_mapped_buttons - check if overlay buttons are mapped + * @list: pointer to the list that holds the segments + * + * Returns true if overlay buttons mapped or false otherwise. + */ +bool touch_overlay_mapped_buttons(struct list_head *list) +{ + struct touch_overlay_segment *segment; + struct list_head *ptr; + + list_for_each(ptr, list) { + segment = list_entry(ptr, struct touch_overlay_segment, list); + if (segment->btn) + return true; + } + + return false; +} +EXPORT_SYMBOL(touch_overlay_mapped_buttons); + +static bool touch_overlay_mt_on_touchscreen(struct list_head *list, + u32 *x, u32 *y) +{ + struct touch_overlay_segment *segment; + bool contact = x && y; + struct list_head *ptr; + + /* Let the caller handle events with no coordinates (release) */ + if (!contact) + return false; + + list_for_each(ptr, list) { + segment = list_entry(ptr, struct touch_overlay_segment, list); + if (!segment->btn && + touch_overlay_segment_event(segment, *x, *y)) { + *x -= segment->x_origin; + *y -= segment->y_origin; + return true; + } + } + + return false; +} + +static bool touch_overlay_button_event(struct input_dev *input, + struct touch_overlay_segment *segment, + const u32 *x, const u32 *y, u32 slot) +{ + bool contact = x && y; + + if (!contact && segment->btn->pressed && segment->btn->slot == slot) { + segment->btn->pressed = false; + input_report_key(input, segment->btn->key, false); + input_sync(input); + return true; + } else if (contact && touch_overlay_segment_event(segment, *x, *y)) { + segment->btn->pressed = true; + segment->btn->slot = slot; + input_report_key(input, segment->btn->key, true); + input_sync(input); + return true; + } + + return false; +} + +/** + * touch_overlay_process_event - process input events according to the overlay + * mapping. This function acts as a filter to release the calling driver from + * the events that are either related to overlay buttons or out of the overlay + * touchscreen area if defined. + * @list: pointer to the list that holds the segments + * @input: pointer to the input device associated to the event + * @x: pointer to the x coordinate (NULL if not available - no contact) + * @y: pointer to the y coordinate (NULL if not available - no contact) + * @slot: slot associated to the event + * + * Returns true if the event was processed (reported for valid key events + * and dropped for events outside the overlay touchscreen area) or false + * if the event must be processed by the caller. In that case this function + * shifts the (x,y) coordinates to the overlay touchscreen axis if required. + */ +bool touch_overlay_process_event(struct list_head *list, + struct input_dev *input, + u32 *x, u32 *y, u32 slot) +{ + struct touch_overlay_segment *segment; + struct list_head *ptr; + + /* + * buttons must be prioritized over overlay touchscreens to account for + * overlappings e.g. a button inside the touchscreen area. + */ + list_for_each(ptr, list) { + segment = list_entry(ptr, struct touch_overlay_segment, list); + if (segment->btn && + touch_overlay_button_event(input, segment, x, y, slot)) { + return true; + } + } + + /* + * valid touch events on the overlay touchscreen are left for the client + * to be processed/reported according to its (possibly) unique features. + */ + return !touch_overlay_mt_on_touchscreen(list, x, y); +} +EXPORT_SYMBOL(touch_overlay_process_event); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Helper functions for overlay objects on touch devices"); diff --git a/include/linux/input/touch-overlay.h b/include/linux/input/touch-overlay.h new file mode 100644 index 000000000000..df974eb46dd4 --- /dev/null +++ b/include/linux/input/touch-overlay.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2023 Javier Carrasco + */ + +#ifndef _TOUCH_OVERLAY +#define _TOUCH_OVERLAY + +#include + +struct input_dev; + +int touch_overlay_map(struct list_head *list, struct input_dev *keypad); + +void touch_overlay_get_touchscreen_abs(struct list_head *list, u16 *x, u16 *y); + +bool touch_overlay_mapped_touchscreen(struct list_head *list); + +bool touch_overlay_mapped_buttons(struct list_head *list); + +bool touch_overlay_process_event(struct list_head *list, struct input_dev *input, + u32 *x, u32 *y, u32 slot); + +#endif From patchwork Wed Dec 20 08:39:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 181536 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2499732dyi; Wed, 20 Dec 2023 00:43:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IGctx1CzcIESpbVWx8AgG9HyvQsdxGhphnCD7rfKNfaLR4/ROLt8NfruM/5tnnlhs3hX7I/ X-Received: by 2002:a05:6358:882a:b0:170:17eb:b57 with SMTP id hv42-20020a056358882a00b0017017eb0b57mr19809111rwb.65.1703061809627; Wed, 20 Dec 2023 00:43:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1703061809; cv=pass; d=google.com; s=arc-20160816; b=KgXKmB9W37XjYxrlfHCUfnIxbFbBv+n5MZ0fNPV2YHxr30qOL2/8zICuEnqZX6/waR f6K0QCBaOXcSw2QcTkluZO1jahBK6G4VHuiscVd/EYrd5zc9cvjaj8EKzmH5L5EaLmuN Wx8kJv/4mFkKh55/5fA+HpI0/DI/3DY4A46bOmxOpLNY8QVmGigaguXys+iw4qhNLAtb QqGahG4Tr+E983pWdzby1325l9RIinKc+ARYHDbGspy9F1sFRKk+jNUelJiK+kosz9Yo BGw2xB+D5W9G0mLF4w1Wmmxmo+DkGYYXK4zXifG0P83FVfY2NxsmI29Rz9xpzQvOlWCZ 7udA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence:cc :to:in-reply-to:references:message-id:content-transfer-encoding :subject:date:from:dkim-signature; bh=YhIWW4/rDnj+F3sOuf67Df7bs4EBw1L8/azwrFPGv9E=; fh=Q2yKSKQ8R8KEx8rDZBLMysofwwLup8S/+bsFQ+KI0PY=; b=zr1wqZD4aw00QdrYv+5HyLf4KMjlyFUJTJy28c3PotjZWURTSNAJ77Y3uz7tDXYDnk g0xAZTwNIPXQ8Zmwpu3iAlEYXj5Jmj4tGOqVeaM3xWZlyY1BHMXkILh8v/Q90R1sZBwu cIGPOVYL+Tz/UiB9B8/SP1FAyGLdowoL134v/RNMCTaUqhzJBSnCMYIwaha5SZepIU5B GhpGQpJFwg6jp1cLH/wzIO3dIilM1Xxol3Y/Rc7B+ltm+5EFSkReYT6GmBBB7FpE4vVv CtggrKEgJ0pkD97mfyjEQGUufNFuMch64IUC5aM52KA+PITq4CYvq8+md7v2oVeWCONe 3new== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b="gV7/VU15"; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel+bounces-6589-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6589-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id f20-20020a631014000000b005c68d9545b9si20699907pgl.619.2023.12.20.00.43.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 00:43:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6589-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b="gV7/VU15"; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel+bounces-6589-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6589-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4E4AAB26276 for ; Wed, 20 Dec 2023 08:41:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A9D0208A3; Wed, 20 Dec 2023 08:40:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="gV7/VU15" X-Original-To: linux-kernel@vger.kernel.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2082.outbound.protection.outlook.com [40.107.6.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F10B11DA31; Wed, 20 Dec 2023 08:39:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wolfvision.net ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WwawyAnUYzuolo3qtickjZrF7SgH00XBOVTbQgJevDvzRaTuRF8j4TDeF/TyMWp4pC99sTKGBbZ1h3i27ZAMpOQaSt/SCi8vESqKWrCQLKYgLawOAurK0DeLiQ8ctGb8GG2eucWpmxI4YoNA8nPDrzenhFHV2axnGnBdfpFvlra1tMgV/Yr2CWKy/IhD2kQdOnBxW4uRqbefJXMzDCq5BsoFzK/KTvJnu3kLKRM7BzV1X1z93hi/us3K2TPeEGDu5Od2v+YHGTupvC9YIXrPpvJFUCFcL1keviQs1rV2DvWiohONFA4XSvBB0EuLHXYGfDZW297xUfxoszQ/1KMIDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YhIWW4/rDnj+F3sOuf67Df7bs4EBw1L8/azwrFPGv9E=; b=dqwWdYcRYFIu76zBYoInXa0OlIsX6iBKyHGP0xYVerHqhPIcpXC9iYU2TK6pJOR/ZPw8/+UDNEnSwBwn3xga3m8yHjhlYiIwSEqdZ3vE/jw+erdNJThIfLeoqfr4/JcwNFX7M5R17ePLsjVg4D44LvywAHxNQNn6U8lc8LZY7YGc7Vkq7SsPa0hO8As0tGcH1AjYq/79vKPXHzNy7s15F9LUG0z506Ng1gksuoLol/FKXkaoIenmhjSh2QCY6E8vcGAbQqLuw/RjpL58pNBhCFuiDgrNNw5lxmb6YcaWWgWotBilWC6FzAAenzMEHnlPXbu0zedjMPuSB3R1nU6+TA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YhIWW4/rDnj+F3sOuf67Df7bs4EBw1L8/azwrFPGv9E=; b=gV7/VU15ZhBW8TqOJ6+fw6J+hguHTloP4Bj4V//rzc/K7m3s3MLlgVdbj5v1jSD73klWTtQjL/4XHmN+pXDOe92H+8DuniDqiZGeClo5Hjl9zCegC4GFDhchCEocmrj1EFi2YgWsq22hpCiQg41WFJ07esRl4keY518Y/j8R+X8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) by PA4PR08MB6080.eurprd08.prod.outlook.com (2603:10a6:102:ec::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.18; Wed, 20 Dec 2023 08:39:52 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6b40:1e6f:7c94:71dc]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6b40:1e6f:7c94:71dc%4]) with mapi id 15.20.7091.034; Wed, 20 Dec 2023 08:39:52 +0000 From: Javier Carrasco Date: Wed, 20 Dec 2023 09:39:45 +0100 Subject: [PATCH v6 3/4] dt-bindings: input: touchscreen: st1232: add touch-overlay example Message-Id: <20230510-feature-ts_virtobj_patch-v6-3-d8a605975153@wolfvision.net> References: <20230510-feature-ts_virtobj_patch-v6-0-d8a605975153@wolfvision.net> In-Reply-To: <20230510-feature-ts_virtobj_patch-v6-0-d8a605975153@wolfvision.net> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Henrik Rydberg , Bastian Hecht , Michael Riesch Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703061588; l=2473; i=javier.carrasco@wolfvision.net; s=20230509; h=from:subject:message-id; bh=59bW29DENUDew3cR5WsWqMNLxLGnItTLxZpUNAO1AqM=; b=zJKzrBhBPFDk7o7khvgq+un3DAbxCeyIfIOU8YOIlnteq3GzaFvaj2lYIC8a60xddubnQ7oZZ 3rTxHLzniIMBboD9hYbsQUPz2AB+edkkq9B+y0Vfeij7Y0aGnKv29od X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-ClientProxiedBy: VI1PR0502CA0028.eurprd05.prod.outlook.com (2603:10a6:803:1::41) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|PA4PR08MB6080:EE_ X-MS-Office365-Filtering-Correlation-Id: 14fc98aa-1b1c-4182-1c68-08dc01373bd9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i9witi/rKJyhru9eDXOBrNXaHa80FVaZ8n2XLSJ1riuRzYRrjHiILjuq/YYOoE1Xjyjle3FzmtK1StliM9WzbsiRqspgIYy2WtqvN6E/Cydc8iD6OYAVmDsPjf89od3sdXUC11nEnaVRV0aCpuaKB+4IdyxtkzxujH+GBzuWabEjGPeaNVA05PfGS63pKYI0u/wb/dg0jsVHd3HkM/RHkjNWU9yIvONg9A9lLq8XTGWW3nJVR7zhDB/6Lk2Dn+KbxWsd1Ivl8WB6Pf5zcEm/uLK3mYNHtJYMVFyjV5hHxtDTe9sDYbBuJQUjmQeGLGHI0JtPOTj5w6Ej7StlK7RnU/FYDn0uDXB4PSWzt+2h+m2FoceGZDNCIFnKAoX3mNVunEWQ1J3RnJHl54h4V3jTU2bZnhwuy4U+S1lNJp6RkEp9m6BR3ThtP5FE5bKdnudxnp3HX95CgVkbgVd8CcLMySrD+sCElV/EwMu5xrDubIpGSlgyxmheBZYqUNvclnoP4HTNfh5U2kpGJ0oGbuL0v1ojxbc7YUMoybGX4YTaC68rX6evvRYM3uZMnrAw79BMBWBB6G48u8lOcbFh0HXtt4qfabbKBAgO+6/5lnpY9/U= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR08MB4974.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39850400004)(366004)(346002)(396003)(376002)(136003)(230922051799003)(186009)(64100799003)(1800799012)(451199024)(2616005)(86362001)(6666004)(6506007)(6512007)(52116002)(478600001)(26005)(107886003)(6636002)(316002)(66946007)(66556008)(66476007)(44832011)(6486002)(110136005)(38100700002)(36756003)(2906002)(4326008)(5660300002)(8936002)(8676002)(38350700005)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?K3NaFZ0LYSk7YXA93VP2IUcRq6uU?= =?utf-8?q?Ah4vKQ0iRWyiUtQZLvWtvPgNprArdrW35sa+TU2rqNaymg5MsHHBvxs20eAs8JGnj?= =?utf-8?q?0MYZjtoIUwwCQp0Uxx42RkCryh5Xm3lSRJqHkZ/EYiQqPcb8DTHFWUic8sFRJYkSI?= =?utf-8?q?osXQSoG2+FyMnuK/rVthQd4VZ09rHCBMX1F9ItoJi56ffiJmTmJWVS4RhZQ+7Gzp2?= =?utf-8?q?ktabl4izqWsBIH0L6nVyzYWL0M6cLJr5nbVrhGYzB2rQ0n6tXIl1KDIwc5GasohJ3?= =?utf-8?q?BLvIKAL3T/UOuCHZR3Op7Ctet36CVVrFcbcOh1kdat39EnnIVeSpXFQnXNAFTPk5T?= =?utf-8?q?9Xfn2ARn7rKPumYYKC+EtBIWYlGRJlWl8dty9OFshw4CqdFd5HoBWYcWA4QihbQEq?= =?utf-8?q?PGHNWqUITPnjIalTn6zDXpvW6JYx7SBDgWpRYQiOvBgmhvpmirnPhKnLK8XNId+Oz?= =?utf-8?q?9cNktRW1ZA7Nq3grWJqDFjRI9l8BuAqy0dalDZ+kVhysXYh115DcE4Nkdugler6LA?= =?utf-8?q?Q/1Cs2lVwI8qQilr8Tc+D7n5bSZwrw511qAe9QNdN6WCIqWCtgCd5JNydpJwDGphE?= =?utf-8?q?BfH6nfdO/u36T8BPDvQiBHdqbkWQ57ZNKoQDgt5DNGQmvuFtPz5PA/ukt9VbtGTCP?= =?utf-8?q?eAgHXhksVWDz5bVbAY4F4bekSuTd0lGW6PXSGKPtfAAmROQv9LrzhATSCOK2gWTs/?= =?utf-8?q?ORVN28pbkKXM5UcLH7OnhRHg5uzAI12fqCpAMEHPyh7wjAuRPUfB6klKHelGhw9uZ?= =?utf-8?q?Y9RDsia81g4LG5SJ/xQjZIeR7Jtb88H2i0taMf21vNj1cdMtO5A6tj7BtUMgXE+Fg?= =?utf-8?q?4XQEbTEFPFQtXjgIEUyiWbKgqt9y9B8v2EF+H74RgE8FXIpmEVExpSDMCxupq3JTR?= =?utf-8?q?kAALBArdWjXzs9yrWbMCcPrkU/NF6prwmLyYGkhnz6b9z/tqQxWbhuFPmOKNDyiC5?= =?utf-8?q?HzkH96JoIfpcC2OJaL4ypyXDYkllCsY32R/ck1cgtIavrch3tEj9d2uAu6lkHbVGA?= =?utf-8?q?rR6HzLFVLSdqlX5iSz0Rrtu3J95929KgRmlvidzAWc/vy5iUwG9ah7RhCxXmI8hFf?= =?utf-8?q?J2Fphp+MkCqnj6sQ8k2RNGmzE7tRA8Ccrpx8jtvEjNXuxRLoPZKsBjxBsVGZmouaR?= =?utf-8?q?9NDoFAAI5IBoU345Eh/Uhm8CihAlarQw8PvZVT/rqXQLP9suj0P0LYHjZNNZz/KzQ?= =?utf-8?q?jnbD6PaXM43DlIysKWUeRAmnr3eV8XLYiThbFaUE49nMNUvQYvcl8S5B4pfM1yV8L?= =?utf-8?q?cjA7m1gadvbZJcwub3djUl/eHmc5R+iqOW80E/Nt84jJ7ZSV89+TbBnTC88IufTzb?= =?utf-8?q?BaFxuoJEKUP11SC21JfPU8kpZ+Ciqlkbq9haENV8LBUYMW8z8JCdF4eqaMfarGE/o?= =?utf-8?q?3LivkhDf/7OVDHb57WShpc5lAJRQDruEDiZFc3Atj3raZNLah21nBgQYAC0lbTBbQ?= =?utf-8?q?wzg/80ucTL+y9q0UdyDAhs/c4GIKJjM1BcYw1MyHBaVDdJdZWcvsl/ztH6c/1nd70?= =?utf-8?q?l/9X3tGscDwKZykLCBc2IDRKo34/No+EmtaLISGPZG4TQlc7xTkiRQI=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 14fc98aa-1b1c-4182-1c68-08dc01373bd9 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2023 08:39:51.9909 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1U/3eOAnkQT9ldTr8WbVWDi3p3YFVM4hNydpiS93YU+Ow8au+AeoKPXu++5IfjaM7rHNnqTOes0QIvFa/i1zOzEhva20pMtJm8WZx6BEm74= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6080 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785789740009937606 X-GMAIL-MSGID: 1785789740009937606 The touch-overaly feature adds support for segments (touch areas) on the touchscreen surface that represent overlays with clipped touchscreen areas and printed buttons. Add nodes for a clipped touchscreen and overlay buttons to the existing example. Signed-off-by: Javier Carrasco Reviewed-by: Rob Herring --- .../input/touchscreen/sitronix,st1232.yaml | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/sitronix,st1232.yaml b/Documentation/devicetree/bindings/input/touchscreen/sitronix,st1232.yaml index 1d8ca19fd37a..e7ee7a0d74c4 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/sitronix,st1232.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/sitronix,st1232.yaml @@ -37,6 +37,7 @@ unevaluatedProperties: false examples: - | + #include i2c { #address-cells = <1>; #size-cells = <0>; @@ -46,5 +47,33 @@ examples: reg = <0x55>; interrupts = <2 0>; gpios = <&gpio1 166 0>; + + touch-overlay { + segment-0 { + label = "Touchscreen"; + x-origin = <0>; + x-size = <240>; + y-origin = <40>; + y-size = <280>; + }; + + segment-1a { + label = "Camera light"; + linux,code = ; + x-origin = <40>; + x-size = <40>; + y-origin = <0>; + y-size = <40>; + }; + + segment-2a { + label = "Power"; + linux,code = ; + x-origin = <160>; + x-size = <40>; + y-origin = <0>; + y-size = <40>; + }; + }; }; }; From patchwork Wed Dec 20 08:39:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 181533 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2498905dyi; Wed, 20 Dec 2023 00:41:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IEO4llwwXUeLqpvrTWftFJAjooBJgt5aow9qq3hfI/G9njksKzERFtPeN9seB1iu5CEgwFz X-Received: by 2002:a17:90a:7343:b0:286:6afe:63d1 with SMTP id j3-20020a17090a734300b002866afe63d1mr9465953pjs.11.1703061679970; Wed, 20 Dec 2023 00:41:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1703061679; cv=pass; d=google.com; s=arc-20160816; b=D0lb6IVEuJk0qg1mNxeXUlZYpfwI69VBCeLZxvlPil32anEVmIKMqscVZBscVcY2B5 edPYFRa0Jy6SHsFrqOdZQLVrxjtWdNTCLhIbO9upf7lYSt0HDPvtvuB7Eed5WdvOdUMs CIwo6UGPfjSLWqbpQCrCj/t0sy7Ijax46HI/NcZzQATDQLify7Nm5VVHmv8dOBOd6aDn io5WDjFbBUkbXaOgmsqIpZlZlf4fBPy0QdGCIXrs+2tgZLI5EZkXF81IMkoYcrlrf4Tx 4UG0AWzunIxhZJh6F2JK/LjR6NwTAeqFOx+r+TuwKWz05cXxeJeclXKTXzN7dVEiBXO7 YYlg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence:cc :to:in-reply-to:references:message-id:content-transfer-encoding :subject:date:from:dkim-signature; bh=2dJliw5bToQke3WfeUdjp5G1kxFNViFF+00Gz9vm6og=; fh=Q2yKSKQ8R8KEx8rDZBLMysofwwLup8S/+bsFQ+KI0PY=; b=P9MzWsgXQfL95Dj9pRdxzsaGO+k+AxusrBFm4exy8WQpSatYZAb1Cnm1rt8OSBRUZj kssPplFPUMyeifvPTgaGxuBOIdHecowjhEllbP3FlBAzx6cknA6lqaO2iJyv5BI4sgCT 8uV3QT5eyQT2KoKenWc7Hxfl1bLyM6vFBtnx2qT2DLhC3Wsro6WSSEAqYTDZmZZqZBKM +/JKbQzlh8sU/uwd8NqppJTmNkaG7PuZyEpvWZ7ahXgKtynXZMTLCr/Zn/oGQCy7vJhg YyXYWJGe2Hv9OflngTQ+1H8erw35/49qVbA9AVrBZnaK3/o0Wbn4jYDoGk+/bUfosr7c f7vw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=g+cWobTZ; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel+bounces-6588-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6588-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bx11-20020a17090af48b00b00285864ca8a0si2697473pjb.180.2023.12.20.00.41.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 00:41:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6588-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=g+cWobTZ; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel+bounces-6588-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6588-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B09C3288CCC for ; Wed, 20 Dec 2023 08:41:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 594F220322; Wed, 20 Dec 2023 08:40:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="g+cWobTZ" X-Original-To: linux-kernel@vger.kernel.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2051.outbound.protection.outlook.com [40.107.8.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 201E11D6A4; Wed, 20 Dec 2023 08:39:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wolfvision.net ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iZcP6pdX+7gUNm2HLgMFTA9R1/pd951H56Df8zidPYxNfdXBU5ZS+IxM8JbYjK3QvPnXFEzMUggdjQJUsZuGChZtCYQ0G669A+nEHbwJe1JaNSaFrZv1onWbENlv+U+bdqRzMRAfSVZZOOSo7K+e7uAT/ZLQcFZDa6WBYTk5tgtDET/Qal/wGUi6mh4tmf5PUWiow6Lf2HRjHaUuf6+pikrEYUDxsMyiARkyoCR87Q0EaQo0ALFVH/72yvlZJ+tcFcw7GxeCN3N1K0ufEh6THiut5YBYtp37aaiQBvi3gHWDBl+c4bIpnF9jO95fqFiaCiRoe6BRGycOHhiXuFXATg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2dJliw5bToQke3WfeUdjp5G1kxFNViFF+00Gz9vm6og=; b=bUIejdZISWkWAXYb7elbB0ZtiLRvi+EjV6v3lLGRcb8Iplo3J19AFiuzKSWpN0wHIO7/2YgVjrCRaK3/fC45HYT5mqFe5Y8K9fXrcCnCgDpaD9Aj5UKhWAuKmJL+PdObGunkq9HzTsjWVQHC8UMl/NbWlmRs0GF7nYbXRM766hOuJpy8Om7TyULMqDN/9kB9bZSJIX/rnYIOmQW/5mKjaFZg8od7NNFBm/aXdqpKaL4d0uGV5gK8vQjuW9umruVLx2rfsyiNjRxPym8c2ZOV2T0GxPjap2yfDVMil+2IwDYbzgd2L0CXlglMzdNsPzvIPPM078YVzEhzp3xXLA4+Ug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2dJliw5bToQke3WfeUdjp5G1kxFNViFF+00Gz9vm6og=; b=g+cWobTZE/vFlvatSv5yd3f9V6X1DVmp/PlZKaWf4veIeh//1TM6UmL4Mn89JAVohnz9IP06W9Z8W5iaJkPWBuvDFIryZOdORd9H/p8SB2GFmxVb0dk36kIiBreznHd3+vYK0tF72L4CvcosW94/tsRx51X4F12zojrmrWOpLCM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) by AM9PR08MB6114.eurprd08.prod.outlook.com (2603:10a6:20b:287::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.18; Wed, 20 Dec 2023 08:39:53 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6b40:1e6f:7c94:71dc]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6b40:1e6f:7c94:71dc%4]) with mapi id 15.20.7091.034; Wed, 20 Dec 2023 08:39:52 +0000 From: Javier Carrasco Date: Wed, 20 Dec 2023 09:39:46 +0100 Subject: [PATCH v6 4/4] Input: st1232 - add touch overlays handling Message-Id: <20230510-feature-ts_virtobj_patch-v6-4-d8a605975153@wolfvision.net> References: <20230510-feature-ts_virtobj_patch-v6-0-d8a605975153@wolfvision.net> In-Reply-To: <20230510-feature-ts_virtobj_patch-v6-0-d8a605975153@wolfvision.net> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Henrik Rydberg , Bastian Hecht , Michael Riesch Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703061588; l=5320; i=javier.carrasco@wolfvision.net; s=20230509; h=from:subject:message-id; bh=5l6dIl/NYW73Tl4xHQU1WZhPslhNKxcOjVzCX472s8k=; b=qSIXewiWUER8XL78l2IfugcIrm8vnXv0D6OSNSE33VjHncGYz1vBcRwowDeMMfrGIZB5C9bu5 5CFFjp8NkQtChVlFfdsIIJEPXaiatvTNUaIdpiGkTvn5rrY9FhbVHWy X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-ClientProxiedBy: VI1PR0502CA0028.eurprd05.prod.outlook.com (2603:10a6:803:1::41) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|AM9PR08MB6114:EE_ X-MS-Office365-Filtering-Correlation-Id: d0292b3c-689f-47fa-c811-08dc01373c46 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VSyjRzKWbxq1gg5O1gn2OAiM9R42U03KX2CWXGJTLk0LM3ovx9iV2+ojrebip33fsK9a+00X7bW6BGtgiOsJ6qXhh5WQJpkP+Q0uE1JDCk3WDz6BRzgqrCe4qSfR+7JLOFeE8WuCTw4KPqguxNYafSEPCV1nx9linPjcAWcR6kZ2/9VnCNdgp5HGtzJCj8Cw891G0jtcMqvEGMdRKlhfbf1XEqztYM/mjopkAXhsGkUpW/afZg+4IJZ4tD+abTX2mnUkP3WsZJ4EGGHSVYwB/HHy/X7OC2bw8H0U94AnV6m2La/nfveHtOPambpOIv3Eayd+PvCBjSLIPAhqflBvJlpsSK71ou9AAyZummBUrgojzSnfIKi9u3dR27+gLbUy7Dl0aVOU+OB12qJEj9ltbo4eX1rYScF8a1KB7z2iar07orlW4Qjv8j3l4HjVPYzvNPgGInz57DRHpbpFO7OsYog9IrVxub2LZw3zkRsnsEcvKPFtxLO8+wQkkbMIbyS7oaT9g2HAsN4GCoi/y84tNsPcOE1OWyMMbe4GlPA78hQGIr3I6iLAPzwy3XoxQIMZvUdsYF4Wd8m1FenArys7D/4w9zsiI4PcjkB4zX1YLP/PyJG3XEnMb9RpcTzHgFii X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR08MB4974.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39850400004)(396003)(136003)(376002)(346002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(26005)(5660300002)(66556008)(6636002)(316002)(6486002)(66946007)(66476007)(44832011)(107886003)(2906002)(38100700002)(4326008)(8936002)(478600001)(8676002)(52116002)(83380400001)(6666004)(41300700001)(110136005)(86362001)(2616005)(6512007)(6506007)(36756003)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?19OS2Q0IK/iHETB19SBJDjYGS798?= =?utf-8?q?ocjUsQ/EeuVp09mCWKK5eFvpsDDqAU1aCd3ghktMr1OVGnwP01wGbgQMYQEI4VMtL?= =?utf-8?q?kDgWzMeTkqe/e5ZPsY64xLBD3WCnJZTRBBRtrA13IJkvckO2IC7T2iKVRm0hrPCun?= =?utf-8?q?7gQNPBWJw3XVAm0XMXJYneUGXvxPe8R93K9fTnqbssa1UWWPvMu10aoX3yXOhWTNk?= =?utf-8?q?u0X6s9f8ClTIXJPhlhbfKDKMPgygHHSa4tktll/YSqkYs+eKsvL7whTi8vLcJRZYF?= =?utf-8?q?B4EIMp2DRhDhpcoCwWnZHwnu9ndYqWEzbmDBlAlhqQ2tHBiPDuItxauyrr0imemHb?= =?utf-8?q?9HShnZBxBxyN3SPGd5B5N6n5GB9cyA4X7T9mvuUgkmGGERHVtUZ+3fSM4wcCpxqRI?= =?utf-8?q?9uCOEcalstGGNbZuxeMtOPUEr2FzFjM0c0RE0KvnCQ4vk/0aVeEfz1kbA2VmGNt98?= =?utf-8?q?+4Yge+f1Tw1S5mC9qJgkisoQtqLm12i/yGZyw8mgJ1jcNKgCa+TO+ZzS4Th+VWhIz?= =?utf-8?q?pW0Std5sU9vwmXx/XtIdr7OQID0+j9W/fTpEOhjO+3sFRzyoyu+IRb/bz8lMlecTT?= =?utf-8?q?ai8rWpn7UpnSDLmn7JJIvwE8W7CWroTnRvol1qi68ipWdSjMnav43Pj+JsJKrWYze?= =?utf-8?q?A9KAu17B4XcVOhVGnApVozqiiBx3oZqfD19vfkIEpi7+BKXHIgmxrG7InSC09e8zN?= =?utf-8?q?XBMLiezccywVEOfejTpu2RXEOeKqOFGmd6m/c4mm+uDFVtuDTDRmtE+tOabUhgJgG?= =?utf-8?q?UvFXl6k59lUKIMB9yETQsbbo0MPM8xErjXv6kg6e1LTXp5TtGXGdAzpWTqwKx3Htu?= =?utf-8?q?7gy33VLE2rqZ1D44/aSEPF1hkged/20mFIjT/CeXUT4K6BEnSxWKj1LuobjXemFNr?= =?utf-8?q?+RiqO4nD8cJ0yPW1Ghs0nHIaWbW8FD9MIobD7noxjnf5SFhOX1t95YIFboFAJkdjb?= =?utf-8?q?EuIKvqkbRhC/Ou7EXH8eWXx85ffmqKnLKBhp5KOWlOR6daqw9yDYxD8yhOL5Uz0Sv?= =?utf-8?q?cYqW3IU+cUUXjKASjPdb38y6f065cJZS0BfrFdxXJdqWVxG1c+AKaGrwuWcAfB27q?= =?utf-8?q?x7E6LFI2QisdrY+kreALD1Br4ibmNih6voJpEvQ7NvhKcaQKF1fyi1hYoVdQ1XPPI?= =?utf-8?q?/BuqMNi1Q+mQ/mqS2bLK4ykv9Wpf34HDRMebO7qsx/kdkQnLKUUpnKPl5GBfiq5lk?= =?utf-8?q?GmmpPHMTQGP63D3hlB44yUJ8MhjxIaSf9Ti81nqRb1Y27cdlvTy4JeH64npQwMmuQ?= =?utf-8?q?xbwUlQxISquynIEuP0k40U768/qfsgpNbfz1ecCF/5HA77Tox1hmwHX9oetbvWh2J?= =?utf-8?q?C0IrKsr5unt0EhMr4iMsV9rx+MfQ+0rAawNeWPeHa7sWKcM3KhwNwMxa2rOFVqwel?= =?utf-8?q?BbJL+xX5pEBANLaUy2NN4O7QkgSWMOP7u2HayT0eOcL2YlnFZ3yAdZv4WHpvWyN8T?= =?utf-8?q?/VnrhWE9H7M1YxMfmHjrsTOnfuj0wJ04dhJQHMx6CiDvnXC3MWx7RzOGkBsODsAV9?= =?utf-8?q?IDrlAu5kG8gDC+YQVTq4McwjkutIxXJWLjTeKSsut4K05QqfMGFjxl0=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: d0292b3c-689f-47fa-c811-08dc01373c46 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2023 08:39:52.8580 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: at+2ijy75fmjHGr/Nh/hNSv0d+LoxXK+4NSAEuuxWHonKorFx9WlYcTWjiUK5sKeR4djj9cQOnKLibkFfmmZgAInSmoRgei3WhejJ6VnHC4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6114 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785789604194731525 X-GMAIL-MSGID: 1785789604194731525 Use touch-overlay to support overlay objects such as buttons and a resized frame defined in the device tree. If buttons are provided, register an additional device to report key events separately. A key event will be generated if the coordinates of a touch event are within the area defined by the button properties. Signed-off-by: Javier Carrasco --- drivers/input/touchscreen/st1232.c | 71 ++++++++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 14 deletions(-) diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c index 6475084aee1b..5684cf04bfa1 100644 --- a/drivers/input/touchscreen/st1232.c +++ b/drivers/input/touchscreen/st1232.c @@ -22,6 +22,7 @@ #include #include #include +#include #define ST1232_TS_NAME "st1232-ts" #define ST1633_TS_NAME "st1633-ts" @@ -56,7 +57,9 @@ struct st1232_ts_data { struct touchscreen_properties prop; struct dev_pm_qos_request low_latency_req; struct gpio_desc *reset_gpio; + struct input_dev *overlay_keypad; const struct st_chip_info *chip_info; + struct list_head touch_overlay_list; int read_buf_len; u8 *read_buf; }; @@ -130,6 +133,7 @@ static int st1232_ts_read_resolution(struct st1232_ts_data *ts, u16 *max_x, static int st1232_ts_parse_and_report(struct st1232_ts_data *ts) { struct input_dev *input = ts->input_dev; + struct input_dev *keypad = ts->overlay_keypad; struct input_mt_pos pos[ST_TS_MAX_FINGERS]; u8 z[ST_TS_MAX_FINGERS]; int slots[ST_TS_MAX_FINGERS]; @@ -138,14 +142,20 @@ static int st1232_ts_parse_and_report(struct st1232_ts_data *ts) for (i = 0; i < ts->chip_info->max_fingers; i++) { u8 *buf = &ts->read_buf[i * 4]; + bool contact = buf[0] & BIT(7); + unsigned int x, y; - if (buf[0] & BIT(7)) { - unsigned int x = ((buf[0] & 0x70) << 4) | buf[1]; - unsigned int y = ((buf[0] & 0x07) << 8) | buf[2]; - - touchscreen_set_mt_pos(&pos[n_contacts], - &ts->prop, x, y); + if (contact) { + x = ((buf[0] & 0x70) << 4) | buf[1]; + y = ((buf[0] & 0x07) << 8) | buf[2]; + } + if (touch_overlay_process_event(&ts->touch_overlay_list, keypad, + contact ? &x : NULL, + contact ? &y : NULL, i)) + continue; + if (contact) { + touchscreen_set_mt_pos(&pos[n_contacts], &ts->prop, x, y); /* st1232 includes a z-axis / touch strength */ if (ts->chip_info->have_z) z[n_contacts] = ts->read_buf[i + 6]; @@ -226,6 +236,7 @@ static int st1232_ts_probe(struct i2c_client *client) const struct st_chip_info *match; struct st1232_ts_data *ts; struct input_dev *input_dev; + struct input_dev *overlay_keypad; u16 max_x, max_y; int error; @@ -263,8 +274,13 @@ static int st1232_ts_probe(struct i2c_client *client) if (!input_dev) return -ENOMEM; + overlay_keypad = devm_input_allocate_device(&client->dev); + if (!overlay_keypad) + return -ENOMEM; + ts->client = client; ts->input_dev = input_dev; + ts->overlay_keypad = overlay_keypad; ts->reset_gpio = devm_gpiod_get_optional(&client->dev, NULL, GPIOD_OUT_HIGH); @@ -286,24 +302,38 @@ static int st1232_ts_probe(struct i2c_client *client) input_dev->name = "st1232-touchscreen"; input_dev->id.bustype = BUS_I2C; + overlay_keypad->name = "st1232-keypad"; + overlay_keypad->id.bustype = BUS_I2C; /* Wait until device is ready */ error = st1232_ts_wait_ready(ts); if (error) return error; - /* Read resolution from the chip */ - error = st1232_ts_read_resolution(ts, &max_x, &max_y); - if (error) { - dev_err(&client->dev, - "Failed to read resolution: %d\n", error); - return error; - } - if (ts->chip_info->have_z) input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, ts->chip_info->max_area, 0, 0); + /* map overlay objects if defined in the device tree */ + INIT_LIST_HEAD(&ts->touch_overlay_list); + error = touch_overlay_map(&ts->touch_overlay_list, ts->overlay_keypad); + if (error) + return error; + + if (touch_overlay_mapped_touchscreen(&ts->touch_overlay_list)) { + /* Read resolution from the overlay touchscreen if defined */ + touch_overlay_get_touchscreen_abs(&ts->touch_overlay_list, + &max_x, &max_y); + } else { + /* Read resolution from the chip */ + error = st1232_ts_read_resolution(ts, &max_x, &max_y); + if (error) { + dev_err(&client->dev, + "Failed to read resolution: %d\n", error); + return error; + } + } + input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, max_x, 0, 0); input_set_abs_params(input_dev, ABS_MT_POSITION_Y, @@ -335,6 +365,19 @@ static int st1232_ts_probe(struct i2c_client *client) return error; } + /* Register keypad input device if overlay buttons were defined */ + if (touch_overlay_mapped_buttons(&ts->touch_overlay_list)) { + error = input_register_device(ts->overlay_keypad); + if (error) { + dev_err(&client->dev, + "Unable to register %s input device\n", + overlay_keypad->name); + return error; + } + } else { + input_free_device(ts->overlay_keypad); + } + i2c_set_clientdata(client, ts); return 0;