From patchwork Fri Jan 19 07:43:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13523388 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2043.outbound.protection.outlook.com [40.107.14.43]) (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 95B33D51E; Fri, 19 Jan 2024 07:43:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.14.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705650227; cv=fail; b=D/AJwwcprknYPg5dvipH5xufqVa7q+pjvHmAOjxwX0b/3ca8n1G3QsvyiBf4pUyLmfVrSFlY+eh1pNEcA8lE7gScCuaTItZ5kiR94TrPaGMFxkva+fPBWcEtWMCA+NBL0fu86ihMlSvFaj5kJy5mLn92TEHuC5qgVVixLjVKJxY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705650227; c=relaxed/simple; bh=ZNiTABoFYWaEKt28zFdQtWrro1OPl0Jcasv4659bNPQ=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=DMWk63tr63tTUD9RG8ZNbbKY1aYiwRnEuOrKHoQDojBe5qLQANf+Of4MNYeJzuW+qic508NIAxXX7J+0GbokNeM50F46TG6N2varfMFv17pMF7Ll9W58F+KRkpsrDul+nsytlfIKS3FlDmmmgPfupqlL8tUNc9qUQ+zvflpZCsI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net; spf=pass smtp.mailfrom=wolfvision.net; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b=xvenX6cK; arc=fail smtp.client-ip=40.107.14.43 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="xvenX6cK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j0m2qf8+dAY1f1c/yq7/+MI/QViNX/2Y7+vYFJGv66WYS1HmSzwiVwGuLULYF+lWkmMbfK7oxoUTUkUrfXydP6ZkAGU5TMvMCOl2JC3JAsTnqsPiveWg6DVwz0WMFIPDUHtUKT1YZjIMRuZD4MP1qnb1PVzPhh2abOsfrH9KxrR1CzCg4gDOyeUlL44Y8BYC0jBysogUgYovuHWm1h5E1E4v5I2xJ5BJLBkZeKoSKnwSeCOVbrcNIy/ThcriC0m64oTANFridG35i6KjHtEsFxMm7C6A0tZXhHo+IkBCdRRvUuxGhJMsqAuNxob1JmmQwOkfWaSXjbdhzIcz2qpIRA== 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=Gfyo3V+MkSiy+1nqFG9sFBwgBkZCJ+lW/9nFNEcd/Lw=; b=OZhYxY4YqbhPhlB3O5m2VAZUXS1Xz3l35QWDGAU2Jv8gQSzLC+AWe4901j6J8lcT7lXWCvi63WUlwuaf7LI0r29/GOl0wV7ILoMC/UBKUuigMqq97F1NpSHK4x0MsbwsVOkIG1+3gj+rtqAvt81HRpaIp6BngEO44GQtUCTcn7VyNHYevs6KGQAyUMl+M/7jDVqm3knLZ0WUQ5TgQUWRab+CRMe9YyKHVKtrzbZkw6SbWBd5v5KDmV99M8yN2Hh6VzieL15kb9Tx9rTVHE7WhWm6ODCGevdhgTBL+vk4egq1qdo8xM1sQiQR3i8zZX3snYFUzxBfhyOq7ZNtnNLbiA== 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=Gfyo3V+MkSiy+1nqFG9sFBwgBkZCJ+lW/9nFNEcd/Lw=; b=xvenX6cK1mypf+JIZry11joY7D4FpW4LyK5oNrKxJTti3b60r+hYPNZkVd5ZdqyHE35N8Pf4TUKNdfsQiHPQnaxl0sxqF6iCeAm3XTm6d/Knfjv1i80oaOyLP79ZNqqI7jhPA9UEn386a429db8E3B2N9om3CbUT+lJQKG2kuUo= 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 AM8PR08MB6578.eurprd08.prod.outlook.com (2603:10a6:20b:36a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 07:43:40 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::c8ee:9414:a0c6:42ab]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::c8ee:9414:a0c6:42ab%6]) with mapi id 15.20.7202.024; Fri, 19 Jan 2024 07:43:40 +0000 From: Javier Carrasco Date: Fri, 19 Jan 2024 08:43:33 +0100 Subject: [PATCH v7 1/4] dt-bindings: touchscreen: add touch-overlay property Message-Id: <20240119-feature-ts_virtobj_patch-v7-1-eda70985808f@wolfvision.net> References: <20240119-feature-ts_virtobj_patch-v7-0-eda70985808f@wolfvision.net> In-Reply-To: <20240119-feature-ts_virtobj_patch-v7-0-eda70985808f@wolfvision.net> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Henrik Rydberg , Bastian Hecht , Michael Riesch , Jeff LaBundy Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org, Javier Carrasco , Rob Herring X-Mailer: b4 0.13-dev-4e032 X-Developer-Signature: v=1; a=ed25519-sha256; t=1705650218; l=7143; i=javier.carrasco@wolfvision.net; s=20230509; h=from:subject:message-id; bh=ZNiTABoFYWaEKt28zFdQtWrro1OPl0Jcasv4659bNPQ=; b=wijrqGc7/fG1CEWL1EoYb9UyG8jBaYyfB9lbTHaMxMId7dfXpdyAfzZNJVRA3erENay+nxDiW 61d5pwmITlUDHdppN6RtxDPQOtPRqoLaxwF7RbaX0Rn2I2vvoVg8aks X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-ClientProxiedBy: VI1PR0102CA0088.eurprd01.prod.exchangelabs.com (2603:10a6:803:15::29) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|AM8PR08MB6578:EE_ X-MS-Office365-Filtering-Correlation-Id: 458c6b6d-b3e6-44f9-cea0-08dc18c25aa3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s2XYyhqwotNc8ckbEd1XtPZnv/aAO3j9i5Fscd+adJiEeZIJcvqU+afERnGUSBsmoeP6bjW2EC/0DX3RJemwG84Fig9RkxgUA4ujprF1xCyY7N4KWdeerrh0P0QWay7fz6nWrOsrspq0r8Y4l/AOMXk3HZl4oPFUXey1ZKfiRL9B/qTO0Yvts+wk5KPH+RMiiojvlP0UYPmft2DZ4rnwNvVW6kRjUygcPgMfHV5ZBE6Zte1AUtNG+EdZGkuMhk3HTZd87xB0JMt5MwMnFp17er8jNt2N7FTZFyCCUFobO+CATAAtcDpRIu0iyiy2T9FhtH1BMCQgfXEIh8UHKCRc9Zr426aX3AY/gilWZug49TqNI5rzMPkG2Jz99h8zOoUeDcqVWDA7ndxqBnUrdkHr6kRR5rI+MtSw8TlppijFsUuN3rGFtBlZlUCk9epZnE4fvkWajbmuWbPk4qUlC5Q/9EHgHW5M4ABlFE9oDhVZe/TZy0Qpg8JpMXT5uIqwokAr7Y4KHgGBh68cJexscX4UU7wr4xINcPdTzsgnlG9Vwgk3n4pXFVNq0VEkjQLvxlusw4en4IZFysQm/7uxMl5vBFolgnVr6NPRtuAUnDbffxsxEZVn01yL433Bdz8TCK8z 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)(136003)(376002)(396003)(346002)(39850400004)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(54906003)(2906002)(7416002)(4326008)(5660300002)(41300700001)(86362001)(38100700002)(478600001)(6486002)(36756003)(2616005)(6666004)(6506007)(6512007)(26005)(52116002)(316002)(8936002)(8676002)(44832011)(38350700005)(110136005)(66946007)(66556008)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?2IzHCd4x9qozVD5NYVFffweq9w3j?= =?utf-8?q?1M/57fhtLxqA0UXmIi8B5axsw707NI7Szf7ryG8Jhf4b93iI+XrmKIU/Dam8Fd4Ju?= =?utf-8?q?Z690m0iMT7DfVy8NUbpderP1EspH3wXXUsw4NNQn5ix5yuO8Z9mjM6MxUPBsKaWMJ?= =?utf-8?q?3nXBKDnUce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T2Z49blys6dWXotFiT24LZjQJGex5FVHGrBun8tLyyKbGO?= =?utf-8?q?iHvlF9f1/hDs6SVtQLD1mxUrVpJRDGkFpm7//5ZPUygQBV27c6VeQvkT68J+koqyJ?= =?utf-8?q?HLN4KVl1HhpI1rVb0gzQEOfUYV4wKJWMRi8cwsBSrxhtmNIMGqrsgaVrnUTBVME+0?= =?utf-8?q?d2BecH04TkFcwpwRwJH5aU9d385LFyA1VKfIAqlQD/0GUU0J70K2OFwmYQSEzK4h5?= =?utf-8?q?Ubjhm1nuzM6plz60c2JfdN2qdX4EwYzBVPYuJapACtKAJQvVeGSNW3YB5uHrgtDkB?= =?utf-8?q?VqDYRda+ZDX5UUHziCXcvwX/bwHJNrEZBEqXLfjWwy1XIPwoXt/8Sla+OEgiW5IPg?= =?utf-8?q?gASTSY+ChfzUQOzHxay0VPE6HtWjCFJraI0k+Sc5AFPlA4im/Yp3uRfQt7lUdk/sB?= =?utf-8?q?YnZS8beOZEnrEf7TVTsrOD7L1J+gPgde71J1u9bWl4K0SGf5iULvWW34rKC3v4H93?= =?utf-8?q?xHO2AVpC2HguMavep0Q79TjoaqGFUzx+JNbJc2CR6ciWGYAY2lDXfs8=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 458c6b6d-b3e6-44f9-cea0-08dc18c25aa3 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 07:43:40.4621 (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: 2RGnNXKicHJF/jU9pzoBIQ7hFaDTuxfqXJ/epol6vtqqQ7rReGmIlhOm3GXz66UXtW7Y++bIThFwhrA09J3pjZX9ZluxDvPs8Lju6JiBJm8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6578 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. Reviewed-by: Jeff LaBundy Reviewed-by: Rob Herring Signed-off-by: Javier Carrasco --- .../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..eb1e86fa86c6 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: + description: descriptive name of the segment + $ref: /schemas/types.yaml#/definitions/string + + 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 Fri Jan 19 07:43:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13523389 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2043.outbound.protection.outlook.com [40.107.14.43]) (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 9496B208A6; Fri, 19 Jan 2024 07:43:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.14.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705650229; cv=fail; b=gJosAECWaztu8tMa8G+qLU+DZE6aCuu73kLnOluyriXYhg+4LJrLBbetHKbdjqyL3P5IN/Nf4L81s+CnuHOnhxg/89Gtlck6mj/GpBrow+ryct+yu7rLsMjMDPmE2WZT+NZEQplLAUQNDA3OruGZPlrT4FSaCM8nP4s6y2WOulk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705650229; c=relaxed/simple; bh=gW9/7WjGR6RQNmaB7YS/LcaoTQXfAVt/sC5oJPuQ9ho=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=fq5w1DUlOMQ8qz8joK5P1aXDECNbJGSEPIAdDQ7X03pKJk+BIFfvPz0BCCwf1i7sMW99yMCxcSAod3tuTXX4AHM83FKbsyMs3JUQAytXdlND0aGHpRZAkBRhT9OcWX1BAJDNxfUXXWi6zahfeHMeOcLcWq1SfyX6QxBFBD9mzbk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net; spf=pass smtp.mailfrom=wolfvision.net; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b=deYpvKJJ; arc=fail smtp.client-ip=40.107.14.43 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="deYpvKJJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C6TTDNxi/7B4iWeMicit+ROPP4q2zjxAhvQJtPfFlY02Yg4bM47+wT8ZwbcBZEmUIcTpDZDuEdrf3jL8xOMg4C3ErrGnh0TOBgDJkbwOR2syV7XLC5oBlYCL230BJcPNwb8/2zQxGEBW/Fl62JADkH4roGSLaJhjvinTtm1ri0i0UFPvVxo1/HL9RR/GzR/uiGnuQGo8MQ04un2wO/KhM0BedP39TqSOrWJMugAlKNXajFbY41yMjTiQtR+CH53uLxvfX67EIF/HF35CFXnO+p5lQueuxpyyryEBkMM7Vy3aPwWjHhkx/dl/+y5sQm2okHW2oJTaprK4fRpmmjoNMQ== 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=CJ9rnxkotim70jMmadQsdu5KSnVSPKT148zA+J1UI3k=; b=j1UXxxiBBORMsTMJmcE7GoGo/7+o3gesfnwWrcjL092AOquVG+AK4dPSBx/Au3t7edtaM/DXLhiZxgXM4q1YjQ8Pligjkigj7OAXVgog7dnesHwMZcVozsY+KZzDVsxd8LyK5tOYszMN+Se3718orWaXAiKxoMnW0fcA9EtZv4dsNTiSQo9jzthcnQy5KxJXsHvIRBBadfKXWd2/y/kRjeKuXm1IPQuUKB+/wVkiKGrBqXyooLrLN9f8K4NisHruUPZpEXIk25/WYBdmd3NyI72Ji0LJJawdy1VCyiVlB9NrTjUgc074Cm2f/WWBnnq2RAkmHQu0Zl6K2+MXS429EA== 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=CJ9rnxkotim70jMmadQsdu5KSnVSPKT148zA+J1UI3k=; b=deYpvKJJC+dSHMvN5N23eY9ziVbe5eOcOt+xGyxXhWPY4Ek/9OrWoUpI9eNkoYP3al5h+MyUjI4NJ8WcgIfvO0+znglJyFIUAHDGkjQfK6YhZOB2/k6hCXsqh+rAhpqd19FlC+vMJuDe+tJrrymi8wngBTZ9sJuwj5N5CB12MgM= 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 AM8PR08MB6578.eurprd08.prod.outlook.com (2603:10a6:20b:36a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 07:43:41 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::c8ee:9414:a0c6:42ab]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::c8ee:9414:a0c6:42ab%6]) with mapi id 15.20.7202.024; Fri, 19 Jan 2024 07:43:41 +0000 From: Javier Carrasco Date: Fri, 19 Jan 2024 08:43:34 +0100 Subject: [PATCH v7 2/4] Input: touch-overlay - Add touchscreen overlay handling Message-Id: <20240119-feature-ts_virtobj_patch-v7-2-eda70985808f@wolfvision.net> References: <20240119-feature-ts_virtobj_patch-v7-0-eda70985808f@wolfvision.net> In-Reply-To: <20240119-feature-ts_virtobj_patch-v7-0-eda70985808f@wolfvision.net> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Henrik Rydberg , Bastian Hecht , Michael Riesch , Jeff LaBundy Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.13-dev-4e032 X-Developer-Signature: v=1; a=ed25519-sha256; t=1705650218; l=10472; i=javier.carrasco@wolfvision.net; s=20230509; h=from:subject:message-id; bh=gW9/7WjGR6RQNmaB7YS/LcaoTQXfAVt/sC5oJPuQ9ho=; b=tF/B+MumsS/cNYR363FV1Ae4Cf3VKbMolgiZ+9a1UUJ92eQg1gDG0nicCb3gdz+hTzitLMX81 X+xaGq0RTqjAmj1x0szcUwTzEuvXKKEwax3VdNAknZwo69HvqDamGzs X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-ClientProxiedBy: VI1PR0102CA0088.eurprd01.prod.exchangelabs.com (2603:10a6:803:15::29) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|AM8PR08MB6578:EE_ X-MS-Office365-Filtering-Correlation-Id: ab7e05a9-2c47-444c-a171-08dc18c25b18 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8IWkuBPEmtVHj1KRNAreFsVOV+9GyrwVwlETNcvJGVH6+B2ELxLIfzlcI4nDj4GSMTphNRHIzbpMg66hWmhVzmT6r9ZAib7nqNtkWnmhmoikd7qOFFkSxLahRDv+1bt+fJhs5beXn2Xc14Wo6Ll8QNRm08yr0GOZpop+8U+0V0RKHkZl5rNNo15gZ2u2zOonjfcdIw9O6FSKi2rf80VeJowl+eCO7DkcWQm4V5wQud1usPQRcHE4W2qMdQZf0nM1JjZafIjLA6Qrq/mFMT//erWCcmqXaHjJcF8cuTVbQiinKNt1WMTFAl7hs+Q/fNQFAZq+4RwEZaoVrV1pK6NuGqJmKsS7GWCAFtI88iaKnktg/B7ezfVMUiANwJjpFNkr2d7knS6oOUryCz33bRvcqYZNI0IwmbO5YycMBTts+EYyhYHmU4hIsFBTBfZbzrFSHD+A2pCZyBNfw8l2+eT4AqT/hSIKFCxyTtfc4N/+P1j6lL0hPcQe3BolEA9HhR5mL8jOXYSOqnaxzAXNlSqb9foN25skNB55mZ8q1kLz1ZrZSYQdFMiaHAY9sxDYR2f0QbNSNxkmht9sCINQW8W0RWJGe5rytgZxsQmqYBzxqn8XQcEi7q5/d6QbLCq3f68k 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)(136003)(376002)(396003)(346002)(39850400004)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(2906002)(7416002)(4326008)(5660300002)(41300700001)(86362001)(38100700002)(478600001)(6486002)(36756003)(107886003)(83380400001)(2616005)(6666004)(6506007)(6512007)(26005)(52116002)(316002)(8936002)(8676002)(44832011)(38350700005)(110136005)(66946007)(66556008)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?8R598hHNH7LDnPWE6TGMS2ujFPea?= =?utf-8?q?2Eazzd14sdgGc2HEqeNzQIQbblZvLRWGRGNOl6Jk557AzzO8VvuAtciQsl3yGOTe7?= =?utf-8?q?+PV32vSZaD+wK9lNabNIoEIrFPxhUGkw88WecgwDI1q7rplfCOWsZFvyJ6Ebh6I+P?= =?utf-8?q?wAB8/rCTqcbKBTp4bvADjRskWsar/iRUKb8DBW6p9UC7amDE0u9+BT3aAdBsHqlEe?= =?utf-8?q?iTV6XsidpFKycgC2X6bU9TB6zHnrJTVbZw10Bzl7W3vsc9L4Yy01A4yvGL6opS/sm?= =?utf-8?q?dsO38v/Ua/n/uEVAGDptI3JXaF9R5JRo09ac23iCZN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kHmxTOGj589g0VY6YbJ0Y?= =?utf-8?q?PBIIuS4xjaHyzr6di/KDOldp2soijg5D2bF7EqzwJoPunVF6MSlTHGrZUVMjYR8x0?= =?utf-8?q?v9fO3rGsqRjtC/OVS1xNw7Ld4bhJ4br+87/wfW4zduyL45Prca+73VOINeXJhMs5+?= =?utf-8?q?4NY2CbmIOj/meHub7uePAVW41OtDa3FA0y0XwF6uLaWofrLsa8ABkyDm40g6uedDE?= =?utf-8?q?b+EFdi8WT3Uf0BeeHxGf24YYx39ChOnw/ZsJi3f17LCaaH/5IdTKyfNo9KOJY7pb2?= =?utf-8?q?HKzsyx4tWNdsCnx0m7iQ4v2AD+8tyU3beoU1PE7GegjrqxnxLYtU3NeRt0QiQR8dI?= =?utf-8?q?QnAOzzbzoHVM0ZEWGagym7DZP/zvVA9y5iQCvJ1IdJi4Lh97Wcox3cQ=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: ab7e05a9-2c47-444c-a171-08dc18c25b18 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 07:43:41.1779 (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: a/uzbA6eWLclpL1Fw7+yy0O//C7v1Tgu4NNAnrWLN4d7kMYLq9YU0G4fxiD3odq3kEVvQaQZK/exT9QJyM5UvqYtRAmK74dhmQLuBKIjnDM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6578 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 Reviewed-by: Jeff LaBundy --- MAINTAINERS | 7 + drivers/input/Makefile | 2 +- drivers/input/touch-overlay.c | 250 ++++++++++++++++++++++++++++++++++++ include/linux/input/touch-overlay.h | 22 ++++ 4 files changed, 280 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index a7c4cf8201e0..668687bf94df 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -21961,6 +21961,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..42b6ad753a00 --- /dev/null +++ b/drivers/input/touch-overlay.c @@ -0,0 +1,250 @@ +// 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 touch_overlay_segment { + struct list_head list; + u32 x_origin; + u32 y_origin; + u32 x_size; + u32 y_size; + u32 key; + bool pressed; + int slot; +}; + +static int touch_overlay_get_segment(struct fwnode_handle *segment_node, + struct touch_overlay_segment *segment, + struct input_dev *input) +{ + 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; + + error = fwnode_property_read_u32(segment_node, "linux,code", + &segment->key); + if (!error) + input_set_capability(input, EV_KEY, segment->key); + else if (error != -EINVAL) + return error; + + 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 + * @input: pointer to the already allocated input_dev + * + * Returns 0 on success and error number otherwise. + * + * If buttons are defined, key capabilities are set accordingly. + */ +int touch_overlay_map(struct list_head *list, struct input_dev *input) +{ + struct fwnode_handle *overlay, *fw_segment; + struct device *dev = input->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; + fwnode_handle_put(overlay); + break; + } + error = touch_overlay_get_segment(fw_segment, segment, input); + if (error) { + fwnode_handle_put(overlay); + break; + } + list_add_tail(&segment->list, list); + } + + 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->key) { + *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->key) + return true; + } + + return false; +} +EXPORT_SYMBOL(touch_overlay_mapped_touchscreen); + +static bool touch_overlay_event_on_ts(struct list_head *list, u32 *x, u32 *y) +{ + struct touch_overlay_segment *segment; + struct list_head *ptr; + bool valid_touch = true; + + if (!x || !y) + return false; + + list_for_each(ptr, list) { + segment = list_entry(ptr, struct touch_overlay_segment, list); + if (segment->key) + continue; + + if (touch_overlay_segment_event(segment, *x, *y)) { + *x -= segment->x_origin; + *y -= segment->y_origin; + return true; + } + /* ignore touch events outside the defined area */ + valid_touch = false; + } + + return valid_touch; +} + +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->pressed && segment->slot == slot) { + segment->pressed = false; + input_report_key(input, segment->key, false); + input_sync(input); + return true; + } else if (contact && touch_overlay_segment_event(segment, *x, *y)) { + segment->pressed = true; + segment->slot = slot; + input_report_key(input, segment->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->key && + 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_event_on_ts(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..cef05c46000d --- /dev/null +++ b/include/linux/input/touch-overlay.h @@ -0,0 +1,22 @@ +/* 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 *input); + +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_process_event(struct list_head *list, struct input_dev *input, + u32 *x, u32 *y, u32 slot); + +#endif From patchwork Fri Jan 19 07:43:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13523390 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2043.outbound.protection.outlook.com [40.107.14.43]) (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 BA3DB28694; Fri, 19 Jan 2024 07:43:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.14.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705650231; cv=fail; b=rUzMTLyfCAYvWLzw/ordjmCPHafdGNdjzE1NBB69EcngykxgaTCFnlbhAsTcPG6p2Danl1o5VogbF2UpaFv4mwjU9jIK3apIhg7V6wedw47357zVf3gnYVKrgL4De+aC9bTs/gr3gb4Zbo7b7/ZBKIEXlXr8ckOVn3UbuibM/Ok= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705650231; c=relaxed/simple; bh=hvL4n2Dl3P/KD4PHi9ARJLtGktaktbtYa5lDp3HXvas=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=eLed+GxO/z1pT6bfQwVvnoaBuDfgYBCEU1e2iwKTufKeDx/WR81E9Nyd4pb9Oj+zIA3oaVut5Sa7uad+KA7qDw3BCH0Yi0qtZp0v12pBx5m7Thm63x+jn8EF98bKBvPLpur/xV23w9Wh6T2bdjvOm5eRxD3U9c745lWv94xH7ns= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net; spf=pass smtp.mailfrom=wolfvision.net; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b=mchJL3cP; arc=fail smtp.client-ip=40.107.14.43 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="mchJL3cP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i3hML/iHL8HhDqGXBzJ8rt8pXK4wCLUuBFzNM3N2oRRbNAaLTLlZAsjPzvFh1sELedX185UHh7seWHWJE5881fdhNMnAErfzybaGYsnonS5H0zWvw8aVrVkwCQQFHXpOcrQLIKxgLZWu94rUuXFBf8t98SvayFggxP7vgU/lJKbr1xX8xPlM1PcQYJfcdW63m9bfavR3Ut/lrUh0pcCkIw5TlM6Eex04Ts6Z0v/w7tOqrnb2tT0FxdC7daDgvIz+8p/tuZ8Ft0SNSCKgX7DMBtMkLAdOleZpwazIKn3K06pDbeYw0yFzGZwMmQr39hC4SRuTMvkGnSl8xVD+SP81xQ== 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=WwcSUkDHIxrh1gIuZO6QMX0u+NT+wLScv/Yxfan2SxQ=; b=ShqSUXlMs8X2AAWRIG7ySk/w5sU5jqZZtAK9Xj4eerhvz09o9HuPIIAATbyF/gpMnvrKe8gWF3qymw7DhAtlZUAVCM2HIlGyRvAFzRaEad1Jyi7U7bdYrXR5ZQfjNddmiE0O2I/NKr7Zzep7ZEPslz9L5sntHc7JQfUtfZF2+atV6oe7HadLi5ZFxVzvvbCPwcHvyBCzLM+MEYk3HFO8Mna19uqx+YuZuVx0yhEtmjkfmYZyZC1SiumMwa75xzskyyPPrf5vjEIhbcRN0K8/yeEufrl9os6KIxDtMCpfP36L0H9UxQrOuQSkSiYVYCnawTtPHV3lKznBUfcmcme5Aw== 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=WwcSUkDHIxrh1gIuZO6QMX0u+NT+wLScv/Yxfan2SxQ=; b=mchJL3cPFdnVE9UNhKOkKJnaDXkICr8MqVWbPczJX8ysmUC7lSbBiSbY9Ldn9StMx6tCKORHLV0ULWkQvAID7WNfFyqNwmbh281HL968k/yEWa/++TXUP1w8aafKkw6MbosaVZOSTTVQ7Q3bYpG0yC62uqH6sjegLIJFc1kAcY4= 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 AM8PR08MB6578.eurprd08.prod.outlook.com (2603:10a6:20b:36a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 07:43:42 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::c8ee:9414:a0c6:42ab]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::c8ee:9414:a0c6:42ab%6]) with mapi id 15.20.7202.024; Fri, 19 Jan 2024 07:43:42 +0000 From: Javier Carrasco Date: Fri, 19 Jan 2024 08:43:35 +0100 Subject: [PATCH v7 3/4] dt-bindings: input: touchscreen: st1232: add touch-overlay example Message-Id: <20240119-feature-ts_virtobj_patch-v7-3-eda70985808f@wolfvision.net> References: <20240119-feature-ts_virtobj_patch-v7-0-eda70985808f@wolfvision.net> In-Reply-To: <20240119-feature-ts_virtobj_patch-v7-0-eda70985808f@wolfvision.net> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Henrik Rydberg , Bastian Hecht , Michael Riesch , Jeff LaBundy Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org, Javier Carrasco , Rob Herring X-Mailer: b4 0.13-dev-4e032 X-Developer-Signature: v=1; a=ed25519-sha256; t=1705650218; l=2517; i=javier.carrasco@wolfvision.net; s=20230509; h=from:subject:message-id; bh=hvL4n2Dl3P/KD4PHi9ARJLtGktaktbtYa5lDp3HXvas=; b=2w0TanuP3rYwVb2fuex4PjUEbrKwJAy4TOXPr7yB2KvAPBgnAeCyPOO/PRf7lgjq6c6wVfXft d6cX4T8dpQJAgrssLsm4U3LS8O+bZJsYKRcUBAkzMI156sPIJmVC6HB X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-ClientProxiedBy: VI1PR0102CA0088.eurprd01.prod.exchangelabs.com (2603:10a6:803:15::29) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|AM8PR08MB6578:EE_ X-MS-Office365-Filtering-Correlation-Id: 06261025-8dfb-4479-745d-08dc18c25b8d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lEqpyRrSsawqF+hcka1AKLqUSdfDiXkPMVXZlm/hLBtnKhTazgzgUI/e6G1cKXbx8NFcmYujTvwiiU0M1vIli9BegVPA7SzzqqPai+3d4fT0AU560aq7x4017K4Lm2efyxyTFyaOCdyyJhirIWAh44RAxkwV+fygK3hXxsh97Bhsr467QR4DlyPiRCg09qq/HAKbJ7YJVR12oxJYSEfKfOHUwHIePBDaVsAEIu+hjEPNDOvqUSH8IOMp1B1cknNSmEVBXE3vLy2mFc/WXdP4lFpU6NvnRFHHgiJ0hYbLRV6ob2N9o5ZwaUAj4h7XVQUGnO+cF925aK8i6wnsVAKHVIw6YiOhaPd9R9J8S/CMQa3KSUGA0NXkWTH1HKvv4FfnfvH6F/EFSkumRq1YDb8OkxrDrFYVYN21Vprr+TyLG1rQJ8lZ6/eKJ4lHidl8F9Mb7di2P7Jm0ubjK+ZolKD31b/awS7WZ3Ywsyvg9CSrHi2LwlKVooqT7iZWP6bXWa/dburVKQWatEIYViHaKuPeRRi/SUKqE4ytGJRunaCPy6qYCsLKBy1sFBLU7zAAj0kM+bPwvYhG6TfZlMCQsBUREneim9fawVjJshGatVwFE/SvautmsglB7DimFb2r1keq 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)(136003)(376002)(396003)(346002)(39850400004)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(54906003)(2906002)(7416002)(4326008)(5660300002)(41300700001)(86362001)(38100700002)(478600001)(6486002)(36756003)(2616005)(6666004)(6506007)(6512007)(26005)(52116002)(316002)(8936002)(8676002)(44832011)(38350700005)(110136005)(66946007)(66556008)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?kRrkeIVcxlf7BFCsgPgnFbvJ5jXs?= =?utf-8?q?UI5dDce4iLl1GHzKFbPEfQ2HI1O9mWx2+SLWSUQFSCZVOgdbVutwrOoYu9Szs9ALp?= =?utf-8?q?doCz02Bhn39BtEXaellOKnNwPt5Uit4jAxfUK/DhDMCzxVL8IVBkVFf8w8zV57hKu?= =?utf-8?q?X0v5qPDRmjxNtiF92EAOvRaoDrXCEWbFCA76+JDGV19MeJFTMP7+U73rbnWRSil4X?= =?utf-8?q?VtSp8kBkHnjzkDZqrP/w3wSunvdXKVWjgOMuni1DHwUsgN6/p2EWmZ8iE1I9/2E90?= =?utf-8?q?cNllanMWbX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pgPXGW4NBpyleVIMue4RTZ7Sw30pnrbciKjZoZ/5eEMdDe8b04uljaDLk?= =?utf-8?q?q6Qd64q8IDJssl7ZA1OjlfhtsxzRy1Kr/Shl5sbVodgSSpOtcXYsLVDNrqxSwUmKi?= =?utf-8?q?82252z+9w+s736UVTEUJCLRFcyIMC5bN+aqU8XJNm+PJ9lKoXPcKlX2Elh/xOTVxg?= =?utf-8?q?A3CWDnQQbfKX8NOmeS4J28RySLZquht1ZR2dqr02pR/lPh+MszdgkSimgDylj6Mci?= =?utf-8?q?gBr/34EDj2qW7lwAVU1++i5qhbvHFA+2ITuerOYKEa08jURL2v232iX0aPBegXgNk?= =?utf-8?q?KAz1BwbjPokS+QzKEudfnTXzIYHX0ZO7+9gpa2KrBGkgTSsQZTZUVi3bJ2EcnnzTL?= =?utf-8?q?h2WBI1m+rf9vYc2EeyJfKs5PFFABWf3Z8TEgwxIuHCnN5cOmfAywOxc=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 06261025-8dfb-4479-745d-08dc18c25b8d X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 07:43:41.9516 (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: ODHvnXwe3NbhSBlIs6uQ7SKj5PhSjGut2v0kiB/80dwjGG5A+rbt5Q2W2FYWqg13OAgT+HfRqNOKOdddk5NnyqXtuZLdCD+OtnuYaiIQs+A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6578 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. Reviewed-by: Rob Herring Signed-off-by: Javier Carrasco --- .../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 Fri Jan 19 07:43:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13523391 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2043.outbound.protection.outlook.com [40.107.14.43]) (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 93A0028E1E; Fri, 19 Jan 2024 07:43:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.14.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705650233; cv=fail; b=nYaPyD1Gq9+XotbgxiZOcKVKrIvTx1nxmLX/TygUkzX3JZbW9cwouwlhv5heUVNGj1snBgEfsS+r73/PshcCtHwy2otDXlVoLt7uSYLAweWUyKvE3pfWjAapxTuWjtZeZpaQRAOD5hvsnZnzQfCkG6dpEKurre27nzv6jWDBDvw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705650233; c=relaxed/simple; bh=8ZCwLODssVe58IJ/RKNeTtBq1x6Smnd905NV4m4CNXo=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=LKX9gFikdqWGJA5m6WUIwvY12dNhnYw0XV8xWch8KCcUFwyWW42lRqY7xCUc+uYDwAuC1Vl2ZPgTA6uHT8mYOBgcTbHlLzX/wzi9/cPJ7MLYS5D0GzRE068jynELYEIhqVCXVwQLVowRJ1V42W+Ip2/SyX4/AxrjZRhGuAtN4JM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net; spf=pass smtp.mailfrom=wolfvision.net; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b=p1Q/n2Nw; arc=fail smtp.client-ip=40.107.14.43 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="p1Q/n2Nw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JZO4KRyQYt9UsfjEQOpWLTxlolaDJk+6LPI48UH8JdMiYwxfxnQOuNoSpZdh/EXw2E6/rfg5zt3qfwziQMCj1oGSbJbnBdEmdY33hpqXoFwX67QbyA3YrEXI3P6ydIf55Jk4kU1g84CUZSVdCmxLtYrekr/yNifKPE96CKaamkgbT+lIpkkhZISADJdtup06qRCTlnyIlgb9VF9TYMfN/iEu7YzYaHyrBiv5Fow08EDjY2b4JoXAhiI0gPWWC7Fq6GRPzzD5vmCxwDzXQ6y8Oaa+jf8zcs9Rto8q1x+I+6kGZZqsYGAChtROKlzkwqIVcgPiZEZyQYgHhvap6n6gXQ== 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=j/pOwDYwfpSMY0Ty5wfbusqYghdBkhPgGizdIHn9Z6w=; b=Dx9xNJwVo3qmIrK6+ZYP2PNgLS1QP7o1tXgfVR9KTi38CwiZliN74TlK0vQg3q9hUt/AXbxpdUA5ZKDpQ4htKhkBgSYwwRE7Rc7fzuYzgSxVJKZbBxYYfhQHQl7yP96Sywr6gn3L4uegh9FvxdcOTlzIaVBEJrwK0LGqWWHLh5BRFkjrVFS5BKbQ2moZ/610Iui5FZgueTpRpniBM+ojfhOYnCXw7AKVV88UW2MuX7daVNuYOaYTBDGnD5z9R36z4mjDRo0YqpZsz52rPBGBbk2puR9qty6dUcBRmZi+LIIYmB2NANgXG6/G7pQJRCJDtY96NJYzUxJGsO1bkEv3hA== 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=j/pOwDYwfpSMY0Ty5wfbusqYghdBkhPgGizdIHn9Z6w=; b=p1Q/n2NwDqoSR0pm21selj1nq69jAfUW/uE9G8pVB3NO214f7Ah19ww3geN/aPJdLYvPTmgXPP9Xo8CNH0gotfekK+cys/GdiGqHLdSN5EpUeYzMq4LLU6o48KWvFLW64LcMAlHEISLavPRiuKhi2c3tQPlSulQCtPyr921pKnE= 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 AM8PR08MB6578.eurprd08.prod.outlook.com (2603:10a6:20b:36a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 07:43:42 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::c8ee:9414:a0c6:42ab]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::c8ee:9414:a0c6:42ab%6]) with mapi id 15.20.7202.024; Fri, 19 Jan 2024 07:43:42 +0000 From: Javier Carrasco Date: Fri, 19 Jan 2024 08:43:36 +0100 Subject: [PATCH v7 4/4] Input: st1232 - add touch overlays handling Message-Id: <20240119-feature-ts_virtobj_patch-v7-4-eda70985808f@wolfvision.net> References: <20240119-feature-ts_virtobj_patch-v7-0-eda70985808f@wolfvision.net> In-Reply-To: <20240119-feature-ts_virtobj_patch-v7-0-eda70985808f@wolfvision.net> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Henrik Rydberg , Bastian Hecht , Michael Riesch , Jeff LaBundy Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.13-dev-4e032 X-Developer-Signature: v=1; a=ed25519-sha256; t=1705650218; l=3410; i=javier.carrasco@wolfvision.net; s=20230509; h=from:subject:message-id; bh=8ZCwLODssVe58IJ/RKNeTtBq1x6Smnd905NV4m4CNXo=; b=Bsze/vswBYZq/N3RY5sCRFd4ol6ZvkcCTPlWeRyxFygRvOKtuzVQaiBnM8SJSibUnIuqfajT1 8MiWN5CSpioBojsvsS8eA1EO2LNxetHQaweU05XQs2pCaeq7CDMrrmb X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-ClientProxiedBy: VI1PR0102CA0088.eurprd01.prod.exchangelabs.com (2603:10a6:803:15::29) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|AM8PR08MB6578:EE_ X-MS-Office365-Filtering-Correlation-Id: 06961663-92f8-4436-e527-08dc18c25bff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6iGXlA1Tb/fKoxAFHsvQ63bmCzpO4JXC8ZlZS7GQLEkN2CJmLjyAUJwXIc1AVIUbMGPU8wd13ZP5YrzwKUqv1Q+DreHTcavnRkgpe9yH4oS/QN3mrWIIoft6ihxexxwVioa0Et/VenvUkDebABzUv2CMkmvaPIbCbl2qHhTZ+edlge7udIZQRuvUcE/6rT05peQ9ZPcJnANqaLaNAmaqpjT19QIc1tWXbl1vzP0IWMrAEloE4uK7BxD5ijY6NrkF9CSocIiAFpdMpr+6JsDw4TgYZAeDW/Qf/z4KOywLmanevjpeV9jWD47rA1HQS0euU+N+o50H+exuWmN86TamOxt1osg/9VMV5sh67hZSC0y5sth6jXC8AEXVXdj/I91SRZlSvKHqS+oq6fwxTbreihgwysFTj+GenUVh1h8T5SdRzGsOnSkjK9Fz1iXYzZGM7Fw6T0DAskvRe7W89AarSeoew+L8dbL7bijoXBbXKYasyt2HBrs/g8qkjFVrKWhJPSJ11hhFW7hrKaSISu/mqxwcQCxP1P0nH5OfvObsEeoMdAt5b+N5VIAwM5M8mCI+k+d098AS8BuOHzTANJiJV34up7Bal5p8tiDiudqG3kbKRtNxqH1fYB81DJZkKAA8 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)(136003)(376002)(396003)(346002)(39850400004)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(2906002)(7416002)(4326008)(5660300002)(41300700001)(86362001)(38100700002)(478600001)(6486002)(36756003)(107886003)(83380400001)(2616005)(6666004)(6506007)(6512007)(26005)(52116002)(316002)(8936002)(8676002)(44832011)(38350700005)(110136005)(66946007)(66556008)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?U0LoFJ10tTt3Ro4vnvPnIRJRLGT+?= =?utf-8?q?nssP+HYtyLwSwkcf8sHAJQMkQua90G5ts7ztOy4eGAYMZrsCz31lUbz7n6fO0I420?= =?utf-8?q?XKzLPCXUDUy00flH7xD9cfliN6VLpMiUU3CsPPU/ECSnQ0zLPtfehpeNwg7wNhzKS?= =?utf-8?q?x/TnkNa3xxTCIbC2aH8xcXSReuzEXxYatU7p47Rm8GjFYfhr4BFS6nlQ7N++9QNeC?= =?utf-8?q?GG2DXHQBgogRnH1Hm4Ws0QZ+wGVVmwrVieb8ycrEcBdRkPpBb7oynsLWV6eJnRA9b?= =?utf-8?q?cORiKSZnF1MVd+gGansEXUwYAMQB3LbAVnv24qgTQ7v5APSBEUgrJiH7W67QO+Wyy?= =?utf-8?q?QMh7W0doKWHbntK/u1s/lmpWDMfXrwDgKI2wXNPhrAIaendficIEOnl8wsD5PuWvC?= =?utf-8?q?wzKZO+2hTGTSGj5fIOEmv76fWhbbFC/7uwOi8ERQ+AEJmdDbiYyEc/godFGgFK5nB?= =?utf-8?q?db2B9p3edI48bNzkM1vaDvpXFEdzYos74w93g1LzHyLcHFYYHMv8uBXGdKnzYyNlq?= =?utf-8?q?qwLRp7Xx+bLz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MENNmzv5y6bahdQfSdJfEOg1JZJ60bxdXy2bAwFVkyKM?= =?utf-8?q?TZQ3/u6Hc/A2uGgY9CDzsVu78nKk4XwpUlyE4lFxV8NZmivg72V/XggeKUNjem1fU?= =?utf-8?q?DxAUGHvs2UIyxsN4fqNMkszs9PmZYUvaCIhweey8eBy65MKjFr3BiWQ=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 06961663-92f8-4436-e527-08dc18c25bff X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 07:43:42.7440 (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: YgyZ4ny1bH2B7C/425u61TV8G9fiopr6az+tY5yVbEj+yBHgxjIEX6b+SKmYvxpiJe1/rybic/wVxEc+go9DnY61x+1Rih9HYJqNkdBOiEY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6578 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 Reviewed-by: Jeff LaBundy --- drivers/input/touchscreen/st1232.c | 48 +++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c index 6475084aee1b..4fa31447dbc1 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" @@ -57,6 +58,7 @@ struct st1232_ts_data { struct dev_pm_qos_request low_latency_req; struct gpio_desc *reset_gpio; const struct st_chip_info *chip_info; + struct list_head touch_overlay_list; int read_buf_len; u8 *read_buf; }; @@ -138,14 +140,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, input, + 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]; @@ -292,18 +300,30 @@ static int st1232_ts_probe(struct i2c_client *client) 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, input_dev); + 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,