From patchwork Mon May 15 15:00:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 682197 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 B3E55C7EE23 for ; Mon, 15 May 2023 15:01:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241845AbjEOPBY (ORCPT ); Mon, 15 May 2023 11:01:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241547AbjEOPBS (ORCPT ); Mon, 15 May 2023 11:01:18 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2079.outbound.protection.outlook.com [40.107.7.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89BD81BCC; Mon, 15 May 2023 08:01:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cHsksdh1Vz3YErMQtePMysAzxtupXaz4hYvFysG8Jt+3rcLvJz8oWb/FXdr3ab7GQiYk71heKq8oDXRwdq9dtXQ77m24fx0AG9u4jhdUmyxA984ZN3+2j0r8+YFiEkV6eIc4eQ15EhihOF7/54lmqiDNRNJv+TeMfWiZ6V7fQ39mzbEd7i8asKlWGQS2cSHpJK7RINXN/Q3ewyj7pOJpKMFhw+ilYNGBo9gufv6eEbp8bAAIW8gKlwppNVyrQ04G38Tbhmvr44mo1Q7++OYAX0hU9K/cZgSOC7bY3xD/fi3IV87VE5HCwwkQGEDSYWlgemSgCC4pyN6T15vAlqoOqw== 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=e2B0A3FeBz4LnUbKf47NFwdHTKByHJWHe0IhxqVwHrU=; b=jU111r77Re6RyfjO8Ix27udKeoLfVMWrbpz8nlil3emCDTJtCY0kOBip0QAnyaQG6LDZ2FBwuPvo/D9c/nplRcQX5KNsDxfXDy5tWZw9KLN9YTKVephp0pggXcKK7+3HYeoKxfgojdZhr1UKET61vt16viABsAHi3YYLlKk0RrVslr4/qPW0Iu9jPJczAnatcErjpe7aiVucLEygXM4JMaOTMhCC52CeV4UCXImnNTWY9frDDc/U52ohMl83ngFYD9v+opV1wUZ0EuAQvN0121MX388bdix4kWhKHI3rqOH0yV9oTJQpZhZfbLVSc/Im/jBPNSa3CzJpScoTuS2EIg== 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=e2B0A3FeBz4LnUbKf47NFwdHTKByHJWHe0IhxqVwHrU=; b=RyMfQNSDMCK1NjeKvNRobK49+v6U3eJNIGHqHtoTk+JOfolb3uhL2inUr4mrbYmy8R3LhtCk1cyI84rut87NkLeSnEP4scBTtRa5UbryUUBpi95SA4FGGCe1wety/EQv0rQdykZWA1eHzQjOy/Mxk1fl4tJivjXh7NiMHDUJn2A= 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 VI1PR08MB9982.eurprd08.prod.outlook.com (2603:10a6:800:1c4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.29; Mon, 15 May 2023 15:01:06 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::bd0e:a139:9e67:b86d]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::bd0e:a139:9e67:b86d%4]) with mapi id 15.20.6387.030; Mon, 15 May 2023 15:01:06 +0000 From: Javier Carrasco Date: Mon, 15 May 2023 17:00:59 +0200 Subject: [PATCH v2 2/4] dt-bindings: touchscreen: add virtual-touchscreen and virtual-buttons properties Message-Id: <20230510-feature-ts_virtobj_patch-v2-2-f68a6bfe7a0f@wolfvision.net> References: <20230510-feature-ts_virtobj_patch-v2-0-f68a6bfe7a0f@wolfvision.net> In-Reply-To: <20230510-feature-ts_virtobj_patch-v2-0-f68a6bfe7a0f@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=1684162864; l=8153; i=javier.carrasco@wolfvision.net; s=20230509; h=from:subject:message-id; bh=QxvMvto/x5XLmhjZ2TbUw5YHv6JL/NthIoSVo7Q2ReE=; b=y49lBfaZ0RNiO3hEYbRqMdT/J6FZz6aI+3xGFEZoSWJ1R7FPwrJWo2Xq63GBau7SOzfE2F4LP epBbe7xJKeeDYXAI/lh8sIgrF26MzsRXzjyhxWkjyUdKEtGUD+yh7CI X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-ClientProxiedBy: VI1P195CA0039.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:5a::28) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|VI1PR08MB9982:EE_ X-MS-Office365-Filtering-Correlation-Id: a20afc66-8c3d-4cf2-bb1a-08db55553535 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ajtihGuFBVyNRqfgWLWpboXVvMvryXFKtWodulG6CoTyb01GSUWUdahbG71c+PebSC0KibV//jCStGf33RA0S30Ij3K9+O/+2cr+IjsXFZTF9MNMuRkV9fTl/REfuODhm640tNKEeTEmNFohcO5OEyMa1wviwUPTNtR1uEqB0Nd5YzNlJ8cNdnxqNit/7hh1wsCKBtw9sDk8oLeRC4FpbkythJc+6fQgSj7GXprnXYzZL0njhuXU1SDNLQAK54qvISrDi7WIo5i0o6Jg37OdSO/wFjRLbTqChqHTDJoBk9eojRIND7Rjl8ZAi7cJZHxSE8iWCR6EmpT10QAq/51bQwcmCSUZ480UeSJbeZsRie0MX0udQTx3bfHeCspDI4cTKMUaJFsFKmyu3NVva8BHuQYV57BtEELsAx7OtwL3lHFq3ueYg2KeNa1CbOMrky5NCxSAou/i+Tk1S8XyGud4aQSZh3bGY76SFPP1E0kVaco3kMJqGNtXipNpg2OukQQnz+kdbsDhIIaAkBbgXxKla9rvzFp5nb1rcbIy7l02/OuVKy1okWaunbTXyaTZk0irmcHaC7Ne55y34PvOtfMZiGRLXZv4/cSkwKuY6f93UB6XbkottvzV0xXsM7frL0CG 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:(13230028)(4636009)(136003)(376002)(396003)(346002)(366004)(39840400004)(451199021)(478600001)(2616005)(86362001)(6486002)(6512007)(6506007)(26005)(186003)(38100700002)(38350700002)(107886003)(36756003)(52116002)(6666004)(110136005)(2906002)(66946007)(66476007)(66556008)(5660300002)(316002)(6636002)(4326008)(44832011)(8676002)(8936002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?NbNLWiqh+vnfoZPP30q+D/fatyxQ?= =?utf-8?q?9Sja4c13UBBB1g70zFiNmg6BTDIMk2M4tbHjMFFH/3KxRCG92e1DFA9cdKHiLrtUS?= =?utf-8?q?JCjw7qWkeTIqggiEQZO/iY2RAZl1GbSJdrwh3P62/Yhe+VYSX5Op9hT5XIuVgkJXk?= =?utf-8?q?Q/p7IBh2AkNINx8CVaqGvLpcC4cew72il+8P01Y9NUZtUfNvF4g/7Di0cd5hpmOXS?= =?utf-8?q?cx/we8xA8sxl7vyLX6jmksmcMgeawxEriuIMaqAoqHefdM8JR0ubzVlsFSFMn56Hw?= =?utf-8?q?CUnP24bT5LotOPXWMsdorHm6TrJSyZShywVUGQK4uxBSNf0ffID0nbixGgw8BIxrw?= =?utf-8?q?OgejxyBdifywAp09Gufe9LRfSYbciUe4QgyAf8N1GaZrGTOV2dMCMQ8SRkCinmb6P?= =?utf-8?q?yXCRUxCoNWM9MNdcTRXfNiOXSj2Y+RlrbQxD2b3ZMuC6q8BGM/lSOYVscR+dT6Rp2?= =?utf-8?q?JVM/k9+mqC7D7ynev7gbFfrNr9UOpUnBfAidCIBuQ31EMalCAR3mf6WciDljAuzHu?= =?utf-8?q?sUBY/LYg8zgRJYgih8YNecwWpsRCwOuwrHlfqZH4Yrf4R3NiUqIjvVIdLFApnUC6Q?= =?utf-8?q?sPbZUCBH/rYVEA6TK62/utB3oUMcytahDbT/aWrA/jQ9yfkEVAeYmsC+SUE+ygUZz?= =?utf-8?q?hH/qImxn7Lnfaj8G/dCjnNT5L7fLsIoZH8cRtjaOlO590wXTWZUFpeuZADmZxxbx1?= =?utf-8?q?jBNqaikTEHpsLCw+U+vlvTCRzzG19L9faegUr5FuVScQC64KElTTTFzpswxtpYneQ?= =?utf-8?q?wncIP+9HpP/b7qJgAt8nxzk2XnKTQqdS4a00mcyICFkei5QSPNWADt6yUyMDbNl0K?= =?utf-8?q?+ZBM8RAt13pgXibfNJazYpXWbZeKYlFAllCBXw+YffHf3K9y2DueFaL2MEErxyZCc?= =?utf-8?q?6YBHSmb0zctaTy2uwMHQFTUWM6Pye8DgMTQ7+UiisngsqTnjcz+vKtspqBjJB5z/I?= =?utf-8?q?u+1GGZEuWOzabP6KwO1TWoIfnrM71UQmz3jS52QZPWWxLGTWbdEkzITVxR7QiIdsb?= =?utf-8?q?sIn95M9PiUmOV1gSvQNPCy8gU/qv7OMMikSvLH5hirGrvI3Wcemr/PkiWD8vAkX4Q?= =?utf-8?q?yjW+7CinmmSHCnnElaeyoAnLQwJR2IKRvdF0CdOQCJjQXboerdM6Fcf9NVK7z2iZx?= =?utf-8?q?QXfr16iTwnxgHemfc8R/VXIDbqhSNLpKgVFQDI6Qb8qXsElWD0zHGPkJ9RutstsSn?= =?utf-8?q?1myKCzywnzonXybi1VPWr0nmOoWrCWpZQrWd5uFv+pKeXXyH4EyjQx4heM9xY29wT?= =?utf-8?q?Uc5cTXboGf8mvsByBeP3lSewLsS/wquziYyHKV6bMWWXiLsLGRt289kGFMJpHecPU?= =?utf-8?q?11QUiNTg9XCZTRxCMu54/ZuJZ3P+gqGUodKoHoOr0+AbD0xWzKiHu1hgKMQOSKzs1?= =?utf-8?q?rRJN1lcA4gdBx2Gvr/PnRuBQdQ3oCx9u/A28kcJTGVriT4oyaPjraEMHxwlMI7ukr?= =?utf-8?q?A3iNTnRXGuXuSPf0wlnGjQeTnwnuRBG7ebupXzvRjxgurdAsMQBjkqNmuivZXfiz+?= =?utf-8?q?1BVlrWbK44gcTocXndTezuNQEPaVj/H1/c35W+4JlDQl0cxFLmsbOE4=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: a20afc66-8c3d-4cf2-bb1a-08db55553535 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2023 15:01:05.7545 (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: zmkv/yMPLENwtzlWylevIavpFw2o3aEBw7fYhm/lt3W7RUucjQ2KJFiiVX5AFDcX0Lm6YsHOPkO6+7Wvk4QzGql15UZ1COnjOyVm1tTbQxk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB9982 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The virtual-touchscreen object defines an area within the touchscreen where touch events are reported and their coordinates get converted to the virtual origin. This object avoids getting events from areas that are physically hidden by overlay frames. For touchscreens where overlay buttons on the touchscreen surface are provided, the virtual-buttons object contains a node for every button and the key event that should be reported when pressed. Signed-off-by: Javier Carrasco --- .../bindings/input/touchscreen/touchscreen.yaml | 139 +++++++++++++++++++++ 1 file changed, 139 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml index 895592da9626..866bfb45a8cf 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml @@ -80,6 +80,145 @@ properties: touchscreen-y-plate-ohms: description: Resistance of the Y-plate in Ohms + virtual-touchscreen: + description: Clipped touchscreen area + + This object can be used to describe a frame that restricts the area + within touch events are reported, ignoring the events that occur outside + this area. 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. + + The x-origin and y-origin properties of this object 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 virtual-touchscreen (effective area). + + The following example shows the new touchscreen area and the new origin + (0',0') for the touch events generated by the device. + + Touchscreen (full area) + ┌────────────────────────────────────────┐ + │ ┌───────────────────────────────┐ │ + │ │ │ │ + │ ├ y-size │ │ + │ │ │ │ + │ │ virtual-touchscreen │ │ + │ │ │ │ + │ │ │ │ + │ │ x-size │ │ + │ ┌└──────────────┴────────────────┘ │ + │(0',0') │ + ┌└────────────────────────────────────────┘ + (0,0) + + where (0',0') = (0+x-origin,0+y-origin) + + type: object + + properties: + x-origin: + description: horizontal origin of the clipped area + $ref: /schemas/types.yaml#/definitions/uint32 + + y-origin: + description: vertical origin of the clipped area + $ref: /schemas/types.yaml#/definitions/uint32 + + x-size: + description: horizontal resolution of the clipped area + $ref: /schemas/types.yaml#/definitions/uint32 + + y-size: + description: vertical resolution of the clipped area + $ref: /schemas/types.yaml#/definitions/uint32 + + virtual-buttons: + description: list of nodes defining the buttons on the touchscreen + + This object can be used to describe buttons on the touchscreen area, + reporting the touch events on their surface as key events instead of + the original touch events. + + This is of special interest if the touchscreen is shipped with a + physical overlay on top of it where a number of buttons with some + predefined functionality are printed. In that case a specific behavior + is expected from those buttons instead of raw touch events. + + The virtual-buttons properties define a per-button area as well as an + origin relative to the real touchscreen origin. Touch events within the + button area are reported as the key event defined in the linux,code + property. Given that the key events do not provide coordinates, the + button origin is only used to place the button area on the touchscreen + surface. Any event outside the virtual-buttons object is reported as a + touch event with no coordinate transformation. + + The following example shows a touchscreen with a single button on it + + Touchscreen (full area) + ┌───────────────────────────────────┐ + │ │ + │ │ + │ ┌─────────┐ │ + │ │button 0 │ │ + │ │KEY_POWER│ │ + │ └─────────┘ │ + │ │ + │ │ + ┌└───────────────────────────────────┘ + (0,0) + + The virtual-buttons object can be combined with the virtual-touchscreen + object as shown in the following example. In that case only the events + within the virtual-touchscreen object are reported as touch events. + + Touchscreen (full area) + ┌─────────┬──────────────────────────────┐ + │ │ │ + │ │ ┌───────────────────────┐ │ + │ button 0│ │ │ │ + │KEY_POWER│ │ │ │ + │ │ │ │ │ + ├─────────┤ │ virtual-touchscreen │ │ + │ │ │ │ │ + │ │ │ │ │ + │ button 1│ │ │ │ + │ KEY_INFO│ ┌└───────────────────────┘ │ + │ │(0',0') │ + ┌└─────────┴──────────────────────────────┘ + (0,0) + + type: object + + patternProperties: + '^button-': + type: object + description: + Each button (key) is represented as a sub-node. + + properties: + label: + $ref: /schemas/types.yaml#/definitions/string + description: descriptive name of the button + + linux,code: true + + x-origin: + description: horizontal origin of the button area + $ref: /schemas/types.yaml#/definitions/uint32 + + y-origin: + description: vertical origin of the button area + $ref: /schemas/types.yaml#/definitions/uint32 + + x-size: + description: horizontal resolution of the button area + $ref: /schemas/types.yaml#/definitions/uint32 + + y-size: + description: vertical resolution of the button area + $ref: /schemas/types.yaml#/definitions/uint32 + dependencies: touchscreen-size-x: [ touchscreen-size-y ] touchscreen-size-y: [ touchscreen-size-x ]